From 4b7b1ba114812caaa096ac2994051f8148bea9a5 Mon Sep 17 00:00:00 2001 From: William Reynish Date: Wed, 31 Oct 2018 17:23:43 +0100 Subject: UI: more single column layout for brush and render properties. --- .../scripts/startup/bl_ui/space_view3d_toolbar.py | 355 ++++++++++++++------- 1 file changed, 241 insertions(+), 114 deletions(-) (limited to 'release/scripts/startup/bl_ui/space_view3d_toolbar.py') diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index e8fffe0c309..9ab2465d7e2 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -88,6 +88,7 @@ class VIEW3D_PT_tools_meshedit_options(View3DPanel, Panel): bl_category = "Options" bl_context = ".mesh_edit" # dot on purpose (access from topbar) bl_label = "Mesh Options" + bl_options = {'DEFAULT_CLOSED'} @classmethod def poll(cls, context): @@ -111,11 +112,11 @@ class VIEW3D_PT_tools_meshedit_options(View3DPanel, Panel): row.active = ob.data.use_mirror_x row.prop(mesh, "use_mirror_topology") - layout.prop(tool_settings, "edge_path_mode") layout.prop(tool_settings, "edge_path_live_unwrap") - layout.prop(tool_settings, "double_threshold") - layout.prop(tool_settings, "use_mesh_automerge") # , icon='AUTOMERGE_ON' + layout.prop(tool_settings, "use_mesh_automerge") + layout.prop(tool_settings, "double_threshold") + layout.prop(tool_settings, "edge_path_mode") # ********** default tools for editmode_curve **************** @@ -620,6 +621,8 @@ class VIEW3D_PT_tools_brush_overlay(Panel, View3DPaintPanel): def draw(self, context): layout = self.layout + layout.use_property_split = True + layout.use_property_decorate = False settings = self.paint_settings(context) brush = settings.brush @@ -628,54 +631,33 @@ class VIEW3D_PT_tools_brush_overlay(Panel, View3DPaintPanel): col = layout.column() - col.label(text="Curve:") row = col.row(align=True) - row.prop( - brush, - "use_cursor_overlay", - text="", - toggle=True, - icon='RESTRICT_VIEW_OFF' if brush.use_cursor_overlay else 'RESTRICT_VIEW_ON', - ) + sub = row.row(align=True) - sub.prop(brush, "cursor_overlay_alpha", text="Alpha") + sub.prop(brush, "cursor_overlay_alpha", text="Curve Alpha") sub.prop(brush, "use_cursor_overlay_override", toggle=True, text="", icon='BRUSH_DATA') + row.prop(brush,"use_cursor_overlay", text="", toggle=True, icon='HIDE_ON' if brush.use_cursor_overlay else 'HIDE_OFF') col.active = brush.brush_capabilities.has_overlay if context.image_paint_object or context.sculpt_object or context.vertex_paint_object: - col.label(text="Texture:") row = col.row(align=True) - if tex_slot.map_mode != 'STENCIL': - row.prop( - brush, - "use_primary_overlay", - text="", - toggle=True, - icon='RESTRICT_VIEW_OFF' if brush.use_primary_overlay else 'RESTRICT_VIEW_ON', - ) sub = row.row(align=True) - sub.prop(brush, "texture_overlay_alpha", text="Alpha") + sub.prop(brush, "texture_overlay_alpha", text="Texture Alpha") sub.prop(brush, "use_primary_overlay_override", toggle=True, text="", icon='BRUSH_DATA') + if tex_slot.map_mode != 'STENCIL': + row.prop(brush, "use_primary_overlay", text="", toggle=True, icon='HIDE_ON' if brush.use_primary_overlay else 'HIDE_OFF') if context.image_paint_object: - col.label(text="Mask Texture:") - row = col.row(align=True) - if tex_slot_mask.map_mode != 'STENCIL': - row.prop( - brush, - "use_secondary_overlay", - text="", - toggle=True, - icon='RESTRICT_VIEW_OFF' if brush.use_secondary_overlay else 'RESTRICT_VIEW_ON', - ) sub = row.row(align=True) - sub.prop(brush, "mask_overlay_alpha", text="Alpha") + sub.prop(brush, "mask_overlay_alpha", text="Mask Texture Alpha") sub.prop(brush, "use_secondary_overlay_override", toggle=True, text="", icon='BRUSH_DATA') + if tex_slot_mask.map_mode != 'STENCIL': + row.prop(brush, "use_secondary_overlay", text="", toggle=True, icon='HIDE_ON' if brush.use_secondary_overlay else 'HIDE_OFF') # TODO, move to space_view3d.py @@ -755,32 +737,26 @@ class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel): col.prop(brush, "stroke_method") if brush.use_anchor: - col.separator() col.prop(brush, "use_edge_to_edge", text="Edge To Edge") if brush.use_airbrush: - col.separator() col.prop(brush, "rate", text="Rate", slider=True) if brush.use_space: - col.separator() row = col.row(align=True) row.prop(brush, "spacing", text="Spacing") row.prop(brush, "use_pressure_spacing", toggle=True, text="") if brush.use_line or brush.use_curve: - col.separator() row = col.row(align=True) row.prop(brush, "spacing", text="Spacing") if brush.use_curve: - col.separator() col.template_ID(brush, "paint_curve", new="paintcurve.new") col.operator("paintcurve.draw") if context.sculpt_object: if brush.sculpt_capabilities.has_jitter: - col.separator() row = col.row(align=True) if brush.use_relative_jitter: @@ -790,39 +766,52 @@ class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel): row.prop(brush, "use_relative_jitter", icon_only=True) row.prop(brush, "use_pressure_jitter", toggle=True, text="") - if brush.sculpt_capabilities.has_smooth_stroke: - col = layout.column() - col.separator() - - col.prop(brush, "use_smooth_stroke") - - sub = col.column() - sub.active = brush.use_smooth_stroke - sub.prop(brush, "smooth_stroke_radius", text="Radius", slider=True) - sub.prop(brush, "smooth_stroke_factor", text="Factor", slider=True) else: - col.separator() row = col.row(align=True) - row.prop(brush, "use_relative_jitter", icon_only=True) if brush.use_relative_jitter: row.prop(brush, "jitter", slider=True) else: row.prop(brush, "jitter_absolute") + row.prop(brush, "use_relative_jitter", icon_only=True) row.prop(brush, "use_pressure_jitter", toggle=True, text="") col = layout.column() - col.separator() - if brush.brush_capabilities.has_smooth_stroke: - col.prop(brush, "use_smooth_stroke") + layout.prop(settings, "input_samples") - sub = col.column() - sub.active = brush.use_smooth_stroke - sub.prop(brush, "smooth_stroke_radius", text="Radius", slider=True) - sub.prop(brush, "smooth_stroke_factor", text="Factor", slider=True) - layout.prop(settings, "input_samples") +class VIEW3D_PT_tools_brush_stroke_smooth_stroke(Panel, View3DPaintPanel): + bl_context = ".paint_common" # dot on purpose (access from topbar) + bl_label = "Smooth Stroke" + bl_parent_id = "VIEW3D_PT_tools_brush_stroke" + bl_options = {'DEFAULT_CLOSED'} + + @classmethod + def poll(cls, context): + settings = cls.paint_settings(context) + brush = settings.brush + if brush.brush_capabilities.has_smooth_stroke: + return True + + def draw_header(self, context): + settings = self.paint_settings(context) + brush = settings.brush + + self.layout.prop(brush, "use_smooth_stroke", text="") + + def draw(self, context): + layout = self.layout + layout.use_property_split = True + layout.use_property_decorate = False + + settings = self.paint_settings(context) + brush = settings.brush + + col = layout.column() + col.active = brush.use_smooth_stroke + col.prop(brush, "smooth_stroke_radius", text="Radius", slider=True) + col.prop(brush, "smooth_stroke_factor", text="Factor", slider=True) # TODO, move to space_view3d.py @@ -904,15 +893,37 @@ class VIEW3D_PT_sculpt_dyntopo(Panel, View3DPaintPanel): col.prop(sculpt, "use_smooth_shading") - col.separator() + +class VIEW3D_PT_sculpt_dyntopo_remesh(Panel, View3DPaintPanel): + bl_context = ".sculpt_mode" # dot on purpose (access from topbar) + bl_label = "Remesh" + bl_parent_id = "VIEW3D_PT_sculpt_dyntopo" + bl_options = {'DEFAULT_CLOSED'} + bl_ui_units_x = 12 + + def draw(self, context): + layout = self.layout + layout.use_property_split = True + layout.use_property_decorate = False + + toolsettings = context.tool_settings + sculpt = toolsettings.sculpt + + col = layout.column() + col.active = context.sculpt_object.use_dynamic_topology_sculpting col.prop(sculpt, "symmetrize_direction") + + flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False) + + col = flow.column() col.operator("sculpt.symmetrize") + col = flow.column() col.operator("sculpt.optimize") if sculpt.detail_type_method in {'CONSTANT', 'MANUAL'}: + col = flow.column() col.operator("sculpt.detail_flood_fill") - # TODO, move to space_view3d.py class VIEW3D_PT_sculpt_options(Panel, View3DPaintPanel): bl_context = ".sculpt_mode" # dot on purpose (access from topbar) @@ -925,25 +936,64 @@ class VIEW3D_PT_sculpt_options(Panel, View3DPaintPanel): def draw(self, context): layout = self.layout + layout.use_property_split = True + layout.use_property_decorate = False + + toolsettings = context.tool_settings + sculpt = toolsettings.sculpt + + flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False) + + col = flow.column() + col.prop(sculpt, "use_threaded", text="Threaded Sculpt") + col = flow.column() + col.prop(sculpt, "show_low_resolution") + col = flow.column() + col.prop(sculpt, "use_deform_only") + col = flow.column() + col.prop(sculpt, "show_diffuse_color") + col = flow.column() + col.prop(sculpt, "show_mask") + + +class VIEW3D_PT_sculpt_options_unified(Panel, View3DPaintPanel): + bl_context = ".sculpt_mode" # dot on purpose (access from topbar) + bl_parent_id = "VIEW3D_PT_sculpt_options" + bl_label = "Unified Brush" + + @classmethod + def poll(cls, context): + return (context.sculpt_object and context.tool_settings.sculpt) + + def draw(self, context): + layout = self.layout + layout.use_property_split = True + layout.use_property_decorate = False + + self.unified_paint_settings(layout, context) + +class VIEW3D_PT_sculpt_options_gravity(Panel, View3DPaintPanel): + bl_context = ".sculpt_mode" # dot on purpose (access from topbar) + bl_parent_id = "VIEW3D_PT_sculpt_options" + bl_label = "Gravity" + + @classmethod + def poll(cls, context): + return (context.sculpt_object and context.tool_settings.sculpt) + + def draw(self, context): + layout = self.layout + layout.use_property_split = True + layout.use_property_decorate = False toolsettings = context.tool_settings sculpt = toolsettings.sculpt capabilities = sculpt.brush.sculpt_capabilities - col = layout.column(align=True) + col = layout.column() col.active = capabilities.has_gravity - col.label(text="Gravity:") col.prop(sculpt, "gravity", slider=True, text="Factor") col.prop(sculpt, "gravity_object") - col.separator() - - layout.prop(sculpt, "use_threaded", text="Threaded Sculpt") - layout.prop(sculpt, "show_low_resolution") - layout.prop(sculpt, "use_deform_only") - layout.prop(sculpt, "show_diffuse_color") - layout.prop(sculpt, "show_mask") - - self.unified_paint_settings(layout, context) # TODO, move to space_view3d.py @@ -1023,35 +1073,68 @@ class VIEW3D_PT_tools_brush_appearance(Panel, View3DPaintPanel): def draw(self, context): layout = self.layout - settings = self.paint_settings(context) - brush = settings.brush - if brush is None: # unlikely but can happen layout.label(text="Brush Unset") return - col = layout.column() - col.prop(settings, "show_brush") - sub = col.column() - sub.active = settings.show_brush +class VIEW3D_PT_tools_brush_appearance_show_brush(Panel, View3DPaintPanel): + bl_context = ".paint_common" # dot on purpose (access from topbar) + bl_label = "Show Brush" + bl_parent_id = "VIEW3D_PT_tools_brush_appearance" + bl_options = {'DEFAULT_CLOSED'} + + def draw_header(self, context): + settings = self.paint_settings(context) + + self.layout.prop(settings, "show_brush", text="") + + def draw(self, context): + layout = self.layout + + layout.use_property_split = True + layout.use_property_decorate = False + + settings = self.paint_settings(context) + brush = settings.brush + + col = layout.column() + col.active = settings.show_brush if context.sculpt_object and context.tool_settings.sculpt: if brush.sculpt_capabilities.has_secondary_color: - sub.row().prop(brush, "cursor_color_add", text="Add") - sub.row().prop(brush, "cursor_color_subtract", text="Subtract") + col.prop(brush, "cursor_color_add", text="Add") + col.prop(brush, "cursor_color_subtract", text="Subtract") else: - sub.prop(brush, "cursor_color_add", text="") + col.prop(brush, "cursor_color_add", text="Color") else: - sub.prop(brush, "cursor_color_add", text="") + col.prop(brush, "cursor_color_add", text="Color") - col.separator() - col = col.column(align=True) - col.prop(brush, "use_custom_icon") - sub = col.column() - sub.active = brush.use_custom_icon - sub.prop(brush, "icon_filepath", text="") +class VIEW3D_PT_tools_brush_appearance_custom_icon(Panel, View3DPaintPanel): + bl_context = ".paint_common" # dot on purpose (access from topbar) + bl_label = "Custom Icon" + bl_parent_id = "VIEW3D_PT_tools_brush_appearance" + bl_options = {'DEFAULT_CLOSED'} + + def draw_header(self, context): + settings = self.paint_settings(context) + brush = settings.brush + + self.layout.prop(brush, "use_custom_icon", text="") + + def draw(self, context): + layout = self.layout + + layout.use_property_split = True + layout.use_property_decorate = False + + settings = self.paint_settings(context) + brush = settings.brush + + col = layout.column() + col.active = brush.use_custom_icon + col.prop(brush, "icon_filepath", text="") # ********** default tools for weight-paint **************** @@ -1133,17 +1216,22 @@ class VIEW3D_PT_tools_imagepaint_external(Panel, View3DPaintPanel): def draw(self, context): layout = self.layout + layout.use_property_split = True + layout.use_property_decorate = False toolsettings = context.tool_settings ipaint = toolsettings.image_paint - col = layout.column() - row = col.split(factor=0.55, align=True) - row.operator("image.project_edit", text="Quick Edit") - row.operator("image.project_apply", text="Apply") + layout.prop(ipaint, "screen_grab_size", text="Screen Grab Size") - col.row().prop(ipaint, "screen_grab_size", text="") + layout.separator() + flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False) + col = flow.column() + col.operator("image.project_edit", text="Quick Edit") + col = flow.column() + col.operator("image.project_apply", text="Apply") + col = flow.column() col.operator("paint.project_image", text="Apply Camera Image") @@ -1187,14 +1275,12 @@ class VIEW3D_PT_tools_projectpaint(View3DPaintPanel, Panel): def draw(self, context): layout = self.layout + layout.use_property_split = True + layout.use_property_decorate = False + toolsettings = context.tool_settings ipaint = toolsettings.image_paint - col = layout.column() - - col.prop(ipaint, "use_occlude") - col.prop(ipaint, "use_backface_culling") - row = layout.row() row.prop(ipaint, "use_normal_falloff") @@ -1202,14 +1288,51 @@ class VIEW3D_PT_tools_projectpaint(View3DPaintPanel, Panel): sub.active = (ipaint.use_normal_falloff) sub.prop(ipaint, "normal_angle", text="") - layout.prop(ipaint, "use_cavity") - if ipaint.use_cavity: - layout.template_curve_mapping(ipaint, "cavity_curve", brush=True) - layout.prop(ipaint, "seam_bleed") layout.prop(ipaint, "dither") + + flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False) + + col = flow.column() + col.prop(ipaint, "use_occlude") + + col = flow.column() + col.prop(ipaint, "use_backface_culling") + +class VIEW3D_PT_tools_projectpaint_unified(Panel, View3DPaintPanel): + bl_context = ".imagepaint" # dot on purpose (access from topbar) + bl_parent_id = "VIEW3D_PT_tools_projectpaint" + bl_label = "Unified Brush" + + def draw(self, context): + layout = self.layout + layout.use_property_split = True + layout.use_property_decorate = False + self.unified_paint_settings(layout, context) +class VIEW3D_PT_tools_projectpaint_cavity(View3DPaintPanel, Panel): + bl_context = ".imagepaint" # dot on purpose (access from topbar) + bl_label = "Cavity Mask" + bl_parent_id = "VIEW3D_PT_tools_projectpaint" + bl_options = {'DEFAULT_CLOSED'} + + def draw_header(self, context): + toolsettings = context.tool_settings + ipaint = toolsettings.image_paint + + self.layout.prop(ipaint, "use_cavity", text="") + + def draw(self, context): + layout = self.layout + + toolsettings = context.tool_settings + ipaint = toolsettings.image_paint + + layout.active = ipaint.use_cavity + + layout.template_curve_mapping(ipaint, "cavity_curve", brush=True) + # TODO, move to space_view3d.py class VIEW3D_PT_imagepaint_options(View3DPaintPanel): @@ -1312,22 +1435,18 @@ class VIEW3D_PT_tools_particlemode(View3DPanel, Panel): class VIEW3D_PT_tools_normal(View3DPanel, Panel): bl_category = "" bl_context = ".mesh_edit" - bl_label = "Normal Tools" + bl_label = "Normals" + bl_options = {'DEFAULT_CLOSED'} def draw(self, context): layout = self.layout - toolsettings = context.tool_settings - - col = layout.column(align=True) - col.label(text="Normal Vector") - col.prop(toolsettings, "normal_vector", text="") - - layout.separator() - layout.label(text="Face Strength") - layout.prop(toolsettings, "face_strength", text="") + layout.use_property_split = True + layout.use_property_decorate = False # No animation. - col = layout.column(align=True) + toolsettings = context.tool_settings + layout.prop(toolsettings, "normal_vector", text="Normal Vector") + layout.prop(toolsettings, "face_strength", text="Face Strength") # ********** grease pencil object tool panels **************** @@ -1752,11 +1871,17 @@ classes = ( VIEW3D_PT_tools_brush_texture, VIEW3D_PT_tools_mask_texture, VIEW3D_PT_tools_brush_stroke, + VIEW3D_PT_tools_brush_stroke_smooth_stroke, VIEW3D_PT_tools_brush_curve, VIEW3D_PT_sculpt_dyntopo, + VIEW3D_PT_sculpt_dyntopo_remesh, VIEW3D_PT_sculpt_options, + VIEW3D_PT_sculpt_options_unified, + VIEW3D_PT_sculpt_options_gravity, VIEW3D_PT_sculpt_symmetry, VIEW3D_PT_tools_brush_appearance, + VIEW3D_PT_tools_brush_appearance_show_brush, + VIEW3D_PT_tools_brush_appearance_custom_icon, VIEW3D_PT_tools_weightpaint_symmetry, VIEW3D_PT_tools_weightpaint_options, VIEW3D_PT_tools_vertexpaint, @@ -1764,6 +1889,8 @@ classes = ( VIEW3D_PT_tools_imagepaint_external, VIEW3D_PT_tools_imagepaint_symmetry, VIEW3D_PT_tools_projectpaint, + VIEW3D_PT_tools_projectpaint_unified, + VIEW3D_PT_tools_projectpaint_cavity, VIEW3D_MT_tools_projectpaint_stencil, VIEW3D_PT_tools_particlemode, -- cgit v1.2.3