Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/node_geo_set_material.cc
| Show All 19 Lines | |||||
| #include "UI_resources.h" | #include "UI_resources.h" | ||||
| #include "DNA_mesh_types.h" | #include "DNA_mesh_types.h" | ||||
| #include "DNA_meshdata_types.h" | #include "DNA_meshdata_types.h" | ||||
| #include "DNA_volume_types.h" | #include "DNA_volume_types.h" | ||||
| #include "BKE_material.h" | #include "BKE_material.h" | ||||
| namespace blender::nodes { | namespace blender::nodes::node_geo_set_material_cc { | ||||
| static void geo_node_set_material_declare(NodeDeclarationBuilder &b) | static void geo_node_set_material_declare(NodeDeclarationBuilder &b) | ||||
| { | { | ||||
| b.add_input<decl::Geometry>(N_("Geometry")) | b.add_input<decl::Geometry>(N_("Geometry")) | ||||
| .supported_type({GEO_COMPONENT_TYPE_MESH, GEO_COMPONENT_TYPE_VOLUME}); | .supported_type({GEO_COMPONENT_TYPE_MESH, GEO_COMPONENT_TYPE_VOLUME}); | ||||
| b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().supports_field(); | b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().supports_field(); | ||||
| b.add_input<decl::Material>(N_("Material")).hide_label(); | b.add_input<decl::Material>(N_("Material")).hide_label(); | ||||
| b.add_output<decl::Geometry>(N_("Geometry")); | b.add_output<decl::Geometry>(N_("Geometry")); | ||||
| ▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | if (volume_selection_warning) { | ||||
| params.error_message_add( | params.error_message_add( | ||||
| NodeWarningType::Info, | NodeWarningType::Info, | ||||
| TIP_("Volumes only support a single material; selection input can not be a field")); | TIP_("Volumes only support a single material; selection input can not be a field")); | ||||
| } | } | ||||
| params.set_output("Geometry", std::move(geometry_set)); | params.set_output("Geometry", std::move(geometry_set)); | ||||
| } | } | ||||
| } // namespace blender::nodes | } // namespace blender::nodes::node_geo_set_material_cc | ||||
| void register_node_type_geo_set_material() | void register_node_type_geo_set_material() | ||||
| { | { | ||||
| namespace file_ns = blender::nodes::node_geo_set_material_cc; | |||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| geo_node_type_base(&ntype, GEO_NODE_SET_MATERIAL, "Set Material", NODE_CLASS_GEOMETRY, 0); | geo_node_type_base(&ntype, GEO_NODE_SET_MATERIAL, "Set Material", NODE_CLASS_GEOMETRY, 0); | ||||
| ntype.declare = blender::nodes::geo_node_set_material_declare; | ntype.declare = file_ns::geo_node_set_material_declare; | ||||
| ntype.geometry_node_execute = blender::nodes::geo_node_set_material_exec; | ntype.geometry_node_execute = file_ns::geo_node_set_material_exec; | ||||
| nodeRegisterType(&ntype); | nodeRegisterType(&ntype); | ||||
| } | } | ||||