Cleanup: Improve consistency when nodes run without OpenVDB
Use a consistent order of expressions and formatting. Also use consistent error message text.
This commit is contained in:
parent
01a4d38606
commit
1b4cf3af4b
|
@ -183,12 +183,11 @@ static void geo_node_distribute_points_in_volume_exec(GeoNodeExecParams params)
|
|||
{
|
||||
GeometrySet geometry_set_in = params.extract_input<GeometrySet>("Volume");
|
||||
|
||||
#ifdef WITH_OPENVDB
|
||||
const NodeGeometryDistributePointsInVolume &storage = node_storage(params.node());
|
||||
const GeometryNodeDistributePointsInVolumeMode mode =
|
||||
static_cast<GeometryNodeDistributePointsInVolumeMode>(storage.mode);
|
||||
|
||||
#ifdef WITH_OPENVDB
|
||||
|
||||
float density;
|
||||
int seed;
|
||||
float3 spacing{0, 0, 0};
|
||||
|
@ -258,9 +257,11 @@ static void geo_node_distribute_points_in_volume_exec(GeoNodeExecParams params)
|
|||
|
||||
params.set_output("Points", std::move(geometry_set_in));
|
||||
|
||||
#else /* WITH_OPENVDB */
|
||||
params.error_message_add(NodeWarningType::Error, TIP_("Blender is compiled without OpenVDB"));
|
||||
#endif /* !WITH_OPENVDB */
|
||||
#else
|
||||
params.set_default_remaining_outputs();
|
||||
params.error_message_add(NodeWarningType::Error,
|
||||
TIP_("Disabled, Blender was compiled without OpenVDB"));
|
||||
#endif
|
||||
}
|
||||
} // namespace blender::nodes
|
||||
|
||||
|
|
|
@ -149,7 +149,6 @@ static void node_geo_exec(GeoNodeExecParams params)
|
|||
{
|
||||
#ifdef WITH_OPENVDB
|
||||
GeometrySet geometry_set(params.extract_input<GeometrySet>("Mesh"));
|
||||
|
||||
geometry_set.modify_geometry_sets([&](GeometrySet &geometry_set) {
|
||||
if (geometry_set.has_mesh()) {
|
||||
Volume *volume = create_volume_from_mesh(*geometry_set.get_mesh_for_read(), params);
|
||||
|
@ -159,9 +158,9 @@ static void node_geo_exec(GeoNodeExecParams params)
|
|||
});
|
||||
params.set_output("Volume", std::move(geometry_set));
|
||||
#else
|
||||
params.set_default_remaining_outputs();
|
||||
params.error_message_add(NodeWarningType::Error,
|
||||
TIP_("Disabled, Blender was compiled without OpenVDB"));
|
||||
params.set_default_remaining_outputs();
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -231,17 +231,16 @@ static void initialize_volume_component_from_points(GeoNodeExecParams ¶ms,
|
|||
|
||||
static void node_geo_exec(GeoNodeExecParams params)
|
||||
{
|
||||
GeometrySet geometry_set = params.extract_input<GeometrySet>("Points");
|
||||
|
||||
#ifdef WITH_OPENVDB
|
||||
GeometrySet geometry_set = params.extract_input<GeometrySet>("Points");
|
||||
geometry_set.modify_geometry_sets([&](GeometrySet &geometry_set) {
|
||||
initialize_volume_component_from_points(params, geometry_set);
|
||||
});
|
||||
params.set_output("Volume", std::move(geometry_set));
|
||||
#else
|
||||
params.set_default_remaining_outputs();
|
||||
params.error_message_add(NodeWarningType::Error,
|
||||
TIP_("Disabled, Blender was compiled without OpenVDB"));
|
||||
params.set_default_remaining_outputs();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -113,9 +113,9 @@ class Grid3DFieldContext : public FieldContext {
|
|||
}
|
||||
};
|
||||
|
||||
#ifdef WITH_OPENVDB
|
||||
static void node_geo_exec(GeoNodeExecParams params)
|
||||
{
|
||||
#ifdef WITH_OPENVDB
|
||||
const float3 bounds_min = params.extract_input<float3>("Min");
|
||||
const float3 bounds_max = params.extract_input<float3>("Max");
|
||||
|
||||
|
@ -177,16 +177,12 @@ static void node_geo_exec(GeoNodeExecParams params)
|
|||
GeometrySet r_geometry_set;
|
||||
r_geometry_set.replace_volume(volume);
|
||||
params.set_output("Volume", r_geometry_set);
|
||||
}
|
||||
|
||||
#else
|
||||
static void node_geo_exec(GeoNodeExecParams params)
|
||||
{
|
||||
params.set_default_remaining_outputs();
|
||||
params.error_message_add(NodeWarningType::Error,
|
||||
TIP_("Disabled, Blender was compiled without OpenVDB"));
|
||||
params.set_default_remaining_outputs();
|
||||
#endif
|
||||
}
|
||||
#endif /* WITH_OPENVDB */
|
||||
|
||||
} // namespace blender::nodes::node_geo_volume_cube_cc
|
||||
|
||||
|
|
|
@ -187,20 +187,19 @@ static Mesh *create_mesh_from_volume(GeometrySet &geometry_set, GeoNodeExecParam
|
|||
|
||||
static void node_geo_exec(GeoNodeExecParams params)
|
||||
{
|
||||
GeometrySet geometry_set = params.extract_input<GeometrySet>("Volume");
|
||||
|
||||
#ifdef WITH_OPENVDB
|
||||
GeometrySet geometry_set = params.extract_input<GeometrySet>("Volume");
|
||||
geometry_set.modify_geometry_sets([&](GeometrySet &geometry_set) {
|
||||
Mesh *mesh = create_mesh_from_volume(geometry_set, params);
|
||||
geometry_set.replace_mesh(mesh);
|
||||
geometry_set.keep_only_during_modify({GEO_COMPONENT_TYPE_MESH});
|
||||
});
|
||||
params.set_output("Mesh", std::move(geometry_set));
|
||||
#else
|
||||
params.set_default_remaining_outputs();
|
||||
params.error_message_add(NodeWarningType::Error,
|
||||
TIP_("Disabled, Blender was compiled without OpenVDB"));
|
||||
#endif
|
||||
|
||||
params.set_output("Mesh", std::move(geometry_set));
|
||||
}
|
||||
|
||||
} // namespace blender::nodes::node_geo_volume_to_mesh_cc
|
||||
|
|
Loading…
Reference in New Issue