Commit: c596e6b277da484c0ffdc3eddf157c4ce9ef6b20
Author: Jacques Lucke
Date:   Fri Aug 6 11:36:28 2021 +0200
Branches: temp-geometry-nodes-expandable-geometry-socket-prototype
https://developer.blender.org/rBc596e6b277da484c0ffdc3eddf157c4ce9ef6b20

workaround for attribute inputs: use string sockets

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

M       source/blender/editors/space_node/node_edit.cc
M       source/blender/nodes/NOD_geometry_exec.hh
M       source/blender/nodes/geometry/nodes/node_geo_geometry_expander.cc
M       source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc

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

diff --git a/source/blender/editors/space_node/node_edit.cc 
b/source/blender/editors/space_node/node_edit.cc
index f35318f2ad1..7572dbcace1 100644
--- a/source/blender/editors/space_node/node_edit.cc
+++ b/source/blender/editors/space_node/node_edit.cc
@@ -2996,12 +2996,12 @@ static void foreach_available_attribute(
     FunctionRef<void(const GeometryExpanderOutput &attribute)> callback)
 {
   LISTBASE_FOREACH (bNodeSocket *, group_input, &ntree->inputs) {
-    if (ELEM(group_input->type, SOCK_INT, SOCK_FLOAT, SOCK_VECTOR, SOCK_RGBA, 
SOCK_BOOLEAN)) {
+    if (group_input->type == SOCK_STRING) {
       GeometryExpanderOutput attribute;
       attribute.type = GEOMETRY_EXPANDER_OUTPUT_TYPE_INPUT;
       attribute.array_source = GEOMETRY_EXPANDER_ARRAY_SOURCE_MESH_VERTICES;
-      attribute.socket_type = (eNodeSocketDatatype)group_input->type;
       STRNCPY(attribute.input_identifier, group_input->identifier);
+      attribute.socket_type = SOCK_FLOAT;
       callback(attribute);
     }
   }
diff --git a/source/blender/nodes/NOD_geometry_exec.hh 
b/source/blender/nodes/NOD_geometry_exec.hh
index 6748d538e6a..156595a1583 100644
--- a/source/blender/nodes/NOD_geometry_exec.hh
+++ b/source/blender/nodes/NOD_geometry_exec.hh
@@ -340,6 +340,11 @@ class GeoNodeExecParams {
                                                     const GeometryComponent 
&component,
                                                     const AttributeDomain 
default_domain) const;
 
+  std::string get_group_input_attribute_name(const StringRef 
UNUSED(input_identifier)) const
+  {
+    return "Group";
+  }
+
  private:
   /* Utilities for detecting common errors at when using this class. */
   void check_input_access(StringRef identifier, const CPPType *requested_type 
= nullptr) const;
diff --git a/source/blender/nodes/geometry/nodes/node_geo_geometry_expander.cc 
b/source/blender/nodes/geometry/nodes/node_geo_geometry_expander.cc
index b2d175ea0ae..b945fb37b29 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_geometry_expander.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_geometry_expander.cc
@@ -160,8 +160,8 @@ static void 
geo_node_geometry_expander_exec(GeoNodeExecParams params)
           break;
         }
         case GEOMETRY_EXPANDER_OUTPUT_TYPE_INPUT: {
-          const std::string attribute_name = get_input_attribute_name(
-              ntree.id.name, expander_output->input_identifier);
+          const std::string attribute_name = 
params.get_group_input_attribute_name(
+              expander_output->input_identifier);
           GVArrayPtr attribute = component->attribute_try_get_for_read(
               attribute_name, domain, data_type);
           if (attribute) {
diff --git a/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc 
b/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc
index 4f76dd11f7a..d63814092d9 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc
@@ -351,7 +351,6 @@ struct SpecialAttributeOutputs {
 
 BLI_NOINLINE static void 
compute_special_attributes(Span<GeometryInstanceGroup> sets,
                                                     Span<int> 
instance_start_offsets,
-                                                    GeometryComponent 
&component,
                                                     Span<Vector<float3>> 
bary_coords_array,
                                                     Span<Vector<int>> 
looptri_indices_array,
                                                     SpecialAttributeOutputs 
&r_special_attributes)
@@ -365,8 +364,6 @@ BLI_NOINLINE static void 
compute_special_attributes(Span<GeometryInstanceGroup>
                                   BKE_mesh_runtime_looptri_len(&mesh)};
 
     for (const float4x4 &transform : set_group.transforms) {
-      const int offset = instance_start_offsets[i_instance];
-
       Span<float3> bary_coords = bary_coords_array[i_instance];
       Span<int> looptri_indices = looptri_indices_array[i_instance];
 
@@ -416,7 +413,6 @@ BLI_NOINLINE static void add_remaining_point_attributes(
                                   looptri_indices_array);
   compute_special_attributes(set_groups,
                              instance_start_offsets,
-                             component,
                              bary_coords_array,
                              looptri_indices_array,
                              r_special_attributes);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to