Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-07-26 00:59:09 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-07-26 00:59:09 +0400
commit1b142434055e2b56b23991f0c9d695b6d4f33390 (patch)
tree8689574221e0d98697af406292b0383c14fc0c3b /source/gameengine/Converter
parentdff9dce1cdcb5250797f529456649510d2396096 (diff)
parent1c00eacca2b084d7189de33cb75e8612cb542030 (diff)
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r20937:21899
missing commits from peter 20942, 21165, 21170, 21174, 21597 these files still need manual merging source/blender/makesdna/DNA_sequence_types.h source/blender/src/sequence.c source/blender/src/seqeffects.c source/blender/src/editseq.c source/blender/include/BSE_sequence.h
Diffstat (limited to 'source/gameengine/Converter')
-rw-r--r--source/gameengine/Converter/BL_ActionActuator.cpp58
-rw-r--r--source/gameengine/Converter/BL_ActionActuator.h2
-rw-r--r--source/gameengine/Converter/BL_ArmatureObject.h1
3 files changed, 50 insertions, 11 deletions
diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp
index bed99a4f502..30055a717e3 100644
--- a/source/gameengine/Converter/BL_ActionActuator.cpp
+++ b/source/gameengine/Converter/BL_ActionActuator.cpp
@@ -805,6 +805,10 @@ PyObject* BL_ActionActuator::PyGetChannel(PyObject* value) {
bPoseChannel *pchan;
+ if(m_userpose==NULL && m_pose==NULL) {
+ BL_ArmatureObject *obj = (BL_ArmatureObject*)GetParent();
+ obj->GetPose(&m_pose); /* Get the underlying pose from the armature */
+ }
// get_pose_channel accounts for NULL pose, run on both incase one exists but
// the channel doesnt
@@ -950,14 +954,18 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel,
obj->GetPose(&m_pose); /* Get the underlying pose from the armature */
if (!m_userpose) {
- obj->GetPose(&m_pose); /* Get the underlying pose from the armature */
+ if(!m_pose)
+ obj->GetPose(&m_pose); /* Get the underlying pose from the armature */
game_copy_pose(&m_userpose, m_pose);
}
- pchan= verify_pose_channel(m_userpose, string); // adds the channel if its not there.
+ // pchan= verify_pose_channel(m_userpose, string); // adds the channel if its not there.
+ pchan= get_pose_channel(m_userpose, string); // adds the channel if its not there.
- VECCOPY (pchan->loc, matrix[3]);
- Mat4ToSize(matrix, pchan->size);
- Mat4ToQuat(matrix, pchan->quat);
+ if(pchan) {
+ VECCOPY (pchan->loc, matrix[3]);
+ Mat4ToSize(matrix, pchan->size);
+ Mat4ToQuat(matrix, pchan->quat);
+ }
}
else {
MT_Vector3 loc;
@@ -969,15 +977,24 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel,
// same as above
if (!m_userpose) {
- obj->GetPose(&m_pose); /* Get the underlying pose from the armature */
+ if(!m_pose)
+ obj->GetPose(&m_pose); /* Get the underlying pose from the armature */
game_copy_pose(&m_userpose, m_pose);
}
- pchan= verify_pose_channel(m_userpose, string);
+ // pchan= verify_pose_channel(m_userpose, string);
+ pchan= get_pose_channel(m_userpose, string); // adds the channel if its not there.
// for some reason loc.setValue(pchan->loc) fails
- pchan->loc[0]= loc[0]; pchan->loc[1]= loc[1]; pchan->loc[2]= loc[2];
- pchan->size[0]= size[0]; pchan->size[1]= size[1]; pchan->size[2]= size[2];
- pchan->quat[0]= quat[3]; pchan->quat[1]= quat[0]; pchan->quat[2]= quat[1]; pchan->quat[3]= quat[2]; /* notice xyzw -> wxyz is intentional */
+ if(pchan) {
+ pchan->loc[0]= loc[0]; pchan->loc[1]= loc[1]; pchan->loc[2]= loc[2];
+ pchan->size[0]= size[0]; pchan->size[1]= size[1]; pchan->size[2]= size[2];
+ pchan->quat[0]= quat[3]; pchan->quat[1]= quat[0]; pchan->quat[2]= quat[1]; pchan->quat[3]= quat[2]; /* notice xyzw -> wxyz is intentional */
+ }
+ }
+
+ if(pchan==NULL) {
+ PyErr_SetString(PyExc_ValueError, "Channel could not be found, use the 'channelNames' attribute to get a list of valid channels");
+ return NULL;
}
pchan->flag |= POSE_ROT|POSE_LOC|POSE_SIZE;
@@ -1051,6 +1068,7 @@ PyAttributeDef BL_ActionActuator::Attributes[] = {
KX_PYATTRIBUTE_FLOAT_RW("frameEnd", 0, MAXFRAMEF, BL_ActionActuator, m_endframe),
KX_PYATTRIBUTE_FLOAT_RW("blendIn", 0, MAXFRAMEF, BL_ActionActuator, m_blendin),
KX_PYATTRIBUTE_RW_FUNCTION("action", BL_ActionActuator, pyattr_get_action, pyattr_set_action),
+ KX_PYATTRIBUTE_RO_FUNCTION("channelNames", BL_ActionActuator, pyattr_get_channel_names),
KX_PYATTRIBUTE_SHORT_RW("priority", 0, 100, false, BL_ActionActuator, m_priority),
KX_PYATTRIBUTE_FLOAT_RW_CHECK("frame", 0, MAXFRAMEF, BL_ActionActuator, m_localtime, CheckFrame),
KX_PYATTRIBUTE_STRING_RW("propName", 0, 31, false, BL_ActionActuator, m_propname),
@@ -1094,3 +1112,23 @@ int BL_ActionActuator::pyattr_set_action(void *self_v, const KX_PYATTRIBUTE_DEF
return PY_SET_ATTR_SUCCESS;
}
+
+PyObject* BL_ActionActuator::pyattr_get_channel_names(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ BL_ActionActuator* self= static_cast<BL_ActionActuator*>(self_v);
+ PyObject *ret= PyList_New(0);
+ PyObject *item;
+
+ bPose *pose= ((BL_ArmatureObject*)self->GetParent())->GetOrigPose();
+
+ if(pose) {
+ bPoseChannel *pchan;
+ for(pchan= (bPoseChannel *)pose->chanbase.first; pchan; pchan= (bPoseChannel *)pchan->next) {
+ item= PyUnicode_FromString(pchan->name);
+ PyList_Append(ret, item);
+ Py_DECREF(item);
+ }
+ }
+
+ return ret;
+}
diff --git a/source/gameengine/Converter/BL_ActionActuator.h b/source/gameengine/Converter/BL_ActionActuator.h
index e328ce126ca..6003e23e315 100644
--- a/source/gameengine/Converter/BL_ActionActuator.h
+++ b/source/gameengine/Converter/BL_ActionActuator.h
@@ -114,7 +114,7 @@ public:
static PyObject* pyattr_get_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
-
+ static PyObject* pyattr_get_channel_names(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
/* attribute check */
static int CheckFrame(void *self, const PyAttributeDef*)
{
diff --git a/source/gameengine/Converter/BL_ArmatureObject.h b/source/gameengine/Converter/BL_ArmatureObject.h
index e1e176840a6..684d89d492b 100644
--- a/source/gameengine/Converter/BL_ArmatureObject.h
+++ b/source/gameengine/Converter/BL_ArmatureObject.h
@@ -60,6 +60,7 @@ public:
void GetMRDPose(struct bPose **pose);
void GetPose(struct bPose **pose);
void SetPose (struct bPose *pose);
+ struct bPose *GetOrigPose() {return m_pose;} // never edit this, only for accessing names
void ApplyPose();
void RestorePose();