Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-04-27 14:50:26 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-06-13 16:22:34 +0300
commit7a10cfe7fe01bbeb7588239a9fd743ecc6af6c39 (patch)
tree05b5b281f0aef36fc27bcaf4b8b9aa9e14d193e3 /release/scripts/startup/bl_ui/properties_physics_cloth.py
parent1664ccb6752adf1bcf326b72d1230aa9b667a1fb (diff)
UI: preset popover buttons in panel headers.
Moves the preset into a menu for the panel header, so it can be changed without opening the panel and takes up less space. Two remaining issues: * For long lists the add new preset button can be scrolled off screen. * We should support showing the name of the chosen preset in the panel header, but the current preset system does not support detecting which preset is used. Differential Revision: https://developer.blender.org/D3366
Diffstat (limited to 'release/scripts/startup/bl_ui/properties_physics_cloth.py')
-rw-r--r--release/scripts/startup/bl_ui/properties_physics_cloth.py18
1 files changed, 6 insertions, 12 deletions
diff --git a/release/scripts/startup/bl_ui/properties_physics_cloth.py b/release/scripts/startup/bl_ui/properties_physics_cloth.py
index f450bc61635..32343959a64 100644
--- a/release/scripts/startup/bl_ui/properties_physics_cloth.py
+++ b/release/scripts/startup/bl_ui/properties_physics_cloth.py
@@ -19,6 +19,7 @@
# <pep8 compliant>
import bpy
from bpy.types import Menu, Panel
+from bl_operators.presets import PresetMenu
from .properties_physics_common import (
point_cache_ui,
@@ -30,11 +31,11 @@ def cloth_panel_enabled(md):
return md.point_cache.is_baked is False
-class CLOTH_MT_presets(Menu):
+class CLOTH_MT_presets(PresetMenu):
bl_label = "Cloth Presets"
preset_subdir = "cloth"
preset_operator = "script.execute_preset"
- draw = Menu.draw_preset
+ preset_add_operator = "cloth.preset_add"
class PhysicButtonsPanel:
@@ -52,6 +53,9 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel, Panel):
bl_label = "Cloth"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
+ def draw_header_preset(self, context):
+ CLOTH_MT_presets.draw_panel_header(self.layout)
+
def draw(self, context):
layout = self.layout
@@ -63,16 +67,6 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel, Panel):
split = layout.split(percentage=0.25)
- col = split.column()
-
- split.label(text="Presets:")
- sub = split.row(align=True)
- sub.menu("CLOTH_MT_presets", text=bpy.types.CLOTH_MT_presets.bl_label)
- sub.operator("cloth.preset_add", text="", icon='ZOOMIN')
- sub.operator("cloth.preset_add", text="", icon='ZOOMOUT').remove_active = True
-
- split = layout.split(percentage=0.25)
-
split.label(text="Quality:")
split.prop(cloth, "quality", text="Steps")