Swap Eevee material output with (Cycles) Material Output
authorDalai Felinto <dfelinto@gmail.com>
Thu, 17 Aug 2017 13:54:05 +0000 (15:54 +0200)
committerDalai Felinto <dfelinto@gmail.com>
Fri, 18 Aug 2017 15:00:45 +0000 (17:00 +0200)
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.

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

index bbf7dc720a8887dd7c05f9f3fea7d6aa7fae4653..b9af0dd0bf6a1ba5f520be343007b4084cb7e6c1 100644 (file)
@@ -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,
index a28a58c7dc765d183729e6d190036fb2138f9627..71caf207134c884a65a6710164786ad6c5e548b0 100644 (file)
@@ -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),
index dc61a2d825ff10417964e1c460508f14824819f2..fd690a917a069ed92e7cbee5e26db3c1759075f2 100644 (file)
@@ -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
index 346d107792e536207e174aac87252f2bfb4fd589..d53fe68eb999693f1611a19258fb3d66fd0e3e48 100644 (file)
@@ -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();
 
index 1c7ecc9ce3b78df3961c66c94ee2cd4fdbaf1962..ce452d585650c0dca930f67e48c60b330f073b7f 100644 (file)
@@ -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
index 33382af9087a6a89260956c9518e604835b8983a..b5d6104432f05b25ac75f9c198f8fb1754cbe720 100644 (file)
@@ -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)) {
index b667df16101f7d636bb04adfbec8cda1ed9f0d44..b8b2b6a4d562b9231139e152de111bcaa7fe2f62 100644 (file)
@@ -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 */
 
index 2c46791ae18362f25d15ce3febf9e25ced5700d3..03912c959402e2b995b931d22001ed055b97af28 100644 (file)
@@ -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
index d8944776cbbcf545063b2e4eea1e60c5c9510c48..490ef91f660dc09d2ca37544a8cdcc0f0e845abd 100644 (file)
@@ -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 (file)
index faf715f..0000000
+++ /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);
-}