Integer socket support in Cycles. Int values are already supported natively in OSL...
[blender.git] / intern / cycles / blender / blender_shader.cpp
index 98ac8692f3611e3aa93f717f119a24f7023e299a..db34a9fe9aa86955fa0ac3b1b7a951d83bc719c9 100644 (file)
@@ -80,6 +80,8 @@ static ShaderSocketType convert_socket_type(BL::NodeSocket::type_enum b_type)
        switch (b_type) {
        case BL::NodeSocket::type_VALUE:
                return SHADER_SOCKET_FLOAT;
+       case BL::NodeSocket::type_INT:
+               return SHADER_SOCKET_INT;
        case BL::NodeSocket::type_VECTOR:
                return SHADER_SOCKET_VECTOR;
        case BL::NodeSocket::type_RGBA:
@@ -89,7 +91,6 @@ static ShaderSocketType convert_socket_type(BL::NodeSocket::type_enum b_type)
        
        case BL::NodeSocket::type_BOOLEAN:
        case BL::NodeSocket::type_MESH:
-       case BL::NodeSocket::type_INT:
        default:
                return SHADER_SOCKET_FLOAT;
        }
@@ -104,6 +105,11 @@ static void set_default_value(ShaderInput *input, BL::NodeSocket sock)
                input->set(value_sock.default_value());
                break;
        }
+       case SHADER_SOCKET_INT: {
+               BL::NodeSocketIntNone value_sock(sock);
+               input->set((float)value_sock.default_value());
+               break;
+       }
        case SHADER_SOCKET_COLOR: {
                BL::NodeSocketRGBA rgba_sock(sock);
                input->set(get_float3(rgba_sock.default_value()));