Added to characterJoint

INLINE const LMatrix4 &get_transform() const;
  CPT(TransformState) get_transform_state() const;

This is to reduce the code bloat for freezing a joint using actor.
Previously, freezing a joint (using its current transform required two temporary
initailizations, a Mat4() and a TransformState in python.

tmat = tmat4(); joint.getTransform( tmat); tstate = TransformState( tmat);
freeze(..., transform = tstate )

now this can be collapsed down to
freeze( ..., transform = joint.getTransformState() )
This commit is contained in:
Zhao Huang 2011-12-15 01:51:59 +00:00
parent 7e8737dd3d
commit a34cb75f82
3 changed files with 18 additions and 0 deletions

View File

@ -12,3 +12,12 @@
//
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
// Function: CharacterJoint::get_transform
// Access: Published
// Description: Returns the transform matrix of the joint
////////////////////////////////////////////////////////////////////
INLINE const LMatrix4 &CharacterJoint::
get_transform() const {
return _value;
}

View File

@ -425,6 +425,11 @@ get_transform(LMatrix4 &transform) const {
transform = _value;
}
CPT(TransformState) CharacterJoint::
get_transform_state() const {
return TransformState::make_mat( _value );
}
////////////////////////////////////////////////////////////////////
// Function: CharacterJoint::get_net_transform
// Access: Published

View File

@ -16,6 +16,7 @@
#define CHARACTERJOINT_H
#include "pandabase.h"
#include "transformState.h"
#include "movingPartMatrix.h"
#include "pandaNode.h"
@ -64,6 +65,9 @@ PUBLISHED:
NodePathCollection get_local_transforms();
void get_transform(LMatrix4 &transform) const;
INLINE const LMatrix4 &get_transform() const;
CPT(TransformState) get_transform_state() const;
void get_net_transform(LMatrix4 &transform) const;
Character *get_character() const;