[Bf-blender-cvs] [bff1577] master: Fix T47424: Blender Internal material node 'mapping' not showing results of animation

Sergey Sharybin noreply at git.blender.org
Tue May 3 11:45:40 CEST 2016


Commit: bff15770a962ae931c1e891ed76fd195ce5b2994
Author: Sergey Sharybin
Date:   Tue May 3 11:44:17 2016 +0200
Branches: master
https://developer.blender.org/rBbff15770a962ae931c1e891ed76fd195ce5b2994

Fix T47424: Blender Internal material node 'mapping' not showing results of animation

Not very efficient solution -- it'll update mapping node on init ntree exec and will
not work for viewport GLSL shading perhaps, but it's as good as it could be within
current dependency graph.

The issue here is that manual edit of values will cause cached matrix re-evaluation.
but using animation does not use rna update callbacks hence no matrix update was
happening.

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

M	source/blender/nodes/shader/nodes/node_shader_mapping.c

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

diff --git a/source/blender/nodes/shader/nodes/node_shader_mapping.c b/source/blender/nodes/shader/nodes/node_shader_mapping.c
index cd398cc..2044f53 100644
--- a/source/blender/nodes/shader/nodes/node_shader_mapping.c
+++ b/source/blender/nodes/shader/nodes/node_shader_mapping.c
@@ -42,6 +42,15 @@ static bNodeSocketTemplate sh_node_mapping_out[] = {
 	{	-1, 0, ""	}
 };
 
+static void *node_shader_initexec_mapping(bNodeExecContext *UNUSED(context),
+                                          bNode *node,
+                                          bNodeInstanceKey UNUSED(key))
+{
+	TexMapping *texmap = node->storage;
+	BKE_texture_mapping_init(texmap);
+	return NULL;
+}
+
 /* do the regular mapping options for blender textures */
 static void node_shader_exec_mapping(void *UNUSED(data), int UNUSED(thread), bNode *node, bNodeExecData *UNUSED(execdata), bNodeStack **in, bNodeStack **out)
 {
@@ -103,7 +112,7 @@ void register_node_type_sh_mapping(void)
 	node_type_size(&ntype, 320, 160, 360);
 	node_type_init(&ntype, node_shader_init_mapping);
 	node_type_storage(&ntype, "TexMapping", node_free_standard_storage, node_copy_standard_storage);
-	node_type_exec(&ntype, NULL, NULL, node_shader_exec_mapping);
+	node_type_exec(&ntype, node_shader_initexec_mapping, NULL, node_shader_exec_mapping);
 	node_type_gpu(&ntype, gpu_shader_mapping);
 	
 	nodeRegisterType(&ntype);




More information about the Bf-blender-cvs mailing list