Sanitize and cleanup a bit depsgraph relations building in some modifiers.
This commit mainly: * Removes some uneeded dependencies to geometry of other objects (since we only use positions of those objects...). * Ensures `DEG_add_modifier_to_transform_relation` is only called once per modifier (in one case at least it could be called twice). * For modifiers using texture mask, only add dependencies to object used to generate texture coordinates when there is actually a texture set. No behavior change expected from this commit...
This commit is contained in:
parent
5cc7036aa3
commit
85de07e64c
Notes:
blender-bot
2023-02-14 08:42:53 +01:00
Referenced by issue #76318, Preferences: Lower left button broken Referenced by issue #75715, Persistent Images causes crash while rendering animation Referenced by issue #75666, 2.83 alpha not opening (11th april release) Referenced by issue #75625, MacOS: Blender quits but with Problem Error Report: "Blender quit unexpectedly"
|
@ -134,19 +134,28 @@ static bool isDisabled(const struct Scene *UNUSED(scene),
|
|||
static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
|
||||
{
|
||||
DisplaceModifierData *dmd = (DisplaceModifierData *)md;
|
||||
if (dmd->map_object != NULL && dmd->texmapping == MOD_DISP_MAP_OBJECT) {
|
||||
MOD_depsgraph_update_object_bone_relation(
|
||||
ctx->node, dmd->map_object, dmd->map_bone, "Displace Modifier");
|
||||
DEG_add_modifier_to_transform_relation(ctx->node, "Displace Modifier");
|
||||
}
|
||||
if (dmd->texmapping == MOD_DISP_MAP_GLOBAL ||
|
||||
(ELEM(
|
||||
dmd->direction, MOD_DISP_DIR_X, MOD_DISP_DIR_Y, MOD_DISP_DIR_Z, MOD_DISP_DIR_RGB_XYZ) &&
|
||||
dmd->space == MOD_DISP_SPACE_GLOBAL)) {
|
||||
DEG_add_modifier_to_transform_relation(ctx->node, "Displace Modifier");
|
||||
bool need_transform_relation = false;
|
||||
|
||||
if (dmd->space == MOD_DISP_SPACE_GLOBAL &&
|
||||
ELEM(dmd->direction, MOD_DISP_DIR_X, MOD_DISP_DIR_Y, MOD_DISP_DIR_Z, MOD_DISP_DIR_RGB_XYZ)) {
|
||||
need_transform_relation = true;
|
||||
}
|
||||
|
||||
if (dmd->texture != NULL) {
|
||||
DEG_add_generic_id_relation(ctx->node, &dmd->texture->id, "Displace Modifier");
|
||||
|
||||
if (dmd->map_object != NULL && dmd->texmapping == MOD_DISP_MAP_OBJECT) {
|
||||
MOD_depsgraph_update_object_bone_relation(
|
||||
ctx->node, dmd->map_object, dmd->map_bone, "Displace Modifier");
|
||||
need_transform_relation = true;
|
||||
}
|
||||
if (dmd->texmapping == MOD_DISP_MAP_GLOBAL) {
|
||||
need_transform_relation = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (need_transform_relation) {
|
||||
DEG_add_modifier_to_transform_relation(ctx->node, "Displace Modifier");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -155,24 +155,31 @@ static void foreachTexLink(ModifierData *md, Object *ob, TexWalkFunc walk, void
|
|||
static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
|
||||
{
|
||||
WarpModifierData *wmd = (WarpModifierData *)md;
|
||||
bool need_transform_relation = false;
|
||||
|
||||
if (wmd->object_from != NULL && wmd->object_to != NULL) {
|
||||
MOD_depsgraph_update_object_bone_relation(
|
||||
ctx->node, wmd->object_from, wmd->bone_from, "Warp Modifier");
|
||||
MOD_depsgraph_update_object_bone_relation(
|
||||
ctx->node, wmd->object_to, wmd->bone_to, "Warp Modifier");
|
||||
|
||||
DEG_add_modifier_to_transform_relation(ctx->node, "Warp Modifier");
|
||||
need_transform_relation = true;
|
||||
}
|
||||
|
||||
if ((wmd->texmapping == MOD_DISP_MAP_OBJECT) && wmd->map_object != NULL) {
|
||||
MOD_depsgraph_update_object_bone_relation(
|
||||
ctx->node, wmd->map_object, wmd->map_bone, "Warp Modifier");
|
||||
|
||||
DEG_add_modifier_to_transform_relation(ctx->node, "Warp Modifier map");
|
||||
}
|
||||
if (wmd->texture != NULL) {
|
||||
DEG_add_generic_id_relation(ctx->node, &wmd->texture->id, "Warp Modifier");
|
||||
|
||||
if ((wmd->texmapping == MOD_DISP_MAP_OBJECT) && wmd->map_object != NULL) {
|
||||
MOD_depsgraph_update_object_bone_relation(
|
||||
ctx->node, wmd->map_object, wmd->map_bone, "Warp Modifier");
|
||||
need_transform_relation = true;
|
||||
}
|
||||
else if (wmd->texmapping == MOD_DISP_MAP_GLOBAL) {
|
||||
need_transform_relation = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (need_transform_relation) {
|
||||
DEG_add_modifier_to_transform_relation(ctx->node, "Warp Modifier");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -98,18 +98,28 @@ static void foreachTexLink(ModifierData *md, Object *ob, TexWalkFunc walk, void
|
|||
static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
|
||||
{
|
||||
WaveModifierData *wmd = (WaveModifierData *)md;
|
||||
bool need_transform_relation = false;
|
||||
|
||||
if (wmd->objectcenter != NULL) {
|
||||
DEG_add_object_relation(ctx->node, wmd->objectcenter, DEG_OB_COMP_TRANSFORM, "Wave Modifier");
|
||||
}
|
||||
MOD_depsgraph_update_object_bone_relation(
|
||||
ctx->node, wmd->map_object, wmd->map_bone, "Wave Modifier");
|
||||
if (wmd->objectcenter != NULL || wmd->map_object != NULL) {
|
||||
DEG_add_modifier_to_transform_relation(ctx->node, "Wave Modifier");
|
||||
need_transform_relation = true;
|
||||
}
|
||||
|
||||
if (wmd->texture != NULL) {
|
||||
DEG_add_generic_id_relation(ctx->node, &wmd->texture->id, "Wave Modifier");
|
||||
|
||||
if ((wmd->texmapping == MOD_DISP_MAP_OBJECT) && wmd->map_object != NULL) {
|
||||
MOD_depsgraph_update_object_bone_relation(
|
||||
ctx->node, wmd->map_object, wmd->map_bone, "Wave Modifier");
|
||||
need_transform_relation = true;
|
||||
}
|
||||
else if (wmd->texmapping == MOD_DISP_MAP_GLOBAL) {
|
||||
need_transform_relation = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (need_transform_relation) {
|
||||
DEG_add_modifier_to_transform_relation(ctx->node, "Wave Modifier");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -135,16 +135,23 @@ static void foreachTexLink(ModifierData *md, Object *ob, TexWalkFunc walk, void
|
|||
static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
|
||||
{
|
||||
WeightVGEditModifierData *wmd = (WeightVGEditModifierData *)md;
|
||||
if (wmd->mask_tex_map_obj != NULL && wmd->mask_tex_mapping == MOD_DISP_MAP_OBJECT) {
|
||||
MOD_depsgraph_update_object_bone_relation(
|
||||
ctx->node, wmd->mask_tex_map_obj, wmd->mask_tex_map_bone, "WeightVGEdit Modifier");
|
||||
DEG_add_modifier_to_transform_relation(ctx->node, "WeightVGEdit Modifier");
|
||||
}
|
||||
else if (wmd->mask_tex_mapping == MOD_DISP_MAP_GLOBAL) {
|
||||
DEG_add_modifier_to_transform_relation(ctx->node, "WeightVGEdit Modifier");
|
||||
}
|
||||
bool need_transform_relation = false;
|
||||
|
||||
if (wmd->mask_texture != NULL) {
|
||||
DEG_add_generic_id_relation(ctx->node, &wmd->mask_texture->id, "WeightVGEdit Modifier");
|
||||
|
||||
if (wmd->mask_tex_map_obj != NULL && wmd->mask_tex_mapping == MOD_DISP_MAP_OBJECT) {
|
||||
MOD_depsgraph_update_object_bone_relation(
|
||||
ctx->node, wmd->mask_tex_map_obj, wmd->mask_tex_map_bone, "WeightVGEdit Modifier");
|
||||
need_transform_relation = true;
|
||||
}
|
||||
else if (wmd->mask_tex_mapping == MOD_DISP_MAP_GLOBAL) {
|
||||
need_transform_relation = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (need_transform_relation) {
|
||||
DEG_add_modifier_to_transform_relation(ctx->node, "WeightVGEdit Modifier");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -181,19 +181,23 @@ static void foreachTexLink(ModifierData *md, Object *ob, TexWalkFunc walk, void
|
|||
static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
|
||||
{
|
||||
WeightVGMixModifierData *wmd = (WeightVGMixModifierData *)md;
|
||||
if (wmd->mask_tex_map_obj != NULL && wmd->mask_tex_mapping == MOD_DISP_MAP_OBJECT) {
|
||||
MOD_depsgraph_update_object_bone_relation(
|
||||
ctx->node, wmd->mask_tex_map_obj, wmd->mask_tex_map_bone, "WeightVGMix Modifier");
|
||||
DEG_add_object_relation(
|
||||
ctx->node, wmd->mask_tex_map_obj, DEG_OB_COMP_GEOMETRY, "WeightVGMix Modifier");
|
||||
bool need_transform_relation = false;
|
||||
|
||||
DEG_add_modifier_to_transform_relation(ctx->node, "WeightVGMix Modifier");
|
||||
}
|
||||
else if (wmd->mask_tex_mapping == MOD_DISP_MAP_GLOBAL) {
|
||||
DEG_add_modifier_to_transform_relation(ctx->node, "WeightVGMix Modifier");
|
||||
}
|
||||
if (wmd->mask_texture != NULL) {
|
||||
DEG_add_generic_id_relation(ctx->node, &wmd->mask_texture->id, "WeightVGMix Modifier");
|
||||
|
||||
if (wmd->mask_tex_map_obj != NULL && wmd->mask_tex_mapping == MOD_DISP_MAP_OBJECT) {
|
||||
MOD_depsgraph_update_object_bone_relation(
|
||||
ctx->node, wmd->mask_tex_map_obj, wmd->mask_tex_map_bone, "WeightVGMix Modifier");
|
||||
need_transform_relation = true;
|
||||
}
|
||||
else if (wmd->mask_tex_mapping == MOD_DISP_MAP_GLOBAL) {
|
||||
need_transform_relation = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (need_transform_relation) {
|
||||
DEG_add_modifier_to_transform_relation(ctx->node, "WeightVGMix Modifier");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -366,6 +366,8 @@ static void foreachTexLink(ModifierData *md, Object *ob, TexWalkFunc walk, void
|
|||
static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
|
||||
{
|
||||
WeightVGProximityModifierData *wmd = (WeightVGProximityModifierData *)md;
|
||||
bool need_transform_relation = false;
|
||||
|
||||
if (wmd->proximity_ob_target != NULL) {
|
||||
DEG_add_object_relation(
|
||||
ctx->node, wmd->proximity_ob_target, DEG_OB_COMP_TRANSFORM, "WeightVGProximity Modifier");
|
||||
|
@ -374,17 +376,25 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
|
|||
DEG_add_object_relation(
|
||||
ctx->node, wmd->proximity_ob_target, DEG_OB_COMP_GEOMETRY, "WeightVGProximity Modifier");
|
||||
}
|
||||
need_transform_relation = true;
|
||||
}
|
||||
if (wmd->mask_tex_map_obj != NULL && wmd->mask_tex_mapping == MOD_DISP_MAP_OBJECT) {
|
||||
MOD_depsgraph_update_object_bone_relation(
|
||||
ctx->node, wmd->mask_tex_map_obj, wmd->mask_tex_map_bone, "WeightVGProximity Modifier");
|
||||
DEG_add_object_relation(
|
||||
ctx->node, wmd->mask_tex_map_obj, DEG_OB_COMP_GEOMETRY, "WeightVGProximity Modifier");
|
||||
}
|
||||
|
||||
if (wmd->mask_texture != NULL) {
|
||||
DEG_add_generic_id_relation(ctx->node, &wmd->mask_texture->id, "WeightVGProximity Modifier");
|
||||
|
||||
if (wmd->mask_tex_map_obj != NULL && wmd->mask_tex_mapping == MOD_DISP_MAP_OBJECT) {
|
||||
MOD_depsgraph_update_object_bone_relation(
|
||||
ctx->node, wmd->mask_tex_map_obj, wmd->mask_tex_map_bone, "WeightVGProximity Modifier");
|
||||
need_transform_relation = true;
|
||||
}
|
||||
else if (wmd->mask_tex_mapping == MOD_DISP_MAP_GLOBAL) {
|
||||
need_transform_relation = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (need_transform_relation) {
|
||||
DEG_add_modifier_to_transform_relation(ctx->node, "WeightVGProximity Modifier");
|
||||
}
|
||||
DEG_add_modifier_to_transform_relation(ctx->node, "WeightVGProximity Modifier");
|
||||
}
|
||||
|
||||
static bool isDisabled(const struct Scene *UNUSED(scene),
|
||||
|
|
Loading…
Reference in New Issue