12 b.add_input<
decl::Bool>(
N_(
"Selection")).default_value(
true).hide_value().supports_field();
15 .default_value({1, 1, 1})
18 b.add_input<
decl::Bool>(
N_(
"Local Space")).default_value(
true).supports_field();
33 const IndexMask selection = evaluator.get_evaluated_selection_as_mask();
36 const VArray<bool> local_spaces = evaluator.get_evaluated<
bool>(2);
41 for (const int i_selection : range) {
42 const int i = selection[i_selection];
43 const float3 pivot = pivots[i];
44 float4x4 &instance_transform = instance_transforms[i];
46 if (local_spaces[i]) {
47 instance_transform *= float4x4::from_location(pivot);
48 rescale_m4(instance_transform.values, scales[i]);
49 instance_transform *= float4x4::from_location(-pivot);
52 const float4x4 original_transform = instance_transform;
53 instance_transform = float4x4::from_location(pivot);
54 rescale_m4(instance_transform.values, scales[i]);
55 instance_transform *= float4x4::from_location(-pivot);
56 instance_transform *= original_transform;
69 params.set_output(
"Instances", std::move(geometry_set));
#define NODE_CLASS_GEOMETRY
#define GEO_NODE_SCALE_INSTANCES
void nodeRegisterType(struct bNodeType *ntype)
blender::MutableSpan< blender::float4x4 > instance_transforms()
int instances_num() const
IndexRange index_range() const
static void scale_instances(GeoNodeExecParams ¶ms, InstancesComponent &instances_component)
static void node_geo_exec(GeoNodeExecParams params)
static void node_declare(NodeDeclarationBuilder &b)
void parallel_for(IndexRange range, int64_t grain_size, const Function &function)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
void register_node_type_geo_scale_instances()
void geo_node_type_base(bNodeType *ntype, int type, const char *name, short nclass)
GeometryComponent & get_component_for_write(GeometryComponentType component_type)
bool has_instances() const
NodeGeometryExecFunction geometry_node_execute
NodeDeclareFunction declare