46#include "RNA_prototypes.hh"
87 item_tmp.identifier = item_tmp.name =
"All Collections";
88 item_tmp.value = INT_MAX;
96 item_tmp.identifier = item_tmp.name = collection->
id.
name + 2;
114 const int collection_object_index)
119 if (
i == collection_object_index) {
135 bmain, scene, ob, single_collection_index);
136 bool is_cycle =
false;
137 bool changed_multi =
false;
145 if (single_collection && collection != single_collection) {
152 bool changed =
false;
170 changed_multi =
true;
179 if (!changed_multi) {
194 ot->name =
"Add Selected to Active Object's Collection";
196 "Add selected objects to one of the collections the active-object is part of. "
197 "Optionally add to \"All Collections\" to ensure selected objects are included in "
198 "the same collections as the active object";
199 ot->idname =
"COLLECTION_OT_objects_add_active";
215 "The collection to add other selected objects to");
230 bmain, scene, ob, single_collection_index);
231 bool changed_multi =
false;
240 if (single_collection && collection != single_collection) {
246 bool changed =
false;
255 changed_multi =
true;
261 if (!changed_multi) {
276 ot->name =
"Remove Selected from Active Collection";
277 ot->description =
"Remove the object from an object collection that contains the active object";
278 ot->idname =
"COLLECTION_OT_objects_remove_active";
294 "The collection to remove other selected objects from");
319 ot->name =
"Remove from All Collections";
320 ot->description =
"Remove selected objects from all collections";
321 ot->idname =
"COLLECTION_OT_objects_remove_all";
338 bmain, scene, ob, single_collection_index);
339 bool changed_multi =
false;
346 if (single_collection && collection != single_collection) {
354 bool changed =
false;
363 changed_multi =
true;
368 if (!changed_multi) {
383 ot->name =
"Remove from Collection";
384 ot->description =
"Remove selected objects from a collection";
385 ot->idname =
"COLLECTION_OT_objects_remove";
401 "The collection to remove this object from");
411 bool changed =
false;
437 ot->name =
"Create New Collection";
438 ot->description =
"Create an object collection from selected objects";
439 ot->idname =
"COLLECTION_OT_create";
449 ot->srna,
"name",
"Collection",
MAX_ID_NAME - 2,
"Name",
"Name of the new collection");
454 return collection !=
nullptr &&
523 ot->name =
"Add Exporter";
524 ot->description =
"Add Exporter";
525 ot->idname =
"COLLECTION_OT_exporter_add";
577 ot->name =
"Remove Exporter";
578 ot->description =
"Remove Exporter";
579 ot->idname =
"COLLECTION_OT_exporter_remove";
589 RNA_def_int(
ot->srna,
"index", 0, 0, INT_MAX,
"Index",
"Exporter index", 0, INT_MAX);
596 const bool report_success)
616 const char *collection_name = collection->
id.
name + 2;
642 ot->last_properties =
nullptr;
651 if (
ot->last_properties) {
654 ot->last_properties = last_properties;
683 ot->description =
"Invoke the export operation";
684 ot->idname =
"COLLECTION_OT_exporter_export";
693 RNA_def_int(
ot->srna,
"index", 0, 0, INT_MAX,
"Index",
"Exporter index", 0, INT_MAX);
735 "Exported %d files from collection '%s'",
746 ot->name =
"Export All";
747 ot->description =
"Invoke all configured exporters on this collection";
748 ot->idname =
"COLLECTION_OT_export_all";
801 "Exported %d files from %d collections",
812 ot->name =
"Export All Collections";
813 ot->description =
"Invoke all configured exporters for all collections";
814 ot->idname =
"WM_OT_collection_export_all";
830 bool at_least_one =
false;
833 PointerRNA op_ptr = layout->
op(
"COLLECTION_OT_exporter_add", fh->label, ICON_NONE);
840 layout->
label(
IFACE_(
"No file handlers available"), ICON_NONE);
885 ot->name =
"Add to Collection";
886 ot->idname =
"OBJECT_OT_collection_add";
887 ot->description =
"Add an object to a new collection";
904 if (
ELEM(
nullptr, ob, collection)) {
936 "Could not add the collection because of dependency cycle detected");
955 ot->name =
"Link to Collection";
956 ot->idname =
"OBJECT_OT_collection_link";
957 ot->description =
"Add an object to an existing collection";
981 if (!ob || !collection) {
987 "Cannot remove an object from a linked or library override collection");
1004 ot->name =
"Remove Collection";
1005 ot->idname =
"OBJECT_OT_collection_remove";
1006 ot->description =
"Remove the active object from this collection";
1033 "Cannot unlink a library override collection which is not the root of its override "
1070 ot->name =
"Unlink Collection";
1071 ot->idname =
"OBJECT_OT_collection_unlink";
1072 ot->description =
"Unlink the collection from all objects";
1111 ot->name =
"Select Objects in Collection";
1112 ot->idname =
"OBJECT_OT_collection_objects_select";
1113 ot->description =
"Select all objects in collection";
bool BKE_collection_object_remove(Main *bmain, Collection *collection, Object *ob, bool free_us)
bool BKE_collection_has_object_recursive(Collection *collection, Object *ob)
void BKE_collection_exporter_free_data(CollectionExport *data)
#define FOREACH_COLLECTION_BEGIN(_bmain, _scene, Type, _instance)
Collection * BKE_collection_add(Main *bmain, Collection *collection_parent, const char *name_custom)
bool BKE_collection_has_object(Collection *collection, const Object *ob)
void BKE_collection_exporter_name_set(const ListBase *exporters, CollectionExport *data, const char *newname)
Collection * BKE_collection_object_find(Main *bmain, Scene *scene, Collection *collection, Object *ob)
bool BKE_collection_object_cyclic_check(Main *bmain, Object *object, Collection *collection)
#define FOREACH_COLLECTION_END
bool BKE_collection_object_add(Main *bmain, Collection *collection, Object *ob)
#define CTX_DATA_BEGIN(C, Type, instance, member)
PointerRNA CTX_data_pointer_get_type(const bContext *C, const char *member, StructRNA *type)
Scene * CTX_data_scene(const bContext *C)
Main * CTX_data_main(const bContext *C)
Collection * CTX_data_collection(const bContext *C)
ViewLayer * CTX_data_view_layer(const bContext *C)
void IDP_FreeProperty(IDProperty *prop)
IDProperty * IDP_New(char type, const IDPropertyTemplate *val, blender::StringRef name, eIDPropertyFlag flags={}) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
IDProperty * IDP_CopyProperty(const IDProperty *prop) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void BKE_view_layer_synced_ensure(const Scene *scene, ViewLayer *view_layer)
Object * BKE_view_layer_active_object_get(const ViewLayer *view_layer)
void BKE_view_layer_need_resync_tag(ViewLayer *view_layer)
void BKE_id_delete(Main *bmain, void *idv) ATTR_NONNULL()
void id_fake_user_set(ID *id)
const char * BKE_main_blendfile_path(const Main *bmain) ATTR_NONNULL()
General operations, lookup, etc. for blender objects.
void BKE_object_groups_clear(Main *bmain, Scene *scene, Object *object)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_report(ReportList *reports, eReportType type, const char *message)
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE bool BLI_listbase_is_empty(const ListBase *lb)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
int BLI_listbase_count(const ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
bool BLI_path_abs(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1
void void void const char * BLI_path_basename(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
#define BLI_path_join(...)
const char * BLI_path_extension(const char *filepath) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
char * STRNCPY(char(&dst)[N], const char *src)
void DEG_id_tag_update(ID *id, unsigned int flags)
void DEG_relations_tag_update(Main *bmain)
Object groups, one object can be in many groups at once.
@ LAYER_COLLECTION_EXCLUDE
Object is a sort of wrapper for general info.
#define BASE_SELECTED(v3d, base)
#define BASE_SELECTABLE(v3d, base)
bool ED_operator_objectmode(bContext *C)
const EnumPropertyItem * RNA_collection_local_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *prop, bool *r_free)
int UI_icon_color_from_collection(const Collection *collection)
#define ND_SPACE_PROPERTIES
#define ND_SPACE_OUTLINER
BMesh const char void * data
#define ID_IS_LINKED(_id)
#define ID_IS_EDITABLE(_id)
#define ID_IS_OVERRIDE_LIBRARY(_id)
void * MEM_callocN(size_t len, const char *str)
void MEM_freeN(void *vmemh)
FileHandlerType * file_handler_find(StringRef idname)
Span< std::unique_ptr< FileHandlerType > > file_handlers()
static wmOperatorStatus collection_objects_remove_exec(bContext *C, wmOperator *op)
static void COLLECTION_OT_exporter_add(wmOperatorType *ot)
static bool collection_unlink_poll(bContext *C)
static wmOperatorStatus collection_remove_exec(bContext *C, wmOperator *op)
static wmOperatorStatus objects_add_active_exec(bContext *C, wmOperator *op)
static wmOperatorStatus collection_export(bContext *C, wmOperator *op, Collection *collection, CollectionExportStats &stats)
static bool collection_export_all_poll(bContext *C)
static void COLLECTION_OT_exporter_remove(wmOperatorType *ot)
static wmOperatorStatus collection_exporter_remove_exec(bContext *C, wmOperator *op)
static wmOperatorStatus collection_unlink_exec(bContext *C, wmOperator *op)
static void COLLECTION_OT_export_all(wmOperatorType *ot)
static wmOperatorStatus collection_objects_remove_all_exec(bContext *C, wmOperator *)
static bool collection_exporter_common_check(const Collection *collection)
static wmOperatorStatus collection_add_exec(bContext *C, wmOperator *)
static wmOperatorStatus select_grouped_exec(bContext *C, wmOperator *)
static wmOperatorStatus collection_exporter_export_exec(bContext *C, wmOperator *op)
void OBJECT_OT_collection_objects_select(wmOperatorType *ot)
static wmOperatorStatus collection_exporter_remove_invoke(bContext *C, wmOperator *op, const wmEvent *)
void base_select(Base *base, eObjectSelect_Mode mode)
void OBJECT_OT_collection_link(wmOperatorType *ot)
Object * context_object(const bContext *C)
static bool collection_exporter_poll(bContext *C)
static Collection * collection_object_active_find_index(Main *bmain, Scene *scene, Object *ob, const int collection_object_index)
static void WM_OT_collection_export_all(wmOperatorType *ot)
void OBJECT_OT_collection_add(wmOperatorType *ot)
static const EnumPropertyItem * collection_object_active_itemf(bContext *C, PointerRNA *, PropertyRNA *, bool *r_free)
static wmOperatorStatus objects_remove_active_exec(bContext *C, wmOperator *op)
static wmOperatorStatus collection_exporter_export(bContext *C, wmOperator *op, CollectionExport *data, Collection *collection, const bool report_success)
static void collection_exporter_menu_draw(const bContext *, Menu *menu)
static wmOperatorStatus collection_io_export_all_exec(bContext *C, wmOperator *op)
static bool collection_exporter_remove_poll(bContext *C)
void COLLECTION_OT_create(wmOperatorType *ot)
static wmOperatorStatus collection_link_exec(bContext *C, wmOperator *op)
static wmOperatorStatus collection_exporter_add_exec(bContext *C, wmOperator *op)
void OBJECT_OT_collection_unlink(wmOperatorType *ot)
void OBJECT_OT_collection_remove(wmOperatorType *ot)
static wmOperatorStatus collection_export_recursive(bContext *C, wmOperator *op, LayerCollection *layer_collection, CollectionExportStats &stats)
static wmOperatorStatus collection_create_exec(bContext *C, wmOperator *op)
void COLLECTION_OT_objects_add_active(wmOperatorType *ot)
void COLLECTION_OT_objects_remove_all(wmOperatorType *ot)
static wmOperatorStatus wm_collection_export_all_exec(bContext *C, wmOperator *op)
void COLLECTION_OT_objects_remove_active(wmOperatorType *ot)
static void COLLECTION_OT_exporter_export(wmOperatorType *ot)
void COLLECTION_OT_objects_remove(wmOperatorType *ot)
void collection_exporter_register()
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
void RNA_string_get(PointerRNA *ptr, const char *name, char *value)
int RNA_int_get(PointerRNA *ptr, const char *name)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_enum_item_add_separator(EnumPropertyItem **items, int *totitem)
void RNA_def_enum_funcs(PropertyRNA *prop, EnumPropertyItemFunc itemfunc)
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)
const EnumPropertyItem rna_enum_dummy_NULL_items[]
int active_exporter_index
struct ID * hierarchy_root
IDOverrideLibrary * override_library
ListBase layer_collections
struct Collection * collection
ListBase layer_collections
std::string get_default_filename(StringRefNull name)
char label[OP_MAX_TYPENAME]
char idname[OP_MAX_TYPENAME]
char export_operator[OP_MAX_TYPENAME]
int successful_exports_num
PointerRNA op(wmOperatorType *ot, std::optional< blender::StringRef > name, int icon, wmOperatorCallContext context, eUI_Item_Flag flag)
void label(blender::StringRef name, int icon)
struct ReportList * reports
void WM_main_add_notifier(uint type, void *reference)
wmOperatorStatus WM_operator_name_call_ptr(bContext *C, wmOperatorType *ot, wmOperatorCallContext context, PointerRNA *properties, const wmEvent *event)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void WM_operatortype_append(void(*opfunc)(wmOperatorType *))
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)
wmOperatorStatus WM_menu_invoke(bContext *C, wmOperator *op, const wmEvent *)
wmOperatorStatus WM_operator_confirm_ex(bContext *C, wmOperator *op, const char *title, const char *message, const char *confirm_text, int icon, bool cancel_default)
wmOperatorStatus WM_enum_search_invoke(bContext *C, wmOperator *op, const wmEvent *)