Merge branch 'master' into blender2.8
This commit is contained in:
@@ -24,6 +24,7 @@ __all__ = (
|
||||
"check",
|
||||
"enable",
|
||||
"disable",
|
||||
"disable_all",
|
||||
"reset_all",
|
||||
"module_bl_info",
|
||||
)
|
||||
@@ -444,6 +445,13 @@ def reset_all(*, reload_scripts=False):
|
||||
disable(mod_name)
|
||||
|
||||
|
||||
def disable_all():
|
||||
import sys
|
||||
for mod_name, mod in sys.modules.items():
|
||||
if getattr(mod, "__addon_enabled__", False):
|
||||
disable(mod_name)
|
||||
|
||||
|
||||
def module_bl_info(mod, info_basis=None):
|
||||
if info_basis is None:
|
||||
info_basis = {
|
||||
|
@@ -204,7 +204,9 @@ def display_name(name):
|
||||
name = name.replace("_colon_", ":")
|
||||
name = name.replace("_plus_", "+")
|
||||
|
||||
name = name.replace("_", " ")
|
||||
# strip to allow underscore prefix
|
||||
# (when paths can't start with numbers for eg).
|
||||
name = name.replace("_", " ").lstrip(" ")
|
||||
|
||||
if name.islower():
|
||||
name = name.lower().title()
|
||||
|
@@ -682,6 +682,10 @@ class _GenericUI:
|
||||
|
||||
return draw_funcs
|
||||
|
||||
@classmethod
|
||||
def is_extended(cls):
|
||||
return bool(getattr(cls.draw, "_draw_funcs", None))
|
||||
|
||||
@classmethod
|
||||
def append(cls, draw_func):
|
||||
"""
|
||||
|
@@ -1204,6 +1204,16 @@ class INFO_MT_lamp_add(Menu):
|
||||
layout.operator_enum("object.lamp_add", "type")
|
||||
|
||||
|
||||
class INFO_MT_camera_add(Menu):
|
||||
bl_idname = "INFO_MT_camera_add"
|
||||
bl_label = "Camera"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.operator_context = 'EXEC_REGION_WIN'
|
||||
layout.operator("object.camera_add", text="Camera", icon='OUTLINER_OB_CAMERA')
|
||||
|
||||
|
||||
class INFO_MT_add(Menu):
|
||||
bl_label = "Add"
|
||||
|
||||
@@ -1235,7 +1245,11 @@ class INFO_MT_add(Menu):
|
||||
layout.operator("object.speaker_add", text="Speaker", icon='OUTLINER_OB_SPEAKER')
|
||||
layout.separator()
|
||||
|
||||
layout.operator("object.camera_add", text="Camera", icon='OUTLINER_OB_CAMERA')
|
||||
if INFO_MT_camera_add.is_extended():
|
||||
layout.menu("INFO_MT_camera_add", icon='OUTLINER_OB_CAMERA')
|
||||
else:
|
||||
INFO_MT_camera_add.draw(self, context)
|
||||
|
||||
layout.menu("INFO_MT_lamp_add", icon='OUTLINER_OB_LAMP')
|
||||
layout.separator()
|
||||
|
||||
|
Reference in New Issue
Block a user