diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-03-25 05:39:47 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-03-25 05:39:47 +0300 |
commit | 0c93bc2b637a6a3fe01b174dad2fb61895d004d2 (patch) | |
tree | b877a434d2a7af2dfdf727b9794fa46359ba670a /release | |
parent | 5d6e9f237be3379b63169f86b8f4117752d095b3 (diff) | |
parent | a7f16c17c260f311e136758497e5490b226ebc03 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/modules/addon_utils.py | 8 | ||||
-rw-r--r-- | release/scripts/modules/bpy/path.py | 4 | ||||
-rw-r--r-- | release/scripts/modules/bpy_types.py | 4 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_view3d.py | 16 |
4 files changed, 30 insertions, 2 deletions
diff --git a/release/scripts/modules/addon_utils.py b/release/scripts/modules/addon_utils.py index 886f078f046..51e3e65b78c 100644 --- a/release/scripts/modules/addon_utils.py +++ b/release/scripts/modules/addon_utils.py @@ -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 = { diff --git a/release/scripts/modules/bpy/path.py b/release/scripts/modules/bpy/path.py index a864a86eba7..e17d710068c 100644 --- a/release/scripts/modules/bpy/path.py +++ b/release/scripts/modules/bpy/path.py @@ -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() diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py index 5eb8b946568..600b29a6b2b 100644 --- a/release/scripts/modules/bpy_types.py +++ b/release/scripts/modules/bpy_types.py @@ -683,6 +683,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): """ Append a draw function to this menu, diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 74472aca25c..03c660807a9 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -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() |