[Bf-blender-cvs] [402bde39d13] blender2.8: UI: show uv sculpt options in topbar & toolsettings

Campbell Barton noreply at git.blender.org
Fri Oct 5 07:02:12 CEST 2018


Commit: 402bde39d135d2bbc314743f37f65693597c57b1
Author: Campbell Barton
Date:   Fri Oct 5 14:53:18 2018 +1000
Branches: blender2.8
https://developer.blender.org/rB402bde39d135d2bbc314743f37f65693597c57b1

UI: show uv sculpt options in topbar & toolsettings

===================================================================

M	release/scripts/startup/bl_ui/space_image.py
M	release/scripts/startup/bl_ui/space_topbar.py
M	source/blender/editors/space_buttons/space_buttons.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py
index cf6db15e3a2..22f85ad37ae 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -1158,22 +1158,16 @@ class IMAGE_PT_tools_paint_options(BrushButtonsPanel, Panel):
 
 
 class IMAGE_PT_uv_sculpt_curve(Panel):
-    bl_space_type = 'IMAGE_EDITOR'
-    bl_region_type = 'TOOLS'
+    bl_space_type = 'PROPERTIES'
+    bl_region_type = 'WINDOW'
+    bl_context = ".uv_sculpt"  # dot on purpose (access from topbar)
+    bl_category = "Options"
     bl_label = "UV Sculpt Curve"
-    bl_category = "Tools"
     bl_options = {'DEFAULT_CLOSED'}
 
     @classmethod
     def poll(cls, context):
-        sima = context.space_data
-        toolsettings = context.tool_settings.image_paint
-
-        return (
-            sima.show_uvedit and
-            context.tool_settings.use_uv_sculpt and
-            not (sima.show_paint and toolsettings.brush)
-        )
+        return IMAGE_PT_uv_sculpt.poll(context)
 
     def draw(self, context):
         layout = self.layout
@@ -1193,39 +1187,45 @@ class IMAGE_PT_uv_sculpt_curve(Panel):
         row.operator("brush.curve_preset", icon='NOCURVE', text="").shape = 'MAX'
 
 
-class IMAGE_PT_uv_sculpt(Panel, ImagePaintPanel):
-    bl_space_type = 'IMAGE_EDITOR'
-    bl_region_type = 'TOOLS'
-    bl_category = "Tools"
+class IMAGE_PT_uv_sculpt(Panel):
+    bl_space_type = 'PROPERTIES'
+    bl_region_type = 'WINDOW'
+    bl_context = ".uv_sculpt"  # dot on purpose (access from topbar)
+    bl_category = "Options"
     bl_label = "UV Sculpt"
 
     @classmethod
     def poll(cls, context):
-        sima = context.space_data
-        toolsettings = context.tool_settings.image_paint
-        return (
-            sima.show_uvedit and
-            context.tool_settings.use_uv_sculpt and
-            not (sima.show_paint and toolsettings.brush)
-        )
+        tool_settings = context.tool_settings
+        if tool_settings.use_uv_sculpt:
+            if context.mode == 'EDIT_MESH':
+                workspace = context.workspace
+                space_type = workspace.tools_space_type
+                if space_type == 'IMAGE_EDITOR':
+                    mode = workspace.tools_mode
+                    if mode == 'VIEW':
+                        return True
+        return False
 
     def draw(self, context):
+        from .properties_paint_common import UnifiedPaintPanel
         layout = self.layout
 
         toolsettings = context.tool_settings
         uvsculpt = toolsettings.uv_sculpt
         brush = uvsculpt.brush
 
-        if brush:
-            col = layout.column()
+        if not self.is_popover:
+            if brush:
+                col = layout.column()
 
-            row = col.row(align=True)
-            self.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
-            self.prop_unified_size(row, context, brush, "use_pressure_size")
+                row = col.row(align=True)
+                UnifiedPaintPanel.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
+                UnifiedPaintPanel.prop_unified_size(row, context, brush, "use_pressure_size")
 
-            row = col.row(align=True)
-            self.prop_unified_strength(row, context, brush, "strength", slider=True, text="Strength")
-            self.prop_unified_strength(row, context, brush, "use_pressure_strength")
+                row = col.row(align=True)
+                UnifiedPaintPanel.prop_unified_strength(row, context, brush, "strength", slider=True, text="Strength")
+                UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength")
 
         col = layout.column()
         col.prop(toolsettings, "uv_sculpt_lock_borders")
diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py
index 4406df5cd7b..2712d09c272 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -162,6 +162,13 @@ class TOPBAR_HT_lower_bar(Header):
                 layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".greasepencil_sculpt", category="")
             elif tool_mode == 'GPENCIL_WEIGHT':
                 layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".greasepencil_weight", category="")
+        elif tool_space_type == 'IMAGE_EDITOR':
+            if tool_mode == 'VIEW':
+                mode = context.mode
+                if mode == 'EDIT_MESH':
+                    tool_settings = context.tool_settings
+                    if tool_settings.use_uv_sculpt:
+                        layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".uv_sculpt", category="")
 
     def draw_center(self, context):
         pass
@@ -301,6 +308,24 @@ class _draw_left_context_mode:
                         layout.row().prop(brush, "puff_mode", expand=True)
                         layout.prop(brush, "use_puff_volume")
 
+    class IMAGE_EDITOR:
+        def VIEW(context, layout, tool):
+            tool_settings = context.tool_settings
+            if tool_settings.use_uv_sculpt:
+                if context.mode == 'EDIT_MESH':
+                    uv_sculpt = tool_settings.uv_sculpt
+                    brush = uv_sculpt.brush
+                    if brush:
+                        from .properties_paint_common import UnifiedPaintPanel
+
+                        row = layout.row(align=True)
+                        UnifiedPaintPanel.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
+                        UnifiedPaintPanel.prop_unified_size(row, context, brush, "use_pressure_size")
+
+                        row = layout.row(align=True)
+                        UnifiedPaintPanel.prop_unified_strength(row, context, brush, "strength", slider=True, text="Strength")
+                        UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength")
+
 
 class TOPBAR_PT_gpencil_layers(Panel):
     bl_space_type = 'VIEW_3D'
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
index 56d70d10a96..14ab00cbef5 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -260,7 +260,10 @@ static void buttons_main_region_layout_tool(const bContext *C, ARegion *ar)
 		}
 	}
 	else if (workspace->tools_space_type == SPACE_IMAGE) {
-		/* TODO */
+		switch (mode) {
+			case CTX_MODE_EDIT_MESH:
+				ARRAY_SET_ITEMS(contexts, ".uv_sculpt");
+		}
 	}
 
 	/* for grease pencil we don't use tool system yet, so we need check outside



More information about the Bf-blender-cvs mailing list