diff --git a/source/blender/modifiers/intern/MOD_nodes.cc b/source/blender/modifiers/intern/MOD_nodes.cc index 7d49d6a45ce..1c1b06f27bb 100644 --- a/source/blender/modifiers/intern/MOD_nodes.cc +++ b/source/blender/modifiers/intern/MOD_nodes.cc @@ -530,9 +530,11 @@ static bool id_property_type_matches_socket(const bNodeSocket &socket, const IDP case SOCK_INT: return property.type == IDP_INT; case SOCK_VECTOR: - return property.type == IDP_ARRAY && property.subtype == IDP_FLOAT && property.len == 3; + return property.type == IDP_ARRAY && + ELEM(property.subtype, IDP_INT, IDP_FLOAT, IDP_DOUBLE) && property.len == 3; case SOCK_RGBA: - return property.type == IDP_ARRAY && property.subtype == IDP_FLOAT && property.len == 4; + return property.type == IDP_ARRAY && + ELEM(property.subtype, IDP_INT, IDP_FLOAT, IDP_DOUBLE) && property.len == 4; case SOCK_BOOLEAN: return property.type == IDP_BOOLEAN; case SOCK_STRING: @@ -570,14 +572,35 @@ static void init_socket_cpp_value_from_property(const IDProperty &property, break; } case SOCK_VECTOR: { + const void *property_array = IDP_Array(&property); float3 value; - copy_v3_v3(value, (const float *)IDP_Array(&property)); + if (property.subtype == IDP_FLOAT) { + value = float3(static_cast(property_array)); + } + else if (property.subtype == IDP_INT) { + value = float3(int3(static_cast(property_array))); + } + else { + BLI_assert(property.subtype == IDP_DOUBLE); + value = float3(double3(static_cast(property_array))); + } new (r_value) fn::ValueOrField(value); break; } case SOCK_RGBA: { - ColorGeometry4f value; - copy_v4_v4((float *)value, (const float *)IDP_Array(&property)); + const void *property_array = IDP_Array(&property); + float4 vec; + if (property.subtype == IDP_FLOAT) { + vec = float4(static_cast(property_array)); + } + else if (property.subtype == IDP_INT) { + vec = float4(int4(static_cast(property_array))); + } + else { + BLI_assert(property.subtype == IDP_DOUBLE); + vec = float4(double4(static_cast(property_array))); + } + ColorGeometry4f value(vec); new (r_value) fn::ValueOrField(value); break; }