[Bf-blender-cvs] [43a56ea1e74] temp-geometry-nodes-text: Initial support for custom attributes on instances
Erik
noreply at git.blender.org
Fri Oct 29 23:50:32 CEST 2021
Commit: 43a56ea1e74a321fc1e53811a63eed717acf62ac
Author: Erik
Date: Thu Oct 28 23:18:30 2021 +0200
Branches: temp-geometry-nodes-text
https://developer.blender.org/rB43a56ea1e74a321fc1e53811a63eed717acf62ac
Initial support for custom attributes on instances
===================================================================
M source/blender/blenkernel/BKE_geometry_set.hh
M source/blender/blenkernel/intern/geometry_component_instances.cc
===================================================================
diff --git a/source/blender/blenkernel/BKE_geometry_set.hh b/source/blender/blenkernel/BKE_geometry_set.hh
index 58a89d0207a..e912b2037ba 100644
--- a/source/blender/blenkernel/BKE_geometry_set.hh
+++ b/source/blender/blenkernel/BKE_geometry_set.hh
@@ -638,6 +638,7 @@ class InstancesComponent : public GeometryComponent {
mutable blender::Array<int> almost_unique_ids_;
public:
+ blender::bke::CustomDataAttributes attributes;
InstancesComponent();
~InstancesComponent() = default;
GeometryComponent *copy() const override;
diff --git a/source/blender/blenkernel/intern/geometry_component_instances.cc b/source/blender/blenkernel/intern/geometry_component_instances.cc
index 5fe77000519..09deefb48bf 100644
--- a/source/blender/blenkernel/intern/geometry_component_instances.cc
+++ b/source/blender/blenkernel/intern/geometry_component_instances.cc
@@ -503,7 +503,21 @@ static ComponentAttributeProviders create_attribute_providers_for_instances()
static InstancePositionAttributeProvider position;
static InstanceIDAttributeProvider id;
- return ComponentAttributeProviders({&position, &id}, {});
+ static CustomDataAccessInfo instance_custom_data_access = {
+ [](GeometryComponent &component) -> CustomData * {
+ InstancesComponent &inst = static_cast<InstancesComponent &>(component);
+ return &inst.attributes.data;
+ },
+ [](const GeometryComponent &component) -> const CustomData * {
+ const InstancesComponent &inst = static_cast<const InstancesComponent &>(component);
+ return &inst.attributes.data;
+ },
+ nullptr};
+
+ static CustomDataAttributeProvider instance_custom_data(ATTR_DOMAIN_POINT,
+ instance_custom_data_access);
+
+ return ComponentAttributeProviders({&position, &id}, {&instance_custom_data});
}
} // namespace blender::bke
More information about the Bf-blender-cvs
mailing list