153 &space_outliner->
tree,
179 return (space_outliner !=
nullptr) &&
234 if (
data->collection !=
nullptr) {
239 data->collection = collection;
258 &space_outliner->
tree,
294 ot->name =
"New Collection";
295 ot->idname =
"OUTLINER_OT_collection_new";
296 ot->description =
"Add a new collection inside selected collection";
307 ot->srna,
"nested",
true,
"Nested",
"Add as child of selected collection");
350 if (!(
data->is_liboverride_hierarchy_root_allowed ||
data->is_liboverride_allowed)) {
355 if (!
data->is_liboverride_allowed) {
363 data->collections_to_edit.add(collection);
374 data.space_outliner = space_outliner;
375 data.is_liboverride_allowed =
false;
376 data.is_liboverride_hierarchy_root_allowed = do_hierarchy;
377 data.is_recursive = !do_hierarchy;
382 &space_outliner->
tree,
427 "Cannot delete collection '%s', it is either a linked one used by other "
428 "linked scenes/collections, or a library override one",
464 ot->name =
"Delete Hierarchy";
465 ot->idname =
"OUTLINER_OT_collection_hierarchy_delete";
466 ot->description =
"Delete selected collection hierarchies";
493 switch (tselem->
type) {
513 &space_outliner->
tree,
518 return data.layer_collection;
526 bool deselect =
STREQ(op->
idname,
"OUTLINER_OT_collection_objects_deselect");
530 &space_outliner->
tree,
534 &selected_collections);
559 ot->name =
"Select Objects";
560 ot->idname =
"OUTLINER_OT_collection_objects_select";
561 ot->description =
"Select objects in collection";
574 ot->name =
"Deselect Objects";
575 ot->idname =
"OUTLINER_OT_collection_objects_deselect";
576 ot->description =
"Deselect objects in collection";
602 switch (tselem->
type) {
621 &space_outliner->
tree,
632 const bool linked = strstr(op->
idname,
"linked") !=
nullptr;
637 &space_outliner->
tree,
641 &selected_collections);
649 int failed_count = 0;
686 (linked ? 0 :
U.dupflag));
691 if (failed_count != 0) {
694 "Unable to duplicate %d of the selected collections. "
695 "Could not find a valid parent collection for the new duplicate, "
696 "they won't be linked to any view layer",
711 ot->name =
"Duplicate Linked Collection";
712 ot->idname =
"OUTLINER_OT_collection_duplicate_linked";
714 "Recursively duplicate the collection, all its children and objects, with linked object "
728 ot->name =
"Duplicate Collection";
729 ot->idname =
"OUTLINER_OT_collection_duplicate";
731 "Recursively duplicate the collection, all its children, objects and object data";
756 data.space_outliner = space_outliner;
757 data.is_liboverride_allowed =
false;
758 data.is_liboverride_hierarchy_root_allowed =
true;
765 op->
reports,
RPT_ERROR,
"Cannot add a collection to a linked/override collection/scene");
771 &space_outliner->
tree,
794 ot->name =
"Link Collection";
795 ot->idname =
"OUTLINER_OT_collection_link";
796 ot->description =
"Link selected collections to active scene";
820 data.space_outliner = space_outliner;
821 data.is_liboverride_allowed =
true;
822 data.is_liboverride_hierarchy_root_allowed =
true;
827 &space_outliner->
tree,
861 ot->name =
"Instance Collection";
862 ot->idname =
"OUTLINER_OT_collection_instance";
863 ot->description =
"Instance selected collections to active scene";
897 data->layer_collections_to_edit.add(lc);
914 data.space_outliner = space_outliner;
915 data.is_liboverride_allowed =
true;
916 data.is_liboverride_hierarchy_root_allowed =
true;
920 &space_outliner->
tree,
976 data.space_outliner = space_outliner;
977 data.is_liboverride_allowed =
true;
978 data.is_liboverride_hierarchy_root_allowed =
true;
979 bool clear = strstr(op->
idname,
"clear") !=
nullptr;
985 &space_outliner->
tree,
1006 ot->name =
"Disable from View Layer";
1007 ot->idname =
"OUTLINER_OT_collection_exclude_set";
1008 ot->description =
"Exclude collection from the active view layer";
1021 ot->name =
"Enable in View Layer";
1022 ot->idname =
"OUTLINER_OT_collection_exclude_clear";
1023 ot->description =
"Include collection in the active view layer";
1036 ot->name =
"Set Holdout";
1037 ot->idname =
"OUTLINER_OT_collection_holdout_set";
1038 ot->description =
"Mask collection in the active view layer";
1051 ot->name =
"Clear Holdout";
1052 ot->idname =
"OUTLINER_OT_collection_holdout_clear";
1053 ot->description =
"Clear masking of collection in the active view layer";
1066 ot->name =
"Set Indirect Only";
1067 ot->idname =
"OUTLINER_OT_collection_indirect_only_set";
1069 "Set collection to only contribute indirectly (through shadows and reflections) in the view "
1083 ot->name =
"Clear Indirect Only";
1084 ot->idname =
"OUTLINER_OT_collection_indirect_only_clear";
1085 ot->description =
"Clear collection contributing only indirectly in the view layer";
1109 data.space_outliner = space_outliner;
1110 data.is_liboverride_allowed =
true;
1111 data.is_liboverride_hierarchy_root_allowed =
true;
1113 &space_outliner->
tree,
1126 &scene->
id, &RNA_LayerCollection, layer_collection);
1133 scene, view_layer, layer_collection,
nullptr, prop,
"hide_viewport", value);
1159 ot->name =
"Isolate Collection";
1160 ot->idname =
"OUTLINER_OT_collection_isolate";
1161 ot->description =
"Hide all but this collection and its parents";
1173 ot->srna,
"extend",
false,
"Extend",
"Extend current visible collections");
1201 const bool show = strstr(op->
idname,
"show") !=
nullptr;
1204 data.space_outliner = space_outliner;
1205 data.is_liboverride_allowed =
true;
1206 data.is_liboverride_hierarchy_root_allowed =
true;
1209 &space_outliner->
tree,
1229 ot->name =
"Show Collection";
1230 ot->idname =
"OUTLINER_OT_collection_show";
1231 ot->description =
"Show the collection in this view layer";
1244 ot->name =
"Hide Collection";
1245 ot->idname =
"OUTLINER_OT_collection_hide";
1246 ot->description =
"Hide the collection in this view layer";
1259 ot->name =
"Show Inside Collection";
1260 ot->idname =
"OUTLINER_OT_collection_show_inside";
1261 ot->description =
"Show all the objects and collections inside the collection";
1274 ot->name =
"Hide Inside Collection";
1275 ot->idname =
"OUTLINER_OT_collection_hide_inside";
1276 ot->description =
"Hide all the objects and collections inside the collection";
1299 if (te ==
nullptr) {
1304 if (collection ==
nullptr) {
1344 const bool is_render = strstr(op->
idname,
"render");
1349 data.space_outliner = space_outliner;
1350 data.is_liboverride_allowed =
true;
1351 data.is_liboverride_hierarchy_root_allowed =
true;
1354 if (has_layer_collection) {
1356 &space_outliner->
tree,
1374 if (
clear && !is_render) {
1381 &space_outliner->
tree,
1414 ot->name =
"Enable Collection";
1415 ot->idname =
"OUTLINER_OT_collection_enable";
1416 ot->description =
"Enable viewport display in the view layers";
1429 ot->name =
"Disable Collection";
1430 ot->idname =
"OUTLINER_OT_collection_disable";
1431 ot->description =
"Disable viewport display in the view layers";
1444 ot->name =
"Enable Collection in Render";
1445 ot->idname =
"OUTLINER_OT_collection_enable_render";
1446 ot->description =
"Render the collection";
1459 ot->name =
"Disable Collection in Render";
1460 ot->idname =
"OUTLINER_OT_collection_disable_render";
1461 ot->description =
"Do not render this collection";
1490 if (tselem ==
nullptr) {
1504 data->collections_to_edit.add(lc);
1511 data->bases_to_edit.add(base);
1524 data.view_layer = view_layer;
1525 data.space_outliner = space_outliner;
1528 &space_outliner->
tree,
1538 for (
Base *base :
data.bases_to_edit) {
1553 ot->idname =
"OUTLINER_OT_hide";
1554 ot->description =
"Hide selected objects and collections";
1591 ot->name =
"Unhide All";
1592 ot->idname =
"OUTLINER_OT_unhide_all";
1593 ot->description =
"Unhide all objects and collections";
1618 &space_outliner->
tree,
1649 ot->name =
"Set Color Tag";
1650 ot->idname =
"OUTLINER_OT_collection_color_tag_set";
1651 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)
WorkSpace * CTX_wm_workspace(const bContext *C)
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.
#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)
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)
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)
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)
void outliner_build_tree(Main *mainvar, WorkSpace *workspace, Scene *scene, ViewLayer *view_layer, SpaceOutliner *space_outliner, ARegion *region)
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)
CollectionRuntimeHandle * 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_)