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:
parent
36d09d9029
commit
0bedf9cf07
Notes:
blender-bot
2023-02-14 06:37:09 +01:00
Referenced by issue #58842, Add-ons Import/Export entries disapear when enabling Filter Addons option
|
@ -373,11 +373,9 @@ def enable(module_name, *, default_set=False, persistent=False, handle_error=Non
|
|||
# 2) Try register collected modules.
|
||||
# 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
|
||||
owner_id_prev = _bl_owner_id_get()
|
||||
_bl_owner_id_set(module_name)
|
||||
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:
|
||||
|
@ -393,8 +391,7 @@ def enable(module_name, *, default_set=False, persistent=False, handle_error=Non
|
|||
_addon_remove(module_name)
|
||||
return None
|
||||
finally:
|
||||
if use_owner:
|
||||
_bl_owner_id_set(owner_id_prev)
|
||||
_bl_owner_id_set(owner_id_prev)
|
||||
|
||||
# * OK loaded successfully! *
|
||||
mod.__addon_enabled__ = True
|
||||
|
@ -513,7 +510,6 @@ def module_bl_info(mod, info_basis=None):
|
|||
"category": "",
|
||||
"warning": "",
|
||||
"show_expanded": False,
|
||||
"use_owner": True,
|
||||
}
|
||||
|
||||
addon_info = getattr(mod, "bl_info", {})
|
||||
|
@ -531,9 +527,5 @@ def module_bl_info(mod, info_basis=None):
|
|||
if not addon_info["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
|
||||
return addon_info
|
||||
|
|
|
@ -783,7 +783,10 @@ class _GenericUI:
|
|||
for func in draw_ls._draw_funcs:
|
||||
|
||||
# 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)
|
||||
if owner_id is not None:
|
||||
if func._owner not in owner_names:
|
||||
|
|
|
@ -77,8 +77,6 @@ class WORKSPACE_PT_addons(WorkSpaceButtonsPanel, Panel):
|
|||
if module is None:
|
||||
continue
|
||||
info = addon_utils.module_bl_info(module)
|
||||
if not info["use_owner"]:
|
||||
continue
|
||||
is_enabled = module_name in owner_ids
|
||||
row = col.row()
|
||||
row.alignment = 'LEFT'
|
||||
|
|
|
@ -452,6 +452,7 @@ class TOPBAR_MT_templates_more(Menu):
|
|||
class TOPBAR_MT_file_import(Menu):
|
||||
bl_idname = "TOPBAR_MT_file_import"
|
||||
bl_label = "Import"
|
||||
bl_owner_use_filter = False
|
||||
|
||||
def draw(self, _context):
|
||||
if bpy.app.build_options.collada:
|
||||
|
@ -464,6 +465,7 @@ class TOPBAR_MT_file_import(Menu):
|
|||
class TOPBAR_MT_file_export(Menu):
|
||||
bl_idname = "TOPBAR_MT_file_export"
|
||||
bl_label = "Export"
|
||||
bl_owner_use_filter = False
|
||||
|
||||
def draw(self, context):
|
||||
if bpy.app.build_options.collada:
|
||||
|
|
Loading…
Reference in New Issue