PartBundle

from panda3d.core import PartBundle
class PartBundle

Bases: PartGroup

This is the root of a MovingPart hierarchy. It defines the hierarchy of moving parts that make up an animatable object.

Inheritance diagram

Inheritance diagram of PartBundle

BTComponentwise = 2
BTComponentwiseQuat = 3
BTLinear = 0
BTNormalizedLinear = 1
BT_componentwise = 2
BT_componentwise_quat = 3
BT_linear = 0
BT_normalized_linear = 1
__init__(*args, **kwargs)
anim_blend_flag
applyTransform()

C++ Interface: apply_transform(const PartBundle self, const TransformState transform)

/**
  • Returns a PartBundle that is a duplicate of this one, but with the

  • indicated transform applied. If this is called multiple times with the

  • same TransformState pointer, it returns the same PartBundle each time.

*/

apply_transform()

C++ Interface: apply_transform(const PartBundle self, const TransformState transform)

/**
  • Returns a PartBundle that is a duplicate of this one, but with the

  • indicated transform applied. If this is called multiple times with the

  • same TransformState pointer, it returns the same PartBundle each time.

*/

bindAnim()

C++ Interface: bind_anim(const PartBundle self, AnimBundle anim, int hierarchy_match_flags, const PartSubset subset)

/**
  • Binds the animation to the bundle, if possible, and returns a new

  • AnimControl that can be used to start and stop the animation. If the anim

  • hierarchy does not match the part hierarchy, returns NULL.

  • If hierarchy_match_flags is 0, only an exact match is accepted; otherwise,

  • it may contain a union of PartGroup::HierarchyMatchFlags values indicating

  • conditions that will be tolerated (but warnings will still be issued).

  • If subset is specified, it restricts the binding only to the named subtree

  • of joints.

  • The AnimControl is not stored within the PartBundle; it is the user’s

  • responsibility to maintain the pointer. The animation will automatically

  • unbind itself when the AnimControl destructs (i.e. its reference count

  • goes to zero).

*/

bind_anim()

C++ Interface: bind_anim(const PartBundle self, AnimBundle anim, int hierarchy_match_flags, const PartSubset subset)

/**
  • Binds the animation to the bundle, if possible, and returns a new

  • AnimControl that can be used to start and stop the animation. If the anim

  • hierarchy does not match the part hierarchy, returns NULL.

  • If hierarchy_match_flags is 0, only an exact match is accepted; otherwise,

  • it may contain a union of PartGroup::HierarchyMatchFlags values indicating

  • conditions that will be tolerated (but warnings will still be issued).

  • If subset is specified, it restricts the binding only to the named subtree

  • of joints.

  • The AnimControl is not stored within the PartBundle; it is the user’s

  • responsibility to maintain the pointer. The animation will automatically

  • unbind itself when the AnimControl destructs (i.e. its reference count

  • goes to zero).

*/

blend_type
clearAnimPreload()

C++ Interface: clear_anim_preload(const PartBundle self)

/**
  • Removes any AnimPreloadTable associated with the PartBundle.

*/

clearControlEffects()

C++ Interface: clear_control_effects(const PartBundle self)

/**
  • Sets the control effect of all AnimControls to zero (but does not “stop”

  • the AnimControls). The character will no longer be affected by any

  • animation, and will return to its default pose (unless restore-initial-pose

  • is false).

  • The AnimControls which are no longer associated will not be using any CPU

  • cycles, but they may still be in the “playing” state; if they are later

  • reassociated with the PartBundle they will resume at their current frame as

  • if they’d been running all along.

*/

clear_anim_preload()

C++ Interface: clear_anim_preload(const PartBundle self)

/**
  • Removes any AnimPreloadTable associated with the PartBundle.

*/

clear_control_effects()

C++ Interface: clear_control_effects(const PartBundle self)

/**
  • Sets the control effect of all AnimControls to zero (but does not “stop”

  • the AnimControls). The character will no longer be affected by any

  • animation, and will return to its default pose (unless restore-initial-pose

  • is false).

  • The AnimControls which are no longer associated will not be using any CPU

  • cycles, but they may still be in the “playing” state; if they are later

  • reassociated with the PartBundle they will resume at their current frame as

  • if they’d been running all along.

*/

controlJoint()

C++ Interface: control_joint(const PartBundle self, str joint_name, PandaNode node)

/**
  • Specifies that the joint with the indicated name should be animated with

  • the transform on the indicated node. It will henceforth always follow the

  • node’s transform, regardless of any animations that may subsequently be

  • bound to the joint.

  • Returns true if the joint is successfully controlled, or false if the named

  • child is not a joint (or slider) or does not exist.

*/

control_joint()

C++ Interface: control_joint(const PartBundle self, str joint_name, PandaNode node)

/**
  • Specifies that the joint with the indicated name should be animated with

  • the transform on the indicated node. It will henceforth always follow the

  • node’s transform, regardless of any animations that may subsequently be

  • bound to the joint.

  • Returns true if the joint is successfully controlled, or false if the named

  • child is not a joint (or slider) or does not exist.

*/

forceUpdate()

C++ Interface: force_update(const PartBundle self)

/**
  • Updates all the parts in the bundle to reflect the data for the current

  • frame, whether we believe it needs it or not.

*/

force_update()

C++ Interface: force_update(const PartBundle self)

/**
  • Updates all the parts in the bundle to reflect the data for the current

  • frame, whether we believe it needs it or not.

*/

frame_blend_flag
freezeJoint()

C++ Interface: freeze_joint(const PartBundle self, str joint_name, const TransformState transform) freeze_joint(const PartBundle self, str joint_name, float value) freeze_joint(const PartBundle self, str joint_name, const LVecBase3f pos, const LVecBase3f hpr, const LVecBase3f scale)

/**
  • Specifies that the joint with the indicated name should be frozen with the

  • specified transform. It will henceforth always hold this fixed transform,

  • regardless of any animations that may subsequently be bound to the joint.

  • Returns true if the joint is successfully frozen, or false if the named

  • child is not a joint (or slider) or does not exist.

*/

/**
  • Specifies that the joint with the indicated name should be frozen with the

  • specified transform. It will henceforth always hold this fixed transform,

  • regardless of any animations that may subsequently be bound to the joint.

  • Returns true if the joint is successfully frozen, or false if the named

  • child is not a joint (or slider) or does not exist.

*/

/**
  • Specifies that the joint with the indicated name should be frozen with the

  • specified transform. It will henceforth always hold this fixed transform,

  • regardless of any animations that may subsequently be bound to the joint.

  • Returns true if the joint is successfully frozen, or false if the named

  • child is not a joint (or slider) or does not exist.

*/

freeze_joint()

C++ Interface: freeze_joint(const PartBundle self, str joint_name, const TransformState transform) freeze_joint(const PartBundle self, str joint_name, float value) freeze_joint(const PartBundle self, str joint_name, const LVecBase3f pos, const LVecBase3f hpr, const LVecBase3f scale)

/**
  • Specifies that the joint with the indicated name should be frozen with the

  • specified transform. It will henceforth always hold this fixed transform,

  • regardless of any animations that may subsequently be bound to the joint.

  • Returns true if the joint is successfully frozen, or false if the named

  • child is not a joint (or slider) or does not exist.

*/

/**
  • Specifies that the joint with the indicated name should be frozen with the

  • specified transform. It will henceforth always hold this fixed transform,

  • regardless of any animations that may subsequently be bound to the joint.

  • Returns true if the joint is successfully frozen, or false if the named

  • child is not a joint (or slider) or does not exist.

*/

/**
  • Specifies that the joint with the indicated name should be frozen with the

  • specified transform. It will henceforth always hold this fixed transform,

  • regardless of any animations that may subsequently be bound to the joint.

  • Returns true if the joint is successfully frozen, or false if the named

  • child is not a joint (or slider) or does not exist.

*/

getAnimBlendFlag()

C++ Interface: get_anim_blend_flag(PartBundle self)

/**
  • Returns whether the character allows multiple different animations to be

  • bound simultaneously. See set_anim_blend_flag().

*/

getAnimPreload()

C++ Interface: get_anim_preload(PartBundle self)

/**
  • Returns the AnimPreloadTable associated with the PartBundle. This table,

  • if present, can be used for the benefit of load_bind_anim() to allow

  • asynchronous binding.

*/

getBlendType()

C++ Interface: get_blend_type(PartBundle self)

/**
  • Returns the algorithm that is used when blending multiple frames or

  • multiple animations together, when either anim_blend_flag or

  • frame_blend_flag is set to true.

*/

getClassType()

C++ Interface: get_class_type()

getControlEffect()

C++ Interface: get_control_effect(PartBundle self, AnimControl control)

/**
  • Returns the amount by which the character is affected by the indicated

  • AnimControl and its associated animation. See set_control_effect().

*/

getFrameBlendFlag()

C++ Interface: get_frame_blend_flag(PartBundle self)

/**
  • Returns whether the character interpolates (blends) between two sequential

  • animation frames, or whether it holds the current frame until the next one

  • is ready. See set_frame_blend_flag().

*/

getNode()

C++ Interface: get_node(PartBundle self, int n)

/**
  • Returns the nth PartBundleNode associated with this PartBundle.

*/

getNodes()
getNumNodes()

C++ Interface: get_num_nodes(PartBundle self)

/**
  • Returns the number of PartBundleNodes that contain a pointer to this

  • PartBundle.

*/

getRootXform()

C++ Interface: get_root_xform(PartBundle self)

/**
  • Returns the transform matrix which is implicitly applied at the root of the

  • animated hierarchy.

*/

get_anim_blend_flag()

C++ Interface: get_anim_blend_flag(PartBundle self)

/**
  • Returns whether the character allows multiple different animations to be

  • bound simultaneously. See set_anim_blend_flag().

*/

get_anim_preload()

C++ Interface: get_anim_preload(PartBundle self)

/**
  • Returns the AnimPreloadTable associated with the PartBundle. This table,

  • if present, can be used for the benefit of load_bind_anim() to allow

  • asynchronous binding.

*/

get_blend_type()

C++ Interface: get_blend_type(PartBundle self)

/**
  • Returns the algorithm that is used when blending multiple frames or

  • multiple animations together, when either anim_blend_flag or

  • frame_blend_flag is set to true.

*/

get_class_type()

C++ Interface: get_class_type()

get_control_effect()

C++ Interface: get_control_effect(PartBundle self, AnimControl control)

/**
  • Returns the amount by which the character is affected by the indicated

  • AnimControl and its associated animation. See set_control_effect().

*/

get_frame_blend_flag()

C++ Interface: get_frame_blend_flag(PartBundle self)

/**
  • Returns whether the character interpolates (blends) between two sequential

  • animation frames, or whether it holds the current frame until the next one

  • is ready. See set_frame_blend_flag().

*/

get_node()

C++ Interface: get_node(PartBundle self, int n)

/**
  • Returns the nth PartBundleNode associated with this PartBundle.

*/

get_nodes()
get_num_nodes()

C++ Interface: get_num_nodes(PartBundle self)

/**
  • Returns the number of PartBundleNodes that contain a pointer to this

  • PartBundle.

*/

get_root_xform()

C++ Interface: get_root_xform(PartBundle self)

/**
  • Returns the transform matrix which is implicitly applied at the root of the

  • animated hierarchy.

*/

loadBindAnim()

C++ Interface: load_bind_anim(const PartBundle self, Loader loader, const Filename filename, int hierarchy_match_flags, const PartSubset subset, bool allow_async)

/**
  • Binds an animation to the bundle. The animation is loaded from the disk

  • via the indicated Loader object. In other respects, this behaves similarly

  • to bind_anim(), with the addition of asynchronous support.

  • If allow_aysnc is true, the load will be asynchronous if possible. This

  • requires that the animation basename can be found in the PartBundle’s

  • preload table (see get_anim_preload()).

  • In an asynchronous load, the animation file will be loaded and bound in a

  • sub-thread. This means that the animation will not necessarily be

  • available at the time this method returns. You may still use the returned

  • AnimControl immediately, though, but no visible effect will occur until the

  • animation eventually becomes available.

  • You can test AnimControl::is_pending() to see if the animation has been

  • loaded yet, or wait for it to finish with AnimControl::wait_pending() or

  • even PartBundle::wait_pending(). You can also set an event to be triggered

  • when the animation finishes loading with

  • AnimControl::set_pending_done_event().

*/

load_bind_anim()

C++ Interface: load_bind_anim(const PartBundle self, Loader loader, const Filename filename, int hierarchy_match_flags, const PartSubset subset, bool allow_async)

/**
  • Binds an animation to the bundle. The animation is loaded from the disk

  • via the indicated Loader object. In other respects, this behaves similarly

  • to bind_anim(), with the addition of asynchronous support.

  • If allow_aysnc is true, the load will be asynchronous if possible. This

  • requires that the animation basename can be found in the PartBundle’s

  • preload table (see get_anim_preload()).

  • In an asynchronous load, the animation file will be loaded and bound in a

  • sub-thread. This means that the animation will not necessarily be

  • available at the time this method returns. You may still use the returned

  • AnimControl immediately, though, but no visible effect will occur until the

  • animation eventually becomes available.

  • You can test AnimControl::is_pending() to see if the animation has been

  • loaded yet, or wait for it to finish with AnimControl::wait_pending() or

  • even PartBundle::wait_pending(). You can also set an event to be triggered

  • when the animation finishes loading with

  • AnimControl::set_pending_done_event().

*/

mergeAnimPreloads()

C++ Interface: merge_anim_preloads(const PartBundle self, const PartBundle other)

/**
  • Copies the contents of the other PartBundle’s preload table into this one.

*/

merge_anim_preloads()

C++ Interface: merge_anim_preloads(const PartBundle self, const PartBundle other)

/**
  • Copies the contents of the other PartBundle’s preload table into this one.

*/

modifyAnimPreload()

C++ Interface: modify_anim_preload(const PartBundle self)

/**
  • Returns a modifiable pointer to the AnimPreloadTable associated with the

  • PartBundle, if any.

*/

modify_anim_preload()

C++ Interface: modify_anim_preload(const PartBundle self)

/**
  • Returns a modifiable pointer to the AnimPreloadTable associated with the

  • PartBundle, if any.

*/

nodes
output()

C++ Interface: output(PartBundle self, ostream out)

/**
  • Writes a one-line description of the bundle.

*/

releaseJoint()

C++ Interface: release_joint(const PartBundle self, str joint_name)

/**
  • Releases the named joint from the effects of a previous call to

  • freeze_joint() or control_joint(). It will henceforth once again follow

  • whatever transforms are dictated by the animation.

  • Returns true if the joint is released, or false if the named child was not

  • previously controlled or frozen, or it does not exist.

*/

release_joint()

C++ Interface: release_joint(const PartBundle self, str joint_name)

/**
  • Releases the named joint from the effects of a previous call to

  • freeze_joint() or control_joint(). It will henceforth once again follow

  • whatever transforms are dictated by the animation.

  • Returns true if the joint is released, or false if the named child was not

  • previously controlled or frozen, or it does not exist.

*/

root_xform
setAnimBlendFlag()

C++ Interface: set_anim_blend_flag(const PartBundle self, bool anim_blend_flag)

/**
  • Defines the way the character responds to multiple calls to

  • set_control_effect()). By default, this flag is set false, which disallows

  • multiple animations. When this flag is false, it is not necessary to

  • explicitly set the control_effect when starting an animation; starting the

  • animation will implicitly remove the control_effect from the previous

  • animation and set it on the current one.

  • However, if this flag is set true, the control_effect must be explicitly

  • set via set_control_effect() whenever an animation is to affect the

  • character.

*/

setAnimPreload()

C++ Interface: set_anim_preload(const PartBundle self, AnimPreloadTable table)

/**
  • Replaces the AnimPreloadTable associated with the PartBundle.

*/

setBlendType()

C++ Interface: set_blend_type(const PartBundle self, int bt)

/**
  • Defines the algorithm that is used when blending multiple frames or

  • multiple animations together, when either anim_blend_flag or

  • frame_blend_flag is set to true.

  • See partBundle.h for a description of the meaning of each of the BlendType

  • values.

*/

setControlEffect()

C++ Interface: set_control_effect(const PartBundle self, AnimControl control, float effect)

/**
  • Sets the amount by which the character is affected by the indicated

  • AnimControl (and its associated animation). Normally, this will only be

  • zero or one. Zero indicates the animation does not affect the character,

  • and one means it does.

  • If the _anim_blend_flag is not false (see set_anim_blend_flag()), it is

  • possible to have multiple AnimControls in effect simultaneously. In this

  • case, the effect is a weight that indicates the relative importance of each

  • AnimControl to the final animation.

*/

setFrameBlendFlag()

C++ Interface: set_frame_blend_flag(const PartBundle self, bool frame_blend_flag)

/**
  • Specifies whether the character interpolates (blends) between two

  • sequential frames of an active animation, showing a smooth intra-frame

  • motion, or whether it holds each frame until the next frame is ready,

  • showing precisely the specified animation.

  • When this value is false, the character holds each frame until the next is

  • ready. When this is true, the character will interpolate between two

  • consecutive frames of animation for each frame the animation is onscreen,

  • according to the amount of time elapsed between the frames.

  • The default value of this flag is determined by the interpolate-frames

  • Config.prc variable.

  • Use set_blend_type() to change the algorithm that the character uses to

  • interpolate matrix positions.

*/

setRootXform()

C++ Interface: set_root_xform(const PartBundle self, const LMatrix4f root_xform)

/**
  • Specifies the transform matrix which is implicitly applied at the root of

  • the animated hierarchy.

*/

set_anim_blend_flag()

C++ Interface: set_anim_blend_flag(const PartBundle self, bool anim_blend_flag)

/**
  • Defines the way the character responds to multiple calls to

  • set_control_effect()). By default, this flag is set false, which disallows

  • multiple animations. When this flag is false, it is not necessary to

  • explicitly set the control_effect when starting an animation; starting the

  • animation will implicitly remove the control_effect from the previous

  • animation and set it on the current one.

  • However, if this flag is set true, the control_effect must be explicitly

  • set via set_control_effect() whenever an animation is to affect the

  • character.

*/

set_anim_preload()

C++ Interface: set_anim_preload(const PartBundle self, AnimPreloadTable table)

/**
  • Replaces the AnimPreloadTable associated with the PartBundle.

*/

set_blend_type()

C++ Interface: set_blend_type(const PartBundle self, int bt)

/**
  • Defines the algorithm that is used when blending multiple frames or

  • multiple animations together, when either anim_blend_flag or

  • frame_blend_flag is set to true.

  • See partBundle.h for a description of the meaning of each of the BlendType

  • values.

*/

set_control_effect()

C++ Interface: set_control_effect(const PartBundle self, AnimControl control, float effect)

/**
  • Sets the amount by which the character is affected by the indicated

  • AnimControl (and its associated animation). Normally, this will only be

  • zero or one. Zero indicates the animation does not affect the character,

  • and one means it does.

  • If the _anim_blend_flag is not false (see set_anim_blend_flag()), it is

  • possible to have multiple AnimControls in effect simultaneously. In this

  • case, the effect is a weight that indicates the relative importance of each

  • AnimControl to the final animation.

*/

set_frame_blend_flag()

C++ Interface: set_frame_blend_flag(const PartBundle self, bool frame_blend_flag)

/**
  • Specifies whether the character interpolates (blends) between two

  • sequential frames of an active animation, showing a smooth intra-frame

  • motion, or whether it holds each frame until the next frame is ready,

  • showing precisely the specified animation.

  • When this value is false, the character holds each frame until the next is

  • ready. When this is true, the character will interpolate between two

  • consecutive frames of animation for each frame the animation is onscreen,

  • according to the amount of time elapsed between the frames.

  • The default value of this flag is determined by the interpolate-frames

  • Config.prc variable.

  • Use set_blend_type() to change the algorithm that the character uses to

  • interpolate matrix positions.

*/

set_root_xform()

C++ Interface: set_root_xform(const PartBundle self, const LMatrix4f root_xform)

/**
  • Specifies the transform matrix which is implicitly applied at the root of

  • the animated hierarchy.

*/

update()

C++ Interface: update(const PartBundle self)

/**
  • Updates all the parts in the bundle to reflect the data for the current

  • frame (as set in each of the AnimControls).

  • Returns true if any part has changed as a result of this, or false

  • otherwise.

*/

waitPending()

C++ Interface: wait_pending(const PartBundle self)

/**
  • Blocks the current thread until all currently-pending AnimControls, with a

  • nonzero control effect, have been loaded and are properly bound.

*/

wait_pending()

C++ Interface: wait_pending(const PartBundle self)

/**
  • Blocks the current thread until all currently-pending AnimControls, with a

  • nonzero control effect, have been loaded and are properly bound.

*/

xform()

C++ Interface: xform(const PartBundle self, const LMatrix4f mat)

/**
  • Applies the indicated transform to the root of the animated hierarchy.

*/