[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22720] branches/blender2.5/blender: 2. 5 - Custom Shape and Bone Groups can be viewed/set on Bones again.
Joshua Leung
aligorith at gmail.com
Sun Aug 23 14:53:57 CEST 2009
Revision: 22720
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22720
Author: aligorith
Date: 2009-08-23 14:53:55 +0200 (Sun, 23 Aug 2009)
Log Message:
-----------
2.5 - Custom Shape and Bone Groups can be viewed/set on Bones again.
Modified Paths:
--------------
branches/blender2.5/blender/release/ui/buttons_data_bone.py
branches/blender2.5/blender/source/blender/makesrna/intern/rna_pose.c
Modified: branches/blender2.5/blender/release/ui/buttons_data_bone.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_bone.py 2009-08-23 12:50:08 UTC (rev 22719)
+++ branches/blender2.5/blender/release/ui/buttons_data_bone.py 2009-08-23 12:53:55 UTC (rev 22720)
@@ -74,10 +74,13 @@
def draw(self, context):
layout = self.layout
+ ob = context.object
bone = context.bone
arm = context.armature
if not bone:
bone = context.edit_bone
+ else:
+ pchan = ob.pose.pose_channels[context.bone.name]
split = layout.split()
@@ -87,14 +90,14 @@
col.itemR(bone, "parent", text="")
else:
col.item_pointerR(bone, "parent", arm, "edit_bones", text="")
-
+
row = col.row()
row.active = bone.parent != None
row.itemR(bone, "connected")
-
+
col.itemL(text="Layers:")
col.template_layers(bone, "layer")
-
+
col = split.column()
col.itemL(text="Inherit:")
col.itemR(bone, "hinge", text="Rotation")
@@ -102,6 +105,17 @@
col.itemL(text="Display:")
col.itemR(bone, "draw_wire", text="Wireframe")
col.itemR(bone, "hidden", text="Hide")
+
+ if ob and pchan:
+ split = layout.split()
+
+ col = split.column()
+ col.itemL(text="Bone Group:")
+ col.item_pointerR(pchan, "bone_group", ob.pose, "bone_groups", text="")
+
+ col = split.column()
+ col.itemL(text="Custom Shape:")
+ col.itemR(pchan, "custom_shape", text="")
class BONE_PT_inverse_kinematics(BoneButtonsPanel):
__label__ = "Inverse Kinematics"
Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_pose.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_pose.c 2009-08-23 12:50:08 UTC (rev 22719)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_pose.c 2009-08-23 12:53:55 UTC (rev 22720)
@@ -151,12 +151,72 @@
return ED_pose_channel_in_IK_chain(ob, pchan);
}
+static PointerRNA rna_PoseChannel_bone_group_get(PointerRNA *ptr)
+{
+ Object *ob= (Object*)ptr->id.data;
+ bPose *pose= (ob) ? ob->pose : NULL;
+ bPoseChannel *pchan= (bPoseChannel*)ptr->data;
+ bActionGroup *grp;
+
+ if (pose)
+ grp= BLI_findlink(&pose->agroups, pchan->agrp_index-1);
+ else
+ grp= NULL;
+
+ return rna_pointer_inherit_refine(ptr, &RNA_BoneGroup, grp);
+}
+
+static void rna_PoseChannel_bone_group_set(PointerRNA *ptr, PointerRNA value)
+{
+ Object *ob= (Object*)ptr->id.data;
+ bPose *pose= (ob) ? ob->pose : NULL;
+ bPoseChannel *pchan= (bPoseChannel*)ptr->data;
+
+ if (pose)
+ pchan->agrp_index= BLI_findindex(&pose->agroups, value.data) + 1;
+ else
+ pchan->agrp_index= 0;
+}
+
+static int rna_PoseChannel_bone_group_index_get(PointerRNA *ptr)
+{
+ bPoseChannel *pchan= (bPoseChannel*)ptr->data;
+ return MAX2(pchan->agrp_index-1, 0);
+}
+
+static void rna_PoseChannel_bone_group_index_set(PointerRNA *ptr, int value)
+{
+ bPoseChannel *pchan= (bPoseChannel*)ptr->data;
+ pchan->agrp_index= value+1;
+}
+
+static void rna_PoseChannel_bone_group_index_range(PointerRNA *ptr, int *min, int *max)
+{
+ Object *ob= (Object*)ptr->id.data;
+ bPose *pose= (ob) ? ob->pose : NULL;
+
+ *min= 0;
+
+ if (pose) {
+ *max= BLI_countlist(&pose->agroups)-1;
+ *max= MAX2(0, *max);
+ }
+ else
+ *max= 0;
+}
+
static PointerRNA rna_Pose_active_bone_group_get(PointerRNA *ptr)
{
bPose *pose= (bPose*)ptr->data;
return rna_pointer_inherit_refine(ptr, &RNA_BoneGroup, BLI_findlink(&pose->agroups, pose->active_group-1));
}
+static void rna_Pose_active_bone_group_set(PointerRNA *ptr, PointerRNA value)
+{
+ bPose *pose= (bPose*)ptr->data;
+ pose->active_group= BLI_findindex(&pose->agroups, value.data) + 1;
+}
+
static int rna_Pose_active_bone_group_index_get(PointerRNA *ptr)
{
bPose *pose= (bPose*)ptr->data;
@@ -304,60 +364,23 @@
RNA_def_struct_ui_text(srna, "Pose Channel", "Channel defining pose data for a bone in a Pose.");
RNA_def_struct_path_func(srna, "rna_PoseChannel_path");
RNA_def_struct_idproperties_func(srna, "rna_PoseChannel_idproperties");
-
+
+ /* Bone Constraints */
prop= RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "Constraint");
RNA_def_property_ui_text(prop, "Constraints", "Constraints that act on this PoseChannel.");
+ /* Name + Selection Status */
prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
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);
-
- prop= RNA_def_property(srna, "has_ik", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_PoseChannel_has_ik_get", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Has IK", "Is part of an IK chain.");
- RNA_def_property_update(prop, NC_OBJECT|ND_POSE|ND_TRANSFORM, "rna_Pose_update");
-
- prop= RNA_def_property(srna, "ik_dof_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "ikflag", BONE_IK_NO_XDOF);
- RNA_def_property_ui_text(prop, "IK X DoF", "Allow movement around the X axis.");
- RNA_def_property_update(prop, NC_OBJECT|ND_POSE|ND_TRANSFORM, "rna_Pose_update");
-
- prop= RNA_def_property(srna, "ik_dof_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "ikflag", BONE_IK_NO_YDOF);
- RNA_def_property_ui_text(prop, "IK Y DoF", "Allow movement around the Y axis.");
- RNA_def_property_update(prop, NC_OBJECT|ND_POSE|ND_TRANSFORM, "rna_Pose_update");
-
- prop= RNA_def_property(srna, "ik_dof_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "ikflag", BONE_IK_NO_ZDOF);
- RNA_def_property_ui_text(prop, "IK Z DoF", "Allow movement around the Z axis.");
- RNA_def_property_update(prop, NC_OBJECT|ND_POSE|ND_TRANSFORM, "rna_Pose_update");
-
- prop= RNA_def_property(srna, "ik_limit_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_XLIMIT);
- RNA_def_property_ui_text(prop, "IK X Limit", "Limit movement around the X axis.");
- RNA_def_property_update(prop, NC_OBJECT|ND_POSE|ND_TRANSFORM, "rna_Pose_update");
-
- prop= RNA_def_property(srna, "ik_limit_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_YLIMIT);
- RNA_def_property_ui_text(prop, "IK Y Limit", "Limit movement around the Y axis.");
- RNA_def_property_update(prop, NC_OBJECT|ND_POSE|ND_TRANSFORM, "rna_Pose_update");
-
- prop= RNA_def_property(srna, "ik_limit_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_ZLIMIT);
- RNA_def_property_ui_text(prop, "IK Z Limit", "Limit movement around the Z axis.");
- RNA_def_property_update(prop, NC_OBJECT|ND_POSE|ND_TRANSFORM, "rna_Pose_update");
prop= RNA_def_property(srna, "selected", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "selectflag", BONE_SELECTED);
RNA_def_property_ui_text(prop, "Selected", "");
-
- prop= RNA_def_property(srna, "bone_group_index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "agrp_index");
- RNA_def_property_ui_text(prop, "Bone Group Index", "Bone Group this pose channel belongs to (0=no group).");
+ /* Baked Bone Path cache data s*/
prop= RNA_def_property(srna, "path_start_frame", PROP_INT, PROP_TIME);
RNA_def_property_int_sdna(prop, NULL, "pathsf");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -369,7 +392,8 @@
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Bone Paths Calculation End Frame", "End frame of range of frames to use for Bone Path calculations.");
RNA_def_property_update(prop, NC_OBJECT|ND_POSE|ND_TRANSFORM, "rna_Pose_update");
-
+
+ /* Relationships to other bones */
prop= RNA_def_property(srna, "bone", PROP_POINTER, PROP_NEVER_NULL);
RNA_def_property_struct_type(prop, "Bone");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -384,7 +408,8 @@
RNA_def_property_struct_type(prop, "PoseChannel");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Child", "Child of this pose channel.");
-
+
+ /* Transformation settings */
prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
RNA_def_property_float_sdna(prop, NULL, "loc");
RNA_def_property_ui_text(prop, "Location", "");
@@ -429,6 +454,7 @@
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Constraint Inverse Matrix", "4x4 matrix, defines transform from final position to unconstrained position."); */
+ /* Head/Tail Coordinates (in Pose Space) - Automatically calculated... */
prop= RNA_def_property(srna, "pose_head", PROP_FLOAT, PROP_TRANSLATION);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Pose Head Position", "Location of head of the channel's bone.");
@@ -436,7 +462,44 @@
prop= RNA_def_property(srna, "pose_tail", PROP_FLOAT, PROP_TRANSLATION);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Pose Tail Position", "Location of tail of the channel's bone.");
+
+ /* IK Settings */
+ prop= RNA_def_property(srna, "has_ik", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_PoseChannel_has_ik_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Has IK", "Is part of an IK chain.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_POSE|ND_TRANSFORM, "rna_Pose_update");
+ prop= RNA_def_property(srna, "ik_dof_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "ikflag", BONE_IK_NO_XDOF);
+ RNA_def_property_ui_text(prop, "IK X DoF", "Allow movement around the X axis.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_POSE|ND_TRANSFORM, "rna_Pose_update");
+
+ prop= RNA_def_property(srna, "ik_dof_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "ikflag", BONE_IK_NO_YDOF);
+ RNA_def_property_ui_text(prop, "IK Y DoF", "Allow movement around the Y axis.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_POSE|ND_TRANSFORM, "rna_Pose_update");
+
+ prop= RNA_def_property(srna, "ik_dof_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "ikflag", BONE_IK_NO_ZDOF);
+ RNA_def_property_ui_text(prop, "IK Z DoF", "Allow movement around the Z axis.");
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list