130 &space_outliner->
tree,
152 return (space_outliner !=
nullptr) &&
194 if (
data->collection !=
nullptr) {
217 &space_outliner->
tree,
252 ot->
name =
"New Collection";
253 ot->
idname =
"OUTLINER_OT_collection_new";
254 ot->
description =
"Add a new collection inside selected collection";
265 ot->
srna,
"nested",
true,
"Nested",
"Add as child of selected collection");
304 if (!(
data->is_liboverride_hierarchy_root_allowed ||
data->is_liboverride_allowed)) {
309 if (!
data->is_liboverride_allowed) {
328 data.space_outliner = space_outliner;
329 data.is_liboverride_allowed =
false;
330 data.is_liboverride_hierarchy_root_allowed = do_hierarchy;
341 GSET_ITER (collections_to_edit_iter,
data.collections_to_edit) {
384 "Cannot delete collection '%s', it is either a linked one used by other "
385 "linked scenes/collections, or a library override one",
409 if (basact_prev !=
BASACT(view_layer)) {
421 ot->
name =
"Delete Hierarchy";
422 ot->
idname =
"OUTLINER_OT_collection_hierarchy_delete";
450 switch (tselem->
type) {
470 &space_outliner->
tree,
475 return data.layer_collection;
482 bool deselect =
STREQ(op->
idname,
"OUTLINER_OT_collection_objects_deselect");
484 if (layer_collection ==
nullptr) {
501 ot->
name =
"Select Objects";
502 ot->
idname =
"OUTLINER_OT_collection_objects_select";
516 ot->
name =
"Deselect Objects";
517 ot->
idname =
"OUTLINER_OT_collection_objects_deselect";
544 switch (tselem->
type) {
563 &space_outliner->
tree,
575 const bool linked = strstr(op->
idname,
"linked") !=
nullptr;
617 if (parent ==
nullptr) {
620 "Could not find a valid parent collection for the new duplicate, "
621 "it won't be linked to any view layer");
625 (linked ? 0 :
U.dupflag));
638 ot->
name =
"Duplicate Linked Collection";
639 ot->
idname =
"OUTLINER_OT_collection_duplicate_linked";
641 "Recursively duplicate the collection, all its children and objects, with linked object "
655 ot->
name =
"Duplicate Collection";
656 ot->
idname =
"OUTLINER_OT_collection_duplicate";
658 "Recursively duplicate the collection, all its children, objects and object data";
683 data.space_outliner = space_outliner;
684 data.is_liboverride_allowed =
false;
685 data.is_liboverride_hierarchy_root_allowed =
true;
691 op->
reports,
RPT_ERROR,
"Cannot add a collection to a linked/override collection/scene");
703 GSET_ITER (collections_to_edit_iter,
data.collections_to_edit) {
723 ot->
name =
"Link Collection";
724 ot->
idname =
"OUTLINER_OT_collection_link";
725 ot->
description =
"Link selected collections to active scene";
749 data.space_outliner = space_outliner;
750 data.is_liboverride_allowed =
false;
751 data.is_liboverride_hierarchy_root_allowed =
true;
764 GSET_ITER (collections_to_edit_iter,
data.collections_to_edit) {
774 GSET_ITER (collections_to_edit_iter,
data.collections_to_edit) {
797 ot->
name =
"Instance Collection";
798 ot->
idname =
"OUTLINER_OT_collection_instance";
799 ot->
description =
"Instance selected collections to active scene";
850 data.space_outliner = space_outliner;
851 data.is_liboverride_allowed =
true;
852 data.is_liboverride_hierarchy_root_allowed =
true;
857 &space_outliner->
tree,
864 GSET_ITER (collections_to_edit_iter,
data.collections_to_edit) {
918 data.space_outliner = space_outliner;
919 data.is_liboverride_allowed =
true;
920 data.is_liboverride_hierarchy_root_allowed =
true;
921 bool clear = strstr(op->
idname,
"clear") !=
nullptr;
929 &space_outliner->
tree,
936 GSET_ITER (collections_to_edit_iter,
data.collections_to_edit) {
955 ot->
name =
"Disable from View Layer";
956 ot->
idname =
"OUTLINER_OT_collection_exclude_set";
957 ot->
description =
"Exclude collection from the active view layer";
970 ot->
name =
"Enable in View Layer";
971 ot->
idname =
"OUTLINER_OT_collection_exclude_clear";
972 ot->
description =
"Include collection in the active view layer";
986 ot->
idname =
"OUTLINER_OT_collection_holdout_set";
987 ot->
description =
"Mask collection in the active view layer";
1000 ot->
name =
"Clear Holdout";
1001 ot->
idname =
"OUTLINER_OT_collection_holdout_clear";
1002 ot->
description =
"Clear masking of collection in the active view layer";
1015 ot->
name =
"Set Indirect Only";
1016 ot->
idname =
"OUTLINER_OT_collection_indirect_only_set";
1018 "Set collection to only contribute indirectly (through shadows and reflections) in the view "
1032 ot->
name =
"Clear Indirect Only";
1033 ot->
idname =
"OUTLINER_OT_collection_indirect_only_clear";
1034 ot->
description =
"Clear collection contributing only indirectly in the view layer";
1058 data.space_outliner = space_outliner;
1059 data.is_liboverride_allowed =
true;
1060 data.is_liboverride_hierarchy_root_allowed =
true;
1063 &space_outliner->
tree,
1070 GSET_ITER (collections_to_edit_iter,
data.collections_to_edit) {
1087 scene, view_layer, layer_collection,
nullptr, prop,
"hide_viewport", value);
1112 ot->
name =
"Isolate Collection";
1113 ot->
idname =
"OUTLINER_OT_collection_isolate";
1114 ot->
description =
"Hide all but this collection and its parents";
1126 ot->
srna,
"extend",
false,
"Extend",
"Extend current visible collections");
1154 const bool show = strstr(op->
idname,
"show") !=
nullptr;
1157 data.space_outliner = space_outliner;
1158 data.is_liboverride_allowed =
true;
1159 data.is_liboverride_hierarchy_root_allowed =
true;
1163 &space_outliner->
tree,
1170 GSET_ITER (collections_to_edit_iter,
data.collections_to_edit) {
1187 ot->
name =
"Show Collection";
1188 ot->
idname =
"OUTLINER_OT_collection_show";
1202 ot->
name =
"Hide Collection";
1203 ot->
idname =
"OUTLINER_OT_collection_hide";
1217 ot->
name =
"Show Inside Collection";
1218 ot->
idname =
"OUTLINER_OT_collection_show_inside";
1219 ot->
description =
"Show all the objects and collections inside the collection";
1232 ot->
name =
"Hide Inside Collection";
1233 ot->
idname =
"OUTLINER_OT_collection_hide_inside";
1234 ot->
description =
"Hide all the objects and collections inside the collection";
1257 if (te ==
nullptr) {
1262 if (collection ==
nullptr) {
1266 if (
clear && (collection->
flag & flag)) {
1269 if (!
clear && !(collection->
flag & flag)) {
1302 const bool is_render = strstr(op->
idname,
"render");
1307 data.space_outliner = space_outliner;
1308 data.is_liboverride_allowed =
true;
1309 data.is_liboverride_hierarchy_root_allowed =
true;
1313 if (has_layer_collection) {
1315 &space_outliner->
tree,
1321 GSET_ITER (collections_to_edit_iter,
data.collections_to_edit) {
1329 collection->
flag &= ~flag;
1332 collection->
flag |= flag;
1336 if (
clear && !is_render) {
1344 &space_outliner->
tree,
1350 GSET_ITER (collections_to_edit_iter,
data.collections_to_edit) {
1358 collection->
flag &= ~flag;
1361 collection->
flag |= flag;
1381 ot->
name =
"Enable Collection";
1382 ot->
idname =
"OUTLINER_OT_collection_enable";
1383 ot->
description =
"Enable viewport display in the view layers";
1396 ot->
name =
"Disable Collection";
1397 ot->
idname =
"OUTLINER_OT_collection_disable";
1398 ot->
description =
"Disable viewport display in the view layers";
1411 ot->
name =
"Enable Collection in Render";
1412 ot->
idname =
"OUTLINER_OT_collection_enable_render";
1426 ot->
name =
"Disable Collection in Render";
1427 ot->
idname =
"OUTLINER_OT_collection_disable_render";
1457 if (tselem ==
nullptr) {
1490 data.view_layer = view_layer;
1491 data.space_outliner = space_outliner;
1496 &space_outliner->
tree,
1503 GSET_ITER (collections_to_edit_iter,
data.collections_to_edit) {
1567 ot->
idname =
"OUTLINER_OT_unhide_all";
1593 &space_outliner->
tree,
1611 collection->color_tag = color_tag;
1624 ot->
name =
"Set Color Tag";
1625 ot->
idname =
"OUTLINER_OT_collection_color_tag_set";
1626 ot->
description =
"Set a color tag for the selected collections";
struct Collection * BKE_collection_add(struct Main *bmain, struct Collection *parent, const char *name)
bool BKE_collection_cycle_find(struct Collection *new_ancestor, struct Collection *collection)
bool BKE_collection_child_add(struct Main *bmain, struct Collection *parent, struct Collection *child)
struct Collection * BKE_collection_duplicate(struct Main *bmain, struct Collection *parent, struct Collection *collection, uint duplicate_flags, uint duplicate_options)
bool BKE_collection_delete(struct Main *bmain, struct Collection *collection, bool hierarchy)
struct Scene * CTX_data_scene(const bContext *C)
struct SpaceOutliner * CTX_wm_space_outliner(const bContext *C)
struct LayerCollection * CTX_data_layer_collection(const bContext *C)
struct ViewLayer * CTX_data_view_layer(const bContext *C)
struct wmMsgBus * CTX_wm_message_bus(const bContext *C)
struct ARegion * CTX_wm_region(const bContext *C)
struct Main * CTX_data_main(const bContext *C)
const struct IDTypeInfo * BKE_idtype_get_info_from_id(const struct ID *id)
void BKE_layer_collection_set_flag(struct LayerCollection *lc, int flag, bool value)
bool BKE_layer_collection_objects_select(struct ViewLayer *view_layer, struct LayerCollection *lc, bool deselect)
struct LayerCollection * BKE_layer_collection_get_active(struct ViewLayer *view_layer)
void BKE_layer_collection_isolate_global(struct Scene *scene, struct ViewLayer *view_layer, struct LayerCollection *lc, bool extend)
struct LayerCollection * BKE_layer_collection_activate_parent(struct ViewLayer *view_layer, struct LayerCollection *lc)
struct Base * BKE_view_layer_base_find(struct ViewLayer *view_layer, struct Object *ob)
void BKE_layer_collection_sync(const struct Scene *scene, struct ViewLayer *view_layer)
void BKE_layer_collection_set_visible(struct ViewLayer *view_layer, struct LayerCollection *lc, bool visible, bool hierarchy)
bool BKE_id_is_editable(const struct Main *bmain, const struct ID *id)
void id_lib_extern(struct ID *id)
void id_us_plus(struct ID *id)
void id_fake_user_clear(struct 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)
GSet * BLI_gset_ptr_new(const char *info)
#define GSET_ITER(gs_iter_, gset_)
void BLI_gset_free(GSet *gs, GSetKeyFreeFP keyfreefp)
BLI_INLINE void * BLI_gsetIterator_getKey(GSetIterator *gsi)
bool BLI_gset_add(GSet *gs, void *key)
#define LISTBASE_FOREACH(type, var, list)
struct LinkData * BLI_genericNodeN(void *data)
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void DEG_id_tag_update(struct ID *id, int flag)
void DEG_relations_tag_update(struct Main *bmain)
ID and Library types, which are fundamental for sdna.
@ ID_RECALC_COPY_ON_WRITE
#define ID_IS_OVERRIDE_LIBRARY_REAL(_id)
#define ID_IS_LINKED(_id)
#define ID_IS_OVERRIDE_LIBRARY(_id)
#define ID_IS_OVERRIDE_LIBRARY_HIERARCHY_ROOT(_id)
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
#define BASACT(_view_layer)
struct Object * ED_object_add_type(struct 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 ED_outliner_select_sync_from_object_tag(struct bContext *C)
static bool is_inside(int x, int y, int cols, int rows)
static void clear(Message *msg)
bool active
all scheduled work for the GPU.
static bool outliner_view_layer_collections_editor_poll(bContext *C)
static bool collections_indirect_only_clear_poll(bContext *C)
void OUTLINER_OT_collection_disable(wmOperatorType *ot)
static int collection_new_exec(bContext *C, wmOperator *op)
void OUTLINER_OT_collection_show_inside(wmOperatorType *ot)
void OUTLINER_OT_collection_objects_deselect(wmOperatorType *ot)
static int collection_isolate_exec(bContext *C, wmOperator *op)
static bool collections_exclude_set_poll(bContext *C)
void OUTLINER_OT_collection_duplicate_linked(wmOperatorType *ot)
static bool collections_holdout_clear_poll(bContext *C)
Collection * outliner_collection_from_tree_element(const TreeElement *te)
static TreeTraversalAction collection_find_selected_to_add(TreeElement *te, void *customdata)
void OUTLINER_OT_unhide_all(wmOperatorType *ot)
void OUTLINER_OT_collection_instance(wmOperatorType *ot)
static bool collections_indirect_only_set_poll(bContext *C)
static bool collection_hide_poll(bContext *C)
static bool collection_enable_poll(bContext *C)
static bool collections_view_layer_poll(bContext *C, bool clear, int flag)
void OUTLINER_OT_collection_holdout_set(wmOperatorType *ot)
static TreeTraversalAction outliner_find_first_selected_collection(TreeElement *te, void *customdata)
void OUTLINER_OT_collection_exclude_set(wmOperatorType *ot)
static int collection_visibility_exec(bContext *C, wmOperator *op)
void ED_outliner_selected_objects_get(const bContext *C, ListBase *objects)
static int collection_flag_exec(bContext *C, wmOperator *op)
void OUTLINER_OT_collection_objects_select(wmOperatorType *ot)
static bool collections_exclude_clear_poll(bContext *C)
TreeTraversalAction outliner_find_selected_collections(TreeElement *te, void *customdata)
void OUTLINER_OT_collection_new(wmOperatorType *ot)
bool ED_outliner_collections_editor_poll(bContext *C)
static int collection_isolate_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static TreeTraversalAction outliner_find_first_selected_layer_collection(TreeElement *te, void *customdata)
void OUTLINER_OT_collection_duplicate(wmOperatorType *ot)
TreeTraversalAction outliner_find_selected_objects(TreeElement *te, void *customdata)
void OUTLINER_OT_collection_hide_inside(wmOperatorType *ot)
static bool collection_show_poll(bContext *C)
void OUTLINER_OT_collection_holdout_clear(wmOperatorType *ot)
void OUTLINER_OT_collection_indirect_only_clear(wmOperatorType *ot)
void OUTLINER_OT_collection_disable_render(wmOperatorType *ot)
static TreeTraversalAction layer_collection_find_data_to_edit(TreeElement *te, void *customdata)
void OUTLINER_OT_collection_hide(wmOperatorType *ot)
static TreeTraversalAction collection_find_data_to_edit(TreeElement *te, void *customdata)
static bool collection_disable_poll(bContext *C)
static TreeElement * outliner_active_collection(bContext *C)
static int outliner_hide_exec(bContext *C, wmOperator *UNUSED(op))
void OUTLINER_OT_collection_exclude_clear(wmOperatorType *ot)
static int collection_objects_select_exec(bContext *C, wmOperator *op)
static int collection_hierarchy_delete_exec(bContext *C, wmOperator *op)
static bool collections_holdout_set_poll(bContext *C)
static int collection_link_exec(bContext *C, wmOperator *op)
bool outliner_is_collection_tree_element(const TreeElement *te)
static int collection_instance_exec(bContext *C, wmOperator *UNUSED(op))
void OUTLINER_OT_collection_enable_render(wmOperatorType *ot)
static bool collection_enable_render_poll(bContext *C)
static LayerCollection * outliner_active_layer_collection(bContext *C)
void OUTLINER_OT_collection_enable(wmOperatorType *ot)
static int outliner_unhide_all_exec(bContext *C, wmOperator *UNUSED(op))
void OUTLINER_OT_collection_indirect_only_set(wmOperatorType *ot)
void outliner_collection_delete(bContext *C, Main *bmain, Scene *scene, ReportList *reports, bool do_hierarchy)
static TreeTraversalAction outliner_hide_find_data_to_edit(TreeElement *te, void *customdata)
static bool collection_edit_in_active_scene_poll(bContext *C)
void OUTLINER_OT_hide(wmOperatorType *ot)
static int collection_duplicate_exec(bContext *C, wmOperator *op)
void OUTLINER_OT_collection_color_tag_set(wmOperatorType *ot)
static bool collection_inside_poll(bContext *C)
static bool collection_disable_render_poll(bContext *C)
void OUTLINER_OT_collection_hierarchy_delete(wmOperatorType *ot)
static int collection_view_layer_exec(bContext *C, wmOperator *op)
static bool collection_flag_poll(bContext *C, bool clear, int flag)
void OUTLINER_OT_collection_isolate(wmOperatorType *ot)
void OUTLINER_OT_collection_show(wmOperatorType *ot)
static int outliner_color_tag_set_exec(bContext *C, wmOperator *op)
void OUTLINER_OT_collection_link(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)
bool outliner_tree_traverse(const SpaceOutliner *space_outliner, ListBase *tree, int filter_te_flag, int filter_tselem_flag, TreeTraversalFunc func, void *customdata)
void outliner_build_tree(struct Main *mainvar, struct Scene *scene, struct ViewLayer *view_layer, struct SpaceOutliner *space_outliner, struct ARegion *region)
void outliner_cleanup_tree(struct SpaceOutliner *space_outliner)
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
bool RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop)
PropertyRNA * RNA_struct_type_find_property(StructRNA *srna, const char *identifier)
void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, bool value)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
int RNA_enum_get(PointerRNA *ptr, const char *name)
const EnumPropertyItem rna_enum_collection_color_items[]
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
SpaceOutliner * space_outliner
bool is_liboverride_allowed
bool is_liboverride_hierarchy_root_allowed
GSet * collections_to_edit
LayerCollection * layer_collection
IDTypeEmbeddedOwnerGetFunction owner_get
ListBase layer_collections
struct Collection * collection
struct Collection * instance_collection
SpaceOutliner * space_outliner
GSet * collections_to_edit
struct Collection * master_collection
struct TreeElement * parent
ListBase layer_collections
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
void WM_main_add_notifier(unsigned int 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_)