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.
This commit is contained in:
Dalai Felinto 2017-08-17 15:54:05 +02:00
parent 8ab6e8aad6
commit e8f0ee157b
10 changed files with 11 additions and 91 deletions

View 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,

View 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),

View 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

View 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();

View 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

View 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)) {

View 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 */

View 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

View 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", "" )

View File

@ -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);
}