Blender  V3.3
node_geo_realize_instances.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 
7 #include "UI_interface.h"
8 #include "UI_resources.h"
9 
11 
13 {
14  b.add_input<decl::Geometry>(N_("Geometry"));
15  b.add_output<decl::Geometry>(N_("Geometry"));
16 }
17 
18 static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
19 {
20  uiItemR(layout, ptr, "legacy_behavior", 0, nullptr, ICON_NONE);
21 }
22 
24 {
25  const bool legacy_behavior = params.node().custom1 & GEO_NODE_REALIZE_INSTANCES_LEGACY_BEHAVIOR;
26 
27  if (legacy_behavior) {
28  params.error_message_add(
30  TIP_("This node uses legacy behavior with regards to attributes on "
31  "instances. The behavior can be changed in the node properties in "
32  "the side bar. In most cases the new behavior is the same for files created in "
33  "Blender 3.0"));
34  }
35 
36  GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
38  options.keep_original_ids = legacy_behavior;
39  options.realize_instance_attributes = !legacy_behavior;
40  geometry_set = geometry::realize_instances(geometry_set, options);
41  params.set_output("Geometry", std::move(geometry_set));
42 }
43 
44 } // namespace blender::nodes::node_geo_realize_instances_cc
45 
47 {
49 
50  static bNodeType ntype;
51 
56  nodeRegisterType(&ntype);
57 }
#define NODE_CLASS_GEOMETRY
Definition: BKE_node.h:359
#define GEO_NODE_REALIZE_INSTANCES
Definition: BKE_node.h:1425
void nodeRegisterType(struct bNodeType *ntype)
Definition: node.cc:1357
#define UNUSED(x)
#define TIP_(msgid)
@ GEO_NODE_REALIZE_INSTANCES_LEGACY_BEHAVIOR
in reality light always falls off quadratically Particle Info
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
CCL_NAMESPACE_BEGIN struct Options options
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
GeometrySet realize_instances(GeometrySet geometry_set, const RealizeInstancesOptions &options)
static void node_geo_exec(GeoNodeExecParams params)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
static void node_declare(NodeDeclarationBuilder &b)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
void register_node_type_geo_realize_instances()
void geo_node_type_base(bNodeType *ntype, int type, const char *name, short nclass)
Defines a node type.
Definition: BKE_node.h:226
NodeGeometryExecFunction geometry_node_execute
Definition: BKE_node.h:316
void(* draw_buttons_ex)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr)
Definition: BKE_node.h:246
NodeDeclareFunction declare
Definition: BKE_node.h:324
#define N_(msgid)
PointerRNA * ptr
Definition: wm_files.c:3480