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/editors/space_view3d | |
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/editors/space_view3d')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_select.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index bef9219f44c..602f790c8df 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -64,6 +64,7 @@ #include "BKE_context.h" #include "BKE_paint.h" #include "BKE_armature.h" +#include "BKE_depsgraph.h" #include "BKE_tessmesh.h" #include "BKE_movieclip.h" #include "BKE_object.h" @@ -333,7 +334,7 @@ static void do_lasso_select_pose(ViewContext *vc, Object *ob, int mcords[][2], s int sco1[2], sco2[2]; bArmature *arm = ob->data; - if (ob->type != OB_ARMATURE || ob->pose == NULL) return; + if ((ob->type != OB_ARMATURE) || (ob->pose == NULL)) return; for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { if (PBONE_VISIBLE(arm, pchan->bone) && (pchan->bone->flag & BONE_UNSELECTABLE) == 0) { @@ -348,6 +349,11 @@ static void do_lasso_select_pose(ViewContext *vc, Object *ob, int mcords[][2], s } } } + + if (arm->flag & ARM_HAS_VIZ_DEPS) { + /* mask modifier ('armature' mode), etc. */ + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); + } } static void object_deselect_all_visible(Scene *scene, View3D *v3d) @@ -1899,12 +1905,19 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, i } if (bone_selected) { - WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, base->object); + Object *ob = base->object; + bArmature *arm = ob->data; + + WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, ob); + + if (arm->flag & ARM_HAS_VIZ_DEPS) { + /* mask modifier ('armature' mode), etc. */ + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); + } } } - + WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, vc->scene); - } MEM_freeN(vbuffer); |