Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
| Show First 20 Lines • Show All 99 Lines • ▼ Show 20 Lines | def cursor(): | ||||
| idname="builtin.cursor", | idname="builtin.cursor", | ||||
| label="Cursor", | label="Cursor", | ||||
| description=( | description=( | ||||
| "Set the cursor location, drag to transform" | "Set the cursor location, drag to transform" | ||||
| ), | ), | ||||
| icon="ops.generic.cursor", | icon="ops.generic.cursor", | ||||
| keymap="3D View Tool: Cursor", | keymap="3D View Tool: Cursor", | ||||
| draw_settings=draw_settings, | draw_settings=draw_settings, | ||||
| options={'KEYMAP_FALLBACK'}, | |||||
| ) | ) | ||||
| @ToolDef.from_fn | @ToolDef.from_fn | ||||
| def cursor_click(): | def cursor_click(): | ||||
| return dict( | return dict( | ||||
| idname="builtin.none", | idname="builtin.none", | ||||
| label="None", | label="None", | ||||
| icon="ops.generic.cursor", | icon="ops.generic.cursor", | ||||
| Show All 22 Lines | def ruler(): | ||||
| ) | ) | ||||
| return dict( | return dict( | ||||
| idname="builtin.measure", | idname="builtin.measure", | ||||
| label="Measure", | label="Measure", | ||||
| description=description, | description=description, | ||||
| icon="ops.view3d.ruler", | icon="ops.view3d.ruler", | ||||
| widget="VIEW3D_GGT_ruler", | widget="VIEW3D_GGT_ruler", | ||||
| keymap="3D View Tool: Measure", | keymap="3D View Tool: Measure", | ||||
| options={'KEYMAP_FALLBACK'}, | |||||
| ) | ) | ||||
| class _defs_annotate: | class _defs_annotate: | ||||
| def draw_settings_common(context, layout, tool): | def draw_settings_common(context, layout, tool): | ||||
| gpd = context.annotation_data | gpd = context.annotation_data | ||||
| region_type = context.region.type | region_type = context.region.type | ||||
| ▲ Show 20 Lines • Show All 78 Lines • ▼ Show 20 Lines | class _defs_annotate: | ||||
| def scribble(*, draw_settings): | def scribble(*, draw_settings): | ||||
| return dict( | return dict( | ||||
| idname="builtin.annotate", | idname="builtin.annotate", | ||||
| label="Annotate", | label="Annotate", | ||||
| icon="ops.gpencil.draw", | icon="ops.gpencil.draw", | ||||
| cursor='PAINT_BRUSH', | cursor='PAINT_BRUSH', | ||||
| keymap="Generic Tool: Annotate", | keymap="Generic Tool: Annotate", | ||||
| draw_settings=draw_settings, | draw_settings=draw_settings, | ||||
| options={'KEYMAP_FALLBACK'}, | |||||
| ) | ) | ||||
| @ToolDef.from_fn.with_args(draw_settings=draw_settings_common) | @ToolDef.from_fn.with_args(draw_settings=draw_settings_common) | ||||
| def line(*, draw_settings): | def line(*, draw_settings): | ||||
| return dict( | return dict( | ||||
| idname="builtin.annotate_line", | idname="builtin.annotate_line", | ||||
| label="Annotate Line", | label="Annotate Line", | ||||
| icon="ops.gpencil.draw.line", | icon="ops.gpencil.draw.line", | ||||
| cursor='PAINT_BRUSH', | cursor='PAINT_BRUSH', | ||||
| keymap="Generic Tool: Annotate Line", | keymap="Generic Tool: Annotate Line", | ||||
| draw_settings=draw_settings, | draw_settings=draw_settings, | ||||
| options={'KEYMAP_FALLBACK'}, | |||||
| ) | ) | ||||
| @ToolDef.from_fn.with_args(draw_settings=draw_settings_common) | @ToolDef.from_fn.with_args(draw_settings=draw_settings_common) | ||||
| def poly(*, draw_settings): | def poly(*, draw_settings): | ||||
| return dict( | return dict( | ||||
| idname="builtin.annotate_polygon", | idname="builtin.annotate_polygon", | ||||
| label="Annotate Polygon", | label="Annotate Polygon", | ||||
| icon="ops.gpencil.draw.poly", | icon="ops.gpencil.draw.poly", | ||||
| cursor='PAINT_BRUSH', | cursor='PAINT_BRUSH', | ||||
| keymap="Generic Tool: Annotate Polygon", | keymap="Generic Tool: Annotate Polygon", | ||||
| draw_settings=draw_settings, | draw_settings=draw_settings, | ||||
| options={'KEYMAP_FALLBACK'}, | |||||
| ) | ) | ||||
| @ToolDef.from_fn | @ToolDef.from_fn | ||||
| def eraser(): | def eraser(): | ||||
| def draw_settings(context, layout, _tool): | def draw_settings(context, layout, _tool): | ||||
| # TODO: Move this setting to tool_settings | # TODO: Move this setting to tool_settings | ||||
| prefs = context.preferences | prefs = context.preferences | ||||
| layout.prop(prefs.edit, "grease_pencil_eraser_radius", text="Radius") | layout.prop(prefs.edit, "grease_pencil_eraser_radius", text="Radius") | ||||
| return dict( | return dict( | ||||
| idname="builtin.annotate_eraser", | idname="builtin.annotate_eraser", | ||||
| label="Annotate Eraser", | label="Annotate Eraser", | ||||
| icon="ops.gpencil.draw.eraser", | icon="ops.gpencil.draw.eraser", | ||||
| cursor='ERASER', | cursor='ERASER', | ||||
| keymap="Generic Tool: Annotate Eraser", | keymap="Generic Tool: Annotate Eraser", | ||||
| draw_settings=draw_settings, | draw_settings=draw_settings, | ||||
| options={'KEYMAP_FALLBACK'}, | |||||
| ) | ) | ||||
| class _defs_transform: | class _defs_transform: | ||||
| @ToolDef.from_fn | @ToolDef.from_fn | ||||
| def translate(): | def translate(): | ||||
| def draw_settings(context, layout, _tool): | def draw_settings(context, layout, _tool): | ||||
| ▲ Show 20 Lines • Show All 253 Lines • ▼ Show 20 Lines | def cube_add(): | ||||
| label="Add Cube", | label="Add Cube", | ||||
| icon="ops.mesh.primitive_cube_add_gizmo", | icon="ops.mesh.primitive_cube_add_gizmo", | ||||
| description=lambda *args: _defs_view3d_add.description_interactive_add( | 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", | widget="VIEW3D_GGT_placement", | ||||
| keymap="3D View Tool: Object, Add Primitive", | keymap="3D View Tool: Object, Add Primitive", | ||||
| draw_settings=draw_settings, | draw_settings=draw_settings, | ||||
| options={'KEYMAP_FALLBACK'}, | |||||
| ) | ) | ||||
| @ToolDef.from_fn | @ToolDef.from_fn | ||||
| def cone_add(): | def cone_add(): | ||||
| def draw_settings(_context, layout, tool, *, extra=False): | 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: | if extra: | ||||
| return | return | ||||
| Show All 10 Lines | def cone_add(): | ||||
| label="Add Cone", | label="Add Cone", | ||||
| icon="ops.mesh.primitive_cone_add_gizmo", | icon="ops.mesh.primitive_cone_add_gizmo", | ||||
| description=lambda *args: _defs_view3d_add.description_interactive_add( | 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", | widget="VIEW3D_GGT_placement", | ||||
| keymap="3D View Tool: Object, Add Primitive", | keymap="3D View Tool: Object, Add Primitive", | ||||
| draw_settings=draw_settings, | draw_settings=draw_settings, | ||||
| options={'KEYMAP_FALLBACK'}, | |||||
| ) | ) | ||||
| @ToolDef.from_fn | @ToolDef.from_fn | ||||
| def cylinder_add(): | def cylinder_add(): | ||||
| def draw_settings(_context, layout, tool, *, extra=False): | 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: | if extra: | ||||
| return | return | ||||
| Show All 9 Lines | def cylinder_add(): | ||||
| label="Add Cylinder", | label="Add Cylinder", | ||||
| icon="ops.mesh.primitive_cylinder_add_gizmo", | icon="ops.mesh.primitive_cylinder_add_gizmo", | ||||
| description=lambda *args: _defs_view3d_add.description_interactive_add( | 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", | widget="VIEW3D_GGT_placement", | ||||
| keymap="3D View Tool: Object, Add Primitive", | keymap="3D View Tool: Object, Add Primitive", | ||||
| draw_settings=draw_settings, | draw_settings=draw_settings, | ||||
| options={'KEYMAP_FALLBACK'}, | |||||
| ) | ) | ||||
| @ToolDef.from_fn | @ToolDef.from_fn | ||||
| def uv_sphere_add(): | def uv_sphere_add(): | ||||
| def draw_settings(_context, layout, tool, *, extra=False): | 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: | if extra: | ||||
| return | return | ||||
| Show All 9 Lines | def uv_sphere_add(): | ||||
| label="Add UV Sphere", | label="Add UV Sphere", | ||||
| icon="ops.mesh.primitive_sphere_add_gizmo", | icon="ops.mesh.primitive_sphere_add_gizmo", | ||||
| description=lambda *args: _defs_view3d_add.description_interactive_add( | 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", | widget="VIEW3D_GGT_placement", | ||||
| keymap="3D View Tool: Object, Add Primitive", | keymap="3D View Tool: Object, Add Primitive", | ||||
| draw_settings=draw_settings, | draw_settings=draw_settings, | ||||
| options={'KEYMAP_FALLBACK'}, | |||||
| ) | ) | ||||
| @ToolDef.from_fn | @ToolDef.from_fn | ||||
| def ico_sphere_add(): | def ico_sphere_add(): | ||||
| def draw_settings(_context, layout, tool, *, extra=False): | 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: | if extra: | ||||
| return | return | ||||
| props = tool.operator_properties("mesh.primitive_ico_sphere_add") | props = tool.operator_properties("mesh.primitive_ico_sphere_add") | ||||
| layout.prop(props, "subdivisions") | layout.prop(props, "subdivisions") | ||||
| if show_extra: | if show_extra: | ||||
| layout.popover("TOPBAR_PT_tool_settings_extra", text="...") | layout.popover("TOPBAR_PT_tool_settings_extra", text="...") | ||||
| return dict( | return dict( | ||||
| idname="builtin.primitive_ico_sphere_add", | idname="builtin.primitive_ico_sphere_add", | ||||
| label="Add Ico Sphere", | label="Add Ico Sphere", | ||||
| icon="ops.mesh.primitive_sphere_add_gizmo", | icon="ops.mesh.primitive_sphere_add_gizmo", | ||||
| description=lambda *args: _defs_view3d_add.description_interactive_add( | 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", | widget="VIEW3D_GGT_placement", | ||||
| keymap="3D View Tool: Object, Add Primitive", | keymap="3D View Tool: Object, Add Primitive", | ||||
| draw_settings=draw_settings, | draw_settings=draw_settings, | ||||
| options={'KEYMAP_FALLBACK'}, | |||||
| ) | ) | ||||
| # ----------------------------------------------------------------------------- | # ----------------------------------------------------------------------------- | ||||
| # Object Modes (named based on context.mode) | # Object Modes (named based on context.mode) | ||||
| class _defs_edit_armature: | class _defs_edit_armature: | ||||
| ▲ Show 20 Lines • Show All 430 Lines • ▼ Show 20 Lines | def knife(): | ||||
| return dict( | return dict( | ||||
| idname="builtin.knife", | idname="builtin.knife", | ||||
| label="Knife", | label="Knife", | ||||
| cursor='KNIFE', | cursor='KNIFE', | ||||
| icon="ops.mesh.knife_tool", | icon="ops.mesh.knife_tool", | ||||
| widget=None, | widget=None, | ||||
| keymap=(), | keymap=(), | ||||
| draw_settings=draw_settings, | draw_settings=draw_settings, | ||||
| options={'KEYMAP_FALLBACK'}, | |||||
| ) | ) | ||||
| @ToolDef.from_fn | @ToolDef.from_fn | ||||
| def bisect(): | def bisect(): | ||||
| def draw_settings(_context, layout, tool): | def draw_settings(_context, layout, tool): | ||||
| props = tool.operator_properties("mesh.bisect") | props = tool.operator_properties("mesh.bisect") | ||||
| layout.prop(props, "use_fill") | layout.prop(props, "use_fill") | ||||
| layout.prop(props, "clear_inner") | layout.prop(props, "clear_inner") | ||||
| ▲ Show 20 Lines • Show All 1,960 Lines • Show Last 20 Lines | |||||