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 actorInterval (self, *args, **kw)
 
def addLOD (self, lodName, inDist=0, outDist=0, center=None)
 
def animPanel (self)
 
def attach (self, partName, anotherPartName, jointName, lodName="lodRoot")
 
def bindAllAnims (self, allowAsyncBind=False)
 
def bindAnim (self, animName, partName=None, lodName=None, allowAsyncBind=False)
 
def cleanup (self)
 
def clearLODAnimation (self)
 
def clearPythonData (self)
 
def controlJoint (self, node, partName, jointName, lodName="lodRoot")
 
def copyActor (self, other, overwrite=False)
 
def delete (self)
 
def disableBlend (self, partName=None)
 
def drawInFront (self, frontPartName, backPartName, mode, root=None, lodName=None)
 
def enableBlend (self, blendType=PartBundle.BTNormalizedLinear, partName=None)
 
def exposeJoint (self, node, partName, jointName, lodName="lodRoot", localTransform=0)
 
def faceAwayFromViewer (self)
 
def faceTowardsViewer (self)
 
def fixBounds (self, partName=None)
 
def fixBounds_old (self, part=None)
 
def flush (self)
 
def freezeJoint (self, partName, jointName, transform=None, pos=Vec3(0, 0, 0), hpr=Vec3(0, 0, 0), scale=Vec3(1, 1, 1))
 
def getActorInfo (self)
 
def getAnimBlends (self, animName=None, partName=None, lodName=None)
 
def getAnimControl (self, animName, partName=None, lodName=None, allowAsyncBind=True)
 
def getAnimControlDict (self)
 
def getAnimControls (self, animName=None, partName=None, lodName=None, allowAsyncBind=True)
 
def getAnimFilename (self, animName, partName='modelRoot')
 
def getAnimNames (self)
 
def getBaseFrameRate (self, animName=None, partName=None)
 
def getCurrentAnim (self, partName=None)
 
def getCurrentFrame (self, animName=None, partName=None)
 
def getDuration (self, animName=None, partName=None, fromFrame=None, toFrame=None)
 
def getFrameRate (self, animName=None, partName=None)
 
def getFrameTime (self, anim, frame, partName=None)
 
def getGeomNode (self)
 
def getJoints (self, partName=None, jointName=' *', lodName=None)
 
def getJointTransform (self, partName, jointName, lodName='lodRoot')
 
def getJointTransformState (self, partName, jointName, lodName='lodRoot')
 
def getLOD (self, lodName)
 
def getLODIndex (self, lodName)
 
def getLODNames (self)
 
def getLODNode (self)
 
def getNumFrames (self, animName=None, partName=None)
 
def getOverlappingJoints (self, partNameA, partNameB, jointName=' *', lodName=None)
 
def getPart (self, partName, lodName="lodRoot")
 
def getPartBundle (self, partName, lodName="lodRoot")
 
def getPartBundleDict (self)
 
def getPartBundles (self, partName=None)
 
def getPartNames (self)
 
def getPlayRate (self, animName=None, partName=None)
 
def getSubpartsComplete (self)
 
def hasLOD (self)
 
def hideAllBounds (self)
 
def hidePart (self, partName, lodName="lodRoot")
 
def initAnimsOnAllLODs (self, partNames)
 
def instance (self, path, partName, jointName, lodName="lodRoot")
 
def listJoints (self, partName="modelRoot", lodName="lodRoot")
 
def loadAnims (self, anims, partName="modelRoot", lodName="lodRoot")
 
def loadAnimsOnAllLODs (self, anims, partName="modelRoot")
 
def loadModel (self, modelPath, partName="modelRoot", lodName="lodRoot", copy=True, okMissing=None, autoBindAnims=True)
 
def loop (self, animName, restart=1, partName=None, fromFrame=None, toFrame=None)
 
def makeSubpart (self, partName, includeJoints, excludeJoints=[], parent="modelRoot", overlapping=False)
 
def osdAnimBlends (self, animName=None, partName=None, lodName=None)
 
def pingpong (self, animName, restart=1, partName=None, fromFrame=None, toFrame=None)
 
def play (self, animName, partName=None, fromFrame=None, toFrame=None)
 
def pose (self, animName, frame, partName=None, lodName=None)
 
def postFlatten (self)
 
def pprint (self)
 
def printAnimBlends (self, animName=None, partName=None, lodName=None)
 
def printLOD (self)
 
def releaseJoint (self, partName, jointName)
 
def removeAnimControlDict (self)
 
def removeNode (self)
 
def removePart (self, partName, lodName="lodRoot")
 
def renamePartBundles (self, partName, newBundleName)
 
def resetLOD (self)
 
def setBlend (self, animBlend=None, frameBlend=None, blendType=None, partName=None)
 
def setCenter (self, center)
 
def setControlEffect (self, animName, effect, partName=None, lodName=None)
 
def setGeomNode (self, node)
 
def setLOD (self, lodName, inDist=0, outDist=0)
 
def setLODAnimation (self, farDistance, nearDistance, delayFactor)
 
def setLODNode (self, node=None)
 
def setPlayRate (self, rate, animName, partName=None)
 
def setSubpartsComplete (self, flag)
 
def showAllBounds (self)
 
def showAllParts (self, partName, lodName="lodRoot")
 
def showPart (self, partName, lodName="lodRoot")
 
def stop (self, animName=None, partName=None)
 
def stopJoint (self, partName, jointName, lodName="lodRoot")
 
def unloadAnims (self, anims=None, partName=None, lodName=None)
 
def update (self, lod=0, partName=None, lodName=None, force=False)
 
def useLOD (self, lodName)
 
def verifySubpartsComplete (self, partName=None, lodName=None)
 
def waitPending (self, partName=None)
 
- 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
 
 loader
 
 switches
 

Static Public Attributes

def actor_interval = actorInterval
 
def add_lod = addLOD
 
 allowAsyncBind = ConfigVariableBool('allow-async-bind', True)
 
def anim_panel = animPanel
 
 animLoaderOptions
 
def bind_all_anims = bindAllAnims
 
def bind_anim = bindAnim
 
def clear_lod_animation = clearLODAnimation
 
def clear_python_data = clearPythonData
 
def control_joint = controlJoint
 
def copy_actor = copyActor
 
def disable_blend = disableBlend
 
def draw_in_front = drawInFront
 
def enable_blend = enableBlend
 
def expose_joint = exposeJoint
 
def face_away_from_viewer = faceAwayFromViewer
 
def face_towards_viewer = faceTowardsViewer
 
def fix_bounds = fixBounds
 
def fix_bounds_old = fixBounds_old
 
def freeze_joint = freezeJoint
 
def get_actor_info = getActorInfo
 
def get_anim_blends = getAnimBlends
 
def get_anim_control = getAnimControl
 
def get_anim_control_dict = getAnimControlDict
 
def get_anim_controls = getAnimControls
 
def get_anim_filename = getAnimFilename
 
def get_anim_names = getAnimNames
 
def get_base_frame_rate = getBaseFrameRate
 
def get_current_anim = getCurrentAnim
 
def get_current_frame = getCurrentFrame
 
def get_duration = getDuration
 
def get_frame_rate = getFrameRate
 
def get_frame_time = getFrameTime
 
def get_geom_node = getGeomNode
 
def get_joint_transform = getJointTransform
 
def get_joint_transform_state = getJointTransformState
 
def get_joints = getJoints
 
def get_lod = getLOD
 
def get_lod_index = getLODIndex
 
def get_lod_names = getLODNames
 
def get_lod_node = getLODNode
 
def get_num_frames = getNumFrames
 
def get_overlapping_joints = getOverlappingJoints
 
def get_part = getPart
 
def get_part_bundle = getPartBundle
 
def get_part_bundle_dict = getPartBundleDict
 
def get_part_bundles = getPartBundles
 
def get_part_names = getPartNames
 
def get_play_rate = getPlayRate
 
def get_subparts_complete = getSubpartsComplete
 
def has_lod = hasLOD
 
def hide_all_bounds = hideAllBounds
 
def hide_part = hidePart
 
def init_anims_on_all_lods = initAnimsOnAllLODs
 
def list_joints = listJoints
 
def load_anims = loadAnims
 
def load_anims_on_all_lods = loadAnimsOnAllLODs
 
def load_model = loadModel
 
def make_subpart = makeSubpart
 
 mergeLODBundles = ConfigVariableBool('merge-lod-bundles', True)
 
 modelLoaderOptions
 
 notify = DirectNotifyGlobal.directNotify.newCategory("Actor")
 
def osd_anim_blends = osdAnimBlends
 
string partPrefix = "__Actor_"
 
def post_flatten = postFlatten
 
def print_anim_blends = printAnimBlends
 
def print_lod = printLOD
 
def release_joint = releaseJoint
 
def remove_anim_control_dict = removeAnimControlDict
 
def remove_node = removeNode
 
def remove_part = removePart
 
def rename_part_bundles = renamePartBundles
 
def reset_lod = resetLOD
 
def set_blend = setBlend
 
def set_center = setCenter
 
def set_control_effect = setControlEffect
 
def set_geom_node = setGeomNode
 
def set_lod = setLOD
 
def set_lod_animation = setLODAnimation
 
def set_lod_node = setLODNode
 
def set_play_rate = setPlayRate
 
def set_subparts_complete = setSubpartsComplete
 
def show_all_bounds = showAllBounds
 
def show_all_parts = showAllParts
 
def show_part = showPart
 
def stop_joint = stopJoint
 
def unload_anims = unloadAnims
 
def use_lod = useLOD
 
 validateSubparts = ConfigVariableBool('validate-subparts', True)
 
def verify_subparts_complete = verifySubpartsComplete
 
def wait_pending = waitPending
 
- Static Public Attributes inherited from DirectObject
def accept_once = acceptOnce
 
def add_task = addTask
 
def detect_leaks = detectLeaks
 
def do_method_later = doMethodLater
 
def get_all_accepting = getAllAccepting
 
def ignore_all = ignoreAll
 
def is_accepting = isAccepting
 
def is_ignoring = isIgnoring
 
def remove_all_tasks = removeAllTasks
 
def remove_task = removeTask
 

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 
)
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

◆ actorInterval()

def actorInterval (   self,
args,
**  kw 
)

◆ addLOD()

def addLOD (   self,
  lodName,
  inDist = 0,
  outDist = 0,
  center = None 
)
addLOD(self, string)
Add a named node under the LODNode to parent all geometry
of a specific LOD under.

◆ animPanel()

def animPanel (   self)

◆ attach()

def attach (   self,
  partName,
  anotherPartName,
  jointName,
  lodName = "lodRoot" 
)
attach(self, string, string, string, key="lodRoot")
Attach one actor part to another at a joint called jointName

◆ bindAllAnims()

def bindAllAnims (   self,
  allowAsyncBind = False 
)
Loads and binds all animations that have been defined for
the Actor. 

◆ bindAnim()

def bindAnim (   self,
  animName,
  partName = None,
  lodName = None,
  allowAsyncBind = False 
)
Binds the named animation to the named part and/or lod.  If
allowAsyncBind is False, this guarantees that the animation is
bound immediately--the animation is never bound in a
sub-thread; it will be loaded and bound in the main thread, so
it will be available by the time this method returns.

The parameters are the same as that for getAnimControls().  In
fact, this method is a thin wrapper around that other method.

Use this method if you need to ensure that an animation is
available before you start to play it, and you don't mind
holding up the render for a frame or two until the animation
is available.

◆ cleanup()

def cleanup (   self)
This method should be called when intending to destroy the Actor, and
cleans up any additional resources stored on the Actor class before
removing the underlying node using `removeNode()`.

Note that `removeNode()` itself is not sufficient to destroy actors,
which is why this method exists.

◆ clearLODAnimation()

def clearLODAnimation (   self)
 Description: Undoes the effect of a recent call to
set_lod_animation().  Henceforth, the character will animate
every frame, regardless of its distance from the camera.

◆ clearPythonData()

def clearPythonData (   self)

◆ controlJoint()

def controlJoint (   self,
  node,
  partName,
  jointName,
  lodName = "lodRoot" 
)
The converse of exposeJoint: this associates the joint with
the indicated node, so that the joint transform will be copied
from the node to the joint each frame.  This can be used for
programmer animation of a particular joint at runtime.

The parameter node should be the NodePath for the node whose
transform will animate the joint.  If node is None, a new node
will automatically be created and loaded with the joint's
initial transform.  In either case, the node used will be
returned.

It used to be necessary to call this before any animations
have been loaded and bound, but that is no longer so.

◆ copyActor()

def copyActor (   self,
  other,
  overwrite = False 
)

◆ delete()

def delete (   self)

Reimplemented in DistributedActor.

◆ disableBlend()

def disableBlend (   self,
  partName = None 
)
Restores normal one-animation-at-a-time operation after a
previous call to enableBlend().

This method is deprecated.  You should use setBlend() instead.

◆ drawInFront()

def drawInFront (   self,
  frontPartName,
  backPartName,
  mode,
  root = None,
  lodName = None 
)
drawInFront(self, string, int, string=None, key=None)

Arrange geometry so the frontPart(s) are drawn in front of
backPart.

If mode == -1, the geometry is simply arranged to be drawn in
the correct order, assuming it is already under a
direct-render scene graph (like the DirectGui system).  That
is, frontPart is reparented to backPart, and backPart is
reordered to appear first among its siblings.

If mode == -2, the geometry is arranged to be drawn in the
correct order, and depth test/write is turned off for
frontPart.

If mode == -3, frontPart is drawn as a decal onto backPart.
This assumes that frontPart is mostly coplanar with and does
not extend beyond backPart, and that backPart is mostly flat
(not self-occluding).

If mode > 0, the frontPart geometry is placed in the 'fixed'
bin, with the indicated drawing order.  This will cause it to
be drawn after almost all other geometry.  In this case, the
backPartName is actually unused.

Takes an optional argument root as the start of the search for the
given parts. Also takes optional lod name to refine search for the
named parts. If root and lod are defined, we search for the given
root under the given lod.

◆ enableBlend()

def enableBlend (   self,
  blendType = PartBundle.BTNormalizedLinear,
  partName = None 
)
Enables blending of multiple animations simultaneously.
After this is called, you may call play(), loop(), or pose()
on multiple animations and have all of them contribute to the
final pose each frame.

With blending in effect, starting a particular animation with
play(), loop(), or pose() does not implicitly make the
animation visible; you must also call setControlEffect() for
each animation you wish to use to indicate how much each
animation contributes to the final pose.

This method is deprecated.  You should use setBlend() instead.

◆ exposeJoint()

def exposeJoint (   self,
  node,
  partName,
  jointName,
  lodName = "lodRoot",
  localTransform = 0 
)
exposeJoint(self, NodePath, string, string, key="lodRoot")
Starts the joint animating the indicated node.  As the joint
animates, it will transform the node by the corresponding
amount.  This will replace whatever matrix is on the node each
frame.  The default is to expose the net transform from the root,
but if localTransform is true, only the node's local transform
from its parent is exposed.

◆ faceAwayFromViewer()

def faceAwayFromViewer (   self)

◆ faceTowardsViewer()

def faceTowardsViewer (   self)

◆ fixBounds()

def fixBounds (   self,
  partName = None 
)

◆ fixBounds_old()

def fixBounds_old (   self,
  part = None 
)
fixBounds(self, nodePath=None)
Force recomputation of bounding spheres for all geoms
in a given part. If no part specified, fix all geoms
in this actor

◆ flush()

def flush (   self)
Actor flush function.  Used by `cleanup()`.

◆ freezeJoint()

def freezeJoint (   self,
  partName,
  jointName,
  transform = None,
  pos = Vec3(0,0,0),
  hpr = Vec3(0,0,0),
  scale = Vec3(1,1,1) 
)
Similar to controlJoint, but the transform assigned is
static, and may not be animated at runtime (without another
subsequent call to freezeJoint).  This is slightly more
optimal than controlJoint() for cases in which the transform
is not intended to be animated during the lifetime of the
Actor. 

◆ getActorInfo()

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

◆ getAnimBlends()

def getAnimBlends (   self,
  animName = None,
  partName = None,
  lodName = None 
)
Returns a list of the form::

   [ (lodName, [(animName, [(partName, effect), (partName, effect), ...]),
                (animName, [(partName, effect), (partName, effect), ...]),
                ...]),
     (lodName, [(animName, [(partName, effect), (partName, effect), ...]),
                (animName, [(partName, effect), (partName, effect), ...]),
                ...]),
      ... ]

This list reports the non-zero control effects for each
partName within a particular animation and LOD. 

◆ getAnimControl()

def getAnimControl (   self,
  animName,
  partName = None,
  lodName = None,
  allowAsyncBind = True 
)
getAnimControl(self, string, string, string="lodRoot")
Search the animControl dictionary indicated by lodName for
a given anim and part. If none specified, try the first part and lod.
Return the animControl if present, or None otherwise.

◆ getAnimControlDict()

def getAnimControlDict (   self)

◆ getAnimControls()

def getAnimControls (   self,
  animName = None,
  partName = None,
  lodName = None,
  allowAsyncBind = True 
)
getAnimControls(self, string, string=None, string=None)

Returns a list of the AnimControls that represent the given
animation for the given part and the given lod.

If animName is None or omitted, the currently-playing
animation (or all currently-playing animations) is returned.
If animName is True, all animations are returned.  If animName
is a single string name, that particular animation is
returned.  If animName is a list of string names, all of the
names animations are returned.

If partName is None or omitted, all parts are returned (or
possibly the one overall Actor part, according to the
subpartsComplete flag).

If lodName is None or omitted, all LOD's are returned.

◆ getAnimFilename()

def getAnimFilename (   self,
  animName,
  partName = 'modelRoot' 
)
getAnimFilename(self, animName)
return the animFilename given the animName

◆ getAnimNames()

def getAnimNames (   self)

◆ getBaseFrameRate()

def getBaseFrameRate (   self,
  animName = None,
  partName = None 
)
getBaseFrameRate(self, string, string=None)
Return frame rate of given anim name and given part, unmodified
by any play rate in effect.

◆ getCurrentAnim()

def getCurrentAnim (   self,
  partName = None 
)
Return the anim currently playing on the actor. If part not
specified return current anim of an arbitrary part in dictionary.
NOTE: only returns info for an arbitrary LOD

◆ getCurrentFrame()

def getCurrentFrame (   self,
  animName = None,
  partName = None 
)
Return the current frame number of the named anim, or if no
anim is specified, then the anim current playing on the
actor. If part not specified return current anim of first part
in dictionary.  NOTE: only returns info for an arbitrary LOD

◆ getDuration()

def getDuration (   self,
  animName = None,
  partName = None,
  fromFrame = None,
  toFrame = None 
)
Return duration of given anim name and given part.
If no anim specified, use the currently playing anim.
If no part specified, return anim duration of first part.
NOTE: returns info for arbitrary LOD

◆ getFrameRate()

def getFrameRate (   self,
  animName = None,
  partName = None 
)
getFrameRate(self, string, string=None)
Return actual frame rate of given anim name and given part.
If no anim specified, use the currently playing anim.
If no part specified, return anim durations of first part.
NOTE: returns info only for an arbitrary LOD

◆ getFrameTime()

def getFrameTime (   self,
  anim,
  frame,
  partName = None 
)

◆ getGeomNode()

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

◆ getJoints()

def getJoints (   self,
  partName = None,
  jointName = '*',
  lodName = None 
)
 Returns the list of all joints, from the named part or
from all parts, that match the indicated jointName.  The
jointName may include pattern characters like \\*. 

◆ getJointTransform()

def getJointTransform (   self,
  partName,
  jointName,
  lodName = 'lodRoot' 
)

◆ getJointTransformState()

def getJointTransformState (   self,
  partName,
  jointName,
  lodName = 'lodRoot' 
)

◆ getLOD()

def getLOD (   self,
  lodName 
)
getLOD(self, string)
Get the named node under the LOD to which we parent all LOD
specific geometry to. Returns 'None' if not found

◆ getLODIndex()

def getLODIndex (   self,
  lodName 
)
getLODIndex(self)
safe method (but expensive) for retrieving the child index

◆ 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

◆ getNumFrames()

def getNumFrames (   self,
  animName = None,
  partName = None 
)

◆ getOverlappingJoints()

def getOverlappingJoints (   self,
  partNameA,
  partNameB,
  jointName = '*',
  lodName = None 
)
 Returns the set of joints, matching jointName, that are
shared between partNameA and partNameB. 

◆ getPart()

def getPart (   self,
  partName,
  lodName = "lodRoot" 
)
Find the named part in the optional named lod and return it, or
return None if not present

◆ getPartBundle()

def getPartBundle (   self,
  partName,
  lodName = "lodRoot" 
)
Find the named part in the optional named lod and return its
associated PartBundle, or return None if not present

◆ 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

◆ getPlayRate()

def getPlayRate (   self,
  animName = None,
  partName = None 
)
Return the play rate of given anim for a given part.
If no part is given, assume first part in dictionary.
If no anim is given, find the current anim for the part.
NOTE: Returns info only for an arbitrary LOD

◆ getSubpartsComplete()

def getSubpartsComplete (   self)
See setSubpartsComplete().

◆ hasLOD()

def hasLOD (   self)
Return 1 if the actor has LODs, 0 otherwise

◆ hideAllBounds()

def hideAllBounds (   self)
Hide the bounds of all actor geoms

◆ hidePart()

def hidePart (   self,
  partName,
  lodName = "lodRoot" 
)
Make the given part of the optionally given lod not render,
even though still in the tree.
NOTE: this will affect child geometry

◆ initAnimsOnAllLODs()

def initAnimsOnAllLODs (   self,
  partNames 
)

◆ instance()

def instance (   self,
  path,
  partName,
  jointName,
  lodName = "lodRoot" 
)
instance(self, NodePath, string, string, key="lodRoot")
Instance a nodePath to an actor part at a joint called jointName

◆ listJoints()

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

◆ loadAnims()

def loadAnims (   self,
  anims,
  partName = "modelRoot",
  lodName = "lodRoot" 
)
loadAnims(self, string:string{}, string='modelRoot',
string='lodRoot')
Actor anim loader. Takes an optional partName (defaults to
'modelRoot' for non-multipart actors) and lodName (defaults
to 'lodRoot' for non-LOD actors) and dict of corresponding
anims in the form animName:animPath{}

◆ loadAnimsOnAllLODs()

def loadAnimsOnAllLODs (   self,
  anims,
  partName = "modelRoot" 
)
loadAnims(self, string:string{}, string='modelRoot',
string='lodRoot')
Actor anim loader. Takes an optional partName (defaults to
'modelRoot' for non-multipart actors) and lodName (defaults
to 'lodRoot' for non-LOD actors) and dict of corresponding
anims in the form animName:animPath{}

◆ loadModel()

def loadModel (   self,
  modelPath,
  partName = "modelRoot",
  lodName = "lodRoot",
  copy = True,
  okMissing = None,
  autoBindAnims = True 
)
Actor model loader. Takes a model name (ie file path), a part
name(defaults to "modelRoot") and an lod name(defaults to "lodRoot").

◆ loop()

def loop (   self,
  animName,
  restart = 1,
  partName = None,
  fromFrame = None,
  toFrame = None 
)
loop(self, string, int=1, string=None)
Loop the given animation on the given part of the actor,
restarting at zero frame if requested. If no part name
is given then try to loop on all parts. NOTE: loops on
all LOD's

Reimplemented in DistributedActor.

◆ makeSubpart()

def makeSubpart (   self,
  partName,
  includeJoints,
  excludeJoints = [],
  parent = "modelRoot",
  overlapping = False 
)
Defines a new "part" of the Actor that corresponds to the
same geometry as the named parent part, but animates only a
certain subset of the joints.  This can be used for
partial-body animations, for instance to animate a hand waving
while the rest of the body continues to play its walking
animation.

includeJoints is a list of joint names that are to be animated
by the subpart.  Each name can include globbing characters
like '?' or '*', which will match one or any number of
characters, respectively.  Including a joint by naming it in
includeJoints implicitly includes all of the descendents of
that joint as well, except for excludeJoints, below.

excludeJoints is a list of joint names that are *not* to be
animated by the subpart.  As in includeJoints, each name can
include globbing characters.  If a joint is named by
excludeJoints, it will not be included (and neither will any
of its descendents), even if a parent joint was named by
includeJoints.

if overlapping is False, an error is raised (in the dev build)
if this subpart shares joints with any other subparts.  If
overlapping is True, no such error is raised.

parent is the actual partName that this subpart is based
on.

◆ osdAnimBlends()

def osdAnimBlends (   self,
  animName = None,
  partName = None,
  lodName = None 
)

◆ pingpong()

def pingpong (   self,
  animName,
  restart = 1,
  partName = None,
  fromFrame = None,
  toFrame = None 
)
pingpong(self, string, int=1, string=None)
Loop the given animation on the given part of the actor,
restarting at zero frame if requested. If no part name
is given then try to loop on all parts. NOTE: loops on
all LOD's

◆ play()

def play (   self,
  animName,
  partName = None,
  fromFrame = None,
  toFrame = None 
)
play(self, string, string=None)
Play the given animation on the given part of the actor.
If no part is specified, try to play on all parts. NOTE:
plays over ALL LODs

◆ pose()

def pose (   self,
  animName,
  frame,
  partName = None,
  lodName = None 
)
pose(self, string, int, string=None)
Pose the actor in position found at given frame in the specified
animation for the specified part. If no part is specified attempt
to apply pose to all parts.

◆ postFlatten()

def postFlatten (   self)
Call this after performing an aggressive flatten operation,
such as flattenStrong(), that involves the Actor.  This is
especially necessary when mergeLODBundles is true, since this
kind of actor may be broken after a flatten operation; this
method should restore proper Actor functionality. 

◆ pprint()

def pprint (   self)
Pretty print actor's details

◆ printAnimBlends()

def printAnimBlends (   self,
  animName = None,
  partName = None,
  lodName = None 
)

◆ printLOD()

def printLOD (   self)

◆ releaseJoint()

def releaseJoint (   self,
  partName,
  jointName 
)
Undoes a previous call to controlJoint() or freezeJoint()
and restores the named joint to its normal animation. 

◆ removeAnimControlDict()

def removeAnimControlDict (   self)

◆ removeNode()

def removeNode (   self)
You should call `cleanup()` for Actor objects instead, since
:meth:`~panda3d.core.NodePath.removeNode()` is not sufficient for
completely destroying Actor objects.

◆ removePart()

def removePart (   self,
  partName,
  lodName = "lodRoot" 
)
Remove the geometry and animations of the named part of the
optional named lod if present.
NOTE: this will remove child geometry also!

◆ renamePartBundles()

def renamePartBundles (   self,
  partName,
  newBundleName 
)

◆ resetLOD()

def resetLOD (   self)
Restore all switch distance info (usually after a useLOD call)

◆ setBlend()

def setBlend (   self,
  animBlend = None,
  frameBlend = None,
  blendType = None,
  partName = None 
)
Changes the way the Actor handles blending of multiple
different animations, and/or interpolation between consecutive
frames.

The animBlend and frameBlend parameters are boolean flags.
You may set either or both to True or False.  If you do not
specify them, they do not change from the previous value.

When animBlend is True, multiple different animations may
simultaneously be playing on the Actor.  This means you may
call play(), loop(), or pose() on multiple animations and have
all of them contribute to the final pose each frame.

In this mode (that is, when animBlend is True), starting a
particular animation with play(), loop(), or pose() does not
implicitly make the animation visible; you must also call
setControlEffect() for each animation you wish to use to
indicate how much each animation contributes to the final
pose.

The frameBlend flag is unrelated to playing multiple
animations.  It controls whether the Actor smoothly
interpolates between consecutive frames of its animation (when
the flag is True) or holds each frame until the next one is
ready (when the flag is False).  The default value of
frameBlend is controlled by the interpolate-frames Config.prc
variable.

In either case, you may also specify blendType, which controls
the precise algorithm used to blend two or more different
matrix values into a final result.  Different skeleton
hierarchies may benefit from different algorithms.  The
default blendType is controlled by the anim-blend-type
Config.prc variable.

◆ setCenter()

def setCenter (   self,
  center 
)

◆ setControlEffect()

def setControlEffect (   self,
  animName,
  effect,
  partName = None,
  lodName = None 
)
Sets the amount by which the named animation contributes to
the overall pose.  This controls blending of multiple
animations; it only makes sense to call this after a previous
call to setBlend(animBlend = True).

◆ setGeomNode()

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

◆ setLOD()

def setLOD (   self,
  lodName,
  inDist = 0,
  outDist = 0 
)
setLOD(self, string)
Set the switch distance for given LOD

◆ setLODAnimation()

def setLODAnimation (   self,
  farDistance,
  nearDistance,
  delayFactor 
)
 Activates a special mode in which the Actor animates less
frequently as it gets further from the camera.  This is
intended as a simple optimization to minimize the effort of
computing animation for lots of characters that may not
necessarily be very important to animate every frame.

If the character is closer to the camera than near_distance,
then it is animated its normal rate, every frame.  If the
character is exactly far_distance away, it is animated only
every delay_factor seconds (which should be a number greater
than 0).  If the character is between near_distance and
far_distance, its animation rate is linearly interpolated
according to its distance between the two.  The interpolation
function continues beyond far_distance, so that the character
is animated increasingly less frequently as it gets farther
away. 

◆ 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

◆ setPlayRate()

def setPlayRate (   self,
  rate,
  animName,
  partName = None 
)
setPlayRate(self, float, string, string=None)
Set the play rate of given anim for a given part.
If no part is given, set for all parts in dictionary.

It used to be legal to let the animName default to the
currently-playing anim, but this was confusing and could lead
to the wrong anim's play rate getting set.  Better to insist
on this parameter.
NOTE: sets play rate on all LODs

◆ setSubpartsComplete()

def setSubpartsComplete (   self,
  flag 
)
Sets the subpartsComplete flag.  This affects the behavior
of play(), loop(), stop(), etc., when no explicit parts are
specified.

When this flag is False (the default), play() with no parts
means to play the animation on the overall Actor, which is a
separate part that overlaps each of the subparts.  If you then
play a different animation on a subpart, it may stop the
overall animation (in non-blend mode) or blend with it (in
blend mode).

When this flag is True, play() with no parts means to play the
animation on each of the subparts--instead of on the overall
Actor.  In this case, you may then play a different animation
on a subpart, which replaces only that subpart's animation.

It makes sense to set this True when the union of all of your
subparts completely defines the entire Actor.

◆ showAllBounds()

def showAllBounds (   self)
Show the bounds of all actor geoms

◆ showAllParts()

def showAllParts (   self,
  partName,
  lodName = "lodRoot" 
)
Make the given part and all its children render while in the tree.
NOTE: this will affect child geometry

◆ showPart()

def showPart (   self,
  partName,
  lodName = "lodRoot" 
)
Make the given part render while in the tree.
NOTE: this will affect child geometry

◆ stop()

def stop (   self,
  animName = None,
  partName = None 
)
stop(self, string=None, string=None)
Stop named animation on the given part of the actor.
If no name specified then stop all animations on the actor.
NOTE: stops all LODs

◆ stopJoint()

def stopJoint (   self,
  partName,
  jointName,
  lodName = "lodRoot" 
)
stopJoint(self, string, string, key="lodRoot")
Stops the joint from animating external nodes.  If the joint
is animating a transform on a node, this will permanently stop
it.  However, this does not affect vertex animations.

◆ unloadAnims()

def unloadAnims (   self,
  anims = None,
  partName = None,
  lodName = None 
)
unloadAnims(self, string:string{}, string='modelRoot',
string='lodRoot')
Actor anim unloader. Takes an optional partName (defaults to
'modelRoot' for non-multipart actors) and lodName (defaults to
'lodRoot' for non-LOD actors) and list of animation
names. Deletes the anim control for the given animation and
parts/lods.

If any parameter is None or omitted, it means all of them.

◆ update()

def update (   self,
  lod = 0,
  partName = None,
  lodName = None,
  force = False 
)
 Updates all of the Actor's joints in the indicated LOD.
The LOD may be specified by name, or by number, where 0 is the
highest level of detail, 1 is the next highest, and so on.

If force is True, this will update every joint, even if we
don't believe it's necessary.

Returns True if any joint has changed as a result of this,
False otherwise. 

◆ useLOD()

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

◆ verifySubpartsComplete()

def verifySubpartsComplete (   self,
  partName = None,
  lodName = None 
)
 Ensures that each joint is defined by at least one
subPart.  Prints a warning if this is not the case. 

◆ waitPending()

def waitPending (   self,
  partName = None 
)
Blocks until all asynchronously pending animations (that
are currently playing) have been loaded and bound the the
Actor.  Call this after calling play() if you are using
asynchronous binds, but you need this particular animation
to be loaded immediately. 

Member Data Documentation

◆ Actor_deleted

Actor_deleted

◆ Actor_initialized

Actor_initialized

◆ actor_interval

def actor_interval = actorInterval
static

◆ add_lod

def add_lod = addLOD
static

◆ allowAsyncBind

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

◆ anim_panel

def anim_panel = animPanel
static

◆ animLoaderOptions

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

◆ bind_all_anims

def bind_all_anims = bindAllAnims
static

◆ bind_anim

def bind_anim = bindAnim
static

◆ clear_lod_animation

def clear_lod_animation = clearLODAnimation
static

◆ clear_python_data

def clear_python_data = clearPythonData
static

◆ control_joint

def control_joint = controlJoint
static

◆ copy_actor

def copy_actor = copyActor
static

◆ disable_blend

def disable_blend = disableBlend
static

◆ draw_in_front

def draw_in_front = drawInFront
static

◆ enable_blend

def enable_blend = enableBlend
static

◆ expose_joint

def expose_joint = exposeJoint
static

◆ face_away_from_viewer

def face_away_from_viewer = faceAwayFromViewer
static

◆ face_towards_viewer

def face_towards_viewer = faceTowardsViewer
static

◆ fix_bounds

def fix_bounds = fixBounds
static

◆ fix_bounds_old

def fix_bounds_old = fixBounds_old
static

◆ freeze_joint

def freeze_joint = freezeJoint
static

◆ get_actor_info

def get_actor_info = getActorInfo
static

◆ get_anim_blends

def get_anim_blends = getAnimBlends
static

◆ get_anim_control

def get_anim_control = getAnimControl
static

◆ get_anim_control_dict

def get_anim_control_dict = getAnimControlDict
static

◆ get_anim_controls

def get_anim_controls = getAnimControls
static

◆ get_anim_filename

def get_anim_filename = getAnimFilename
static

◆ get_anim_names

def get_anim_names = getAnimNames
static

◆ get_base_frame_rate

def get_base_frame_rate = getBaseFrameRate
static

◆ get_current_anim

def get_current_anim = getCurrentAnim
static

◆ get_current_frame

def get_current_frame = getCurrentFrame
static

◆ get_duration

def get_duration = getDuration
static

◆ get_frame_rate

def get_frame_rate = getFrameRate
static

◆ get_frame_time

def get_frame_time = getFrameTime
static

◆ get_geom_node

def get_geom_node = getGeomNode
static

◆ get_joint_transform

def get_joint_transform = getJointTransform
static

◆ get_joint_transform_state

def get_joint_transform_state = getJointTransformState
static

◆ get_joints

def get_joints = getJoints
static

◆ get_lod

def get_lod = getLOD
static

◆ get_lod_index

def get_lod_index = getLODIndex
static

◆ get_lod_names

def get_lod_names = getLODNames
static

◆ get_lod_node

def get_lod_node = getLODNode
static

◆ get_num_frames

def get_num_frames = getNumFrames
static

◆ get_overlapping_joints

def get_overlapping_joints = getOverlappingJoints
static

◆ get_part

def get_part = getPart
static

◆ get_part_bundle

def get_part_bundle = getPartBundle
static

◆ get_part_bundle_dict

def get_part_bundle_dict = getPartBundleDict
static

◆ get_part_bundles

def get_part_bundles = getPartBundles
static

◆ get_part_names

def get_part_names = getPartNames
static

◆ get_play_rate

def get_play_rate = getPlayRate
static

◆ get_subparts_complete

def get_subparts_complete = getSubpartsComplete
static

◆ gotName

gotName

◆ has_lod

def has_lod = hasLOD
static

◆ hide_all_bounds

def hide_all_bounds = hideAllBounds
static

◆ hide_part

def hide_part = hidePart
static

◆ init_anims_on_all_lods

def init_anims_on_all_lods = initAnimsOnAllLODs
static

◆ list_joints

def list_joints = listJoints
static

◆ load_anims

def load_anims = loadAnims
static

◆ load_anims_on_all_lods

def load_anims_on_all_lods = loadAnimsOnAllLODs
static

◆ load_model

def load_model = loadModel
static

◆ loader

loader

◆ make_subpart

def make_subpart = makeSubpart
static

◆ 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

◆ osd_anim_blends

def osd_anim_blends = osdAnimBlends
static

◆ partPrefix

string partPrefix = "__Actor_"
static

◆ post_flatten

def post_flatten = postFlatten
static

◆ print_anim_blends

def print_anim_blends = printAnimBlends
static

◆ print_lod

def print_lod = printLOD
static

◆ release_joint

def release_joint = releaseJoint
static

◆ remove_anim_control_dict

def remove_anim_control_dict = removeAnimControlDict
static

◆ remove_node

def remove_node = removeNode
static

◆ remove_part

def remove_part = removePart
static

◆ rename_part_bundles

def rename_part_bundles = renamePartBundles
static

◆ reset_lod

def reset_lod = resetLOD
static

◆ set_blend

def set_blend = setBlend
static

◆ set_center

def set_center = setCenter
static

◆ set_control_effect

def set_control_effect = setControlEffect
static

◆ set_geom_node

def set_geom_node = setGeomNode
static

◆ set_lod

def set_lod = setLOD
static

◆ set_lod_animation

def set_lod_animation = setLODAnimation
static

◆ set_lod_node

def set_lod_node = setLODNode
static

◆ set_play_rate

def set_play_rate = setPlayRate
static

◆ set_subparts_complete

def set_subparts_complete = setSubpartsComplete
static

◆ show_all_bounds

def show_all_bounds = showAllBounds
static

◆ show_all_parts

def show_all_parts = showAllParts
static

◆ show_part

def show_part = showPart
static

◆ stop_joint

def stop_joint = stopJoint
static

◆ switches

switches

◆ unload_anims

def unload_anims = unloadAnims
static

◆ use_lod

def use_lod = useLOD
static

◆ validateSubparts

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

◆ verify_subparts_complete

def verify_subparts_complete = verifySubpartsComplete
static

◆ wait_pending

def wait_pending = waitPending
static