diff options
author | Joshua Leung <aligorith@gmail.com> | 2012-06-03 11:49:54 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2012-06-03 11:49:54 +0400 |
commit | 7985fd0d1f532e0a564339e901d56bc5710437fe (patch) | |
tree | f7a0c55f2fc1cecfd3e8ceddd12e2a8a2b6541c7 /source/blender/makesrna/intern/rna_armature.c | |
parent | 1d4213b2bcb014cb5256d5ae8c8e10b370cc166e (diff) |
Part-Bugfix, Part-Feature Completion: 'Armature' Option for Mask Modifier
finally works
This commit finally hooks up the Mask Modifier's "Armature" option with the
relevant depsgraph updates on bone selection. Hence, this feature finally works
as it was originally intended - that is, bone selections can be used to control
which parts of the mesh that the mask modifier is applied to are displayed,
giving riggers more freedom to experiment with rigs that don't necessarily
feature overbearing/cluttering widgets.
Regarding the implementation ("has_viz_deps" flag):
This feature is just the "tip of the iceberg" of a number of related set of
rigging/visual animation tools I've had in mind for a while now (dating back to
the introduction of this modifier). Key considerations
- Not all rigs will use this, so we don't want an extra (depsgraph-flush +
search) recalc cost for those that don't use this.
- There are some planned features which will also use this
Diffstat (limited to 'source/blender/makesrna/intern/rna_armature.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_armature.c | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index f3742687fc5..b86077ff1bd 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -131,9 +131,10 @@ static void rna_Armature_update_layers(Main *bmain, Scene *UNUSED(scene), Pointe /* proxy lib exception, store it here so we can restore layers on file * load, since it would otherwise get lost due to being linked data */ - for (ob = bmain->object.first; ob; ob = ob->id.next) + for (ob = bmain->object.first; ob; ob = ob->id.next) { if (ob->data == arm && ob->pose) ob->pose->proxy_layer = arm->layer; + } WM_main_add_notifier(NC_GEOM | ND_DATA, arm); } @@ -141,7 +142,35 @@ static void rna_Armature_update_layers(Main *bmain, Scene *UNUSED(scene), Pointe static void rna_Armature_redraw_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { ID *id = ptr->id.data; + + WM_main_add_notifier(NC_GEOM | ND_DATA, id); +} +static void rna_Bone_select_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) +{ + ID *id = ptr->id.data; + + /* special updates for cases where rigs try to hook into armature drawing stuff + * e.g. Mask Modifier - 'Armature' option + */ + if (id) { + if (GS(id->name) == ID_AR) { + bArmature *arm = (bArmature *)id; + + if (arm->flag & ARM_HAS_VIZ_DEPS) { + DAG_id_tag_update(id, OB_RECALC_DATA); + } + } + else if (GS(id->name) == ID_OB) { + Object *ob = (Object *)id; + bArmature *arm = (bArmature *)ob->data; + + if (arm->flag & ARM_HAS_VIZ_DEPS) { + DAG_id_tag_update(id, OB_RECALC_DATA); + } + } + } + WM_main_add_notifier(NC_GEOM | ND_DATA, id); } @@ -608,8 +637,8 @@ static void rna_def_bone(BlenderRNA *brna) prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_SELECTED); RNA_def_property_ui_text(prop, "Select", ""); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_update(prop, 0, "rna_Armature_redraw_data"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* XXX: review whether this could be used for interesting effects... */ + RNA_def_property_update(prop, 0, "rna_Bone_select_update"); prop = RNA_def_property(srna, "select_head", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_ROOTSEL); |