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:
authorCampbell Barton <ideasman42@gmail.com>2019-05-21 08:49:36 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-05-21 08:49:36 +0300
commit91a292ba40b4008263e117955a8366dfc0d963c4 (patch)
tree3f54788f532e8dfe6b78513f8b105b11a28b83fc
parent909c0bd0433222bcdb8661c3ecdf6026150557f0 (diff)
UI: show symmetry popovers next to newly added mirror buttons
This moves symmetry panels to a small popover next to the mirror axis buttons.
-rw-r--r--release/scripts/startup/bl_ui/space_view3d.py20
-rw-r--r--release/scripts/startup/bl_ui/space_view3d_toolbar.py48
2 files changed, 59 insertions, 9 deletions
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 5b8daa7ebea..4d8d65d2d4c 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -122,40 +122,44 @@ class VIEW3D_HT_tool_header(Header):
row.label(icon='MOD_MIRROR')
sub = row.row(align=True)
sub.scale_x = 0.6
- return sub
+ return row, sub
if mode_string == 'EDIT_MESH':
- sub = row_for_mirror()
+ _row, sub = row_for_mirror()
sub.prop(context.object.data, "use_mirror_x", text="X", toggle=True)
tool_settings = context.tool_settings
layout.prop(tool_settings, "use_mesh_automerge", text="")
elif mode_string == 'EDIT_ARMATURE':
- sub = row_for_mirror()
+ _row, sub = row_for_mirror()
sub.prop(context.object.data, "use_mirror_x", text="X", toggle=True)
elif mode_string == 'POSE':
- sub = row_for_mirror()
+ _row, sub = row_for_mirror()
sub.prop(context.object.pose, "use_mirror_x", text="X", toggle=True)
elif mode_string == 'PAINT_WEIGHT':
- sub = row_for_mirror()
+ row, sub = row_for_mirror()
sub.prop(context.object.data, "use_mirror_x", text="X", toggle=True)
+ row.popover(panel="VIEW3D_PT_tools_weightpaint_symmetry_for_topbar", text="")
elif mode_string == 'SCULPT':
- sub = row_for_mirror()
+ row, sub = row_for_mirror()
sculpt = context.tool_settings.sculpt
sub.prop(sculpt, "use_symmetry_x", text="X", toggle=True)
sub.prop(sculpt, "use_symmetry_y", text="Y", toggle=True)
sub.prop(sculpt, "use_symmetry_z", text="Z", toggle=True)
+ row.popover(panel="VIEW3D_PT_sculpt_symmetry_for_topbar", text="")
elif mode_string == 'PAINT_TEXTURE':
- sub = row_for_mirror()
+ _row, sub = row_for_mirror()
ipaint = context.tool_settings.image_paint
sub.prop(ipaint, "use_symmetry_x", text="X", toggle=True)
sub.prop(ipaint, "use_symmetry_y", text="Y", toggle=True)
sub.prop(ipaint, "use_symmetry_z", text="Z", toggle=True)
+ # No need for a popover, the panel only has these options.
elif mode_string == 'PAINT_VERTEX':
- sub = row_for_mirror()
+ row, sub = row_for_mirror()
vpaint = context.tool_settings.vertex_paint
sub.prop(vpaint, "use_symmetry_x", text="X", toggle=True)
sub.prop(vpaint, "use_symmetry_y", text="Y", toggle=True)
sub.prop(vpaint, "use_symmetry_z", text="Z", toggle=True)
+ row.popover(panel="VIEW3D_PT_tools_vertexpaint_symmetry_for_topbar", text="")
# Expand panels from the side-bar as popovers.
if mode_string == 'SCULPT':
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index d5b94156545..2bfdc0e9814 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1169,7 +1169,11 @@ class VIEW3D_PT_sculpt_symmetry(Panel, View3DPaintPanel):
@classmethod
def poll(cls, context):
- return (context.sculpt_object and context.tool_settings.sculpt)
+ return (
+ (context.sculpt_object and context.tool_settings.sculpt) and
+ # When used in the tool header, this is explicitly included next to the XYZ symmetry buttons.
+ (context.region.type != 'TOOL_HEADER')
+ )
def draw(self, context):
layout = self.layout
@@ -1223,6 +1227,14 @@ class VIEW3D_PT_sculpt_symmetry(Panel, View3DPaintPanel):
layout.column().prop(sculpt, "tile_offset", text="Tile Offset")
+class VIEW3D_PT_sculpt_symmetry_for_topbar(Panel):
+ bl_space_type = 'TOPBAR'
+ bl_region_type = 'HEADER'
+ bl_label = "Symmetry"
+
+ draw = VIEW3D_PT_sculpt_symmetry.draw
+
+
class VIEW3D_PT_tools_brush_display_show_brush(Panel, View3DPaintPanel):
bl_context = ".paint_common" # dot on purpose (access from topbar)
bl_label = "Show Brush"
@@ -1290,6 +1302,11 @@ class VIEW3D_PT_tools_weightpaint_symmetry(Panel, View3DPaintPanel):
bl_options = {'DEFAULT_CLOSED'}
bl_label = "Symmetry"
+ @classmethod
+ def poll(cls, context):
+ # When used in the tool header, this is explicitly included next to the XYZ symmetry buttons.
+ return (context.region.type != 'TOOL_HEADER')
+
def draw(self, context):
layout = self.layout
tool_settings = context.tool_settings
@@ -1297,6 +1314,14 @@ class VIEW3D_PT_tools_weightpaint_symmetry(Panel, View3DPaintPanel):
draw_vpaint_symmetry(layout, wpaint)
+class VIEW3D_PT_tools_weightpaint_symmetry_for_topbar(Panel):
+ bl_space_type = 'TOPBAR'
+ bl_region_type = 'HEADER'
+ bl_label = "Symmetry"
+
+ draw = VIEW3D_PT_tools_weightpaint_symmetry.draw
+
+
# TODO, move to space_view3d.py
class VIEW3D_PT_tools_weightpaint_options(Panel, View3DPaintPanel):
bl_context = ".weightpaint"
@@ -1363,6 +1388,11 @@ class VIEW3D_PT_tools_vertexpaint_symmetry(Panel, View3DPaintPanel):
bl_options = {'DEFAULT_CLOSED'}
bl_label = "Symmetry"
+ @classmethod
+ def poll(cls, context):
+ # When used in the tool header, this is explicitly included next to the XYZ symmetry buttons.
+ return (context.region.type != 'TOOL_HEADER')
+
def draw(self, context):
layout = self.layout
tool_settings = context.tool_settings
@@ -1370,6 +1400,14 @@ class VIEW3D_PT_tools_vertexpaint_symmetry(Panel, View3DPaintPanel):
draw_vpaint_symmetry(layout, vpaint)
+class VIEW3D_PT_tools_vertexpaint_symmetry_for_topbar(Panel):
+ bl_space_type = 'TOPBAR'
+ bl_region_type = 'HEADER'
+ bl_label = "Symmetry"
+
+ draw = VIEW3D_PT_tools_vertexpaint_symmetry.draw
+
+
# ********** default tools for texture-paint ****************
@@ -1407,6 +1445,11 @@ class VIEW3D_PT_tools_imagepaint_symmetry(Panel, View3DPaintPanel):
bl_label = "Symmetry"
bl_options = {'DEFAULT_CLOSED'}
+ @classmethod
+ def poll(cls, context):
+ # When used in the tool header, this is explicitly included next to the XYZ symmetry buttons.
+ return (context.region.type != 'TOOL_HEADER')
+
def draw(self, context):
layout = self.layout
@@ -2054,13 +2097,16 @@ classes = (
VIEW3D_PT_sculpt_dyntopo,
VIEW3D_PT_sculpt_dyntopo_remesh,
VIEW3D_PT_sculpt_symmetry,
+ VIEW3D_PT_sculpt_symmetry_for_topbar,
VIEW3D_PT_sculpt_options,
VIEW3D_PT_sculpt_options_unified,
VIEW3D_PT_sculpt_options_gravity,
VIEW3D_PT_tools_weightpaint_symmetry,
+ VIEW3D_PT_tools_weightpaint_symmetry_for_topbar,
VIEW3D_PT_tools_weightpaint_options,
VIEW3D_PT_tools_weightpaint_options_unified,
VIEW3D_PT_tools_vertexpaint_symmetry,
+ VIEW3D_PT_tools_vertexpaint_symmetry_for_topbar,
VIEW3D_PT_tools_vertexpaint_options,
VIEW3D_PT_tools_imagepaint_symmetry,
VIEW3D_PT_tools_imagepaint_options,