Differential D16858 Diff 58916 source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc
Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc
| Show All 27 Lines | b.add_input<decl::Int>(N_("Rings")) | ||||
| .max(1024) | .max(1024) | ||||
| .description(N_("The number of horizontal rings")); | .description(N_("The number of horizontal rings")); | ||||
| b.add_input<decl::Float>(N_("Radius")) | b.add_input<decl::Float>(N_("Radius")) | ||||
| .default_value(1.0f) | .default_value(1.0f) | ||||
| .min(0.0f) | .min(0.0f) | ||||
| .subtype(PROP_DISTANCE) | .subtype(PROP_DISTANCE) | ||||
| .description(N_("Distance from the generated points to the origin")); | .description(N_("Distance from the generated points to the origin")); | ||||
| b.add_output<decl::Geometry>(N_("Mesh")); | b.add_output<decl::Geometry>(N_("Mesh")); | ||||
| b.add_output<decl::Vector>(N_("UV Map")).field_source(); | b.add_output<decl::Vector>(N_("UV Map")).field_on_auto(); | ||||
| } | } | ||||
| static int sphere_vert_total(const int segments, const int rings) | static int sphere_vert_total(const int segments, const int rings) | ||||
| { | { | ||||
| return segments * (rings - 1) + 2; | return segments * (rings - 1) + 2; | ||||
| } | } | ||||
| static int sphere_edge_total(const int segments, const int rings) | static int sphere_edge_total(const int segments, const int rings) | ||||
| ▲ Show 20 Lines • Show All 312 Lines • ▼ Show 20 Lines | if (rings_num < 3) { | ||||
| params.error_message_add(NodeWarningType::Info, TIP_("Rings must be at least 3")); | params.error_message_add(NodeWarningType::Info, TIP_("Rings must be at least 3")); | ||||
| } | } | ||||
| params.set_default_remaining_outputs(); | params.set_default_remaining_outputs(); | ||||
| return; | return; | ||||
| } | } | ||||
| const float radius = params.extract_input<float>("Radius"); | const float radius = params.extract_input<float>("Radius"); | ||||
| StrongAnonymousAttributeID uv_map_id; | AutoAnonymousAttributeID uv_map_id = params.get_output_anonymous_attribute_id_if_needed( | ||||
| if (params.output_is_required("UV Map")) { | "UV Map"); | ||||
| uv_map_id = StrongAnonymousAttributeID("uv_map"); | |||||
| } | |||||
| Mesh *mesh = create_uv_sphere_mesh(radius, segments_num, rings_num, uv_map_id.get()); | Mesh *mesh = create_uv_sphere_mesh(radius, segments_num, rings_num, uv_map_id.get()); | ||||
| params.set_output("Mesh", GeometrySet::create_with_mesh(mesh)); | params.set_output("Mesh", GeometrySet::create_with_mesh(mesh)); | ||||
| if (uv_map_id) { | if (uv_map_id) { | ||||
| params.set_output("UV Map", | params.set_output("UV Map", | ||||
| AnonymousAttributeFieldInput::Create<float3>( | AnonymousAttributeFieldInput::Create<float3>( | ||||
| std::move(uv_map_id), params.attribute_producer_name())); | std::move(uv_map_id), params.attribute_producer_name())); | ||||
| } | } | ||||
| Show All 15 Lines | |||||