Merge branch 'master' into blender2.8
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Wed, 18 Jul 2018 12:13:02 +0000 (14:13 +0200)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Wed, 18 Jul 2018 12:13:16 +0000 (14:13 +0200)
27 files changed:
1  2 
intern/cycles/blender/blender_shader.cpp
intern/cycles/render/nodes.cpp
intern/cycles/render/nodes.h
release/scripts/startup/nodeitems_builtins.py
source/blender/blenkernel/BKE_node.h
source/blender/blenkernel/intern/node.c
source/blender/blenlib/CMakeLists.txt
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/writefile.c
source/blender/compositor/CMakeLists.txt
source/blender/editors/include/UI_interface.h
source/blender/editors/interface/interface_eyedropper.c
source/blender/editors/interface/interface_eyedropper_color.c
source/blender/editors/interface/interface_intern.h
source/blender/editors/interface/interface_ops.c
source/blender/editors/interface/interface_templates.c
source/blender/editors/space_node/drawnode.c
source/blender/editors/space_node/node_edit.c
source/blender/editors/space_node/node_intern.h
source/blender/editors/space_node/node_ops.c
source/blender/makesdna/DNA_node_types.h
source/blender/makesrna/intern/rna_nodetree.c
source/blender/nodes/CMakeLists.txt
source/blender/nodes/NOD_composite.h
source/blender/nodes/NOD_shader.h
source/blender/nodes/NOD_static_types.h
source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.c

Simple merge
Simple merge
index e6500b7c2c0c291c7159e78a07e7174413e0c880,4f4190da30b9815decbea18bf9a02c55b1b8509b..a70d78c16c62083a64dd4bc4c3b65e74395a1dad
@@@ -194,30 -225,30 +194,31 @@@ shader_node_categories = 
          NodeItem("ShaderNodeOutputLineStyle", poll=line_style_shader_nodes_poll),
          NodeItem("NodeGroupOutput", poll=group_input_output_item_poll),
      ]),
 -    ShaderNewNodeCategory("SH_NEW_SHADER", "Shader", items=[
 -        NodeItem("ShaderNodeMixShader"),
 -        NodeItem("ShaderNodeAddShader"),
 -        NodeItem("ShaderNodeBsdfDiffuse", poll=object_shader_nodes_poll),
 -        NodeItem("ShaderNodeBsdfPrincipled", poll=object_shader_nodes_poll),
 -        NodeItem("ShaderNodeBsdfGlossy", poll=object_shader_nodes_poll),
 -        NodeItem("ShaderNodeBsdfTransparent", poll=object_shader_nodes_poll),
 -        NodeItem("ShaderNodeBsdfRefraction", poll=object_shader_nodes_poll),
 -        NodeItem("ShaderNodeBsdfGlass", poll=object_shader_nodes_poll),
 -        NodeItem("ShaderNodeBsdfTranslucent", poll=object_shader_nodes_poll),
 -        NodeItem("ShaderNodeBsdfAnisotropic", poll=object_shader_nodes_poll),
 -        NodeItem("ShaderNodeBsdfVelvet", poll=object_shader_nodes_poll),
 -        NodeItem("ShaderNodeBsdfToon", poll=object_shader_nodes_poll),
 -        NodeItem("ShaderNodeSubsurfaceScattering", poll=object_shader_nodes_poll),
 -        NodeItem("ShaderNodeEmission", poll=object_shader_nodes_poll),
 -        NodeItem("ShaderNodeBsdfHair", poll=object_shader_nodes_poll),
 +    ShaderNodeCategory("SH_NEW_SHADER", "Shader", items=[
 +        NodeItem("ShaderNodeMixShader", poll=eevee_cycles_shader_nodes_poll),
 +        NodeItem("ShaderNodeAddShader", poll=eevee_cycles_shader_nodes_poll),
 +        NodeItem("ShaderNodeBsdfDiffuse", poll=object_eevee_cycles_shader_nodes_poll),
 +        NodeItem("ShaderNodeBsdfPrincipled", poll=object_eevee_cycles_shader_nodes_poll),
 +        NodeItem("ShaderNodeBsdfGlossy", poll=object_eevee_cycles_shader_nodes_poll),
 +        NodeItem("ShaderNodeBsdfTransparent", poll=object_eevee_cycles_shader_nodes_poll),
 +        NodeItem("ShaderNodeBsdfRefraction", poll=object_eevee_cycles_shader_nodes_poll),
 +        NodeItem("ShaderNodeBsdfGlass", poll=object_eevee_cycles_shader_nodes_poll),
 +        NodeItem("ShaderNodeBsdfTranslucent", poll=object_cycles_shader_nodes_poll),
 +        NodeItem("ShaderNodeBsdfAnisotropic", poll=object_cycles_shader_nodes_poll),
 +        NodeItem("ShaderNodeBsdfVelvet", poll=object_cycles_shader_nodes_poll),
 +        NodeItem("ShaderNodeBsdfToon", poll=object_cycles_shader_nodes_poll),
 +        NodeItem("ShaderNodeSubsurfaceScattering", poll=object_eevee_cycles_shader_nodes_poll),
 +        NodeItem("ShaderNodeEmission", poll=object_eevee_cycles_shader_nodes_poll),
 +        NodeItem("ShaderNodeBsdfHair", poll=object_cycles_shader_nodes_poll),
          NodeItem("ShaderNodeBackground", poll=world_shader_nodes_poll),
 -        NodeItem("ShaderNodeHoldout", poll=object_shader_nodes_poll),
 -        NodeItem("ShaderNodeVolumeAbsorption"),
 -        NodeItem("ShaderNodeVolumeScatter"),
 +        NodeItem("ShaderNodeHoldout", poll=object_cycles_shader_nodes_poll),
 +        NodeItem("ShaderNodeVolumeAbsorption", poll=eevee_cycles_shader_nodes_poll),
 +        NodeItem("ShaderNodeVolumeScatter", poll=eevee_cycles_shader_nodes_poll),
          NodeItem("ShaderNodeVolumePrincipled"),
 +        NodeItem("ShaderNodeEeveeSpecular", poll=object_eevee_shader_nodes_poll),
+         NodeItem("ShaderNodeBsdfHairPrincipled", poll=object_shader_nodes_poll)
      ]),
 -    ShaderNewNodeCategory("SH_NEW_TEXTURE", "Texture", items=[
 +    ShaderNodeCategory("SH_NEW_TEXTURE", "Texture", items=[
          NodeItem("ShaderNodeTexImage"),
          NodeItem("ShaderNodeTexEnvironment"),
          NodeItem("ShaderNodeTexSky"),
Simple merge
index 61f53f938e24776a26ab059cc1a5900b11d0f40c,e3f5773b1e4e1b89a804c8ce010075d1cdd54195..9621a759f3c35c09579d3e9638ea2a1ba86cb146
@@@ -158,8 -160,8 +159,9 @@@ set(SR
        BLI_hash.h
        BLI_hash_md5.h
        BLI_hash_mm2a.h
+       BLI_hash_mm3.h
        BLI_heap.h
 +      BLI_iterator.h
        BLI_jitter_2d.h
        BLI_kdopbvh.h
        BLI_kdtree.h
index 1a0f738ab8a0e0040eea58b1c2ae3a20ed3f9342,9b396aa9642b2005b688ecc1363bc91b5fce3610..ed7379acca903eeee286afcee64fb2750e37e916
@@@ -223,12 -222,8 +223,14 @@@ void NODE_OT_shader_script_update(struc
  void NODE_OT_viewer_border(struct wmOperatorType *ot);
  void NODE_OT_clear_viewer_border(struct wmOperatorType *ot);
  
 +/* node_widgets.c */
 +void NODE_GGT_backdrop_transform(struct wmGizmoGroupType *gzgt);
 +void NODE_GGT_backdrop_crop(struct wmGizmoGroupType *gzgt);
 +void NODE_GGT_backdrop_sun_beams(struct wmGizmoGroupType *gzgt);
 +void NODE_GGT_backdrop_corner_pin(struct wmGizmoGroupType *gzgt);
 +
+ void NODE_OT_cryptomatte_layer_add(struct wmOperatorType *ot);
+ void NODE_OT_cryptomatte_layer_remove(struct wmOperatorType *ot);
  
  extern const char *node_context_dir[];
  
Simple merge
Simple merge
Simple merge
index 0000000000000000000000000000000000000000,c502985203398b5ea1b38c058041458fcac3c307..5fff2548ba1ca478ff9fb50658ca06613f5b990e
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,133 +1,132 @@@
 -      node_type_compatibility(&ntype, NODE_NEW_SHADING);
+ /*
+  * ***** 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) 2018 Blender Foundation.
+  * All rights reserved.
+  *
+  * The Original Code is: all of this file.
+  *
+  * Contributor(s): Lukas Stockner, L. E. Segovia
+  *
+  * ***** END GPL LICENSE BLOCK *****
+  */
+ #include "../node_shader_util.h"
+ /* **************** OUTPUT ******************** */
+ /* Color, melanin and absorption coefficient default to approximately same brownish hair. */
+ static bNodeSocketTemplate sh_node_bsdf_hair_principled_in[] = {
+       {       SOCK_RGBA,              1, N_("Color"),                                         0.017513f, 0.005763f, 0.002059f, 1.0f, 0.0f, 1.0f},
+       {       SOCK_FLOAT,             1, N_("Melanin"),                                       0.8f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
+       {       SOCK_FLOAT,             1, N_("Melanin Redness"),                       1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
+       {       SOCK_RGBA,              1, N_("Tint"),                                          1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f},
+       {       SOCK_VECTOR,    1, N_("Absorption Coefficient"),        0.245531f, 0.52f, 1.365f, 0.0f, 0.0f, 1000.0f},
+       {       SOCK_FLOAT,             1, N_("Roughness"),                                     0.3f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
+       {       SOCK_FLOAT,             1, N_("Radial Roughness"),                      0.3f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
+       {       SOCK_FLOAT,             1, N_("Coat"),                                          0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
+       {       SOCK_FLOAT,             1, N_("IOR"),                                           1.55f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
+       {       SOCK_FLOAT,             1, N_("Offset"),                                        2.f*((float)M_PI)/180.f, 0.0f, 0.0f, 0.0f, -M_PI_2, M_PI_2, PROP_ANGLE},
+       {       SOCK_FLOAT,     1, N_("Random Color"),                          0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
+       {       SOCK_FLOAT,     1, N_("Random Roughness"),                      0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
+       {       SOCK_FLOAT,             1, N_("Random"),                                        0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
+       {       -1, 0, ""       },
+ };
+ static bNodeSocketTemplate sh_node_bsdf_hair_principled_out[] = {
+       {       SOCK_SHADER, 0, N_("BSDF")},
+       {       -1, 0, ""       }
+ };
+ /* Initialize the custom Parametrization property to Color. */
+ static void node_shader_init_hair_principled(bNodeTree *UNUSED(ntree), bNode *node)
+ {
+       node->custom1 = SHD_PRINCIPLED_HAIR_REFLECTANCE;
+ }
+ /* Triggers (in)visibility of some sockets when changing Parametrization. */
+ static void node_shader_update_hair_principled(bNodeTree *UNUSED(ntree), bNode *node)
+ {
+       bNodeSocket *sock;
+       int parametrization = node->custom1;
+       for (sock = node->inputs.first; sock; sock = sock->next) {
+               if (STREQ(sock->name, "Color")) {
+                       if (parametrization == SHD_PRINCIPLED_HAIR_REFLECTANCE) {
+                               sock->flag &= ~SOCK_UNAVAIL;
+                       }
+                       else {
+                               sock->flag |= SOCK_UNAVAIL;
+                       }
+               }
+               else if (STREQ(sock->name, "Melanin")) {
+                       if (parametrization == SHD_PRINCIPLED_HAIR_PIGMENT_CONCENTRATION) {
+                               sock->flag &= ~SOCK_UNAVAIL;
+                       }
+                       else {
+                               sock->flag |= SOCK_UNAVAIL;
+                       }
+               }
+               else if (STREQ(sock->name, "Melanin Redness")) {
+                       if (parametrization == SHD_PRINCIPLED_HAIR_PIGMENT_CONCENTRATION) {
+                               sock->flag &= ~SOCK_UNAVAIL;
+                       }
+                       else {
+                               sock->flag |= SOCK_UNAVAIL;
+                       }
+               }
+               else if (STREQ(sock->name, "Tint")) {
+                       if (parametrization == SHD_PRINCIPLED_HAIR_PIGMENT_CONCENTRATION) {
+                               sock->flag &= ~SOCK_UNAVAIL;
+                       }
+                       else {
+                               sock->flag |= SOCK_UNAVAIL;
+                       }
+               }
+               else if (STREQ(sock->name, "Absorption Coefficient")) {
+                       if (parametrization == SHD_PRINCIPLED_HAIR_DIRECT_ABSORPTION) {
+                               sock->flag &= ~SOCK_UNAVAIL;
+                       }
+                       else {
+                               sock->flag |= SOCK_UNAVAIL;
+                       }
+               }
+               else if (STREQ(sock->name, "Random Color")) {
+                       if (parametrization == SHD_PRINCIPLED_HAIR_PIGMENT_CONCENTRATION) {
+                               sock->flag &= ~SOCK_UNAVAIL;
+                       }
+                       else {
+                               sock->flag |= SOCK_UNAVAIL;
+                       }
+               }
+       }
+ }
+ /* node type definition */
+ void register_node_type_sh_bsdf_hair_principled(void)
+ {
+       static bNodeType ntype;
+       sh_node_type_base(&ntype, SH_NODE_BSDF_HAIR_PRINCIPLED, "Principled Hair BSDF", NODE_CLASS_SHADER, 0);
+       node_type_socket_templates(&ntype, sh_node_bsdf_hair_principled_in, sh_node_bsdf_hair_principled_out);
+       node_type_size_preset(&ntype, NODE_SIZE_LARGE);
+       node_type_init(&ntype, node_shader_init_hair_principled);
+       node_type_storage(&ntype, "", NULL, NULL);
+       node_type_update(&ntype, node_shader_update_hair_principled, NULL);
+       nodeRegisterType(&ntype);
+ }