Panda3D
Classes | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Actor Class Reference
Inheritance diagram for Actor:
DirectObject DistributedActor

Classes

class  AnimDef
 
class  PartDef
 
class  SubpartDef
 

Public Member Functions

def __init__ (self, models=None, anims=None, other=None, copy=True, lodNode=None, flattenable=True, setFinal=False, mergeLODBundles=None, allowAsyncBind=None, okMissing=None)
 
def __cmp__ (self, other)
 
def __str__ (self)
 
def cleanup (self)
 
def clearPythonData (self)
 
def copyActor (self, other, overwrite=False)
 
def delete (self)
 
def flush (self)
 
def getActorInfo (self)
 
def getAnimControlDict (self)
 
def getAnimNames (self)
 
def getGeomNode (self)
 
def getLODNames (self)
 
def getLODNode (self)
 
def getPartBundleDict (self)
 
def getPartBundles (self, partName=None)
 
def getPartNames (self)
 
def listJoints (self, partName="modelRoot", lodName="lodRoot")
 
def pprint (self)
 
def removeAnimControlDict (self)
 
def removeNode (self)
 
def setGeomNode (self, node)
 
def setLODNode (self, node=None)
 
def useLOD (self, lodName)
 
- Public Member Functions inherited from DirectObject
def __init__ (self)
 
def accept (self, event, method, extraArgs=[])
 
def acceptOnce (self, event, method, extraArgs=[])
 
def addTask (self, args, kwargs)
 
def detectLeaks (self)
 
def doMethodLater (self, args, kwargs)
 
def getAllAccepting (self)
 
def ignore (self, event)
 
def ignoreAll (self)
 
def isAccepting (self, event)
 
def isIgnoring (self, event)
 
def removeAllTasks (self)
 
def removeTask (self, taskOrName)
 

Public Attributes

 Actor_deleted
 
 Actor_initialized
 
 gotName
 
 switches
 

Static Public Attributes

 allowAsyncBind = ConfigVariableBool('allow-async-bind', True)
 
 animLoaderOptions
 
 mergeLODBundles = ConfigVariableBool('merge-lod-bundles', True)
 
 modelLoaderOptions
 
 notify = DirectNotifyGlobal.directNotify.newCategory("Actor")
 
string partPrefix = "__Actor_"
 
 validateSubparts = ConfigVariableBool('validate-subparts', True)
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __init__()

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

◆ __cmp__()

def __cmp__ (   self,
  other 
)

◆ __str__()

def __str__ (   self)
Actor print function

◆ cleanup()

def cleanup (   self)
Actor cleanup function

◆ clearPythonData()

def clearPythonData (   self)

◆ copyActor()

def copyActor (   self,
  other,
  overwrite = False 
)

◆ delete()

def delete (   self)

◆ flush()

def flush (   self)
Actor flush function

◆ getActorInfo()

def getActorInfo (   self)
Utility function to create a list of information about an actor.
Useful for iterating over details of an actor.

◆ getAnimControlDict()

def getAnimControlDict (   self)

◆ getAnimNames()

def getAnimNames (   self)

◆ getGeomNode()

def getGeomNode (   self)
Return the node that contains all actor geometry

◆ getLODNames()

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

◆ getLODNode()

def getLODNode (   self)
Return the node that switches actor geometry in and out

◆ getPartBundleDict()

def getPartBundleDict (   self)

◆ getPartBundles()

def getPartBundles (   self,
  partName = None 
)
Returns a list of PartBundle objects for the entire Actor,
or for the indicated part only. 

◆ getPartNames()

def getPartNames (   self)
Return list of Actor part names. If not an multipart actor,
returns 'modelRoot' NOTE: returns parts of arbitrary LOD

◆ listJoints()

def listJoints (   self,
  partName = "modelRoot",
  lodName = "lodRoot" 
)
Handy utility function to list the joint hierarchy of the
actor. 

◆ pprint()

def pprint (   self)
Pretty print actor's details

◆ removeAnimControlDict()

def removeAnimControlDict (   self)

◆ removeNode()

def removeNode (   self)

◆ setGeomNode()

def setGeomNode (   self,
  node 
)
Set the node that contains all actor geometry

◆ setLODNode()

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

◆ useLOD()

def useLOD (   self,
  lodName 
)
Make the Actor ONLY display the given LOD

Member Data Documentation

◆ Actor_deleted

Actor_deleted

◆ Actor_initialized

Actor_initialized

◆ allowAsyncBind

allowAsyncBind = ConfigVariableBool('allow-async-bind', True)
static

◆ animLoaderOptions

animLoaderOptions
static
Initial value:
= LoaderOptions(LoaderOptions.LFSearch |
LoaderOptions.LFReportErrors |
LoaderOptions.LFConvertAnim)

◆ gotName

gotName

◆ mergeLODBundles

mergeLODBundles = ConfigVariableBool('merge-lod-bundles', True)
static

◆ modelLoaderOptions

modelLoaderOptions
static
Initial value:
= LoaderOptions(LoaderOptions.LFSearch |
LoaderOptions.LFReportErrors |
LoaderOptions.LFConvertSkeleton)

◆ notify

notify = DirectNotifyGlobal.directNotify.newCategory("Actor")
static

◆ partPrefix

string partPrefix = "__Actor_"
static

◆ switches

switches

◆ validateSubparts

validateSubparts = ConfigVariableBool('validate-subparts', True)
static