Fix T58842: Add-ons Import/Export entries disapear when enabling Filter

Addons option

This removes the 'use_owner' option feature from rB61c8ed40f5df.
(this wasnt working well when addons are enabled and when switching
workspaces)

Now Addon filtering is just bypassed for Import/Export menus.
(by introducing/setting bl_owner_use_filter = False)

Maniphest Tasks: T58842

Differential Revision: https://developer.blender.org/D6740
This commit is contained in:
Philipp Oeser
2020-02-03 12:49:09 +01:00
parent 36d09d9029
commit 0bedf9cf07
4 changed files with 10 additions and 15 deletions

View File

@@ -373,8 +373,6 @@ def enable(module_name, *, default_set=False, persistent=False, handle_error=Non
# 2) Try register collected modules. # 2) Try register collected modules.
# Removed register_module, addons need to handle their own registration now. # Removed register_module, addons need to handle their own registration now.
use_owner = mod.bl_info.get("use_owner", True)
if use_owner:
from _bpy import _bl_owner_id_get, _bl_owner_id_set from _bpy import _bl_owner_id_get, _bl_owner_id_set
owner_id_prev = _bl_owner_id_get() owner_id_prev = _bl_owner_id_get()
_bl_owner_id_set(module_name) _bl_owner_id_set(module_name)
@@ -393,7 +391,6 @@ def enable(module_name, *, default_set=False, persistent=False, handle_error=Non
_addon_remove(module_name) _addon_remove(module_name)
return None return None
finally: finally:
if use_owner:
_bl_owner_id_set(owner_id_prev) _bl_owner_id_set(owner_id_prev)
# * OK loaded successfully! * # * OK loaded successfully! *
@@ -513,7 +510,6 @@ def module_bl_info(mod, info_basis=None):
"category": "", "category": "",
"warning": "", "warning": "",
"show_expanded": False, "show_expanded": False,
"use_owner": True,
} }
addon_info = getattr(mod, "bl_info", {}) addon_info = getattr(mod, "bl_info", {})
@@ -531,9 +527,5 @@ def module_bl_info(mod, info_basis=None):
if not addon_info["name"]: if not addon_info["name"]:
addon_info["name"] = mod.__name__ addon_info["name"] = mod.__name__
# Temporary auto-magic, don't use_owner for import export menus.
if mod.bl_info["category"] == "Import-Export":
mod.bl_info["use_owner"] = False
addon_info["_init"] = None addon_info["_init"] = None
return addon_info return addon_info

View File

@@ -783,7 +783,10 @@ class _GenericUI:
for func in draw_ls._draw_funcs: for func in draw_ls._draw_funcs:
# Begin 'owner_id' filter. # Begin 'owner_id' filter.
if owner_names is not None: # Exclude Import/Export menus from this filtering (io addons should always show there)
if not getattr(self, "bl_owner_use_filter", True):
pass
elif owner_names is not None:
owner_id = getattr(func, "_owner", None) owner_id = getattr(func, "_owner", None)
if owner_id is not None: if owner_id is not None:
if func._owner not in owner_names: if func._owner not in owner_names:

View File

@@ -77,8 +77,6 @@ class WORKSPACE_PT_addons(WorkSpaceButtonsPanel, Panel):
if module is None: if module is None:
continue continue
info = addon_utils.module_bl_info(module) info = addon_utils.module_bl_info(module)
if not info["use_owner"]:
continue
is_enabled = module_name in owner_ids is_enabled = module_name in owner_ids
row = col.row() row = col.row()
row.alignment = 'LEFT' row.alignment = 'LEFT'

View File

@@ -452,6 +452,7 @@ class TOPBAR_MT_templates_more(Menu):
class TOPBAR_MT_file_import(Menu): class TOPBAR_MT_file_import(Menu):
bl_idname = "TOPBAR_MT_file_import" bl_idname = "TOPBAR_MT_file_import"
bl_label = "Import" bl_label = "Import"
bl_owner_use_filter = False
def draw(self, _context): def draw(self, _context):
if bpy.app.build_options.collada: if bpy.app.build_options.collada:
@@ -464,6 +465,7 @@ class TOPBAR_MT_file_import(Menu):
class TOPBAR_MT_file_export(Menu): class TOPBAR_MT_file_export(Menu):
bl_idname = "TOPBAR_MT_file_export" bl_idname = "TOPBAR_MT_file_export"
bl_label = "Export" bl_label = "Export"
bl_owner_use_filter = False
def draw(self, context): def draw(self, context):
if bpy.app.build_options.collada: if bpy.app.build_options.collada: