33 "Output each child of the collection as a separate instance, sorted alphabetically");
36 "Reset the transforms of every child instance in the output. Only used when Separate "
37 "Children is enabled");
40 "Instance of the collection or instances of all the children in the collection");
65 if (collection ==
nullptr) {
72 collection,
const_cast<Object *
>(self_object));
80 TIP_(
"Cannot access collections geometry because it's not evaluated "
81 "yet. This can happen when there is a dependency cycle"));
87 const bool use_relative_transform = (
storage.transform_space ==
90 std::unique_ptr<bke::Instances> instances = std::make_unique<bke::Instances>();
92 const bool separate_children = params.
extract_input<
bool>(
"Separate Children"_ustr);
93 if (separate_children) {
94 const bool reset_children = params.
extract_input<
bool>(
"Reset Children"_ustr);
97 children_collections.append(collection_child.
collection);
101 children_objects.
append(collection_object.
ob);
105 entries.
reserve(children_collections.size() + children_objects.
size());
107 for (
Collection *child_collection : children_collections) {
109 if (!reset_children) {
111 if (use_relative_transform) {
118 const int handle = instances->add_reference(*child_collection);
121 for (
Object *child_object : children_objects) {
122 const int handle = instances->add_reference(*child_object);
124 if (!reset_children) {
125 if (use_relative_transform) {
126 transform = self_object->world_to_object();
131 transform *= child_object->object_to_world();
140 instances->resize(entries.
size());
144 handles[i] = entries[i].handle;
145 transforms[i] = entries[i].transform;
150 if (use_relative_transform) {
155 instances->resize(1);
156 instances->reference_handles_for_write().first() = instances->add_reference(*collection);
157 instances->transforms_for_write().first() =
transform;
167 static const EnumPropertyItem rna_node_geometry_collection_info_transform_space_items[] = {
172 "Output the geometry relative to the collection offset"},
177 "Bring the input collection geometry into the modified object, maintaining the relative "
178 "position between the objects in the scene"},
179 {0,
nullptr, 0,
nullptr,
nullptr},
186 "The transformation of the instances output. Does not affect the internal geometry",
187 rna_node_geometry_collection_info_transform_space_items,
198 ntype.
ui_name =
"Collection Info";
199 ntype.
ui_description =
"Retrieve geometry instances from a collection";
#define NODE_STORAGE_FUNCS(StorageT)
#define GEO_NODE_COLLECTION_INFO
Object groups, one object can be in many groups at once.
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define NOD_storage_enum_accessors(member)
void append(const T &value)
IndexRange index_range() const
void reserve(const int64_t min_capacity)
void error_message_add(const NodeWarningType type, StringRef message) const
T extract_input(const UString identifier)
const bNode & node() const
void set_default_remaining_outputs()
void set_output(const UString identifier, T &&value)
const Object * self_object() const
#define storage(slot, qualifiers)
void node_register_type(bNodeType &ntype)
void node_type_storage(bNodeType &ntype, std::optional< StringRefNull > storagename, void(*freefunc)(bNode *node), void(*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node))
static void node_layout(ui::Layout &layout, bContext *, PointerRNA *ptr)
static void node_rna(StructRNA *srna)
static void node_declare(NodeDeclarationBuilder &b)
static void node_register()
static void node_node_init(bNodeTree *, bNode *node)
static void node_geo_exec(GeoNodeExecParams params)
PropertyRNA * RNA_def_node_enum(StructRNA *srna, const char *identifier, const char *ui_name, const char *ui_description, const EnumPropertyItem *static_items, const EnumRNAAccessors accessors, std::optional< int > default_value, const EnumPropertyItemFunc item_func, const bool allow_animation)
int char char int int int BLI_strcasecmp_natural(const char *s1, const char *s2) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
bool BKE_collection_has_object_recursive_instanced_orig_id(Collection *collection_eval, Object *object_eval)
MatBase< float, 4, 4 > float4x4
BMesh const char void * data
void rna_Node_update_relations(Main *bmain, Scene *scne, PointerRNA *ptr)
@ GEO_NODE_TRANSFORM_SPACE_ORIGINAL
@ GEO_NODE_TRANSFORM_SPACE_RELATIVE
bool DEG_collection_geometry_is_evaluated(const Collection &collection)
void RNA_def_property_update_runtime(PropertyRNA *prop, RNAPropertyUpdateFunc func)
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
void node_free_standard_storage(bNode *node)
VecBase< float, 3 > float3
void geo_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
struct Collection * collection
ListBaseT< CollectionChild > children
ListBaseT< CollectionObject > gobject
static MatBase identity()
void(*) draw_buttons(ui::Layout &, bContext *C, PointerRNA *ptr)
std::string ui_description
NodeGeometryExecFunction geometry_node_execute
void(*) initfunc(bNodeTree *ntree, bNode *node)
const char * enum_name_legacy
NodeDeclareFunction declare
static GeometrySet from_instances(std::unique_ptr< Instances > instances)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< StringRef > name_opt, int icon, std::optional< StringRef > placeholder=std::nullopt)