[Bf-blender-cvs] [f8a23fb05ac] temp-geometry-nodes-expandable-geometry-socket-prototype: fix passing values from modifier

Jacques Lucke noreply at git.blender.org
Tue Aug 3 13:45:42 CEST 2021


Commit: f8a23fb05acfebc3ae64a4927617e21d4ff894fc
Author: Jacques Lucke
Date:   Tue Aug 3 13:45:34 2021 +0200
Branches: temp-geometry-nodes-expandable-geometry-socket-prototype
https://developer.blender.org/rBf8a23fb05acfebc3ae64a4927617e21d4ff894fc

fix passing values from modifier

===================================================================

M	source/blender/modifiers/intern/MOD_nodes.cc

===================================================================

diff --git a/source/blender/modifiers/intern/MOD_nodes.cc b/source/blender/modifiers/intern/MOD_nodes.cc
index 3853b345c14..b67cdbb1cb0 100644
--- a/source/blender/modifiers/intern/MOD_nodes.cc
+++ b/source/blender/modifiers/intern/MOD_nodes.cc
@@ -86,6 +86,7 @@
 #include "NOD_geometry_nodes_eval_log.hh"
 #include "NOD_node_tree_multi_function.hh"
 
+using blender::Array;
 using blender::destruct_ptr;
 using blender::float3;
 using blender::FunctionRef;
@@ -401,12 +402,14 @@ static const SocketPropertyType *get_socket_property_type(const bNodeSocket &bso
           },
           [](const IDProperty &property) { return ELEM(property.type, IDP_FLOAT, IDP_DOUBLE); },
           [](const IDProperty &property, void *r_value) {
+            float value;
             if (property.type == IDP_FLOAT) {
-              *(float *)r_value = IDP_Float(&property);
+              value = IDP_Float(&property);
             }
             else if (property.type == IDP_DOUBLE) {
-              *(float *)r_value = (float)IDP_Double(&property);
+              value = (float)IDP_Double(&property);
             }
+            new (r_value) Array<float>({value});
           },
       };
       return &float_type;
@@ -441,7 +444,10 @@ static const SocketPropertyType *get_socket_property_type(const bNodeSocket &bso
             return (PropertyType)((bNodeSocketValueInt *)socket.default_value)->subtype;
           },
           [](const IDProperty &property) { return property.type == IDP_INT; },
-          [](const IDProperty &property, void *r_value) { *(int *)r_value = IDP_Int(&property); },
+          [](const IDProperty &property, void *r_value) {
+            int value = IDP_Int(&property);
+            new (r_value) Array<int>({value});
+          },
       };
       return &int_type;
     }
@@ -485,7 +491,9 @@ static const SocketPropertyType *get_socket_property_type(const bNodeSocket &bso
                    property.len == 3;
           },
           [](const IDProperty &property, void *r_value) {
-            copy_v3_v3((float *)r_value, (const float *)IDP_Array(&property));
+            float3 value;
+            copy_v3_v3(value, (const float *)IDP_Array(&property));
+            new (r_value) Array<float3>({value});
           },
       };
       return &vector_type;
@@ -517,8 +525,10 @@ static const SocketPropertyType *get_socket_property_type(const bNodeSocket &bso
           nullptr,
           [](const IDProperty &property) { return property.type == IDP_INT; },
           [](const IDProperty &property, void *r_value) {
-            *(bool *)r_value = IDP_Int(&property) != 0;
+            bool value = IDP_Int(&property) != 0;
+            new (r_value) Array<bool>({value});
           },
+
       };
       return &boolean_type;
     }



More information about the Bf-blender-cvs mailing list