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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-07-14 21:59:26 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-07-14 21:59:26 +0400
commitf1a745c436887d14c8dbe1029154c13dda127ecd (patch)
tree1ef6b5c15242baf1e910e3e7791ffc8e42dc71ca /source/blender/makesrna/intern/rna_pose.c
parent4b3dafcaa765249c0787b41df014f32863cd202f (diff)
2.5: Armature
* Bone Transform panel now works, using appropriate EditBone or PoseChannel properties. * Bone name and parent are now editable. * Some other tweaks to the UI layouts for Armature and Bone. * Notifiers for armature/editbone properties.
Diffstat (limited to 'source/blender/makesrna/intern/rna_pose.c')
-rw-r--r--source/blender/makesrna/intern/rna_pose.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c
index b8863540bdf..ac2c37d4066 100644
--- a/source/blender/makesrna/intern/rna_pose.c
+++ b/source/blender/makesrna/intern/rna_pose.c
@@ -39,12 +39,18 @@
#ifdef RNA_RUNTIME
+#include "BLI_arithb.h"
+
#include "BKE_context.h"
#include "BKE_depsgraph.h"
#include "BKE_idprop.h"
+#include "ED_armature.h"
+
static void rna_Pose_update(bContext *C, PointerRNA *ptr)
{
+ // XXX when to use this? ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK);
+
DAG_object_flush_update(CTX_data_scene(C), ptr->id.data, OB_RECALC_DATA);
}
@@ -60,6 +66,39 @@ IDProperty *rna_PoseChannel_idproperties(PointerRNA *ptr, int create)
return pchan->prop;
}
+static void rna_PoseChannel_euler_rotation_get(PointerRNA *ptr, float *value)
+{
+ bPoseChannel *pchan= ptr->data;
+
+ if(pchan->rotmode == PCHAN_ROT_QUAT)
+ QuatToEul(pchan->quat, value);
+ else
+ VECCOPY(value, pchan->eul);
+}
+
+static void rna_PoseChannel_euler_rotation_set(PointerRNA *ptr, const float *value)
+{
+ bPoseChannel *pchan= ptr->data;
+
+ if(pchan->rotmode == PCHAN_ROT_QUAT)
+ EulToQuat((float*)value, pchan->quat);
+ else
+ VECCOPY(pchan->eul, value);
+}
+
+static void rna_PoseChannel_name_set(PointerRNA *ptr, const char *value)
+{
+ Object *ob= (Object*)ptr->id.data;
+ bPoseChannel *pchan= (bPoseChannel*)ptr->data;
+ char oldname[32], newname[32];
+
+ /* need to be on the stack */
+ BLI_strncpy(newname, value, 32);
+ BLI_strncpy(oldname, pchan->name, 32);
+
+ ED_armature_bone_rename(ob->data, oldname, newname);
+}
+
#else
/* users shouldn't be editing pose channel data directly -- better to set ipos and let blender calc pose_channel stuff */
@@ -86,7 +125,7 @@ static void rna_def_pose_channel(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Constraints", "Constraints that act on this PoseChannel.");
prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_PoseChannel_name_set");
RNA_def_property_ui_text(prop, "Name", "");
RNA_def_struct_name_property(srna, prop);
@@ -165,6 +204,7 @@ static void rna_def_pose_channel(BlenderRNA *brna)
prop= RNA_def_property(srna, "euler_rotation", PROP_FLOAT, PROP_ROTATION);
RNA_def_property_float_sdna(prop, NULL, "eul");
+ RNA_def_property_float_funcs(prop, "rna_PoseChannel_euler_rotation_get", "rna_PoseChannel_euler_rotation_set", NULL);
RNA_def_property_ui_text(prop, "Rotation (Euler)", "Rotation in Eulers.");
RNA_def_property_update(prop, NC_OBJECT|ND_POSE|ND_TRANSFORM, "rna_Pose_update");