Merge branch 'master' into blender2.8
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Sat, 3 Feb 2018 15:10:01 +0000 (16:10 +0100)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Sat, 3 Feb 2018 15:10:01 +0000 (16:10 +0100)
20 files changed:
1  2 
intern/cycles/blender/addon/ui.py
intern/cycles/blender/addon/version_update.py
intern/cycles/blender/blender_mesh.cpp
intern/cycles/blender/blender_shader.cpp
release/datafiles/locale
release/scripts/addons
release/scripts/addons_contrib
release/scripts/startup/nodeitems_builtins.py
source/blender/blenkernel/BKE_node.h
source/blender/blenkernel/intern/node.c
source/blender/editors/space_node/drawnode.c
source/blender/gpu/shaders/gpu_shader_material.glsl
source/blender/makesdna/DNA_node_types.h
source/blender/makesrna/intern/rna_nodetree.c
source/blender/nodes/CMakeLists.txt
source/blender/nodes/NOD_shader.h
source/blender/nodes/NOD_static_types.h
source/blender/nodes/shader/nodes/node_shader_displacement.c
source/blender/nodes/shader/nodes/node_shader_vector_displacement.c
source/tools

Simple merge
index cd65bc3277eda27e1c0b9f20a25928f6586d89a8,469c949d1ca882be19daa128842f813b72a944d8..c93ed11a47b3016cf59711ec16de2e2e94c30e99
@@@ -1,1 -1,1 +1,1 @@@
- Subproject commit cd65bc3277eda27e1c0b9f20a25928f6586d89a8
 -Subproject commit 469c949d1ca882be19daa128842f813b72a944d8
++Subproject commit c93ed11a47b3016cf59711ec16de2e2e94c30e99
index f5536e5e49c34dfc0a7b8990257cd393339e23c6,c88411ff7776a2db5d6ef6117a1b2faa42a95611..371960484a38fc64e0a2635170a41a0d8ab2f6bd
@@@ -1,1 -1,1 +1,1 @@@
- Subproject commit f5536e5e49c34dfc0a7b8990257cd393339e23c6
 -Subproject commit c88411ff7776a2db5d6ef6117a1b2faa42a95611
++Subproject commit 371960484a38fc64e0a2635170a41a0d8ab2f6bd
index 310578043dec1aae382eb6a447ae1d103792d7e6,310578043dec1aae382eb6a447ae1d103792d7e6..a8515cfdfe9a98127b592f36fcbe51b7e23b969a
@@@ -1,1 -1,1 +1,1 @@@
--Subproject commit 310578043dec1aae382eb6a447ae1d103792d7e6
++Subproject commit a8515cfdfe9a98127b592f36fcbe51b7e23b969a
index 4e30cb076d47f569b10d02991af527495ea4b46f,8a736c9952d21732411f0c422c63367ea2df30eb..770b2b4a18526e0de7c9b011b2b2cd3760526033
@@@ -798,9 -789,9 +798,10 @@@ struct ShadeResult
  #define SH_NODE_UVALONGSTROKE                 191
  #define SH_NODE_TEX_POINTDENSITY              192
  #define SH_NODE_BSDF_PRINCIPLED         193
 +#define SH_NODE_EEVEE_SPECULAR                        195
  #define SH_NODE_BEVEL                   197
  #define SH_NODE_DISPLACEMENT            198
+ #define SH_NODE_VECTOR_DISPLACEMENT     199
  
  /* custom defines options for Material node */
  #define SH_NODE_MAT_DIFF   1
Simple merge
Simple merge
index d5c191b396681f740f929833c49fe0c0c287fc4f,e976eaf143acb58b0adbe0df9dc9590217f45e2c..25aee34f0ab787e0b52248d8744a10aed36e6eea
@@@ -41,13 -42,30 +42,30 @@@ static bNodeSocketTemplate sh_node_disp
        {       -1, 0, ""       }
  };
  
+ static void node_shader_init_displacement(bNodeTree *UNUSED(ntree), bNode *node)
+ {
+       node->custom1 = SHD_SPACE_OBJECT; /* space */
+       /* Set default value here for backwards compatibility. */
+       for (bNodeSocket *sock = node->inputs.first; sock; sock = sock->next) {
+               if (STREQ(sock->name, "Midlevel")) {
+                       ((bNodeSocketValueFloat *)sock->default_value)->value = 0.5f;
+               }
+       }
+ }
  static int gpu_shader_displacement(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
  {
-       if (!in[2].link) {
-               GPU_link(mat, "direction_transform_m4v3", GPU_builtin(GPU_VIEW_NORMAL), GPU_builtin(GPU_INVERSE_VIEW_MATRIX), &in[2].link);
+       if (!in[3].link) {
+               GPU_link(mat, "direction_transform_m4v3", GPU_builtin(GPU_VIEW_NORMAL), GPU_builtin(GPU_INVERSE_VIEW_MATRIX), &in[3].link);
        }
  
-       return GPU_stack_link(mat, node, "node_displacement", in, out);
+       if(node->custom1 == SHD_SPACE_OBJECT) {
 -              return GPU_stack_link(mat, "node_displacement_object", in, out, GPU_builtin(GPU_OBJECT_MATRIX));
++              return GPU_stack_link(mat, node, "node_displacement_object", in, out, GPU_builtin(GPU_OBJECT_MATRIX));
+       }
+       else {
 -              return GPU_stack_link(mat, "node_displacement_world", in, out, GPU_builtin(GPU_OBJECT_MATRIX));
++              return GPU_stack_link(mat, node, "node_displacement_world", in, out, GPU_builtin(GPU_OBJECT_MATRIX));
+       }
  }
  
  /* node type definition */
index 0000000000000000000000000000000000000000,c40377c3d59ca4e3ea2a7bfac8673c8f03318fff..c864a60681285fe54e08a0e5962c77bafae4699e
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,82 +1,83 @@@
 -              return GPU_stack_link(mat, "node_vector_displacement_object", in, out, GPU_builtin(GPU_OBJECT_MATRIX));
+ /*
+  * ***** 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"
+ /* **************** OUTPUT ******************** */
+ static bNodeSocketTemplate sh_node_vector_displacement_in[] = {
+       {       SOCK_RGBA, 0, N_("Vector"), 0.00f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f, PROP_NONE, SOCK_HIDE_VALUE},
+       {       SOCK_FLOAT, 0, N_("Midlevel"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
+       {       SOCK_FLOAT, 0, N_("Scale"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
+       {       -1, 0, ""       }
+ };
+ static bNodeSocketTemplate sh_node_vector_displacement_out[] = {
+       {       SOCK_VECTOR, 0, N_("Displacement"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+       {       -1, 0, ""       }
+ };
+ static void node_shader_init_vector_displacement(bNodeTree *UNUSED(ntree), bNode *node)
+ {
+       node->custom1 = SHD_SPACE_TANGENT; /* space */
+ }
+ static int gpu_shader_vector_displacement(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
+ {
+       if(node->custom1 == SHD_SPACE_TANGENT) {
+               return GPU_stack_link(mat,
++                                    node,
+                                     "node_vector_displacement_tangent",
+                                     in,
+                                     out,
+                                     GPU_attribute(CD_TANGENT, ""),
+                                     GPU_builtin(GPU_VIEW_NORMAL),
+                                     GPU_builtin(GPU_OBJECT_MATRIX),
+                                     GPU_builtin(GPU_VIEW_MATRIX));
+       }
+       else if(node->custom1 == SHD_SPACE_OBJECT) {
 -              return GPU_stack_link(mat, "node_vector_displacement_world", in, out);
++              return GPU_stack_link(mat, node, "node_vector_displacement_object", in, out, GPU_builtin(GPU_OBJECT_MATRIX));
+       }
+       else {
++              return GPU_stack_link(mat, node, "node_vector_displacement_world", in, out);
+       }
+ }
+ /* node type definition */
+ void register_node_type_sh_vector_displacement(void)
+ {
+       static bNodeType ntype;
+       sh_node_type_base(&ntype, SH_NODE_VECTOR_DISPLACEMENT, "Vector Displacement", NODE_CLASS_OP_VECTOR, 0);
+       node_type_compatibility(&ntype, NODE_NEW_SHADING);
+       node_type_socket_templates(&ntype, sh_node_vector_displacement_in, sh_node_vector_displacement_out);
+       node_type_storage(&ntype, "", NULL, NULL);
+       node_type_init(&ntype, node_shader_init_vector_displacement);
+       node_type_gpu(&ntype, gpu_shader_vector_displacement);
+       nodeRegisterType(&ntype);
+ }
diff --cc source/tools
index ccf20e08702ee6424edbda01544bb9f8bc386de4,7695e14cfc5820ac66546e0e515914d85ab81af3..b11375e89061303401376f7aeae42ac2fd64692a
@@@ -1,1 -1,1 +1,1 @@@
- Subproject commit ccf20e08702ee6424edbda01544bb9f8bc386de4
 -Subproject commit 7695e14cfc5820ac66546e0e515914d85ab81af3
++Subproject commit b11375e89061303401376f7aeae42ac2fd64692a