Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2018-05-23 16:52:35 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2018-05-23 16:55:13 +0300
commit4a2213dc9a15d6fbff49cde6f919f27b7fbecf89 (patch)
treebd2f7093ad3446a454f63c85ba2a800178f6ae01 /source/blender/modifiers
parenta455e35343a46af48dc8c8b53356c09368509591 (diff)
Fix modifiers not using depsgraph time for texture evaluation.
Texture animation seems to be broken anyway currently, but at leat modifier side it should now be OK.
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r--source/blender/modifiers/intern/MOD_displace.c13
-rw-r--r--source/blender/modifiers/intern/MOD_util.c7
-rw-r--r--source/blender/modifiers/intern/MOD_util.h3
-rw-r--r--source/blender/modifiers/intern/MOD_warp.c12
-rw-r--r--source/blender/modifiers/intern/MOD_wave.c2
-rw-r--r--source/blender/modifiers/intern/MOD_weightvg_util.c6
-rw-r--r--source/blender/modifiers/intern/MOD_weightvg_util.h2
-rw-r--r--source/blender/modifiers/intern/MOD_weightvgedit.c2
-rw-r--r--source/blender/modifiers/intern/MOD_weightvgmix.c2
-rw-r--r--source/blender/modifiers/intern/MOD_weightvgproximity.c2
10 files changed, 34 insertions, 17 deletions
diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c
index 7997ccbfedc..d6b96b34273 100644
--- a/source/blender/modifiers/intern/MOD_displace.c
+++ b/source/blender/modifiers/intern/MOD_displace.c
@@ -52,6 +52,8 @@
#include "BKE_deform.h"
#include "BKE_object.h"
+#include "DEG_depsgraph.h"
+
#include "MEM_guardedalloc.h"
#include "MOD_util.h"
@@ -271,9 +273,11 @@ static void displaceModifier_do_task(
/* dm must be a CDDerivedMesh */
static void displaceModifier_do(
- DisplaceModifierData *dmd, Object *ob,
+ DisplaceModifierData *dmd, const ModifierEvalContext *ctx,
Mesh *mesh, float (*vertexCos)[3], const int numVerts)
{
+ Object *ob = ctx->object;
+ Depsgraph *depsgraph = ctx->depsgraph;
MVert *mvert;
MDeformVert *dvert;
int direction = dmd->direction;
@@ -295,7 +299,7 @@ static void displaceModifier_do(
"displaceModifier_do tex_co");
get_texture_coords_mesh((MappingInfoModifierData *)dmd, ob, mesh, vertexCos, tex_co);
- modifier_init_texture(dmd->modifier.scene, dmd->texture);
+ modifier_init_texture(depsgraph, dmd->texture);
}
else {
tex_co = NULL;
@@ -374,8 +378,7 @@ static void deformVerts(
BLI_assert(mesh_src->totvert == numVerts);
- displaceModifier_do((DisplaceModifierData *)md, ctx->object, mesh_src,
- vertexCos, numVerts);
+ displaceModifier_do((DisplaceModifierData *)md, ctx, mesh_src, vertexCos, numVerts);
if (mesh_src != mesh) {
BKE_id_free(NULL, mesh_src);
@@ -390,7 +393,7 @@ static void deformVertsEM(
BLI_assert(mesh_src->totvert == numVerts);
- displaceModifier_do((DisplaceModifierData *)md, ctx->object, mesh_src, vertexCos, numVerts);
+ displaceModifier_do((DisplaceModifierData *)md, ctx, mesh_src, vertexCos, numVerts);
if (mesh_src != mesh) {
BKE_id_free(NULL, mesh_src);
diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c
index c5593cd004e..4a62d17fa27 100644
--- a/source/blender/modifiers/intern/MOD_util.c
+++ b/source/blender/modifiers/intern/MOD_util.c
@@ -53,6 +53,9 @@
#include "BKE_modifier.h"
+#include "DEG_depsgraph.h"
+#include "DEG_depsgraph_query.h"
+
#include "MOD_util.h"
#include "MOD_modifiertypes.h"
@@ -60,13 +63,13 @@
#include "bmesh.h"
-void modifier_init_texture(const Scene *scene, Tex *tex)
+void modifier_init_texture(const Depsgraph *depsgraph, Tex *tex)
{
if (!tex)
return;
if (tex->ima && BKE_image_is_animated(tex->ima)) {
- BKE_image_user_frame_calc(&tex->iuser, scene->r.cfra, 0);
+ BKE_image_user_frame_calc(&tex->iuser, DEG_get_ctime(depsgraph), 0);
}
}
diff --git a/source/blender/modifiers/intern/MOD_util.h b/source/blender/modifiers/intern/MOD_util.h
index 4ca13e164fb..0b3452b22b8 100644
--- a/source/blender/modifiers/intern/MOD_util.h
+++ b/source/blender/modifiers/intern/MOD_util.h
@@ -34,6 +34,7 @@
#include "DEG_depsgraph_build.h"
struct DerivedMesh;
+struct Depsgraph;
struct MDeformVert;
struct Mesh;
struct ModifierData;
@@ -41,7 +42,7 @@ struct Object;
struct Scene;
struct Tex;
-void modifier_init_texture(const struct Scene *scene, struct Tex *texture);
+void modifier_init_texture(const struct Depsgraph *depsgraph, struct Tex *texture);
void get_texture_coords(
struct MappingInfoModifierData *dmd, struct Object *ob, struct DerivedMesh *dm,
float (*co)[3], float (*texco)[3], int numVerts);
diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c
index f6585521269..4df71d91e3e 100644
--- a/source/blender/modifiers/intern/MOD_warp.c
+++ b/source/blender/modifiers/intern/MOD_warp.c
@@ -45,6 +45,8 @@
#include "BKE_texture.h"
#include "BKE_colortools.h"
+#include "DEG_depsgraph.h"
+
#include "RE_shader_ext.h"
#include "MOD_util.h"
@@ -149,9 +151,11 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
}
static void warpModifier_do(
- WarpModifierData *wmd, Object *ob,
+ WarpModifierData *wmd, const ModifierEvalContext *ctx,
Mesh *mesh, float (*vertexCos)[3], int numVerts)
{
+ Object *ob = ctx->object;
+ Depsgraph *depsgraph = ctx->depsgraph;
float obinv[4][4];
float mat_from[4][4];
float mat_from_inv[4][4];
@@ -213,7 +217,7 @@ static void warpModifier_do(
tex_co = MEM_malloc_arrayN(numVerts, sizeof(*tex_co), "warpModifier_do tex_co");
get_texture_coords_mesh((MappingInfoModifierData *)wmd, ob, mesh, vertexCos, tex_co);
- modifier_init_texture(wmd->modifier.scene, wmd->texture);
+ modifier_init_texture(depsgraph, wmd->texture);
}
for (i = 0; i < numVerts; i++) {
@@ -316,7 +320,7 @@ static void deformVerts(
BLI_assert(mesh_src->totvert == numVerts);
- warpModifier_do((WarpModifierData *)md, ctx->object, mesh_src, vertexCos, numVerts);
+ warpModifier_do((WarpModifierData *)md, ctx, mesh_src, vertexCos, numVerts);
}
static void deformVertsEM(
@@ -331,7 +335,7 @@ static void deformVertsEM(
BLI_assert(mesh_src->totvert == numVerts);
- warpModifier_do((WarpModifierData *)md, ctx->object, mesh_src, vertexCos, numVerts);
+ warpModifier_do((WarpModifierData *)md, ctx, mesh_src, vertexCos, numVerts);
if (!mesh) {
BKE_id_free(NULL, mesh_src);
diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c
index 43f76c23351..552746634c5 100644
--- a/source/blender/modifiers/intern/MOD_wave.c
+++ b/source/blender/modifiers/intern/MOD_wave.c
@@ -194,7 +194,7 @@ static void waveModifier_do(
"waveModifier_do tex_co");
get_texture_coords_mesh((MappingInfoModifierData *)wmd, ob, mesh, vertexCos, tex_co);
- modifier_init_texture(wmd->modifier.scene, wmd->texture);
+ modifier_init_texture(depsgraph, wmd->texture);
}
if (lifefac != 0.0f) {
diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c
index 3d7c4bc24d8..a18e12e06ec 100644
--- a/source/blender/modifiers/intern/MOD_weightvg_util.c
+++ b/source/blender/modifiers/intern/MOD_weightvg_util.c
@@ -46,6 +46,8 @@
#include "BKE_modifier.h"
#include "BKE_texture.h" /* Texture masking. */
+#include "DEG_depsgraph.h"
+
#include "MEM_guardedalloc.h"
#include "MOD_util.h"
#include "MOD_weightvg_util.h"
@@ -116,11 +118,13 @@ void weightvg_do_map(int num, float *new_w, short falloff_type, CurveMapping *cm
* XXX The standard "factor" value is assumed in [0.0, 1.0] range. Else, weird results might appear.
*/
void weightvg_do_mask(
+ const ModifierEvalContext *ctx,
const int num, const int *indices, float *org_w, const float *new_w,
Object *ob, Mesh *mesh, const float fact, const char defgrp_name[MAX_VGROUP_NAME],
Scene *scene, Tex *texture, const int tex_use_channel, const int tex_mapping,
Object *tex_map_object, const char *tex_uvlayer_name)
{
+ Depsgraph *depsgraph = ctx->depsgraph;
int ref_didx;
int i;
@@ -148,7 +152,7 @@ void weightvg_do_mask(
tex_co = MEM_calloc_arrayN(numVerts, sizeof(*tex_co), "WeightVG Modifier, TEX mode, tex_co");
get_texture_coords_mesh(&t_map, ob, mesh, NULL, tex_co);
- modifier_init_texture(scene, texture);
+ modifier_init_texture(depsgraph, texture);
/* For each weight (vertex), make the mix between org and new weights. */
for (i = 0; i < num; ++i) {
diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.h b/source/blender/modifiers/intern/MOD_weightvg_util.h
index 341ea386e76..f69659e46a3 100644
--- a/source/blender/modifiers/intern/MOD_weightvg_util.h
+++ b/source/blender/modifiers/intern/MOD_weightvg_util.h
@@ -35,6 +35,7 @@ struct CurveMapping;
struct MDeformVert;
struct MDeformWeight;
struct Mesh;
+struct ModifierEvalContext;
struct Object;
struct Tex;
struct Scene;
@@ -73,6 +74,7 @@ void weightvg_do_map(int num, float *new_w, short mode, struct CurveMapping *cma
* XXX The standard "factor" value is assumed in [0.0, 1.0] range. Else, weird results might appear.
*/
void weightvg_do_mask(
+ const ModifierEvalContext *ctx,
const int num, const int *indices, float *org_w, const float *new_w, Object *ob,
struct Mesh *mesh, const float fact, const char defgrp_name[MAX_VGROUP_NAME],
struct Scene *scene, Tex *texture, const int tex_use_channel, const int tex_mapping,
diff --git a/source/blender/modifiers/intern/MOD_weightvgedit.c b/source/blender/modifiers/intern/MOD_weightvgedit.c
index 068488ecf95..7c71dd5159e 100644
--- a/source/blender/modifiers/intern/MOD_weightvgedit.c
+++ b/source/blender/modifiers/intern/MOD_weightvgedit.c
@@ -254,7 +254,7 @@ static Mesh *applyModifier(
}
/* Do masking. */
- weightvg_do_mask(numVerts, NULL, org_w, new_w, ctx->object, result, wmd->mask_constant,
+ weightvg_do_mask(ctx, numVerts, NULL, org_w, new_w, ctx->object, result, wmd->mask_constant,
wmd->mask_defgrp_name, wmd->modifier.scene, wmd->mask_texture,
wmd->mask_tex_use_channel, wmd->mask_tex_mapping,
wmd->mask_tex_map_obj, wmd->mask_tex_uvlayer_name);
diff --git a/source/blender/modifiers/intern/MOD_weightvgmix.c b/source/blender/modifiers/intern/MOD_weightvgmix.c
index 448e74371b5..1736bb01951 100644
--- a/source/blender/modifiers/intern/MOD_weightvgmix.c
+++ b/source/blender/modifiers/intern/MOD_weightvgmix.c
@@ -366,7 +366,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
}
/* Do masking. */
- weightvg_do_mask(numIdx, indices, org_w, new_w, ctx->object, result, wmd->mask_constant,
+ weightvg_do_mask(ctx, numIdx, indices, org_w, new_w, ctx->object, result, wmd->mask_constant,
wmd->mask_defgrp_name, wmd->modifier.scene, wmd->mask_texture,
wmd->mask_tex_use_channel, wmd->mask_tex_mapping,
wmd->mask_tex_map_obj, wmd->mask_tex_uvlayer_name);
diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c
index 6b31ca677cc..64133222c1e 100644
--- a/source/blender/modifiers/intern/MOD_weightvgproximity.c
+++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c
@@ -544,7 +544,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
do_map(ob, new_w, numIdx, wmd->min_dist, wmd->max_dist, wmd->falloff_type);
/* Do masking. */
- weightvg_do_mask(numIdx, indices, org_w, new_w, ob, result, wmd->mask_constant,
+ weightvg_do_mask(ctx, numIdx, indices, org_w, new_w, ob, result, wmd->mask_constant,
wmd->mask_defgrp_name, wmd->modifier.scene, wmd->mask_texture,
wmd->mask_tex_use_channel, wmd->mask_tex_mapping,
wmd->mask_tex_map_obj, wmd->mask_tex_uvlayer_name);