Differential D16858 Diff 58937 source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cylinder.cc
Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cylinder.cc
| Show All 37 Lines | b.add_input<decl::Float>(N_("Radius")) | ||||
| .subtype(PROP_DISTANCE) | .subtype(PROP_DISTANCE) | ||||
| .description(N_("The radius of the cylinder")); | .description(N_("The radius of the cylinder")); | ||||
| b.add_input<decl::Float>(N_("Depth")) | b.add_input<decl::Float>(N_("Depth")) | ||||
| .default_value(2.0f) | .default_value(2.0f) | ||||
| .min(0.0f) | .min(0.0f) | ||||
| .subtype(PROP_DISTANCE) | .subtype(PROP_DISTANCE) | ||||
| .description(N_("The height of the cylinder")); | .description(N_("The height of the cylinder")); | ||||
| b.add_output<decl::Geometry>(N_("Mesh")); | b.add_output<decl::Geometry>(N_("Mesh")); | ||||
| b.add_output<decl::Bool>(N_("Top")).field_source(); | b.add_output<decl::Bool>(N_("Top")).field_on_auto(); | ||||
| b.add_output<decl::Bool>(N_("Side")).field_source(); | b.add_output<decl::Bool>(N_("Side")).field_on_auto(); | ||||
| b.add_output<decl::Bool>(N_("Bottom")).field_source(); | b.add_output<decl::Bool>(N_("Bottom")).field_on_auto(); | ||||
| b.add_output<decl::Vector>(N_("UV Map")).field_source(); | b.add_output<decl::Vector>(N_("UV Map")).field_on_auto(); | ||||
| } | } | ||||
| static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr) | static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr) | ||||
| { | { | ||||
| uiLayoutSetPropSep(layout, true); | uiLayoutSetPropSep(layout, true); | ||||
| uiLayoutSetPropDecorate(layout, false); | uiLayoutSetPropDecorate(layout, false); | ||||
| uiItemR(layout, ptr, "fill_type", 0, nullptr, ICON_NONE); | uiItemR(layout, ptr, "fill_type", 0, nullptr, ICON_NONE); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | static void node_geo_exec(GeoNodeExecParams params) | ||||
| const int fill_segments = no_fill ? 1 : params.extract_input<int>("Fill Segments"); | const int fill_segments = no_fill ? 1 : params.extract_input<int>("Fill Segments"); | ||||
| if (fill_segments < 1) { | if (fill_segments < 1) { | ||||
| params.error_message_add(NodeWarningType::Info, TIP_("Fill Segments must be at least 1")); | params.error_message_add(NodeWarningType::Info, TIP_("Fill Segments must be at least 1")); | ||||
| params.set_default_remaining_outputs(); | params.set_default_remaining_outputs(); | ||||
| return; | return; | ||||
| } | } | ||||
| ConeAttributeOutputs attribute_outputs; | ConeAttributeOutputs attribute_outputs; | ||||
| if (params.output_is_required("Top")) { | attribute_outputs.top_id = params.get_output_anonymous_attribute_id_if_needed("Top"); | ||||
| attribute_outputs.top_id = StrongAnonymousAttributeID("top_selection"); | attribute_outputs.bottom_id = params.get_output_anonymous_attribute_id_if_needed("Bottom"); | ||||
| } | attribute_outputs.side_id = params.get_output_anonymous_attribute_id_if_needed("Side"); | ||||
| if (params.output_is_required("Bottom")) { | attribute_outputs.uv_map_id = params.get_output_anonymous_attribute_id_if_needed("UV Map"); | ||||
| attribute_outputs.bottom_id = StrongAnonymousAttributeID("bottom_selection"); | |||||
| } | |||||
| if (params.output_is_required("Side")) { | |||||
| attribute_outputs.side_id = StrongAnonymousAttributeID("side_selection"); | |||||
| } | |||||
| if (params.output_is_required("UV Map")) { | |||||
| attribute_outputs.uv_map_id = StrongAnonymousAttributeID("uv_map"); | |||||
| } | |||||
| /* The cylinder is a special case of the cone mesh where the top and bottom radius are equal. */ | /* The cylinder is a special case of the cone mesh where the top and bottom radius are equal. */ | ||||
| Mesh *mesh = create_cylinder_or_cone_mesh(radius, | Mesh *mesh = create_cylinder_or_cone_mesh(radius, | ||||
| radius, | radius, | ||||
| depth, | depth, | ||||
| circle_segments, | circle_segments, | ||||
| side_segments, | side_segments, | ||||
| fill_segments, | fill_segments, | ||||
| ▲ Show 20 Lines • Show All 46 Lines • Show Last 20 Lines | |||||