90 Scene *scene = id_cast<Scene *>(tselem->
id);
94 return id_cast<Collection *>(tselem->
id);
170 data.selected_array.free_no_destruct();
186 return (space_outliner !=
nullptr) &&
243 if (active_te->idcode ==
ID_OB) {
245 bmain, scene,
nullptr,
reinterpret_cast<Object *
>(active_te->store_elem->id));
266 view_layer, new_collection))
274 bool is_textbut_set =
false;
276 TreeStoreElem *tselem = TREESTORE(te);
277 if (Collection *collection = outliner_collection_from_tree_element(te)) {
278 if ((new_collection == collection) && !is_textbut_set) {
279 tselem->flag |= TSE_TEXTBUT;
280 is_textbut_set = true;
296 ot->
name =
"New Collection";
297 ot->
idname =
"OUTLINER_OT_collection_new";
309 ot->
srna,
"nested",
false,
"Nested",
"Add as child of selected collection");
352 if (!(
data->is_liboverride_hierarchy_root_allowed ||
data->is_liboverride_allowed)) {
357 if (!
data->is_liboverride_allowed) {
365 data->collections_to_edit.add(collection);
376 data.space_outliner = space_outliner;
377 data.is_liboverride_allowed =
false;
378 data.is_liboverride_hierarchy_root_allowed = do_hierarchy;
379 data.is_recursive = !do_hierarchy;
429 "Cannot delete collection '%s', it is either a linked one used by other "
430 "linked scenes/collections, or a library override one",
466 ot->
name =
"Delete Hierarchy";
467 ot->
idname =
"OUTLINER_OT_collection_hierarchy_delete";
468 ot->
description =
"Delete selected collection hierarchies";
495 switch (tselem->
type) {
520 return data.layer_collection;
529 bool deselect =
STREQ(op->
idname,
"OUTLINER_OT_collection_objects_deselect");
537 &selected_collections);
562 ot->
name =
"Select Objects";
563 ot->
idname =
"OUTLINER_OT_collection_objects_select";
577 ot->
name =
"Deselect Objects";
578 ot->
idname =
"OUTLINER_OT_collection_objects_deselect";
579 ot->
description =
"Deselect objects in collection";
605 switch (tselem->
type) {
635 const bool linked = strstr(op->
idname,
"linked") !=
nullptr;
644 &selected_collections);
652 int failed_count = 0;
689 (linked ? 0 :
U.dupflag));
694 if (failed_count != 0) {
697 "Unable to duplicate %d of the selected collections. "
698 "Could not find a valid parent collection for the new duplicate, "
699 "they won't be linked to any view layer",
714 ot->
name =
"Duplicate Linked Collection";
715 ot->
idname =
"OUTLINER_OT_collection_duplicate_linked";
717 "Recursively duplicate the collection, all its children and objects, with linked object "
731 ot->
name =
"Duplicate Collection";
732 ot->
idname =
"OUTLINER_OT_collection_duplicate";
734 "Recursively duplicate the collection, all its children, objects and object data";
759 data.space_outliner = space_outliner;
760 data.is_liboverride_allowed =
false;
761 data.is_liboverride_hierarchy_root_allowed =
true;
768 op->
reports,
RPT_ERROR,
"Cannot add a collection to a linked/override collection/scene");
797 ot->
name =
"Link Collection";
798 ot->
idname =
"OUTLINER_OT_collection_link";
799 ot->
description =
"Link selected collections to active scene";
823 data.space_outliner = space_outliner;
824 data.is_liboverride_allowed =
true;
825 data.is_liboverride_hierarchy_root_allowed =
true;
865 ot->
name =
"Instance Collection";
866 ot->
idname =
"OUTLINER_OT_collection_instance";
867 ot->
description =
"Instance selected collections to active scene";
901 data->layer_collections_to_edit.add(lc);
918 data.space_outliner = space_outliner;
919 data.is_liboverride_allowed =
true;
920 data.is_liboverride_hierarchy_root_allowed =
true;
931 if (clear && (lc->
flag & flag)) {
934 else if (!clear && !(lc->
flag & flag)) {
980 data.space_outliner = space_outliner;
981 data.is_liboverride_allowed =
true;
982 data.is_liboverride_hierarchy_root_allowed =
true;
983 bool clear = strstr(op->
idname,
"clear") !=
nullptr;
985 strstr(op->
idname,
"indirect_only") ?
1011 ot->
name =
"Disable from View Layer";
1012 ot->
idname =
"OUTLINER_OT_collection_exclude_set";
1013 ot->
description =
"Exclude collection from the active view layer";
1026 ot->
name =
"Enable in View Layer";
1027 ot->
idname =
"OUTLINER_OT_collection_exclude_clear";
1028 ot->
description =
"Include collection in the active view layer";
1041 ot->
name =
"Set Holdout";
1042 ot->
idname =
"OUTLINER_OT_collection_holdout_set";
1043 ot->
description =
"Mask collection in the active view layer";
1056 ot->
name =
"Clear Holdout";
1057 ot->
idname =
"OUTLINER_OT_collection_holdout_clear";
1058 ot->
description =
"Clear masking of collection in the active view layer";
1071 ot->
name =
"Set Indirect Only";
1072 ot->
idname =
"OUTLINER_OT_collection_indirect_only_set";
1074 "Set collection to only contribute indirectly (through shadows and reflections) in the view "
1088 ot->
name =
"Clear Indirect Only";
1089 ot->
idname =
"OUTLINER_OT_collection_indirect_only_clear";
1090 ot->
description =
"Clear collection contributing only indirectly in the view layer";
1115 data.space_outliner = space_outliner;
1116 data.is_liboverride_allowed =
true;
1117 data.is_liboverride_hierarchy_root_allowed =
true;
1132 &scene->
id, RNA_LayerCollection, layer_collection);
1139 *bmain, scene, view_layer, layer_collection,
nullptr, prop,
"hide_viewport", value);
1165 ot->
name =
"Isolate Collection";
1166 ot->
idname =
"OUTLINER_OT_collection_isolate";
1167 ot->
description =
"Hide all but this collection and its parents";
1179 ot->
srna,
"extend",
false,
"Extend",
"Extend current visible collections");
1207 const bool is_inside = strstr(op->
idname,
"inside") !=
nullptr;
1208 const bool show = strstr(op->
idname,
"show") !=
nullptr;
1211 data.space_outliner = space_outliner;
1212 data.is_liboverride_allowed =
true;
1213 data.is_liboverride_hierarchy_root_allowed =
true;
1236 ot->
name =
"Show Collection";
1237 ot->
idname =
"OUTLINER_OT_collection_show";
1238 ot->
description =
"Show the collection in this view layer";
1251 ot->
name =
"Hide Collection";
1252 ot->
idname =
"OUTLINER_OT_collection_hide";
1253 ot->
description =
"Hide the collection in this view layer";
1266 ot->
name =
"Show Inside Collection";
1267 ot->
idname =
"OUTLINER_OT_collection_show_inside";
1268 ot->
description =
"Show all the objects and collections inside the collection";
1281 ot->
name =
"Hide Inside Collection";
1282 ot->
idname =
"OUTLINER_OT_collection_hide_inside";
1283 ot->
description =
"Hide all the objects and collections inside the collection";
1306 if (te ==
nullptr) {
1311 if (collection ==
nullptr) {
1315 if (clear && (collection->
flag & flag)) {
1318 if (!clear && !(collection->
flag & flag)) {
1351 const bool is_render = strstr(op->
idname,
"render");
1352 const bool clear = strstr(op->
idname,
"show") || strstr(op->
idname,
"enable");
1356 data.space_outliner = space_outliner;
1357 data.is_liboverride_allowed =
true;
1358 data.is_liboverride_hierarchy_root_allowed =
true;
1361 if (has_layer_collection) {
1374 collection->
flag &= ~flag;
1377 collection->
flag |= flag;
1381 if (clear && !is_render) {
1399 collection->
flag &= ~flag;
1402 collection->
flag |= flag;
1421 ot->
name =
"Enable Collection";
1422 ot->
idname =
"OUTLINER_OT_collection_enable";
1423 ot->
description =
"Enable viewport display in the view layers";
1436 ot->
name =
"Disable Collection";
1437 ot->
idname =
"OUTLINER_OT_collection_disable";
1438 ot->
description =
"Disable viewport display in the view layers";
1451 ot->
name =
"Enable Collection in Render";
1452 ot->
idname =
"OUTLINER_OT_collection_enable_render";
1466 ot->
name =
"Disable Collection in Render";
1467 ot->
idname =
"OUTLINER_OT_collection_disable_render";
1468 ot->
description =
"Do not render this collection";
1499 if (tselem ==
nullptr) {
1513 data->collections_to_edit.add(lc);
1518 Object *ob = id_cast<Object *>(tselem->
id);
1521 data->bases_to_edit.add(base);
1537 data.view_layer = view_layer;
1538 data.space_outliner = space_outliner;
1552 for (
Base *base :
data.bases_to_edit) {
1567 ot->
idname =
"OUTLINER_OT_hide";
1568 ot->
description =
"Hide selected objects and collections";
1578 ot->
srna,
"unselected",
false,
"Unselected",
"Hide unselected objects");
1610 ot->
name =
"Unhide All";
1611 ot->
idname =
"OUTLINER_OT_unhide_all";
1612 ot->
description =
"Unhide all objects and collections";
1670 return TIP_(
"Remove Color Tag");
1681 return TIP_(
"Remove color tag from the selected collections");
1689 ot->
name =
"Set Color Tag";
1690 ot->
idname =
"OUTLINER_OT_collection_color_tag_set";
1691 ot->
description =
"Set a color tag for the selected collections";
#define CTX_IFACE_(context, msgid)
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.
Object is a sort of wrapper for general info.
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 all(const SpaceOutliner &space_outliner, const ConstVisitorFn visitor)
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)
bool outliner_tree_traverse(const SpaceOutliner *space_outliner, ListBaseT< TreeElement > *tree, int filter_te_flag, int filter_tselem_flag, TreeTraversalFunc func, void *customdata)
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 std::string outliner_collection_color_tag_set_get_name(wmOperatorType *ot, PointerRNA *properties)
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_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_hide_exec(bContext *C, wmOperator *op)
static std::string outliner_collection_color_tag_set_get_description(bContext *, wmOperatorType *ot, PointerRNA *properties)
static wmOperatorStatus outliner_unhide_all_exec(bContext *C, wmOperator *)
static bool collections_indirect_only_set_poll(bContext *C)
static TreeTraversalAction outliner_find_first_selected_collection(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)
void outliner_collection_isolate_flag(const Main &bmain, Scene *scene, ViewLayer *view_layer, LayerCollection *layer_collection, Collection *collection, PropertyRNA *layer_or_collection_prop, const char *propname, const bool value)
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 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)
TreeElement * outliner_find_element_with_flag(const ListBaseT< TreeElement > *lb, short flag)
void OUTLINER_OT_collection_enable_render(wmOperatorType *ot)
static wmOperatorStatus collection_isolate_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void WM_main_add_notifier(uint type, void *reference)
bool BKE_collection_delete(Main *bmain, Collection *collection, bool hierarchy)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
int RNA_enum_get(PointerRNA *ptr, const char *name)
const EnumPropertyItem rna_enum_collection_color_items[]
Collection * BKE_collection_duplicate(Main *bmain, Collection *parent, CollectionChild *child_old, Collection *collection, eDupli_ID_Flags duplicate_flags, uint duplicate_options)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
bool BKE_layer_collection_activate(ViewLayer *view_layer, LayerCollection *lc)
WorkSpace * CTX_wm_workspace(const bContext *C)
SpaceOutliner * CTX_wm_space_outliner(const bContext *C)
LayerCollection * BKE_layer_collection_get_active(ViewLayer *view_layer)
void ED_outliner_select_sync_from_collection_tag(bContext *C)
bool BKE_collection_child_add(Main *bmain, Collection *parent, Collection *child)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
Base * BKE_view_layer_active_base_get(ViewLayer *view_layer)
void BKE_view_layer_need_resync_tag(ViewLayer *view_layer)
@ TSE_VIEW_COLLECTION_BASE
@ TSE_SCENE_COLLECTION_BASE
ViewLayer * CTX_data_view_layer(const bContext *C)
void ED_outliner_select_sync_from_object_tag(bContext *C)
void BKE_layer_collection_set_flag(LayerCollection *lc, eLayerCollection_Flag flag, bool value)
bool RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop)
@ LIB_ID_DUPLICATE_IS_ROOT_ID
Collection * BKE_collection_object_find(Main *bmain, Scene *scene, Collection *collection, Object *ob)
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
bool ED_outliner_collections_editor_poll(bContext *C)
void DEG_id_tag_update(ID *id, unsigned int flags)
void BKE_layer_collection_isolate_global(Scene *scene, ViewLayer *view_layer, LayerCollection *lc, bool extend)
void BKE_report(ReportList *reports, eReportType type, const char *message)
BMesh const char void * data
@ LAYER_COLLECTION_INDIRECT_ONLY
@ LAYER_COLLECTION_EXCLUDE
@ LAYER_COLLECTION_HOLDOUT
CollectionChild * BKE_collection_child_find(Collection *parent, Collection *collection)
bool BKE_view_layer_synced_ensure(const Main &bmain, const Scene *scene, ViewLayer *view_layer)
void ED_outliner_selected_objects_get(const bContext *C, ListBaseT< LinkData > *objects)
LayerCollection * BKE_layer_collection_first_from_scene_collection(const ViewLayer *view_layer, const Collection *collection)
LinkData * BLI_genericNodeN(void *data)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
PropertyRNA * RNA_struct_type_find_property(StructRNA *srna, const char *identifier)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
wmMsgBus * CTX_wm_message_bus(const bContext *C)
bool BKE_collection_cycle_find(Collection *new_ancestor, Collection *collection)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Main * CTX_data_main(const bContext *C)
@ COLLECTION_HIDE_VIEWPORT
void ED_outliner_select_sync_flag_outliners(const bContext *C)
ID_Type GS(const char *name)
Base * BKE_view_layer_base_find(ViewLayer *view_layer, Object *ob)
LayerCollection * BKE_layer_collection_activate_parent(ViewLayer *view_layer, LayerCollection *lc)
bool BKE_layer_collection_objects_select(const Main &bmain, const Scene *scene, ViewLayer *view_layer, LayerCollection *lc, bool deselect)
ID * BKE_id_owner_get(ID *id, const bool debug_relationship_assert=true)
void DEG_relations_tag_update(Main *bmain)
void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, bool value)
Scene * CTX_data_scene(const bContext *C)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
bool ED_operator_region_outliner_active(bContext *C)
bool BKE_id_is_editable(const Main *bmain, const ID *id)
void id_fake_user_clear(ID *id)
ARegion * CTX_wm_region(const bContext *C)
ListBaseT< Base > * BKE_view_layer_object_bases_get(ViewLayer *view_layer)
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
LayerCollection * CTX_data_layer_collection(const bContext *C)
void BKE_layer_collection_set_visible(const Main &bmain, const Scene *scene, ViewLayer *view_layer, LayerCollection *lc, bool visible, bool hierarchy)
Collection * BKE_collection_add(Main *bmain, Collection *collection_parent, const char *name_custom)
struct Collection * collection
bke::CollectionRuntime * runtime
CollectionColorTag color_tag
eLayerCollection_Flag flag
struct Collection * collection
ListBaseT< LayerCollection > layer_collections
ListBaseT< Collection > collections
eObject_TransFlag transflag
struct Collection * instance_collection
struct Collection * master_collection
eSpaceOutliner_Mode outlinevis
ed::outliner::SpaceOutliner_Runtime * runtime
ListBaseT< LayerCollection > layer_collections
LayerCollection * active_collection
ListBaseT< CollectionParent > parents
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
ListBaseT< LinkData > selected_array
SpaceOutliner * space_outliner
Set< Base * > bases_to_edit
Set< LayerCollection * > collections_to_edit
ListBaseT< ed::outliner::TreeElement > tree
TreeStoreElem * store_elem
wmEventModifierFlag modifier
wmOperatorStatus(*) exec(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
const char * translation_context
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) invoke(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
std::string(*) get_description(bContext *C, wmOperatorType *ot, PointerRNA *ptr)
std::string(*) get_name(wmOperatorType *ot, PointerRNA *ptr)
struct ReportList * reports
#define WM_msg_publish_rna_prop(mbus, id_, data_, type_, prop_)