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) {
66 params.set_default_remaining_outputs();
72 collection,
const_cast<Object *
>(self_object));
75 params.set_default_remaining_outputs();
80 TIP_(
"Cannot access collections geometry because it's not evaluated "
81 "yet. This can happen when there is a dependency cycle"));
82 params.set_default_remaining_outputs();
90 std::unique_ptr<bke::Instances> instances = std::make_unique<bke::Instances>();
92 const bool separate_children =
params.extract_input<
bool>(
"Separate Children");
93 if (separate_children) {
94 const bool reset_children =
params.extract_input<
bool>(
"Reset Children");
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();
136 std::sort(entries.
begin(),
139 return BLI_strcasecmp_natural(a.name, b.name) < 0;
142 instances->add_instance(entry.handle, entry.transform);
147 if (use_relative_transform) {
152 const int handle = instances->add_reference(*collection);
153 instances->add_instance(handle,
transform);
163 static const EnumPropertyItem rna_node_geometry_collection_info_transform_space_items[] = {
168 "Output the geometry relative to the collection offset"},
173 "Bring the input collection geometry into the modified object, maintaining the relative "
174 "position between the objects in the scene"},
175 {0,
nullptr, 0,
nullptr,
nullptr},
182 "The transformation of the instances output. Does not affect the internal geometry",
183 rna_node_geometry_collection_info_transform_space_items,
194 ntype.
ui_name =
"Collection Info";
195 ntype.
ui_description =
"Retrieve geometry instances from a collection";
bool BKE_collection_has_object_recursive_instanced_orig_id(Collection *collection_eval, Object *object_eval)
#define NODE_STORAGE_FUNCS(StorageT)
#define GEO_NODE_COLLECTION_INFO
#define LISTBASE_FOREACH(type, var, list)
bool DEG_collection_geometry_is_evaluated(const Collection &collection)
Object groups, one object can be in many groups at once.
@ GEO_NODE_TRANSFORM_SPACE_RELATIVE
@ GEO_NODE_TRANSFORM_SPACE_ORIGINAL
#define NOD_REGISTER_NODE(REGISTER_FUNC)
void rna_Node_update_relations(Main *bmain, Scene *scne, PointerRNA *ptr)
#define NOD_storage_enum_accessors(member)
BMesh const char void * data
SIMD_FORCE_INLINE btVector3 transform(const btVector3 &point) const
void append(const T &value)
void reserve(const int64_t min_capacity)
void * MEM_callocN(size_t len, const char *str)
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_rna(StructRNA *srna)
static void node_declare(NodeDeclarationBuilder &b)
static void node_layout(uiLayout *layout, bContext *, PointerRNA *ptr)
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)
MatBase< float, 4, 4 > float4x4
VecBase< float, 3 > float3
void geo_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
void node_free_standard_storage(bNode *node)
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
void RNA_def_property_update_runtime(PropertyRNA *prop, RNAPropertyUpdateFunc func)
static MatBase identity()
std::string ui_description
void(* initfunc)(bNodeTree *ntree, bNode *node)
NodeGeometryExecFunction geometry_node_execute
const char * enum_name_legacy
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
NodeDeclareFunction declare
static GeometrySet from_instances(Instances *instances, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< blender::StringRef > name_opt, int icon, std::optional< blender::StringRef > placeholder=std::nullopt)