Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/node_geo_collection_info.cc
| Show All 22 Lines | static void node_declare(NodeDeclarationBuilder &b) | ||||
| b.add_input<decl::Collection>(N_("Collection")).hide_label(); | b.add_input<decl::Collection>(N_("Collection")).hide_label(); | ||||
| b.add_input<decl::Bool>(N_("Separate Children")) | b.add_input<decl::Bool>(N_("Separate Children")) | ||||
| .description( | .description( | ||||
| N_("Output each child of the collection as a separate instance, sorted alphabetically")); | N_("Output each child of the collection as a separate instance, sorted alphabetically")); | ||||
| b.add_input<decl::Bool>(N_("Reset Children")) | b.add_input<decl::Bool>(N_("Reset Children")) | ||||
| .description( | .description( | ||||
| N_("Reset the transforms of every child instance in the output. Only used when Separate " | N_("Reset the transforms of every child instance in the output. Only used when Separate " | ||||
| "Children is enabled")); | "Children is enabled")); | ||||
| b.add_output<decl::Geometry>(N_("Geometry")); | b.add_output<decl::Geometry>(N_("Instances")); | ||||
| } | } | ||||
| static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr) | static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr) | ||||
| { | { | ||||
| uiItemR(layout, ptr, "transform_space", UI_ITEM_R_EXPAND, nullptr, ICON_NONE); | uiItemR(layout, ptr, "transform_space", UI_ITEM_R_EXPAND, nullptr, ICON_NONE); | ||||
| } | } | ||||
| static void node_node_init(bNodeTree * /*tree*/, bNode *node) | static void node_node_init(bNodeTree * /*tree*/, bNode *node) | ||||
| ▲ Show 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | if (use_relative_transform) { | ||||
| copy_v3_v3(transform.values[3], collection->instance_offset); | copy_v3_v3(transform.values[3], collection->instance_offset); | ||||
| mul_m4_m4_pre(transform.values, self_object->world_to_object); | mul_m4_m4_pre(transform.values, self_object->world_to_object); | ||||
| } | } | ||||
| const int handle = instances->add_reference(*collection); | const int handle = instances->add_reference(*collection); | ||||
| instances->add_instance(handle, transform); | instances->add_instance(handle, transform); | ||||
| } | } | ||||
| params.set_output("Geometry", GeometrySet::create_with_instances(instances.release())); | params.set_output("Instances", GeometrySet::create_with_instances(instances.release())); | ||||
| } | } | ||||
| } // namespace blender::nodes::node_geo_collection_info_cc | } // namespace blender::nodes::node_geo_collection_info_cc | ||||
| void register_node_type_geo_collection_info() | void register_node_type_geo_collection_info() | ||||
| { | { | ||||
| namespace file_ns = blender::nodes::node_geo_collection_info_cc; | namespace file_ns = blender::nodes::node_geo_collection_info_cc; | ||||
| Show All 13 Lines | |||||