37 {0,
nullptr, 0,
nullptr,
nullptr},
41 "Collection color total is an invalid size");
49# include <fmt/format.h>
76static void rna_Collection_all_objects_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
78 Collection *collection =
static_cast<Collection *
>(ptr->data);
107static bool rna_collection_objects_edit_check(
Collection *collection,
113 reports,
RPT_ERROR,
"Collection '%s' is not an original ID", collection->id.name + 2);
125 "Could not (un)link the object '%s'. %s",
134static void rna_Collection_objects_link(
Collection *collection,
139 if (!rna_collection_objects_edit_check(collection, reports,
object)) {
145 "Object '%s' already in collection '%s'",
147 collection->id.name + 2);
156static void rna_Collection_objects_unlink(
Collection *collection,
161 if (!rna_collection_objects_edit_check(collection, reports,
object)) {
167 "Object '%s' not in collection '%s'",
169 collection->id.name + 2);
178static bool rna_Collection_objects_override_apply(
Main *bmain,
183 PointerRNA *ptr_item_dst = &rnaapply_ctx.ptr_item_dst;
184 PointerRNA *ptr_item_src = &rnaapply_ctx.ptr_item_src;
188 "Unsupported RNA override operation on collections' objects");
191 Collection *coll_dst = id_cast<Collection *>(ptr_dst->owner_id);
193 if (!ptr_item_dst->has_type() || !ptr_item_src->has_type()) {
198 Object *ob_dst =
static_cast<Object *
>(ptr_item_dst->data);
199 Object *ob_src =
static_cast<Object *
>(ptr_item_src->data);
201 if (ob_src == ob_dst) {
206 BLI_assert_msg(0,
"Could not find destination object in destination collection!");
229static bool rna_collection_children_edit_check(
Collection *collection,
235 reports,
RPT_ERROR,
"Collection '%s' is not an original ID", collection->id.name + 2);
247 "Could not (un)link the collection '%s'. %s",
255static void rna_Collection_children_link(
Collection *collection,
260 if (!rna_collection_children_edit_check(collection, reports, child)) {
266 "Collection '%s' already in collection '%s'",
268 collection->id.name + 2);
277static void rna_Collection_children_unlink(
Collection *collection,
282 if (!rna_collection_children_edit_check(collection, reports, child)) {
288 "Collection '%s' not in collection '%s'",
290 collection->id.name + 2);
299static bool rna_Collection_children_override_apply(
Main *bmain,
304 PointerRNA *ptr_item_dst = &rnaapply_ctx.ptr_item_dst;
305 PointerRNA *ptr_item_src = &rnaapply_ctx.ptr_item_src;
309 "Unsupported RNA override operation on collections' children");
312 Collection *coll_dst = id_cast<Collection *>(ptr_dst->owner_id);
314 if (!ptr_item_dst->has_type() || !ptr_item_src->has_type()) {
325 if (collchild_dst ==
nullptr) {
326 BLI_assert_msg(0,
"Could not find destination sub-collection in destination collection!");
332 id_us_min(&collchild_dst->collection->id);
333 collchild_dst->collection = subcoll_src;
352 collection->flag |= flag;
355 collection->flag &= ~flag;
359static void rna_Collection_hide_select_set(
PointerRNA *ptr,
bool value)
364static void rna_Collection_hide_viewport_set(
PointerRNA *ptr,
bool value)
369static void rna_Collection_hide_render_set(
PointerRNA *ptr,
bool value)
385static int rna_Collection_color_tag_get(
PointerRNA *ptr)
392static void rna_Collection_color_tag_set(
PointerRNA *ptr,
int value)
408static void rna_Collection_instance_offset_update(
Main * ,
416static std::optional<std::string> rna_CollectionLightLinking_path(
const PointerRNA *ptr)
418 Collection *collection = id_cast<Collection *>(ptr->owner_id);
426 if (&collection_object.light_linking == collection_light_linking) {
427 return fmt::format(
"collection_objects[{}].light_linking", counter);
434 if (&collection_child.light_linking == collection_light_linking) {
435 return fmt::format(
"collection_children[{}].light_linking", counter);
456 Collection *collection = id_cast<Collection *>(ptr->owner_id);
457 if (collection !=
nullptr) {
479 ptr->owner_id, RNA_IDPropertyWrapPtr,
data->import_properties);
485 ptr->owner_id, RNA_IDPropertyWrapPtr,
data->import_properties);
491static void rna_CollectionExport_name_set(
PointerRNA *ptr,
const char *value)
505 fh = types[type].get();
509 collection, fh->idname, name ?
const_cast<char *
>(name) : fh->label);
526static void rna_CollectionExport_move(
Collection *collection,
534 "Could not move collection exporter from index '%d' to '%d'",
556 item_tmp.identifier = fh->idname;
557 item_tmp.name = fh->label;
583 ptr->owner_id, RNA_IDPropertyWrapPtr,
data->export_properties);
589 ptr->owner_id, RNA_IDPropertyWrapPtr,
data->export_properties);
599 if (filepath_prop && filepath_prop->type ==
IDP_STRING) {
606static void rna_CollectionImport_filepath_get(
PointerRNA *ptr,
char *value)
609 const char *value_src = rna_CollectionImport_filepath_value_from_idprop(
data);
610 strcpy(value, value_src ? value_src :
"");
612static int rna_CollectionImport_filepath_length(
PointerRNA *ptr)
615 const char *value_src = rna_CollectionImport_filepath_value_from_idprop(
data);
616 return value_src ? strlen(value_src) : 0;
618static void rna_CollectionImport_filepath_set(
PointerRNA *ptr,
const char *value)
621 if (!
data->import_properties) {
628 const char *prop_id =
"filepath";
629 const size_t value_maxsize =
FILE_MAX;
635 if (prop ==
nullptr) {
643static int rna_CollectionImport_filepath_is_editable(
const PointerRNA *ptr,
const char **r_info)
647 if (
data->runtime &&
data->runtime->archive_library) {
648 *r_info =
N_(
"Path of imported external data cannot be edited");
658 if (filepath_prop && filepath_prop->type ==
IDP_STRING) {
665static void rna_CollectionExport_filepath_get(
PointerRNA *ptr,
char *value)
668 const char *value_src = rna_CollectionExport_filepath_value_from_idprop(
data);
669 strcpy(value, value_src ? value_src :
"");
671static int rna_CollectionExport_filepath_length(
PointerRNA *ptr)
674 const char *value_src = rna_CollectionExport_filepath_value_from_idprop(
data);
675 return value_src ? strlen(value_src) : 0;
677static void rna_CollectionExport_filepath_set(
PointerRNA *ptr,
const char *value)
680 if (!
data->export_properties) {
687 const char *prop_id =
"filepath";
688 const size_t value_maxsize =
FILE_MAX;
694 if (prop ==
nullptr) {
732 parm =
RNA_def_pointer(func,
"object",
"Object",
"",
"Object to remove");
752 parm =
RNA_def_pointer(func,
"child",
"Collection",
"",
"Collection to add");
759 parm =
RNA_def_pointer(func,
"child",
"Collection",
"",
"Collection to remove");
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");
788 parm =
RNA_def_pointer(func,
"exporter",
"CollectionExport",
"",
"Export Handler to remove");
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);
810 {0,
nullptr, 0,
nullptr,
nullptr},
819 "Collection Light Linking",
820 "Light linking settings of objects and children collections of a collection");
827 prop,
"Link State",
"Light or shadow receiving state of the object or collection");
842 srna,
"Collection Object",
"Object of a collection with its collection related settings");
850 prop,
"Sort Index",
"Custom sort index of the object in the collection");
859 "Custom sort index when the object is shown under a parent of another object");
879 srna,
"Collection Child",
"Child collection with its collection related settings");
887 prop,
"Sort Index",
"Custom sort index of the collection in the parent collection");
895 prop,
"Light Linking",
"Light linking settings of the collection object");
913 prop,
"rna_CollectionImport_archive_library_get",
nullptr,
nullptr,
nullptr);
916 "Archive library owning all imported data from this collection "
917 "importer (None if no data has been imported yet)");
929 prop,
"Import Properties",
"Properties associated with the configured importer");
931 prop,
"rna_CollectionImport_import_properties_get",
nullptr,
nullptr,
nullptr);
937 "rna_CollectionImport_filepath_get",
938 "rna_CollectionImport_filepath_length",
939 "rna_CollectionImport_filepath_set");
970 prop,
"Export Properties",
"Properties associated with the configured exporter");
972 prop,
"rna_CollectionExport_export_properties_get",
nullptr,
nullptr,
nullptr);
981 "rna_CollectionExport_filepath_get",
982 "rna_CollectionExport_filepath_length",
983 "rna_CollectionExport_filepath_set");
1006 prop,
"Instance Offset",
"Offset from the origin to use when instancing");
1015 "rna_Collection_objects_begin",
1016 "rna_iterator_listbase_next",
1017 "rna_iterator_listbase_end",
1018 "rna_Collection_objects_get",
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",
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",
1064 "Collection Objects",
1065 "Objects of the collection with their parent-collection-specific settings");
1073 "Collection Children",
1074 "Children collections with their parent-collection-specific settings");
1080 prop,
"Collection Import Handler",
"Import Handler configured for the collection");
1087 prop,
"Collection Export Handlers",
"Export Handlers configured for the collection");
1093 prop,
"Active Collection Exporter Index",
"Active index in the exporters list");
1127 "Generate feature lines for this collection"},
1132 "Only use the collection to produce occlusion"},
1135 "INTERSECTION_ONLY",
1137 "Intersection Only",
1138 "Only generate intersection lines for this collection"},
1143 "Include this collection but do not generate intersection lines"},
1145 "FORCE_INTERSECTION",
1147 "Force Intersection",
1148 "Generate intersection lines even with objects that disabled intersection"},
1149 {0,
nullptr, 0,
nullptr,
nullptr}};
1159 prop,
"Use Intersection Masks",
"Use custom intersection mask for faces in this collection");
1164 prop,
nullptr,
"lineart_intersection_mask", 1 << 0, 8);
1166 prop,
"Masks",
"Intersection generated by this collection will have this mask value");
1171 "Intersection Priority",
1172 "The intersection line will be included into the object with the "
1173 "higher intersection priority value");
1181 prop,
"Use Intersection Priority",
"Assign intersection priority value for this collection");
1187 prop,
"rna_Collection_color_tag_get",
"rna_Collection_color_tag_set",
nullptr);
#define IDP_string_get(prop)
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
#define ND_SPACE_PROPERTIES
#define UNUSED_VARS_NDEBUG(...)
#define BLI_assert_msg(a, msg)
constexpr IndexRange index_range() const
constexpr bool contains(int64_t value) const
FileHandlerType * file_handler_find(StringRef idname)
Span< std::unique_ptr< FileHandlerType > > file_handlers()
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)
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()
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[]
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 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()
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()
@ COLLECTION_LRT_USE_INTERSECTION_PRIORITY
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)
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
@ PROPOVERRIDE_NO_COMPARISON
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)
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[]
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[]
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
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)
@ COLLECTION_HIDE_VIEWPORT
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)
@ PROP_PATH_SUPPORTS_BLEND_RELATIVE
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()
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
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)
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 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()
static void rna_def_collection_exporter_data(BlenderRNA *brna)
CollectionColorTag color_tag
char import_operator[OP_MAX_TYPENAME]