Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/node_geo_separate_geometry.cc
| Show All 15 Lines | |||||
| #include "UI_interface.h" | #include "UI_interface.h" | ||||
| #include "UI_resources.h" | #include "UI_resources.h" | ||||
| #include "node_geometry_util.hh" | #include "node_geometry_util.hh" | ||||
| namespace blender::nodes::node_geo_separate_geometry_cc { | namespace blender::nodes::node_geo_separate_geometry_cc { | ||||
| static void geo_node_separate_geometry_declare(NodeDeclarationBuilder &b) | static void node_declare(NodeDeclarationBuilder &b) | ||||
| { | { | ||||
| b.add_input<decl::Geometry>(N_("Geometry")); | b.add_input<decl::Geometry>(N_("Geometry")); | ||||
| b.add_input<decl::Bool>(N_("Selection")) | b.add_input<decl::Bool>(N_("Selection")) | ||||
| .default_value(true) | .default_value(true) | ||||
| .hide_value() | .hide_value() | ||||
| .supports_field() | .supports_field() | ||||
| .description(N_("The parts of the geometry that go into the first output")); | .description(N_("The parts of the geometry that go into the first output")); | ||||
| b.add_output<decl::Geometry>(N_("Selection")) | b.add_output<decl::Geometry>(N_("Selection")) | ||||
| .description(N_("The parts of the geometry in the selection")); | .description(N_("The parts of the geometry in the selection")); | ||||
| b.add_output<decl::Geometry>(N_("Inverted")) | b.add_output<decl::Geometry>(N_("Inverted")) | ||||
| .description(N_("The parts of the geometry not in the selection")); | .description(N_("The parts of the geometry not in the selection")); | ||||
| } | } | ||||
| static void geo_node_separate_geometry_layout(uiLayout *layout, | static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) | ||||
| bContext *UNUSED(C), | |||||
| PointerRNA *ptr) | |||||
| { | { | ||||
| uiItemR(layout, ptr, "domain", 0, "", ICON_NONE); | uiItemR(layout, ptr, "domain", 0, "", ICON_NONE); | ||||
| } | } | ||||
| static void geo_node_separate_geometry_init(bNodeTree *UNUSED(tree), bNode *node) | static void node_init(bNodeTree *UNUSED(tree), bNode *node) | ||||
| { | { | ||||
| NodeGeometrySeparateGeometry *data = (NodeGeometrySeparateGeometry *)MEM_callocN( | NodeGeometrySeparateGeometry *data = (NodeGeometrySeparateGeometry *)MEM_callocN( | ||||
| sizeof(NodeGeometrySeparateGeometry), __func__); | sizeof(NodeGeometrySeparateGeometry), __func__); | ||||
| data->domain = ATTR_DOMAIN_POINT; | data->domain = ATTR_DOMAIN_POINT; | ||||
| node->storage = data; | node->storage = data; | ||||
| } | } | ||||
| static void geo_node_separate_geometry_exec(GeoNodeExecParams params) | static void node_geo_exec(GeoNodeExecParams params) | ||||
| { | { | ||||
| GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry"); | GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry"); | ||||
| const Field<bool> selection_field = params.extract_input<Field<bool>>("Selection"); | const Field<bool> selection_field = params.extract_input<Field<bool>>("Selection"); | ||||
| const bNode &node = params.node(); | const bNode &node = params.node(); | ||||
| const NodeGeometryDeleteGeometry &storage = *(const NodeGeometryDeleteGeometry *)node.storage; | const NodeGeometryDeleteGeometry &storage = *(const NodeGeometryDeleteGeometry *)node.storage; | ||||
| const AttributeDomain domain = static_cast<AttributeDomain>(storage.domain); | const AttributeDomain domain = static_cast<AttributeDomain>(storage.domain); | ||||
| ▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | void register_node_type_geo_separate_geometry() | ||||
| geo_node_type_base( | geo_node_type_base( | ||||
| &ntype, GEO_NODE_SEPARATE_GEOMETRY, "Separate Geometry", NODE_CLASS_GEOMETRY, 0); | &ntype, GEO_NODE_SEPARATE_GEOMETRY, "Separate Geometry", NODE_CLASS_GEOMETRY, 0); | ||||
| node_type_storage(&ntype, | node_type_storage(&ntype, | ||||
| "NodeGeometrySeparateGeometry", | "NodeGeometrySeparateGeometry", | ||||
| node_free_standard_storage, | node_free_standard_storage, | ||||
| node_copy_standard_storage); | node_copy_standard_storage); | ||||
| node_type_init(&ntype, file_ns::geo_node_separate_geometry_init); | node_type_init(&ntype, file_ns::node_init); | ||||
| ntype.declare = file_ns::geo_node_separate_geometry_declare; | ntype.declare = file_ns::node_declare; | ||||
| ntype.geometry_node_execute = file_ns::geo_node_separate_geometry_exec; | ntype.geometry_node_execute = file_ns::node_geo_exec; | ||||
| ntype.draw_buttons = file_ns::geo_node_separate_geometry_layout; | ntype.draw_buttons = file_ns::node_layout; | ||||
| nodeRegisterType(&ntype); | nodeRegisterType(&ntype); | ||||
| } | } | ||||