Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/node_geo_set_geometry_name.cc
- This file was added.
| /* | |||||
| * This program is free software; you can redistribute it and/or | |||||
| * modify it under the terms of the GNU General Public License | |||||
| * as published by the Free Software Foundation; either version 2 | |||||
| * of the License, or (at your option) any later version. | |||||
| * | |||||
| * This program is distributed in the hope that it will be useful, | |||||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
| * GNU General Public License for more details. | |||||
| * | |||||
| * You should have received a copy of the GNU General Public License | |||||
| * along with this program; if not, write to the Free Software Foundation, | |||||
| * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||||
| */ | |||||
| #include "DEG_depsgraph_query.h" | |||||
| #include "node_geometry_util.hh" | |||||
| namespace blender::nodes { | |||||
| static void geo_node_set_geometry_name_declare(NodeDeclarationBuilder &b) | |||||
| { | |||||
| b.add_input<decl::Geometry>("Geometry"); | |||||
| b.add_input<decl::String>("Name"); | |||||
| b.add_output<decl::Geometry>("Geometry"); | |||||
| } | |||||
| static void geo_node_set_geometry_name_exec(GeoNodeExecParams params) | |||||
| { | |||||
| GeometrySet geometry = params.extract_input<GeometrySet>("Geometry"); | |||||
| std::string name = params.extract_input<std::string>("Name"); | |||||
| geometry.set_name(std::move(name)); | |||||
| params.set_output("Geometry", std::move(geometry)); | |||||
| } | |||||
| } // namespace blender::nodes | |||||
| void register_node_type_geo_set_geometry_name() | |||||
| { | |||||
| static bNodeType ntype; | |||||
| geo_node_type_base( | |||||
| &ntype, GEO_NODE_SET_GEOMETRY_NAME, "Set Geometry Name", NODE_CLASS_GEOMETRY, 0); | |||||
| ntype.geometry_node_execute = blender::nodes::geo_node_set_geometry_name_exec; | |||||
| ntype.declare = blender::nodes::geo_node_set_geometry_name_declare; | |||||
| nodeRegisterType(&ntype); | |||||
| } | |||||