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
This commit is contained in:
@@ -20,13 +20,14 @@
|
||||
import bpy
|
||||
from bpy.types import Panel, Menu
|
||||
from bpy.app.translations import pgettext_iface as iface_
|
||||
from bl_operators.presets import PresetMenu
|
||||
|
||||
|
||||
class FLUID_MT_presets(Menu):
|
||||
class FLUID_MT_presets(PresetMenu):
|
||||
bl_label = "Fluid Presets"
|
||||
preset_subdir = "fluid"
|
||||
preset_operator = "script.execute_preset"
|
||||
draw = Menu.draw_preset
|
||||
preset_add_operator = "fluid.preset_add"
|
||||
|
||||
|
||||
class PhysicButtonsPanel:
|
||||
@@ -240,11 +241,7 @@ class PHYSICS_PT_domain_gravity(PhysicButtonsPanel, Panel):
|
||||
col.prop(fluid, "simulation_scale", text="Meters")
|
||||
|
||||
col = split.column()
|
||||
col.label(text="Viscosity Presets:")
|
||||
sub = col.row(align=True)
|
||||
sub.menu("FLUID_MT_presets", text=bpy.types.FLUID_MT_presets.bl_label)
|
||||
sub.operator("fluid.preset_add", text="", icon='ZOOMIN')
|
||||
sub.operator("fluid.preset_add", text="", icon='ZOOMOUT').remove_active = True
|
||||
FLUID_MT_presets.draw_menu(col, text="Viscosity Presets")
|
||||
|
||||
sub = col.column(align=True)
|
||||
sub.prop(fluid, "viscosity_base", text="Base")
|
||||
|
Reference in New Issue
Block a user