Changeset View
Changeset View
Standalone View
Standalone View
source/blender/modifiers/intern/MOD_util.c
| Show First 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | |||||
| #include "MOD_modifiertypes.h" | #include "MOD_modifiertypes.h" | ||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "bmesh.h" | #include "bmesh.h" | ||||
| void MOD_init_texture(MappingInfoModifierData *dmd, const ModifierEvalContext *ctx) | void MOD_init_texture(MappingInfoModifierData *dmd, const ModifierEvalContext *ctx) | ||||
| { | { | ||||
| Tex *tex = (Tex *)DEG_get_evaluated_id(ctx->depsgraph, &dmd->texture->id); | Tex *tex = dmd->texture; | ||||
| if (tex == NULL) { | if (tex == NULL) { | ||||
| return; | return; | ||||
| } | } | ||||
| if (tex->ima && BKE_image_is_animated(tex->ima)) { | if (tex->ima && BKE_image_is_animated(tex->ima)) { | ||||
| BKE_image_user_frame_calc(&tex->iuser, DEG_get_ctime(ctx->depsgraph)); | BKE_image_user_frame_calc(&tex->iuser, DEG_get_ctime(ctx->depsgraph)); | ||||
| } | } | ||||
| } | } | ||||
| /* TODO to be renamed to get_texture_coords once we are done with moving modifiers to Mesh. */ | /* TODO to be renamed to get_texture_coords once we are done with moving modifiers to Mesh. */ | ||||
| /** \param cos: may be NULL, in which case we use directly mesh vertices' coordinates. */ | /** \param cos: may be NULL, in which case we use directly mesh vertices' coordinates. */ | ||||
| void MOD_get_texture_coords( | void MOD_get_texture_coords( | ||||
| MappingInfoModifierData *dmd, | MappingInfoModifierData *dmd, | ||||
| const ModifierEvalContext *ctx, | const ModifierEvalContext *UNUSED(ctx), | ||||
| Object *ob, | Object *ob, | ||||
| Mesh *mesh, | Mesh *mesh, | ||||
| float (*cos)[3], | float (*cos)[3], | ||||
| float (*r_texco)[3]) | float (*r_texco)[3]) | ||||
| { | { | ||||
| const int numVerts = mesh->totvert; | const int numVerts = mesh->totvert; | ||||
| int i; | int i; | ||||
| int texmapping = dmd->texmapping; | int texmapping = dmd->texmapping; | ||||
| float mapob_imat[4][4]; | float mapob_imat[4][4]; | ||||
| if (texmapping == MOD_DISP_MAP_OBJECT) { | if (texmapping == MOD_DISP_MAP_OBJECT) { | ||||
| if (dmd->map_object != NULL) { | if (dmd->map_object != NULL) { | ||||
| Object *map_object = DEG_get_evaluated_object(ctx->depsgraph, dmd->map_object); | Object *map_object = dmd->map_object; | ||||
| invert_m4_m4(mapob_imat, map_object->obmat); | invert_m4_m4(mapob_imat, map_object->obmat); | ||||
| } | } | ||||
| else {/* if there is no map object, default to local */ | else {/* if there is no map object, default to local */ | ||||
| texmapping = MOD_DISP_MAP_LOCAL; | texmapping = MOD_DISP_MAP_LOCAL; | ||||
| } | } | ||||
| } | } | ||||
| /* UVs need special handling, since they come from faces */ | /* UVs need special handling, since they come from faces */ | ||||
| ▲ Show 20 Lines • Show All 205 Lines • Show Last 20 Lines | |||||