Changeset View
Standalone View
source/blender/modifiers/intern/MOD_armature.c
| Show All 18 Lines | |||||
| /** \file | /** \file | ||||
| * \ingroup modifiers | * \ingroup modifiers | ||||
| */ | */ | ||||
| #include <string.h> | #include <string.h> | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BLI_listbase.h" | |||||
| #include "DNA_armature_types.h" | #include "DNA_armature_types.h" | ||||
| #include "DNA_object_types.h" | #include "DNA_object_types.h" | ||||
| #include "DNA_mesh_types.h" | #include "DNA_mesh_types.h" | ||||
| #include "BKE_action.h" | |||||
| #include "BKE_editmesh.h" | #include "BKE_editmesh.h" | ||||
| #include "BKE_lattice.h" | #include "BKE_lattice.h" | ||||
| #include "BKE_library.h" | #include "BKE_library.h" | ||||
| #include "BKE_library_query.h" | #include "BKE_library_query.h" | ||||
| #include "BKE_mesh.h" | #include "BKE_mesh.h" | ||||
| #include "BKE_modifier.h" | #include "BKE_modifier.h" | ||||
| #include "DEG_depsgraph_query.h" | #include "DEG_depsgraph_query.h" | ||||
| ▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | static void foreachObjectLink(ModifierData *md, Object *ob, ObjectWalkFunc walk, void *userData) | ||||
| walk(userData, ob, &amd->object, IDWALK_CB_NOP); | walk(userData, ob, &amd->object, IDWALK_CB_NOP); | ||||
| } | } | ||||
| static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx) | static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx) | ||||
| { | { | ||||
| ArmatureModifierData *amd = (ArmatureModifierData *)md; | ArmatureModifierData *amd = (ArmatureModifierData *)md; | ||||
| if (amd->object != NULL) { | if (amd->object != NULL) { | ||||
| /* If not using envelopes, create relations to individual bones for more rigging flexibility. */ | |||||
| if ((amd->deformflag & ARM_DEF_ENVELOPE) == 0 && | |||||
| (amd->object->pose != NULL && ctx->object != NULL)) { | |||||
sergey: `ctx->object` can not be `NULL`. | |||||
| /* But only when actually using vertex groups. */ | |||||
| if ((amd->deformflag & ARM_DEF_VGROUP) != 0 && | |||||
| ELEM(ctx->object->type, OB_MESH, OB_LATTICE, OB_GPENCIL)) { | |||||
sergeyUnsubmitted Not Done Inline ActionsShould this have a corresponding else with a relation to the entire pose? sergey: Should this have a corresponding `else` with a relation to the entire pose? | |||||
angavrilovAuthorUnsubmitted Done Inline ActionsWell, I might be mistaken, but afaict if neither envelopes nor groups are enabled or available, the modifier will simply do nothing, so it has no dependencies. The envelope case requires a link to the whole pose because any deform bone can be used (even if groups are enabled in some cases), and BONE_NO_DEFORM can be animated. angavrilov: Well, I might be mistaken, but afaict if neither envelopes nor groups are enabled or available… | |||||
sergeyUnsubmitted Not Done Inline ActionsWorth adding as a comment maybe? sergey: Worth adding as a comment maybe? | |||||
| /* Enumerate groups that match existing bones. */ | |||||
| LISTBASE_FOREACH (bDeformGroup *, dg, &ctx->object->defbase) { | |||||
| if (BKE_pose_channel_find_name(amd->object->pose, dg->name) != NULL) { | |||||
| /* Can't check BONE_NO_DEFORM because it can be animated. */ | |||||
brechtUnsubmitted Not Done Inline ActionsYou could check if the property is animated or has a driver, and in that case add always add the relation. We do this kind of thing for animated object visibility and will also need it to fix the animated bbone parameter crash. brecht: You could check if the property is animated or has a driver, and in that case add always add… | |||||
angavrilovAuthorUnsubmitted Done Inline ActionsCan you do that easily? angavrilov: Can you do that easily? | |||||
brechtUnsubmitted Not Done Inline ActionsThere is no really simple and efficient way to check it currently. See visibility_animated_check_cb for how it's done now. However I imagine that in the spring rig, the bones that happen to have a matching vertex groups but are not used for deform is quite small and would not make much of a performance impact. brecht: There is no really simple and efficient way to check it currently. See… | |||||
| DEG_add_bone_relation( | |||||
| ctx->node, amd->object, dg->name, DEG_OB_COMP_BONE, "Armature Modifier"); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| /* Otherwise require the whole pose to be complete. */ | |||||
| else { | |||||
| DEG_add_object_relation(ctx->node, amd->object, DEG_OB_COMP_EVAL_POSE, "Armature Modifier"); | DEG_add_object_relation(ctx->node, amd->object, DEG_OB_COMP_EVAL_POSE, "Armature Modifier"); | ||||
| } | |||||
| DEG_add_object_relation(ctx->node, amd->object, DEG_OB_COMP_TRANSFORM, "Armature Modifier"); | DEG_add_object_relation(ctx->node, amd->object, DEG_OB_COMP_TRANSFORM, "Armature Modifier"); | ||||
| } | } | ||||
| DEG_add_modifier_to_transform_relation(ctx->node, "Armature Modifier"); | DEG_add_modifier_to_transform_relation(ctx->node, "Armature Modifier"); | ||||
| } | } | ||||
| static void deformVerts(ModifierData *md, | static void deformVerts(ModifierData *md, | ||||
| const ModifierEvalContext *ctx, | const ModifierEvalContext *ctx, | ||||
| Mesh *mesh, | Mesh *mesh, | ||||
| ▲ Show 20 Lines • Show All 140 Lines • Show Last 20 Lines | |||||
ctx->object can not be NULL.