diff --git a/release/scripts/ui/properties_data_bone.py b/release/scripts/ui/properties_data_bone.py index 3369adab5a8..e64b2e1a10d 100644 --- a/release/scripts/ui/properties_data_bone.py +++ b/release/scripts/ui/properties_data_bone.py @@ -223,8 +223,11 @@ class BONE_PT_display(BoneButtonsPanel): if wide_ui: col = split.column() + col.label(text="Custom Shape:") col.prop(pchan, "custom_shape", text="") + if pchan.custom_shape: + col.prop_object(pchan, "custom_shape_transform", ob.pose, "bones", text="") class BONE_PT_inverse_kinematics(BoneButtonsPanel): diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 1eff6c8f8e3..8a38e575cfa 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -3782,6 +3782,7 @@ static void direct_link_pose(FileData *fd, bPose *pose) pchan->bone= NULL; pchan->parent= newdataadr(fd, pchan->parent); pchan->child= newdataadr(fd, pchan->child); + pchan->custom_tx= newdataadr(fd, pchan->custom_tx); direct_link_constraints(fd, &pchan->constraints); diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index 1e0393479b0..3b21373139e 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -1106,6 +1106,8 @@ static int preview_notifier_id(ShaderPreview *sp) case ID_LA: return NC_LAMP; } + + return 0; } /* use same function for icon & shader, so the job manager diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index d8c2fb9d43e..c59c5cddb3f 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -1622,8 +1622,14 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, if ( (bone) && !(bone->flag & (BONE_HIDDEN_P|BONE_HIDDEN_PG)) ) { if (bone->layer & arm->layer) { + int use_custom = (pchan->custom) && !(arm->flag & ARM_NO_CUSTOM); glPushMatrix(); - glMultMatrixf(pchan->pose_mat); + + if(use_custom && pchan->custom_tx) { + glMultMatrixf(pchan->custom_tx->pose_mat); + } else { + glMultMatrixf(pchan->pose_mat); + } /* catch exception for bone with hidden parent */ flag= bone->flag; @@ -1637,7 +1643,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, /* set color-set to use */ set_pchan_colorset(ob, pchan); - if ((pchan->custom) && !(arm->flag & ARM_NO_CUSTOM)) { + if (use_custom) { /* if drawwire, don't try to draw in solid */ if (pchan->bone->flag & BONE_DRAWWIRE) draw_wire= 1; @@ -1687,7 +1693,12 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, if (pchan->custom) { if ((dt < OB_SOLID) || (bone->flag & BONE_DRAWWIRE)) { glPushMatrix(); - glMultMatrixf(pchan->pose_mat); + + if(pchan->custom_tx) { + glMultMatrixf(pchan->custom_tx->pose_mat); + } else { + glMultMatrixf(pchan->pose_mat); + } /* prepare colors */ if (arm->flag & ARM_POSEMODE) diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h index aa3b921565f..b6af91a9570 100644 --- a/source/blender/makesdna/DNA_action_types.h +++ b/source/blender/makesdna/DNA_action_types.h @@ -213,6 +213,7 @@ typedef struct bPoseChannel { float *path; /* totpath x 3 x float */ // XXX depreceated... old animation system (armature only viz) bMotionPath *mpath; /* motion path cache for this bone */ struct Object *custom; /* draws custom object instead of default bone shape */ + struct bPoseChannel *custom_tx; /* odd feature, display with another bones transform. needed in rare cases for advanced rigs, since the alternative is highly complicated - campbell */ } bPoseChannel; diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index 07c4445872e..ff8f21028eb 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -912,6 +912,13 @@ static void rna_def_pose_channel(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Custom Object", "Object that defines custom draw type for this bone."); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update"); + prop= RNA_def_property(srna, "custom_shape_transform", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "custom_tx"); + RNA_def_property_struct_type(prop, "PoseBone"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Custom Shape Transform", "Bone that defines the display transform of this custom shape."); + RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update"); + /* bone groups */ prop= RNA_def_property(srna, "bone_group_index", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "agrp_index");