Blender  V3.3
node_geo_input_instance_scale.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #include "node_geometry_util.hh"
4 
6 
8 {
9  b.add_output<decl::Vector>(N_("Scale")).field_source();
10 }
11 
13  public:
15  {
16  }
17 
19  const eAttrDomain UNUSED(domain),
20  IndexMask UNUSED(mask)) const final
21  {
23  return {};
24  }
25 
26  const InstancesComponent &instance_component = static_cast<const InstancesComponent &>(
27  component);
28 
29  auto scale_fn = [&](const int i) -> float3 {
30  return instance_component.instance_transforms()[i].scale();
31  };
32 
33  return VArray<float3>::ForFunc(instance_component.instances_num(), scale_fn);
34  }
35 
36  uint64_t hash() const override
37  {
38  return 8346343;
39  }
40 
41  bool is_equal_to(const fn::FieldNode &other) const override
42  {
43  return dynamic_cast<const VectorFieldInput *>(&other) != nullptr;
44  }
45 };
46 
48 {
49  Field<float3> scale{std::make_shared<VectorFieldInput>()};
50  params.set_output("Scale", std::move(scale));
51 }
52 
53 } // namespace blender::nodes::node_geo_input_instance_scale_cc
54 
56 {
58 
59  static bNodeType ntype;
63  nodeRegisterType(&ntype);
64 }
eAttrDomain
Definition: BKE_attribute.h:25
@ GEO_COMPONENT_TYPE_INSTANCES
#define NODE_CLASS_INPUT
Definition: BKE_node.h:345
void nodeRegisterType(struct bNodeType *ntype)
Definition: node.cc:1357
#define GEO_NODE_INPUT_INSTANCE_SCALE
Definition: BKE_node.h:1501
#define final(a, b, c)
Definition: BLI_hash.h:21
#define UNUSED(x)
static uint8 component(Color32 c, uint i)
Definition: ColorBlock.cpp:108
blender::MutableSpan< blender::float4x4 > instance_transforms()
static VArray ForFunc(const int64_t size, GetFunc get_func)
GVArray get_varray_for_context(const GeometryComponent &component, const eAttrDomain UNUSED(domain), IndexMask UNUSED(mask)) const final
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
Definition: math_float4.h:513
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
void register_node_type_geo_input_instance_scale()
void geo_node_type_base(bNodeType *ntype, int type, const char *name, short nclass)
unsigned __int64 uint64_t
Definition: stdint.h:90
Defines a node type.
Definition: BKE_node.h:226
NodeGeometryExecFunction geometry_node_execute
Definition: BKE_node.h:316
NodeDeclareFunction declare
Definition: BKE_node.h:324
#define N_(msgid)