def stroke_curve_snap(parent):
        paint_settings = UnifiedPaintPanel.paint_settings(parent.context)
        if paint_settings:
            brush = paint_settings.brush
            if brush and hasattr(
                    brush, "stroke_method") and brush.stroke_method == 'CURVE':
                snap_items = ToolSettings.bl_rna.properties[
                    "snap_elements"].enum_items
                tool_settings = parent.context.tool_settings
                snap_elements = tool_settings.snap_elements
                if len(snap_elements) == 1:
                    text = ""
                    for elem in snap_elements:
                        icon = snap_items[elem].icon
                        break
                else:
                    text = "Mix"
                    icon = 'NONE'
                del snap_items, snap_elements

                row = parent.layout.row(align=True)
                row.prop(tool_settings, "use_snap", text="")

                sub = row.row(align=True)
                sub.popover(
                    panel="VIEW3D_PT_snapping",
                    icon=icon,
                    text=text,
                )
                return 2.6
        return -1  # Invalid
Beispiel #2
0
    def draw(self, context):
        layout = self.layout

        settings = UnifiedPaintPanel.paint_settings(context)
        brush = settings.brush

        pie = layout.menu_pie()
        pie.operator_enum("brush", "stroke_method")
    def poll(cls, context):
        settings = UnifiedPaintPanel.paint_settings(context)
        if not settings:
            return False

        brush = settings.brush
        tex_slot = brush.texture_slot

        return tex_slot.has_texture_angle and tex_slot.has_texture_angle_source
Beispiel #4
0
    def draw(self, context):
        layout = self.layout
        settings = UnifiedPaintPanel.paint_settings(context)
        brush = settings.brush

        sculpt_tool = brush.sculpt_tool

        pie = layout.menu_pie()
        pie.operator_enum("brush.curve_preset", "shape")
 def brush_selector(parent):
     paint_settings = UnifiedPaintPanel.paint_settings(parent.context)
     if paint_settings:
         rows_cols = parent.prefs.brush_selector_grid_size
         parent.layout.template_ID_preview(paint_settings,
                                           "brush",
                                           rows=rows_cols[0],
                                           cols=rows_cols[1],
                                           hide_buttons=True)
         return 7.6
     return -1
Beispiel #6
0
    def draw(self, context):
        layout = self.layout
        settings = UnifiedPaintPanel.paint_settings(context)
        colum_n = utils_core.addon_settings(lists=False)

        if utils_core.addon_settings(lists=True) != 'popup':
            layout.label(text="Seems no active brush", icon="INFO")
            layout.label(text="in the Tool Shelf", icon="BACK")

        layout.template_ID_preview(settings, "brush",
                                   new="brush.add", rows=3, cols=colum_n)
    def draw(self, context):
        layout = self.layout
        settings = UnifiedPaintPanel.paint_settings(context)

        # check if brush exists (for instance, in paint mode before adding a slot)
        if hasattr(settings, 'brush'):
            brush = settings.brush
        else:
            brush = None

        if not brush:
            layout.label(text="No Brushes currently available", icon="INFO")
            return

        if not context.particle_edit_object:
            if UseBrushesLists():
                flow = layout.column_flow(columns=3)

                for brsh in bpy.data.brushes:
                    if (context.sculpt_object and brsh.use_paint_sculpt):
                        props = flow.operator("wm.context_set_id",
                                              text=brsh.name,
                                              icon_value=layout.icon(brsh))
                        props.data_path = "tool_settings.sculpt.brush"
                        props.value = brsh.name
                    elif (context.image_paint_object and brsh.use_paint_image):
                        props = flow.operator("wm.context_set_id",
                                              text=brsh.name,
                                              icon_value=layout.icon(brsh))
                        props.data_path = "tool_settings.image_paint.brush"
                        props.value = brsh.name
                    elif (context.vertex_paint_object
                          and brsh.use_paint_vertex):
                        props = flow.operator("wm.context_set_id",
                                              text=brsh.name,
                                              icon_value=layout.icon(brsh))
                        props.data_path = "tool_settings.vertex_paint.brush"
                        props.value = brsh.name
                    elif (context.weight_paint_object
                          and brsh.use_paint_weight):
                        props = flow.operator("wm.context_set_id",
                                              text=brsh.name,
                                              icon_value=layout.icon(brsh))
                        props.data_path = "tool_settings.weight_paint.brush"
                        props.value = brsh.name
            else:
                layout.template_ID_preview(settings,
                                           "brush",
                                           new="brush.add",
                                           rows=3,
                                           cols=8)
Beispiel #8
0
    def draw(self, context):
        layout = self.layout
        settings = UnifiedPaintPanel.paint_settings(context)
        colum_n = utils_core.addon_settings(lists=False)

        if utils_core.addon_settings(lists=True) != 'popup':
            layout.label(text="Seems no active brush", icon="INFO")
            layout.label(text="in the Tool Shelf", icon="BACK")

        layout.template_ID_preview(settings,
                                   "brush",
                                   new="brush.add",
                                   rows=3,
                                   cols=colum_n)
Beispiel #9
0
    def draw(self, context):
        layout = self.layout

        settings = UnifiedPaintPanel.paint_settings(context)
        brush = settings.brush

        flow = layout.column_flow(columns=2)
        for brush in bpy.data.brushes:
            if context.sculpt_object:
                if brush.use_paint_sculpt:

                    row = flow.row(1)
                    row.label(icon_value=row.icon(brush))

                    props = row.operator("wm.context_set_id", text=brush.name)
                    props.data_path = "tool_settings.sculpt.brush"
                    props.value = brush.name
Beispiel #10
0
    def draw(self, context):
        layout = self.layout

        settings = UnifiedPaintPanel.paint_settings(context)
        brush = settings.brush

        flow = layout.column_flow(columns=2)
        for brush in bpy.data.brushes:
            if context.sculpt_object:
                if brush.use_paint_sculpt:
                   
                    row = flow.row(1)
                    row.label(icon_value=row.icon(brush))
                   
                    props = row.operator("wm.context_set_id", text=brush.name)
                    props.data_path = "tool_settings.sculpt.brush"
                    props.value = brush.name
    def draw(self, context):
        layout = self.layout

        settings = UnifiedPaintPanel.paint_settings(context)
        brush = settings.brush

        sculpt = (context.sculpt_object is not None)

        tex_slot = brush.texture_slot

        layout.prop(tex_slot, "use_rake", text="Rake")

        if brush.brush_capabilities.has_random_texture_angle and tex_slot.has_random_texture_angle:
            if sculpt:
                if brush.sculpt_capabilities.has_random_texture_angle:
                    layout.prop(tex_slot, "use_random", text="Random")
            else:
                layout.prop(tex_slot, "use_random", text="Random")
    def draw(self, context):
        layout = self.layout
        settings = UnifiedPaintPanel.paint_settings(context)
        brush = getattr(settings, "brush", None)

        ups = context.tool_settings.unified_paint_settings
        layout.prop(ups, "use_unified_size", text="Unified Size")
        layout.prop(ups, "use_unified_strength", text="Unified Strength")
        if context.image_paint_object or context.vertex_paint_object:
            layout.prop(ups, "use_unified_color", text="Unified Color")
        layout.separator()

        if not brush:
            layout.label(text="No Brushes currently available", icon="INFO")
            return

        layout.menu("VIEW3D_MT_brush_paint_modes")

        if context.sculpt_object:
            sculpt_tool = brush.sculpt_tool

            layout.separator()
            layout.operator_menu_enum("brush.curve_preset",
                                      "shape",
                                      text="Curve Preset")
            layout.separator()

            if sculpt_tool != 'GRAB':
                layout.prop_menu_enum(brush, "stroke_method")

                if sculpt_tool in {
                        'DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'
                }:
                    layout.prop_menu_enum(brush, "direction")

                if sculpt_tool == 'LAYER':
                    layout.prop(brush, "use_persistent")
                    layout.operator("sculpt.set_persistent_base")
Beispiel #13
0
    def draw(self, context):
        if (context.mode != "SCULPT"):
            super().draw(context)
            return
        # Not a brush but a tool.
        elif not UnifiedPaintPanel.paint_settings(context):
            super().draw(context)
            return

        # self.layout.template_header() # to change region

        # VARIABLES
        self.act_obj = context.active_object
        toolsettings = context.tool_settings
        self.sculpt = toolsettings.sculpt
        self.brush = brush = self.sculpt.brush

        wm = context.window_manager
        scn = context.scene

        # Not a brush but a tool.
        if brush is None:
            return

        self.capabilities = self.brush.sculpt_capabilities
        self.ups = toolsettings.unified_paint_settings
        self.context = context

        self.prefs = context.preferences.addons[main_package].preferences
        self.sep = 5 * context.preferences.view.ui_scale

        self.props = scn.bas_custom_ui

        layout = self.layout

        for block in blocks:
            block(self)
Beispiel #14
0
    def draw(self, context):
        datapath, icon = self.init()
        menu = utils_core.Menu(self)
        settings = UnifiedPaintPanel.paint_settings(context)
        colum_n = utils_core.addon_settings(lists=False)

        menu.add_item().label(text="Brush")
        menu.add_item().separator()

        has_brush = utils_core.get_brush_link(context, types="brush")
        current_brush = eval(
            "bpy.context.{}".format(datapath)) if has_brush else None

        # get the current brush's name
        if current_brush and utils_core.get_mode() != utils_core.particle_edit:
            current_brush = current_brush.name

        if utils_core.get_mode() == utils_core.particle_edit:
            particle_tools = [["None", 'NONE'], ["Comb", 'COMB'],
                              ["Smooth", 'SMOOTH'], ["Add", 'ADD'],
                              ["Length", 'LENGTH'], ["Puff", 'PUFF'],
                              ["Cut", 'CUT'], ["Weight", 'WEIGHT']]

            # if you are in particle edit mode add the menu items for particle mode
            for tool in particle_tools:
                utils_core.menuprop(menu.add_item(),
                                    tool[0],
                                    tool[1],
                                    datapath,
                                    icon='RADIOBUT_OFF',
                                    disable=True,
                                    disable_icon='RADIOBUT_ON')
        else:
            column_flow = menu.add_item("column_flow", columns=colum_n)
            if utils_core.addon_settings(lists=True) == 'template':
                self.layout.template_ID_preview(settings,
                                                "brush",
                                                new="brush.add",
                                                rows=3,
                                                cols=colum_n)
            else:
                # iterate over all the brushes
                for item in bpy.data.brushes:
                    if utils_core.get_mode() == utils_core.sculpt:
                        if item.use_paint_sculpt:
                            # if you are in sculpt mode and the brush
                            # is a sculpt brush add the brush to the menu
                            utils_core.menuprop(
                                menu.add_item(parent=column_flow),
                                item.name,
                                'bpy.data.brushes["%s"]' % item.name,
                                datapath,
                                icon=icon[item.sculpt_tool],
                                disable=True,
                                custom_disable_exp=[item.name, current_brush],
                                path=True)
                    if utils_core.get_mode() == utils_core.vertex_paint:
                        if item.use_paint_vertex:
                            # if you are in vertex paint mode and the brush
                            # is a vertex paint brush add the brush to the menu
                            utils_core.menuprop(
                                menu.add_item(parent=column_flow),
                                item.name,
                                'bpy.data.brushes["%s"]' % item.name,
                                datapath,
                                icon=icon[item.vertex_tool],
                                disable=True,
                                custom_disable_exp=[item.name, current_brush],
                                path=True)
                    if utils_core.get_mode() == utils_core.weight_paint:
                        if item.use_paint_weight:
                            # if you are in weight paint mode and the brush
                            # is a weight paint brush add the brush to the menu
                            utils_core.menuprop(
                                menu.add_item(parent=column_flow),
                                item.name,
                                'bpy.data.brushes["%s"]' % item.name,
                                datapath,
                                icon=icon[item.vertex_tool],
                                disable=True,
                                custom_disable_exp=[item.name, current_brush],
                                path=True)
                    if utils_core.get_mode() == utils_core.texture_paint:
                        if item.use_paint_image:
                            # if you are in texture paint mode and the brush
                            # is a texture paint brush add the brush to the menu
                            utils_core.menuprop(
                                menu.add_item(parent=column_flow),
                                item.name,
                                'bpy.data.brushes["%s"]' % item.name,
                                datapath,
                                icon=icon[item.image_tool],
                                disable=True,
                                custom_disable_exp=[item.name, current_brush],
                                path=True)
Beispiel #15
0
    def draw(self, context):
        mode = utils_core.get_mode()
        layout = self.layout
        settings = UnifiedPaintPanel.paint_settings(context)
        colum_n = utils_core.addon_settings(lists=False)

        layout.row().label(text="Brush")
        layout.row().separator()

        has_brush = utils_core.get_brush_link(context, types="brush")
        current_brush = eval("bpy.context.{}".format(
            brush_datapath[mode])) if has_brush else None

        # get the current brush's name
        if current_brush and utils_core.get_mode() != 'PARTICLE_EDIT':
            current_brush = current_brush.name

        if mode == 'PARTICLE_EDIT':
            # if you are in particle edit mode add the menu items for particle mode
            for tool in particle_tools:
                utils_core.menuprop(layout.row(),
                                    tool[0],
                                    tool[1],
                                    brush_datapath[mode],
                                    icon='RADIOBUT_OFF',
                                    disable=True,
                                    disable_icon='RADIOBUT_ON')
        else:
            column_flow = layout.column_flow(columns=colum_n)
            if utils_core.addon_settings(lists=True) == 'template':
                layout.template_ID_preview(settings,
                                           "brush",
                                           new="brush.add",
                                           rows=3,
                                           cols=colum_n)
            else:
                # iterate over all the brushes
                for item in bpy.data.brushes:
                    if mode == 'SCULPT':
                        if item.use_paint_sculpt:
                            # if you are in sculpt mode and the brush
                            # is a sculpt brush add the brush to the menu
                            utils_core.menuprop(
                                column_flow.row(),
                                item.name,
                                'bpy.data.brushes["%s"]' % item.name,
                                brush_datapath[mode],
                                icon=brush_icon[mode][item.sculpt_tool],
                                disable=True,
                                custom_disable_exp=(item.name, current_brush),
                                path=True)
                    if mode == 'VERTEX_PAINT':
                        if item.use_paint_vertex:
                            # if you are in vertex paint mode and the brush
                            # is a vertex paint brush add the brush to the menu
                            utils_core.menuprop(
                                column_flow.row(),
                                item.name,
                                'bpy.data.brushes["%s"]' % item.name,
                                brush_datapath[mode],
                                icon=brush_icon[mode][item.vertex_tool],
                                disable=True,
                                custom_disable_exp=(item.name, current_brush),
                                path=True)
                    if mode == 'WEIGHT_PAINT':
                        if item.use_paint_weight:
                            # if you are in weight paint mode and the brush
                            # is a weight paint brush add the brush to the menu
                            utils_core.menuprop(
                                column_flow.row(),
                                item.name,
                                'bpy.data.brushes["%s"]' % item.name,
                                brush_datapath[mode],
                                icon=brush_icon[mode][item.vertex_tool],
                                disable=True,
                                custom_disable_exp=(item.name, current_brush),
                                path=True)
                    if utils_core.get_mode() == 'TEXTURE_PAINT':
                        if item.use_paint_image:
                            # if you are in texture paint mode and the brush
                            # is a texture paint brush add the brush to the menu
                            utils_core.menuprop(
                                column_flow.row(),
                                item.name,
                                'bpy.data.brushes["%s"]' % item.name,
                                brush_datapath[mode],
                                icon=brush_icon[mode][item.image_tool],
                                disable=True,
                                custom_disable_exp=(item.name, current_brush),
                                path=True)
Beispiel #16
0
    def draw(self, context):
        mode = utils_core.get_mode()
        layout = self.layout
        settings = UnifiedPaintPanel.paint_settings(context)
        colum_n = utils_core.addon_settings(lists=False)

        layout.row().label(text="Brush")
        layout.row().separator()

        has_brush = utils_core.get_brush_link(context, types="brush")
        current_brush = eval("bpy.context.{}".format(brush_datapath[mode])) if has_brush else None

        # get the current brush's name
        if current_brush and utils_core.get_mode() != 'PARTICLE_EDIT':
            current_brush = current_brush.name

        if mode == 'PARTICLE_EDIT':
            # if you are in particle edit mode add the menu items for particle mode
            for tool in particle_tools:
                utils_core.menuprop(
                        layout.row(), tool[0], tool[1], brush_datapath[mode],
                        icon='RADIOBUT_OFF', disable=True,
                        disable_icon='RADIOBUT_ON'
                        )
        else:
            column_flow = layout.column_flow(columns=colum_n)
            if utils_core.addon_settings(lists=True) == 'template':
                layout.template_ID_preview(settings, "brush",
                                           new="brush.add", rows=3, cols=colum_n)
            else:
                # iterate over all the brushes
                for item in bpy.data.brushes:
                    if mode == 'SCULPT':
                        if item.use_paint_sculpt:
                            # if you are in sculpt mode and the brush
                            # is a sculpt brush add the brush to the menu
                            utils_core.menuprop(
                                    column_flow.row(), item.name,
                                    'bpy.data.brushes["%s"]' % item.name,
                                    brush_datapath[mode], icon=brush_icon[mode][item.sculpt_tool],
                                    disable=True, custom_disable_exp=(item.name, current_brush),
                                    path=True
                                    )
                    if mode == 'VERTEX_PAINT':
                        if item.use_paint_vertex:
                            # if you are in vertex paint mode and the brush
                            # is a vertex paint brush add the brush to the menu
                            utils_core.menuprop(
                                    column_flow.row(), item.name,
                                    'bpy.data.brushes["%s"]' % item.name,
                                    brush_datapath[mode], icon=brush_icon[mode][item.vertex_tool],
                                    disable=True, custom_disable_exp=(item.name, current_brush),
                                    path=True
                                    )
                    if mode == 'WEIGHT_PAINT':
                        if item.use_paint_weight:
                            # if you are in weight paint mode and the brush
                            # is a weight paint brush add the brush to the menu
                            utils_core.menuprop(
                                    column_flow.row(), item.name,
                                    'bpy.data.brushes["%s"]' % item.name,
                                    brush_datapath[mode], icon=brush_icon[mode][item.vertex_tool],
                                    disable=True, custom_disable_exp=(item.name, current_brush),
                                    path=True
                                    )
                    if utils_core.get_mode() == 'TEXTURE_PAINT':
                        if item.use_paint_image:
                            # if you are in texture paint mode and the brush
                            # is a texture paint brush add the brush to the menu
                            utils_core.menuprop(
                                    column_flow.row(), item.name,
                                    'bpy.data.brushes["%s"]' % item.name,
                                    brush_datapath[mode], icon=brush_icon[mode][item.image_tool],
                                    disable=True, custom_disable_exp=(item.name, current_brush),
                                    path=True
                                    )
Beispiel #17
0
def VIEW3D_HT_header_draw_new(self, context):
    if "BLEND4WEB" not in context.scene.render.engine:
        _VIEW3D_HT_header_draw(self, context)
    else:
        layout = self.layout

        view = context.space_data
        # mode_string = context.mode
        obj = context.active_object
        toolsettings = context.tool_settings

        row = layout.row(align=True)
        row.template_header()

        bpy.types.VIEW3D_MT_editor_menus.draw_collapsible(context, layout)

        # Contains buttons like Mode, Pivot, Manipulator, Layer, Mesh Select Mode...
        row = layout
        layout.template_header_3D()

        if obj:
            mode = obj.mode
            # Particle edit
            if mode == 'PARTICLE_EDIT':
                row.prop(toolsettings.particle_edit,
                         "select_mode",
                         text="",
                         expand=True)

            # Occlude geometry
            if ((view.viewport_shade not in {'BOUNDBOX', 'WIREFRAME'} and
                 (mode == 'PARTICLE_EDIT' or
                  (mode == 'EDIT' and obj.type == 'MESH')))
                    or (mode == 'WEIGHT_PAINT')):
                row.prop(view, "use_occlude_geometry", text="")

            # Proportional editing
            if context.gpencil_data and context.gpencil_data.use_stroke_edit_mode:
                row = layout.row(align=True)
                row.prop(toolsettings, "proportional_edit", icon_only=True)
                if toolsettings.proportional_edit != 'DISABLED':
                    row.prop(toolsettings,
                             "proportional_edit_falloff",
                             icon_only=True)
            elif mode in {'EDIT', 'PARTICLE_EDIT'}:
                row = layout.row(align=True)
                row.prop(toolsettings, "proportional_edit", icon_only=True)
                if toolsettings.proportional_edit != 'DISABLED':
                    row.prop(toolsettings,
                             "proportional_edit_falloff",
                             icon_only=True)
            elif mode == 'OBJECT':
                row = layout.row(align=True)
                row.prop(toolsettings,
                         "use_proportional_edit_objects",
                         icon_only=True)
                if toolsettings.use_proportional_edit_objects:
                    row.prop(toolsettings,
                             "proportional_edit_falloff",
                             icon_only=True)
        else:
            # Proportional editing
            if context.gpencil_data and context.gpencil_data.use_stroke_edit_mode:
                row = layout.row(align=True)
                row.prop(toolsettings, "proportional_edit", icon_only=True)
                if toolsettings.proportional_edit != 'DISABLED':
                    row.prop(toolsettings,
                             "proportional_edit_falloff",
                             icon_only=True)

        # Snap
        show_snap = False
        if obj is None:
            show_snap = True
        else:
            if mode not in {
                    'SCULPT', 'VERTEX_PAINT', 'WEIGHT_PAINT', 'TEXTURE_PAINT'
            }:
                show_snap = True
            else:
                paint_settings = UnifiedPaintPanel.paint_settings(context)
                if paint_settings:
                    brush = paint_settings.brush
                    if brush and brush.stroke_method == 'CURVE':
                        show_snap = True

        if show_snap:
            snap_element = toolsettings.snap_element
            row = layout.row(align=True)
            row.prop(toolsettings, "use_snap", text="")
            row.prop(toolsettings, "snap_element", icon_only=True)
            if snap_element == 'INCREMENT':
                row.prop(toolsettings, "use_snap_grid_absolute", text="")
            else:
                row.prop(toolsettings, "snap_target", text="")
                if obj:
                    if mode == 'EDIT':
                        row.prop(toolsettings, "use_snap_self", text="")
                    if mode in {'OBJECT', 'POSE', 'EDIT'
                                } and snap_element != 'VOLUME':
                        row.prop(toolsettings,
                                 "use_snap_align_rotation",
                                 text="")

            if snap_element == 'VOLUME':
                row.prop(toolsettings, "use_snap_peel_object", text="")
            elif snap_element == 'FACE':
                row.prop(toolsettings, "use_snap_project", text="")

        # AutoMerge editing
        if obj:
            if (mode == 'EDIT' and obj.type == 'MESH'):
                layout.prop(toolsettings,
                            "use_mesh_automerge",
                            text="",
                            icon='AUTOMERGE_ON')

        # Pose
        if obj and mode == 'POSE':
            row = layout.row(align=True)
            row.operator("pose.copy", text="", icon='COPYDOWN')
            row.operator("pose.paste", text="",
                         icon='PASTEDOWN').flipped = False
            row.operator("pose.paste", text="",
                         icon='PASTEFLIPDOWN').flipped = True

        # GPencil
        if context.gpencil_data and context.gpencil_data.use_stroke_edit_mode:
            row = layout.row(align=True)
            row.operator("gpencil.copy", text="", icon='COPYDOWN')
            row.operator("gpencil.paste", text="", icon='PASTEDOWN')

            # XXX: icon
            layout.prop(context.gpencil_data,
                        "use_onion_skinning",
                        text="Onion Skins",
                        icon='PARTICLE_PATH')

            row = layout.row(align=True)
            row.prop(context.tool_settings.gpencil_sculpt, "use_select_mask")
            row.prop(context.tool_settings.gpencil_sculpt,
                     "selection_alpha",
                     slider=True)
Beispiel #18
0
def VIEW3D_HT_header_draw_new(self, context):
    if "BLEND4WEB" not in context.scene.render.engine:
        _VIEW3D_HT_header_draw(self, context)
    else:
        layout = self.layout

        view = context.space_data
        # mode_string = context.mode
        obj = context.active_object
        toolsettings = context.tool_settings

        row = layout.row(align=True)
        row.template_header()

        bpy.types.VIEW3D_MT_editor_menus.draw_collapsible(context, layout)

        # Contains buttons like Mode, Pivot, Manipulator, Layer, Mesh Select Mode...
        row = layout
        layout.template_header_3D()

        if obj:
            mode = obj.mode
            # Particle edit
            if mode == 'PARTICLE_EDIT':
                row.prop(toolsettings.particle_edit, "select_mode", text="", expand=True)

            # Occlude geometry
            if ((view.viewport_shade not in {'BOUNDBOX', 'WIREFRAME'} and (mode == 'PARTICLE_EDIT' or (mode == 'EDIT' and obj.type == 'MESH'))) or
                    (mode == 'WEIGHT_PAINT')):
                row.prop(view, "use_occlude_geometry", text="")

            # Proportional editing
            if context.gpencil_data and context.gpencil_data.use_stroke_edit_mode:
                row = layout.row(align=True)
                row.prop(toolsettings, "proportional_edit", icon_only=True)
                if toolsettings.proportional_edit != 'DISABLED':
                    row.prop(toolsettings, "proportional_edit_falloff", icon_only=True)
            elif mode in {'EDIT', 'PARTICLE_EDIT'}:
                row = layout.row(align=True)
                row.prop(toolsettings, "proportional_edit", icon_only=True)
                if toolsettings.proportional_edit != 'DISABLED':
                    row.prop(toolsettings, "proportional_edit_falloff", icon_only=True)
            elif mode == 'OBJECT':
                row = layout.row(align=True)
                row.prop(toolsettings, "use_proportional_edit_objects", icon_only=True)
                if toolsettings.use_proportional_edit_objects:
                    row.prop(toolsettings, "proportional_edit_falloff", icon_only=True)
        else:
            # Proportional editing
            if context.gpencil_data and context.gpencil_data.use_stroke_edit_mode:
                row = layout.row(align=True)
                row.prop(toolsettings, "proportional_edit", icon_only=True)
                if toolsettings.proportional_edit != 'DISABLED':
                    row.prop(toolsettings, "proportional_edit_falloff", icon_only=True)

        # Snap
        show_snap = False
        if obj is None:
            show_snap = True
        else:
            if mode not in {'SCULPT', 'VERTEX_PAINT', 'WEIGHT_PAINT', 'TEXTURE_PAINT'}:
                show_snap = True
            else:
                paint_settings = UnifiedPaintPanel.paint_settings(context)
                if paint_settings:
                    brush = paint_settings.brush
                    if brush and brush.stroke_method == 'CURVE':
                        show_snap = True

        if show_snap:
            snap_element = toolsettings.snap_element
            row = layout.row(align=True)
            row.prop(toolsettings, "use_snap", text="")
            row.prop(toolsettings, "snap_element", icon_only=True)
            if snap_element == 'INCREMENT':
                row.prop(toolsettings, "use_snap_grid_absolute", text="")
            else:
                row.prop(toolsettings, "snap_target", text="")
                if obj:
                    if mode == 'EDIT':
                        row.prop(toolsettings, "use_snap_self", text="")
                    if mode in {'OBJECT', 'POSE', 'EDIT'} and snap_element != 'VOLUME':
                        row.prop(toolsettings, "use_snap_align_rotation", text="")

            if snap_element == 'VOLUME':
                row.prop(toolsettings, "use_snap_peel_object", text="")
            elif snap_element == 'FACE':
                row.prop(toolsettings, "use_snap_project", text="")

        # AutoMerge editing
        if obj:
            if (mode == 'EDIT' and obj.type == 'MESH'):
                layout.prop(toolsettings, "use_mesh_automerge", text="", icon='AUTOMERGE_ON')

        # Pose
        if obj and mode == 'POSE':
            row = layout.row(align=True)
            row.operator("pose.copy", text="", icon='COPYDOWN')
            row.operator("pose.paste", text="", icon='PASTEDOWN').flipped = False
            row.operator("pose.paste", text="", icon='PASTEFLIPDOWN').flipped = True

        # GPencil
        if context.gpencil_data and context.gpencil_data.use_stroke_edit_mode:
            row = layout.row(align=True)
            row.operator("gpencil.copy", text="", icon='COPYDOWN')
            row.operator("gpencil.paste", text="", icon='PASTEDOWN')

            # XXX: icon
            layout.prop(context.gpencil_data, "use_onion_skinning", text="Onion Skins", icon='PARTICLE_PATH')

            row = layout.row(align=True)
            row.prop(context.tool_settings.gpencil_sculpt, "use_select_mask")
            row.prop(context.tool_settings.gpencil_sculpt, "selection_alpha", slider=True)