diff options
Diffstat (limited to 'release/scripts/startup/bl_ui')
11 files changed, 78 insertions, 23 deletions
diff --git a/release/scripts/startup/bl_ui/properties_data_camera.py b/release/scripts/startup/bl_ui/properties_data_camera.py index d196fe78387..3a938ccd47e 100644 --- a/release/scripts/startup/bl_ui/properties_data_camera.py +++ b/release/scripts/startup/bl_ui/properties_data_camera.py @@ -20,7 +20,7 @@ import bpy from bpy.types import Panel from rna_prop_ui import PropertyPanel -from bl_operators.presets import PresetMenu +from bl_ui.utils import PresetPanel class CameraButtonsPanel: @@ -34,7 +34,7 @@ class CameraButtonsPanel: return context.camera and (engine in cls.COMPAT_ENGINES) -class CAMERA_PT_presets(PresetMenu): +class CAMERA_PT_presets(PresetPanel, Panel): bl_label = "Camera Presets" preset_subdir = "camera" preset_operator = "script.execute_preset" @@ -42,7 +42,7 @@ class CAMERA_PT_presets(PresetMenu): COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'} -class SAFE_AREAS_PT_presets(PresetMenu): +class SAFE_AREAS_PT_presets(PresetPanel, Panel): bl_label = "Camera Presets" preset_subdir = "safe_areas" preset_operator = "script.execute_preset" diff --git a/release/scripts/startup/bl_ui/properties_material_gpencil.py b/release/scripts/startup/bl_ui/properties_material_gpencil.py index e33628658fc..24ba786f7af 100644 --- a/release/scripts/startup/bl_ui/properties_material_gpencil.py +++ b/release/scripts/startup/bl_ui/properties_material_gpencil.py @@ -20,7 +20,7 @@ import bpy from bpy.types import Menu, Panel, UIList from rna_prop_ui import PropertyPanel -from bl_operators.presets import PresetMenu +from bl_ui.utils import PresetPanel from .properties_grease_pencil_common import ( GreasePencilMaterialsPanel, @@ -250,7 +250,7 @@ class MATERIAL_PT_gpencil_options(GPMaterialButtonsPanel, Panel): layout.prop(gpcolor, "pass_index") -class MATERIAL_PT_gpencil_material_presets(PresetMenu): +class MATERIAL_PT_gpencil_material_presets(PresetPanel, Panel): """Material settings""" bl_label = "Material Presets" preset_subdir = "gpencil_material" diff --git a/release/scripts/startup/bl_ui/properties_output.py b/release/scripts/startup/bl_ui/properties_output.py index bd96152204a..ec7874f8992 100644 --- a/release/scripts/startup/bl_ui/properties_output.py +++ b/release/scripts/startup/bl_ui/properties_output.py @@ -20,17 +20,17 @@ # <pep8 compliant> import bpy from bpy.types import Menu, Panel, UIList -from bl_operators.presets import PresetMenu +from bl_ui.utils import PresetPanel -class RENDER_PT_presets(PresetMenu): +class RENDER_PT_presets(PresetPanel, Panel): bl_label = "Render Presets" preset_subdir = "render" preset_operator = "script.execute_preset" preset_add_operator = "render.preset_add" -class RENDER_PT_ffmpeg_presets(PresetMenu): +class RENDER_PT_ffmpeg_presets(PresetPanel, Panel): bl_label = "FFMPEG Presets" preset_subdir = "ffmpeg" preset_operator = "script.python_file_run" diff --git a/release/scripts/startup/bl_ui/properties_particle.py b/release/scripts/startup/bl_ui/properties_particle.py index 7d0f6de7b1b..c85b8004808 100644 --- a/release/scripts/startup/bl_ui/properties_particle.py +++ b/release/scripts/startup/bl_ui/properties_particle.py @@ -21,7 +21,7 @@ import bpy from bpy.types import Panel, Menu from rna_prop_ui import PropertyPanel from bpy.app.translations import pgettext_iface as iface_ -from bl_operators.presets import PresetMenu +from bl_ui.utils import PresetPanel from .properties_physics_common import ( point_cache_ui, @@ -95,7 +95,7 @@ class PARTICLE_MT_context_menu(Menu): ) -class PARTICLE_PT_hair_dynamics_presets(PresetMenu): +class PARTICLE_PT_hair_dynamics_presets(PresetPanel, Panel): bl_label = "Hair Dynamics Presets" preset_subdir = "hair_dynamics" preset_operator = "script.execute_preset" diff --git a/release/scripts/startup/bl_ui/properties_physics_cloth.py b/release/scripts/startup/bl_ui/properties_physics_cloth.py index 71731644caf..4c8e056aa03 100644 --- a/release/scripts/startup/bl_ui/properties_physics_cloth.py +++ b/release/scripts/startup/bl_ui/properties_physics_cloth.py @@ -22,7 +22,7 @@ import bpy from bpy.types import ( Panel, ) -from bl_operators.presets import PresetMenu +from bl_ui.utils import PresetPanel from .properties_physics_common import ( point_cache_ui, @@ -34,7 +34,7 @@ def cloth_panel_enabled(md): return md.point_cache.is_baked is False -class CLOTH_PT_presets(PresetMenu): +class CLOTH_PT_presets(PresetPanel, Panel): bl_label = "Cloth Presets" preset_subdir = "cloth" preset_operator = "script.execute_preset" diff --git a/release/scripts/startup/bl_ui/properties_physics_fluid.py b/release/scripts/startup/bl_ui/properties_physics_fluid.py index b3ec45c2571..17289cfbaf1 100644 --- a/release/scripts/startup/bl_ui/properties_physics_fluid.py +++ b/release/scripts/startup/bl_ui/properties_physics_fluid.py @@ -23,10 +23,10 @@ from bpy.types import ( Panel, ) from bpy.app.translations import pgettext_iface as iface_ -from bl_operators.presets import PresetMenu +from bl_ui.utils import PresetPanel -class FLUID_PT_presets(PresetMenu): +class FLUID_PT_presets(PresetPanel, Panel): bl_label = "Fluid Presets" preset_subdir = "fluid" preset_operator = "script.execute_preset" diff --git a/release/scripts/startup/bl_ui/properties_scene.py b/release/scripts/startup/bl_ui/properties_scene.py index 49d0b4075a1..f3243d92520 100644 --- a/release/scripts/startup/bl_ui/properties_scene.py +++ b/release/scripts/startup/bl_ui/properties_scene.py @@ -25,7 +25,6 @@ from bpy.types import ( ) from rna_prop_ui import PropertyPanel -from bl_operators.presets import PresetMenu from .properties_physics_common import ( point_cache_ui, diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py index 58955722aaa..39c3597c788 100644 --- a/release/scripts/startup/bl_ui/space_clip.py +++ b/release/scripts/startup/bl_ui/space_clip.py @@ -21,7 +21,7 @@ import bpy from bpy.types import Panel, Header, Menu, UIList from bpy.app.translations import pgettext_iface as iface_ -from bl_operators.presets import PresetMenu +from bl_ui.utils import PresetPanel from .properties_grease_pencil_common import ( AnnotationDrawingToolsPanel, AnnotationDataPanel, @@ -1460,7 +1460,7 @@ class CLIP_MT_tracking_context_menu(Menu): text="Unlock Tracks").action = 'UNLOCK' -class CLIP_PT_camera_presets(PresetMenu): +class CLIP_PT_camera_presets(PresetPanel, Panel): """Predefined tracking camera intrinsics""" bl_label = "Camera Presets" preset_subdir = "tracking_camera" @@ -1468,7 +1468,7 @@ class CLIP_PT_camera_presets(PresetMenu): preset_add_operator = "clip.camera_preset_add" -class CLIP_PT_track_color_presets(PresetMenu): +class CLIP_PT_track_color_presets(PresetPanel, Panel): """Predefined track color""" bl_label = "Color Presets" preset_subdir = "tracking_track_color" @@ -1476,7 +1476,7 @@ class CLIP_PT_track_color_presets(PresetMenu): preset_add_operator = "clip.track_color_preset_add" -class CLIP_PT_tracking_settings_presets(PresetMenu): +class CLIP_PT_tracking_settings_presets(PresetPanel, Panel): """Predefined tracking settings""" bl_label = "Tracking Presets" preset_subdir = "tracking_settings" diff --git a/release/scripts/startup/bl_ui/space_node.py b/release/scripts/startup/bl_ui/space_node.py index ca809a07d92..c2e5a979ade 100644 --- a/release/scripts/startup/bl_ui/space_node.py +++ b/release/scripts/startup/bl_ui/space_node.py @@ -21,7 +21,7 @@ import bpy import nodeitems_utils from bpy.types import Header, Menu, Panel from bpy.app.translations import pgettext_iface as iface_ -from bl_operators.presets import PresetMenu +from bl_ui.utils import PresetPanel from .properties_grease_pencil_common import ( AnnotationDrawingToolsPanel, AnnotationDataPanel, @@ -304,7 +304,7 @@ class NODE_MT_node(Menu): layout.operator("node.read_viewlayers") -class NODE_PT_node_color_presets(PresetMenu): +class NODE_PT_node_color_presets(PresetPanel, Panel): """Predefined node color""" bl_label = "Color Presets" preset_subdir = "node_color" diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index ae58237f267..22571080628 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -31,7 +31,7 @@ from .properties_paint_common import ( brush_texpaint_common, brush_texture_settings, ) -from bl_operators.presets import PresetMenu +from bl_ui.utils import PresetPanel class View3DPanel: @@ -1816,7 +1816,7 @@ class VIEW3D_PT_tools_grease_pencil_weight_appearance(GreasePencilAppearancePane bl_label = "Appearance" -class VIEW3D_PT_gpencil_brush_presets(PresetMenu): +class VIEW3D_PT_gpencil_brush_presets(PresetPanel, Panel): """Brush settings""" bl_label = "Brush Presets" preset_subdir = "gpencil_brush" diff --git a/release/scripts/startup/bl_ui/utils.py b/release/scripts/startup/bl_ui/utils.py new file mode 100644 index 00000000000..8c7ceefecb6 --- /dev/null +++ b/release/scripts/startup/bl_ui/utils.py @@ -0,0 +1,56 @@ +# ##### BEGIN GPL LICENSE BLOCK ##### +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# ##### END GPL LICENSE BLOCK ##### + +# <pep8 compliant> + +from bpy.types import Menu + + +# Panel mix-in class (don't register). +class PresetPanel: + bl_space_type = 'PROPERTIES' + bl_region_type = 'HEADER' + bl_label = "Presets" + path_menu = Menu.path_menu + + @classmethod + def draw_panel_header(cls, layout): + layout.emboss = 'NONE' + layout.popover( + panel=cls.__name__, + icon='PRESET', + text="", + ) + + @classmethod + def draw_menu(cls, layout, text=None): + if text is None: + text = cls.bl_label + + layout.popover( + panel=cls.__name__, + icon='PRESET', + text=text, + ) + + def draw(self, context): + layout = self.layout + layout.emboss = 'PULLDOWN_MENU' + layout.operator_context = 'EXEC_DEFAULT' + + Menu.draw_preset(self, context) |