__bindAnimToPart def __bindAnimToPart(self, animName, partName, lodName) for internal use only! |
__cmp__ def __cmp__(self, other) Undocumented function. |
__copyAnimControls def __copyAnimControls(self, other) __copyAnimControls(self, Actor) Get the anims from the anim control's in the anim control dictionary of another actor. Bind these anim's to the part bundles in our part bundle dict that have matching names, and store the resulting anim controls in our own part bundle dict |
__copyPartBundles def __copyPartBundles(self, other) __copyPartBundles(self, Actor) Copy the part bundle dictionary from another actor as this instance's own. NOTE: this method does not actually copy geometry |
__copySubpartDict def __copySubpartDict(self, other) Copies the subpartDict from another as this instance's own. This makes a deep copy of the map and all of the names and PartSubset objects within it. We can't use copy.deepcopy() because of the included C++ PartSubset objects. |
__doListJoints def __doListJoints(self, indentLevel, part, isIncluded, subset) Undocumented function. |
__init__ def __init__(self, models=None, anims=None, other=None, copy=1, lodNode=None, flattenable=1, setFinal=0, mergeLODBundles=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() |
__prepareBundle def __prepareBundle(self, bundleNP, partModel, partName="modelRoot", lodName="lodRoot") Undocumented function. |
__str__ def __str__(self) Actor print function |
__updateSortedLODNames def __updateSortedLODNames(self) Undocumented function. |
actorInterval def actorInterval(self, *args, **kw) Undocumented function. |
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) Undocumented function. |
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) Loads and binds all animations that have been defined for the Actor. |
bindAnim def bindAnim(self, animName, partName="modelRoot", lodName="lodRoot") bindAnim(self, string, string='modelRoot', string='lodRoot') Bind the named animation to the named part and lod |
cleanup def cleanup(self) Actor cleanup function |
clearPythonData def clearPythonData(self) Undocumented function. |
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) Undocumented function. |
delete def delete(self) Undocumented function. |
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) Undocumented function. |
faceTowardsViewer def faceTowardsViewer(self) Undocumented function. |
fixBounds def fixBounds(self, partName=None) Undocumented function. |
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 |
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) 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) Undocumented function. |
getAnimControls def getAnimControls(self, animName=None, partName=None, lodName=None) 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 omitted, the currently-playing animation (or all currently-playing animations) is returned. If partName is omitted, all parts are returned (or possibly the one overall Actor part, according to the subpartsComplete flag). If lodName is 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) Undocumented function. |
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 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) Undocumented function. |
getGeomNode def getGeomNode(self) Return the node that contains all actor geometry |
getJoints def getJoints(self, jointName) Undocumented function. |
getJointTransform def getJointTransform(self, partName, jointName, lodName='lodRoot') Undocumented function. |
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 |
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) Undocumented function. |
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) Undocumented function. |
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) Undocumented function. |
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=1) loadModel(self, string, string="modelRoot", string="lodRoot", bool = 0) Actor model loader. Takes a model name (ie file path), a part name(defaults to "modelRoot") and an lod name(defaults to "lodRoot"). If copy is set to 0, do a loadModel instead of a loadModelCopy. |
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 |
makeSubpart def makeSubpart(self, partName, includeJoints, excludeJoints=[], parent="modelRoot") 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. parent is the actual partName that this subpart is based on. |
osdAnimBlends def osdAnimBlends(self, animName=None, partName=None, lodName=None) Undocumented function. |
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) Undocumented function. |
printLOD def printLOD(self) Undocumented function. |
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) Undocumented function. |
removeNode def removeNode(self) Undocumented function. |
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) Undocumented function. |
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) Undocumented function. |
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 |
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 dict of corresponding anims in the form animName:animPath{}. 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 |