Blender V5.3
rna_collection.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include <cstdlib>
10
11#include "BKE_file_handler.hh"
12
14
15#include "BLI_path_utils.hh"
16#include "BLI_utildefines.hh"
17
18#include "RNA_define.hh"
19#include "RNA_enum_types.hh"
20
21#include "rna_internal.hh"
22
23#include "WM_types.hh"
24
25namespace blender {
26
28 {COLLECTION_COLOR_NONE, "NONE", ICON_X, "None", "Assign no color tag to the collection"},
29 {COLLECTION_COLOR_01, "COLOR_01", ICON_COLLECTION_COLOR_01, "Color 01", ""},
30 {COLLECTION_COLOR_02, "COLOR_02", ICON_COLLECTION_COLOR_02, "Color 02", ""},
31 {COLLECTION_COLOR_03, "COLOR_03", ICON_COLLECTION_COLOR_03, "Color 03", ""},
32 {COLLECTION_COLOR_04, "COLOR_04", ICON_COLLECTION_COLOR_04, "Color 04", ""},
33 {COLLECTION_COLOR_05, "COLOR_05", ICON_COLLECTION_COLOR_05, "Color 05", ""},
34 {COLLECTION_COLOR_06, "COLOR_06", ICON_COLLECTION_COLOR_06, "Color 06", ""},
35 {COLLECTION_COLOR_07, "COLOR_07", ICON_COLLECTION_COLOR_07, "Color 07", ""},
36 {COLLECTION_COLOR_08, "COLOR_08", ICON_COLLECTION_COLOR_08, "Color 08", ""},
37 {0, nullptr, 0, nullptr, nullptr},
38};
39/* Minus 1 for NONE & 1 for the nullptr sentinel. */
41 "Collection color total is an invalid size");
42
43} // namespace blender
44
45#ifdef RNA_RUNTIME
46
47# include <string>
48
49# include <fmt/format.h>
50
51# include "DNA_object_types.h"
52# include "DNA_scene_types.h"
53
54# include "DEG_depsgraph.hh"
55# include "DEG_depsgraph_build.hh"
56# include "DEG_depsgraph_query.hh"
57
58# include "BLI_listbase.hh"
59
60# include "BKE_collection.hh"
61# include "BKE_global.hh"
62# include "BKE_idprop.hh"
63# include "BKE_layer.hh"
64# include "BKE_lib_id.hh"
65# include "BKE_library.hh"
66# include "BKE_report.hh"
67
68# include "BLT_translation.hh"
69
70# include "WM_api.hh"
71
72# include "RNA_access.hh"
73
74namespace blender {
75
76static void rna_Collection_all_objects_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
77{
78 Collection *collection = static_cast<Collection *>(ptr->data);
79 ListBaseT<Base> collection_objects = BKE_collection_object_cache_get(collection);
80 rna_iterator_listbase_begin(iter, ptr, &collection_objects, nullptr);
81}
82
83static PointerRNA rna_Collection_all_objects_get(CollectionPropertyIterator *iter)
84{
85 ListBaseIterator *internal = &iter->internal.listbase;
86
87 /* we are actually iterating a ObjectBase list, so override get */
88 Base *base = reinterpret_cast<Base *>(internal->link);
89 return RNA_id_pointer_create(&base->object->id);
90}
91
92static void rna_Collection_objects_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
93{
94 Collection *collection = static_cast<Collection *>(ptr->data);
95 rna_iterator_listbase_begin(iter, ptr, &collection->gobject, nullptr);
96}
97
98static PointerRNA rna_Collection_objects_get(CollectionPropertyIterator *iter)
99{
100 ListBaseIterator *internal = &iter->internal.listbase;
101
102 /* we are actually iterating a ObjectBase list, so override get */
103 CollectionObject *cob = reinterpret_cast<CollectionObject *>(internal->link);
104 return RNA_id_pointer_create(&cob->ob->id);
105}
106
107static bool rna_collection_objects_edit_check(Collection *collection,
108 ReportList *reports,
109 Object *object)
110{
111 if (!DEG_is_original(collection)) {
113 reports, RPT_ERROR, "Collection '%s' is not an original ID", collection->id.name + 2);
114 return false;
115 }
116 if (!DEG_is_original(object)) {
117 BKE_reportf(reports, RPT_ERROR, "Collection '%s' is not an original ID", object->id.name + 2);
118 return false;
119 }
120
121 std::string reason;
122 if (!BKE_collection_is_content_editable(collection, &reason)) {
123 BKE_reportf(reports,
124 RPT_ERROR,
125 "Could not (un)link the object '%s'. %s",
126 object->id.name + 2,
127 reason.c_str());
128 return false;
129 }
130
131 return true;
132}
133
134static void rna_Collection_objects_link(Collection *collection,
135 Main *bmain,
136 ReportList *reports,
137 Object *object)
138{
139 if (!rna_collection_objects_edit_check(collection, reports, object)) {
140 return;
141 }
142 if (!BKE_collection_object_add(bmain, collection, object)) {
143 BKE_reportf(reports,
144 RPT_ERROR,
145 "Object '%s' already in collection '%s'",
146 object->id.name + 2,
147 collection->id.name + 2);
148 return;
149 }
150
154}
155
156static void rna_Collection_objects_unlink(Collection *collection,
157 Main *bmain,
158 ReportList *reports,
159 Object *object)
160{
161 if (!rna_collection_objects_edit_check(collection, reports, object)) {
162 return;
163 }
164 if (!BKE_collection_object_remove(bmain, collection, object, false)) {
165 BKE_reportf(reports,
166 RPT_ERROR,
167 "Object '%s' not in collection '%s'",
168 object->id.name + 2,
169 collection->id.name + 2);
170 return;
171 }
172
176}
177
178static bool rna_Collection_objects_override_apply(Main *bmain,
180{
181 PointerRNA *ptr_dst = &rnaapply_ctx.ptr_dst;
182 PropertyRNA *prop_dst = rnaapply_ctx.prop_dst;
183 PointerRNA *ptr_item_dst = &rnaapply_ctx.ptr_item_dst;
184 PointerRNA *ptr_item_src = &rnaapply_ctx.ptr_item_src;
185 IDOverrideLibraryPropertyOperation *opop = rnaapply_ctx.liboverride_operation;
186
187 BLI_assert_msg(opop->operation == LIBOVERRIDE_OP_REPLACE,
188 "Unsupported RNA override operation on collections' objects");
189 UNUSED_VARS_NDEBUG(opop);
190
191 Collection *coll_dst = id_cast<Collection *>(ptr_dst->owner_id);
192
193 if (!ptr_item_dst->has_type() || !ptr_item_src->has_type()) {
194 // BLI_assert_msg(0, "invalid source or destination object.");
195 return false;
196 }
197
198 Object *ob_dst = static_cast<Object *>(ptr_item_dst->data);
199 Object *ob_src = static_cast<Object *>(ptr_item_src->data);
200
201 if (ob_src == ob_dst) {
202 return true;
203 }
204
205 if (!BKE_collection_object_replace(bmain, coll_dst, ob_dst, ob_src)) {
206 BLI_assert_msg(0, "Could not find destination object in destination collection!");
207 return false;
208 }
209
210 RNA_property_update_main(bmain, nullptr, ptr_dst, prop_dst);
211 return true;
212}
213
214static void rna_Collection_children_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
215{
216 Collection *collection = static_cast<Collection *>(ptr->data);
217 rna_iterator_listbase_begin(iter, ptr, &collection->children, nullptr);
218}
219
220static PointerRNA rna_Collection_children_get(CollectionPropertyIterator *iter)
221{
222 ListBaseIterator *internal = &iter->internal.listbase;
223
224 /* we are actually iterating a CollectionChild list, so override get */
225 CollectionChild *child = reinterpret_cast<CollectionChild *>(internal->link);
226 return RNA_id_pointer_create(&child->collection->id);
227}
228
229static bool rna_collection_children_edit_check(Collection *collection,
230 ReportList *reports,
231 Collection *child)
232{
233 if (!DEG_is_original(collection)) {
235 reports, RPT_ERROR, "Collection '%s' is not an original ID", collection->id.name + 2);
236 return false;
237 }
238 if (!DEG_is_original(child)) {
239 BKE_reportf(reports, RPT_ERROR, "Collection '%s' is not an original ID", child->id.name + 2);
240 return false;
241 }
242
243 std::string reason;
244 if (!BKE_collection_is_content_editable(collection, &reason)) {
245 BKE_reportf(reports,
246 RPT_ERROR,
247 "Could not (un)link the collection '%s'. %s",
248 child->id.name + 2,
249 reason.c_str());
250 return false;
251 }
252 return true;
253}
254
255static void rna_Collection_children_link(Collection *collection,
256 Main *bmain,
257 ReportList *reports,
258 Collection *child)
259{
260 if (!rna_collection_children_edit_check(collection, reports, child)) {
261 return;
262 }
263 if (!BKE_collection_child_add(bmain, collection, child)) {
264 BKE_reportf(reports,
265 RPT_ERROR,
266 "Collection '%s' already in collection '%s'",
267 child->id.name + 2,
268 collection->id.name + 2);
269 return;
270 }
271
275}
276
277static void rna_Collection_children_unlink(Collection *collection,
278 Main *bmain,
279 ReportList *reports,
280 Collection *child)
281{
282 if (!rna_collection_children_edit_check(collection, reports, child)) {
283 return;
284 }
285 if (!BKE_collection_child_remove(bmain, collection, child)) {
286 BKE_reportf(reports,
287 RPT_ERROR,
288 "Collection '%s' not in collection '%s'",
289 child->id.name + 2,
290 collection->id.name + 2);
291 return;
292 }
293
297}
298
299static bool rna_Collection_children_override_apply(Main *bmain,
301{
302 PointerRNA *ptr_dst = &rnaapply_ctx.ptr_dst;
303 PropertyRNA *prop_dst = rnaapply_ctx.prop_dst;
304 PointerRNA *ptr_item_dst = &rnaapply_ctx.ptr_item_dst;
305 PointerRNA *ptr_item_src = &rnaapply_ctx.ptr_item_src;
306 IDOverrideLibraryPropertyOperation *opop = rnaapply_ctx.liboverride_operation;
307
308 BLI_assert_msg(opop->operation == LIBOVERRIDE_OP_REPLACE,
309 "Unsupported RNA override operation on collections' children");
310 UNUSED_VARS_NDEBUG(opop);
311
312 Collection *coll_dst = id_cast<Collection *>(ptr_dst->owner_id);
313
314 if (!ptr_item_dst->has_type() || !ptr_item_src->has_type()) {
315 /* This can happen when reference and overrides differ, just ignore then. */
316 return false;
317 }
318
319 Collection *subcoll_dst = static_cast<Collection *>(ptr_item_dst->data);
320 Collection *subcoll_src = static_cast<Collection *>(ptr_item_src->data);
321
322 CollectionChild *collchild_dst = static_cast<CollectionChild *>(
323 BLI_findptr(&coll_dst->children, subcoll_dst, offsetof(CollectionChild, collection)));
324
325 if (collchild_dst == nullptr) {
326 BLI_assert_msg(0, "Could not find destination sub-collection in destination collection!");
327 return false;
328 }
329
330 /* XXX TODO: We most certainly rather want to have a 'swap object pointer in collection'
331 * util in BKE_collection. This is only temp quick dirty test! */
332 id_us_min(&collchild_dst->collection->id);
333 collchild_dst->collection = subcoll_src;
334 id_us_plus(&collchild_dst->collection->id);
335
336 BKE_collection_object_cache_free(bmain, coll_dst, 0);
338
339 RNA_property_update_main(bmain, nullptr, ptr_dst, prop_dst);
340 return true;
341}
342
343static void rna_Collection_flag_set(PointerRNA *ptr, const bool value, const eCollection_Flag flag)
344{
345 Collection *collection = static_cast<Collection *>(ptr->data);
346
347 if (collection->flag & COLLECTION_IS_MASTER) {
348 return;
349 }
350
351 if (value) {
352 collection->flag |= flag;
353 }
354 else {
355 collection->flag &= ~flag;
356 }
357}
358
359static void rna_Collection_hide_select_set(PointerRNA *ptr, bool value)
360{
361 rna_Collection_flag_set(ptr, value, COLLECTION_HIDE_SELECT);
362}
363
364static void rna_Collection_hide_viewport_set(PointerRNA *ptr, bool value)
365{
366 rna_Collection_flag_set(ptr, value, COLLECTION_HIDE_VIEWPORT);
367}
368
369static void rna_Collection_hide_render_set(PointerRNA *ptr, bool value)
370{
371 rna_Collection_flag_set(ptr, value, COLLECTION_HIDE_RENDER);
372}
373
374static void rna_Collection_flag_update(Main *bmain, Scene *scene, PointerRNA *ptr)
375{
376 Collection *collection = static_cast<Collection *>(ptr->data);
377 BKE_collection_object_cache_free(bmain, collection, 0);
379
383}
384
385static int rna_Collection_color_tag_get(PointerRNA *ptr)
386{
387 Collection *collection = static_cast<Collection *>(ptr->data);
388
389 return collection->color_tag;
390}
391
392static void rna_Collection_color_tag_set(PointerRNA *ptr, int value)
393{
394 Collection *collection = static_cast<Collection *>(ptr->data);
395
396 if (collection->flag & COLLECTION_IS_MASTER) {
397 return;
398 }
399
400 collection->color_tag = CollectionColorTag(value);
401}
402
403static void rna_Collection_color_tag_update(Main * /*bmain*/, Scene *scene, PointerRNA * /*ptr*/)
404{
406}
407
408static void rna_Collection_instance_offset_update(Main * /*bmain*/,
409 Scene * /*scene*/,
410 PointerRNA *ptr)
411{
412 Collection *collection = static_cast<Collection *>(ptr->data);
413 DEG_id_tag_update(&collection->id, ID_RECALC_GEOMETRY);
414}
415
416static std::optional<std::string> rna_CollectionLightLinking_path(const PointerRNA *ptr)
417{
418 Collection *collection = id_cast<Collection *>(ptr->owner_id);
419 CollectionLightLinking *collection_light_linking = static_cast<CollectionLightLinking *>(
420 ptr->data);
421
422 int counter;
423
424 counter = 0;
425 for (CollectionObject &collection_object : collection->gobject) {
426 if (&collection_object.light_linking == collection_light_linking) {
427 return fmt::format("collection_objects[{}].light_linking", counter);
428 }
429 ++counter;
430 }
431
432 counter = 0;
433 for (CollectionChild &collection_child : collection->children) {
434 if (&collection_child.light_linking == collection_light_linking) {
435 return fmt::format("collection_children[{}].light_linking", counter);
436 }
437 ++counter;
438 }
439
440 return "..";
441}
442
443static void rna_CollectionLightLinking_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
444{
445 /* The light linking collection comes from the collection. It does not have shading component,
446 * but is collected to objects via hierarchy component. Tagging its hierarchy for update will
447 * lead the objects which use the collection to update its shading. */
449
450 /* Tag relations for update so that an updated state of light sets is calculated. */
452}
453
454static void rna_Collection_sort_index_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
455{
456 Collection *collection = id_cast<Collection *>(ptr->owner_id);
457 if (collection != nullptr) {
461 }
462}
463
464static PointerRNA rna_CollectionImport_archive_library_get(PointerRNA *ptr)
465{
466 const CollectionImport *data = reinterpret_cast<CollectionImport *>(ptr->data);
467 return RNA_pointer_create_discrete(ptr->owner_id, RNA_Library, data->runtime->archive_library);
468}
469
470static PointerRNA rna_CollectionImport_import_properties_get(PointerRNA *ptr)
471{
472 const CollectionImport *data = reinterpret_cast<CollectionImport *>(ptr->data);
473
474 /* If the File Handler or Operator is missing, we allow the data to be accessible
475 * as generic ID properties. */
476 blender::bke::FileHandlerType *fh = blender::bke::file_handler_find(data->fh_idname);
477 if (!fh) {
479 ptr->owner_id, RNA_IDPropertyWrapPtr, data->import_properties);
480 }
481
483 if (!ot) {
485 ptr->owner_id, RNA_IDPropertyWrapPtr, data->import_properties);
486 }
487
488 return RNA_pointer_create_discrete(ptr->owner_id, ot->srna, data->import_properties);
489}
490
491static void rna_CollectionExport_name_set(PointerRNA *ptr, const char *value)
492{
493 CollectionExport *data = reinterpret_cast<CollectionExport *>(ptr->data);
494 BKE_collection_exporter_name_set(nullptr, data, value);
495}
496
497static CollectionExport *rna_CollectionExport_new(Collection *collection,
498 ReportList *reports,
499 int type,
500 const char *name)
501{
502 bke::FileHandlerType *fh = nullptr;
504 if (types.index_range().contains(type)) {
505 fh = types[type].get();
506 }
507 if (fh) {
509 collection, fh->idname, name ? const_cast<char *>(name) : fh->label);
510
512 return exporter;
513 }
514 else {
515 BKE_reportf(reports, RPT_ERROR, "File handler not found");
516 return nullptr;
517 }
518}
519
520static void rna_CollectionExport_remove(Collection *collection, CollectionExport *exporter)
521{
522 BKE_collection_exporter_remove(collection, exporter);
524}
525
526static void rna_CollectionExport_move(Collection *collection,
527 ReportList *reports,
528 const int from,
529 const int to)
530{
531 if (!BKE_collection_exporter_move(collection, from, to)) {
532 BKE_reportf(reports,
533 RPT_ERROR,
534 "Could not move collection exporter from index '%d' to '%d'",
535 from,
536 to);
537 return;
538 }
539
541}
542
543static const EnumPropertyItem *rna_CollectionExport_type_itemf(bContext * /*C*/,
544 PointerRNA * /*ptr*/,
545 PropertyRNA * /*prop*/,
546 bool *r_free)
547{
548 EnumPropertyItem *item = nullptr, item_tmp = {0};
549 int totitem = 0;
551
552 for (const int i : types.index_range()) {
553 bke::FileHandlerType *fh = types[i].get();
554 if (WM_operatortype_find(fh->export_operator, true)) {
555 item_tmp.value = i;
556 item_tmp.identifier = fh->idname;
557 item_tmp.name = fh->label;
558
559 RNA_enum_item_add(&item, &totitem, &item_tmp);
560 }
561 }
562
563 if (totitem == 0) {
564 *r_free = false;
566 }
567
568 RNA_enum_item_end(&item, &totitem);
569 *r_free = true;
570
571 return item;
572}
573
574static PointerRNA rna_CollectionExport_export_properties_get(PointerRNA *ptr)
575{
576 const CollectionExport *data = reinterpret_cast<CollectionExport *>(ptr->data);
577
578 /* If the File Handler or Operator is missing, we allow the data to be accessible
579 * as generic ID properties. */
581 if (!fh) {
583 ptr->owner_id, RNA_IDPropertyWrapPtr, data->export_properties);
584 }
585
586 wmOperatorType *ot = WM_operatortype_find(fh->export_operator, false);
587 if (!ot) {
589 ptr->owner_id, RNA_IDPropertyWrapPtr, data->export_properties);
590 }
591
592 return RNA_pointer_create_discrete(ptr->owner_id, ot->srna, data->export_properties);
593}
594
595static const char *rna_CollectionImport_filepath_value_from_idprop(CollectionImport *data)
596{
597 if (IDProperty *group = data->import_properties) {
598 IDProperty *filepath_prop = IDP_GetPropertyFromGroup(group, "filepath");
599 if (filepath_prop && filepath_prop->type == IDP_STRING) {
600 return IDP_string_get(filepath_prop);
601 }
602 }
603 return nullptr;
604}
605
606static void rna_CollectionImport_filepath_get(PointerRNA *ptr, char *value)
607{
608 CollectionImport *data = reinterpret_cast<CollectionImport *>(ptr->data);
609 const char *value_src = rna_CollectionImport_filepath_value_from_idprop(data);
610 strcpy(value, value_src ? value_src : "");
611}
612static int rna_CollectionImport_filepath_length(PointerRNA *ptr)
613{
614 CollectionImport *data = reinterpret_cast<CollectionImport *>(ptr->data);
615 const char *value_src = rna_CollectionImport_filepath_value_from_idprop(data);
616 return value_src ? strlen(value_src) : 0;
617}
618static void rna_CollectionImport_filepath_set(PointerRNA *ptr, const char *value)
619{
620 CollectionImport *data = reinterpret_cast<CollectionImport *>(ptr->data);
621 if (!data->import_properties) {
622 IDPropertyTemplate val{};
623 data->import_properties = IDP_New(IDP_GROUP, &val, "import_properties");
624 }
625 IDProperty *group = data->import_properties;
626 /* By convention all exporters are expected to have a `filepath` property.
627 * See #WM_operator_properties_filesel. */
628 const char *prop_id = "filepath";
629 const size_t value_maxsize = FILE_MAX;
630 IDProperty *prop = IDP_GetPropertyFromGroup(group, prop_id);
631 if (prop && prop->type != IDP_STRING) {
632 IDP_FreeFromGroup(group, prop);
633 prop = nullptr;
634 }
635 if (prop == nullptr) {
636 prop = IDP_NewStringMaxSize(value, value_maxsize, prop_id);
637 IDP_AddToGroup(group, prop);
638 }
639 else {
640 IDP_AssignStringMaxSize(prop, value, value_maxsize);
641 }
642}
643static int rna_CollectionImport_filepath_is_editable(const PointerRNA *ptr, const char **r_info)
644{
645 CollectionImport *data = ptr->data_as<CollectionImport>();
646
647 if (data->runtime && data->runtime->archive_library) {
648 *r_info = N_("Path of imported external data cannot be edited");
649 return 0;
650 }
651 return int(PROP_EDITABLE);
652}
653
654static const char *rna_CollectionExport_filepath_value_from_idprop(CollectionExport *data)
655{
656 if (IDProperty *group = data->export_properties) {
657 IDProperty *filepath_prop = IDP_GetPropertyFromGroup(group, "filepath");
658 if (filepath_prop && filepath_prop->type == IDP_STRING) {
659 return IDP_string_get(filepath_prop);
660 }
661 }
662 return nullptr;
663}
664
665static void rna_CollectionExport_filepath_get(PointerRNA *ptr, char *value)
666{
667 CollectionExport *data = reinterpret_cast<CollectionExport *>(ptr->data);
668 const char *value_src = rna_CollectionExport_filepath_value_from_idprop(data);
669 strcpy(value, value_src ? value_src : "");
670}
671static int rna_CollectionExport_filepath_length(PointerRNA *ptr)
672{
673 CollectionExport *data = reinterpret_cast<CollectionExport *>(ptr->data);
674 const char *value_src = rna_CollectionExport_filepath_value_from_idprop(data);
675 return value_src ? strlen(value_src) : 0;
676}
677static void rna_CollectionExport_filepath_set(PointerRNA *ptr, const char *value)
678{
679 CollectionExport *data = reinterpret_cast<CollectionExport *>(ptr->data);
680 if (!data->export_properties) {
681 IDPropertyTemplate val{};
682 data->export_properties = IDP_New(IDP_GROUP, &val, "export_properties");
683 }
684 IDProperty *group = data->export_properties;
685 /* By convention all exporters are expected to have a `filepath` property.
686 * See #WM_operator_properties_filesel. */
687 const char *prop_id = "filepath";
688 const size_t value_maxsize = FILE_MAX;
689 IDProperty *prop = IDP_GetPropertyFromGroup(group, prop_id);
690 if (prop && prop->type != IDP_STRING) {
691 IDP_FreeFromGroup(group, prop);
692 prop = nullptr;
693 }
694 if (prop == nullptr) {
695 prop = IDP_NewStringMaxSize(value, value_maxsize, prop_id);
696 IDP_AddToGroup(group, prop);
697 }
698 else {
699 IDP_AssignStringMaxSize(prop, value, value_maxsize);
700 }
701}
702
703} // namespace blender
704
705#else
706
707namespace blender {
708
709/* collection.objects */
711{
712 StructRNA *srna;
713 FunctionRNA *func;
714 PropertyRNA *parm;
715
716 RNA_def_property_srna(cprop, "CollectionObjects");
717 srna = RNA_def_struct(brna, "CollectionObjects", nullptr);
718 RNA_def_struct_sdna(srna, "Collection");
719 RNA_def_struct_ui_text(srna, "Collection Objects", "Collection of collection objects");
720
721 /* add object */
722 func = RNA_def_function(srna, "link", "rna_Collection_objects_link");
724 RNA_def_function_ui_description(func, "Add this object to a collection");
725 parm = RNA_def_pointer(func, "object", "Object", "", "Object to add");
727
728 /* remove object */
729 func = RNA_def_function(srna, "unlink", "rna_Collection_objects_unlink");
730 RNA_def_function_ui_description(func, "Remove this object from a collection");
732 parm = RNA_def_pointer(func, "object", "Object", "", "Object to remove");
734}
735
736/* collection.children */
738{
739 StructRNA *srna;
740 FunctionRNA *func;
741 PropertyRNA *parm;
742
743 RNA_def_property_srna(cprop, "CollectionChildren");
744 srna = RNA_def_struct(brna, "CollectionChildren", nullptr);
745 RNA_def_struct_sdna(srna, "Collection");
746 RNA_def_struct_ui_text(srna, "Collection Children", "Collection of child collections");
747
748 /* add child */
749 func = RNA_def_function(srna, "link", "rna_Collection_children_link");
751 RNA_def_function_ui_description(func, "Add this collection as child of this collection");
752 parm = RNA_def_pointer(func, "child", "Collection", "", "Collection to add");
754
755 /* remove child */
756 func = RNA_def_function(srna, "unlink", "rna_Collection_children_unlink");
757 RNA_def_function_ui_description(func, "Remove this child collection from a collection");
759 parm = RNA_def_pointer(func, "child", "Collection", "", "Collection to remove");
761}
762
764{
765 StructRNA *srna;
766 FunctionRNA *func;
767 PropertyRNA *parm;
768
769 RNA_def_property_srna(cprop, "CollectionExports");
770 srna = RNA_def_struct(brna, "CollectionExports", nullptr);
771 RNA_def_struct_sdna(srna, "Collection");
772 RNA_def_struct_ui_text(srna, "Export Handlers", "Collection of export handlers");
773
774 func = RNA_def_function(srna, "new", "rna_CollectionExport_new");
775 RNA_def_function_ui_description(func, "Add an export handler to the collection");
777 parm = RNA_def_enum(
778 func, "type", rna_enum_dummy_DEFAULT_items, 0, "Type", "The type of export handler to add");
779 RNA_def_property_enum_funcs(parm, nullptr, nullptr, "rna_CollectionExport_type_itemf");
781 RNA_def_string(func, "name", nullptr, 0, "Name", "Name of the new export handler");
782 parm = RNA_def_pointer(func, "exporter", "CollectionExport", "", "Newly created export handler");
784 RNA_def_function_return(func, parm);
785
786 func = RNA_def_function(srna, "remove", "rna_CollectionExport_remove");
787 RNA_def_function_ui_description(func, "Remove an export handler from the collection");
788 parm = RNA_def_pointer(func, "exporter", "CollectionExport", "", "Export Handler to remove");
790
791 func = RNA_def_function(srna, "move", "rna_CollectionExport_move");
792 RNA_def_function_ui_description(func, "Move an export handler");
794 parm = RNA_def_int(
795 func, "from_index", -1, INT_MIN, INT_MAX, "From Index", "Index to move", 0, 10000);
797 parm = RNA_def_int(func, "to_index", -1, INT_MIN, INT_MAX, "To Index", "Target index", 0, 10000);
799}
800
802{
803 StructRNA *srna;
804 PropertyRNA *prop;
805
806 /* TODO(sergey): Use proper icons. */
807 static const EnumPropertyItem light_linking_state_items[] = {
808 {COLLECTION_LIGHT_LINKING_STATE_INCLUDE, "INCLUDE", ICON_OUTLINER_OB_LIGHT, "Include", ""},
809 {COLLECTION_LIGHT_LINKING_STATE_EXCLUDE, "EXCLUDE", ICON_LIGHT, "Exclude", ""},
810 {0, nullptr, 0, nullptr, nullptr},
811 };
812
814
815 srna = RNA_def_struct(brna, "CollectionLightLinking", nullptr);
816 RNA_def_struct_sdna(srna, "CollectionLightLinking");
818 srna,
819 "Collection Light Linking",
820 "Light linking settings of objects and children collections of a collection");
821 RNA_def_struct_path_func(srna, "rna_CollectionLightLinking_path");
822
823 /* Light state. */
824 prop = RNA_def_property(srna, "link_state", PROP_ENUM, PROP_NONE);
825 RNA_def_property_enum_items(prop, light_linking_state_items);
827 prop, "Link State", "Light or shadow receiving state of the object or collection");
829 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_CollectionLightLinking_update");
830
832}
833
835{
836 StructRNA *srna;
837 PropertyRNA *prop;
838
839 srna = RNA_def_struct(brna, "CollectionObject", nullptr);
840 RNA_def_struct_sdna(srna, "CollectionObject");
842 srna, "Collection Object", "Object of a collection with its collection related settings");
843
845
846 /* Sort Index. */
847 prop = RNA_def_property(srna, "sort_index", PROP_INT, PROP_NONE);
848 RNA_def_property_int_sdna(prop, nullptr, "sort_index");
850 prop, "Sort Index", "Custom sort index of the object in the collection");
851 RNA_def_property_update(prop, NC_SCENE | ND_LAYER, "rna_Collection_sort_index_update");
852
853 /* Sort Index Child. */
854 prop = RNA_def_property(srna, "parented_sort_index", PROP_INT, PROP_NONE);
855 RNA_def_property_int_sdna(prop, nullptr, "parented_sort_index");
857 prop,
858 "Sort Index Child",
859 "Custom sort index when the object is shown under a parent of another object");
860 RNA_def_property_update(prop, NC_SCENE | ND_LAYER, "rna_Collection_sort_index_update");
861
862 /* Light Linking. */
863 prop = RNA_def_property(srna, "light_linking", PROP_POINTER, PROP_NONE);
865 RNA_def_property_struct_type(prop, "CollectionLightLinking");
866 RNA_def_property_ui_text(prop, "Light Linking", "Light linking settings of the collection");
867
869}
870
872{
873 StructRNA *srna;
874 PropertyRNA *prop;
875
876 srna = RNA_def_struct(brna, "CollectionChild", nullptr);
877 RNA_def_struct_sdna(srna, "CollectionChild");
879 srna, "Collection Child", "Child collection with its collection related settings");
880
882
883 /* Sort Index. */
884 prop = RNA_def_property(srna, "sort_index", PROP_INT, PROP_NONE);
885 RNA_def_property_int_sdna(prop, nullptr, "sort_index");
887 prop, "Sort Index", "Custom sort index of the collection in the parent collection");
888 RNA_def_property_update(prop, NC_SCENE | ND_LAYER, "rna_Collection_sort_index_update");
889
890 /* Light Linking. */
891 prop = RNA_def_property(srna, "light_linking", PROP_POINTER, PROP_NONE);
893 RNA_def_property_struct_type(prop, "CollectionLightLinking");
895 prop, "Light Linking", "Light linking settings of the collection object");
896
898}
899
901{
902 StructRNA *srna;
903 PropertyRNA *prop;
904
905 srna = RNA_def_struct(brna, "CollectionImport", nullptr);
906 RNA_def_struct_sdna(srna, "CollectionImport");
907 RNA_def_struct_ui_text(srna, "Collection Import Data", "Importer configured for the collection");
908
909 prop = RNA_def_property(srna, "archive_library", PROP_POINTER, PROP_NONE);
910 RNA_def_property_pointer_sdna(prop, nullptr, "runtime->archive_library");
911 RNA_def_property_struct_type(prop, "Library");
913 prop, "rna_CollectionImport_archive_library_get", nullptr, nullptr, nullptr);
915 "Imported Library",
916 "Archive library owning all imported data from this collection "
917 "importer (None if no data has been imported yet)");
919
920 prop = RNA_def_property(srna, "is_open", PROP_BOOLEAN, PROP_NONE);
922 RNA_def_property_ui_text(prop, "Is Open", "Whether the panel is expanded or closed");
925
926 prop = RNA_def_property(srna, "import_properties", PROP_POINTER, PROP_NONE);
927 RNA_def_property_struct_type(prop, "PropertyGroup");
929 prop, "Import Properties", "Properties associated with the configured importer");
931 prop, "rna_CollectionImport_import_properties_get", nullptr, nullptr, nullptr);
932
933 /* Wrap the operator property for same reason as the CollectionExport filepath property below. */
934 prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
937 "rna_CollectionImport_filepath_get",
938 "rna_CollectionImport_filepath_length",
939 "rna_CollectionImport_filepath_set");
941 RNA_def_property_ui_text(prop, "File Path", "The file path used for importing");
943 RNA_def_property_editable_func(prop, "rna_CollectionImport_filepath_is_editable");
945}
946
948{
949 StructRNA *srna;
950 PropertyRNA *prop;
951
952 srna = RNA_def_struct(brna, "CollectionExport", nullptr);
953 RNA_def_struct_sdna(srna, "CollectionExport");
954 RNA_def_struct_ui_text(srna, "Collection Export Data", "Exporter configured for the collection");
955
956 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
957 RNA_def_struct_ui_text(srna, "Name", "");
959 RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_CollectionExport_name_set");
960
961 prop = RNA_def_property(srna, "is_open", PROP_BOOLEAN, PROP_NONE);
963 RNA_def_property_ui_text(prop, "Is Open", "Whether the panel is expanded or closed");
966
967 prop = RNA_def_property(srna, "export_properties", PROP_POINTER, PROP_NONE);
968 RNA_def_property_struct_type(prop, "PropertyGroup");
970 prop, "Export Properties", "Properties associated with the configured exporter");
972 prop, "rna_CollectionExport_export_properties_get", nullptr, nullptr, nullptr);
973
974 /* Wrap the operator property because exposing the operator property directly
975 * causes problems, as the operator property typically wont support
976 * #PROP_PATH_SUPPORTS_BLEND_RELATIVE, when the collection property does since
977 * it's expanded before passing it to the operator, see #137856 & #137507. */
978 prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
981 "rna_CollectionExport_filepath_get",
982 "rna_CollectionExport_filepath_length",
983 "rna_CollectionExport_filepath_set");
985 RNA_def_property_ui_text(prop, "File Path", "The file path used for exporting");
988}
989
991{
992 StructRNA *srna;
993 PropertyRNA *prop;
994
995 srna = RNA_def_struct(brna, "Collection", "ID");
996 RNA_def_struct_ui_text(srna, "Collection", "Collection of Object data-blocks");
997 RNA_def_struct_ui_icon(srna, ICON_GROUP);
998 /* This is done on save/load in `readfile.cc`,
999 * removed if no objects are in the collection and not in a scene. */
1001
1003
1004 prop = RNA_def_property(srna, "instance_offset", PROP_FLOAT, PROP_TRANSLATION);
1006 prop, "Instance Offset", "Offset from the origin to use when instancing");
1007 RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, RNA_TRANSLATION_PREC_DEFAULT);
1008 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Collection_instance_offset_update");
1009
1010 prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE);
1011 RNA_def_property_struct_type(prop, "Object");
1012 RNA_def_property_override_funcs(prop, nullptr, nullptr, "rna_Collection_objects_override_apply");
1013 RNA_def_property_ui_text(prop, "Objects", "Objects that are directly in this collection");
1015 "rna_Collection_objects_begin",
1016 "rna_iterator_listbase_next",
1017 "rna_iterator_listbase_end",
1018 "rna_Collection_objects_get",
1019 nullptr,
1020 nullptr,
1021 nullptr,
1022 nullptr);
1023 rna_def_collection_objects(brna, prop);
1024
1025 prop = RNA_def_property(srna, "all_objects", PROP_COLLECTION, PROP_NONE);
1026 RNA_def_property_struct_type(prop, "Object");
1028 prop, "All Objects", "Objects that are in this collection and its child collections");
1032 "rna_Collection_all_objects_begin",
1033 "rna_iterator_listbase_next",
1034 "rna_iterator_listbase_end",
1035 "rna_Collection_all_objects_get",
1036 nullptr,
1037 nullptr,
1038 nullptr,
1039 nullptr);
1040
1041 prop = RNA_def_property(srna, "children", PROP_COLLECTION, PROP_NONE);
1042 RNA_def_property_struct_type(prop, "Collection");
1044 prop, nullptr, nullptr, "rna_Collection_children_override_apply");
1046 prop, "Children", "Collections that are immediate children of this collection");
1048 "rna_Collection_children_begin",
1049 "rna_iterator_listbase_next",
1050 "rna_iterator_listbase_end",
1051 "rna_Collection_children_get",
1052 nullptr,
1053 nullptr,
1054 nullptr,
1055 nullptr);
1056 rna_def_collection_children(brna, prop);
1057
1058 /* Collection objects. */
1059 prop = RNA_def_property(srna, "collection_objects", PROP_COLLECTION, PROP_NONE);
1060 RNA_def_property_struct_type(prop, "CollectionObject");
1061 RNA_def_property_collection_sdna(prop, nullptr, "gobject", nullptr);
1063 prop,
1064 "Collection Objects",
1065 "Objects of the collection with their parent-collection-specific settings");
1066 /* TODO(sergey): Functions to link and unlink objects. */
1067
1068 /* Children collections. */
1069 prop = RNA_def_property(srna, "collection_children", PROP_COLLECTION, PROP_NONE);
1070 RNA_def_property_struct_type(prop, "CollectionChild");
1071 RNA_def_property_collection_sdna(prop, nullptr, "children", nullptr);
1073 "Collection Children",
1074 "Children collections with their parent-collection-specific settings");
1075
1076 /* Importer Handler. */
1077 prop = RNA_def_property(srna, "importer", PROP_POINTER, PROP_NONE);
1078 RNA_def_property_struct_type(prop, "CollectionImport");
1080 prop, "Collection Import Handler", "Import Handler configured for the collection");
1081
1082 /* Export Handlers. */
1083 prop = RNA_def_property(srna, "exporters", PROP_COLLECTION, PROP_NONE);
1084 RNA_def_property_struct_type(prop, "CollectionExport");
1085 RNA_def_property_collection_sdna(prop, nullptr, "exporters", nullptr);
1087 prop, "Collection Export Handlers", "Export Handlers configured for the collection");
1088 rna_def_collection_exporters(brna, prop);
1089
1090 prop = RNA_def_property(srna, "active_exporter_index", PROP_INT, PROP_UNSIGNED);
1093 prop, "Active Collection Exporter Index", "Active index in the exporters list");
1094
1095 /* TODO(sergey): Functions to link and unlink collections. */
1096
1097 /* Flags */
1098 prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
1100 RNA_def_property_boolean_funcs(prop, nullptr, "rna_Collection_hide_select_set");
1102 RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, -1);
1103 RNA_def_property_ui_text(prop, "Disable Selection", "Disable selection in viewport");
1104 RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_Collection_flag_update");
1105
1106 prop = RNA_def_property(srna, "hide_viewport", PROP_BOOLEAN, PROP_NONE);
1108 RNA_def_property_boolean_funcs(prop, nullptr, "rna_Collection_hide_viewport_set");
1110 RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, -1);
1111 RNA_def_property_ui_text(prop, "Disable in Viewports", "Globally disable in viewports");
1112 RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_Collection_flag_update");
1113
1114 prop = RNA_def_property(srna, "hide_render", PROP_BOOLEAN, PROP_NONE);
1116 RNA_def_property_boolean_funcs(prop, nullptr, "rna_Collection_hide_render_set");
1118 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, -1);
1119 RNA_def_property_ui_text(prop, "Disable in Renders", "Globally disable in renders");
1120 RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_Collection_flag_update");
1121
1122 static const EnumPropertyItem rna_collection_lineart_usage[] = {
1124 "INCLUDE",
1125 0,
1126 "Include",
1127 "Generate feature lines for this collection"},
1129 "OCCLUSION_ONLY",
1130 0,
1131 "Occlusion Only",
1132 "Only use the collection to produce occlusion"},
1133 {COLLECTION_LRT_EXCLUDE, "EXCLUDE", 0, "Exclude", "Don't use this collection in Line Art"},
1135 "INTERSECTION_ONLY",
1136 0,
1137 "Intersection Only",
1138 "Only generate intersection lines for this collection"},
1140 "NO_INTERSECTION",
1141 0,
1142 "No Intersection",
1143 "Include this collection but do not generate intersection lines"},
1145 "FORCE_INTERSECTION",
1146 0,
1147 "Force Intersection",
1148 "Generate intersection lines even with objects that disabled intersection"},
1149 {0, nullptr, 0, nullptr, nullptr}};
1150
1151 prop = RNA_def_property(srna, "lineart_usage", PROP_ENUM, PROP_NONE);
1152 RNA_def_property_enum_items(prop, rna_collection_lineart_usage);
1153 RNA_def_property_ui_text(prop, "Usage", "How to use this collection in Line Art calculation");
1154 RNA_def_property_update(prop, NC_SCENE, nullptr);
1155
1156 prop = RNA_def_property(srna, "lineart_use_intersection_mask", PROP_BOOLEAN, PROP_NONE);
1157 RNA_def_property_boolean_sdna(prop, nullptr, "lineart_flags", 1);
1159 prop, "Use Intersection Masks", "Use custom intersection mask for faces in this collection");
1160 RNA_def_property_update(prop, NC_SCENE, nullptr);
1161
1162 prop = RNA_def_property(srna, "lineart_intersection_mask", PROP_BOOLEAN, PROP_NONE);
1164 prop, nullptr, "lineart_intersection_mask", 1 << 0, 8);
1166 prop, "Masks", "Intersection generated by this collection will have this mask value");
1167 RNA_def_property_update(prop, NC_SCENE, nullptr);
1168
1169 prop = RNA_def_property(srna, "lineart_intersection_priority", PROP_INT, PROP_NONE);
1171 "Intersection Priority",
1172 "The intersection line will be included into the object with the "
1173 "higher intersection priority value");
1174 RNA_def_property_update(prop, NC_SCENE, nullptr);
1175
1176 prop = RNA_def_property(srna, "use_lineart_intersection_priority", PROP_BOOLEAN, PROP_NONE);
1179 prop, nullptr, "lineart_flags", COLLECTION_LRT_USE_INTERSECTION_PRIORITY);
1181 prop, "Use Intersection Priority", "Assign intersection priority value for this collection");
1182 RNA_def_property_update(prop, NC_SCENE, nullptr);
1183
1184 prop = RNA_def_property(srna, "color_tag", PROP_ENUM, PROP_NONE);
1185 RNA_def_property_enum_sdna(prop, nullptr, "color_tag");
1187 prop, "rna_Collection_color_tag_get", "rna_Collection_color_tag_set", nullptr);
1189 RNA_def_property_ui_text(prop, "Collection Color", "Color tag for a collection");
1190 RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_Collection_color_tag_update");
1191
1193
1199}
1200
1201} // namespace blender
1202
1203#endif
#define IDP_string_get(prop)
#define FILE_MAX
Object groups, one object can be in many groups at once.
Object is a sort of wrapper for general info.
#define RNA_TRANSLATION_PREC_DEFAULT
Definition RNA_types.hh:272
#define ND_DRAW
Definition WM_types.hh:502
#define ND_OB_SELECT
Definition WM_types.hh:461
#define ND_SPACE_PROPERTIES
Definition WM_types.hh:572
#define NC_SCENE
Definition WM_types.hh:391
#define ND_LAYER_CONTENT
Definition WM_types.hh:472
#define ND_LAYER
Definition WM_types.hh:469
#define NC_OBJECT
Definition WM_types.hh:392
#define NC_SPACE
Definition WM_types.hh:405
#define UNUSED_VARS_NDEBUG(...)
#define BLI_assert_msg(a, msg)
constexpr IndexRange index_range() const
Definition BLI_span.hh:405
constexpr bool contains(int64_t value) const
#define offsetof(t, d)
#define INT_MAX
FileHandlerType * file_handler_find(StringRef idname)
Span< std::unique_ptr< FileHandlerType > > file_handlers()
BMesh Iterators.
void WM_main_add_notifier(uint type, void *reference)
void * BLI_findptr(const ListBase *listbase, const void *ptr, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:710
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
void IDP_FreeFromGroup(IDProperty *group, IDProperty *prop) ATTR_NONNULL()
Definition idprop.cc:812
void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable)
void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
@ COLLECTION_LRT_NO_INTERSECTION
@ COLLECTION_LRT_OCCLUSION_ONLY
@ COLLECTION_LRT_INTERSECTION_ONLY
@ COLLECTION_LRT_FORCE_INTERSECTION
BLI_STATIC_ASSERT(ARRAY_SIZE(data_mode_strings)==CTX_MODE_NUM+1, "Must have a string for each context mode") const char *CTX_data_mode_string(const bContext *C)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
void RNA_def_property_boolean_bitset_array_sdna(PropertyRNA *prop, const char *structname, const char *propname, const int64_t booleanbit, const int length)
const EnumPropertyItem rna_enum_collection_color_items[]
@ STRUCT_ID_REFCOUNT
void RNA_def_property_override_funcs(PropertyRNA *prop, const char *diff, const char *store, const char *apply)
void RNA_def_collections(BlenderRNA *brna)
void RNA_property_update_main(Main *bmain, Scene *scene, PointerRNA *ptr, PropertyRNA *prop)
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
void id_us_plus(ID *id)
Definition lib_id.cc:433
void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
PointerRNA RNA_id_pointer_create(ID *id)
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
bool BKE_collection_child_add(Main *bmain, Collection *parent, Collection *child)
bool IDP_AddToGroup(IDProperty *group, IDProperty *prop) ATTR_NONNULL()
Definition idprop.cc:788
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
IDProperty * IDP_GetPropertyFromGroup(const IDProperty *prop, StringRef name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition idprop.cc:818
@ COLLECTION_LRT_USE_INTERSECTION_PRIORITY
@ FUNC_USE_REPORTS
@ FUNC_USE_MAIN
void RNA_define_lib_overridable(const bool make_overridable)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
@ LIBOVERRIDE_OP_REPLACE
Definition DNA_ID.h:188
static void rna_def_collection_child(BlenderRNA *brna)
void BKE_collection_object_cache_free(const Main *bmain, Collection *collection, const int id_create_flag)
void RNA_def_property_string_maxlength(PropertyRNA *prop, int maxlength)
static void rna_def_collection_light_linking(BlenderRNA *brna)
bool BKE_collection_exporter_move(Collection *collection, const int from, const int to)
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition RNA_types.hh:588
@ PROPOVERRIDE_NO_COMPARISON
Definition RNA_types.hh:596
bool DEG_is_original(const T *id)
@ COLLECTION_LIGHT_LINKING_STATE_INCLUDE
@ COLLECTION_LIGHT_LINKING_STATE_EXCLUDE
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier_c_str, int type, int subtype)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
@ PROP_BOOLEAN
Definition RNA_types.hh:210
@ PROP_POINTER
Definition RNA_types.hh:215
@ PROP_STRING
Definition RNA_types.hh:213
@ PROP_COLLECTION
Definition RNA_types.hh:216
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, const char *next, const char *end, const char *get, const char *length, const char *lookupint, const char *lookupstring, const char *assignint)
void DEG_id_tag_update(ID *id, unsigned int flags)
BMesh const char void * data
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
CollectionExport * BKE_collection_exporter_add(Collection *collection, char *idname, char *label)
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
constexpr size_t ARRAY_SIZE(const T(&arg)[N]) noexcept
bool BKE_collection_child_remove(Main *bmain, Collection *parent, Collection *child)
bool BKE_collection_object_add(Main *bmain, Collection *collection, Object *ob)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
void RNA_def_struct_clear_flag(StructRNA *srna, StructFlag flag)
void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
const EnumPropertyItem rna_enum_dummy_DEFAULT_items[]
Definition rna_rna.cc:34
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier_c_str, const char *call)
const EnumPropertyItem rna_enum_dummy_NULL_items[]
Definition rna_rna.cc:28
ListBaseT< Base > BKE_collection_object_cache_get(Collection *collection)
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_boolean_default(PropertyRNA *prop, bool value)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
static void rna_def_collection_exporters(BlenderRNA *brna, PropertyRNA *cprop)
static void rna_def_collection_importer_data(BlenderRNA *brna)
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)
void RNA_def_function_flag(FunctionRNA *func, FunctionFlag flag)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
bool BKE_collection_is_content_editable(const Collection *collection, std::string *reason=nullptr)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
Definition report.cc:191
bool BKE_collection_object_remove(Main *bmain, Collection *collection, Object *ob, bool free_us)
void RNA_def_property_override_clear_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
void BKE_collection_exporter_remove(Collection *collection, CollectionExport *data)
bool BKE_collection_object_replace(Main *bmain, Collection *collection, Object *ob_old, Object *ob_new)
void BKE_collection_exporter_name_set(const ListBaseT< CollectionExport > *exporters, CollectionExport *data, const char *newname)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
@ ID_RECALC_HIERARCHY
Definition DNA_ID.h:1158
@ ID_RECALC_SYNC_TO_EVAL
Definition DNA_ID.h:1118
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:1074
@ PROP_EDITABLE
Definition RNA_types.hh:376
@ PROP_ENUM_NO_CONTEXT
Definition RNA_types.hh:500
@ PROP_PATH_SUPPORTS_BLEND_RELATIVE
Definition RNA_types.hh:526
@ PROP_NEVER_NULL
Definition RNA_types.hh:447
@ PROP_ANIMATABLE
Definition RNA_types.hh:389
@ PROP_NO_DEG_UPDATE
Definition RNA_types.hh:509
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
IDProperty * IDP_New(char type, const IDPropertyTemplate *val, StringRef name, eIDPropertyFlag flags={}) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition idprop.cc:1132
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
void DEG_relations_tag_update(Main *bmain)
IDProperty * IDP_NewStringMaxSize(const char *st, size_t st_maxncpy, StringRef name, eIDPropertyFlag flags={}) ATTR_WARN_UNUSED_RESULT
Definition idprop.cc:400
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
static void rna_def_collection_object(BlenderRNA *brna)
@ PROP_TRANSLATION
Definition RNA_types.hh:318
@ PROP_FILEPATH
Definition RNA_types.hh:284
@ PROP_UNSIGNED
Definition RNA_types.hh:306
@ PARM_REQUIRED
Definition RNA_types.hh:631
void rna_iterator_listbase_begin(CollectionPropertyIterator *iter, PointerRNA *ptr, ListBase *lb, IteratorSkipFunc skip)
bool BKE_main_collection_sync(const Main *bmain)
void RNA_def_struct_name_property(StructRNA *srna, PropertyRNA *prop, const bool allow_replace)
static void rna_def_collection_objects(BlenderRNA *brna, PropertyRNA *cprop)
void id_us_min(ID *id)
Definition lib_id.cc:441
void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, int consecutive)
static void rna_def_collection_children(BlenderRNA *brna, PropertyRNA *cprop)
void IDP_AssignStringMaxSize(IDProperty *prop, const char *st, size_t st_maxncpy) ATTR_NONNULL()
Definition idprop.cc:470
static void rna_def_collection_exporter_data(BlenderRNA *brna)
CollectionColorTag color_tag
char import_operator[OP_MAX_TYPENAME]
#define N_(msgid)