[Bf-blender-cvs] [9c183f6] master: Fix T47610: Texture node in compositing nodes does not update

Sergey Sharybin noreply at git.blender.org
Wed Mar 2 08:48:21 CET 2016


Commit: 9c183f60e1b0892614cf64db274488ff5bc61620
Author: Sergey Sharybin
Date:   Wed Mar 2 12:45:46 2016 +0500
Branches: master
https://developer.blender.org/rB9c183f60e1b0892614cf64db274488ff5bc61620

Fix T47610: Texture node in compositing nodes does not update

The issue was caused by some code accessing R from a functions which
are marked as safe for use from outside of render pipeline.

Now those functions are safe(er) for use.

===================================================================

M	source/blender/blenkernel/intern/brush.c
M	source/blender/blenkernel/intern/particle.c
M	source/blender/editors/mesh/editmesh_tools.c
M	source/blender/editors/sculpt_paint/paint_utils.c
M	source/blender/render/extern/include/RE_render_ext.h
M	source/blender/render/intern/include/render_types.h
M	source/blender/render/intern/source/render_texture.c
M	source/blender/render/intern/source/renderdatabase.c

===================================================================

diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 166c2b2..31dac03 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -570,7 +570,7 @@ float BKE_brush_sample_tex_3D(const Scene *scene, Brush *br,
 		/* Get strength by feeding the vertex
 		 * location directly into a texture */
 		hasrgb = externtex(mtex, point, &intensity,
-		                   rgba, rgba + 1, rgba + 2, rgba + 3, thread, pool, false);
+		                   rgba, rgba + 1, rgba + 2, rgba + 3, thread, pool, false, false);
 	}
 	else if (mtex->brush_map_mode == MTEX_MAP_MODE_STENCIL) {
 		float rotation = -mtex->rot;
@@ -601,7 +601,7 @@ float BKE_brush_sample_tex_3D(const Scene *scene, Brush *br,
 		co[2] = 0.0f;
 
 		hasrgb = externtex(mtex, co, &intensity,
-		                   rgba, rgba + 1, rgba + 2, rgba + 3, thread, pool, false);
+		                   rgba, rgba + 1, rgba + 2, rgba + 3, thread, pool, false, false);
 	}
 	else {
 		float rotation = -mtex->rot;
@@ -658,7 +658,7 @@ float BKE_brush_sample_tex_3D(const Scene *scene, Brush *br,
 		co[2] = 0.0f;
 
 		hasrgb = externtex(mtex, co, &intensity,
-		                   rgba, rgba + 1, rgba + 2, rgba + 3, thread, pool, false);
+		                   rgba, rgba + 1, rgba + 2, rgba + 3, thread, pool, false, false);
 	}
 
 	intensity += br->texture_sample_bias;
@@ -718,7 +718,7 @@ float BKE_brush_sample_masktex(const Scene *scene, Brush *br,
 		co[2] = 0.0f;
 
 		externtex(mtex, co, &intensity,
-		          rgba, rgba + 1, rgba + 2, rgba + 3, thread, pool, false);
+		          rgba, rgba + 1, rgba + 2, rgba + 3, thread, pool, false, false);
 	}
 	else {
 		float rotation = -mtex->rot;
@@ -775,7 +775,7 @@ float BKE_brush_sample_masktex(const Scene *scene, Brush *br,
 		co[2] = 0.0f;
 
 		externtex(mtex, co, &intensity,
-		          rgba, rgba + 1, rgba + 2, rgba + 3, thread, pool, false);
+		          rgba, rgba + 1, rgba + 2, rgba + 3, thread, pool, false, false);
 	}
 
 	CLAMP(intensity, 0.0f, 1.0f);
@@ -1048,7 +1048,7 @@ unsigned int *BKE_brush_gen_texture_cache(Brush *br, int half_side, bool use_sec
 				/* This is copied from displace modifier code */
 				/* TODO(sergey): brush are always cacheing with CM enabled for now. */
 				externtex(mtex, co, &intensity,
-				          rgba, rgba + 1, rgba + 2, rgba + 3, 0, NULL, false);
+				          rgba, rgba + 1, rgba + 2, rgba + 3, 0, NULL, false, false);
 
 				((char *)texcache)[(iy * side + ix) * 4] =
 				((char *)texcache)[(iy * side + ix) * 4 + 1] =
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index d02308b..66d6252 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -3499,7 +3499,7 @@ static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSetti
 					break;
 			}
 
-			externtex(mtex, texvec, &value, rgba, rgba + 1, rgba + 2, rgba + 3, 0, NULL, false);
+			externtex(mtex, texvec, &value, rgba, rgba + 1, rgba + 2, rgba + 3, 0, NULL, false, false);
 
 			if ((event & mtex->mapto) & PAMAP_ROUGH)
 				ptex->rough1 = ptex->rough2 = ptex->roughe = texture_value_blend(def, ptex->rough1, value, mtex->roughfac, blend);
@@ -3582,7 +3582,7 @@ void psys_get_texture(ParticleSimulationData *sim, ParticleData *pa, ParticleTex
 					break;
 			}
 
-			externtex(mtex, texvec, &value, rgba, rgba + 1, rgba + 2, rgba + 3, 0, NULL, false);
+			externtex(mtex, texvec, &value, rgba, rgba + 1, rgba + 2, rgba + 3, 0, NULL, false, false);
 
 			if ((event & mtex->mapto) & PAMAP_TIME) {
 				/* the first time has to set the base value for time regardless of blend mode */
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index b240836..33dd3cd 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -4987,7 +4987,7 @@ static int edbm_noise_exec(bContext *C, wmOperator *op)
 		BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
 			if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
 				float tin, dum;
-				externtex(ma->mtex[0], eve->co, &tin, &dum, &dum, &dum, &dum, 0, NULL, false);
+				externtex(ma->mtex[0], eve->co, &tin, &dum, &dum, &dum, &dum, 0, NULL, false, false);
 				eve->co[2] += fac * tin;
 			}
 		}
diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c
index dc0852a..31c471c 100644
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@ -177,7 +177,7 @@ float paint_get_tex_pixel(MTex *mtex, float u, float v, struct ImagePool *pool,
 	float co[3] = {u, v, 0.0f};
 
 	externtex(mtex, co, &intensity,
-	          rgba, rgba + 1, rgba + 2, rgba + 3, thread, pool, false);
+	          rgba, rgba + 1, rgba + 2, rgba + 3, thread, pool, false, false);
 
 	return intensity;
 }
@@ -189,7 +189,7 @@ void paint_get_tex_pixel_col(MTex *mtex, float u, float v, float rgba[4], struct
 	float intensity;
 
 	hasrgb = externtex(mtex, co, &intensity,
-	                   rgba, rgba + 1, rgba + 2, rgba + 3, thread, pool, false);
+	                   rgba, rgba + 1, rgba + 2, rgba + 3, thread, pool, false, false);
 	if (!hasrgb) {
 		rgba[0] = intensity;
 		rgba[1] = intensity;
diff --git a/source/blender/render/extern/include/RE_render_ext.h b/source/blender/render/extern/include/RE_render_ext.h
index 075db3a..2b5d0ca 100644
--- a/source/blender/render/extern/include/RE_render_ext.h
+++ b/source/blender/render/extern/include/RE_render_ext.h
@@ -46,7 +46,7 @@ struct Scene;
 /* used by particle.c, effect.c, editmesh_modes.c and brush.c, returns 1 if rgb, 0 otherwise */
 int externtex(
         struct MTex *mtex, const float vec[3], float *tin, float *tr, float *tg, float *tb, float *ta,
-        const int thread, struct ImagePool *pool, const bool skip_load_image);
+        const int thread, struct ImagePool *pool, const bool skip_load_image, const bool texnode_preview);
 void texture_rgb_blend(float in[3], const float tex[3], const float out[3], float fact, float facg, int blendtype);
 float texture_value_blend(float tex, float out, float fact, float facg, int blendtype);
 
diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h
index 3b69c12..ed83cfe 100644
--- a/source/blender/render/intern/include/render_types.h
+++ b/source/blender/render/intern/include/render_types.h
@@ -437,7 +437,7 @@ typedef struct HaloRen {
 	unsigned int lay;
 	struct Material *mat;
 	struct ImagePool *pool;
-	bool skip_load_image;
+	bool skip_load_image, texnode_preview;
 } HaloRen;
 
 /* ------------------------------------------------------------------------- */
diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c
index 29d8f17..172fc99 100644
--- a/source/blender/render/intern/source/render_texture.c
+++ b/source/blender/render/intern/source/render_texture.c
@@ -1103,7 +1103,16 @@ static void do_2d_mapping(MTex *mtex, float texvec[3], VlakRen *vlr, const float
 
 /* ************************************** */
 
-static int multitex(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int osatex, TexResult *texres, const short thread, short which_output, struct ImagePool *pool, const bool skip_load_image)
+static int multitex(Tex *tex,
+                    float texvec[3],
+                    float dxt[3], float dyt[3],
+                    int osatex,
+                    TexResult *texres,
+                    const short thread,
+                    const short which_output,
+                    struct ImagePool *pool,
+                    const bool skip_load_image,
+                    const bool texnode_preview)
 {
 	float tmpvec[3];
 	int retval = 0; /* return value, int:0, col:1, nor:2, everything:3 */
@@ -1112,7 +1121,7 @@ static int multitex(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int o
 	
 	if (tex->use_nodes && tex->nodetree) {
 		retval = ntreeTexExecTree(tex->nodetree, texres, texvec, dxt, dyt, osatex, thread,
-		                          tex, which_output, R.r.cfra, (R.r.scemode & R_TEXNODE_PREVIEW) != 0, NULL, NULL);
+		                          tex, which_output, R.r.cfra, texnode_preview, NULL, NULL);
 	}
 	else {
 		switch (tex->type) {
@@ -1218,9 +1227,19 @@ static int multitex(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int o
 	return retval;
 }
 
-static int multitex_nodes_intern(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int osatex, TexResult *texres,
-                                 const short thread, short which_output, ShadeInput *shi, MTex *mtex, struct ImagePool *pool,
-                                 bool scene_color_manage, const bool skip_load_image)
+static int multitex_nodes_intern(Tex *tex,
+                                 float texvec[3],
+                                 float dxt[3], float dyt[3],
+                                 int osatex,
+                                 TexResult *texres,
+                                 const short thread,
+                                 short which_output,
+                                 ShadeInput *shi,
+                                 MTex *mtex, struct
+                                 ImagePool *pool,
+                                 const bool scene_color_manage,
+                                 const bool skip_load_image,
+                                 const bool texnode_preview)
 {
 	if (tex==NULL) {
 		memset(texres, 0, sizeof(TexResult));
@@ -1236,7 +1255,16 @@ static int multitex_nodes_intern(Tex *tex, float texvec[3], float dxt[3], float
 		if (mtex) {
 			/* we have mtex, use it for 2d mapping images only */
 			do_2d_mapping(mtex, texvec, shi->vlr, shi->facenor, dxt, dyt);
-			rgbnor = multitex(tex, texvec, dxt, dyt, osatex, texres, thread, which_output, pool, skip_load_image);
+			rgbnor = multitex(tex,
+			                  texvec,
+			                  dxt, dyt,
+			                  osatex,
+			                  texres,
+			                  thread,
+			                  which_output,
+			  

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list