diff options
Diffstat (limited to 'source/blender/modifiers/intern/MOD_util.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_util.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c index 3210105f710..d0c4ee38112 100644 --- a/source/blender/modifiers/intern/MOD_util.c +++ b/source/blender/modifiers/intern/MOD_util.c @@ -63,13 +63,16 @@ #include "bmesh.h" -void MOD_init_texture(const Depsgraph *depsgraph, Tex *tex) +void MOD_init_texture(MappingInfoModifierData *dmd, const ModifierEvalContext *ctx) { - if (!tex) + Tex *tex = (Tex *)DEG_get_evaluated_id(ctx->depsgraph, &dmd->texture->id); + + if (tex == NULL) { return; + } if (tex->ima && BKE_image_is_animated(tex->ima)) { - BKE_image_user_frame_calc(&tex->iuser, DEG_get_ctime(depsgraph)); + BKE_image_user_frame_calc(&tex->iuser, DEG_get_ctime(ctx->depsgraph)); } } @@ -77,6 +80,7 @@ void MOD_init_texture(const Depsgraph *depsgraph, Tex *tex) /** \param cos may be NULL, in which case we use directly mesh vertices' coordinates. */ void MOD_get_texture_coords( MappingInfoModifierData *dmd, + const ModifierEvalContext *ctx, Object *ob, Mesh *mesh, float (*cos)[3], @@ -88,10 +92,13 @@ void MOD_get_texture_coords( float mapob_imat[4][4]; if (texmapping == MOD_DISP_MAP_OBJECT) { - if (dmd->map_object) - invert_m4_m4(mapob_imat, dmd->map_object->obmat); - else /* if there is no map object, default to local */ + if (dmd->map_object != NULL) { + Object *map_object = DEG_get_evaluated_object(ctx->depsgraph, dmd->map_object); + invert_m4_m4(mapob_imat, map_object->obmat); + } + else {/* if there is no map object, default to local */ texmapping = MOD_DISP_MAP_LOCAL; + } } /* UVs need special handling, since they come from faces */ |