153 &space_outliner->
tree,
179 return (space_outliner !=
nullptr) &&
234 if (
data->collection !=
nullptr) {
239 data->collection = collection;
257 &space_outliner->
tree,
293 ot->name =
"New Collection";
294 ot->idname =
"OUTLINER_OT_collection_new";
295 ot->description =
"Add a new collection inside selected collection";
306 ot->srna,
"nested",
true,
"Nested",
"Add as child of selected collection");
349 if (!(
data->is_liboverride_hierarchy_root_allowed ||
data->is_liboverride_allowed)) {
354 if (!
data->is_liboverride_allowed) {
362 data->collections_to_edit.add(collection);
373 data.space_outliner = space_outliner;
374 data.is_liboverride_allowed =
false;
375 data.is_liboverride_hierarchy_root_allowed = do_hierarchy;
376 data.is_recursive = !do_hierarchy;
381 &space_outliner->
tree,
426 "Cannot delete collection '%s', it is either a linked one used by other "
427 "linked scenes/collections, or a library override one",
463 ot->name =
"Delete Hierarchy";
464 ot->idname =
"OUTLINER_OT_collection_hierarchy_delete";
465 ot->description =
"Delete selected collection hierarchies";
492 switch (tselem->
type) {
512 &space_outliner->
tree,
517 return data.layer_collection;
525 bool deselect =
STREQ(op->
idname,
"OUTLINER_OT_collection_objects_deselect");
529 &space_outliner->
tree,
533 &selected_collections);
558 ot->name =
"Select Objects";
559 ot->idname =
"OUTLINER_OT_collection_objects_select";
560 ot->description =
"Select objects in collection";
573 ot->name =
"Deselect Objects";
574 ot->idname =
"OUTLINER_OT_collection_objects_deselect";
575 ot->description =
"Deselect objects in collection";
601 switch (tselem->
type) {
620 &space_outliner->
tree,
631 const bool linked = strstr(op->
idname,
"linked") !=
nullptr;
636 &space_outliner->
tree,
640 &selected_collections);
648 int failed_count = 0;
685 (linked ? 0 :
U.dupflag));
690 if (failed_count != 0) {
693 "Unable to duplicate %d of the selected collections. "
694 "Could not find a valid parent collection for the new duplicate, "
695 "they won't be linked to any view layer",
710 ot->name =
"Duplicate Linked Collection";
711 ot->idname =
"OUTLINER_OT_collection_duplicate_linked";
713 "Recursively duplicate the collection, all its children and objects, with linked object "
727 ot->name =
"Duplicate Collection";
728 ot->idname =
"OUTLINER_OT_collection_duplicate";
730 "Recursively duplicate the collection, all its children, objects and object data";
755 data.space_outliner = space_outliner;
756 data.is_liboverride_allowed =
false;
757 data.is_liboverride_hierarchy_root_allowed =
true;
764 op->
reports,
RPT_ERROR,
"Cannot add a collection to a linked/override collection/scene");
770 &space_outliner->
tree,
793 ot->name =
"Link Collection";
794 ot->idname =
"OUTLINER_OT_collection_link";
795 ot->description =
"Link selected collections to active scene";
819 data.space_outliner = space_outliner;
820 data.is_liboverride_allowed =
true;
821 data.is_liboverride_hierarchy_root_allowed =
true;
826 &space_outliner->
tree,
860 ot->name =
"Instance Collection";
861 ot->idname =
"OUTLINER_OT_collection_instance";
862 ot->description =
"Instance selected collections to active scene";
896 data->layer_collections_to_edit.add(lc);
913 data.space_outliner = space_outliner;
914 data.is_liboverride_allowed =
true;
915 data.is_liboverride_hierarchy_root_allowed =
true;
919 &space_outliner->
tree,
975 data.space_outliner = space_outliner;
976 data.is_liboverride_allowed =
true;
977 data.is_liboverride_hierarchy_root_allowed =
true;
978 bool clear = strstr(op->
idname,
"clear") !=
nullptr;
984 &space_outliner->
tree,
1005 ot->name =
"Disable from View Layer";
1006 ot->idname =
"OUTLINER_OT_collection_exclude_set";
1007 ot->description =
"Exclude collection from the active view layer";
1020 ot->name =
"Enable in View Layer";
1021 ot->idname =
"OUTLINER_OT_collection_exclude_clear";
1022 ot->description =
"Include collection in the active view layer";
1035 ot->name =
"Set Holdout";
1036 ot->idname =
"OUTLINER_OT_collection_holdout_set";
1037 ot->description =
"Mask collection in the active view layer";
1050 ot->name =
"Clear Holdout";
1051 ot->idname =
"OUTLINER_OT_collection_holdout_clear";
1052 ot->description =
"Clear masking of collection in the active view layer";
1065 ot->name =
"Set Indirect Only";
1066 ot->idname =
"OUTLINER_OT_collection_indirect_only_set";
1068 "Set collection to only contribute indirectly (through shadows and reflections) in the view "
1082 ot->name =
"Clear Indirect Only";
1083 ot->idname =
"OUTLINER_OT_collection_indirect_only_clear";
1084 ot->description =
"Clear collection contributing only indirectly in the view layer";
1108 data.space_outliner = space_outliner;
1109 data.is_liboverride_allowed =
true;
1110 data.is_liboverride_hierarchy_root_allowed =
true;
1112 &space_outliner->
tree,
1125 &scene->
id, &RNA_LayerCollection, layer_collection);
1132 scene, view_layer, layer_collection,
nullptr, prop,
"hide_viewport", value);
1158 ot->name =
"Isolate Collection";
1159 ot->idname =
"OUTLINER_OT_collection_isolate";
1160 ot->description =
"Hide all but this collection and its parents";
1172 ot->srna,
"extend",
false,
"Extend",
"Extend current visible collections");
1200 const bool show = strstr(op->
idname,
"show") !=
nullptr;
1203 data.space_outliner = space_outliner;
1204 data.is_liboverride_allowed =
true;
1205 data.is_liboverride_hierarchy_root_allowed =
true;
1208 &space_outliner->
tree,
1228 ot->name =
"Show Collection";
1229 ot->idname =
"OUTLINER_OT_collection_show";
1230 ot->description =
"Show the collection in this view layer";
1243 ot->name =
"Hide Collection";
1244 ot->idname =
"OUTLINER_OT_collection_hide";
1245 ot->description =
"Hide the collection in this view layer";
1258 ot->name =
"Show Inside Collection";
1259 ot->idname =
"OUTLINER_OT_collection_show_inside";
1260 ot->description =
"Show all the objects and collections inside the collection";
1273 ot->name =
"Hide Inside Collection";
1274 ot->idname =
"OUTLINER_OT_collection_hide_inside";
1275 ot->description =
"Hide all the objects and collections inside the collection";
1298 if (te ==
nullptr) {
1303 if (collection ==
nullptr) {
1343 const bool is_render = strstr(op->
idname,
"render");
1348 data.space_outliner = space_outliner;
1349 data.is_liboverride_allowed =
true;
1350 data.is_liboverride_hierarchy_root_allowed =
true;
1353 if (has_layer_collection) {
1355 &space_outliner->
tree,
1373 if (
clear && !is_render) {
1380 &space_outliner->
tree,
1413 ot->name =
"Enable Collection";
1414 ot->idname =
"OUTLINER_OT_collection_enable";
1415 ot->description =
"Enable viewport display in the view layers";
1428 ot->name =
"Disable Collection";
1429 ot->idname =
"OUTLINER_OT_collection_disable";
1430 ot->description =
"Disable viewport display in the view layers";
1443 ot->name =
"Enable Collection in Render";
1444 ot->idname =
"OUTLINER_OT_collection_enable_render";
1445 ot->description =
"Render the collection";
1458 ot->name =
"Disable Collection in Render";
1459 ot->idname =
"OUTLINER_OT_collection_disable_render";
1460 ot->description =
"Do not render this collection";
1489 if (tselem ==
nullptr) {
1503 data->collections_to_edit.add(lc);
1510 data->bases_to_edit.add(base);
1523 data.view_layer = view_layer;
1524 data.space_outliner = space_outliner;
1527 &space_outliner->
tree,
1537 for (
Base *base :
data.bases_to_edit) {
1552 ot->idname =
"OUTLINER_OT_hide";
1553 ot->description =
"Hide selected objects and collections";
1590 ot->name =
"Unhide All";
1591 ot->idname =
"OUTLINER_OT_unhide_all";
1592 ot->description =
"Unhide all objects and collections";
1617 &space_outliner->
tree,
1648 ot->name =
"Set Color Tag";
1649 ot->idname =
"OUTLINER_OT_collection_color_tag_set";
1650 ot->description =
"Set a color tag for the selected collections";
CollectionChild * BKE_collection_child_find(Collection *parent, Collection *collection)
Collection * BKE_collection_add(Main *bmain, Collection *collection_parent, const char *name_custom)
Collection * BKE_collection_duplicate(Main *bmain, Collection *parent, CollectionChild *child_old, Collection *collection, eDupli_ID_Flags duplicate_flags, uint duplicate_options)
bool BKE_collection_child_add(Main *bmain, Collection *parent, Collection *child)
bool BKE_collection_delete(Main *bmain, Collection *collection, bool hierarchy)
bool BKE_collection_cycle_find(Collection *new_ancestor, Collection *collection)
LayerCollection * CTX_data_layer_collection(const bContext *C)
SpaceOutliner * CTX_wm_space_outliner(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
Main * CTX_data_main(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
wmMsgBus * CTX_wm_message_bus(const bContext *C)
ViewLayer * CTX_data_view_layer(const bContext *C)
LayerCollection * BKE_layer_collection_get_active(ViewLayer *view_layer)
void BKE_view_layer_synced_ensure(const Scene *scene, ViewLayer *view_layer)
bool BKE_layer_collection_objects_select(const Scene *scene, ViewLayer *view_layer, LayerCollection *lc, bool deselect)
Base * BKE_view_layer_active_base_get(ViewLayer *view_layer)
void BKE_layer_collection_set_visible(const Scene *scene, ViewLayer *view_layer, LayerCollection *lc, bool visible, bool hierarchy)
void BKE_layer_collection_isolate_global(Scene *scene, ViewLayer *view_layer, LayerCollection *lc, bool extend)
void BKE_view_layer_need_resync_tag(ViewLayer *view_layer)
Base * BKE_view_layer_base_find(ViewLayer *view_layer, Object *ob)
LayerCollection * BKE_layer_collection_activate_parent(ViewLayer *view_layer, LayerCollection *lc)
void BKE_layer_collection_set_flag(LayerCollection *lc, int flag, bool value)
ListBase * BKE_view_layer_object_bases_get(ViewLayer *view_layer)
bool BKE_id_is_editable(const Main *bmain, const ID *id)
ID * BKE_id_owner_get(ID *id, const bool debug_relationship_assert=true)
void id_fake_user_clear(ID *id)
@ LIB_ID_DUPLICATE_IS_ROOT_ID
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_report(ReportList *reports, eReportType type, const char *message)
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
LinkData * BLI_genericNodeN(void *data)
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE bool BLI_listbase_is_empty(const ListBase *lb)
void void BLI_freelistN(ListBase *listbase) ATTR_NONNULL(1)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void DEG_id_tag_update(ID *id, unsigned int flags)
void DEG_relations_tag_update(Main *bmain)
ID and Library types, which are fundamental for SDNA.
Object groups, one object can be in many groups at once.
@ COLLECTION_HIDE_VIEWPORT
@ LAYER_COLLECTION_EXCLUDE
@ LAYER_COLLECTION_INDIRECT_ONLY
@ LAYER_COLLECTION_HOLDOUT
Object is a sort of wrapper for general info.
@ TSE_VIEW_COLLECTION_BASE
@ TSE_SCENE_COLLECTION_BASE
void ED_outliner_select_sync_from_object_tag(bContext *C)
bool ED_outliner_collections_editor_poll(bContext *C)
bool ED_operator_region_outliner_active(bContext *C)
BMesh const char void * data
static bool is_inside(int x, int y, int cols, int rows)
#define ID_IS_OVERRIDE_LIBRARY_REAL(_id)
#define ID_IS_EDITABLE(_id)
#define ID_IS_OVERRIDE_LIBRARY(_id)
#define ID_IS_OVERRIDE_LIBRARY_HIERARCHY_ROOT(_id)
static void clear(Message &msg)
Object * add_type(bContext *C, int type, const char *name, const float loc[3], const float rot[3], bool enter_editmode, unsigned short local_view_bits) ATTR_NONNULL(1) ATTR_RETURNS_NONNULL
void OUTLINER_OT_collection_duplicate_linked(wmOperatorType *ot)
void OUTLINER_OT_collection_objects_deselect(wmOperatorType *ot)
void OUTLINER_OT_collection_disable_render(wmOperatorType *ot)
static bool collections_exclude_clear_poll(bContext *C)
void OUTLINER_OT_collection_link(wmOperatorType *ot)
void OUTLINER_OT_collection_color_tag_set(wmOperatorType *ot)
void OUTLINER_OT_collection_hierarchy_delete(wmOperatorType *ot)
void OUTLINER_OT_collection_exclude_set(wmOperatorType *ot)
static bool collection_inside_poll(bContext *C)
static TreeTraversalAction collection_collect_data_to_edit(TreeElement *te, void *customdata)
void OUTLINER_OT_collection_show(wmOperatorType *ot)
static wmOperatorStatus collection_isolate_exec(bContext *C, wmOperator *op)
static bool collections_holdout_clear_poll(bContext *C)
bool outliner_is_collection_tree_element(const TreeElement *te)
static wmOperatorStatus collection_new_exec(bContext *C, wmOperator *op)
static TreeElement * outliner_active_collection(bContext *C)
static bool collection_disable_poll(bContext *C)
static wmOperatorStatus collection_objects_select_exec(bContext *C, wmOperator *op)
static TreeTraversalAction outliner_find_first_selected_layer_collection(TreeElement *te, void *customdata)
static wmOperatorStatus collection_visibility_exec(bContext *C, wmOperator *op)
void OUTLINER_OT_collection_indirect_only_clear(wmOperatorType *ot)
void OUTLINER_OT_hide(wmOperatorType *ot)
static bool collections_exclude_set_poll(bContext *C)
void OUTLINER_OT_collection_holdout_set(wmOperatorType *ot)
static bool collection_show_poll(bContext *C)
void OUTLINER_OT_collection_hide(wmOperatorType *ot)
void outliner_collection_isolate_flag(Scene *scene, ViewLayer *view_layer, LayerCollection *layer_collection, Collection *collection, PropertyRNA *layer_or_collection_prop, const char *propname, const bool value)
void OUTLINER_OT_collection_exclude_clear(wmOperatorType *ot)
static bool collections_view_layer_poll(bContext *C, bool clear, int flag)
void OUTLINER_OT_collection_objects_select(wmOperatorType *ot)
static TreeTraversalAction layer_collection_collect_data_to_edit(TreeElement *te, void *customdata)
static LayerCollection * outliner_active_layer_collection(bContext *C)
static wmOperatorStatus collection_instance_exec(bContext *C, wmOperator *)
void outliner_collection_delete(bContext *C, Main *bmain, Scene *scene, ReportList *reports, bool do_hierarchy)
static bool collection_enable_poll(bContext *C)
void outliner_build_tree(Main *mainvar, Scene *scene, ViewLayer *view_layer, SpaceOutliner *space_outliner, ARegion *region)
static bool collections_holdout_set_poll(bContext *C)
static wmOperatorStatus collection_hierarchy_delete_exec(bContext *C, wmOperator *op)
void OUTLINER_OT_unhide_all(wmOperatorType *ot)
void OUTLINER_OT_collection_hide_inside(wmOperatorType *ot)
void OUTLINER_OT_collection_enable(wmOperatorType *ot)
static wmOperatorStatus collection_flag_exec(bContext *C, wmOperator *op)
static bool outliner_view_layer_collections_editor_poll(bContext *C)
static wmOperatorStatus collection_link_exec(bContext *C, wmOperator *op)
TreeTraversalAction outliner_collect_selected_objects(TreeElement *te, void *customdata)
Collection * outliner_collection_from_tree_element(const TreeElement *te)
static bool collections_indirect_only_clear_poll(bContext *C)
static wmOperatorStatus outliner_unhide_all_exec(bContext *C, wmOperator *)
bool outliner_tree_traverse(const SpaceOutliner *space_outliner, ListBase *tree, int filter_te_flag, int filter_tselem_flag, TreeTraversalFunc func, void *customdata)
static bool collections_indirect_only_set_poll(bContext *C)
static TreeTraversalAction outliner_find_first_selected_collection(TreeElement *te, void *customdata)
static TreeTraversalAction collection_find_selected_to_add(TreeElement *te, void *customdata)
static TreeTraversalAction outliner_hide_collect_data_to_edit(TreeElement *te, void *customdata)
static bool collection_disable_render_poll(bContext *C)
void outliner_cleanup_tree(SpaceOutliner *space_outliner)
static bool collection_edit_in_active_scene_poll(bContext *C)
void OUTLINER_OT_collection_holdout_clear(wmOperatorType *ot)
void OUTLINER_OT_collection_duplicate(wmOperatorType *ot)
static bool collection_hide_poll(bContext *C)
void OUTLINER_OT_collection_isolate(wmOperatorType *ot)
void OUTLINER_OT_collection_disable(wmOperatorType *ot)
void OUTLINER_OT_collection_show_inside(wmOperatorType *ot)
static wmOperatorStatus outliner_color_tag_set_exec(bContext *C, wmOperator *op)
static wmOperatorStatus collection_duplicate_exec(bContext *C, wmOperator *op)
static TreeTraversalAction outliner_collect_selected_parent_collections(TreeElement *te, void *customdata)
static wmOperatorStatus outliner_hide_exec(bContext *C, wmOperator *)
static bool collection_flag_poll(bContext *C, bool clear, int flag)
static bool collection_enable_render_poll(bContext *C)
void OUTLINER_OT_collection_new(wmOperatorType *ot)
static bool collection_new_poll(bContext *C)
void OUTLINER_OT_collection_instance(wmOperatorType *ot)
void OUTLINER_OT_collection_indirect_only_set(wmOperatorType *ot)
TreeTraversalAction outliner_collect_selected_collections(TreeElement *te, void *customdata)
static wmOperatorStatus collection_view_layer_exec(bContext *C, wmOperator *op)
void OUTLINER_OT_collection_enable_render(wmOperatorType *ot)
static wmOperatorStatus collection_isolate_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void ED_outliner_selected_objects_get(const bContext *C, ListBase *objects)
bool ED_outliner_collections_editor_poll(bContext *C)
PropertyRNA * RNA_struct_type_find_property(StructRNA *srna, const char *identifier)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
bool RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, bool value)
bool RNA_boolean_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)
const EnumPropertyItem rna_enum_collection_color_items[]
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_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
Collection_Runtime runtime
ListBase layer_collections
struct Collection * collection
struct Collection * instance_collection
struct Collection * master_collection
ListBase layer_collections
bool is_liboverride_hierarchy_root_allowed
SpaceOutliner * space_outliner
Set< LayerCollection * > layer_collections_to_edit
Set< Collection * > collections_to_edit
bool is_liboverride_allowed
LayerCollection * layer_collection
SpaceOutliner * space_outliner
Set< Base * > bases_to_edit
Set< LayerCollection * > collections_to_edit
TreeStoreElem * store_elem
wmEventModifierFlag modifier
struct ReportList * reports
void WM_main_add_notifier(uint type, void *reference)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
#define WM_msg_publish_rna_prop(mbus, id_, data_, type_, prop_)