diff options
-rw-r--r-- | release/scripts/startup/bl_app_templates_system/2D_Animation/__init__.py | 18 | ||||
-rw-r--r-- | source/blender/nodes/shader/node_shader_tree.c | 18 |
2 files changed, 33 insertions, 3 deletions
diff --git a/release/scripts/startup/bl_app_templates_system/2D_Animation/__init__.py b/release/scripts/startup/bl_app_templates_system/2D_Animation/__init__.py index 62c1edbee85..009cb65d150 100644 --- a/release/scripts/startup/bl_app_templates_system/2D_Animation/__init__.py +++ b/release/scripts/startup/bl_app_templates_system/2D_Animation/__init__.py @@ -1,3 +1,21 @@ +# ##### 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. +# +# ##### END GPL LICENSE BLOCK ##### + # Initialization script for 2D Animation template import bpy diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c index d44cb8c7de1..179a92ec7bd 100644 --- a/source/blender/nodes/shader/node_shader_tree.c +++ b/source/blender/nodes/shader/node_shader_tree.c @@ -385,9 +385,21 @@ static void ntree_shader_groups_expand_inputs(bNodeTree *localtree) /* Fix the case where the socket is actually converting the data. (see T71374) * We only do the case of lossy conversion to float.*/ if ((socket->type == SOCK_FLOAT) && (link->fromsock->type != link->tosock->type)) { - bNode *tmp = nodeAddStaticNode(NULL, localtree, SH_NODE_RGBTOBW); - nodeAddLink(localtree, link->fromnode, link->fromsock, tmp, tmp->inputs.first); - nodeAddLink(localtree, tmp, tmp->outputs.first, node, socket); + if (link->fromsock->type == SOCK_RGBA) { + bNode *tmp = nodeAddStaticNode(NULL, localtree, SH_NODE_RGBTOBW); + nodeAddLink(localtree, link->fromnode, link->fromsock, tmp, tmp->inputs.first); + nodeAddLink(localtree, tmp, tmp->outputs.first, node, socket); + } + else if (link->fromsock->type == SOCK_VECTOR) { + bNode *tmp = nodeAddStaticNode(NULL, localtree, SH_NODE_VECTOR_MATH); + tmp->custom1 = NODE_VECTOR_MATH_DOT_PRODUCT; + bNodeSocket *dot_input1 = tmp->inputs.first; + bNodeSocket *dot_input2 = dot_input1->next; + bNodeSocketValueVector *input2_socket_value = dot_input2->default_value; + copy_v3_fl(input2_socket_value->value, 1.0f / 3.0f); + nodeAddLink(localtree, link->fromnode, link->fromsock, tmp, dot_input1); + nodeAddLink(localtree, tmp, tmp->outputs.last, node, socket); + } } continue; } |