Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/node_geo_attribute_capture.cc
| Show First 20 Lines • Show All 141 Lines • ▼ Show 20 Lines | case CD_PROP_INT32: | ||||
| break; | break; | ||||
| default: | default: | ||||
| break; | break; | ||||
| } | } | ||||
| WeakAnonymousAttributeID anonymous_id{"Attribute"}; | WeakAnonymousAttributeID anonymous_id{"Attribute"}; | ||||
| const CPPType &type = field.cpp_type(); | const CPPType &type = field.cpp_type(); | ||||
| static const Array<GeometryComponentType> types = { | static const Array<GeometryComponentType> types = { | ||||
| GEO_COMPONENT_TYPE_MESH, GEO_COMPONENT_TYPE_POINT_CLOUD, GEO_COMPONENT_TYPE_CURVE}; | GEO_COMPONENT_TYPE_MESH, GEO_COMPONENT_TYPE_POINT_CLOUD, GEO_COMPONENT_TYPE_CURVE}; | ||||
| geometry_set.modify_geometry_sets([&](GeometrySet &geometry_set) { | geometry_set.modify_geometry_sets([&](GeometrySet &geometry_set) { | ||||
| for (const GeometryComponentType type : types) { | for (const GeometryComponentType type : types) { | ||||
| if (geometry_set.has(type)) { | if (geometry_set.has(type)) { | ||||
| GeometryComponent &component = geometry_set.get_component_for_write(type); | GeometryComponent &component = geometry_set.get_component_for_write(type); | ||||
| try_capture_field_on_geometry(component, anonymous_id.get(), domain, field); | try_capture_field_on_geometry(component, anonymous_id.get(), domain, field); | ||||
| } | } | ||||
| } | } | ||||
| }); | }); | ||||
HooglyBoogly: Add a comment, something like `/* Run on the instances component separately to only affect the… | |||||
| if (geometry_set.has_instances()) { | |||||
| GeometryComponent &component = geometry_set.get_component_for_write( | |||||
| GEO_COMPONENT_TYPE_INSTANCES); | |||||
| try_capture_field_on_geometry(component, anonymous_id.get(), domain, field); | |||||
| } | |||||
HooglyBooglyUnsubmitted Done Inline ActionsThese two cases should go in a if (domain == ATTR_DOMAIN_INSTANCE) { ... } else { ... } block. HooglyBoogly: These two cases should go in a `if (domain == ATTR_DOMAIN_INSTANCE) { ... } else { ... }` block. | |||||
| GField output_field{std::make_shared<bke::AnonymousAttributeFieldInput>( | GField output_field{std::make_shared<bke::AnonymousAttributeFieldInput>( | ||||
| std::move(anonymous_id), type, params.attribute_producer_name())}; | std::move(anonymous_id), type, params.attribute_producer_name())}; | ||||
| switch (data_type) { | switch (data_type) { | ||||
| case CD_PROP_FLOAT: { | case CD_PROP_FLOAT: { | ||||
| params.set_output("Attribute_001", Field<float>(output_field)); | params.set_output("Attribute_001", Field<float>(output_field)); | ||||
| break; | break; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines | |||||
Add a comment, something like /* Run on the instances component separately to only affect the top level of instances. */