Blender V4.3
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.add_input<decl::Geometry>("Instances").only_instances();
12 b.add_input<decl::Bool>("Selection").default_value(true).hide_value().field_on_all();
13 b.add_input<decl::Matrix>("Transform")
14 .field_on_all()
16 b.add_output<decl::Geometry>("Instances").propagate_all();
17}
18
20{
21 GeometrySet geometry_set = params.extract_input<GeometrySet>("Instances");
22 Field<bool> selection_field = params.extract_input<Field<bool>>("Selection");
23 Field<float4x4> transform_field = params.extract_input<Field<float4x4>>("Transform");
24
25 if (geometry_set.has_instances()) {
28 instances, "instance_transform", AttrDomain::Instance, selection_field, transform_field);
29 }
30
31 params.set_output("Instances", std::move(geometry_set));
32}
33
34static void node_register()
35{
36 static bke::bNodeType ntype;
37
39 &ntype, GEO_NODE_SET_INSTANCE_TRANSFORM, "Set Instance Transform", NODE_CLASS_GEOMETRY);
41 ntype.declare = node_declare;
42 bke::node_type_size(&ntype, 160, 100, 700);
43 node_register_type(&ntype);
44}
46
47} // namespace blender::nodes::node_geo_set_instance_transform_cc
#define NODE_CLASS_GEOMETRY
Definition BKE_node.hh:418
#define NOD_REGISTER_NODE(REGISTER_FUNC)
local_group_size(16, 16) .push_constant(Type b
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
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 node_type_size(bNodeType *ntype, int width, int minwidth, int maxwidth)
Definition node.cc:4602
void instance_transform(const bNode &, void *r_value)
void geo_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
GeometryComponent & get_component_for_write(GeometryComponent::Type component_type)
Defines a node type.
Definition BKE_node.hh:218
NodeGeometryExecFunction geometry_node_execute
Definition BKE_node.hh:339
NodeDeclareFunction declare
Definition BKE_node.hh:347