realize-depth #5

Merged
Arye Ramaty merged 43 commits from David-Haver/blender:realize-depth into WIP-realize-depth 2024-03-31 17:22:49 +02:00
Showing only changes of commit 0bc454422f - Show all commits

View File

@ -38,26 +38,29 @@ static void node_geo_exec(GeoNodeExecParams params)
} }
GeometryComponentEditData::remember_deformed_positions_if_necessary(geometry_set); GeometryComponentEditData::remember_deformed_positions_if_necessary(geometry_set);
Field<bool> selection_field = params.extract_input<Field<bool>>("Selection");
Field<bool> realize_all_filed = params.extract_input<Field<bool>>("Realize All"); Field<bool> realize_all_field = params.extract_input<Field<bool>>("Realize All");
Field<int> depth_field = params.extract_input<Field<int>>("Depth"); Field<int> depth_field = params.extract_input<Field<int>>("Depth");
static auto depth_override = mf::build::SI2_SO<int, bool, int>( static auto depth_override = mf::build::SI2_SO<int, bool, int>(
"depth_override", "depth_override",
[](int value, bool realize_all_filed) { [](int depth, bool realize_all_field) {
return realize_all_filed ? geometry::VariedDepthOption::MAX_DEPTH : std::max(value, 0); return realize_all_field ? geometry::VariedDepthOption::MAX_DEPTH : std::max(depth, 0);
}, },
mf::build::exec_presets::AllSpanOrSingle()); mf::build::exec_presets::AllSpanOrSingle());
Field<int> depth_field_overrided(FieldOperation::Create(
depth_override, {std::move(depth_field), std::move(realize_all_field)}));
Field<bool> selection_field = params.extract_input<Field<bool>>("Selection");
static auto selection_override = mf::build::SI2_SO<int, bool, bool>( static auto selection_override = mf::build::SI2_SO<int, bool, bool>(
"selection_override", "selection_override",
[](int value, bool selection) { return value == 0 ? false : selection; }, [](int depth_override, bool selection) { return depth_override == 0 ? false : selection; },
mf::build::exec_presets::AllSpanOrSingle()); mf::build::exec_presets::AllSpanOrSingle());
Field<int> depth_field_overrided( Field<bool> selection_field_overrided(FieldOperation::Create(
FieldOperation::Create(depth_override, {depth_field, realize_all_filed})); selection_override, {depth_field_overrided, std::move(selection_field)}));
Field<bool> selection_field_overrided(
FieldOperation::Create(selection_override, {depth_field_overrided, selection_field}));
const bke::Instances &instances = *geometry_set.get_instances(); const bke::Instances &instances = *geometry_set.get_instances();
const bke::InstancesFieldContext field_context(instances); const bke::InstancesFieldContext field_context(instances);