46#include "RNA_prototypes.hh"
88 item_tmp.identifier = item_tmp.name =
"All Collections";
89 item_tmp.value = INT_MAX;
97 item_tmp.identifier = item_tmp.name = collection->
id.
name + 2;
115 const int collection_object_index)
120 if (
i == collection_object_index) {
136 bmain, scene, ob, single_collection_index);
137 bool is_cycle =
false;
138 bool changed_multi =
false;
146 if (single_collection && collection != single_collection) {
153 bool changed =
false;
171 changed_multi =
true;
180 if (!changed_multi) {
195 ot->name =
"Add Selected to Active Object's Collection";
197 "Add selected objects to one of the collections the active-object is part of. "
198 "Optionally add to \"All Collections\" to ensure selected objects are included in "
199 "the same collections as the active object";
200 ot->idname =
"COLLECTION_OT_objects_add_active";
216 "The collection to add other selected objects to");
231 bmain, scene, ob, single_collection_index);
232 bool changed_multi =
false;
241 if (single_collection && collection != single_collection) {
247 bool changed =
false;
256 changed_multi =
true;
262 if (!changed_multi) {
277 ot->name =
"Remove Selected from Active Collection";
278 ot->description =
"Remove the object from an object collection that contains the active object";
279 ot->idname =
"COLLECTION_OT_objects_remove_active";
295 "The collection to remove other selected objects from");
320 ot->name =
"Remove from All Collections";
321 ot->description =
"Remove selected objects from all collections";
322 ot->idname =
"COLLECTION_OT_objects_remove_all";
339 bmain, scene, ob, single_collection_index);
340 bool changed_multi =
false;
347 if (single_collection && collection != single_collection) {
355 bool changed =
false;
364 changed_multi =
true;
369 if (!changed_multi) {
384 ot->name =
"Remove from Collection";
385 ot->description =
"Remove selected objects from a collection";
386 ot->idname =
"COLLECTION_OT_objects_remove";
402 "The collection to remove this object from");
412 bool changed =
false;
438 ot->name =
"Create New Collection";
439 ot->description =
"Create an object collection from selected objects";
440 ot->idname =
"COLLECTION_OT_create";
454 return collection !=
nullptr &&
510 ot->name =
"Add Exporter";
511 ot->description =
"Add exporter to the exporter list";
512 ot->idname =
"COLLECTION_OT_exporter_add";
557 ot->name =
"Remove Exporter";
558 ot->description =
"Remove exporter from the exporter list";
559 ot->idname =
"COLLECTION_OT_exporter_remove";
569 RNA_def_int(
ot->srna,
"index", 0, 0, INT_MAX,
"Index",
"Exporter index", 0, INT_MAX);
580 const int to = from + dir;
593 {-1,
"UP", 0,
"Up",
""},
594 {1,
"DOWN", 0,
"Down",
""},
595 {0,
nullptr, 0,
nullptr,
nullptr},
599 ot->name =
"Move Exporter";
600 ot->description =
"Move exporter up or down in the exporter list";
601 ot->idname =
"COLLECTION_OT_exporter_move";
615 "Direction to move the active exporter");
622 const bool report_success)
642 const char *collection_name = collection->
id.
name + 2;
668 ot->last_properties =
nullptr;
677 if (
ot->last_properties) {
680 ot->last_properties = last_properties;
709 ot->description =
"Invoke the export operation";
710 ot->idname =
"COLLECTION_OT_exporter_export";
719 RNA_def_int(
ot->srna,
"index", 0, 0, INT_MAX,
"Index",
"Exporter index", 0, INT_MAX);
761 "Exported %d files from collection '%s'",
772 ot->name =
"Export All";
773 ot->description =
"Invoke all configured exporters on this collection";
774 ot->idname =
"COLLECTION_OT_export_all";
827 "Exported %d files from %d collections",
838 ot->name =
"Export All Collections";
839 ot->description =
"Invoke all configured exporters for all collections";
840 ot->idname =
"WM_OT_collection_export_all";
856 bool at_least_one =
false;
859 PointerRNA op_ptr = layout->
op(
"COLLECTION_OT_exporter_add", fh->label, ICON_NONE);
866 layout->
label(
IFACE_(
"No file handlers available"), ICON_NONE);
912 ot->name =
"Add to Collection";
913 ot->idname =
"OBJECT_OT_collection_add";
914 ot->description =
"Add an object to a new collection";
931 if (
ELEM(
nullptr, ob, collection)) {
963 "Could not add the collection because of dependency cycle detected");
982 ot->name =
"Link to Collection";
983 ot->idname =
"OBJECT_OT_collection_link";
984 ot->description =
"Add an object to an existing collection";
1008 if (!ob || !collection) {
1014 "Cannot remove an object from a linked or library override collection");
1031 ot->name =
"Remove Collection";
1032 ot->idname =
"OBJECT_OT_collection_remove";
1033 ot->description =
"Remove the active object from this collection";
1060 "Cannot unlink a library override collection which is not the root of its override "
1097 ot->name =
"Unlink Collection";
1098 ot->idname =
"OBJECT_OT_collection_unlink";
1099 ot->description =
"Unlink the collection from all objects";
1138 ot->name =
"Select Objects in Collection";
1139 ot->idname =
"OBJECT_OT_collection_objects_select";
1140 ot->description =
"Select all objects in collection";
bool BKE_collection_object_remove(Main *bmain, Collection *collection, Object *ob, bool free_us)
void BKE_collection_exporter_remove(Collection *collection, CollectionExport *data)
bool BKE_collection_has_object_recursive(Collection *collection, Object *ob)
#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)
bool BKE_collection_exporter_move(Collection *collection, const int from, const int to)
CollectionExport * BKE_collection_exporter_add(Collection *collection, char *idname, char *label)
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_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)
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
#define STRNCPY_UTF8(dst, src)
void DEG_id_tag_update(ID *id, unsigned int flags)
void DEG_relations_tag_update(Main *bmain)
#define ID_IS_LINKED(_id)
#define ID_IS_EDITABLE(_id)
#define ID_IS_OVERRIDE_LIBRARY(_id)
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
void * MEM_callocN(size_t len, const char *str)
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 void COLLECTION_OT_exporter_move(wmOperatorType *ot)
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)
static wmOperatorStatus collection_exporter_move_exec(bContext *C, wmOperator *op)
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)
int RNA_int_get(PointerRNA *ptr, const char *name)
std::string RNA_string_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
void label(blender::StringRef name, int icon)
PointerRNA op(wmOperatorType *ot, std::optional< blender::StringRef > name, int icon, blender::wm::OpCallContext context, eUI_Item_Flag flag)
struct ReportList * reports
wmOperatorStatus WM_operator_name_call_ptr(bContext *C, wmOperatorType *ot, blender::wm::OpCallContext context, PointerRNA *properties, const wmEvent *event)
void WM_main_add_notifier(uint type, void *reference)
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 *)