[Bf-blender-cvs] [6b8ebd6] wiggly-widgets: Hook up facemap property to bones.

Antony Riakiotakis noreply at git.blender.org
Mon Dec 15 12:11:25 CET 2014


Commit: 6b8ebd6bd6eb39dea4a6f06ccd151dc760ee5e9b
Author: Antony Riakiotakis
Date:   Mon Dec 15 12:09:54 2014 +0100
Branches: wiggly-widgets
https://developer.blender.org/rB6b8ebd6bd6eb39dea4a6f06ccd151dc760ee5e9b

Hook up facemap property to bones.

A bone using a facemap will not be displayed at all, rather it will use
the facemap of the mesh as an interaction area. The facemap still does
nothing since it's not yet hooked up to the customdata and widget code.
That will come next.

===================================================================

M	release/scripts/startup/bl_ui/properties_data_bone.py
M	source/blender/blenkernel/intern/action.c
M	source/blender/blenkernel/intern/armature.c
M	source/blender/blenloader/intern/readfile.c
M	source/blender/editors/armature/pose_edit.c
M	source/blender/editors/space_view3d/drawarmature.c
M	source/blender/makesdna/DNA_action_types.h
M	source/blender/makesrna/intern/rna_pose.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/properties_data_bone.py b/release/scripts/startup/bl_ui/properties_data_bone.py
index c07e9d6..fcc168f 100644
--- a/release/scripts/startup/bl_ui/properties_data_bone.py
+++ b/release/scripts/startup/bl_ui/properties_data_bone.py
@@ -229,7 +229,9 @@ class BONE_PT_display(BoneButtonsPanel, Panel):
                 col.label(text="Custom Shape:")
                 col.prop(pchan, "custom_shape", text="")
                 if pchan.custom_shape:
-                    col.prop_search(pchan, "custom_shape_transform", ob.pose, "bones", text="At")
+                    col.prop_search(pchan, "custom_shape_fmap", pchan.custom_shape, "face_maps", text="Face Map")
+                    if not pchan.custom_shape_fmap:
+                        col.prop_search(pchan, "custom_shape_transform", ob.pose, "bones", text="At")
 
 
 class BONE_PT_inverse_kinematics(BoneButtonsPanel, Panel):
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index c1173cb..2938c6f 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -860,6 +860,7 @@ void BKE_pose_channel_copy_data(bPoseChannel *pchan, const bPoseChannel *pchan_f
 
 	/* custom shape */
 	pchan->custom = pchan_from->custom;
+	pchan->custom_fmap = pchan_from->custom_fmap;
 	if (pchan->custom) {
 		id_us_plus(&pchan->custom->id);
 	}
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index f4a5d33..f926e0a 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -1712,6 +1712,7 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected
 		else {
 			/* always copy custom shape */
 			pchan->custom = pchanp->custom;
+			pchan->custom_fmap = pchanp->custom_fmap;
 			if (pchan->custom) {
 				id_us_plus(&pchan->custom->id);
 			}
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 6bfa4e6..8de44e1 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -2943,6 +2943,7 @@ static void lib_link_pose(FileData *fd, Main *bmain, Object *ob, bPose *pose)
 		pchan->bone = BKE_armature_find_bone_name(arm, pchan->name);
 		
 		pchan->custom = newlibadr_us(fd, arm->id.lib, pchan->custom);
+		pchan->custom_fmap = newlibadr_us(fd, arm->id.lib, pchan->custom_fmap);
 		if (pchan->bone == NULL)
 			rebuild= 1;
 		else if (ob->id.lib==NULL && arm->id.lib) {
@@ -4926,7 +4927,7 @@ static void direct_link_object(FileData *fd, Object *ob)
 		direct_link_motionpath(fd, ob->mpath);
 	
 	link_list(fd, &ob->defbase);
-	link_list(fd, &ob->fmaps);	
+	link_list(fd, &ob->fmaps);
 // XXX deprecated - old animation system <<<
 	direct_link_nlastrips(fd, &ob->nlastrips);
 	link_list(fd, &ob->constraintChannels);
diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c
index d8a32f0..999d697 100644
--- a/source/blender/editors/armature/pose_edit.c
+++ b/source/blender/editors/armature/pose_edit.c
@@ -455,6 +455,7 @@ static void pose_copy_menu(Scene *scene)
 					break;
 					case 8: /* Custom Bone Shape */
 						pchan->custom = pchanact->custom;
+						pchan->custom_fmap = pchanact->custom_fmap;
 						if (pchan->custom) {
 							id_us_plus(&pchan->custom->id);
 						}
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c
index 691da78..24d0254 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -1739,6 +1739,11 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
 			{
 				if (bone->layer & arm->layer) {
 					const bool use_custom = (pchan->custom) && !(arm->flag & ARM_NO_CUSTOM);
+					
+					/* skip drawing in that case */
+					if (use_custom && pchan->custom_fmap)
+						continue;
+					
 					glPushMatrix();
 					
 					if (use_custom && pchan->custom_tx) {
@@ -1838,7 +1843,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
 			    ((G.f & G_PICKSEL) == 0 || (bone->flag & BONE_UNSELECTABLE) == 0) )
 			{
 				if (bone->layer & arm->layer) {
-					if (pchan->custom) {
+					if (pchan->custom && !pchan->custom_fmap) {
 						if ((dt < OB_SOLID) || (bone->flag & BONE_DRAWWIRE)) {
 							glPushMatrix();
 							
diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h
index 243e747..6832959 100644
--- a/source/blender/makesdna/DNA_action_types.h
+++ b/source/blender/makesdna/DNA_action_types.h
@@ -212,6 +212,7 @@ typedef struct bPoseChannel {
 	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 */
+	struct FaceMap *custom_fmap;    /* uses facemap of object to interact with it */
 
 	/* transforms - written in by actions or transform */
 	float loc[3];
diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c
index f72f97b..f825112 100644
--- a/source/blender/makesrna/intern/rna_pose.c
+++ b/source/blender/makesrna/intern/rna_pose.c
@@ -1072,6 +1072,12 @@ static void rna_def_pose_channel(BlenderRNA *brna)
 	                         "Bone that defines the display transform of this custom shape");
 	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
+
+	prop = RNA_def_property(srna, "custom_shape_fmap", PROP_POINTER, PROP_NONE);
+	RNA_def_property_pointer_sdna(prop, NULL, "custom_fmap");
+	RNA_def_property_struct_type(prop, "FaceMap");
+	RNA_def_property_flag(prop, PROP_EDITABLE);
+	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);




More information about the Bf-blender-cvs mailing list