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:
authorCampbell Barton <ideasman42@gmail.com>2018-02-28 17:26:02 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-02-28 17:31:07 +0300
commitd937d06c02f62c11385c1c1f58d963fec03365d9 (patch)
treec9a7052205b4cbcc4c9219ed2e9838cc5414c56c /release/scripts/modules/addon_utils.py
parent80d1d9629e1d4dd12aca580e3844a24f5d160356 (diff)
WorkSpace: UI filtering for add-ons
Allows for each workspace to have it's own add-ons on display. Filtering for: Panels, Menus, Keymaps & Manipulators. Automatically applies to add-ons at the moment. Access from workspace, toggled off by default once enabled, add-ons can be white-listed. See D3076
Diffstat (limited to 'release/scripts/modules/addon_utils.py')
-rw-r--r--release/scripts/modules/addon_utils.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/release/scripts/modules/addon_utils.py b/release/scripts/modules/addon_utils.py
index 97fc45189f2..23874abd8c9 100644
--- a/release/scripts/modules/addon_utils.py
+++ b/release/scripts/modules/addon_utils.py
@@ -352,6 +352,11 @@ def enable(module_name, *, default_set=False, persistent=False, handle_error=Non
# 2) try register collected modules
# removed, addons need to handle own registration now.
+
+ from _bpy import _bl_owner_id_get, _bl_owner_id_set
+ owner_id_prev = _bl_owner_id_get()
+ _bl_owner_id_set(module_name)
+
# 3) try run the modules register function
try:
mod.register()
@@ -363,6 +368,8 @@ def enable(module_name, *, default_set=False, persistent=False, handle_error=Non
if default_set:
_addon_remove(module_name)
return None
+ finally:
+ _bl_owner_id_set(owner_id_prev)
# * OK loaded successfully! *
mod.__addon_enabled__ = True