[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45508] trunk/blender/source/blender/ modifiers/intern: Fix #30882: using an image sequence in the displace modifier did not update

Brecht Van Lommel brechtvanlommel at pandora.be
Tue Apr 10 16:11:46 CEST 2012


Revision: 45508
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45508
Author:   blendix
Date:     2012-04-10 14:11:45 +0000 (Tue, 10 Apr 2012)
Log Message:
-----------
Fix #30882: using an image sequence in the displace modifier did not update
properly in animation rendering.

Modified Paths:
--------------
    trunk/blender/source/blender/modifiers/intern/MOD_displace.c
    trunk/blender/source/blender/modifiers/intern/MOD_util.c
    trunk/blender/source/blender/modifiers/intern/MOD_util.h
    trunk/blender/source/blender/modifiers/intern/MOD_warp.c
    trunk/blender/source/blender/modifiers/intern/MOD_wave.c
    trunk/blender/source/blender/modifiers/intern/MOD_weightvg_util.c
    trunk/blender/source/blender/modifiers/intern/MOD_weightvg_util.h
    trunk/blender/source/blender/modifiers/intern/MOD_weightvgedit.c
    trunk/blender/source/blender/modifiers/intern/MOD_weightvgmix.c
    trunk/blender/source/blender/modifiers/intern/MOD_weightvgproximity.c

Modified: trunk/blender/source/blender/modifiers/intern/MOD_displace.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_displace.c	2012-04-10 13:19:16 UTC (rev 45507)
+++ trunk/blender/source/blender/modifiers/intern/MOD_displace.c	2012-04-10 14:11:45 UTC (rev 45508)
@@ -187,6 +187,8 @@
 				 "displaceModifier_do tex_co");
 	get_texture_coords((MappingInfoModifierData *)dmd, ob, dm, vertexCos, tex_co, numVerts);
 
+	modifier_init_texture(dmd->modifier.scene, dmd->texture);
+
 	for (i = 0; i < numVerts; ++i) {
 		TexResult texres;
 		float delta = 0, strength = dmd->strength;

Modified: trunk/blender/source/blender/modifiers/intern/MOD_util.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_util.c	2012-04-10 13:19:16 UTC (rev 45507)
+++ trunk/blender/source/blender/modifiers/intern/MOD_util.c	2012-04-10 14:11:45 UTC (rev 45508)
@@ -32,11 +32,13 @@
 
 #include <string.h>
 
+#include "DNA_curve_types.h"
+#include "DNA_image_types.h"
 #include "DNA_lattice_types.h"
+#include "DNA_meshdata_types.h"
 #include "DNA_modifier_types.h"
 #include "DNA_object_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_meshdata_types.h"
+#include "DNA_scene_types.h"
 
 #include "BLI_utildefines.h"
 #include "BLI_math_vector.h"
@@ -44,6 +46,7 @@
 
 #include "BKE_cdderivedmesh.h"
 #include "BKE_deform.h"
+#include "BKE_image.h"
 #include "BKE_lattice.h"
 #include "BKE_mesh.h"
 #include "BKE_displist.h"
@@ -57,6 +60,15 @@
 
 #include "RE_shader_ext.h"
 
+void modifier_init_texture(Scene *scene, Tex *tex)
+{
+	if (!tex)
+		return;
+
+	if (tex->ima && ELEM(tex->ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE))
+		BKE_image_user_calc_frame(&tex->iuser, scene->r.cfra, 0);
+}
+
 void get_texture_value(Tex *texture, float *tex_co, TexResult *texres)
 {
 	int result_type;

Modified: trunk/blender/source/blender/modifiers/intern/MOD_util.h
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_util.h	2012-04-10 13:19:16 UTC (rev 45507)
+++ trunk/blender/source/blender/modifiers/intern/MOD_util.h	2012-04-10 14:11:45 UTC (rev 45508)
@@ -40,6 +40,7 @@
 struct Tex;
 struct TexResult;
 
+void modifier_init_texture(struct Scene *scene, struct Tex *texture);
 void get_texture_value(struct Tex *texture, float *tex_co, struct TexResult *texres);
 void get_texture_coords(struct MappingInfoModifierData *dmd, struct Object *ob, struct DerivedMesh *dm, float (*co)[3], float (*texco)[3], int numVerts);
 void modifier_vgroup_cache(struct ModifierData *md, float (*vertexCos)[3]);

Modified: trunk/blender/source/blender/modifiers/intern/MOD_warp.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_warp.c	2012-04-10 13:19:16 UTC (rev 45507)
+++ trunk/blender/source/blender/modifiers/intern/MOD_warp.c	2012-04-10 14:11:45 UTC (rev 45508)
@@ -222,6 +222,8 @@
 	if (wmd->texture) {
 		tex_co = MEM_mallocN(sizeof(*tex_co) * numVerts, "warpModifier_do tex_co");
 		get_texture_coords((MappingInfoModifierData *)wmd, ob, dm, vertexCos, tex_co, numVerts);
+
+		modifier_init_texture(wmd->modifier.scene, wmd->texture);
 	}
 
 	for (i = 0; i < numVerts; i++) {

Modified: trunk/blender/source/blender/modifiers/intern/MOD_wave.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_wave.c	2012-04-10 13:19:16 UTC (rev 45507)
+++ trunk/blender/source/blender/modifiers/intern/MOD_wave.c	2012-04-10 14:11:45 UTC (rev 45508)
@@ -221,6 +221,8 @@
 		tex_co = MEM_mallocN(sizeof(*tex_co) * numVerts,
 					 "waveModifier_do tex_co");
 		get_texture_coords((MappingInfoModifierData *)wmd, ob, dm, vertexCos, tex_co, numVerts);
+
+		modifier_init_texture(wmd->modifier.scene, wmd->texture);
 	}
 
 	if (lifefac != 0.0f) {

Modified: trunk/blender/source/blender/modifiers/intern/MOD_weightvg_util.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_weightvg_util.c	2012-04-10 13:19:16 UTC (rev 45507)
+++ trunk/blender/source/blender/modifiers/intern/MOD_weightvg_util.c	2012-04-10 14:11:45 UTC (rev 45508)
@@ -38,6 +38,7 @@
 #include "DNA_meshdata_types.h"
 #include "DNA_modifier_types.h"
 #include "DNA_object_types.h"
+#include "DNA_scene_types.h"
 
 #include "BKE_cdderivedmesh.h"
 #include "BKE_colortools.h"       /* CurveMapping. */
@@ -113,7 +114,7 @@
  */
 void weightvg_do_mask(int num, const int *indices, float *org_w, const float *new_w,
                       Object *ob, DerivedMesh *dm, float fact, const char defgrp_name[MAX_VGROUP_NAME],
-                      Tex *texture, int tex_use_channel, int tex_mapping,
+                      Scene *scene, Tex *texture, int tex_use_channel, int tex_mapping,
                       Object *tex_map_object, const char *tex_uvlayer_name)
 {
 	int ref_didx;
@@ -145,6 +146,8 @@
 		get_texture_coords(&t_map, ob, dm, v_co, tex_co, num);
 		MEM_freeN(v_co);
 
+		modifier_init_texture(scene, texture);
+
 		/* For each weight (vertex), make the mix between org and new weights. */
 		for (i = 0; i < num; ++i) {
 			int idx = indices ? indices[i] : i;

Modified: trunk/blender/source/blender/modifiers/intern/MOD_weightvg_util.h
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_weightvg_util.h	2012-04-10 13:19:16 UTC (rev 45507)
+++ trunk/blender/source/blender/modifiers/intern/MOD_weightvg_util.h	2012-04-10 14:11:45 UTC (rev 45508)
@@ -39,6 +39,7 @@
 struct DerivedMesh;
 struct Object;
 struct Tex;
+struct Scene;
 
 /*
  * XXX I'd like to make modified weights visible in WeightPaint mode,
@@ -73,9 +74,9 @@
  * XXX The standard "factor" value is assumed in [0.0, 1.0] range. Else, weird results might appear.
  */
 void weightvg_do_mask(int num, const int *indices, float *org_w, const float *new_w, Object *ob,
-                      DerivedMesh *dm, float fact, const char defgrp_name[MAX_VGROUP_NAME], Tex *texture,
-                      int tex_use_channel, int tex_mapping, Object *tex_map_object,
-                      const char *tex_uvlayer_name);
+                      DerivedMesh *dm, float fact, const char defgrp_name[MAX_VGROUP_NAME],
+                      struct Scene *scene, Tex *texture, int tex_use_channel, int tex_mapping,
+                      Object *tex_map_object, const char *tex_uvlayer_name);
 
 /* Applies weights to given vgroup (defgroup), and optionally add/remove vertices from the group.
  * If indices is not NULL, it must be a table of same length as weights, mapping to the real

Modified: trunk/blender/source/blender/modifiers/intern/MOD_weightvgedit.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_weightvgedit.c	2012-04-10 13:19:16 UTC (rev 45507)
+++ trunk/blender/source/blender/modifiers/intern/MOD_weightvgedit.c	2012-04-10 14:11:45 UTC (rev 45508)
@@ -243,8 +243,9 @@
 
 	/* Do masking. */
 	weightvg_do_mask(numVerts, NULL, org_w, new_w, ob, dm, wmd->mask_constant,
-	                 wmd->mask_defgrp_name, wmd->mask_texture, wmd->mask_tex_use_channel,
-	                 wmd->mask_tex_mapping, wmd->mask_tex_map_obj, wmd->mask_tex_uvlayer_name);
+	                 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);
 
 	/* Update/add/remove from vgroup. */
 	weightvg_update_vg(dvert, defgrp_idx, dw, numVerts, NULL, org_w, do_add, wmd->add_threshold,

Modified: trunk/blender/source/blender/modifiers/intern/MOD_weightvgmix.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_weightvgmix.c	2012-04-10 13:19:16 UTC (rev 45507)
+++ trunk/blender/source/blender/modifiers/intern/MOD_weightvgmix.c	2012-04-10 14:11:45 UTC (rev 45508)
@@ -370,8 +370,9 @@
 
 	/* Do masking. */
 	weightvg_do_mask(numIdx, indices, org_w, new_w, ob, dm, wmd->mask_constant,
-	                 wmd->mask_defgrp_name, wmd->mask_texture, wmd->mask_tex_use_channel,
-	                 wmd->mask_tex_mapping, wmd->mask_tex_map_obj, wmd->mask_tex_uvlayer_name);
+	                 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);
 
 	/* Update (add to) vgroup.
 	 * XXX Depending on the MOD_WVG_SET_xxx option chosen, we might have to add vertices to vgroup.

Modified: trunk/blender/source/blender/modifiers/intern/MOD_weightvgproximity.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_weightvgproximity.c	2012-04-10 13:19:16 UTC (rev 45507)
+++ trunk/blender/source/blender/modifiers/intern/MOD_weightvgproximity.c	2012-04-10 14:11:45 UTC (rev 45508)
@@ -504,8 +504,9 @@
 
 	/* Do masking. */
 	weightvg_do_mask(numIdx, indices, org_w, new_w, ob, dm, wmd->mask_constant,
-	                 wmd->mask_defgrp_name, wmd->mask_texture, wmd->mask_tex_use_channel,
-	                 wmd->mask_tex_mapping, wmd->mask_tex_map_obj, wmd->mask_tex_uvlayer_name);
+	                 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);
 
 	/* Update vgroup. Note we never add nor remove vertices from vgroup here. */
 	weightvg_update_vg(dvert, defgrp_idx, dw, numIdx, indices, org_w, FALSE, 0.0f, FALSE, 0.0f);




More information about the Bf-blender-cvs mailing list