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 @@ -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): """ diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index b718228e7b2..e17d237b060 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -1206,6 +1206,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" @@ -1237,7 +1247,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()