Panda3D
Classes | Public Member Functions | Public Attributes | Static Public Attributes

Actor Class Reference

Inheritance diagram for Actor:
DistributedActor

List of all members.

Classes

class  AnimDef
class  PartDef
class  SubpartDef

Public Member Functions

def __init__
def __cmp__
def __str__
def cleanup
def clearPythonData
def copyActor
def delete
def flush
def getActorInfo
def getAnimControlDict
def getAnimNames
def getGeomNode
def getLODNames
def getLODNode
def getPartBundleDict
def getPartBundles
def getPartNames
def listJoints
def pprint
def removeAnimControlDict
def removeNode
def setGeomNode
def setLODNode
def useLOD

Public Attributes

 Actor_deleted
 Actor_initialized
 allowAsyncBind
 gotName
 mergeLODBundles
 switches

Static Public Attributes

tuple animLoaderOptions
tuple modelLoaderOptions
tuple notify = directNotify.newCategory("Actor")
string partPrefix = "__Actor_"
tuple validateSubparts = ConfigVariableBool('validate-subparts', True)

Detailed Description

Actor class: Contains methods for creating, manipulating
and playing animations on characters

Constructor & Destructor Documentation

def __init__ (   self,
  models = None,
  anims = None,
  other = None,
  copy = True,
  lodNode = None,
  flattenable = True,
  setFinal = False,
  mergeLODBundles = None,
  allowAsyncBind = None,
  okMissing = None 
)
__init__(self, string | string:string{}, string:string{} |
string:(string:string{}){}, Actor=None)
Actor constructor: can be used to create single or multipart
actors. If another Actor is supplied as an argument this
method acts like a copy constructor. Single part actors are
created by calling with a model and animation dictionary
(animName:animPath{}) as follows:

   a = Actor("panda-3k.egg", {"walk":"panda-walk.egg" \
                      "run":"panda-run.egg"})

This could be displayed and animated as such:

   a.reparentTo(render)
   a.loop("walk")
   a.stop()

Multipart actors expect a dictionary of parts and a dictionary
of animation dictionaries (partName:(animName:animPath{}){}) as
below:

    a = Actor(

# part dictionary
{"head":"char/dogMM/dogMM_Shorts-head-mod", \
 "torso":"char/dogMM/dogMM_Shorts-torso-mod", \
 "legs":"char/dogMM/dogMM_Shorts-legs-mod"}, \

# dictionary of anim dictionaries
{"head":{"walk":"char/dogMM/dogMM_Shorts-head-walk", \
         "run":"char/dogMM/dogMM_Shorts-head-run"}, \
 "torso":{"walk":"char/dogMM/dogMM_Shorts-torso-walk", \
          "run":"char/dogMM/dogMM_Shorts-torso-run"}, \
 "legs":{"walk":"char/dogMM/dogMM_Shorts-legs-walk", \
         "run":"char/dogMM/dogMM_Shorts-legs-run"} \
 })

In addition multipart actor parts need to be connected together
in a meaningful fashion:

    a.attach("head", "torso", "joint-head")
    a.attach("torso", "legs", "joint-hips")

#
# ADD LOD COMMENT HERE!
#

Other useful Actor class functions:

    #fix actor eye rendering
    a.drawInFront("joint-pupil?", "eyes*")

    #fix bounding volumes - this must be done after drawing
    #the actor for a few frames, otherwise it has no effect
    a.fixBounds()

Member Function Documentation

def __cmp__ (   self,
  other 
)
def __str__ (   self)
Actor print function
def cleanup (   self)
Actor cleanup function
def clearPythonData (   self)
def copyActor (   self,
  other,
  overwrite = False 
)
def delete (   self)

Reimplemented in DistributedActor.

def flush (   self)
Actor flush function
def getActorInfo (   self)
Utility function to create a list of information about an actor.
Useful for iterating over details of an actor.
def getAnimControlDict (   self)
def getAnimNames (   self)
def getGeomNode (   self)
Return the node that contains all actor geometry
def getLODNames (   self)
Return list of Actor LOD names. If not an LOD actor,
returns 'lodRoot'
Caution - this returns a reference to the list - not your own copy
def getLODNode (   self)
Return the node that switches actor geometry in and out
def getPartBundleDict (   self)
def getPartBundles (   self,
  partName = None 
)
Returns a list of PartBundle objects for the entire Actor,
or for the indicated part only. 
def getPartNames (   self)
Return list of Actor part names. If not an multipart actor,
returns 'modelRoot' NOTE: returns parts of arbitrary LOD
def listJoints (   self,
  partName = "modelRoot",
  lodName = "lodRoot" 
)
Handy utility function to list the joint hierarchy of the
actor. 
def pprint (   self)
Pretty print actor's details
def removeAnimControlDict (   self)
def removeNode (   self)
def setGeomNode (   self,
  node 
)
Set the node that contains all actor geometry
def setLODNode (   self,
  node = None 
)
Set the node that switches actor geometry in and out.
If one is not supplied as an argument, make one
def useLOD (   self,
  lodName 
)
Make the Actor ONLY display the given LOD

Member Data Documentation

tuple animLoaderOptions [static]
Initial value:
LoaderOptions(LoaderOptions.LFSearch |
                                       LoaderOptions.LFReportErrors |
                                       LoaderOptions.LFConvertAnim)
tuple modelLoaderOptions [static]
Initial value:
LoaderOptions(LoaderOptions.LFSearch |
                                       LoaderOptions.LFReportErrors |
                                       LoaderOptions.LFConvertSkeleton)
tuple notify = directNotify.newCategory("Actor") [static]
string partPrefix = "__Actor_" [static]
tuple validateSubparts = ConfigVariableBool('validate-subparts', True) [static]
 All Classes Namespaces Functions Variables Properties