[Bf-blender-cvs] [b68a951] wiggly-widgets: Modify facemaps mapping to bones.
Antony Riakiotakis
noreply at git.blender.org
Fri Dec 19 16:11:23 CET 2014
Commit: b68a951e91fdaaee491cc841a3a8b770bdf75a90
Author: Antony Riakiotakis
Date: Fri Dec 19 16:11:04 2014 +0100
Branches: wiggly-widgets
https://developer.blender.org/rBb68a951e91fdaaee491cc841a3a8b770bdf75a90
Modify facemaps mapping to bones.
Now simply add a flag to the armature modifier to use facemaps. Facemaps
on the mesh object with the same name as the armature bones will get
displayed as widgets.
===================================================================
M release/scripts/startup/bl_ui/properties_data_bone.py
M release/scripts/startup/bl_ui/properties_data_modifier.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/editors/space_view3d/space_view3d.c
M source/blender/makesdna/DNA_action_types.h
M source/blender/makesdna/DNA_armature_types.h
M source/blender/makesrna/intern/rna_modifier.c
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 fcc168f..c07e9d6 100644
--- a/release/scripts/startup/bl_ui/properties_data_bone.py
+++ b/release/scripts/startup/bl_ui/properties_data_bone.py
@@ -229,9 +229,7 @@ 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_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")
+ col.prop_search(pchan, "custom_shape_transform", ob.pose, "bones", text="At")
class BONE_PT_inverse_kinematics(BoneButtonsPanel, Panel):
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 7a96996..401546f 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -61,6 +61,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
col.label(text="Bind To:")
col.prop(md, "use_vertex_groups", text="Vertex Groups")
col.prop(md, "use_bone_envelopes", text="Bone Envelopes")
+ col.prop(md, "use_face_maps", text="Face Maps")
layout.separator()
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index 2938c6f..c1173cb 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -860,7 +860,6 @@ 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 f926e0a..f4a5d33 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -1712,7 +1712,6 @@ 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 8de44e1..59a8f79 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -2943,7 +2943,6 @@ 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) {
diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c
index 999d697..d8a32f0 100644
--- a/source/blender/editors/armature/pose_edit.c
+++ b/source/blender/editors/armature/pose_edit.c
@@ -455,7 +455,6 @@ 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 d13c505..db96dc1 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -1730,15 +1730,12 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
index = base->selcol;
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
- bool use_custom;
bone = pchan->bone;
arm->layer_used |= bone->layer;
- use_custom = (pchan->custom) && !(arm->flag & ARM_NO_CUSTOM);
/* 1) bone must be visible, 2) for OpenGL select-drawing cannot have unselectable [#27194] */
if (((bone->flag & (BONE_HIDDEN_P | BONE_HIDDEN_PG)) == 0) &&
- ((G.f & G_PICKSEL) == 0 || (bone->flag & BONE_UNSELECTABLE) == 0) &&
- !(use_custom && pchan->custom_fmap))
+ ((G.f & G_PICKSEL) == 0 || (bone->flag & BONE_UNSELECTABLE) == 0))
{
if (bone->layer & arm->layer) {
const bool use_custom = (pchan->custom) && !(arm->flag & ARM_NO_CUSTOM);
@@ -1843,7 +1840,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 && !pchan->custom_fmap) {
+ if (pchan->custom) {
if ((dt < OB_SOLID) || (bone->flag & BONE_DRAWWIRE)) {
glPushMatrix();
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 833b992..062fd7b 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -34,6 +34,7 @@
#include "DNA_armature_types.h"
#include "DNA_material_types.h"
+#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_camera_types.h"
@@ -45,12 +46,14 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
+#include "BKE_action.h"
#include "BKE_context.h"
#include "BKE_depsgraph.h"
#include "BKE_icons.h"
#include "BKE_key.h"
#include "BKE_library.h"
#include "BKE_main.h"
+#include "BKE_modifier.h"
#include "BKE_object.h"
#include "BKE_scene.h"
#include "BKE_screen.h"
@@ -781,10 +784,20 @@ static int WIDGETGROUP_armature_facemap_poll(const struct bContext *C, struct wm
{
Object *ob = CTX_data_active_object(C);
- if (ob && ob->type == OB_ARMATURE) {
- bArmature *arm = ob->data;
- if (!arm->edbo)
- return true;
+ if (ob && ob->type == OB_MESH && ob->fmaps.first) {
+ ModifierData *md;
+ VirtualModifierData virtualModifierData;
+
+ md = modifiers_getVirtualModifierList(ob, &virtualModifierData);
+
+ /* exception for shape keys because we can edit those */
+ for (; md; md = md->next) {
+ if (modifier_isEnabled(CTX_data_scene(C), md, eModifierMode_Realtime) && md->type == eModifierType_Armature) {
+ ArmatureModifierData *amd = (ArmatureModifierData *) md;
+ if (amd->object && (amd->deformflag & ARM_DEF_FACEMAPS))
+ return true;
+ }
+ }
}
return false;
}
@@ -794,19 +807,33 @@ static void WIDGETGROUP_armature_facemap_draw(const struct bContext *C, struct w
float color_shape[4] = {1.0f, 0.3f, 0.0f, 1.0f};
Object *ob = CTX_data_active_object(C);
wmWidget *widget;
-
- //bArmature *arm = ob->data;
- bPoseChannel *pchan;
-
- for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
- if (pchan->custom && pchan->custom_fmap) {
- int index = BLI_findindex(&pchan->custom->fmaps, pchan->custom_fmap);
- if (index != -1) {
- widget = WIDGET_facemap_new(wgroup, 0, pchan->custom, index);
- WIDGET_facemap_set_color(widget, color_shape);
+ Object *armature;
+ ModifierData *md;
+ VirtualModifierData virtualModifierData;
+ int index = 0;
+ bFaceMap *fmap = ob->fmaps.first;
+
+ md = modifiers_getVirtualModifierList(ob, &virtualModifierData);
+
+ /* exception for shape keys because we can edit those */
+ for (; md; md = md->next) {
+ if (modifier_isEnabled(CTX_data_scene(C), md, eModifierMode_Realtime) && md->type == eModifierType_Armature) {
+ ArmatureModifierData *amd = (ArmatureModifierData *) md;
+ if (amd->object && (amd->deformflag & ARM_DEF_FACEMAPS)) {
+ armature = amd->object;
+ break;
}
}
}
+
+
+ for (; fmap; fmap = fmap->next, index++) {
+ if (BKE_pose_channel_find_name(armature->pose, fmap->name)) {
+ widget = WIDGET_facemap_new(wgroup, 0, ob, index);
+ WIDGET_facemap_set_color(widget, color_shape);
+
+ }
+ }
}
diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h
index 6832959..243e747 100644
--- a/source/blender/makesdna/DNA_action_types.h
+++ b/source/blender/makesdna/DNA_action_types.h
@@ -212,7 +212,6 @@ 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/makesdna/DNA_armature_types.h b/source/blender/makesdna/DNA_armature_types.h
index b6d4a8c..716a0a4 100644
--- a/source/blender/makesdna/DNA_armature_types.h
+++ b/source/blender/makesdna/DNA_armature_types.h
@@ -154,7 +154,8 @@ typedef enum eArmature_DeformFlag {
ARM_DEF_ENVELOPE = (1<<1),
ARM_DEF_QUATERNION = (1<<2),
ARM_DEF_B_BONE_REST = (1<<3), /* deprecated */
- ARM_DEF_INVERT_VGROUP = (1<<4)
+ ARM_DEF_INVERT_VGROUP = (1<<4),
+ ARM_DEF_FACEMAPS = (1<<5)
} eArmature_DeformFlag;
#if (DNA_DEPRECATED_GCC_POISON == 1)
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 7058e90..802c5b5 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -1229,6 +1229,11 @@ static void rna_def_modifier_armature(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Use Bone Envelopes", "Bind Bone envelopes to armature modifier");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ prop = RNA_def_property(srna, "use_face_maps", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_FACEMAPS);
+ RNA_def_property_ui_text(prop, "Use
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list