Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc
| Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | b.add_input<decl::Vector>("Rotation") | ||||
| .subtype(PROP_EULER) | .subtype(PROP_EULER) | ||||
| .supports_field() | .supports_field() | ||||
| .description("Rotation of the instances"); | .description("Rotation of the instances"); | ||||
| b.add_input<decl::Vector>("Scale") | b.add_input<decl::Vector>("Scale") | ||||
| .default_value({1.0f, 1.0f, 1.0f}) | .default_value({1.0f, 1.0f, 1.0f}) | ||||
| .subtype(PROP_XYZ) | .subtype(PROP_XYZ) | ||||
| .supports_field() | .supports_field() | ||||
| .description("Scale of the instances"); | .description("Scale of the instances"); | ||||
| b.add_input<decl::Int>("Stable ID") | |||||
| .supports_field() | |||||
| .description( | |||||
| "ID for every instance that is used to identify it over time even when the number of " | |||||
| "instances changes. Used for example for motion blur"); | |||||
| b.add_output<decl::Geometry>("Instances"); | b.add_output<decl::Geometry>("Instances"); | ||||
| } | } | ||||
| static void add_instances_from_component(InstancesComponent &dst_component, | static void add_instances_from_component(InstancesComponent &dst_component, | ||||
| const GeometryComponent &src_component, | const GeometryComponent &src_component, | ||||
| const GeometrySet &instance, | const GeometrySet &instance, | ||||
| const GeoNodeExecParams ¶ms) | const GeoNodeExecParams ¶ms) | ||||
| Show All 22 Lines | static void add_instances_from_component(InstancesComponent &dst_component, | ||||
| FieldEvaluator field_evaluator{field_context, domain_size}; | FieldEvaluator field_evaluator{field_context, domain_size}; | ||||
| const VArray<bool> *pick_instance = nullptr; | const VArray<bool> *pick_instance = nullptr; | ||||
| const VArray<int> *indices = nullptr; | const VArray<int> *indices = nullptr; | ||||
| const VArray<float3> *rotations = nullptr; | const VArray<float3> *rotations = nullptr; | ||||
| const VArray<float3> *scales = nullptr; | const VArray<float3> *scales = nullptr; | ||||
| /* The evaluator could use the component's stable IDs as a destination directly, but only the | /* The evaluator could use the component's stable IDs as a destination directly, but only the | ||||
| * selected indices should be copied. */ | * selected indices should be copied. */ | ||||
| const VArray<int> *stable_ids = nullptr; | GVArray_Typed<int> stable_ids = src_component.attribute_get_for_read( | ||||
| "random_point_id", ATTR_DOMAIN_POINT, 0); | |||||
| field_evaluator.add(params.get_input<Field<bool>>("Pick Instance"), &pick_instance); | field_evaluator.add(params.get_input<Field<bool>>("Pick Instance"), &pick_instance); | ||||
| field_evaluator.add(params.get_input<Field<int>>("Instance Index"), &indices); | field_evaluator.add(params.get_input<Field<int>>("Instance Index"), &indices); | ||||
| field_evaluator.add(params.get_input<Field<float3>>("Rotation"), &rotations); | field_evaluator.add(params.get_input<Field<float3>>("Rotation"), &rotations); | ||||
| field_evaluator.add(params.get_input<Field<float3>>("Scale"), &scales); | field_evaluator.add(params.get_input<Field<float3>>("Scale"), &scales); | ||||
| field_evaluator.add(params.get_input<Field<int>>("Stable ID"), &stable_ids); | |||||
| field_evaluator.evaluate(); | field_evaluator.evaluate(); | ||||
| GVArray_Typed<float3> positions = src_component.attribute_get_for_read<float3>( | GVArray_Typed<float3> positions = src_component.attribute_get_for_read<float3>( | ||||
| "position", domain, {0, 0, 0}); | "position", domain, {0, 0, 0}); | ||||
| const InstancesComponent *src_instances = instance.get_component_for_read<InstancesComponent>(); | const InstancesComponent *src_instances = instance.get_component_for_read<InstancesComponent>(); | ||||
| /* Maps handles from the source instances to handles on the new instance. */ | /* Maps handles from the source instances to handles on the new instance. */ | ||||
| ▲ Show 20 Lines • Show All 115 Lines • Show Last 20 Lines | |||||