[Bf-blender-cvs] [e8f0ee157b2] blender2.8: Swap Eevee material output with (Cycles) Material Output

Dalai Felinto noreply at git.blender.org
Fri Aug 18 18:29:50 CEST 2017


Commit: e8f0ee157b290e41258bf704d63c00cb2d4d2a90
Author: Dalai Felinto
Date:   Thu Aug 17 15:54:05 2017 +0200
Branches: blender2.8
https://developer.blender.org/rBe8f0ee157b290e41258bf704d63c00cb2d4d2a90

Swap Eevee material output with (Cycles) Material Output

Since we started supporting the (Cycles) Material Output old files
stopped working. There is no reason to keep the original Eevee material
otuput anymore.

It includes doversion for old files.

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

M	intern/cycles/blender/blender_shader.cpp
M	release/scripts/startup/nodeitems_builtins.py
M	source/blender/blenkernel/BKE_node.h
M	source/blender/blenkernel/intern/node.c
M	source/blender/blenloader/intern/versioning_280.c
M	source/blender/editors/space_node/node_edit.c
M	source/blender/gpu/shaders/gpu_shader_material.glsl
M	source/blender/nodes/CMakeLists.txt
M	source/blender/nodes/NOD_static_types.h
D	source/blender/nodes/shader/nodes/node_shader_output_eevee_material.c

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

diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp
index bbf7dc720a8..b9af0dd0bf6 100644
--- a/intern/cycles/blender/blender_shader.cpp
+++ b/intern/cycles/blender/blender_shader.cpp
@@ -947,7 +947,6 @@ static BL::ShaderNode find_output_node(BL::ShaderNodeTree& b_ntree)
 {
 	BL::ShaderNodeTree::nodes_iterator b_node;
 	BL::ShaderNode output_node(PointerRNA_NULL);
-	BL::ShaderNode eevee_output_node(PointerRNA_NULL);
 
 	for(b_ntree.nodes.begin(b_node); b_node != b_ntree.nodes.end(); ++b_node) {
 		BL::ShaderNodeOutputMaterial b_output_node(*b_node);
@@ -964,19 +963,9 @@ static BL::ShaderNode find_output_node(BL::ShaderNodeTree& b_ntree)
 				output_node = b_output_node;
 			}
 		}
-		else if (b_output_node.is_a(&RNA_ShaderNodeOutputEeveeMaterial)) {
-			/* Eevee output used  if no Cycles node exists */
-			if(b_output_node.is_active_output()) {
-				eevee_output_node = b_output_node;
-			}
-			else if(!eevee_output_node.ptr.data) {
-				eevee_output_node = b_output_node;
-			}
-
-		}
 	}
 
-	return (output_node.ptr.data) ? output_node : eevee_output_node;
+	return output_node;
 }
 
 static void add_nodes(Scene *scene,
diff --git a/release/scripts/startup/nodeitems_builtins.py b/release/scripts/startup/nodeitems_builtins.py
index a28a58c7dc7..71caf207134 100644
--- a/release/scripts/startup/nodeitems_builtins.py
+++ b/release/scripts/startup/nodeitems_builtins.py
@@ -251,8 +251,7 @@ shader_node_categories = [
         NodeItem("NodeGroupInput", poll=group_input_output_item_poll),
         ]),
     ShaderNewNodeCategory("SH_NEW_OUTPUT", "Output", items=[
-        NodeItem("ShaderNodeOutputMaterial", poll=object_cycles_shader_nodes_poll),
-        NodeItem("ShaderNodeOutputEeveeMaterial", poll=object_eevee_shader_nodes_poll),
+        NodeItem("ShaderNodeOutputMaterial", poll=object_eevee_cycles_shader_nodes_poll),
         NodeItem("ShaderNodeOutputLamp", poll=object_cycles_shader_nodes_poll),
         NodeItem("ShaderNodeOutputWorld", poll=world_shader_nodes_poll),
         NodeItem("ShaderNodeOutputLineStyle", poll=line_style_shader_nodes_poll),
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index dc61a2d825f..fd690a917a0 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -798,7 +798,6 @@ struct ShadeResult;
 #define SH_NODE_BSDF_PRINCIPLED         193
 #define SH_NODE_EEVEE_METALLIC			194
 #define SH_NODE_EEVEE_SPECULAR			195
-#define SH_NODE_OUTPUT_EEVEE_MATERIAL	196
 
 /* custom defines options for Material node */
 #define SH_NODE_MAT_DIFF   1
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 346d107792e..d53fe68eb99 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -3599,7 +3599,6 @@ static void registerShaderNodes(void)
 
 	register_node_type_sh_output_lamp();
 	register_node_type_sh_output_material();
-	register_node_type_sh_output_eevee_material();
 	register_node_type_sh_output_world();
 	register_node_type_sh_output_linestyle();
 
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 1c7ecc9ce3b..ce452d58565 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -446,10 +446,17 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
 							error = true;
 						}
 
-						if (node->type == SH_NODE_EEVEE_SPECULAR && STREQ(node->idname, "ShaderNodeOutputSpecular")) {
+						else if (node->type == SH_NODE_EEVEE_SPECULAR && STREQ(node->idname, "ShaderNodeOutputSpecular")) {
 							BLI_strncpy(node->idname, "ShaderNodeEeveeSpecular", sizeof(node->idname));
 							error = true;
 						}
+
+						else if (node->type == 196 /* SH_NODE_OUTPUT_EEVEE_MATERIAL */ &&
+						         STREQ(node->idname, "ShaderNodeOutputEeveeMaterial"))
+						{
+							node->type = SH_NODE_OUTPUT_MATERIAL;
+							BLI_strncpy(node->idname, "ShaderNodeOutputMaterial", sizeof(node->idname));
+						}
 					}
 				}
 			} FOREACH_NODETREE_END
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index 33382af9087..b5d6104432f 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -399,7 +399,7 @@ void ED_node_shader_default(const bContext *C, ID *id)
 			ma->nodetree = ntree;
 
 			if (BKE_scene_uses_blender_eevee(scene)) {
-				output_type = SH_NODE_OUTPUT_EEVEE_MATERIAL;
+				output_type = SH_NODE_OUTPUT_MATERIAL;
 				shader_type = SH_NODE_EEVEE_METALLIC;
 			}
 			else if (BKE_scene_use_new_shading_nodes(scene)) {
diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl
index b667df16101..b8b2b6a4d56 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -4080,11 +4080,6 @@ void node_eevee_specular(
 	result = Closure(L + emissive.rgb, 1.0 - transp, vec4(ssr_spec, roughness), normal_encode(vN, viewCameraVec), int(ssr_id));
 }
 
-void node_output_eevee_material(Closure surface, out Closure result)
-{
-	result = surface;
-}
-
 #endif /* EEVEE_ENGINE */
 #endif /* VOLUMETRICS */
 
diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt
index 2c46791ae18..03912c95940 100644
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@ -188,7 +188,6 @@ set(SRC
 	shader/nodes/node_shader_eevee_specular.c
 	shader/nodes/node_shader_output_lamp.c
 	shader/nodes/node_shader_output_material.c
-	shader/nodes/node_shader_output_eevee_material.c
 	shader/nodes/node_shader_output_world.c
 	shader/nodes/node_shader_output_linestyle.c
 	shader/nodes/node_shader_particle_info.c
diff --git a/source/blender/nodes/NOD_static_types.h b/source/blender/nodes/NOD_static_types.h
index d8944776cbb..490ef91f660 100644
--- a/source/blender/nodes/NOD_static_types.h
+++ b/source/blender/nodes/NOD_static_types.h
@@ -69,7 +69,6 @@ DefNode( ShaderNode,     SH_NODE_HUE_SAT,         0,                      "HUE_S
 DefNode( ShaderNode,     SH_NODE_OUTPUT_MATERIAL,    def_sh_output,          "OUTPUT_MATERIAL",    OutputMaterial,   "Material Output",   ""       )
 DefNode( ShaderNode,     SH_NODE_EEVEE_METALLIC,     0,                      "EEVEE_METALLIC",     EeveeMetallic,    "Metallic", "")
 DefNode( ShaderNode,     SH_NODE_EEVEE_SPECULAR,     0,                      "EEVEE_SPECULAR",     EeveeSpecular,    "Specular", "")
-DefNode( ShaderNode,     SH_NODE_OUTPUT_EEVEE_MATERIAL, def_sh_output,       "OUTPUT_EEVEE_MATERIAL", OutputEeveeMaterial, "Material Output", "")
 DefNode( ShaderNode,     SH_NODE_OUTPUT_LAMP,        def_sh_output,          "OUTPUT_LAMP",        OutputLamp,       "Lamp Output",       ""       )
 DefNode( ShaderNode,     SH_NODE_OUTPUT_WORLD,       def_sh_output,          "OUTPUT_WORLD",       OutputWorld,      "World Output",      ""       )
 DefNode( ShaderNode,     SH_NODE_OUTPUT_LINESTYLE,   def_sh_output_linestyle,"OUTPUT_LINESTYLE",   OutputLineStyle,  "Line Style Output", ""       )
diff --git a/source/blender/nodes/shader/nodes/node_shader_output_eevee_material.c b/source/blender/nodes/shader/nodes/node_shader_output_eevee_material.c
deleted file mode 100644
index faf715f2b66..00000000000
--- a/source/blender/nodes/shader/nodes/node_shader_output_eevee_material.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2005 Blender Foundation.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#include "../node_shader_util.h"
-
-#include "BKE_scene.h"
-
-/* **************** OUTPUT ******************** */
-
-static bNodeSocketTemplate sh_node_output_eevee_material_in[] = {
-	{	SOCK_SHADER, 1, N_("Surface")},
-	{	-1, 0, ""	}
-};
-
-static int node_shader_gpu_output_eevee_material(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
-{
-	GPUNodeLink *outlink;
-
-	GPU_stack_link(mat, node, "node_output_eevee_material", in, out, &outlink);
-	GPU_material_output_link(mat, outlink);
-
-	return true;
-}
-
-
-/* node type definition */
-void register_node_type_sh_output_eevee_material(void)
-{
-	static bNodeType ntype;
-
-	sh_node_type_base(&ntype, SH_NODE_OUTPUT_EEVEE_MATERIAL, "Material Output", NODE_CLASS_OUTPUT, 0);
-	node_type_compatibility(&ntype, NODE_NEW_SHADING);
-	node_type_socket_templates(&ntype, sh_node_output_eevee_material_in, NULL);
-	node_type_init(&ntype, NULL);
-	node_type_storage(&ntype, "", NULL, NULL);
-	node_type_gpu(&ntype, node_shader_gpu_output_eevee_material);
-
-	/* Do not allow muting output node. */
-	node_type_internal_links(&ntype, NULL);
-
-	nodeRegisterType(&ntype);
-}



More information about the Bf-blender-cvs mailing list