Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2012-06-03 11:49:54 +0400
committerJoshua Leung <aligorith@gmail.com>2012-06-03 11:49:54 +0400
commit7985fd0d1f532e0a564339e901d56bc5710437fe (patch)
treef7a0c55f2fc1cecfd3e8ceddd12e2a8a2b6541c7 /source/blender/modifiers/intern/MOD_mask.c
parent1d4213b2bcb014cb5256d5ae8c8e10b370cc166e (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/modifiers/intern/MOD_mask.c')
-rw-r--r--source/blender/modifiers/intern/MOD_mask.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/source/blender/modifiers/intern/MOD_mask.c b/source/blender/modifiers/intern/MOD_mask.c
index fe17c3ee988..5039ffef382 100644
--- a/source/blender/modifiers/intern/MOD_mask.c
+++ b/source/blender/modifiers/intern/MOD_mask.c
@@ -86,9 +86,12 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
MaskModifierData *mmd = (MaskModifierData *)md;
if (mmd->ob_arm) {
+ bArmature *arm = (bArmature *)mmd->ob_arm->data;
DagNode *armNode = dag_get_node(forest, mmd->ob_arm);
+ /* tag relationship in depsgraph, but also on the armature */
dag_add_relation(forest, armNode, obNode, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Mask Modifier");
+ arm->flag |= ARM_HAS_VIZ_DEPS;
}
}
@@ -149,7 +152,10 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
if (ELEM3(NULL, oba, oba->pose, ob->defbase.first))
return derivedData;
- /* determine whether each vertexgroup is associated with a selected bone or not */
+ /* determine whether each vertexgroup is associated with a selected bone or not
+ * - each cell is a boolean saying whether bone corresponding to the ith group is selected
+ * - groups that don't match a bone are treated as not existing (along with the corresponding ungrouped verts)
+ */
bone_select_array = MEM_mallocN(defbase_tot * sizeof(char), "mask array");
for (i = 0, def = ob->defbase.first; def; def = def->next, i++) {
@@ -163,13 +169,9 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
}
}
- /* if no bones selected, free hashes and return original mesh */
- if (bone_select_tot == 0) {
- MEM_freeN(bone_select_array);
- return derivedData;
- }
-
- /* repeat the previous check, but for dverts */
+ /* if no dverts (i.e. no data for vertex groups exists), we've got an
+ * inconsistent situation, so free hashes and return oirginal mesh
+ */
dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
if (dvert == NULL) {
MEM_freeN(bone_select_array);