forked from blender/blender
davidhaver-WIP-realize-depth #3
@ -207,14 +207,10 @@ void join_transform_instance_components(const Span<const GeometryComponent *> sr
|
|||||||
const bke::InstancesComponent &src_instance_component = static_cast<const bke::InstancesComponent &>(*src_component);
|
const bke::InstancesComponent &src_instance_component = static_cast<const bke::InstancesComponent &>(*src_component);
|
||||||
tot_instances += src_instance_component.get()->instances_num();
|
tot_instances += src_instance_component.get()->instances_num();
|
||||||
}
|
}
|
||||||
|
|
||||||
// dst_instances->reserve(tot_instances);
|
|
||||||
|
|
||||||
for (const int i:src_components.index_range())
|
for (const int i:src_components.index_range())
|
||||||
{
|
{
|
||||||
const bke::GeometryComponent *src_component = src_components[i];
|
const bke::GeometryComponent *src_component = src_components[i];
|
||||||
const bke::InstancesComponent &src_instance_component = static_cast<const bke::InstancesComponent &>(*src_component);
|
const bke::InstancesComponent &src_instance_component = static_cast<const bke::InstancesComponent &>(*src_component);
|
||||||
// const bke::InstancesComponent *src_component = src_components[i];
|
|
||||||
const blender::float4x4 &base_transform = src_base_transforms[i];
|
const blender::float4x4 &base_transform = src_base_transforms[i];
|
||||||
const bke::Instances &src_instances = *src_instance_component.get();
|
const bke::Instances &src_instances = *src_instance_component.get();
|
||||||
|
|
||||||
@ -240,16 +236,6 @@ void join_transform_instance_components(const Span<const GeometryComponent *> sr
|
|||||||
bke::InstancesComponent &dst_component = result.get_component_for_write<bke::InstancesComponent>();
|
bke::InstancesComponent &dst_component = result.get_component_for_write<bke::InstancesComponent>();
|
||||||
join_attributes(src_components, dst_component, {"position"});
|
join_attributes(src_components, dst_component, {"position"});
|
||||||
|
|
||||||
// if (src_components.size() == 1){
|
|
||||||
// result.add(*src_components.first());
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// else{
|
|
||||||
// result.add(*src_components[0]);
|
|
||||||
// result.add(*src_components[1]);
|
|
||||||
// result.add(*src_components[2]);
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GeometrySet join_geometries(const Span<GeometrySet> geometries,
|
GeometrySet join_geometries(const Span<GeometrySet> geometries,
|
||||||
|
@ -655,7 +655,6 @@ static void gather_realize_tasks_recursive(GatherTasksInfo &gather_info,
|
|||||||
}
|
}
|
||||||
case bke::GeometryComponent::Type::Instance: {
|
case bke::GeometryComponent::Type::Instance: {
|
||||||
if (current_depth == target_depth) {
|
if (current_depth == target_depth) {
|
||||||
// const auto &instances_component = static_cast<const bke::InstancesComponent *>(component);
|
|
||||||
gather_info.instances_components_to_merge.append(component);
|
gather_info.instances_components_to_merge.append(component);
|
||||||
gather_info.instances_components_transforms.append(base_transform);
|
gather_info.instances_components_transforms.append(base_transform);
|
||||||
}
|
}
|
||||||
@ -1678,22 +1677,7 @@ bke::GeometrySet realize_instances(bke::GeometrySet geometry_set,
|
|||||||
}
|
}
|
||||||
gather_realize_tasks_recursive(gather_info, 0, -1, geometry_set, transform, attribute_fallbacks);
|
gather_realize_tasks_recursive(gather_info, 0, -1, geometry_set, transform, attribute_fallbacks);
|
||||||
|
|
||||||
// Vector<bke::GeometrySet> geometries_to_merge;
|
|
||||||
// Vector<const bke::GeometryComponent *> component_to_merge;
|
|
||||||
// for (const auto &instances_component : gather_info.instances_components_to_merge) {
|
|
||||||
// // Assuming InstancesComponent is implicitly convertible to GeometryComponent
|
|
||||||
// const bke::GeometryComponent *geometry_component = static_cast<const bke::GeometryComponent *>(instances_component);
|
|
||||||
// component_to_merge.append(geometry_component);
|
|
||||||
// // Create a new GeometrySet and add the geometry component to it
|
|
||||||
// bke::GeometrySet new_geometry_se;
|
|
||||||
// new_geometry_se.add(*geometry_component);
|
|
||||||
|
|
||||||
// // Add the new GeometrySet to the Vector
|
|
||||||
// geometries_to_merge.append(new_geometry_se);
|
|
||||||
// }
|
|
||||||
|
|
||||||
join_transform_instance_components(gather_info.instances_components_to_merge, gather_info.instances_components_transforms, new_geometry_set);
|
join_transform_instance_components(gather_info.instances_components_to_merge, gather_info.instances_components_transforms, new_geometry_set);
|
||||||
// new_geometry_set = geometry::join_geometries(geometries_to_merge, options.propagation_info);
|
|
||||||
|
|
||||||
execute_realize_pointcloud_tasks(options,
|
execute_realize_pointcloud_tasks(options,
|
||||||
all_pointclouds_info,
|
all_pointclouds_info,
|
||||||
|
@ -23,6 +23,7 @@ static void node_declare(NodeDeclarationBuilder &b)
|
|||||||
.description(("Which top-level instances to realize"));
|
.description(("Which top-level instances to realize"));
|
||||||
b.add_input<decl::Int>("Depth")
|
b.add_input<decl::Int>("Depth")
|
||||||
.default_value(0)
|
.default_value(0)
|
||||||
|
.min(0)
|
||||||
.supports_field()
|
.supports_field()
|
||||||
.description(
|
.description(
|
||||||
("Number of levels of nested instances to realize for each top-level instance"));
|
("Number of levels of nested instances to realize for each top-level instance"));
|
||||||
|
Loading…
Reference in New Issue
Block a user