Fix #33347: cycles OSL crash connecting string to vector socket.

This commit is contained in:
Brecht Van Lommel 2012-11-30 06:10:16 +00:00
parent 6bb45495d1
commit e7f594b0df
8 changed files with 41 additions and 0 deletions

@ -20,6 +20,7 @@
shader node_convert_from_color( shader node_convert_from_color(
color Color = color(0.0, 0.0, 0.0), color Color = color(0.0, 0.0, 0.0),
output string String = "",
output float Val = 0.0, output float Val = 0.0,
output int ValInt = 0, output int ValInt = 0,
output vector Vector = vector(0.0, 0.0, 0.0), output vector Vector = vector(0.0, 0.0, 0.0),

@ -20,6 +20,7 @@
shader node_convert_from_float( shader node_convert_from_float(
float Val = 0.0, float Val = 0.0,
output string String = "",
output int ValInt = 0, output int ValInt = 0,
output color Color = color(0.0, 0.0, 0.0), output color Color = color(0.0, 0.0, 0.0),
output vector Vector = vector(0.0, 0.0, 0.0), output vector Vector = vector(0.0, 0.0, 0.0),

@ -20,6 +20,7 @@
shader node_convert_from_int( shader node_convert_from_int(
int ValInt = 0, int ValInt = 0,
output string String = "",
output float Val = 0.0, output float Val = 0.0,
output color Color = color(0.0, 0.0, 0.0), output color Color = color(0.0, 0.0, 0.0),
output vector Vector = vector(0.0, 0.0, 0.0), output vector Vector = vector(0.0, 0.0, 0.0),

@ -20,6 +20,7 @@
shader node_convert_from_normal( shader node_convert_from_normal(
normal Normal = normal(0.0, 0.0, 0.0), normal Normal = normal(0.0, 0.0, 0.0),
output string String = "",
output float Val = 0.0, output float Val = 0.0,
output int ValInt = 0, output int ValInt = 0,
output vector Vector = vector(0.0, 0.0, 0.0), output vector Vector = vector(0.0, 0.0, 0.0),

@ -20,6 +20,7 @@
shader node_convert_from_point( shader node_convert_from_point(
point Point = point(0.0, 0.0, 0.0), point Point = point(0.0, 0.0, 0.0),
output string String = "",
output float Val = 0.0, output float Val = 0.0,
output int ValInt = 0, output int ValInt = 0,
output vector Vector = vector(0.0, 0.0, 0.0), output vector Vector = vector(0.0, 0.0, 0.0),

@ -0,0 +1,31 @@
/*
* Copyright 2011, Blender Foundation.
*
* 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.
*/
#include "stdosl.h"
shader node_convert_from_string(
string String = "",
output color Color = color(0.0, 0.0, 0.0),
output float Val = 0.0,
output int ValInt = 0,
output vector Vector = vector(0.0, 0.0, 0.0),
output point Point = point(0.0, 0.0, 0.0),
output normal Normal = normal(0.0, 0.0, 0.0))
{
}

@ -20,6 +20,7 @@
shader node_convert_from_vector( shader node_convert_from_vector(
vector Vector = vector(0.0, 0.0, 0.0), vector Vector = vector(0.0, 0.0, 0.0),
output string String = "",
output float Val = 0.0, output float Val = 0.0,
output int ValInt = 0, output int ValInt = 0,
output color Color = color(0.0, 0.0, 0.0), output color Color = color(0.0, 0.0, 0.0),

@ -1124,6 +1124,8 @@ ConvertNode::ConvertNode(ShaderSocketType from_, ShaderSocketType to_)
add_input("Point", SHADER_SOCKET_POINT); add_input("Point", SHADER_SOCKET_POINT);
else if(from == SHADER_SOCKET_NORMAL) else if(from == SHADER_SOCKET_NORMAL)
add_input("Normal", SHADER_SOCKET_NORMAL); add_input("Normal", SHADER_SOCKET_NORMAL);
else if(from == SHADER_SOCKET_STRING)
add_input("String", SHADER_SOCKET_STRING);
else else
assert(0); assert(0);
@ -1139,6 +1141,8 @@ ConvertNode::ConvertNode(ShaderSocketType from_, ShaderSocketType to_)
add_output("Point", SHADER_SOCKET_POINT); add_output("Point", SHADER_SOCKET_POINT);
else if(to == SHADER_SOCKET_NORMAL) else if(to == SHADER_SOCKET_NORMAL)
add_output("Normal", SHADER_SOCKET_NORMAL); add_output("Normal", SHADER_SOCKET_NORMAL);
else if(to == SHADER_SOCKET_STRING)
add_output("String", SHADER_SOCKET_STRING);
else else
assert(0); assert(0);
} }