Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cone.cc
| Show First 20 Lines • Show All 742 Lines • ▼ Show 20 Lines | b.add_input<decl::Float>(N_("Radius Bottom")) | ||||
| .subtype(PROP_DISTANCE) | .subtype(PROP_DISTANCE) | ||||
| .description(N_("Radius of the bottom circle of the cone")); | .description(N_("Radius of the bottom circle of the cone")); | ||||
| 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_("Height of the generated cone")); | .description(N_("Height of the generated cone")); | ||||
| 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_all(); | ||||
| b.add_output<decl::Bool>(N_("Bottom")).field_source(); | b.add_output<decl::Bool>(N_("Bottom")).field_on_all(); | ||||
| b.add_output<decl::Bool>(N_("Side")).field_source(); | b.add_output<decl::Bool>(N_("Side")).field_on_all(); | ||||
| b.add_output<decl::Vector>(N_("UV Map")).field_source(); | b.add_output<decl::Vector>(N_("UV Map")).field_on_all(); | ||||
| } | } | ||||
| static void node_init(bNodeTree * /*tree*/, bNode *node) | static void node_init(bNodeTree * /*tree*/, bNode *node) | ||||
| { | { | ||||
| NodeGeometryMeshCone *node_storage = MEM_cnew<NodeGeometryMeshCone>(__func__); | NodeGeometryMeshCone *node_storage = MEM_cnew<NodeGeometryMeshCone>(__func__); | ||||
| node_storage->fill_type = GEO_NODE_MESH_CIRCLE_FILL_NGON; | node_storage->fill_type = GEO_NODE_MESH_CIRCLE_FILL_NGON; | ||||
| ▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | if (fill_segments < 1) { | ||||
| return; | return; | ||||
| } | } | ||||
| const float radius_top = params.extract_input<float>("Radius Top"); | const float radius_top = params.extract_input<float>("Radius Top"); | ||||
| const float radius_bottom = params.extract_input<float>("Radius Bottom"); | const float radius_bottom = params.extract_input<float>("Radius Bottom"); | ||||
| const float depth = params.extract_input<float>("Depth"); | const float depth = params.extract_input<float>("Depth"); | ||||
| 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"); | |||||
| } | |||||
| Mesh *mesh = create_cylinder_or_cone_mesh(radius_top, | Mesh *mesh = create_cylinder_or_cone_mesh(radius_top, | ||||
| radius_bottom, | radius_bottom, | ||||
| depth, | depth, | ||||
| circle_segments, | circle_segments, | ||||
| side_segments, | side_segments, | ||||
| fill_segments, | fill_segments, | ||||
| fill, | fill, | ||||
| ▲ Show 20 Lines • Show All 49 Lines • Show Last 20 Lines | |||||