Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'release/scripts/startup/bl_ui/space_outliner.py')
-rw-r--r--release/scripts/startup/bl_ui/space_outliner.py88
1 files changed, 73 insertions, 15 deletions
diff --git a/release/scripts/startup/bl_ui/space_outliner.py b/release/scripts/startup/bl_ui/space_outliner.py
index fff252ade01..2b60158e3ae 100644
--- a/release/scripts/startup/bl_ui/space_outliner.py
+++ b/release/scripts/startup/bl_ui/space_outliner.py
@@ -2,6 +2,11 @@
import bpy
from bpy.types import Header, Menu, Panel
+from bpy.app.translations import (
+ contexts as i18n_contexts,
+ pgettext_iface as iface_,
+)
+
class OUTLINER_HT_header(Header):
bl_space_type = 'OUTLINER'
@@ -25,8 +30,15 @@ class OUTLINER_HT_header(Header):
layout.separator_spacer()
- row = layout.row(align=True)
- row.prop(space, "filter_text", icon='VIEWZOOM', text="")
+ filter_text_supported = True
+ # No text filtering for library override hierarchies. The tree is lazy built to avoid
+ # performance issues in complex files.
+ if display_mode == 'LIBRARY_OVERRIDES' and space.lib_override_view_mode == 'HIERARCHIES':
+ filter_text_supported = False
+
+ if filter_text_supported:
+ row = layout.row(align=True)
+ row.prop(space, "filter_text", icon='VIEWZOOM', text="")
layout.separator_spacer()
@@ -41,11 +53,8 @@ class OUTLINER_HT_header(Header):
text="",
icon='FILTER',
)
- if display_mode == 'LIBRARY_OVERRIDES' and space.lib_override_view_mode == 'HIERARCHIES':
- # Don't add ID type filter for library overrides hierarchies mode. Point of it is to see a hierarchy that is
- # usually constructed out of different ID types.
- pass
- elif display_mode in {'LIBRARIES', 'LIBRARY_OVERRIDES', 'ORPHAN_DATA'}:
+
+ if display_mode in {'LIBRARIES' 'ORPHAN_DATA'}:
row.prop(space, "use_filter_id_type", text="", icon='FILTER')
sub = row.row(align=True)
sub.active = space.use_filter_id_type
@@ -55,7 +64,7 @@ class OUTLINER_HT_header(Header):
layout.operator("outliner.collection_new", text="", icon='COLLECTION_NEW').nested = True
elif display_mode == 'ORPHAN_DATA':
- layout.operator("outliner.orphans_purge", text="Purge")
+ layout.operator("outliner.orphans_purge", text="Purge").do_recursive = True
elif space.display_mode == 'DATA_API':
layout.separator()
@@ -97,6 +106,10 @@ class OUTLINER_MT_context_menu(Menu):
layout.separator()
+ layout.menu("OUTLINER_MT_liboverride")
+
+ layout.separator()
+
layout.menu("OUTLINER_MT_context_menu_view")
layout.separator()
@@ -207,7 +220,8 @@ class OUTLINER_MT_collection(Menu):
space = context.space_data
- layout.operator("outliner.collection_new", text="New").nested = True
+ layout.operator("outliner.collection_new", text="New",
+ text_ctxt=i18n_contexts.id_collection).nested = True
layout.operator("outliner.collection_duplicate", text="Duplicate Collection")
layout.operator("outliner.collection_duplicate_linked", text="Duplicate Linked")
layout.operator("outliner.id_copy", text="Copy", icon='COPYDOWN')
@@ -309,9 +323,22 @@ class OUTLINER_MT_object(Menu):
OUTLINER_MT_context_menu.draw_common_operators(layout)
+def has_selected_ids_in_context(context):
+ if hasattr(context, "id"):
+ return True
+ if len(context.selected_ids) > 0:
+ return True
+
+ return False
+
+
class OUTLINER_MT_asset(Menu):
bl_label = "Assets"
+ @classmethod
+ def poll(cls, context):
+ return has_selected_ids_in_context(context)
+
def draw(self, _context):
layout = self.layout
@@ -320,6 +347,31 @@ class OUTLINER_MT_asset(Menu):
layout.operator("asset.clear", text="Clear Asset (Set Fake User)").set_fake_user = True
+class OUTLINER_MT_liboverride(Menu):
+ bl_label = "Library Override"
+
+ @classmethod
+ def poll(cls, context):
+ return has_selected_ids_in_context(context)
+
+ def draw(self, _context):
+ layout = self.layout
+
+ layout.operator_menu_enum("outliner.liboverride_operation", "selection_set",
+ text="Make").type = 'OVERRIDE_LIBRARY_CREATE_HIERARCHY'
+ layout.operator_menu_enum(
+ "outliner.liboverride_operation",
+ "selection_set",
+ text="Reset").type = 'OVERRIDE_LIBRARY_RESET'
+ layout.operator_menu_enum("outliner.liboverride_operation", "selection_set",
+ text="Clear").type = 'OVERRIDE_LIBRARY_CLEAR_SINGLE'
+
+ layout.separator()
+
+ layout.operator_menu_enum("outliner.liboverride_troubleshoot_operation", "type",
+ text="Troubleshoot").selection_set = 'SELECTED'
+
+
class OUTLINER_PT_filter(Panel):
bl_space_type = 'OUTLINER'
bl_region_type = 'HEADER'
@@ -363,14 +415,19 @@ class OUTLINER_PT_filter(Panel):
row.prop(space, "show_mode_column", text="Show Mode Column")
layout.separator()
- col = layout.column(align=True)
- col.label(text="Search")
- col.prop(space, "use_filter_complete", text="Exact Match")
- col.prop(space, "use_filter_case_sensitive", text="Case Sensitive")
+ filter_text_supported = True
+ # Same exception for library overrides as in OUTLINER_HT_header.
+ if display_mode == 'LIBRARY_OVERRIDES' and space.lib_override_view_mode == 'HIERARCHIES':
+ filter_text_supported = False
+
+ if filter_text_supported:
+ col = layout.column(align=True)
+ col.label(text="Search")
+ col.prop(space, "use_filter_complete", text="Exact Match")
+ col.prop(space, "use_filter_case_sensitive", text="Case Sensitive")
if display_mode == 'LIBRARY_OVERRIDES' and space.lib_override_view_mode == 'PROPERTIES' and bpy.data.libraries:
- col.separator()
- row = col.row()
+ row = layout.row()
row.label(icon='LIBRARY_DATA_OVERRIDE')
row.prop(space, "use_filter_lib_override_system", text="System Overrides")
@@ -457,6 +514,7 @@ classes = (
OUTLINER_MT_collection_view_layer,
OUTLINER_MT_object,
OUTLINER_MT_asset,
+ OUTLINER_MT_liboverride,
OUTLINER_MT_context_menu,
OUTLINER_MT_context_menu_view,
OUTLINER_MT_view_pie,