Cleanup: quiet warnings when reloading scripts
Some UI classes weren't unregistered which caused a warning when
reloading scripts (since [0]). Register/Unregister these classes along
with the classes of other sub-modules.
[0]: c5e2ec8a1a
This commit is contained in:
@@ -113,6 +113,8 @@ def translation_update(_):
|
||||
|
||||
def register():
|
||||
from bpy.utils import register_class
|
||||
for cls in classes:
|
||||
register_class(cls)
|
||||
for mod in _modules_loaded:
|
||||
for cls in mod.classes:
|
||||
register_class(cls)
|
||||
@@ -184,6 +186,9 @@ def unregister():
|
||||
for cls in reversed(mod.classes):
|
||||
if cls.is_registered:
|
||||
unregister_class(cls)
|
||||
for cls in reversed(classes):
|
||||
if cls.is_registered:
|
||||
unregister_class(cls)
|
||||
|
||||
try:
|
||||
bpy.app.handlers.translation_update_post.remove(translation_update)
|
||||
@@ -251,9 +256,6 @@ class UI_UL_list(bpy.types.UIList):
|
||||
return cls.sort_items_helper(_sort, lambda e: e[1].lower())
|
||||
|
||||
|
||||
bpy.utils.register_class(UI_UL_list)
|
||||
|
||||
|
||||
class UI_MT_list_item_context_menu(bpy.types.Menu):
|
||||
"""
|
||||
UI List item context menu definition. Scripts can append/prepend this to
|
||||
@@ -270,9 +272,6 @@ class UI_MT_list_item_context_menu(bpy.types.Menu):
|
||||
pass
|
||||
|
||||
|
||||
bpy.utils.register_class(UI_MT_list_item_context_menu)
|
||||
|
||||
|
||||
class UI_MT_button_context_menu(bpy.types.Menu):
|
||||
"""
|
||||
UI button context menu definition. Scripts can append/prepend this to
|
||||
@@ -290,4 +289,8 @@ class UI_MT_button_context_menu(bpy.types.Menu):
|
||||
self.layout.menu_contents("WM_MT_button_context")
|
||||
|
||||
|
||||
bpy.utils.register_class(UI_MT_button_context_menu)
|
||||
classes = (
|
||||
UI_UL_list,
|
||||
UI_MT_list_item_context_menu,
|
||||
UI_MT_button_context_menu,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user