diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py index 533d0976af0..7e0fe54ab8d 100644 --- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py +++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py @@ -25,15 +25,14 @@ def kmi_to_string_or_none(kmi): def generate_from_enum_ex( - _context, - *, - idname_prefix, - icon_prefix, - type, - attr, - cursor="DEFAULT", - tooldef_keywords={}, - exclude_filter={}, + _context, *, + idname_prefix, + icon_prefix, + type, + attr, + cursor='DEFAULT', + tooldef_keywords={}, + exclude_filter={}, ): tool_defs = [] for enum in type.bl_rna.properties[attr].enum_items_static: @@ -79,11 +78,12 @@ class _defs_view3d_generic: props = tool.operator_properties("view3d.cursor3d") layout.prop(props, "use_depth") layout.prop(props, "orientation") - return dict( idname="builtin.cursor", label="Cursor", - description=("Set the cursor location, drag to transform"), + description=( + "Set the cursor location, drag to transform" + ), icon="ops.generic.cursor", keymap="3D View Tool: Cursor", draw_settings=draw_settings, @@ -118,7 +118,6 @@ class _defs_view3d_generic: kmi_to_string_or_none(kmi_add), kmi_to_string_or_none(kmi_remove), ) - return dict( idname="builtin.measure", label="Measure", @@ -130,6 +129,7 @@ class _defs_view3d_generic: class _defs_annotate: + def draw_settings_common(context, layout, tool): gpd = context.annotation_data region_type = context.region.type @@ -139,15 +139,15 @@ class _defs_annotate: text = gpd.layers.active_note maxw = 25 if len(text) > maxw: - text = text[: maxw - 5] + ".." + text[-3:] + text = text[:maxw - 5] + '..' + text[-3:] else: text = "" gpl = context.active_annotation_layer if gpl is not None: layout.label(text="Annotation:") - if context.space_data.type in {"VIEW_3D", "SEQUENCE_EDITOR"}: - if region_type == "TOOL_HEADER": + if context.space_data.type in {'VIEW_3D', 'SEQUENCE_EDITOR'}: + if region_type == 'TOOL_HEADER': sub = layout.split(align=True, factor=0.5) sub.ui_units_x = 6.5 sub.prop(gpl, "color", text="") @@ -164,30 +164,21 @@ class _defs_annotate: space_type = tool.space_type tool_settings = context.tool_settings - if space_type == "VIEW_3D": + if space_type == 'VIEW_3D': row = layout.row(align=True) - row.prop( - tool_settings, "annotation_stroke_placement_view3d", text="Placement" - ) - if tool_settings.gpencil_stroke_placement_view3d == "CURSOR": + row.prop(tool_settings, "annotation_stroke_placement_view3d", text="Placement") + if tool_settings.gpencil_stroke_placement_view3d == 'CURSOR': row.prop(tool_settings.gpencil_sculpt, "lockaxis") - elif tool_settings.gpencil_stroke_placement_view3d in {"SURFACE", "STROKE"}: + elif tool_settings.gpencil_stroke_placement_view3d in {'SURFACE', 'STROKE'}: row.prop(tool_settings, "use_gpencil_stroke_endpoints") - elif space_type in { - "IMAGE_EDITOR", - "NODE_EDITOR", - "SEQUENCE_EDITOR", - "CLIP_EDITOR", - }: + elif space_type in {'IMAGE_EDITOR', 'NODE_EDITOR', 'SEQUENCE_EDITOR', 'CLIP_EDITOR'}: row = layout.row(align=True) - row.prop( - tool_settings, "annotation_stroke_placement_view2d", text="Placement" - ) + row.prop(tool_settings, "annotation_stroke_placement_view2d", text="Placement") if tool.idname == "builtin.annotate_line": props = tool.operator_properties("gpencil.annotate") - if region_type == "TOOL_HEADER": + if region_type == 'TOOL_HEADER': row = layout.row() row.ui_units_x = 15 row.prop(props, "arrowstyle_start", text="Start") @@ -199,7 +190,7 @@ class _defs_annotate: col.prop(props, "arrowstyle_end", text="End") elif tool.idname == "builtin.annotate": props = tool.operator_properties("gpencil.annotate") - if region_type == "TOOL_HEADER": + if region_type == 'TOOL_HEADER': row = layout.row() row.prop(props, "use_stabilizer", text="Stabilize Stroke") subrow = layout.row(align=False) @@ -219,10 +210,10 @@ class _defs_annotate: idname="builtin.annotate", label="Annotate", icon="ops.gpencil.draw", - cursor="PAINT_BRUSH", + cursor='PAINT_BRUSH', keymap="Generic Tool: Annotate", draw_settings=draw_settings, - options={"KEYMAP_FALLBACK"}, + options={'KEYMAP_FALLBACK'}, ) @ToolDef.from_fn.with_args(draw_settings=draw_settings_common) @@ -231,10 +222,10 @@ class _defs_annotate: idname="builtin.annotate_line", label="Annotate Line", icon="ops.gpencil.draw.line", - cursor="PAINT_BRUSH", + cursor='PAINT_BRUSH', keymap="Generic Tool: Annotate Line", draw_settings=draw_settings, - options={"KEYMAP_FALLBACK"}, + options={'KEYMAP_FALLBACK'}, ) @ToolDef.from_fn.with_args(draw_settings=draw_settings_common) @@ -243,10 +234,10 @@ class _defs_annotate: idname="builtin.annotate_polygon", label="Annotate Polygon", icon="ops.gpencil.draw.poly", - cursor="PAINT_BRUSH", + cursor='PAINT_BRUSH', keymap="Generic Tool: Annotate Polygon", draw_settings=draw_settings, - options={"KEYMAP_FALLBACK"}, + options={'KEYMAP_FALLBACK'}, ) @ToolDef.from_fn @@ -255,21 +246,21 @@ class _defs_annotate: # TODO: Move this setting to tool_settings prefs = context.preferences layout.prop(prefs.edit, "grease_pencil_eraser_radius", text="Radius") - return dict( idname="builtin.annotate_eraser", label="Annotate Eraser", icon="ops.gpencil.draw.eraser", - cursor="ERASER", + cursor='ERASER', keymap="Generic Tool: Annotate Eraser", draw_settings=draw_settings, - options={"KEYMAP_FALLBACK"}, + options={'KEYMAP_FALLBACK'}, ) class _defs_transform: + def draw_transform_sculpt_tool_settings(context, layout): - if context.mode != "SCULPT": + if context.mode != 'SCULPT': return layout.prop(context.tool_settings.sculpt, "transform_mode") @@ -277,10 +268,7 @@ class _defs_transform: def translate(): def draw_settings(context, layout, _tool): _defs_transform.draw_transform_sculpt_tool_settings(context, layout) - _template_widget.VIEW3D_GGT_xform_gizmo.draw_settings_with_index( - context, layout, 1 - ) - + _template_widget.VIEW3D_GGT_xform_gizmo.draw_settings_with_index(context, layout, 1) return dict( idname="builtin.move", label="Move", @@ -296,10 +284,7 @@ class _defs_transform: def rotate(): def draw_settings(context, layout, _tool): _defs_transform.draw_transform_sculpt_tool_settings(context, layout) - _template_widget.VIEW3D_GGT_xform_gizmo.draw_settings_with_index( - context, layout, 2 - ) - + _template_widget.VIEW3D_GGT_xform_gizmo.draw_settings_with_index(context, layout, 2) return dict( idname="builtin.rotate", label="Rotate", @@ -315,10 +300,7 @@ class _defs_transform: def scale(): def draw_settings(context, layout, _tool): _defs_transform.draw_transform_sculpt_tool_settings(context, layout) - _template_widget.VIEW3D_GGT_xform_gizmo.draw_settings_with_index( - context, layout, 3 - ) - + _template_widget.VIEW3D_GGT_xform_gizmo.draw_settings_with_index(context, layout, 3) return dict( idname="builtin.scale", label="Scale", @@ -333,10 +315,7 @@ class _defs_transform: @ToolDef.from_fn def scale_cage(): def draw_settings(context, layout, _tool): - _template_widget.VIEW3D_GGT_xform_gizmo.draw_settings_with_index( - context, layout, 3 - ) - + _template_widget.VIEW3D_GGT_xform_gizmo.draw_settings_with_index(context, layout, 3) return dict( idname="builtin.scale_cage", label="Scale Cage", @@ -351,10 +330,7 @@ class _defs_transform: def shear(): def draw_settings(context, layout, _tool): # props = tool.operator_properties("transform.shear") - _template_widget.VIEW3D_GGT_xform_gizmo.draw_settings_with_index( - context, layout, 2 - ) - + _template_widget.VIEW3D_GGT_xform_gizmo.draw_settings_with_index(context, layout, 2) return dict( idname="builtin.shear", label="Shear", @@ -372,7 +348,7 @@ class _defs_transform: show_drag = True tool_settings = context.tool_settings - if tool_settings.workspace_tool_type == "FALLBACK": + if tool_settings.workspace_tool_type == 'FALLBACK': show_drag = False if show_drag: @@ -380,14 +356,14 @@ class _defs_transform: layout.prop(props, "drag_action") _defs_transform.draw_transform_sculpt_tool_settings(context, layout) - _template_widget.VIEW3D_GGT_xform_gizmo.draw_settings_with_index( - context, layout, 1 - ) + _template_widget.VIEW3D_GGT_xform_gizmo.draw_settings_with_index(context, layout, 1) return dict( idname="builtin.transform", label="Transform", - description=("Supports any combination of grab, rotate, and scale at once"), + description=( + "Supports any combination of grab, rotate, and scale at once" + ), icon="ops.transform.transform", widget="VIEW3D_GGT_xform_gizmo", keymap="3D View Tool: Transform", @@ -396,6 +372,7 @@ class _defs_transform: class _defs_view3d_select: + @ToolDef.from_fn def select(): return dict( @@ -413,7 +390,6 @@ class _defs_view3d_select: row = layout.row() row.use_property_split = False row.prop(props, "mode", text="", expand=True, icon_only=True) - return dict( idname="builtin.select_box", label="Select Box", @@ -430,7 +406,6 @@ class _defs_view3d_select: row = layout.row() row.use_property_split = False row.prop(props, "mode", text="", expand=True, icon_only=True) - return dict( idname="builtin.select_lasso", label="Select Lasso", @@ -451,7 +426,6 @@ class _defs_view3d_select: def draw_cursor(_context, tool, xy): from gpu_extras.presets import draw_circle_2d - props = tool.operator_properties("view3d.select_circle") radius = props.radius draw_circle_2d(xy, (1.0,) * 4, radius, segments=32) @@ -468,6 +442,7 @@ class _defs_view3d_select: class _defs_view3d_add: + @staticmethod def description_interactive_add(context, _item, _km, *, prefix): km = context.window_manager.keyconfigs.user.keymaps["View3D Placement Modal"] @@ -478,9 +453,9 @@ class _defs_view3d_add: return item if km is not None: - kmi_snap = keymap_item_from_propvalue("SNAP_ON") - kmi_center = keymap_item_from_propvalue("PIVOT_CENTER_ON") - kmi_fixed_aspect = keymap_item_from_propvalue("FIXED_ASPECT_ON") + kmi_snap = keymap_item_from_propvalue('SNAP_ON') + kmi_center = keymap_item_from_propvalue('PIVOT_CENTER_ON') + kmi_fixed_aspect = keymap_item_from_propvalue('FIXED_ASPECT_ON') else: kmi_snap = None kmi_center = None @@ -515,7 +490,7 @@ class _defs_view3d_add: row = layout.row() row.prop(props, "snap_target") - region_is_header = bpy.context.region.type == "TOOL_HEADER" + region_is_header = bpy.context.region.type == 'TOOL_HEADER' if region_is_header: # Don't draw the "extra" popover here as we might have other settings & this should be last. @@ -539,9 +514,7 @@ class _defs_view3d_add: @ToolDef.from_fn def cube_add(): def draw_settings(_context, layout, tool, *, extra=False): - show_extra = _defs_view3d_add.draw_settings_interactive_add( - layout, tool, extra - ) + show_extra = _defs_view3d_add.draw_settings_interactive_add(layout, tool, extra) if show_extra: layout.popover("TOPBAR_PT_tool_settings_extra", text="...") @@ -550,8 +523,7 @@ class _defs_view3d_add: label="Add Cube", icon="ops.mesh.primitive_cube_add_gizmo", description=lambda *args: _defs_view3d_add.description_interactive_add( - *args, - prefix=tip_("Add cube to mesh interactively"), + *args, prefix=tip_("Add cube to mesh interactively"), ), widget="VIEW3D_GGT_placement", keymap="3D View Tool: Object, Add Primitive", @@ -561,9 +533,7 @@ class _defs_view3d_add: @ToolDef.from_fn def cone_add(): def draw_settings(_context, layout, tool, *, extra=False): - show_extra = _defs_view3d_add.draw_settings_interactive_add( - layout, tool, extra - ) + show_extra = _defs_view3d_add.draw_settings_interactive_add(layout, tool, extra) if extra: return @@ -579,8 +549,7 @@ class _defs_view3d_add: label="Add Cone", icon="ops.mesh.primitive_cone_add_gizmo", description=lambda *args: _defs_view3d_add.description_interactive_add( - *args, - prefix=tip_("Add cone to mesh interactively"), + *args, prefix=tip_("Add cone to mesh interactively"), ), widget="VIEW3D_GGT_placement", keymap="3D View Tool: Object, Add Primitive", @@ -590,9 +559,7 @@ class _defs_view3d_add: @ToolDef.from_fn def cylinder_add(): def draw_settings(_context, layout, tool, *, extra=False): - show_extra = _defs_view3d_add.draw_settings_interactive_add( - layout, tool, extra - ) + show_extra = _defs_view3d_add.draw_settings_interactive_add(layout, tool, extra) if extra: return @@ -602,14 +569,12 @@ class _defs_view3d_add: if show_extra: layout.popover("TOPBAR_PT_tool_settings_extra", text="...") - return dict( idname="builtin.primitive_cylinder_add", label="Add Cylinder", icon="ops.mesh.primitive_cylinder_add_gizmo", description=lambda *args: _defs_view3d_add.description_interactive_add( - *args, - prefix=tip_("Add cylinder to mesh interactively"), + *args, prefix=tip_("Add cylinder to mesh interactively"), ), widget="VIEW3D_GGT_placement", keymap="3D View Tool: Object, Add Primitive", @@ -619,9 +584,7 @@ class _defs_view3d_add: @ToolDef.from_fn def uv_sphere_add(): def draw_settings(_context, layout, tool, *, extra=False): - show_extra = _defs_view3d_add.draw_settings_interactive_add( - layout, tool, extra - ) + show_extra = _defs_view3d_add.draw_settings_interactive_add(layout, tool, extra) if extra: return @@ -631,14 +594,12 @@ class _defs_view3d_add: if show_extra: layout.popover("TOPBAR_PT_tool_settings_extra", text="...") - return dict( idname="builtin.primitive_uv_sphere_add", label="Add UV Sphere", icon="ops.mesh.primitive_sphere_add_gizmo", description=lambda *args: _defs_view3d_add.description_interactive_add( - *args, - prefix=tip_("Add sphere to mesh interactively"), + *args, prefix=tip_("Add sphere to mesh interactively"), ), widget="VIEW3D_GGT_placement", keymap="3D View Tool: Object, Add Primitive", @@ -648,9 +609,7 @@ class _defs_view3d_add: @ToolDef.from_fn def ico_sphere_add(): def draw_settings(_context, layout, tool, *, extra=False): - show_extra = _defs_view3d_add.draw_settings_interactive_add( - layout, tool, extra - ) + show_extra = _defs_view3d_add.draw_settings_interactive_add(layout, tool, extra) if extra: return @@ -659,14 +618,12 @@ class _defs_view3d_add: if show_extra: layout.popover("TOPBAR_PT_tool_settings_extra", text="...") - return dict( idname="builtin.primitive_ico_sphere_add", label="Add Ico Sphere", icon="ops.mesh.primitive_sphere_add_gizmo", description=lambda *args: _defs_view3d_add.description_interactive_add( - *args, - prefix=tip_("Add sphere to mesh interactively"), + *args, prefix=tip_("Add sphere to mesh interactively"), ), widget="VIEW3D_GGT_placement", keymap="3D View Tool: Object, Add Primitive", @@ -677,8 +634,8 @@ class _defs_view3d_add: # ----------------------------------------------------------------------------- # Object Modes (named based on context.mode) - class _defs_edit_armature: + @ToolDef.from_fn def roll(): return dict( @@ -725,7 +682,7 @@ class _defs_edit_armature: return dict( idname="builtin.extrude_to_cursor", label="Extrude to Cursor", - cursor="CROSSHAIR", + cursor='CROSSHAIR', icon="ops.armature.extrude_cursor", widget=None, keymap=(), @@ -733,6 +690,7 @@ class _defs_edit_armature: class _defs_edit_mesh: + @ToolDef.from_fn def rip_region(): def draw_settings(_context, layout, tool): @@ -765,7 +723,6 @@ class _defs_edit_mesh: props = tool.operator_properties("mesh.polybuild_face_at_cursor_move") props_macro = props.MESH_OT_polybuild_face_at_cursor layout.prop(props_macro, "create_quads") - return dict( idname="builtin.poly_build", label="Poly Build", @@ -866,9 +823,9 @@ class _defs_edit_mesh: def draw_settings(context, layout, tool, *, extra=False): props = tool.operator_properties("mesh.bevel") - region_is_header = context.region.type == "TOOL_HEADER" + region_is_header = context.region.type == 'TOOL_HEADER' - edge_bevel = props.affect == "EDGES" + edge_bevel = props.affect == 'EDGES' if not extra: if region_is_header: @@ -910,7 +867,7 @@ class _defs_edit_mesh: col.active = edge_bevel col.prop(props, "miter_outer", text="Miter Outer") col.prop(props, "miter_inner", text="Inner") - if props.miter_inner == "ARC": + if props.miter_inner == 'ARC': col.prop(props, "spread") layout.separator() @@ -923,11 +880,9 @@ class _defs_edit_mesh: layout.prop(props, "profile_type") - if props.profile_type == "CUSTOM": + if props.profile_type == 'CUSTOM': tool_settings = context.tool_settings - layout.template_curveprofile( - tool_settings, "custom_bevel_profile_preset" - ) + layout.template_curveprofile(tool_settings, "custom_bevel_profile_preset") return dict( idname="builtin.bevel", @@ -944,7 +899,9 @@ class _defs_edit_mesh: idname="builtin.extrude_region", label="Extrude Region", # The operator description isn't useful in this case, give our own. - description=("Extrude freely or along an axis"), + description=( + "Extrude freely or along an axis" + ), icon="ops.mesh.extrude_region_move", widget="VIEW3D_GGT_xform_extrude", # Important to use same operator as 'E' key. @@ -972,7 +929,6 @@ class _defs_edit_mesh: props = tool.operator_properties("mesh.extrude_region_shrink_fatten") props_macro = props.TRANSFORM_OT_shrink_fatten layout.prop(props_macro, "use_even_offset") - return dict( idname="builtin.extrude_along_normals", label="Extrude Along Normals", @@ -1002,7 +958,7 @@ class _defs_edit_mesh: return dict( idname="builtin.extrude_to_cursor", label="Extrude to Cursor", - cursor="CROSSHAIR", + cursor='CROSSHAIR', icon="ops.mesh.dupli_extrude_cursor", widget=None, keymap=(), @@ -1011,6 +967,7 @@ class _defs_edit_mesh: @ToolDef.from_fn def loopcut_slide(): + def draw_settings(_context, layout, tool): props = tool.operator_properties("mesh.loopcut_slide") props_macro = props.MESH_OT_loopcut @@ -1042,7 +999,6 @@ class _defs_edit_mesh: def draw_settings(_context, layout, tool): props = tool.operator_properties("mesh.vertices_smooth") layout.prop(props, "repeat") - return dict( idname="builtin.smooth", label="Smooth", @@ -1059,7 +1015,6 @@ class _defs_edit_mesh: layout.prop(props, "uniform") layout.prop(props, "normal") layout.prop(props, "seed") - return dict( idname="builtin.randomize", label="Randomize", @@ -1113,7 +1068,7 @@ class _defs_edit_mesh: layout.prop(props, "use_occlude_geometry") layout.prop(props, "only_selected") layout.prop(props, "xray") - region_is_header = bpy.context.region.type == "TOOL_HEADER" + region_is_header = bpy.context.region.type == 'TOOL_HEADER' if region_is_header: show_extra = True else: @@ -1128,16 +1083,15 @@ class _defs_edit_mesh: layout.prop(props, "angle_snapping_increment", text="") if show_extra: layout.popover("TOPBAR_PT_tool_settings_extra", text="...") - return dict( idname="builtin.knife", label="Knife", - cursor="KNIFE", + cursor='KNIFE', icon="ops.mesh.knife_tool", widget=None, keymap=(), draw_settings=draw_settings, - options={"KEYMAP_FALLBACK"}, + options={'KEYMAP_FALLBACK'}, ) @ToolDef.from_fn @@ -1148,7 +1102,6 @@ class _defs_edit_mesh: layout.prop(props, "clear_inner") layout.prop(props, "clear_outer") layout.prop(props, "threshold") - return dict( idname="builtin.bisect", label="Bisect", @@ -1160,6 +1113,7 @@ class _defs_edit_mesh: class _defs_edit_curve: + @ToolDef.from_fn def draw(): def draw_settings(context, layout, _tool, *, extra=False): @@ -1168,7 +1122,7 @@ class _defs_edit_curve: cps = tool_settings.curve_paint_settings region_type = context.region.type - if region_type == "TOOL_HEADER": + if region_type == 'TOOL_HEADER': if not extra: layout.prop(cps, "curve_type", text="") layout.prop(cps, "depth_mode", expand=True) @@ -1178,13 +1132,13 @@ class _defs_edit_curve: layout.use_property_split = True layout.use_property_decorate = False - if region_type != "TOOL_HEADER": + if region_type != 'TOOL_HEADER': layout.prop(cps, "curve_type") layout.separator() - if cps.curve_type == "BEZIER": + if cps.curve_type == 'BEZIER': layout.prop(cps, "fit_method") layout.prop(cps, "error_threshold") - if region_type != "TOOL_HEADER": + if region_type != 'TOOL_HEADER': row = layout.row(heading="Detect Corners", align=True) else: row = layout.row(heading="Corners", align=True) @@ -1202,13 +1156,13 @@ class _defs_edit_curve: col.prop(cps, "radius_max", text="Max") col.prop(cps, "use_pressure_radius") - if region_type != "TOOL_HEADER" or cps.depth_mode == "SURFACE": + if region_type != 'TOOL_HEADER' or cps.depth_mode == 'SURFACE': layout.separator() - if region_type != "TOOL_HEADER": + if region_type != 'TOOL_HEADER': row = layout.row() row.prop(cps, "depth_mode", expand=True) - if cps.depth_mode == "SURFACE": + if cps.depth_mode == 'SURFACE': col = layout.column() col.prop(cps, "surface_offset") col.prop(cps, "use_offset_absolute") @@ -1220,7 +1174,7 @@ class _defs_edit_curve: return dict( idname="builtin.draw", label="Draw", - cursor="PAINT_BRUSH", + cursor='PAINT_BRUSH', icon="ops.curve.draw", widget=None, keymap=(), @@ -1243,7 +1197,7 @@ class _defs_edit_curve: return dict( idname="builtin.extrude_cursor", label="Extrude to Cursor", - cursor="CROSSHAIR", + cursor='CROSSHAIR', icon="ops.curve.extrude_cursor", widget=None, keymap=(), @@ -1255,11 +1209,10 @@ class _defs_edit_curve: props = tool.operator_properties("curve.pen") layout.prop(props, "close_spline") layout.prop(props, "extrude_handle") - return dict( idname="builtin.pen", label="Curve Pen", - cursor="CROSSHAIR", + cursor='CROSSHAIR', icon="ops.curve.pen", widget=None, keymap=(), @@ -1281,7 +1234,9 @@ class _defs_edit_curve: return dict( idname="builtin.radius", label="Radius", - description=("Expand or contract the radius of the selected curve points"), + description=( + "Expand or contract the radius of the selected curve points" + ), icon="ops.curve.radius", widget="VIEW3D_GGT_tool_generic_handle_free", keymap=(), @@ -1294,7 +1249,6 @@ class _defs_edit_curve: layout.prop(props, "uniform") layout.prop(props, "normal") layout.prop(props, "seed") - return dict( idname="builtin.randomize", label="Randomize", @@ -1306,6 +1260,7 @@ class _defs_edit_curve: class _defs_pose: + @ToolDef.from_fn def breakdown(): return dict( @@ -1338,6 +1293,7 @@ class _defs_pose: class _defs_particle: + @staticmethod def generate_from_brushes(context): return generate_from_enum_ex( @@ -1350,6 +1306,7 @@ class _defs_particle: class _defs_sculpt: + @staticmethod def generate_from_brushes(context): return generate_from_enum_ex( @@ -1453,7 +1410,6 @@ class _defs_sculpt: layout.prop(props, "trim_mode", expand=False) layout.prop(props, "trim_extrude_mode", expand=False) layout.prop(props, "use_cursor_depth", expand=False) - return dict( idname="builtin.box_trim", label="Box Trim", @@ -1471,7 +1427,6 @@ class _defs_sculpt: layout.prop(props, "trim_orientation", expand=False) layout.prop(props, "trim_extrude_mode", expand=False) layout.prop(props, "use_cursor_depth", expand=False) - return dict( idname="builtin.lasso_trim", label="Lasso Trim", @@ -1505,10 +1460,10 @@ class _defs_sculpt: row = layout.row(align=True) row.prop(props, "deform_axis") layout.prop(props, "orientation", expand=False) - if props.type == "SURFACE_SMOOTH": + if props.type == 'SURFACE_SMOOTH': layout.prop(props, "surface_smooth_shape_preservation", expand=False) layout.prop(props, "surface_smooth_current_vertex", expand=False) - elif props.type == "SHARPEN": + elif props.type == 'SHARPEN': layout.prop(props, "sharpen_smooth_ratio", expand=False) layout.prop(props, "sharpen_intensify_detail_strength", expand=False) layout.prop(props, "sharpen_curvature_smooth_iterations", expand=False) @@ -1550,7 +1505,7 @@ class _defs_sculpt: def draw_settings(_context, layout, tool): props = tool.operator_properties("sculpt.color_filter") layout.prop(props, "type", expand=False) - if props.type == "FILL": + if props.type == 'FILL': layout.prop(props, "fill_color", expand=False) layout.prop(props, "strength") @@ -1599,16 +1554,15 @@ class _defs_sculpt: class _defs_vertex_paint: + @staticmethod def poll_select_mask(context): if context is None: return True ob = context.active_object - return ( - ob - and ob.type == "MESH" - and (ob.data.use_paint_mask or ob.data.use_paint_mask_vertex) - ) + return (ob and ob.type == 'MESH' and + (ob.data.use_paint_mask or + ob.data.use_paint_mask_vertex)) @staticmethod def generate_from_brushes(context): @@ -1622,12 +1576,14 @@ class _defs_vertex_paint: class _defs_texture_paint: + @staticmethod def poll_select_mask(context): if context is None: return True ob = context.active_object - return ob and ob.type == "MESH" and (ob.data.use_paint_mask) + return (ob and ob.type == 'MESH' and + (ob.data.use_paint_mask)) @staticmethod def generate_from_brushes(context): @@ -1637,21 +1593,20 @@ class _defs_texture_paint: icon_prefix="brush.paint_texture.", type=bpy.types.Brush, attr="image_tool", - cursor="PAINT_CROSS", + cursor='PAINT_CROSS', ) class _defs_weight_paint: + @staticmethod def poll_select_mask(context): if context is None: return True ob = context.active_object - return ( - ob - and ob.type == "MESH" - and (ob.data.use_paint_mask or ob.data.use_paint_mask_vertex) - ) + return (ob and ob.type == 'MESH' and + (ob.data.use_paint_mask or + ob.data.use_paint_mask_vertex)) @staticmethod def generate_from_brushes(context): @@ -1673,12 +1628,11 @@ class _defs_weight_paint: else: return layout.label(text="Weight: %.3f" % weight) - return dict( idname="builtin.sample_weight", label="Sample Weight", icon="ops.paint.weight_sample", - cursor="EYEDROPPER", + cursor='EYEDROPPER', widget=None, keymap=(), draw_settings=draw_settings, @@ -1690,7 +1644,7 @@ class _defs_weight_paint: idname="builtin.sample_vertex_group", label="Sample Vertex Group", icon="ops.paint.weight_sample_group", - cursor="EYEDROPPER", + cursor='EYEDROPPER', widget=None, keymap=(), ) @@ -1701,7 +1655,6 @@ class _defs_weight_paint: brush = context.tool_settings.weight_paint.brush if brush is not None: from bl_ui.properties_paint_common import UnifiedPaintPanel - UnifiedPaintPanel.prop_unified( layout, context, @@ -1735,6 +1688,7 @@ class _defs_weight_paint: class _defs_image_generic: + @staticmethod def poll_uvedit(context): if context is None: @@ -1751,7 +1705,9 @@ class _defs_image_generic: return dict( idname="builtin.cursor", label="Cursor", - description=("Set the cursor location, drag to transform"), + description=( + "Set the cursor location, drag to transform" + ), icon="ops.generic.cursor", keymap=(), ) @@ -1763,11 +1719,12 @@ class _defs_image_generic: def draw_settings(_context, layout, tool): props = tool.operator_properties("image.sample") layout.prop(props, "size") - return dict( idname="builtin.sample", label="Sample", - description=("Sample pixel values under the cursor"), + description=( + "Sample pixel values under the cursor" + ), icon="ops.paint.weight_sample", # XXX, needs own icon. keymap="Image Editor Tool: Sample", draw_settings=draw_settings, @@ -1775,6 +1732,7 @@ class _defs_image_generic: class _defs_image_uv_transform: + @ToolDef.from_fn def translate(): return dict( @@ -1813,7 +1771,9 @@ class _defs_image_uv_transform: return dict( idname="builtin.transform", label="Transform", - description=("Supports any combination of grab, rotate, and scale at once"), + description=( + "Supports any combination of grab, rotate, and scale at once" + ), icon="ops.transform.transform", widget="IMAGE_GGT_gizmo2d", # No keymap default action, only for gizmo! @@ -1821,6 +1781,7 @@ class _defs_image_uv_transform: class _defs_image_uv_select: + @ToolDef.from_fn def select(): return dict( @@ -1838,7 +1799,6 @@ class _defs_image_uv_select: row = layout.row() row.use_property_split = False row.prop(props, "mode", text="", expand=True, icon_only=True) - return dict( idname="builtin.select_box", label="Select Box", @@ -1855,7 +1815,6 @@ class _defs_image_uv_select: row = layout.row() row.use_property_split = False row.prop(props, "mode", text="", expand=True, icon_only=True) - return dict( idname="builtin.select_lasso", label="Select Lasso", @@ -1876,7 +1835,6 @@ class _defs_image_uv_select: def draw_cursor(_context, tool, xy): from gpu_extras.presets import draw_circle_2d - props = tool.operator_properties("uv.select_circle") radius = props.radius draw_circle_2d(xy, (1.0,) * 4, radius, segments=32) @@ -1893,6 +1851,7 @@ class _defs_image_uv_select: class _defs_image_uv_edit: + @ToolDef.from_fn def rip_region(): return dict( @@ -1902,16 +1861,16 @@ class _defs_image_uv_edit: # TODO: generic operator (UV version of `VIEW3D_GGT_tool_generic_handle_free`). widget=None, keymap=(), - options={"KEYMAP_FALLBACK"}, + options={'KEYMAP_FALLBACK'}, ) class _defs_image_uv_sculpt: + @staticmethod def generate_from_brushes(context): def draw_cursor(context, _tool, xy): from gpu_extras.presets import draw_circle_2d - tool_settings = context.tool_settings uv_sculpt = tool_settings.uv_sculpt if not uv_sculpt.show_brush: @@ -1936,12 +1895,13 @@ class _defs_image_uv_sculpt: operator="sculpt.uv_sculpt_stroke", keymap="Image Editor Tool: Uv, Sculpt Stroke", draw_cursor=draw_cursor, - options={"KEYMAP_FALLBACK"}, + options={'KEYMAP_FALLBACK'}, ), ) class _defs_gpencil_paint: + @staticmethod def gpencil_primitive_toolbar(context, layout, _tool, props): paint = context.tool_settings.gpencil_paint @@ -1974,7 +1934,7 @@ class _defs_gpencil_paint: icon_prefix="brush.gpencil_draw.", type=bpy.types.Brush, attr="gpencil_tool", - cursor="DOT", + cursor='DOT', tooldef_keywords=dict( operator="gpencil.draw", ), @@ -1987,12 +1947,11 @@ class _defs_gpencil_paint: row = layout.row() row.use_property_split = False row.prop(props, "flat_caps") - return dict( idname="builtin.cutter", label="Cutter", icon="ops.gpencil.stroke_cutter", - cursor="KNIFE", + cursor='KNIFE', widget=None, keymap=(), draw_settings=draw_settings, @@ -2008,7 +1967,7 @@ class _defs_gpencil_paint: idname="builtin.line", label="Line", icon="ops.gpencil.primitive_line", - cursor="CROSSHAIR", + cursor='CROSSHAIR', widget=None, keymap=(), draw_settings=draw_settings, @@ -2024,7 +1983,7 @@ class _defs_gpencil_paint: idname="builtin.polyline", label="Polyline", icon="ops.gpencil.primitive_polyline", - cursor="CROSSHAIR", + cursor='CROSSHAIR', widget=None, keymap=(), draw_settings=draw_settings, @@ -2040,7 +1999,7 @@ class _defs_gpencil_paint: idname="builtin.box", label="Box", icon="ops.gpencil.primitive_box", - cursor="CROSSHAIR", + cursor='CROSSHAIR', widget=None, keymap=(), draw_settings=draw_settings, @@ -2056,7 +2015,7 @@ class _defs_gpencil_paint: idname="builtin.circle", label="Circle", icon="ops.gpencil.primitive_circle", - cursor="CROSSHAIR", + cursor='CROSSHAIR', widget=None, keymap=(), draw_settings=draw_settings, @@ -2072,7 +2031,7 @@ class _defs_gpencil_paint: idname="builtin.arc", label="Arc", icon="ops.gpencil.primitive_arc", - cursor="CROSSHAIR", + cursor='CROSSHAIR', widget=None, keymap=(), draw_settings=draw_settings, @@ -2088,7 +2047,7 @@ class _defs_gpencil_paint: idname="builtin.curve", label="Curve", icon="ops.gpencil.primitive_curve", - cursor="CROSSHAIR", + cursor='CROSSHAIR', widget=None, keymap=(), draw_settings=draw_settings, @@ -2101,12 +2060,11 @@ class _defs_gpencil_paint: row = layout.row() row.use_property_split = False row.prop(props, "mode", expand=True) - return dict( idname="builtin.eyedropper", label="Eyedropper", icon="ops.paint.eyedropper_add", - cursor="EYEDROPPER", + cursor='EYEDROPPER', widget=None, keymap=(), draw_settings=draw_settings, @@ -2126,7 +2084,7 @@ class _defs_gpencil_paint: idname="builtin.interpolate", label="Interpolate", icon="ops.pose.breakdowner", - cursor="DEFAULT", + cursor='DEFAULT', widget=None, keymap=(), draw_settings=draw_settings, @@ -2136,11 +2094,11 @@ class _defs_gpencil_paint: class _defs_gpencil_edit: def is_segment(context): ts = context.scene.tool_settings - if context.mode == "EDIT_GPENCIL": - return ts.gpencil_selectmode_edit == "SEGMENT" - elif context.mode == "SCULPT_GPENCIL": + if context.mode == 'EDIT_GPENCIL': + return ts.gpencil_selectmode_edit == 'SEGMENT' + elif context.mode == 'SCULPT_GPENCIL': return ts.use_gpencil_select_mask_segment - elif context.mode == "VERTEX_GPENCIL": + elif context.mode == 'VERTEX_GPENCIL': return ts.use_gpencil_vertex_select_mask_segment else: return False @@ -2159,10 +2117,7 @@ class _defs_gpencil_edit: def select(): def draw_settings(context, layout, _tool): if _defs_gpencil_edit.is_segment(context): - layout.prop( - context.tool_settings.gpencil_sculpt, "intersection_threshold" - ) - + layout.prop(context.tool_settings.gpencil_sculpt, "intersection_threshold") return dict( idname="builtin.select", label="Tweak", @@ -2180,10 +2135,7 @@ class _defs_gpencil_edit: row.use_property_split = False row.prop(props, "mode", text="", expand=True, icon_only=True) if _defs_gpencil_edit.is_segment(context): - layout.prop( - context.tool_settings.gpencil_sculpt, "intersection_threshold" - ) - + layout.prop(context.tool_settings.gpencil_sculpt, "intersection_threshold") return dict( idname="builtin.select_box", label="Select Box", @@ -2201,10 +2153,7 @@ class _defs_gpencil_edit: row.use_property_split = False row.prop(props, "mode", text="", expand=True, icon_only=True) if _defs_gpencil_edit.is_segment(context): - layout.prop( - context.tool_settings.gpencil_sculpt, "intersection_threshold" - ) - + layout.prop(context.tool_settings.gpencil_sculpt, "intersection_threshold") return dict( idname="builtin.select_lasso", label="Select Lasso", @@ -2223,13 +2172,10 @@ class _defs_gpencil_edit: row.prop(props, "mode", text="", expand=True, icon_only=True) layout.prop(props, "radius") if _defs_gpencil_edit.is_segment(context): - layout.prop( - context.tool_settings.gpencil_sculpt, "intersection_threshold" - ) + layout.prop(context.tool_settings.gpencil_sculpt, "intersection_threshold") def draw_cursor(_context, tool, xy): from gpu_extras.presets import draw_circle_2d - props = tool.operator_properties("gpencil.select_circle") radius = props.radius draw_circle_2d(xy, (1.0,) * 4, radius, segments=32) @@ -2249,8 +2195,11 @@ class _defs_gpencil_edit: return dict( idname="builtin.radius", label="Radius", - description=("Expand or contract the radius of the selected points"), + description=( + "Expand or contract the radius of the selected points" + ), icon="ops.gpencil.radius", + widget=None, keymap=(), ) @@ -2298,7 +2247,7 @@ class _defs_gpencil_edit: idname="builtin.transform_fill", label="Transform Fill", icon="ops.gpencil.transform_fill", - cursor="DEFAULT", + cursor='DEFAULT', widget=None, keymap=(), draw_settings=draw_settings, @@ -2319,7 +2268,7 @@ class _defs_gpencil_edit: idname="builtin.interpolate", label="Interpolate", icon="ops.pose.breakdowner", - cursor="DEFAULT", + cursor='DEFAULT', widget=None, keymap=(), draw_settings=draw_settings, @@ -2327,21 +2276,16 @@ class _defs_gpencil_edit: class _defs_gpencil_sculpt: + @staticmethod def poll_select_mask(context): if context is None: return True ob = context.active_object ts = context.scene.tool_settings - return ( - ob - and ob.type == "GPENCIL" - and ( - ts.use_gpencil_select_mask_point - or ts.use_gpencil_select_mask_stroke - or ts.use_gpencil_select_mask_segment - ) - ) + return ob and ob.type == 'GPENCIL' and (ts.use_gpencil_select_mask_point or + ts.use_gpencil_select_mask_stroke or + ts.use_gpencil_select_mask_segment) @staticmethod def generate_from_brushes(context): @@ -2358,6 +2302,7 @@ class _defs_gpencil_sculpt: class _defs_gpencil_weight: + @staticmethod def generate_from_brushes(context): return generate_from_enum_ex( @@ -2373,6 +2318,7 @@ class _defs_gpencil_weight: class _defs_curves_sculpt: + @ToolDef.from_fn def selection_paint(): return dict( @@ -2388,7 +2334,7 @@ class _defs_curves_sculpt: idname="builtin_brush.comb", label="Comb", icon="ops.curves.sculpt_comb", - data_block="COMB", + data_block='COMB', ) @ToolDef.from_fn @@ -2397,7 +2343,7 @@ class _defs_curves_sculpt: idname="builtin_brush.add", label="Add", icon="ops.curves.sculpt_add", - data_block="ADD", + data_block='ADD', ) @ToolDef.from_fn @@ -2406,7 +2352,7 @@ class _defs_curves_sculpt: idname="builtin_brush.delete", label="Delete", icon="ops.curves.sculpt_delete", - data_block="DELETE", + data_block='DELETE', ) @ToolDef.from_fn @@ -2415,7 +2361,7 @@ class _defs_curves_sculpt: idname="builtin_brush.snake_hook", label="Snake Hook", icon="ops.curves.sculpt_snake_hook", - data_block="SNAKE_HOOK", + data_block='SNAKE_HOOK', ) @ToolDef.from_fn @@ -2424,7 +2370,7 @@ class _defs_curves_sculpt: idname="builtin_brush.grow_shrink", label="Grow/Shrink", icon="ops.curves.sculpt_grow_shrink", - data_block="GROW_SHRINK", + data_block='GROW_SHRINK', ) @ToolDef.from_fn @@ -2433,7 +2379,7 @@ class _defs_curves_sculpt: idname="builtin_brush.pinch", label="Pinch", icon="ops.curves.sculpt_pinch", - data_block="PINCH", + data_block='PINCH', ) @ToolDef.from_fn @@ -2442,7 +2388,7 @@ class _defs_curves_sculpt: idname="builtin_brush.smooth", label="Smooth", icon="ops.curves.sculpt_smooth", - data_block="SMOOTH", + data_block='SMOOTH', ) @ToolDef.from_fn @@ -2451,7 +2397,7 @@ class _defs_curves_sculpt: idname="builtin_brush.puff", label="Puff", icon="ops.curves.sculpt_puff", - data_block="PUFF", + data_block='PUFF', ) @ToolDef.from_fn @@ -2474,21 +2420,16 @@ class _defs_curves_sculpt: class _defs_gpencil_vertex: + @staticmethod def poll_select_mask(context): if context is None: return True ob = context.active_object ts = context.scene.tool_settings - return ( - ob - and ob.type == "GPENCIL" - and ( - ts.use_gpencil_vertex_select_mask_point - or ts.use_gpencil_vertex_select_mask_stroke - or ts.use_gpencil_vertex_select_mask_segment - ) - ) + return ob and ob.type == 'GPENCIL' and (ts.use_gpencil_vertex_select_mask_point or + ts.use_gpencil_vertex_select_mask_stroke or + ts.use_gpencil_vertex_select_mask_segment) @staticmethod def generate_from_brushes(context): @@ -2498,7 +2439,7 @@ class _defs_gpencil_vertex: icon_prefix="brush.paint_vertex.", type=bpy.types.Brush, attr="gpencil_vertex_tool", - cursor="DOT", + cursor='DOT', tooldef_keywords=dict( operator="gpencil.vertex_paint", ), @@ -2506,6 +2447,7 @@ class _defs_gpencil_vertex: class _defs_node_select: + @ToolDef.from_fn def select(): return dict( @@ -2523,7 +2465,6 @@ class _defs_node_select: row = layout.row() row.use_property_split = False row.prop(props, "mode", text="", expand=True, icon_only=True) - return dict( idname="builtin.select_box", label="Select Box", @@ -2540,7 +2481,6 @@ class _defs_node_select: row = layout.row() row.use_property_split = False row.prop(props, "mode", text="", expand=True, icon_only=True) - return dict( idname="builtin.select_lasso", label="Select Lasso", @@ -2561,7 +2501,6 @@ class _defs_node_select: def draw_cursor(_context, tool, xy): from gpu_extras.presets import draw_circle_2d - props = tool.operator_properties("node.select_circle") radius = props.radius draw_circle_2d(xy, (1.0,) * 4, radius, segments=32) @@ -2578,6 +2517,7 @@ class _defs_node_select: class _defs_node_edit: + @ToolDef.from_fn def links_cut(): return dict( @@ -2586,17 +2526,20 @@ class _defs_node_edit: icon="ops.node.links_cut", widget=None, keymap="Node Tool: Links Cut", - options={"KEYMAP_FALLBACK"}, + options={'KEYMAP_FALLBACK'}, ) class _defs_sequencer_generic: + @ToolDef.from_fn def cursor(): return dict( idname="builtin.cursor", label="Cursor", - description=("Set the cursor location, drag to transform"), + description=( + "Set the cursor location, drag to transform" + ), icon="ops.generic.cursor", keymap="Sequencer Tool: Cursor", ) @@ -2608,16 +2551,15 @@ class _defs_sequencer_generic: row = layout.row() row.use_property_split = False row.prop(props, "type", expand=True) - return dict( idname="builtin.blade", label="Blade", icon="ops.sequencer.blade", - cursor="CROSSHAIR", + cursor='CROSSHAIR', widget=None, keymap="Sequencer Tool: Blade", draw_settings=draw_settings, - options={"KEYMAP_FALLBACK"}, + options={'KEYMAP_FALLBACK'}, ) @ToolDef.from_fn @@ -2625,7 +2567,9 @@ class _defs_sequencer_generic: return dict( idname="builtin.sample", label="Sample", - description=("Sample pixel values under the cursor"), + description=( + "Sample pixel values under the cursor" + ), icon="ops.paint.weight_sample", # XXX, needs own icon. keymap="Sequencer Tool: Sample", ) @@ -2668,7 +2612,9 @@ class _defs_sequencer_generic: return dict( idname="builtin.transform", label="Transform", - description=("Supports any combination of grab, rotate, and scale at once"), + description=( + "Supports any combination of grab, rotate, and scale at once" + ), icon="ops.transform.transform", widget="SEQUENCER_GGT_gizmo2d", # No keymap default action, only for gizmo! @@ -2694,7 +2640,6 @@ class _defs_sequencer_select: row.use_property_split = False row.prop(props, "mode", text="", expand=True, icon_only=True) pass - return dict( idname="builtin.select_box", label="Select Box", @@ -2706,10 +2651,10 @@ class _defs_sequencer_select: class IMAGE_PT_tools_active(ToolSelectPanelHelper, Panel): - bl_space_type = "IMAGE_EDITOR" - bl_region_type = "TOOLS" + bl_space_type = 'IMAGE_EDITOR' + bl_region_type = 'TOOLS' bl_label = "Tools" # not visible - bl_options = {"HIDE_HEADER"} + bl_options = {'HIDE_HEADER'} # Satisfy the 'ToolSelectPanelHelper' API. keymap_prefix = "Image Editor Tool:" @@ -2721,7 +2666,7 @@ class IMAGE_PT_tools_active(ToolSelectPanelHelper, Panel): def tools_from_context(cls, context, mode=None): if mode is None: if context.space_data is None: - mode = "VIEW" + mode = 'VIEW' else: mode = context.space_data.mode for tools in (cls._tools[None], cls._tools.get(mode, ())): @@ -2769,11 +2714,11 @@ class IMAGE_PT_tools_active(ToolSelectPanelHelper, Panel): None: [ # for all modes ], - "VIEW": [ + 'VIEW': [ _defs_image_generic.sample, *_tools_annotate, ], - "UV": [ + 'UV': [ *_tools_select, _defs_image_generic.cursor, None, @@ -2789,10 +2734,10 @@ class IMAGE_PT_tools_active(ToolSelectPanelHelper, Panel): else () ), ], - "MASK": [ + 'MASK': [ None, ], - "PAINT": [ + 'PAINT': [ _defs_texture_paint.generate_from_brushes, None, *_tools_annotate, @@ -2801,10 +2746,10 @@ class IMAGE_PT_tools_active(ToolSelectPanelHelper, Panel): class NODE_PT_tools_active(ToolSelectPanelHelper, Panel): - bl_space_type = "NODE_EDITOR" - bl_region_type = "TOOLS" + bl_space_type = 'NODE_EDITOR' + bl_region_type = 'TOOLS' bl_label = "Tools" # not visible - bl_options = {"HIDE_HEADER"} + bl_options = {'HIDE_HEADER'} # Satisfy the 'ToolSelectPanelHelper' API. keymap_prefix = "Node Editor Tool:" @@ -2865,10 +2810,10 @@ class NODE_PT_tools_active(ToolSelectPanelHelper, Panel): class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel): - bl_space_type = "VIEW_3D" - bl_region_type = "TOOLS" + bl_space_type = 'VIEW_3D' + bl_region_type = 'TOOLS' bl_label = "Tools" # not visible - bl_options = {"HIDE_HEADER"} + bl_options = {'HIDE_HEADER'} # Satisfy the 'ToolSelectPanelHelper' API. keymap_prefix = "3D View Tool:" @@ -2957,12 +2902,12 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel): # _defs_view3d_generic.cursor, # End group. ], - "OBJECT": [ + 'OBJECT': [ *_tools_default, None, _tools_view3d_add, ], - "POSE": [ + 'POSE': [ *_tools_default, None, ( @@ -2971,7 +2916,7 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel): _defs_pose.relax, ), ], - "EDIT_ARMATURE": [ + 'EDIT_ARMATURE': [ *_tools_default, None, _defs_edit_armature.roll, @@ -2986,8 +2931,9 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel): ), _defs_transform.shear, ], - "EDIT_MESH": [ + 'EDIT_MESH': [ *_tools_default, + None, _tools_view3d_add, None, @@ -3034,7 +2980,7 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel): _defs_edit_mesh.rip_edge, ), ], - "EDIT_CURVE": [ + 'EDIT_CURVE': [ *_tools_default, None, _defs_edit_curve.draw, @@ -3050,37 +2996,37 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel): _defs_transform.shear, _defs_edit_curve.curve_vertex_randomize, ], - "EDIT_CURVES": [ + 'EDIT_CURVES': [ *_tools_select, ], - "EDIT_SURFACE": [ + 'EDIT_SURFACE': [ *_tools_default, None, _defs_transform.shear, ], - "EDIT_METABALL": [ + 'EDIT_METABALL': [ *_tools_default, None, _defs_transform.shear, ], - "EDIT_LATTICE": [ + 'EDIT_LATTICE': [ *_tools_default, None, _defs_transform.shear, ], - "EDIT_TEXT": [ + 'EDIT_TEXT': [ _defs_view3d_generic.cursor, None, *_tools_annotate, _defs_view3d_generic.ruler, ], - "PARTICLE": [ + 'PARTICLE': [ *_tools_select, _defs_view3d_generic.cursor, None, _defs_particle.generate_from_brushes, ], - "SCULPT": [ + 'SCULPT': [ _defs_sculpt.generate_from_brushes, None, ( @@ -3113,7 +3059,7 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel): None, *_tools_annotate, ], - "PAINT_TEXTURE": [ + 'PAINT_TEXTURE': [ _defs_texture_paint.generate_from_brushes, None, lambda context: ( @@ -3123,7 +3069,7 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel): ), *_tools_annotate, ], - "PAINT_VERTEX": [ + 'PAINT_VERTEX': [ _defs_vertex_paint.generate_from_brushes, None, lambda context: ( @@ -3133,7 +3079,7 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel): ), *_tools_annotate, ], - "PAINT_WEIGHT": [ + 'PAINT_WEIGHT': [ _defs_weight_paint.generate_from_brushes, _defs_weight_paint.gradient, None, @@ -3159,7 +3105,7 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel): ), *_tools_annotate, ], - "PAINT_GPENCIL": [ + 'PAINT_GPENCIL': [ _defs_view3d_generic.cursor, None, _defs_gpencil_paint.generate_from_brushes, @@ -3178,7 +3124,7 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel): None, *_tools_annotate, ], - "EDIT_GPENCIL": [ + 'EDIT_GPENCIL': [ *_tools_gpencil_select, _defs_view3d_generic.cursor, None, @@ -3197,7 +3143,7 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel): None, *_tools_annotate, ], - "SCULPT_GPENCIL": [ + 'SCULPT_GPENCIL': [ _defs_gpencil_sculpt.generate_from_brushes, None, *_tools_annotate, @@ -3207,12 +3153,12 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel): else () ), ], - "WEIGHT_GPENCIL": [ + 'WEIGHT_GPENCIL': [ _defs_gpencil_weight.generate_from_brushes, None, *_tools_annotate, ], - "VERTEX_GPENCIL": [ + 'VERTEX_GPENCIL': [ _defs_gpencil_vertex.generate_from_brushes, None, *_tools_annotate, @@ -3223,7 +3169,7 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel): else () ), ], - "SCULPT_CURVES": [ + 'SCULPT_CURVES': [ _defs_curves_sculpt.selection_paint, None, _defs_curves_sculpt.add, @@ -3244,10 +3190,10 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel): class SEQUENCER_PT_tools_active(ToolSelectPanelHelper, Panel): - bl_space_type = "SEQUENCE_EDITOR" - bl_region_type = "TOOLS" + bl_space_type = 'SEQUENCE_EDITOR' + bl_region_type = 'TOOLS' bl_label = "Tools" # not visible - bl_options = {"HIDE_HEADER"} + bl_options = {'HIDE_HEADER'} # Satisfy the 'ToolSelectPanelHelper' API. keymap_prefix = "Sequence Editor Tool:" @@ -3292,8 +3238,9 @@ class SEQUENCER_PT_tools_active(ToolSelectPanelHelper, Panel): # The keys match sequence editors view type: `context.space_data.view_type`. # The values represent the tools, see `ToolSelectPanelHelper` for details. _tools = { - None: [], - "PREVIEW": [ + None: [ + ], + 'PREVIEW': [ *_tools_select, _defs_sequencer_generic.cursor, None, @@ -3305,11 +3252,11 @@ class SEQUENCER_PT_tools_active(ToolSelectPanelHelper, Panel): _defs_sequencer_generic.sample, *_tools_annotate, ], - "SEQUENCER": [ + 'SEQUENCER': [ *_tools_select, _defs_sequencer_generic.blade, ], - "SEQUENCER_PREVIEW": [ + 'SEQUENCER_PREVIEW': [ *_tools_select, None, *_tools_annotate, @@ -3328,6 +3275,5 @@ classes = ( if __name__ == "__main__": # only for live edit. from bpy.utils import register_class - for cls in classes: register_class(cls)