Blender V4.5
node_geo_set_instance_transform.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2024 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
6
8
10{
11 b.use_custom_socket_order();
12 b.allow_any_socket_order();
13 b.add_input<decl::Geometry>("Instances").only_instances();
14 b.add_output<decl::Geometry>("Instances").propagate_all().align_with_previous();
15 b.add_input<decl::Bool>("Selection").default_value(true).hide_value().field_on_all();
16 b.add_input<decl::Matrix>("Transform")
17 .field_on_all()
19}
20
22{
23 GeometrySet geometry_set = params.extract_input<GeometrySet>("Instances");
24 Field<bool> selection_field = params.extract_input<Field<bool>>("Selection");
25 Field<float4x4> transform_field = params.extract_input<Field<float4x4>>("Transform");
26
27 if (geometry_set.has_instances()) {
30 instances, "instance_transform", AttrDomain::Instance, selection_field, transform_field);
31 }
32
33 params.set_output("Instances", std::move(geometry_set));
34}
35
36static void node_register()
37{
38 static bke::bNodeType ntype;
39
40 geo_node_type_base(&ntype, "GeometryNodeSetInstanceTransform", GEO_NODE_SET_INSTANCE_TRANSFORM);
41 ntype.ui_name = "Set Instance Transform";
42 ntype.ui_description = "Set the transformation matrix of every instance";
43 ntype.enum_name_legacy = "SET_INSTANCE_TRANSFORM";
46 ntype.declare = node_declare;
47 bke::node_type_size(ntype, 160, 100, 700);
48 node_register_type(ntype);
49}
51
52} // namespace blender::nodes::node_geo_set_instance_transform_cc
#define NODE_CLASS_GEOMETRY
Definition BKE_node.hh:447
#define GEO_NODE_SET_INSTANCE_TRANSFORM
@ NODE_DEFAULT_INPUT_INSTANCE_TRANSFORM_FIELD
#define NOD_REGISTER_NODE(REGISTER_FUNC)
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
void node_type_size(bNodeType &ntype, int width, int minwidth, int maxwidth)
Definition node.cc:5573
bool try_capture_field_on_geometry(MutableAttributeAccessor attributes, const fn::FieldContext &field_context, const StringRef attribute_id, AttrDomain domain, const fn::Field< bool > &selection, const fn::GField &field)
void geo_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
GeometryComponent & get_component_for_write(GeometryComponent::Type component_type)
Defines a node type.
Definition BKE_node.hh:226
std::string ui_description
Definition BKE_node.hh:232
NodeGeometryExecFunction geometry_node_execute
Definition BKE_node.hh:347
const char * enum_name_legacy
Definition BKE_node.hh:235
NodeDeclareFunction declare
Definition BKE_node.hh:355