Factorize some common modifiers depsgraph relation update code.
Add a utility to deal with common 'object or posebone transform' case.
This commit is contained in:
parent
b0350d8310
commit
5cc7036aa3
|
@ -135,14 +135,8 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
|
|||
{
|
||||
DisplaceModifierData *dmd = (DisplaceModifierData *)md;
|
||||
if (dmd->map_object != NULL && dmd->texmapping == MOD_DISP_MAP_OBJECT) {
|
||||
if (dmd->map_bone[0] && dmd->map_object->type == OB_ARMATURE) {
|
||||
DEG_add_object_relation(
|
||||
ctx->node, dmd->map_object, DEG_OB_COMP_EVAL_POSE, "Displace Modifier");
|
||||
}
|
||||
else {
|
||||
DEG_add_object_relation(
|
||||
ctx->node, dmd->map_object, DEG_OB_COMP_TRANSFORM, "Displace Modifier");
|
||||
}
|
||||
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 ||
|
||||
|
|
|
@ -262,6 +262,22 @@ void MOD_get_vgroup(
|
|||
}
|
||||
}
|
||||
|
||||
void MOD_depsgraph_update_object_bone_relation(struct DepsNodeHandle *node,
|
||||
Object *object,
|
||||
const char *bonename,
|
||||
const char *description)
|
||||
{
|
||||
if (object == NULL) {
|
||||
return;
|
||||
}
|
||||
if (bonename[0] != '\0' && object->type == OB_ARMATURE) {
|
||||
DEG_add_object_relation(node, object, DEG_OB_COMP_EVAL_POSE, description);
|
||||
}
|
||||
else {
|
||||
DEG_add_object_relation(node, object, DEG_OB_COMP_TRANSFORM, description);
|
||||
}
|
||||
}
|
||||
|
||||
/* only called by BKE_modifier.h/modifier.c */
|
||||
void modifier_type_init(ModifierTypeInfo *types[])
|
||||
{
|
||||
|
|
|
@ -56,4 +56,8 @@ void MOD_get_vgroup(struct Object *ob,
|
|||
struct MDeformVert **dvert,
|
||||
int *defgrp_index);
|
||||
|
||||
void MOD_depsgraph_update_object_bone_relation(struct DepsNodeHandle *node,
|
||||
struct Object *object,
|
||||
const char *bonename,
|
||||
const char *description);
|
||||
#endif /* __MOD_UTIL_H__ */
|
||||
|
|
|
@ -233,26 +233,14 @@ static void foreachObjectLink(ModifierData *md, Object *ob, ObjectWalkFunc walk,
|
|||
walk(userData, ob, &umd->object_src, IDWALK_CB_NOP);
|
||||
}
|
||||
|
||||
static void uv_warp_deps_object_bone_new(struct DepsNodeHandle *node,
|
||||
Object *object,
|
||||
const char *bonename)
|
||||
{
|
||||
if (object != NULL) {
|
||||
if (object->type == OB_ARMATURE && bonename[0]) {
|
||||
DEG_add_object_relation(node, object, DEG_OB_COMP_EVAL_POSE, "UVWarp Modifier");
|
||||
}
|
||||
else {
|
||||
DEG_add_object_relation(node, object, DEG_OB_COMP_TRANSFORM, "UVWarp Modifier");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
|
||||
{
|
||||
UVWarpModifierData *umd = (UVWarpModifierData *)md;
|
||||
|
||||
uv_warp_deps_object_bone_new(ctx->node, umd->object_src, umd->bone_src);
|
||||
uv_warp_deps_object_bone_new(ctx->node, umd->object_dst, umd->bone_dst);
|
||||
MOD_depsgraph_update_object_bone_relation(
|
||||
ctx->node, umd->object_src, umd->bone_src, "UVWarp Modifier");
|
||||
MOD_depsgraph_update_object_bone_relation(
|
||||
ctx->node, umd->object_dst, umd->bone_dst, "UVWarp Modifier");
|
||||
|
||||
DEG_add_modifier_to_transform_relation(ctx->node, "UVWarp Modifier");
|
||||
}
|
||||
|
|
|
@ -152,31 +152,22 @@ static void foreachTexLink(ModifierData *md, Object *ob, TexWalkFunc walk, void
|
|||
walk(userData, ob, md, "texture");
|
||||
}
|
||||
|
||||
static void warp_deps_object_bone_new(struct DepsNodeHandle *node,
|
||||
Object *object,
|
||||
const char *bonename)
|
||||
{
|
||||
if (bonename[0] && object->type == OB_ARMATURE) {
|
||||
DEG_add_object_relation(node, object, DEG_OB_COMP_EVAL_POSE, "Warp Modifier");
|
||||
}
|
||||
else {
|
||||
DEG_add_object_relation(node, object, DEG_OB_COMP_TRANSFORM, "Warp Modifier");
|
||||
}
|
||||
}
|
||||
|
||||
static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
|
||||
{
|
||||
WarpModifierData *wmd = (WarpModifierData *)md;
|
||||
|
||||
if (wmd->object_from != NULL && wmd->object_to != NULL) {
|
||||
warp_deps_object_bone_new(ctx->node, wmd->object_from, wmd->bone_from);
|
||||
warp_deps_object_bone_new(ctx->node, wmd->object_to, wmd->bone_to);
|
||||
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");
|
||||
}
|
||||
|
||||
if ((wmd->texmapping == MOD_DISP_MAP_OBJECT) && wmd->map_object != NULL) {
|
||||
warp_deps_object_bone_new(ctx->node, wmd->map_object, wmd->map_bone);
|
||||
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");
|
||||
}
|
||||
|
|
|
@ -98,22 +98,16 @@ static void foreachTexLink(ModifierData *md, Object *ob, TexWalkFunc walk, void
|
|||
static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
|
||||
{
|
||||
WaveModifierData *wmd = (WaveModifierData *)md;
|
||||
|
||||
if (wmd->objectcenter != NULL) {
|
||||
DEG_add_object_relation(ctx->node, wmd->objectcenter, DEG_OB_COMP_TRANSFORM, "Wave Modifier");
|
||||
}
|
||||
if (wmd->map_object != NULL) {
|
||||
if (wmd->map_bone[0] && wmd->map_object->type == OB_ARMATURE) {
|
||||
DEG_add_object_relation(
|
||||
ctx->node, wmd->map_object, DEG_OB_COMP_EVAL_POSE, "Wave Modifier");
|
||||
}
|
||||
else {
|
||||
DEG_add_object_relation(
|
||||
ctx->node, wmd->map_object, 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");
|
||||
}
|
||||
|
||||
if (wmd->texture != NULL) {
|
||||
DEG_add_generic_id_relation(ctx->node, &wmd->texture->id, "Wave Modifier");
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
#include "MOD_util.h"
|
||||
#include "MOD_weightvg_util.h"
|
||||
|
||||
/**************************************
|
||||
|
@ -135,14 +136,8 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
|
|||
{
|
||||
WeightVGEditModifierData *wmd = (WeightVGEditModifierData *)md;
|
||||
if (wmd->mask_tex_map_obj != NULL && wmd->mask_tex_mapping == MOD_DISP_MAP_OBJECT) {
|
||||
if (wmd->mask_tex_map_bone[0] && wmd->mask_tex_map_obj->type == OB_ARMATURE) {
|
||||
DEG_add_object_relation(
|
||||
ctx->node, wmd->mask_tex_map_obj, DEG_OB_COMP_EVAL_POSE, "WeightVGEdit Modifier");
|
||||
}
|
||||
else {
|
||||
DEG_add_object_relation(
|
||||
ctx->node, wmd->mask_tex_map_obj, DEG_OB_COMP_TRANSFORM, "WeightVGEdit Modifier");
|
||||
}
|
||||
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) {
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
#include "MOD_util.h"
|
||||
#include "MOD_weightvg_util.h"
|
||||
|
||||
/**
|
||||
|
@ -181,14 +182,8 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
|
|||
{
|
||||
WeightVGMixModifierData *wmd = (WeightVGMixModifierData *)md;
|
||||
if (wmd->mask_tex_map_obj != NULL && wmd->mask_tex_mapping == MOD_DISP_MAP_OBJECT) {
|
||||
if (wmd->mask_tex_map_bone[0] && wmd->mask_tex_map_obj->type == OB_ARMATURE) {
|
||||
DEG_add_object_relation(
|
||||
ctx->node, wmd->mask_tex_map_obj, DEG_OB_COMP_EVAL_POSE, "WeightVGMix Modifier");
|
||||
}
|
||||
else {
|
||||
DEG_add_object_relation(
|
||||
ctx->node, wmd->mask_tex_map_obj, DEG_OB_COMP_TRANSFORM, "WeightVGMix Modifier");
|
||||
}
|
||||
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");
|
||||
|
||||
|
|
|
@ -376,14 +376,8 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
|
|||
}
|
||||
}
|
||||
if (wmd->mask_tex_map_obj != NULL && wmd->mask_tex_mapping == MOD_DISP_MAP_OBJECT) {
|
||||
if (wmd->mask_tex_map_bone[0] && wmd->mask_tex_map_obj->type == OB_ARMATURE) {
|
||||
DEG_add_object_relation(
|
||||
ctx->node, wmd->mask_tex_map_obj, DEG_OB_COMP_EVAL_POSE, "WeightVGProximity Modifier");
|
||||
}
|
||||
else {
|
||||
DEG_add_object_relation(
|
||||
ctx->node, wmd->mask_tex_map_obj, DEG_OB_COMP_TRANSFORM, "WeightVGProximity Modifier");
|
||||
}
|
||||
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");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue