Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/geometry_component_instances.cc
| Show First 20 Lines • Show All 392 Lines • ▼ Show 20 Lines | public: | ||||
| { | { | ||||
| const InstancesComponent &instances_component = static_cast<const InstancesComponent &>( | const InstancesComponent &instances_component = static_cast<const InstancesComponent &>( | ||||
| component); | component); | ||||
| Span<float4x4> transforms = instances_component.instance_transforms(); | Span<float4x4> transforms = instances_component.instance_transforms(); | ||||
| return std::make_unique<fn::GVArray_For_DerivedSpan<float4x4, float3, get_transform_position>>( | return std::make_unique<fn::GVArray_For_DerivedSpan<float4x4, float3, get_transform_position>>( | ||||
| transforms); | transforms); | ||||
| } | } | ||||
| GVMutableArrayPtr try_get_for_write(GeometryComponent &component) const final | WriteAttributeLookup try_get_for_write(GeometryComponent &component) const final | ||||
| { | { | ||||
| InstancesComponent &instances_component = static_cast<InstancesComponent &>(component); | InstancesComponent &instances_component = static_cast<InstancesComponent &>(component); | ||||
| MutableSpan<float4x4> transforms = instances_component.instance_transforms(); | MutableSpan<float4x4> transforms = instances_component.instance_transforms(); | ||||
| return std::make_unique<fn::GVMutableArray_For_DerivedSpan<float4x4, | return { | ||||
| std::make_unique<fn::GVMutableArray_For_DerivedSpan<float4x4, | |||||
| float3, | float3, | ||||
| get_transform_position, | get_transform_position, | ||||
| set_transform_position>>( | set_transform_position>>(transforms), | ||||
| transforms); | domain_}; | ||||
| } | } | ||||
| bool try_delete(GeometryComponent &UNUSED(component)) const final | bool try_delete(GeometryComponent &UNUSED(component)) const final | ||||
| { | { | ||||
| return false; | return false; | ||||
| } | } | ||||
| bool try_create(GeometryComponent &UNUSED(component), | bool try_create(GeometryComponent &UNUSED(component), | ||||
| Show All 20 Lines | public: | ||||
| { | { | ||||
| const InstancesComponent &instances = static_cast<const InstancesComponent &>(component); | const InstancesComponent &instances = static_cast<const InstancesComponent &>(component); | ||||
| if (instances.instance_ids().is_empty()) { | if (instances.instance_ids().is_empty()) { | ||||
| return {}; | return {}; | ||||
| } | } | ||||
| return std::make_unique<fn::GVArray_For_Span<int>>(instances.instance_ids()); | return std::make_unique<fn::GVArray_For_Span<int>>(instances.instance_ids()); | ||||
| } | } | ||||
| GVMutableArrayPtr try_get_for_write(GeometryComponent &component) const final | WriteAttributeLookup try_get_for_write(GeometryComponent &component) const final | ||||
| { | { | ||||
| InstancesComponent &instances = static_cast<InstancesComponent &>(component); | InstancesComponent &instances = static_cast<InstancesComponent &>(component); | ||||
| if (instances.instance_ids().is_empty()) { | if (instances.instance_ids().is_empty()) { | ||||
| return {}; | return {}; | ||||
| } | } | ||||
| return std::make_unique<fn::GVMutableArray_For_MutableSpan<int>>(instances.instance_ids()); | return {std::make_unique<fn::GVMutableArray_For_MutableSpan<int>>(instances.instance_ids()), | ||||
| domain_}; | |||||
| } | } | ||||
| bool try_delete(GeometryComponent &component) const final | bool try_delete(GeometryComponent &component) const final | ||||
| { | { | ||||
| InstancesComponent &instances = static_cast<InstancesComponent &>(component); | InstancesComponent &instances = static_cast<InstancesComponent &>(component); | ||||
| if (instances.instance_ids().is_empty()) { | if (instances.instance_ids().is_empty()) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 56 Lines • Show Last 20 Lines | |||||