2023-08-16 00:20:26 +10:00
|
|
|
# SPDX-FileCopyrightText: 2017-2023 Blender Authors
|
2023-06-15 13:09:04 +10:00
|
|
|
#
|
2022-02-11 09:07:11 +11:00
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
2017-10-21 16:19:48 +11:00
|
|
|
|
2020-02-28 08:58:34 +11:00
|
|
|
# For documentation on tool definitions: see "bl_ui.space_toolsystem_common.ToolDef"
|
|
|
|
|
# where there are comments for each field and their use.
|
|
|
|
|
|
2017-10-21 16:19:48 +11:00
|
|
|
# For now group all tools together
|
|
|
|
|
# we may want to move these into per space-type files.
|
|
|
|
|
#
|
|
|
|
|
# For now keep this in a single file since it's an area that may change,
|
|
|
|
|
# so avoid making changes all over the place.
|
|
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
import bpy
|
2017-10-21 16:19:48 +11:00
|
|
|
from bpy.types import Panel
|
|
|
|
|
|
2019-06-11 16:08:32 +10:00
|
|
|
from bl_ui.space_toolsystem_common import (
|
2017-10-21 16:19:48 +11:00
|
|
|
ToolSelectPanelHelper,
|
2018-04-27 13:23:29 +02:00
|
|
|
ToolDef,
|
2017-10-21 16:19:48 +11:00
|
|
|
)
|
2018-11-02 09:10:23 +11:00
|
|
|
|
2019-03-31 18:43:14 +02:00
|
|
|
from bpy.app.translations import pgettext_tip as tip_
|
|
|
|
|
|
|
|
|
|
|
2019-01-09 12:27:58 +11:00
|
|
|
def kmi_to_string_or_none(kmi):
|
|
|
|
|
return kmi.to_string() if kmi else "<none>"
|
|
|
|
|
|
|
|
|
|
|
2018-08-02 17:41:11 +10:00
|
|
|
def generate_from_enum_ex(
|
2023-02-14 10:30:49 +01:00
|
|
|
_context, *,
|
|
|
|
|
idname_prefix,
|
|
|
|
|
icon_prefix,
|
|
|
|
|
type,
|
|
|
|
|
attr,
|
|
|
|
|
cursor='DEFAULT',
|
2023-04-14 20:11:51 +10:00
|
|
|
tooldef_keywords=None,
|
2023-04-14 20:11:59 +10:00
|
|
|
icon_map=None,
|
|
|
|
|
use_separators=True,
|
2018-08-02 17:41:11 +10:00
|
|
|
):
|
2023-04-14 20:11:51 +10:00
|
|
|
if tooldef_keywords is None:
|
|
|
|
|
tooldef_keywords = {}
|
|
|
|
|
|
2018-08-02 17:41:11 +10:00
|
|
|
tool_defs = []
|
2023-04-14 20:11:59 +10:00
|
|
|
|
|
|
|
|
enum_items = getattr(
|
|
|
|
|
type.bl_rna.properties[attr],
|
|
|
|
|
"enum_items_static_ui" if use_separators else
|
|
|
|
|
"enum_items_static",
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
for enum in enum_items:
|
|
|
|
|
if use_separators:
|
|
|
|
|
if not (name := enum.name):
|
|
|
|
|
# Empty string for a UI Separator.
|
|
|
|
|
tool_defs.append(None)
|
|
|
|
|
continue
|
|
|
|
|
if not (idname := enum.identifier):
|
|
|
|
|
# This is a heading, there is no purpose in showing headings here.
|
|
|
|
|
continue
|
|
|
|
|
else:
|
|
|
|
|
name = enum.name
|
|
|
|
|
idname = enum.identifier
|
|
|
|
|
|
|
|
|
|
icon = icon_prefix + idname.lower()
|
|
|
|
|
if icon_map is not None:
|
|
|
|
|
icon = icon_map.get(icon, icon)
|
|
|
|
|
|
2018-08-02 17:41:11 +10:00
|
|
|
tool_defs.append(
|
|
|
|
|
ToolDef.from_dict(
|
|
|
|
|
dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname=idname_prefix + name,
|
2019-03-15 12:45:41 +11:00
|
|
|
label=name,
|
2023-04-20 07:55:24 +02:00
|
|
|
description=enum.description,
|
2023-04-14 20:11:59 +10:00
|
|
|
icon=icon,
|
2019-09-30 13:33:54 +02:00
|
|
|
cursor=cursor,
|
2019-03-15 12:45:41 +11:00
|
|
|
data_block=idname,
|
2018-11-06 12:08:39 +11:00
|
|
|
**tooldef_keywords,
|
2022-12-15 17:24:23 +11:00
|
|
|
),
|
|
|
|
|
),
|
2018-08-02 17:41:11 +10:00
|
|
|
)
|
|
|
|
|
return tuple(tool_defs)
|
|
|
|
|
|
|
|
|
|
|
2018-11-21 09:09:34 +11:00
|
|
|
# Use for shared widget data.
|
|
|
|
|
class _template_widget:
|
2018-11-21 09:25:55 +11:00
|
|
|
class VIEW3D_GGT_xform_extrude:
|
2018-11-21 09:09:34 +11:00
|
|
|
@staticmethod
|
2019-04-19 07:32:24 +02:00
|
|
|
def draw_settings(_context, layout, tool):
|
2018-11-21 09:25:55 +11:00
|
|
|
props = tool.gizmo_group_properties("VIEW3D_GGT_xform_extrude")
|
2018-11-21 09:09:34 +11:00
|
|
|
layout.prop(props, "axis_type", expand=True)
|
|
|
|
|
|
2019-04-13 20:36:53 +02:00
|
|
|
class VIEW3D_GGT_xform_gizmo:
|
2018-12-19 20:51:04 +11:00
|
|
|
@staticmethod
|
|
|
|
|
def draw_settings_with_index(context, layout, index):
|
|
|
|
|
scene = context.scene
|
2018-12-19 22:36:33 +11:00
|
|
|
orient_slot = scene.transform_orientation_slots[index]
|
2018-12-20 07:43:50 +11:00
|
|
|
layout.prop(orient_slot, "type")
|
2018-12-19 20:51:04 +11:00
|
|
|
|
2018-11-21 09:09:34 +11:00
|
|
|
|
2018-04-27 13:23:29 +02:00
|
|
|
class _defs_view3d_generic:
|
2018-04-30 12:14:46 +02:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def cursor():
|
2019-04-19 07:32:24 +02:00
|
|
|
def draw_settings(_context, layout, tool):
|
2018-06-22 15:07:11 +02:00
|
|
|
props = tool.operator_properties("view3d.cursor3d")
|
|
|
|
|
layout.prop(props, "use_depth")
|
|
|
|
|
layout.prop(props, "orientation")
|
2018-04-30 12:14:46 +02:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.cursor",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Cursor",
|
2023-02-14 10:30:49 +01:00
|
|
|
description=(
|
|
|
|
|
"Set the cursor location, drag to transform"
|
|
|
|
|
),
|
2018-05-07 21:38:43 +02:00
|
|
|
icon="ops.generic.cursor",
|
2018-12-14 12:17:00 +11:00
|
|
|
keymap="3D View Tool: Cursor",
|
2018-06-22 15:07:11 +02:00
|
|
|
draw_settings=draw_settings,
|
2018-05-07 21:38:43 +02:00
|
|
|
)
|
2018-04-30 12:14:46 +02:00
|
|
|
|
2018-05-28 18:05:21 +02:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def cursor_click():
|
|
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.none",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="None",
|
2018-05-28 18:05:21 +02:00
|
|
|
icon="ops.generic.cursor",
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-05-28 18:05:21 +02:00
|
|
|
)
|
|
|
|
|
|
2018-04-30 12:14:46 +02:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def ruler():
|
2019-04-19 07:32:24 +02:00
|
|
|
def description(_context, _item, km):
|
2019-01-09 12:27:58 +11:00
|
|
|
if km is not None:
|
2019-02-20 16:38:21 +11:00
|
|
|
kmi_add = km.keymap_items.find_from_operator("view3d.ruler_add")
|
|
|
|
|
kmi_remove = km.keymap_items.find_from_operator("view3d.ruler_remove")
|
2019-01-09 12:27:58 +11:00
|
|
|
else:
|
2019-02-20 16:38:21 +11:00
|
|
|
kmi_add = None
|
|
|
|
|
kmi_remove = None
|
2019-04-09 23:16:11 +10:00
|
|
|
return tip_(
|
2018-09-07 11:48:03 +10:00
|
|
|
"Measure distance and angles.\n"
|
2020-06-26 12:30:03 +10:00
|
|
|
"\u2022 %s anywhere for new measurement.\n"
|
2018-09-07 11:48:03 +10:00
|
|
|
"\u2022 Drag ruler segment to measure an angle.\n"
|
2020-06-26 12:30:03 +10:00
|
|
|
"\u2022 %s to remove the active ruler.\n"
|
2019-02-04 10:32:17 +11:00
|
|
|
"\u2022 Ctrl while dragging to snap.\n"
|
2020-02-17 13:00:01 +01:00
|
|
|
"\u2022 Shift while dragging to measure surface thickness"
|
2020-06-26 12:30:03 +10:00
|
|
|
) % (
|
2019-02-20 16:38:21 +11:00
|
|
|
kmi_to_string_or_none(kmi_add),
|
|
|
|
|
kmi_to_string_or_none(kmi_remove),
|
2018-11-28 23:52:05 +11:00
|
|
|
)
|
|
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.measure",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Measure",
|
2018-11-28 23:52:05 +11:00
|
|
|
description=description,
|
2018-05-07 21:38:43 +02:00
|
|
|
icon="ops.view3d.ruler",
|
2018-07-15 14:24:10 +02:00
|
|
|
widget="VIEW3D_GGT_ruler",
|
2018-12-14 12:17:00 +11:00
|
|
|
keymap="3D View Tool: Measure",
|
2018-05-07 21:38:43 +02:00
|
|
|
)
|
|
|
|
|
|
2018-08-28 21:00:25 +10:00
|
|
|
|
2018-11-27 17:33:52 +11:00
|
|
|
class _defs_annotate:
|
2023-02-14 10:30:49 +01:00
|
|
|
|
2018-11-27 17:33:52 +11:00
|
|
|
def draw_settings_common(context, layout, tool):
|
2020-02-10 11:55:49 +01:00
|
|
|
gpd = context.annotation_data
|
2020-05-06 11:38:32 +02:00
|
|
|
region_type = context.region.type
|
|
|
|
|
|
2018-11-27 17:33:52 +11:00
|
|
|
if gpd is not None:
|
|
|
|
|
if gpd.layers.active_note is not None:
|
|
|
|
|
text = gpd.layers.active_note
|
|
|
|
|
maxw = 25
|
|
|
|
|
if len(text) > maxw:
|
2023-02-14 10:30:49 +01:00
|
|
|
text = text[:maxw - 5] + '..' + text[-3:]
|
2018-10-10 11:10:13 +11:00
|
|
|
else:
|
2018-11-27 17:33:52 +11:00
|
|
|
text = ""
|
|
|
|
|
|
2020-02-10 11:55:49 +01:00
|
|
|
gpl = context.active_annotation_layer
|
2018-11-27 17:33:52 +11:00
|
|
|
if gpl is not None:
|
2024-03-28 12:15:33 +01:00
|
|
|
if context.space_data.type in {'VIEW_3D', 'SEQUENCE_EDITOR', 'IMAGE_EDITOR', 'NODE_EDITOR'}:
|
|
|
|
|
layout.label(text="Annotation:")
|
2023-02-14 10:30:49 +01:00
|
|
|
if region_type == 'TOOL_HEADER':
|
2020-05-06 11:38:32 +02:00
|
|
|
sub = layout.split(align=True, factor=0.5)
|
|
|
|
|
sub.ui_units_x = 6.5
|
|
|
|
|
sub.prop(gpl, "color", text="")
|
|
|
|
|
else:
|
|
|
|
|
sub = layout.row(align=True)
|
|
|
|
|
sub.prop(gpl, "color", text="")
|
|
|
|
|
sub.popover(
|
|
|
|
|
panel="TOPBAR_PT_annotation_layers",
|
|
|
|
|
text=text,
|
|
|
|
|
)
|
2024-03-28 12:15:33 +01:00
|
|
|
elif context.space_data.type == 'PROPERTIES':
|
|
|
|
|
row = layout.row(align=True)
|
|
|
|
|
row.prop(gpl, "color", text="Annotation")
|
|
|
|
|
row.popover(
|
|
|
|
|
panel="TOPBAR_PT_annotation_layers",
|
|
|
|
|
text=text,
|
|
|
|
|
)
|
2020-05-06 11:38:32 +02:00
|
|
|
else:
|
2024-03-28 12:15:33 +01:00
|
|
|
layout.label(text="Annotation:")
|
2020-05-06 11:38:32 +02:00
|
|
|
layout.prop(gpl, "color", text="")
|
2018-07-31 10:22:19 +02:00
|
|
|
|
2018-11-27 17:33:52 +11:00
|
|
|
space_type = tool.space_type
|
2020-05-06 11:38:32 +02:00
|
|
|
tool_settings = context.tool_settings
|
|
|
|
|
|
2023-02-14 10:30:49 +01:00
|
|
|
if space_type == 'VIEW_3D':
|
2018-11-27 17:33:52 +11:00
|
|
|
row = layout.row(align=True)
|
2023-02-14 10:30:49 +01:00
|
|
|
row.prop(tool_settings, "annotation_stroke_placement_view3d", text="Placement")
|
|
|
|
|
if tool_settings.gpencil_stroke_placement_view3d == 'CURSOR':
|
2018-11-27 17:33:52 +11:00
|
|
|
row.prop(tool_settings.gpencil_sculpt, "lockaxis")
|
2023-02-14 10:30:49 +01:00
|
|
|
elif tool_settings.gpencil_stroke_placement_view3d in {'SURFACE', 'STROKE'}:
|
2018-11-27 17:33:52 +11:00
|
|
|
row.prop(tool_settings, "use_gpencil_stroke_endpoints")
|
2021-07-26 18:52:48 -04:00
|
|
|
|
2023-02-14 10:30:49 +01:00
|
|
|
elif space_type in {'IMAGE_EDITOR', 'NODE_EDITOR', 'SEQUENCE_EDITOR', 'CLIP_EDITOR'}:
|
2021-07-26 18:52:48 -04:00
|
|
|
row = layout.row(align=True)
|
2023-02-14 10:30:49 +01:00
|
|
|
row.prop(tool_settings, "annotation_stroke_placement_view2d", text="Placement")
|
2018-07-31 10:22:19 +02:00
|
|
|
|
2020-05-06 11:38:32 +02:00
|
|
|
if tool.idname == "builtin.annotate_line":
|
|
|
|
|
props = tool.operator_properties("gpencil.annotate")
|
2023-02-14 10:30:49 +01:00
|
|
|
if region_type == 'TOOL_HEADER':
|
2020-05-06 11:38:32 +02:00
|
|
|
row = layout.row()
|
|
|
|
|
row.ui_units_x = 15
|
|
|
|
|
row.prop(props, "arrowstyle_start", text="Start")
|
|
|
|
|
row.separator()
|
|
|
|
|
row.prop(props, "arrowstyle_end", text="End")
|
|
|
|
|
else:
|
|
|
|
|
col = layout.row().column(align=True)
|
|
|
|
|
col.prop(props, "arrowstyle_start", text="Style Start")
|
|
|
|
|
col.prop(props, "arrowstyle_end", text="End")
|
2021-05-27 19:44:53 +02:00
|
|
|
elif tool.idname == "builtin.annotate":
|
2020-05-08 20:18:12 +02:00
|
|
|
props = tool.operator_properties("gpencil.annotate")
|
2023-02-14 10:30:49 +01:00
|
|
|
if region_type == 'TOOL_HEADER':
|
2021-05-27 19:44:53 +02:00
|
|
|
row = layout.row()
|
|
|
|
|
row.prop(props, "use_stabilizer", text="Stabilize Stroke")
|
|
|
|
|
subrow = layout.row(align=False)
|
|
|
|
|
subrow.active = props.use_stabilizer
|
|
|
|
|
subrow.prop(props, "stabilizer_radius", text="Radius", slider=True)
|
|
|
|
|
subrow.prop(props, "stabilizer_factor", text="Factor", slider=True)
|
|
|
|
|
else:
|
|
|
|
|
layout.prop(props, "use_stabilizer", text="Stabilize Stroke")
|
|
|
|
|
col = layout.column(align=False)
|
|
|
|
|
col.active = props.use_stabilizer
|
|
|
|
|
col.prop(props, "stabilizer_radius", text="Radius", slider=True)
|
|
|
|
|
col.prop(props, "stabilizer_factor", text="Factor", slider=True)
|
2020-05-06 11:38:32 +02:00
|
|
|
|
2018-11-27 17:33:52 +11:00
|
|
|
@ToolDef.from_fn.with_args(draw_settings=draw_settings_common)
|
|
|
|
|
def scribble(*, draw_settings):
|
|
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.annotate",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Annotate",
|
2018-11-27 17:33:52 +11:00
|
|
|
icon="ops.gpencil.draw",
|
2023-02-14 10:30:49 +01:00
|
|
|
cursor='PAINT_BRUSH',
|
2018-11-27 17:33:52 +11:00
|
|
|
keymap="Generic Tool: Annotate",
|
|
|
|
|
draw_settings=draw_settings,
|
2023-02-14 10:30:49 +01:00
|
|
|
options={'KEYMAP_FALLBACK'},
|
2018-11-27 17:33:52 +11:00
|
|
|
)
|
2018-11-05 06:57:01 +11:00
|
|
|
|
2018-11-27 17:33:52 +11:00
|
|
|
@ToolDef.from_fn.with_args(draw_settings=draw_settings_common)
|
|
|
|
|
def line(*, draw_settings):
|
|
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.annotate_line",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Annotate Line",
|
2018-11-27 17:33:52 +11:00
|
|
|
icon="ops.gpencil.draw.line",
|
2023-02-14 10:30:49 +01:00
|
|
|
cursor='PAINT_BRUSH',
|
2018-11-27 17:33:52 +11:00
|
|
|
keymap="Generic Tool: Annotate Line",
|
|
|
|
|
draw_settings=draw_settings,
|
2023-02-14 10:30:49 +01:00
|
|
|
options={'KEYMAP_FALLBACK'},
|
2018-11-27 17:33:52 +11:00
|
|
|
)
|
2018-07-31 10:22:19 +02:00
|
|
|
|
2018-11-27 17:33:52 +11:00
|
|
|
@ToolDef.from_fn.with_args(draw_settings=draw_settings_common)
|
|
|
|
|
def poly(*, draw_settings):
|
|
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.annotate_polygon",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Annotate Polygon",
|
2018-11-27 17:33:52 +11:00
|
|
|
icon="ops.gpencil.draw.poly",
|
2023-02-14 10:30:49 +01:00
|
|
|
cursor='PAINT_BRUSH',
|
2018-11-27 17:33:52 +11:00
|
|
|
keymap="Generic Tool: Annotate Polygon",
|
|
|
|
|
draw_settings=draw_settings,
|
2023-02-14 10:30:49 +01:00
|
|
|
options={'KEYMAP_FALLBACK'},
|
2018-11-27 17:33:52 +11:00
|
|
|
)
|
2018-08-28 21:00:25 +10:00
|
|
|
|
2018-11-27 17:33:52 +11:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def eraser():
|
2019-04-19 07:32:24 +02:00
|
|
|
def draw_settings(context, layout, _tool):
|
2018-11-27 17:33:52 +11:00
|
|
|
# TODO: Move this setting to tool_settings
|
2018-12-21 12:47:44 +11:00
|
|
|
prefs = context.preferences
|
|
|
|
|
layout.prop(prefs.edit, "grease_pencil_eraser_radius", text="Radius")
|
2018-11-27 17:33:52 +11:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.annotate_eraser",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Annotate Eraser",
|
2018-11-27 17:33:52 +11:00
|
|
|
icon="ops.gpencil.draw.eraser",
|
2023-02-14 10:30:49 +01:00
|
|
|
cursor='ERASER',
|
2018-11-27 17:33:52 +11:00
|
|
|
keymap="Generic Tool: Annotate Eraser",
|
|
|
|
|
draw_settings=draw_settings,
|
2023-02-14 10:30:49 +01:00
|
|
|
options={'KEYMAP_FALLBACK'},
|
2018-11-27 17:33:52 +11:00
|
|
|
)
|
2018-07-31 10:22:19 +02:00
|
|
|
|
|
|
|
|
|
2018-04-27 13:23:29 +02:00
|
|
|
class _defs_transform:
|
2023-02-14 10:30:49 +01:00
|
|
|
|
2022-06-03 19:21:04 -07:00
|
|
|
def draw_transform_sculpt_tool_settings(context, layout):
|
2023-02-14 10:30:49 +01:00
|
|
|
if context.mode != 'SCULPT':
|
2022-06-03 19:21:04 -07:00
|
|
|
return
|
|
|
|
|
layout.prop(context.tool_settings.sculpt, "transform_mode")
|
|
|
|
|
|
2018-04-30 12:14:46 +02:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def translate():
|
2019-04-19 07:32:24 +02:00
|
|
|
def draw_settings(context, layout, _tool):
|
2022-06-03 19:21:04 -07:00
|
|
|
_defs_transform.draw_transform_sculpt_tool_settings(context, layout)
|
2023-02-14 10:30:49 +01:00
|
|
|
_template_widget.VIEW3D_GGT_xform_gizmo.draw_settings_with_index(context, layout, 1)
|
2018-04-30 12:14:46 +02:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.move",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Move",
|
2018-06-28 10:34:41 +02:00
|
|
|
# cursor='SCROLL_XY',
|
2018-05-07 21:38:43 +02:00
|
|
|
icon="ops.transform.translate",
|
2019-04-13 20:36:53 +02:00
|
|
|
widget="VIEW3D_GGT_xform_gizmo",
|
2018-07-03 18:33:52 +02:00
|
|
|
operator="transform.translate",
|
2018-12-14 12:17:00 +11:00
|
|
|
keymap="3D View Tool: Move",
|
2018-12-19 20:51:04 +11:00
|
|
|
draw_settings=draw_settings,
|
2018-05-07 21:38:43 +02:00
|
|
|
)
|
2018-04-30 12:14:46 +02:00
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def rotate():
|
2019-04-19 07:32:24 +02:00
|
|
|
def draw_settings(context, layout, _tool):
|
2022-06-03 19:21:04 -07:00
|
|
|
_defs_transform.draw_transform_sculpt_tool_settings(context, layout)
|
2023-02-14 10:30:49 +01:00
|
|
|
_template_widget.VIEW3D_GGT_xform_gizmo.draw_settings_with_index(context, layout, 2)
|
2018-04-30 12:14:46 +02:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.rotate",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Rotate",
|
2018-06-28 10:34:41 +02:00
|
|
|
# cursor='SCROLL_XY',
|
2018-04-30 12:14:46 +02:00
|
|
|
icon="ops.transform.rotate",
|
2019-04-13 20:36:53 +02:00
|
|
|
widget="VIEW3D_GGT_xform_gizmo",
|
2018-07-03 18:33:52 +02:00
|
|
|
operator="transform.rotate",
|
2018-12-14 12:17:00 +11:00
|
|
|
keymap="3D View Tool: Rotate",
|
2018-12-19 20:51:04 +11:00
|
|
|
draw_settings=draw_settings,
|
2018-04-30 12:14:46 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def scale():
|
2019-04-19 07:32:24 +02:00
|
|
|
def draw_settings(context, layout, _tool):
|
2022-06-03 19:21:04 -07:00
|
|
|
_defs_transform.draw_transform_sculpt_tool_settings(context, layout)
|
2023-02-14 10:30:49 +01:00
|
|
|
_template_widget.VIEW3D_GGT_xform_gizmo.draw_settings_with_index(context, layout, 3)
|
2018-04-30 12:14:46 +02:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.scale",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Scale",
|
2018-06-28 10:34:41 +02:00
|
|
|
# cursor='SCROLL_XY',
|
2018-04-30 12:14:46 +02:00
|
|
|
icon="ops.transform.resize",
|
2019-04-13 20:36:53 +02:00
|
|
|
widget="VIEW3D_GGT_xform_gizmo",
|
2018-07-03 18:33:52 +02:00
|
|
|
operator="transform.resize",
|
2018-12-14 12:17:00 +11:00
|
|
|
keymap="3D View Tool: Scale",
|
2018-12-19 20:51:04 +11:00
|
|
|
draw_settings=draw_settings,
|
2018-04-30 12:14:46 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def scale_cage():
|
2019-04-19 07:32:24 +02:00
|
|
|
def draw_settings(context, layout, _tool):
|
2023-02-14 10:30:49 +01:00
|
|
|
_template_widget.VIEW3D_GGT_xform_gizmo.draw_settings_with_index(context, layout, 3)
|
2018-04-30 12:14:46 +02:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.scale_cage",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Scale Cage",
|
2018-04-30 12:14:46 +02:00
|
|
|
icon="ops.transform.resize.cage",
|
2018-07-15 14:24:10 +02:00
|
|
|
widget="VIEW3D_GGT_xform_cage",
|
2018-07-03 18:33:52 +02:00
|
|
|
operator="transform.resize",
|
2019-02-21 16:42:59 +11:00
|
|
|
keymap="3D View Tool: Scale",
|
2018-12-19 20:51:04 +11:00
|
|
|
draw_settings=draw_settings,
|
2018-04-30 12:14:46 +02:00
|
|
|
)
|
|
|
|
|
|
2020-01-29 10:25:09 +11:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def shear():
|
|
|
|
|
def draw_settings(context, layout, _tool):
|
|
|
|
|
# props = tool.operator_properties("transform.shear")
|
2023-02-14 10:30:49 +01:00
|
|
|
_template_widget.VIEW3D_GGT_xform_gizmo.draw_settings_with_index(context, layout, 2)
|
2020-01-29 10:25:09 +11:00
|
|
|
return dict(
|
|
|
|
|
idname="builtin.shear",
|
|
|
|
|
label="Shear",
|
|
|
|
|
icon="ops.transform.shear",
|
|
|
|
|
widget="VIEW3D_GGT_xform_shear",
|
|
|
|
|
keymap="3D View Tool: Shear",
|
|
|
|
|
draw_settings=draw_settings,
|
|
|
|
|
)
|
|
|
|
|
|
2023-10-21 15:12:47 +02:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def bend():
|
|
|
|
|
return dict(
|
|
|
|
|
idname="builtin.bend",
|
|
|
|
|
label="Bend",
|
|
|
|
|
icon="ops.gpencil.edit_bend",
|
|
|
|
|
widget=None,
|
|
|
|
|
keymap="3D View Tool: Bend",
|
|
|
|
|
)
|
|
|
|
|
|
2019-05-24 01:35:48 +10:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def transform():
|
|
|
|
|
def draw_settings(context, layout, tool):
|
2019-07-01 13:11:55 +10:00
|
|
|
if layout.use_property_split:
|
2019-05-24 01:35:48 +10:00
|
|
|
layout.label(text="Gizmos:")
|
|
|
|
|
|
2019-12-07 03:45:50 +11:00
|
|
|
show_drag = True
|
2020-01-03 14:04:11 +11:00
|
|
|
tool_settings = context.tool_settings
|
2023-02-14 10:30:49 +01:00
|
|
|
if tool_settings.workspace_tool_type == 'FALLBACK':
|
2020-01-03 14:04:11 +11:00
|
|
|
show_drag = False
|
2019-12-07 03:45:50 +11:00
|
|
|
|
|
|
|
|
if show_drag:
|
|
|
|
|
props = tool.gizmo_group_properties("VIEW3D_GGT_xform_gizmo")
|
|
|
|
|
layout.prop(props, "drag_action")
|
2019-05-24 01:35:48 +10:00
|
|
|
|
2022-06-03 19:21:04 -07:00
|
|
|
_defs_transform.draw_transform_sculpt_tool_settings(context, layout)
|
2023-02-14 10:30:49 +01:00
|
|
|
_template_widget.VIEW3D_GGT_xform_gizmo.draw_settings_with_index(context, layout, 1)
|
2019-05-24 01:35:48 +10:00
|
|
|
|
|
|
|
|
return dict(
|
|
|
|
|
idname="builtin.transform",
|
|
|
|
|
label="Transform",
|
2023-02-14 10:30:49 +01:00
|
|
|
description=(
|
|
|
|
|
"Supports any combination of grab, rotate, and scale at once"
|
|
|
|
|
),
|
2019-05-24 01:35:48 +10:00
|
|
|
icon="ops.transform.transform",
|
|
|
|
|
widget="VIEW3D_GGT_xform_gizmo",
|
|
|
|
|
keymap="3D View Tool: Transform",
|
|
|
|
|
draw_settings=draw_settings,
|
|
|
|
|
)
|
|
|
|
|
|
2018-04-27 13:23:29 +02:00
|
|
|
|
|
|
|
|
class _defs_view3d_select:
|
2023-02-14 10:30:49 +01:00
|
|
|
|
2018-04-30 12:14:46 +02:00
|
|
|
@ToolDef.from_fn
|
2018-11-22 16:05:28 +01:00
|
|
|
def select():
|
|
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.select",
|
2019-09-04 11:55:36 +02:00
|
|
|
label="Tweak",
|
2018-11-22 16:05:28 +01:00
|
|
|
icon="ops.generic.select",
|
|
|
|
|
widget=None,
|
2019-09-04 11:55:36 +02:00
|
|
|
keymap="3D View Tool: Tweak",
|
2018-11-22 16:05:28 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def box():
|
2019-04-19 07:32:24 +02:00
|
|
|
def draw_settings(_context, layout, tool):
|
2018-10-05 10:27:04 +10:00
|
|
|
props = tool.operator_properties("view3d.select_box")
|
2019-05-06 15:59:34 +02:00
|
|
|
row = layout.row()
|
|
|
|
|
row.use_property_split = False
|
|
|
|
|
row.prop(props, "mode", text="", expand=True, icon_only=True)
|
2018-04-30 12:14:46 +02:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.select_box",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Select Box",
|
2018-10-05 10:27:04 +10:00
|
|
|
icon="ops.generic.select_box",
|
2018-04-30 12:14:46 +02:00
|
|
|
widget=None,
|
2018-12-14 12:17:00 +11:00
|
|
|
keymap="3D View Tool: Select Box",
|
2018-11-13 14:05:20 +11:00
|
|
|
draw_settings=draw_settings,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def lasso():
|
2019-04-19 07:32:24 +02:00
|
|
|
def draw_settings(_context, layout, tool):
|
2018-11-13 14:05:20 +11:00
|
|
|
props = tool.operator_properties("view3d.select_lasso")
|
2019-05-06 15:59:34 +02:00
|
|
|
row = layout.row()
|
|
|
|
|
row.use_property_split = False
|
|
|
|
|
row.prop(props, "mode", text="", expand=True, icon_only=True)
|
2018-11-13 14:05:20 +11:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.select_lasso",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Select Lasso",
|
2018-11-13 14:05:20 +11:00
|
|
|
icon="ops.generic.select_lasso",
|
|
|
|
|
widget=None,
|
2018-12-14 13:21:13 +11:00
|
|
|
keymap="3D View Tool: Select Lasso",
|
2018-08-14 10:28:41 +10:00
|
|
|
draw_settings=draw_settings,
|
2018-04-30 12:14:46 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def circle():
|
2019-04-19 07:32:24 +02:00
|
|
|
def draw_settings(_context, layout, tool):
|
2018-08-29 15:03:50 +10:00
|
|
|
props = tool.operator_properties("view3d.select_circle")
|
2019-05-06 15:59:34 +02:00
|
|
|
row = layout.row()
|
|
|
|
|
row.use_property_split = False
|
|
|
|
|
row.prop(props, "mode", text="", expand=True, icon_only=True)
|
2018-08-29 15:03:50 +10:00
|
|
|
layout.prop(props, "radius")
|
2018-10-25 21:05:29 +11:00
|
|
|
|
2019-04-19 07:32:24 +02:00
|
|
|
def draw_cursor(_context, tool, xy):
|
2018-10-25 21:05:29 +11:00
|
|
|
from gpu_extras.presets import draw_circle_2d
|
|
|
|
|
props = tool.operator_properties("view3d.select_circle")
|
|
|
|
|
radius = props.radius
|
PyAPI: use keyword only arguments
Use keyword only arguments for the following functions.
- addon_utils.module_bl_info 2nd arg `info_basis`.
- addon_utils.modules 1st `module_cache`, 2nd arg `refresh`.
- addon_utils.modules_refresh 1st arg `module_cache`.
- bl_app_template_utils.activate 1nd arg `template_id`.
- bl_app_template_utils.import_from_id 2nd arg `ignore_not_found`.
- bl_app_template_utils.import_from_path 2nd arg `ignore_not_found`.
- bl_keymap_utils.keymap_from_toolbar.generate 2nd & 3rd args `use_fallback_keys` & `use_reset`.
- bl_keymap_utils.platform_helpers.keyconfig_data_oskey_from_ctrl 2nd arg `filter_fn`.
- bl_ui_utils.bug_report_url.url_prefill_from_blender 1st arg `addon_info`.
- bmesh.types.BMFace.copy 1st & 2nd args `verts`, `edges`.
- bmesh.types.BMesh.calc_volume 1st arg `signed`.
- bmesh.types.BMesh.from_mesh 2nd..4th args `face_normals`, `use_shape_key`, `shape_key_index`.
- bmesh.types.BMesh.from_object 3rd & 4th args `cage`, `face_normals`.
- bmesh.types.BMesh.transform 2nd arg `filter`.
- bmesh.types.BMesh.update_edit_mesh 2nd & 3rd args `loop_triangles`, `destructive`.
- bmesh.types.{BMVertSeq,BMEdgeSeq,BMFaceSeq}.sort 1st & 2nd arg `key`, `reverse`.
- bmesh.utils.face_split 4th..6th args `coords`, `use_exist`, `example`.
- bpy.data.libraries.load 2nd..4th args `link`, `relative`, `assets_only`.
- bpy.data.user_map 1st..3rd args `subset`, `key_types, `value_types`.
- bpy.msgbus.subscribe_rna 5th arg `options`.
- bpy.path.abspath 2nd & 3rd args `start` & `library`.
- bpy.path.clean_name 2nd arg `replace`.
- bpy.path.ensure_ext 3rd arg `case_sensitive`.
- bpy.path.module_names 2nd arg `recursive`.
- bpy.path.relpath 2nd arg `start`.
- bpy.types.EditBone.transform 2nd & 3rd arg `scale`, `roll`.
- bpy.types.Operator.as_keywords 1st arg `ignore`.
- bpy.types.Struct.{keyframe_insert,keyframe_delete} 2nd..5th args `index`, `frame`, `group`, `options`.
- bpy.types.WindowManager.popup_menu 2nd & 3rd arg `title`, `icon`.
- bpy.types.WindowManager.popup_menu_pie 3rd & 4th arg `title`, `icon`.
- bpy.utils.app_template_paths 1st arg `subdir`.
- bpy.utils.app_template_paths 1st arg `subdir`.
- bpy.utils.blend_paths 1st..3rd args `absolute`, `packed`, `local`.
- bpy.utils.execfile 2nd arg `mod`.
- bpy.utils.keyconfig_set 2nd arg `report`.
- bpy.utils.load_scripts 1st & 2nd `reload_scripts` & `refresh_scripts`.
- bpy.utils.preset_find 3rd & 4th args `display_name`, `ext`.
- bpy.utils.resource_path 2nd & 3rd arg `major`, `minor`.
- bpy.utils.script_paths 1st..4th args `subdir`, `user_pref`, `check_all`, `use_user`.
- bpy.utils.smpte_from_frame 2nd & 3rd args `fps`, `fps_base`.
- bpy.utils.smpte_from_seconds 2nd & 3rd args `fps`, `fps_base`.
- bpy.utils.system_resource 2nd arg `subdir`.
- bpy.utils.time_from_frame 2nd & 3rd args `fps`, `fps_base`.
- bpy.utils.time_to_frame 2nd & 3rd args `fps`, `fps_base`.
- bpy.utils.units.to_string 4th..6th `precision`, `split_unit`, `compatible_unit`.
- bpy.utils.units.to_value 4th arg `str_ref_unit`.
- bpy.utils.user_resource 2nd & 3rd args `subdir`, `create`
- bpy_extras.view3d_utils.location_3d_to_region_2d 4th arg `default`.
- bpy_extras.view3d_utils.region_2d_to_origin_3d 4th arg `clamp`.
- gpu.offscreen.unbind 1st arg `restore`.
- gpu_extras.batch.batch_for_shader 4th arg `indices`.
- gpu_extras.batch.presets.draw_circle_2d 4th arg `segments`.
- gpu_extras.presets.draw_circle_2d 4th arg `segments`.
- imbuf.types.ImBuf.resize 2nd arg `resize`.
- imbuf.write 2nd arg `filepath`.
- mathutils.kdtree.KDTree.find 2nd arg `filter`.
- nodeitems_utils.NodeCategory 3rd & 4th arg `descriptions`, `items`.
- nodeitems_utils.NodeItem 2nd..4th args `label`, `settings`, `poll`.
- nodeitems_utils.NodeItemCustom 1st & 2nd arg `poll`, `draw`.
- rna_prop_ui.draw 5th arg `use_edit`.
- rna_prop_ui.rna_idprop_ui_get 2nd arg `create`.
- rna_prop_ui.rna_idprop_ui_prop_clear 3rd arg `remove`.
- rna_prop_ui.rna_idprop_ui_prop_get 3rd arg `create`.
- rna_xml.xml2rna 2nd arg `root_rna`.
- rna_xml.xml_file_write 4th arg `skip_typemap`.
2021-06-08 18:03:14 +10:00
|
|
|
draw_circle_2d(xy, (1.0,) * 4, radius, segments=32)
|
2018-10-25 21:05:29 +11:00
|
|
|
|
2018-04-30 12:14:46 +02:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.select_circle",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Select Circle",
|
2018-04-30 12:14:46 +02:00
|
|
|
icon="ops.generic.select_circle",
|
|
|
|
|
widget=None,
|
2018-12-14 12:17:00 +11:00
|
|
|
keymap="3D View Tool: Select Circle",
|
2018-08-29 15:03:50 +10:00
|
|
|
draw_settings=draw_settings,
|
2018-10-25 21:05:29 +11:00
|
|
|
draw_cursor=draw_cursor,
|
2018-04-30 12:14:46 +02:00
|
|
|
)
|
|
|
|
|
|
2018-11-13 14:05:20 +11:00
|
|
|
|
2020-05-28 14:34:17 +10:00
|
|
|
class _defs_view3d_add:
|
2023-02-14 10:30:49 +01:00
|
|
|
|
2021-01-16 11:29:59 +11:00
|
|
|
@staticmethod
|
|
|
|
|
def description_interactive_add(context, _item, _km, *, prefix):
|
|
|
|
|
km = context.window_manager.keyconfigs.user.keymaps["View3D Placement Modal"]
|
|
|
|
|
|
|
|
|
|
def keymap_item_from_propvalue(propvalue):
|
|
|
|
|
for item in km.keymap_items:
|
|
|
|
|
if item.propvalue == propvalue:
|
|
|
|
|
return item
|
2023-04-13 13:14:06 +10:00
|
|
|
return None
|
2021-01-16 11:29:59 +11:00
|
|
|
|
|
|
|
|
if km is not None:
|
2023-02-14 10:30:49 +01:00
|
|
|
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')
|
2021-01-16 11:29:59 +11:00
|
|
|
else:
|
|
|
|
|
kmi_snap = None
|
|
|
|
|
kmi_center = None
|
|
|
|
|
kmi_fixed_aspect = None
|
|
|
|
|
return tip_(
|
|
|
|
|
"%s\n"
|
|
|
|
|
"\u2022 %s toggles snap while dragging.\n"
|
|
|
|
|
"\u2022 %s toggles dragging from the center.\n"
|
|
|
|
|
"\u2022 %s toggles fixed aspect"
|
|
|
|
|
) % (
|
|
|
|
|
prefix,
|
|
|
|
|
kmi_to_string_or_none(kmi_snap),
|
|
|
|
|
kmi_to_string_or_none(kmi_center),
|
|
|
|
|
kmi_to_string_or_none(kmi_fixed_aspect),
|
|
|
|
|
)
|
|
|
|
|
|
2020-05-28 14:34:17 +10:00
|
|
|
# Layout tweaks here would be good to avoid,
|
|
|
|
|
# this shows limits in layout engine, as buttons are using a lot of space.
|
|
|
|
|
@staticmethod
|
2023-05-16 15:00:45 +02:00
|
|
|
def draw_settings_interactive_add(layout, tool_settings, tool, extra):
|
2021-01-17 21:33:37 +11:00
|
|
|
show_extra = False
|
2021-01-16 11:29:57 +11:00
|
|
|
if not extra:
|
|
|
|
|
row = layout.row()
|
|
|
|
|
row.label(text="Depth:")
|
|
|
|
|
row = layout.row()
|
2023-05-16 15:00:45 +02:00
|
|
|
row.prop(tool_settings, "plane_depth", text="")
|
2021-01-16 11:29:57 +11:00
|
|
|
row = layout.row()
|
|
|
|
|
row.label(text="Orientation:")
|
|
|
|
|
row = layout.row()
|
2023-05-16 15:00:45 +02:00
|
|
|
row.prop(tool_settings, "plane_orientation", text="")
|
2023-06-27 20:29:05 +02:00
|
|
|
row = layout.row()
|
|
|
|
|
row.prop(tool_settings, "snap_elements_tool")
|
2021-01-16 11:29:57 +11:00
|
|
|
|
2023-02-14 10:30:49 +01:00
|
|
|
region_is_header = bpy.context.region.type == 'TOOL_HEADER'
|
2021-01-16 11:29:57 +11:00
|
|
|
if region_is_header:
|
2021-01-17 21:33:37 +11:00
|
|
|
# Don't draw the "extra" popover here as we might have other settings & this should be last.
|
|
|
|
|
show_extra = True
|
2021-01-16 11:29:57 +11:00
|
|
|
else:
|
|
|
|
|
extra = True
|
|
|
|
|
|
|
|
|
|
if extra:
|
2023-05-16 15:00:45 +02:00
|
|
|
props = tool.operator_properties("view3d.interactive_add")
|
2021-01-16 11:29:57 +11:00
|
|
|
layout.use_property_split = True
|
2023-05-16 15:00:45 +02:00
|
|
|
layout.row().prop(tool_settings, "plane_axis", expand=True)
|
|
|
|
|
layout.row().prop(tool_settings, "plane_axis_auto")
|
2021-01-17 21:16:22 +11:00
|
|
|
|
|
|
|
|
layout.label(text="Base")
|
|
|
|
|
layout.row().prop(props, "plane_origin_base", expand=True)
|
|
|
|
|
layout.row().prop(props, "plane_aspect_base", expand=True)
|
|
|
|
|
layout.label(text="Height")
|
|
|
|
|
layout.row().prop(props, "plane_origin_depth", expand=True)
|
|
|
|
|
layout.row().prop(props, "plane_aspect_depth", expand=True)
|
2021-01-17 21:33:37 +11:00
|
|
|
return show_extra
|
2020-05-28 14:34:17 +10:00
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def cube_add():
|
2023-05-16 15:00:45 +02:00
|
|
|
def draw_settings(context, layout, tool, *, extra=False):
|
|
|
|
|
show_extra = _defs_view3d_add.draw_settings_interactive_add(layout, context.tool_settings, tool, extra)
|
2021-01-17 21:33:37 +11:00
|
|
|
if show_extra:
|
|
|
|
|
layout.popover("TOPBAR_PT_tool_settings_extra", text="...")
|
|
|
|
|
|
2020-05-28 14:34:17 +10:00
|
|
|
return dict(
|
|
|
|
|
idname="builtin.primitive_cube_add",
|
|
|
|
|
label="Add Cube",
|
|
|
|
|
icon="ops.mesh.primitive_cube_add_gizmo",
|
2021-01-16 11:29:59 +11:00
|
|
|
description=lambda *args: _defs_view3d_add.description_interactive_add(
|
2023-02-14 10:30:49 +01:00
|
|
|
*args, prefix=tip_("Add cube to mesh interactively"),
|
2020-05-28 14:34:17 +10:00
|
|
|
),
|
|
|
|
|
widget="VIEW3D_GGT_placement",
|
|
|
|
|
keymap="3D View Tool: Object, Add Primitive",
|
|
|
|
|
draw_settings=draw_settings,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def cone_add():
|
2023-05-16 15:00:45 +02:00
|
|
|
def draw_settings(context, layout, tool, *, extra=False):
|
|
|
|
|
show_extra = _defs_view3d_add.draw_settings_interactive_add(layout, context.tool_settings, tool, extra)
|
2021-01-16 11:29:57 +11:00
|
|
|
if extra:
|
|
|
|
|
return
|
2020-05-28 14:34:17 +10:00
|
|
|
|
|
|
|
|
props = tool.operator_properties("mesh.primitive_cone_add")
|
|
|
|
|
layout.prop(props, "vertices")
|
|
|
|
|
layout.prop(props, "end_fill_type")
|
2021-01-17 21:33:37 +11:00
|
|
|
|
|
|
|
|
if show_extra:
|
|
|
|
|
layout.popover("TOPBAR_PT_tool_settings_extra", text="...")
|
|
|
|
|
|
2020-05-28 14:34:17 +10:00
|
|
|
return dict(
|
|
|
|
|
idname="builtin.primitive_cone_add",
|
|
|
|
|
label="Add Cone",
|
2020-06-26 09:53:27 -04:00
|
|
|
icon="ops.mesh.primitive_cone_add_gizmo",
|
2021-01-16 11:29:59 +11:00
|
|
|
description=lambda *args: _defs_view3d_add.description_interactive_add(
|
2023-02-14 10:30:49 +01:00
|
|
|
*args, prefix=tip_("Add cone to mesh interactively"),
|
2020-05-28 14:34:17 +10:00
|
|
|
),
|
|
|
|
|
widget="VIEW3D_GGT_placement",
|
|
|
|
|
keymap="3D View Tool: Object, Add Primitive",
|
|
|
|
|
draw_settings=draw_settings,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def cylinder_add():
|
2023-05-16 15:00:45 +02:00
|
|
|
def draw_settings(context, layout, tool, *, extra=False):
|
|
|
|
|
show_extra = _defs_view3d_add.draw_settings_interactive_add(layout, context.tool_settings, tool, extra)
|
2021-01-16 11:29:57 +11:00
|
|
|
if extra:
|
|
|
|
|
return
|
2020-05-28 14:34:17 +10:00
|
|
|
|
|
|
|
|
props = tool.operator_properties("mesh.primitive_cylinder_add")
|
|
|
|
|
layout.prop(props, "vertices")
|
|
|
|
|
layout.prop(props, "end_fill_type")
|
2021-01-17 21:33:37 +11:00
|
|
|
|
|
|
|
|
if show_extra:
|
|
|
|
|
layout.popover("TOPBAR_PT_tool_settings_extra", text="...")
|
2020-05-28 14:34:17 +10:00
|
|
|
return dict(
|
|
|
|
|
idname="builtin.primitive_cylinder_add",
|
|
|
|
|
label="Add Cylinder",
|
|
|
|
|
icon="ops.mesh.primitive_cylinder_add_gizmo",
|
2021-01-16 11:29:59 +11:00
|
|
|
description=lambda *args: _defs_view3d_add.description_interactive_add(
|
2023-02-14 10:30:49 +01:00
|
|
|
*args, prefix=tip_("Add cylinder to mesh interactively"),
|
2020-05-28 14:34:17 +10:00
|
|
|
),
|
|
|
|
|
widget="VIEW3D_GGT_placement",
|
|
|
|
|
keymap="3D View Tool: Object, Add Primitive",
|
|
|
|
|
draw_settings=draw_settings,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def uv_sphere_add():
|
2023-05-16 15:00:45 +02:00
|
|
|
def draw_settings(context, layout, tool, *, extra=False):
|
|
|
|
|
show_extra = _defs_view3d_add.draw_settings_interactive_add(layout, context.tool_settings, tool, extra)
|
2021-01-16 11:29:57 +11:00
|
|
|
if extra:
|
|
|
|
|
return
|
2020-05-28 14:34:17 +10:00
|
|
|
|
|
|
|
|
props = tool.operator_properties("mesh.primitive_uv_sphere_add")
|
|
|
|
|
layout.prop(props, "segments")
|
|
|
|
|
layout.prop(props, "ring_count")
|
2021-01-17 21:33:37 +11:00
|
|
|
|
|
|
|
|
if show_extra:
|
|
|
|
|
layout.popover("TOPBAR_PT_tool_settings_extra", text="...")
|
2020-05-28 14:34:17 +10:00
|
|
|
return dict(
|
|
|
|
|
idname="builtin.primitive_uv_sphere_add",
|
|
|
|
|
label="Add UV Sphere",
|
|
|
|
|
icon="ops.mesh.primitive_sphere_add_gizmo",
|
2021-01-16 11:29:59 +11:00
|
|
|
description=lambda *args: _defs_view3d_add.description_interactive_add(
|
2023-02-14 10:30:49 +01:00
|
|
|
*args, prefix=tip_("Add sphere to mesh interactively"),
|
2020-05-28 14:34:17 +10:00
|
|
|
),
|
|
|
|
|
widget="VIEW3D_GGT_placement",
|
|
|
|
|
keymap="3D View Tool: Object, Add Primitive",
|
|
|
|
|
draw_settings=draw_settings,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def ico_sphere_add():
|
2023-05-16 15:00:45 +02:00
|
|
|
def draw_settings(context, layout, tool, *, extra=False):
|
|
|
|
|
show_extra = _defs_view3d_add.draw_settings_interactive_add(layout, context.tool_settings, tool, extra)
|
2021-01-16 11:29:57 +11:00
|
|
|
if extra:
|
|
|
|
|
return
|
2020-05-28 14:34:17 +10:00
|
|
|
|
|
|
|
|
props = tool.operator_properties("mesh.primitive_ico_sphere_add")
|
|
|
|
|
layout.prop(props, "subdivisions")
|
2021-01-17 21:33:37 +11:00
|
|
|
|
|
|
|
|
if show_extra:
|
|
|
|
|
layout.popover("TOPBAR_PT_tool_settings_extra", text="...")
|
2020-05-28 14:34:17 +10:00
|
|
|
return dict(
|
|
|
|
|
idname="builtin.primitive_ico_sphere_add",
|
|
|
|
|
label="Add Ico Sphere",
|
|
|
|
|
icon="ops.mesh.primitive_sphere_add_gizmo",
|
2021-01-16 11:29:59 +11:00
|
|
|
description=lambda *args: _defs_view3d_add.description_interactive_add(
|
2023-02-14 10:30:49 +01:00
|
|
|
*args, prefix=tip_("Add sphere to mesh interactively"),
|
2020-05-28 14:34:17 +10:00
|
|
|
),
|
|
|
|
|
widget="VIEW3D_GGT_placement",
|
|
|
|
|
keymap="3D View Tool: Object, Add Primitive",
|
|
|
|
|
draw_settings=draw_settings,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
2018-04-27 13:23:29 +02:00
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
|
# Object Modes (named based on context.mode)
|
|
|
|
|
|
2023-02-09 15:53:42 +01:00
|
|
|
class _defs_edit_armature:
|
2023-02-14 10:30:49 +01:00
|
|
|
|
2018-04-30 12:14:46 +02:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def roll():
|
|
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.roll",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Roll",
|
2018-04-30 12:14:46 +02:00
|
|
|
icon="ops.armature.bone.roll",
|
2019-12-12 18:38:41 +11:00
|
|
|
widget="VIEW3D_GGT_tool_generic_handle_free",
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-04-30 12:14:46 +02:00
|
|
|
)
|
|
|
|
|
|
2018-05-15 10:24:26 +02:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def bone_envelope():
|
|
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.bone_envelope",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Bone Envelope",
|
2018-05-15 13:49:44 +02:00
|
|
|
icon="ops.transform.bone_envelope",
|
2019-12-12 18:38:41 +11:00
|
|
|
widget="VIEW3D_GGT_tool_generic_handle_free",
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-05-15 10:24:26 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def bone_size():
|
|
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.bone_size",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Bone Size",
|
2018-05-15 13:49:44 +02:00
|
|
|
icon="ops.transform.bone_size",
|
2019-12-12 18:38:41 +11:00
|
|
|
widget="VIEW3D_GGT_tool_generic_handle_free",
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-05-15 10:24:26 +02:00
|
|
|
)
|
|
|
|
|
|
2018-04-30 12:14:46 +02:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def extrude():
|
|
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.extrude",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Extrude",
|
2018-04-30 12:14:46 +02:00
|
|
|
icon="ops.armature.extrude_move",
|
2018-11-21 09:25:55 +11:00
|
|
|
widget="VIEW3D_GGT_xform_extrude",
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-11-21 09:25:55 +11:00
|
|
|
draw_settings=_template_widget.VIEW3D_GGT_xform_extrude.draw_settings,
|
2018-04-30 12:14:46 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def extrude_cursor():
|
|
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.extrude_to_cursor",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Extrude to Cursor",
|
2023-02-14 10:30:49 +01:00
|
|
|
cursor='CROSSHAIR',
|
2018-04-30 12:14:46 +02:00
|
|
|
icon="ops.armature.extrude_cursor",
|
|
|
|
|
widget=None,
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-04-27 13:23:29 +02:00
|
|
|
)
|
2018-05-07 21:38:43 +02:00
|
|
|
|
|
|
|
|
|
2018-04-27 13:23:29 +02:00
|
|
|
class _defs_edit_mesh:
|
2023-02-14 10:30:49 +01:00
|
|
|
|
2018-04-30 12:14:46 +02:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def rip_region():
|
2019-04-19 07:32:24 +02:00
|
|
|
def draw_settings(_context, layout, tool):
|
2018-05-22 14:00:44 +02:00
|
|
|
props = tool.operator_properties("mesh.rip_move")
|
2018-05-11 20:22:04 +02:00
|
|
|
props_macro = props.MESH_OT_rip
|
|
|
|
|
layout.prop(props_macro, "use_fill")
|
|
|
|
|
|
2018-04-30 12:14:46 +02:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.rip_region",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Rip Region",
|
2018-04-30 12:14:46 +02:00
|
|
|
icon="ops.mesh.rip",
|
2019-12-07 03:45:50 +11:00
|
|
|
widget="VIEW3D_GGT_tool_generic_handle_free",
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-05-11 20:22:04 +02:00
|
|
|
draw_settings=draw_settings,
|
2018-04-30 12:14:46 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def rip_edge():
|
|
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.rip_edge",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Rip Edge",
|
2018-04-30 12:14:46 +02:00
|
|
|
icon="ops.mesh.rip_edge",
|
2019-12-12 18:38:41 +11:00
|
|
|
widget="VIEW3D_GGT_tool_generic_handle_free",
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-04-30 12:14:46 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def poly_build():
|
2019-09-15 05:26:15 +10:00
|
|
|
def draw_settings(_context, layout, tool):
|
2019-08-27 16:19:25 +02:00
|
|
|
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")
|
2018-04-30 12:14:46 +02:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.poly_build",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Poly Build",
|
2018-04-30 12:14:46 +02:00
|
|
|
icon="ops.mesh.polybuild_hover",
|
2018-09-09 16:11:02 +10:00
|
|
|
widget="VIEW3D_GGT_mesh_preselect_elem",
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2019-08-27 16:19:25 +02:00
|
|
|
draw_settings=draw_settings,
|
2018-04-30 12:14:46 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def edge_slide():
|
2019-04-19 07:32:24 +02:00
|
|
|
def draw_settings(_context, layout, tool):
|
2018-08-22 17:53:03 +10:00
|
|
|
props = tool.operator_properties("transform.edge_slide")
|
|
|
|
|
layout.prop(props, "correct_uv")
|
|
|
|
|
|
2018-04-30 12:14:46 +02:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.edge_slide",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Edge Slide",
|
2018-04-30 12:14:46 +02:00
|
|
|
icon="ops.transform.edge_slide",
|
2019-12-07 03:45:50 +11:00
|
|
|
widget="VIEW3D_GGT_tool_generic_handle_normal",
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-08-22 17:53:03 +10:00
|
|
|
draw_settings=draw_settings,
|
2018-04-30 12:14:46 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def vert_slide():
|
2019-04-19 07:32:24 +02:00
|
|
|
def draw_settings(_context, layout, tool):
|
2018-08-22 17:53:03 +10:00
|
|
|
props = tool.operator_properties("transform.vert_slide")
|
|
|
|
|
layout.prop(props, "correct_uv")
|
|
|
|
|
|
2018-04-30 12:14:46 +02:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.vertex_slide",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Vertex Slide",
|
2018-04-30 12:14:46 +02:00
|
|
|
icon="ops.transform.vert_slide",
|
2019-12-07 03:45:50 +11:00
|
|
|
widget="VIEW3D_GGT_tool_generic_handle_free",
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-08-22 17:53:03 +10:00
|
|
|
draw_settings=draw_settings,
|
2018-04-30 12:14:46 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def spin():
|
2019-04-19 07:32:24 +02:00
|
|
|
def draw_settings(_context, layout, tool):
|
2018-09-17 14:52:54 +10:00
|
|
|
props = tool.operator_properties("mesh.spin")
|
|
|
|
|
layout.prop(props, "steps")
|
2024-02-09 13:01:55 +01:00
|
|
|
layout.prop(props, "dupli")
|
2018-10-02 17:05:13 +10:00
|
|
|
props = tool.gizmo_group_properties("MESH_GGT_spin")
|
|
|
|
|
layout.prop(props, "axis")
|
2018-09-17 14:52:54 +10:00
|
|
|
|
2018-04-30 12:14:46 +02:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.spin",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Spin",
|
2018-04-30 12:14:46 +02:00
|
|
|
icon="ops.mesh.spin",
|
2018-09-18 13:24:35 +10:00
|
|
|
widget="MESH_GGT_spin",
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-09-17 14:52:54 +10:00
|
|
|
draw_settings=draw_settings,
|
2018-04-30 12:14:46 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def inset():
|
2019-04-19 07:32:24 +02:00
|
|
|
def draw_settings(_context, layout, tool):
|
2018-05-22 14:00:44 +02:00
|
|
|
props = tool.operator_properties("mesh.inset")
|
2018-05-11 20:23:29 +02:00
|
|
|
layout.prop(props, "use_outset")
|
|
|
|
|
layout.prop(props, "use_individual")
|
|
|
|
|
layout.prop(props, "use_even_offset")
|
|
|
|
|
layout.prop(props, "use_relative_offset")
|
|
|
|
|
|
2018-04-30 12:14:46 +02:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.inset_faces",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Inset Faces",
|
2018-04-30 12:14:46 +02:00
|
|
|
icon="ops.mesh.inset",
|
2021-08-26 16:02:35 +10:00
|
|
|
widget="VIEW3D_GGT_tool_generic_handle_free",
|
|
|
|
|
widget_properties=[
|
|
|
|
|
("radius", 75.0),
|
|
|
|
|
("backdrop_fill_alpha", 0.0),
|
|
|
|
|
],
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-05-11 20:23:29 +02:00
|
|
|
draw_settings=draw_settings,
|
2018-04-30 12:14:46 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def bevel():
|
2019-12-12 11:56:20 -05:00
|
|
|
def draw_settings(context, layout, tool, *, extra=False):
|
2018-08-22 17:37:07 +10:00
|
|
|
props = tool.operator_properties("mesh.bevel")
|
2020-06-23 10:16:28 -04:00
|
|
|
|
2023-02-14 10:30:49 +01:00
|
|
|
region_is_header = context.region.type == 'TOOL_HEADER'
|
2019-12-12 11:56:20 -05:00
|
|
|
|
2023-02-14 10:30:49 +01:00
|
|
|
edge_bevel = props.affect == 'EDGES'
|
2020-07-21 16:32:00 -04:00
|
|
|
|
2019-12-16 14:29:03 +11:00
|
|
|
if not extra:
|
2020-06-23 10:16:28 -04:00
|
|
|
if region_is_header:
|
2019-12-12 11:56:20 -05:00
|
|
|
layout.prop(props, "offset_type", text="")
|
|
|
|
|
else:
|
2020-07-21 16:32:00 -04:00
|
|
|
layout.row().prop(props, "affect", expand=True)
|
2020-07-21 16:47:58 -04:00
|
|
|
layout.separator()
|
2019-12-12 11:56:20 -05:00
|
|
|
layout.prop(props, "offset_type")
|
|
|
|
|
|
|
|
|
|
layout.prop(props, "segments")
|
2020-06-22 22:25:55 -04:00
|
|
|
|
2020-07-21 16:47:58 -04:00
|
|
|
if region_is_header:
|
|
|
|
|
layout.prop(props, "affect", text="")
|
|
|
|
|
|
|
|
|
|
layout.prop(props, "profile", text="Shape", slider=True)
|
2019-12-12 11:56:20 -05:00
|
|
|
|
2020-06-23 10:16:28 -04:00
|
|
|
if region_is_header:
|
2019-12-12 11:56:20 -05:00
|
|
|
layout.popover("TOPBAR_PT_tool_settings_extra", text="...")
|
|
|
|
|
else:
|
|
|
|
|
extra = True
|
|
|
|
|
|
2020-06-22 22:25:55 -04:00
|
|
|
if extra:
|
|
|
|
|
layout.use_property_split = True
|
|
|
|
|
layout.use_property_decorate = False
|
|
|
|
|
|
2020-07-21 16:32:00 -04:00
|
|
|
layout.prop(props, "material")
|
2020-06-22 22:25:55 -04:00
|
|
|
|
|
|
|
|
col = layout.column()
|
2020-07-21 16:32:00 -04:00
|
|
|
col.prop(props, "harden_normals")
|
2020-06-22 22:25:55 -04:00
|
|
|
col.prop(props, "clamp_overlap")
|
|
|
|
|
col.prop(props, "loop_slide")
|
|
|
|
|
|
UI: Layout changes for new checkbox layout possibilities
Follow-up to previous commit.
Some examples:
{F8473507} {F8473508} {F8473509} {F8473510}
For more screenshots, please see D7430.
We use column or row headings here to bring more structure, and to give
the eye visual anchors which aid eye-scanning. The left-aligned
checkboxes likewise help with this. And we keep the adherence to the
center line, so the alignment matches up between the various buttons and
controls.
* Changes the property split percentage from 50/50% to 40/60%. This is
needed to give enough space for the checkboxes. But in most cases this
looks better anyway - see Transform panel. In some cases it simply
fills out the available space more efficently.
* Fix various hacks where we previously used manually defined splits.
When we did this, the alignment was never quite right, and the layout
code was a mess.
* Adds column headings to many places where a list of checkboxes all
share a common purpose or leading text.
* Add checkbox + value configurations various places where a checkbox
only serves to enable the value slider
* Removes most uses of grid flow layout. The grid flow layouts combine
poorly with column headings, and also they would mess alignment up
badly. The grid flow layouts also often made buttons and controls jump
around on the screen if you would just resize editors slightly,
causing visual confusion, making users lose their place. The logic for
at what time the list of items would re-flow was often flawed, jumping
to multiple columns too fast or too late - and frankly, the grid flow
layouts would often just look bad.
Maniphest Task: https://developer.blender.org/T65965
Differential Revision: https://developer.blender.org/D7430
Reviewed by: Brecht Van Lommel, Pablo Vazquez.
Most work here by William Reynish, few changes by Julian Eisel.
2020-04-17 16:54:03 +02:00
|
|
|
col = layout.column(heading="Mark")
|
2020-07-21 16:32:00 -04:00
|
|
|
col.active = edge_bevel
|
UI: Layout changes for new checkbox layout possibilities
Follow-up to previous commit.
Some examples:
{F8473507} {F8473508} {F8473509} {F8473510}
For more screenshots, please see D7430.
We use column or row headings here to bring more structure, and to give
the eye visual anchors which aid eye-scanning. The left-aligned
checkboxes likewise help with this. And we keep the adherence to the
center line, so the alignment matches up between the various buttons and
controls.
* Changes the property split percentage from 50/50% to 40/60%. This is
needed to give enough space for the checkboxes. But in most cases this
looks better anyway - see Transform panel. In some cases it simply
fills out the available space more efficently.
* Fix various hacks where we previously used manually defined splits.
When we did this, the alignment was never quite right, and the layout
code was a mess.
* Adds column headings to many places where a list of checkboxes all
share a common purpose or leading text.
* Add checkbox + value configurations various places where a checkbox
only serves to enable the value slider
* Removes most uses of grid flow layout. The grid flow layouts combine
poorly with column headings, and also they would mess alignment up
badly. The grid flow layouts also often made buttons and controls jump
around on the screen if you would just resize editors slightly,
causing visual confusion, making users lose their place. The logic for
at what time the list of items would re-flow was often flawed, jumping
to multiple columns too fast or too late - and frankly, the grid flow
layouts would often just look bad.
Maniphest Task: https://developer.blender.org/T65965
Differential Revision: https://developer.blender.org/D7430
Reviewed by: Brecht Van Lommel, Pablo Vazquez.
Most work here by William Reynish, few changes by Julian Eisel.
2020-04-17 16:54:03 +02:00
|
|
|
col.prop(props, "mark_seam", text="Seam")
|
|
|
|
|
col.prop(props, "mark_sharp", text="Sharp")
|
2019-12-12 11:56:20 -05:00
|
|
|
|
2020-07-21 16:32:00 -04:00
|
|
|
col = layout.column()
|
|
|
|
|
col.active = edge_bevel
|
|
|
|
|
col.prop(props, "miter_outer", text="Miter Outer")
|
|
|
|
|
col.prop(props, "miter_inner", text="Inner")
|
2023-02-14 10:30:49 +01:00
|
|
|
if props.miter_inner == 'ARC':
|
2020-07-21 16:32:00 -04:00
|
|
|
col.prop(props, "spread")
|
2019-12-12 11:56:20 -05:00
|
|
|
|
2020-07-21 16:47:58 -04:00
|
|
|
layout.separator()
|
|
|
|
|
|
|
|
|
|
col = layout.column()
|
|
|
|
|
col.active = edge_bevel
|
|
|
|
|
col.prop(props, "vmesh_method", text="Intersections")
|
|
|
|
|
|
|
|
|
|
layout.prop(props, "face_strength_mode", text="Face Strength")
|
|
|
|
|
|
|
|
|
|
layout.prop(props, "profile_type")
|
|
|
|
|
|
2023-02-14 10:30:49 +01:00
|
|
|
if props.profile_type == 'CUSTOM':
|
2019-12-12 11:56:20 -05:00
|
|
|
tool_settings = context.tool_settings
|
2023-02-14 10:30:49 +01:00
|
|
|
layout.template_curveprofile(tool_settings, "custom_bevel_profile_preset")
|
2018-08-22 17:37:07 +10:00
|
|
|
|
2018-04-30 12:14:46 +02:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.bevel",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Bevel",
|
2018-04-30 12:14:46 +02:00
|
|
|
icon="ops.mesh.bevel",
|
2019-12-07 03:45:50 +11:00
|
|
|
widget="VIEW3D_GGT_tool_generic_handle_normal",
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-08-22 17:37:07 +10:00
|
|
|
draw_settings=draw_settings,
|
2018-04-30 12:14:46 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def extrude():
|
|
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.extrude_region",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Extrude Region",
|
2018-10-02 18:48:28 +10:00
|
|
|
# The operator description isn't useful in this case, give our own.
|
2023-02-14 10:30:49 +01:00
|
|
|
description=(
|
|
|
|
|
"Extrude freely or along an axis"
|
|
|
|
|
),
|
2018-04-30 12:14:46 +02:00
|
|
|
icon="ops.mesh.extrude_region_move",
|
2018-11-21 09:25:55 +11:00
|
|
|
widget="VIEW3D_GGT_xform_extrude",
|
2018-10-02 18:48:28 +10:00
|
|
|
# Important to use same operator as 'E' key.
|
|
|
|
|
operator="view3d.edit_mesh_extrude_move_normal",
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-11-21 09:25:55 +11:00
|
|
|
draw_settings=_template_widget.VIEW3D_GGT_xform_extrude.draw_settings,
|
2018-04-30 12:14:46 +02:00
|
|
|
)
|
|
|
|
|
|
2020-04-15 12:01:43 -03:00
|
|
|
@ToolDef.from_fn
|
2020-06-22 09:20:43 -03:00
|
|
|
def extrude_manifold():
|
2020-04-15 12:01:43 -03:00
|
|
|
return dict(
|
2020-06-22 09:20:43 -03:00
|
|
|
idname="builtin.extrude_manifold",
|
|
|
|
|
label="Extrude Manifold",
|
2020-04-15 12:01:43 -03:00
|
|
|
description=(
|
|
|
|
|
"Extrude, dissolves edges whose faces form a flat surface and intersect new edges"
|
|
|
|
|
),
|
2020-06-24 11:32:06 -03:00
|
|
|
icon="ops.mesh.extrude_manifold",
|
2020-04-15 12:01:43 -03:00
|
|
|
widget="VIEW3D_GGT_tool_generic_handle_normal",
|
|
|
|
|
keymap=(),
|
|
|
|
|
)
|
|
|
|
|
|
2018-08-29 22:59:49 +10:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def extrude_normals():
|
2019-04-19 07:32:24 +02:00
|
|
|
def draw_settings(_context, layout, tool):
|
2018-08-29 22:59:49 +10:00
|
|
|
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(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.extrude_along_normals",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Extrude Along Normals",
|
2018-08-29 22:59:49 +10:00
|
|
|
icon="ops.mesh.extrude_region_shrink_fatten",
|
2019-12-07 03:45:50 +11:00
|
|
|
widget="VIEW3D_GGT_tool_generic_handle_normal",
|
2018-10-02 15:17:00 +10:00
|
|
|
operator="mesh.extrude_region_shrink_fatten",
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-08-29 22:59:49 +10:00
|
|
|
draw_settings=draw_settings,
|
|
|
|
|
)
|
|
|
|
|
|
2018-04-30 12:14:46 +02:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def extrude_individual():
|
|
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.extrude_individual",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Extrude Individual",
|
2018-04-30 12:14:46 +02:00
|
|
|
icon="ops.mesh.extrude_faces_move",
|
2019-12-07 03:45:50 +11:00
|
|
|
widget="VIEW3D_GGT_tool_generic_handle_normal",
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-04-30 12:14:46 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def extrude_cursor():
|
2019-04-19 07:32:24 +02:00
|
|
|
def draw_settings(_context, layout, tool):
|
2018-09-27 12:23:01 +10:00
|
|
|
props = tool.operator_properties("mesh.dupli_extrude_cursor")
|
|
|
|
|
layout.prop(props, "rotate_source")
|
|
|
|
|
|
2018-04-30 12:14:46 +02:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.extrude_to_cursor",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Extrude to Cursor",
|
2023-02-14 10:30:49 +01:00
|
|
|
cursor='CROSSHAIR',
|
2018-04-30 12:14:46 +02:00
|
|
|
icon="ops.mesh.dupli_extrude_cursor",
|
|
|
|
|
widget=None,
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-09-27 12:23:01 +10:00
|
|
|
draw_settings=draw_settings,
|
2018-04-30 12:14:46 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def loopcut_slide():
|
2023-02-14 10:30:49 +01:00
|
|
|
|
2019-04-19 07:32:24 +02:00
|
|
|
def draw_settings(_context, layout, tool):
|
2018-08-22 14:04:37 +10:00
|
|
|
props = tool.operator_properties("mesh.loopcut_slide")
|
|
|
|
|
props_macro = props.MESH_OT_loopcut
|
|
|
|
|
layout.prop(props_macro, "number_cuts")
|
|
|
|
|
props_macro = props.TRANSFORM_OT_edge_slide
|
|
|
|
|
layout.prop(props_macro, "correct_uv")
|
|
|
|
|
|
2018-04-30 12:14:46 +02:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.loop_cut",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Loop Cut",
|
2018-04-30 12:14:46 +02:00
|
|
|
icon="ops.mesh.loopcut_slide",
|
2018-08-21 19:02:28 +10:00
|
|
|
widget="VIEW3D_GGT_mesh_preselect_edgering",
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-08-22 14:04:37 +10:00
|
|
|
draw_settings=draw_settings,
|
2018-04-30 12:14:46 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def offset_edge_loops_slide():
|
|
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.offset_edge_loop_cut",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Offset Edge Loop Cut",
|
2018-04-30 12:14:46 +02:00
|
|
|
icon="ops.mesh.offset_edge_loops_slide",
|
|
|
|
|
widget=None,
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-04-30 12:14:46 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def vertex_smooth():
|
2019-04-19 07:32:24 +02:00
|
|
|
def draw_settings(_context, layout, tool):
|
2018-09-13 09:23:24 +10:00
|
|
|
props = tool.operator_properties("mesh.vertices_smooth")
|
|
|
|
|
layout.prop(props, "repeat")
|
2018-04-30 12:14:46 +02:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.smooth",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Smooth",
|
2018-04-30 12:14:46 +02:00
|
|
|
icon="ops.mesh.vertices_smooth",
|
2019-12-07 03:45:50 +11:00
|
|
|
widget="VIEW3D_GGT_tool_generic_handle_normal",
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-09-13 09:23:24 +10:00
|
|
|
draw_settings=draw_settings,
|
2018-04-30 12:14:46 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def vertex_randomize():
|
2019-04-19 07:32:24 +02:00
|
|
|
def draw_settings(_context, layout, tool):
|
2018-09-13 09:23:24 +10:00
|
|
|
props = tool.operator_properties("transform.vertex_random")
|
|
|
|
|
layout.prop(props, "uniform")
|
|
|
|
|
layout.prop(props, "normal")
|
|
|
|
|
layout.prop(props, "seed")
|
2018-04-30 12:14:46 +02:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.randomize",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Randomize",
|
2018-04-30 12:14:46 +02:00
|
|
|
icon="ops.transform.vertex_random",
|
2019-12-07 03:45:50 +11:00
|
|
|
widget="VIEW3D_GGT_tool_generic_handle_normal",
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-09-13 09:23:24 +10:00
|
|
|
draw_settings=draw_settings,
|
2018-04-30 12:14:46 +02:00
|
|
|
)
|
|
|
|
|
|
2018-08-28 20:41:48 +10:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def tosphere():
|
|
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.to_sphere",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="To Sphere",
|
2018-08-28 20:41:48 +10:00
|
|
|
icon="ops.transform.tosphere",
|
|
|
|
|
widget=None,
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-08-28 20:41:48 +10:00
|
|
|
)
|
|
|
|
|
|
2018-04-30 12:14:46 +02:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def shrink_fatten():
|
2019-04-19 07:32:24 +02:00
|
|
|
def draw_settings(_context, layout, tool):
|
2018-05-22 14:00:44 +02:00
|
|
|
props = tool.operator_properties("transform.shrink_fatten")
|
2018-05-11 20:23:29 +02:00
|
|
|
layout.prop(props, "use_even_offset")
|
|
|
|
|
|
2018-04-30 12:14:46 +02:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.shrink_fatten",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Shrink/Fatten",
|
2018-04-30 12:14:46 +02:00
|
|
|
icon="ops.transform.shrink_fatten",
|
2019-12-07 03:45:50 +11:00
|
|
|
widget="VIEW3D_GGT_tool_generic_handle_normal",
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-05-11 20:23:29 +02:00
|
|
|
draw_settings=draw_settings,
|
2018-04-30 12:14:46 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def push_pull():
|
|
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.push_pull",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Push/Pull",
|
2018-04-30 12:14:46 +02:00
|
|
|
icon="ops.transform.push_pull",
|
2019-12-07 03:45:50 +11:00
|
|
|
widget="VIEW3D_GGT_tool_generic_handle_normal",
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-04-30 12:14:46 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def knife():
|
2021-09-22 21:23:44 -04:00
|
|
|
def draw_settings(_context, layout, tool, *, extra=False):
|
|
|
|
|
show_extra = False
|
2018-05-22 14:00:44 +02:00
|
|
|
props = tool.operator_properties("mesh.knife_tool")
|
2021-09-22 21:23:44 -04:00
|
|
|
if not extra:
|
|
|
|
|
layout.prop(props, "use_occlude_geometry")
|
|
|
|
|
layout.prop(props, "only_selected")
|
|
|
|
|
layout.prop(props, "xray")
|
2023-02-14 10:30:49 +01:00
|
|
|
region_is_header = bpy.context.region.type == 'TOOL_HEADER'
|
2021-09-22 21:23:44 -04:00
|
|
|
if region_is_header:
|
|
|
|
|
show_extra = True
|
|
|
|
|
else:
|
|
|
|
|
extra = True
|
|
|
|
|
if extra:
|
2022-04-06 17:01:07 -05:00
|
|
|
layout.use_property_decorate = False
|
2021-09-22 21:23:44 -04:00
|
|
|
layout.use_property_split = True
|
2022-04-06 17:01:07 -05:00
|
|
|
|
2021-09-22 21:23:44 -04:00
|
|
|
layout.prop(props, "visible_measurements")
|
|
|
|
|
layout.prop(props, "angle_snapping")
|
|
|
|
|
layout.label(text="Angle Snapping Increment")
|
2022-04-06 17:01:07 -05:00
|
|
|
layout.prop(props, "angle_snapping_increment", text="")
|
2021-09-22 21:23:44 -04:00
|
|
|
if show_extra:
|
|
|
|
|
layout.popover("TOPBAR_PT_tool_settings_extra", text="...")
|
2018-04-30 12:14:46 +02:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.knife",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Knife",
|
2023-02-14 10:30:49 +01:00
|
|
|
cursor='KNIFE',
|
2018-04-30 12:14:46 +02:00
|
|
|
icon="ops.mesh.knife_tool",
|
|
|
|
|
widget=None,
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-04-30 12:14:46 +02:00
|
|
|
draw_settings=draw_settings,
|
2023-02-14 10:30:49 +01:00
|
|
|
options={'KEYMAP_FALLBACK'},
|
2018-04-30 12:14:46 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def bisect():
|
2019-04-19 07:32:24 +02:00
|
|
|
def draw_settings(_context, layout, tool):
|
2018-09-12 06:24:15 +10:00
|
|
|
props = tool.operator_properties("mesh.bisect")
|
|
|
|
|
layout.prop(props, "use_fill")
|
|
|
|
|
layout.prop(props, "clear_inner")
|
|
|
|
|
layout.prop(props, "clear_outer")
|
|
|
|
|
layout.prop(props, "threshold")
|
2018-04-30 12:14:46 +02:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.bisect",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Bisect",
|
2018-04-30 12:14:46 +02:00
|
|
|
icon="ops.mesh.bisect",
|
|
|
|
|
widget=None,
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-09-12 06:24:15 +10:00
|
|
|
draw_settings=draw_settings,
|
2018-04-27 13:23:29 +02:00
|
|
|
)
|
|
|
|
|
|
2018-05-07 21:38:43 +02:00
|
|
|
|
2024-03-23 10:51:48 -04:00
|
|
|
def curve_draw_settings(context, layout, tool, *, extra=False):
|
2023-12-11 15:46:55 -05:00
|
|
|
# Tool settings initialize operator options.
|
|
|
|
|
tool_settings = context.tool_settings
|
|
|
|
|
cps = tool_settings.curve_paint_settings
|
|
|
|
|
region_type = context.region.type
|
2018-05-11 20:25:01 +02:00
|
|
|
|
2023-12-11 15:46:55 -05:00
|
|
|
if region_type == 'TOOL_HEADER':
|
|
|
|
|
if not extra:
|
|
|
|
|
layout.prop(cps, "curve_type", text="")
|
|
|
|
|
layout.prop(cps, "depth_mode", expand=True)
|
|
|
|
|
layout.popover("TOPBAR_PT_tool_settings_extra", text="...")
|
|
|
|
|
return
|
2018-05-11 20:25:01 +02:00
|
|
|
|
2023-12-11 15:46:55 -05:00
|
|
|
layout.use_property_split = True
|
|
|
|
|
layout.use_property_decorate = False
|
2023-12-11 19:44:19 +01:00
|
|
|
|
2023-12-11 15:46:55 -05:00
|
|
|
if region_type != 'TOOL_HEADER':
|
|
|
|
|
layout.prop(cps, "curve_type")
|
|
|
|
|
layout.separator()
|
|
|
|
|
if cps.curve_type == 'BEZIER':
|
|
|
|
|
layout.prop(cps, "fit_method")
|
|
|
|
|
layout.prop(cps, "error_threshold")
|
2023-12-11 19:44:19 +01:00
|
|
|
if region_type != 'TOOL_HEADER':
|
2023-12-11 15:46:55 -05:00
|
|
|
row = layout.row(heading="Detect Corners", align=True)
|
|
|
|
|
else:
|
|
|
|
|
row = layout.row(heading="Corners", align=True)
|
|
|
|
|
row.prop(cps, "use_corners_detect", text="")
|
|
|
|
|
sub = row.row(align=True)
|
|
|
|
|
sub.active = cps.use_corners_detect
|
|
|
|
|
sub.prop(cps, "corner_angle", text="")
|
|
|
|
|
layout.separator()
|
|
|
|
|
|
|
|
|
|
col = layout.column(align=True)
|
|
|
|
|
col.prop(cps, "radius_taper_start", text="Taper Start", slider=True)
|
|
|
|
|
col.prop(cps, "radius_taper_end", text="End", slider=True)
|
|
|
|
|
col = layout.column(align=True)
|
|
|
|
|
col.prop(cps, "radius_min", text="Radius Min")
|
|
|
|
|
col.prop(cps, "radius_max", text="Max")
|
|
|
|
|
col.prop(cps, "use_pressure_radius")
|
|
|
|
|
|
|
|
|
|
if region_type != 'TOOL_HEADER' or cps.depth_mode == 'SURFACE':
|
|
|
|
|
layout.separator()
|
|
|
|
|
|
|
|
|
|
if region_type != 'TOOL_HEADER':
|
|
|
|
|
row = layout.row()
|
|
|
|
|
row.prop(cps, "depth_mode", expand=True)
|
|
|
|
|
if cps.depth_mode == 'SURFACE':
|
|
|
|
|
col = layout.column()
|
|
|
|
|
col.prop(cps, "surface_offset")
|
|
|
|
|
col.prop(cps, "use_offset_absolute")
|
|
|
|
|
col.prop(cps, "use_stroke_endpoints")
|
|
|
|
|
if cps.use_stroke_endpoints:
|
|
|
|
|
colsub = layout.column(align=True)
|
|
|
|
|
colsub.prop(cps, "surface_plane")
|
2020-05-11 10:16:52 -04:00
|
|
|
|
2024-03-23 10:51:48 -04:00
|
|
|
props = tool.operator_properties("curves.draw")
|
|
|
|
|
col = layout.column(align=True)
|
|
|
|
|
col.prop(props, "is_curve_2d", text="Curve 2D")
|
|
|
|
|
col.prop(props, "bezier_as_nurbs", text="As NURBS")
|
|
|
|
|
|
2020-05-11 10:16:52 -04:00
|
|
|
|
2023-12-11 19:44:19 +01:00
|
|
|
class _defs_edit_curve:
|
2018-05-11 20:25:01 +02:00
|
|
|
|
2023-12-11 19:44:19 +01:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def draw():
|
2018-04-30 12:14:46 +02:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.draw",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Draw",
|
2023-02-14 10:30:49 +01:00
|
|
|
cursor='PAINT_BRUSH',
|
2018-10-21 16:04:58 +11:00
|
|
|
icon="ops.curve.draw",
|
2018-04-30 12:14:46 +02:00
|
|
|
widget=None,
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2023-12-11 19:44:19 +01:00
|
|
|
draw_settings=curve_draw_settings,
|
2018-04-27 13:23:29 +02:00
|
|
|
)
|
|
|
|
|
|
2018-08-29 15:14:41 +10:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def extrude():
|
|
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.extrude",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Extrude",
|
2018-10-21 16:04:58 +11:00
|
|
|
icon="ops.curve.extrude_move",
|
2018-11-21 09:25:55 +11:00
|
|
|
widget="VIEW3D_GGT_xform_extrude",
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-11-21 09:25:55 +11:00
|
|
|
draw_settings=_template_widget.VIEW3D_GGT_xform_extrude.draw_settings,
|
2018-08-29 15:14:41 +10:00
|
|
|
)
|
|
|
|
|
|
2018-04-30 12:14:46 +02:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def extrude_cursor():
|
|
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.extrude_cursor",
|
2020-02-17 11:16:13 +01:00
|
|
|
label="Extrude to Cursor",
|
2023-02-14 10:30:49 +01:00
|
|
|
cursor='CROSSHAIR',
|
2018-10-21 16:04:58 +11:00
|
|
|
icon="ops.curve.extrude_cursor",
|
2018-04-30 12:14:46 +02:00
|
|
|
widget=None,
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-04-27 13:23:29 +02:00
|
|
|
)
|
|
|
|
|
|
2022-04-03 22:37:22 +05:30
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def pen():
|
|
|
|
|
def draw_settings(_context, layout, tool):
|
|
|
|
|
props = tool.operator_properties("curve.pen")
|
|
|
|
|
layout.prop(props, "close_spline")
|
|
|
|
|
layout.prop(props, "extrude_handle")
|
|
|
|
|
return dict(
|
|
|
|
|
idname="builtin.pen",
|
|
|
|
|
label="Curve Pen",
|
2023-02-14 10:30:49 +01:00
|
|
|
cursor='CROSSHAIR',
|
2022-04-03 22:37:22 +05:30
|
|
|
icon="ops.curve.pen",
|
|
|
|
|
widget=None,
|
|
|
|
|
keymap=(),
|
|
|
|
|
draw_settings=draw_settings,
|
|
|
|
|
)
|
|
|
|
|
|
2018-11-15 22:27:02 +11:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def tilt():
|
|
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.tilt",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Tilt",
|
2018-11-15 22:27:02 +11:00
|
|
|
icon="ops.transform.tilt",
|
2019-12-12 18:38:41 +11:00
|
|
|
widget="VIEW3D_GGT_tool_generic_handle_free",
|
2018-11-15 22:27:02 +11:00
|
|
|
keymap=(),
|
|
|
|
|
)
|
|
|
|
|
|
2019-03-03 12:37:18 +01:00
|
|
|
@ToolDef.from_fn
|
2019-03-04 09:50:59 +01:00
|
|
|
def curve_radius():
|
2019-03-03 12:37:18 +01:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.radius",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Radius",
|
2023-02-14 10:30:49 +01:00
|
|
|
description=(
|
|
|
|
|
"Expand or contract the radius of the selected curve points"
|
|
|
|
|
),
|
2019-03-04 09:50:59 +01:00
|
|
|
icon="ops.curve.radius",
|
2019-12-12 18:38:41 +11:00
|
|
|
widget="VIEW3D_GGT_tool_generic_handle_free",
|
2019-03-03 12:37:18 +01:00
|
|
|
keymap=(),
|
|
|
|
|
)
|
2018-05-07 21:38:43 +02:00
|
|
|
|
2019-03-03 20:37:47 +01:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def curve_vertex_randomize():
|
2019-04-19 07:32:24 +02:00
|
|
|
def draw_settings(_context, layout, tool):
|
2019-03-03 20:37:47 +01:00
|
|
|
props = tool.operator_properties("transform.vertex_random")
|
|
|
|
|
layout.prop(props, "uniform")
|
|
|
|
|
layout.prop(props, "normal")
|
|
|
|
|
layout.prop(props, "seed")
|
|
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.randomize",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Randomize",
|
2019-03-03 20:37:47 +01:00
|
|
|
icon="ops.curve.vertex_random",
|
2019-12-07 03:45:50 +11:00
|
|
|
widget="VIEW3D_GGT_tool_generic_handle_normal",
|
2019-03-03 20:37:47 +01:00
|
|
|
keymap=(),
|
|
|
|
|
draw_settings=draw_settings,
|
|
|
|
|
)
|
|
|
|
|
|
2023-12-11 15:46:55 -05:00
|
|
|
|
2023-12-11 19:44:19 +01:00
|
|
|
class _defs_edit_curves:
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def draw():
|
|
|
|
|
def curve_draw(context, layout, tool, *, extra=False):
|
|
|
|
|
curve_draw_settings(context, layout, tool, extra=extra)
|
|
|
|
|
|
|
|
|
|
return dict(
|
|
|
|
|
idname="builtin.draw",
|
|
|
|
|
label="Draw",
|
|
|
|
|
cursor='PAINT_BRUSH',
|
|
|
|
|
icon="ops.curve.draw",
|
|
|
|
|
widget=None,
|
|
|
|
|
keymap=(),
|
|
|
|
|
draw_settings=curve_draw,
|
|
|
|
|
)
|
2019-03-03 20:37:47 +01:00
|
|
|
|
2023-12-11 15:46:55 -05:00
|
|
|
|
2023-04-21 19:08:44 +02:00
|
|
|
class _defs_edit_text:
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def select_text():
|
|
|
|
|
return dict(
|
|
|
|
|
idname="builtin.select_text",
|
|
|
|
|
label="Select Text",
|
|
|
|
|
cursor='TEXT',
|
|
|
|
|
icon="ops.generic.select_box",
|
|
|
|
|
widget=None,
|
|
|
|
|
keymap=(),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
2018-05-15 12:40:50 +02:00
|
|
|
class _defs_pose:
|
2023-02-14 10:30:49 +01:00
|
|
|
|
2018-05-15 12:40:50 +02:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def breakdown():
|
|
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.breakdowner",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Breakdowner",
|
2018-05-15 13:49:44 +02:00
|
|
|
icon="ops.pose.breakdowner",
|
2018-05-15 12:40:50 +02:00
|
|
|
widget=None,
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-05-15 12:40:50 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def push():
|
|
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.push",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Push",
|
2018-05-15 13:49:44 +02:00
|
|
|
icon="ops.pose.push",
|
2018-05-15 12:40:50 +02:00
|
|
|
widget=None,
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-05-15 12:40:50 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def relax():
|
|
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.relax",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Relax",
|
2018-05-15 13:49:44 +02:00
|
|
|
icon="ops.pose.relax",
|
2018-05-15 12:40:50 +02:00
|
|
|
widget=None,
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-05-15 12:40:50 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
2018-08-02 17:41:11 +10:00
|
|
|
class _defs_particle:
|
2023-02-14 10:30:49 +01:00
|
|
|
|
2018-08-02 17:41:11 +10:00
|
|
|
@staticmethod
|
|
|
|
|
def generate_from_brushes(context):
|
|
|
|
|
return generate_from_enum_ex(
|
|
|
|
|
context,
|
2019-03-15 14:18:21 +11:00
|
|
|
idname_prefix="builtin_brush.",
|
2018-08-02 17:41:11 +10:00
|
|
|
icon_prefix="brush.particle.",
|
2018-11-05 13:54:43 +11:00
|
|
|
type=bpy.types.ParticleEdit,
|
2018-08-02 17:41:11 +10:00
|
|
|
attr="tool",
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
2018-04-29 14:31:00 +02:00
|
|
|
class _defs_sculpt:
|
2023-02-14 10:30:49 +01:00
|
|
|
|
2018-04-29 14:31:00 +02:00
|
|
|
@staticmethod
|
|
|
|
|
def generate_from_brushes(context):
|
2018-11-06 12:08:39 +11:00
|
|
|
return generate_from_enum_ex(
|
|
|
|
|
context,
|
2019-03-15 14:18:21 +11:00
|
|
|
idname_prefix="builtin_brush.",
|
2018-04-30 15:21:04 +02:00
|
|
|
icon_prefix="brush.sculpt.",
|
2018-11-06 12:08:39 +11:00
|
|
|
type=bpy.types.Brush,
|
|
|
|
|
attr="sculpt_tool",
|
2023-04-14 20:11:59 +10:00
|
|
|
# TODO(@ideasman42): we may want to enable this,
|
|
|
|
|
# it causes awkward grouping with 2x column button layout.
|
|
|
|
|
use_separators=False,
|
2018-04-30 15:21:04 +02:00
|
|
|
)
|
2018-04-29 16:36:31 +02:00
|
|
|
|
2018-08-23 12:56:02 +10:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def hide_border():
|
2024-03-12 14:19:02 +01:00
|
|
|
def draw_settings(_context, layout, tool):
|
|
|
|
|
props = tool.operator_properties("paint.hide_show")
|
|
|
|
|
layout.prop(props, "area", expand=False)
|
|
|
|
|
|
2018-08-23 12:56:02 +10:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.box_hide",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Box Hide",
|
2018-08-23 22:46:04 +10:00
|
|
|
icon="ops.sculpt.border_hide",
|
2018-08-23 12:56:02 +10:00
|
|
|
widget=None,
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2024-03-12 14:19:02 +01:00
|
|
|
draw_settings=draw_settings,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def hide_lasso():
|
|
|
|
|
def draw_settings(_context, layout, tool):
|
|
|
|
|
props = tool.operator_properties("paint.hide_show_lasso_gesture")
|
|
|
|
|
layout.prop(props, "area", expand=False)
|
|
|
|
|
|
|
|
|
|
return dict(
|
|
|
|
|
idname="builtin.lasso_hide",
|
|
|
|
|
label="Lasso Hide",
|
|
|
|
|
icon="ops.sculpt.lasso_hide",
|
|
|
|
|
widget=None,
|
|
|
|
|
keymap=(),
|
|
|
|
|
draw_settings=draw_settings,
|
2018-08-23 12:56:02 +10:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def mask_border():
|
2020-08-10 17:04:18 +02:00
|
|
|
def draw_settings(_context, layout, tool):
|
|
|
|
|
props = tool.operator_properties("paint.mask_box_gesture")
|
|
|
|
|
layout.prop(props, "use_front_faces_only", expand=False)
|
|
|
|
|
|
2018-08-23 12:56:02 +10:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.box_mask",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Box Mask",
|
2018-08-23 22:46:04 +10:00
|
|
|
icon="ops.sculpt.border_mask",
|
2018-08-23 12:56:02 +10:00
|
|
|
widget=None,
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2020-08-10 17:04:18 +02:00
|
|
|
draw_settings=draw_settings,
|
2018-08-23 12:56:02 +10:00
|
|
|
)
|
2018-04-30 16:06:51 +02:00
|
|
|
|
2019-06-07 16:04:12 +10:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def mask_lasso():
|
2020-08-10 17:04:18 +02:00
|
|
|
def draw_settings(_context, layout, tool):
|
|
|
|
|
props = tool.operator_properties("paint.mask_lasso_gesture")
|
|
|
|
|
layout.prop(props, "use_front_faces_only", expand=False)
|
|
|
|
|
|
2019-06-07 16:04:12 +10:00
|
|
|
return dict(
|
|
|
|
|
idname="builtin.lasso_mask",
|
|
|
|
|
label="Lasso Mask",
|
2019-06-07 10:24:19 +02:00
|
|
|
icon="ops.sculpt.lasso_mask",
|
2019-06-07 16:04:12 +10:00
|
|
|
widget=None,
|
|
|
|
|
keymap=(),
|
2020-08-10 17:04:18 +02:00
|
|
|
draw_settings=draw_settings,
|
2019-06-07 16:04:12 +10:00
|
|
|
)
|
|
|
|
|
|
2020-09-26 21:59:30 +02:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def mask_line():
|
|
|
|
|
def draw_settings(_context, layout, tool):
|
|
|
|
|
props = tool.operator_properties("paint.mask_line_gesture")
|
|
|
|
|
layout.prop(props, "use_front_faces_only", expand=False)
|
2020-10-23 01:07:20 +02:00
|
|
|
layout.prop(props, "use_limit_to_segment", expand=False)
|
2020-09-26 21:59:30 +02:00
|
|
|
|
|
|
|
|
return dict(
|
|
|
|
|
idname="builtin.line_mask",
|
|
|
|
|
label="Line Mask",
|
|
|
|
|
icon="ops.sculpt.line_mask",
|
|
|
|
|
widget=None,
|
|
|
|
|
keymap=(),
|
|
|
|
|
draw_settings=draw_settings,
|
|
|
|
|
)
|
|
|
|
|
|
2020-09-03 16:15:20 +02:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def face_set_box():
|
|
|
|
|
def draw_settings(_context, layout, tool):
|
|
|
|
|
props = tool.operator_properties("sculpt.face_set_box_gesture")
|
|
|
|
|
layout.prop(props, "use_front_faces_only", expand=False)
|
|
|
|
|
|
|
|
|
|
return dict(
|
|
|
|
|
idname="builtin.box_face_set",
|
|
|
|
|
label="Box Face Set",
|
|
|
|
|
icon="ops.sculpt.border_face_set",
|
|
|
|
|
widget=None,
|
|
|
|
|
keymap=(),
|
|
|
|
|
draw_settings=draw_settings,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def face_set_lasso():
|
|
|
|
|
def draw_settings(_context, layout, tool):
|
|
|
|
|
props = tool.operator_properties("sculpt.face_set_lasso_gesture")
|
|
|
|
|
layout.prop(props, "use_front_faces_only", expand=False)
|
|
|
|
|
|
|
|
|
|
return dict(
|
|
|
|
|
idname="builtin.lasso_face_set",
|
|
|
|
|
label="Lasso Face Set",
|
|
|
|
|
icon="ops.sculpt.lasso_face_set",
|
|
|
|
|
widget=None,
|
|
|
|
|
keymap=(),
|
|
|
|
|
draw_settings=draw_settings,
|
|
|
|
|
)
|
|
|
|
|
|
2020-09-05 20:06:27 +02:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def trim_box():
|
2020-10-06 18:07:39 +02:00
|
|
|
def draw_settings(_context, layout, tool):
|
|
|
|
|
props = tool.operator_properties("sculpt.trim_box_gesture")
|
2024-03-26 17:25:06 +01:00
|
|
|
layout.prop(props, "trim_solver", expand=False)
|
2020-10-06 18:07:39 +02:00
|
|
|
layout.prop(props, "trim_mode", expand=False)
|
2023-02-24 11:28:23 -08:00
|
|
|
layout.prop(props, "trim_orientation", expand=False)
|
2023-01-11 09:57:58 -08:00
|
|
|
layout.prop(props, "trim_extrude_mode", expand=False)
|
2020-10-15 19:13:29 +02:00
|
|
|
layout.prop(props, "use_cursor_depth", expand=False)
|
2020-09-05 20:06:27 +02:00
|
|
|
return dict(
|
|
|
|
|
idname="builtin.box_trim",
|
|
|
|
|
label="Box Trim",
|
|
|
|
|
icon="ops.sculpt.box_trim",
|
|
|
|
|
widget=None,
|
|
|
|
|
keymap=(),
|
2020-10-06 18:07:39 +02:00
|
|
|
draw_settings=draw_settings,
|
2020-09-05 20:06:27 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def trim_lasso():
|
2020-10-06 18:07:39 +02:00
|
|
|
def draw_settings(_context, layout, tool):
|
|
|
|
|
props = tool.operator_properties("sculpt.trim_lasso_gesture")
|
2024-03-26 17:25:06 +01:00
|
|
|
layout.prop(props, "trim_solver", expand=False)
|
2020-10-06 18:07:39 +02:00
|
|
|
layout.prop(props, "trim_mode", expand=False)
|
2020-10-30 01:16:14 +01:00
|
|
|
layout.prop(props, "trim_orientation", expand=False)
|
2023-01-11 09:57:58 -08:00
|
|
|
layout.prop(props, "trim_extrude_mode", expand=False)
|
2020-10-15 19:13:29 +02:00
|
|
|
layout.prop(props, "use_cursor_depth", expand=False)
|
2020-09-05 20:06:27 +02:00
|
|
|
return dict(
|
|
|
|
|
idname="builtin.lasso_trim",
|
|
|
|
|
label="Lasso Trim",
|
|
|
|
|
icon="ops.sculpt.lasso_trim",
|
|
|
|
|
widget=None,
|
|
|
|
|
keymap=(),
|
2020-10-06 18:07:39 +02:00
|
|
|
draw_settings=draw_settings,
|
2020-09-05 20:06:27 +02:00
|
|
|
)
|
|
|
|
|
|
2020-09-29 22:46:38 +02:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def project_line():
|
2020-10-23 01:07:20 +02:00
|
|
|
def draw_settings(_context, layout, tool):
|
|
|
|
|
props = tool.operator_properties("sculpt.project_line_gesture")
|
|
|
|
|
layout.prop(props, "use_limit_to_segment", expand=False)
|
|
|
|
|
|
2020-09-29 22:46:38 +02:00
|
|
|
return dict(
|
|
|
|
|
idname="builtin.line_project",
|
|
|
|
|
label="Line Project",
|
|
|
|
|
icon="ops.sculpt.line_project",
|
|
|
|
|
widget=None,
|
|
|
|
|
keymap=(),
|
2020-10-23 01:07:20 +02:00
|
|
|
draw_settings=draw_settings,
|
2020-09-29 22:46:38 +02:00
|
|
|
)
|
|
|
|
|
|
2019-09-09 15:42:51 +02:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def mesh_filter():
|
2019-09-15 05:26:15 +10:00
|
|
|
def draw_settings(_context, layout, tool):
|
2019-09-09 15:42:51 +02:00
|
|
|
props = tool.operator_properties("sculpt.mesh_filter")
|
|
|
|
|
layout.prop(props, "type", expand=False)
|
|
|
|
|
layout.prop(props, "strength")
|
2020-08-18 12:32:42 +02:00
|
|
|
row = layout.row(align=True)
|
|
|
|
|
row.prop(props, "deform_axis")
|
2020-08-17 18:47:00 +02:00
|
|
|
layout.prop(props, "orientation", expand=False)
|
2023-02-14 10:30:49 +01:00
|
|
|
if props.type == 'SURFACE_SMOOTH':
|
2020-03-26 16:05:46 +01:00
|
|
|
layout.prop(props, "surface_smooth_shape_preservation", expand=False)
|
|
|
|
|
layout.prop(props, "surface_smooth_current_vertex", expand=False)
|
2023-02-14 10:30:49 +01:00
|
|
|
elif props.type == 'SHARPEN':
|
2020-04-05 02:00:50 +02:00
|
|
|
layout.prop(props, "sharpen_smooth_ratio", expand=False)
|
2020-08-04 23:42:48 +02:00
|
|
|
layout.prop(props, "sharpen_intensify_detail_strength", expand=False)
|
|
|
|
|
layout.prop(props, "sharpen_curvature_smooth_iterations", expand=False)
|
2019-09-09 15:42:51 +02:00
|
|
|
|
|
|
|
|
return dict(
|
|
|
|
|
idname="builtin.mesh_filter",
|
|
|
|
|
label="Mesh Filter",
|
|
|
|
|
icon="ops.sculpt.mesh_filter",
|
|
|
|
|
widget=None,
|
2019-09-10 06:11:52 +10:00
|
|
|
keymap=(),
|
2019-09-09 15:42:51 +02:00
|
|
|
draw_settings=draw_settings,
|
|
|
|
|
)
|
2018-08-28 21:00:25 +10:00
|
|
|
|
2020-06-01 22:36:26 +02:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def cloth_filter():
|
|
|
|
|
def draw_settings(_context, layout, tool):
|
|
|
|
|
props = tool.operator_properties("sculpt.cloth_filter")
|
|
|
|
|
layout.prop(props, "type", expand=False)
|
|
|
|
|
layout.prop(props, "strength")
|
2020-08-18 13:27:58 +02:00
|
|
|
row = layout.row(align=True)
|
|
|
|
|
row.prop(props, "force_axis")
|
2020-08-18 20:38:33 +02:00
|
|
|
layout.prop(props, "orientation", expand=False)
|
2020-06-01 22:36:26 +02:00
|
|
|
layout.prop(props, "cloth_mass")
|
|
|
|
|
layout.prop(props, "cloth_damping")
|
|
|
|
|
layout.prop(props, "use_face_sets")
|
2020-07-29 17:39:08 +02:00
|
|
|
layout.prop(props, "use_collisions")
|
2020-06-01 22:36:26 +02:00
|
|
|
|
|
|
|
|
return dict(
|
|
|
|
|
idname="builtin.cloth_filter",
|
|
|
|
|
label="Cloth Filter",
|
|
|
|
|
icon="ops.sculpt.cloth_filter",
|
|
|
|
|
widget=None,
|
|
|
|
|
keymap=(),
|
|
|
|
|
draw_settings=draw_settings,
|
|
|
|
|
)
|
|
|
|
|
|
Sculpt Vertex Colors: Initial implementation
Sculpt Vertex Colors is a painting system that runs inside sculpt mode, reusing all its tools and optimizations. This provides much better performance, easier to maintain code and more advanced features (new brush engine, filters, symmetry options, masks and face sets compatibility...). This is also the initial step for future features like vertex painting in Multires and brushes that can sculpt and paint at the same time.
This commit includes:
- SCULPT_UNDO_COLOR for undo support in sculpt mode
- SCULPT_UPDATE_COLOR and PBVH flags and rendering
- Sculpt Color API functions
- Sculpt capability for sculpt tools (only enabled in the Paint Brush for now)
- Rendering support in workbench (default to Sculpt Vertex Colors except in Vertex Paint)
- Conversion operator between MPropCol (Sculpt Vertex Colors) and MLoopCol (Vertex Paint)
- Remesher reprojection in the Voxel Remehser
- Paint Brush and Smear Brush with color smoothing in alt-smooth mode
- Parameters for the new brush engine (density, opacity, flow, wet paint mixing, tip scale) implemented in Sculpt Vertex Colors
- Color Filter
- Color picker (uses S shortcut, replaces smooth)
- Color selector in the top bar
Reviewed By: brecht
Maniphest Tasks: T72866
Differential Revision: https://developer.blender.org/D5975
2020-06-22 20:05:28 +02:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def color_filter():
|
|
|
|
|
def draw_settings(_context, layout, tool):
|
|
|
|
|
props = tool.operator_properties("sculpt.color_filter")
|
|
|
|
|
layout.prop(props, "type", expand=False)
|
2023-02-14 10:30:49 +01:00
|
|
|
if props.type == 'FILL':
|
2020-06-30 03:25:49 +02:00
|
|
|
layout.prop(props, "fill_color", expand=False)
|
Sculpt Vertex Colors: Initial implementation
Sculpt Vertex Colors is a painting system that runs inside sculpt mode, reusing all its tools and optimizations. This provides much better performance, easier to maintain code and more advanced features (new brush engine, filters, symmetry options, masks and face sets compatibility...). This is also the initial step for future features like vertex painting in Multires and brushes that can sculpt and paint at the same time.
This commit includes:
- SCULPT_UNDO_COLOR for undo support in sculpt mode
- SCULPT_UPDATE_COLOR and PBVH flags and rendering
- Sculpt Color API functions
- Sculpt capability for sculpt tools (only enabled in the Paint Brush for now)
- Rendering support in workbench (default to Sculpt Vertex Colors except in Vertex Paint)
- Conversion operator between MPropCol (Sculpt Vertex Colors) and MLoopCol (Vertex Paint)
- Remesher reprojection in the Voxel Remehser
- Paint Brush and Smear Brush with color smoothing in alt-smooth mode
- Parameters for the new brush engine (density, opacity, flow, wet paint mixing, tip scale) implemented in Sculpt Vertex Colors
- Color Filter
- Color picker (uses S shortcut, replaces smooth)
- Color selector in the top bar
Reviewed By: brecht
Maniphest Tasks: T72866
Differential Revision: https://developer.blender.org/D5975
2020-06-22 20:05:28 +02:00
|
|
|
layout.prop(props, "strength")
|
|
|
|
|
|
|
|
|
|
return dict(
|
|
|
|
|
idname="builtin.color_filter",
|
|
|
|
|
label="Color Filter",
|
|
|
|
|
icon="ops.sculpt.color_filter",
|
|
|
|
|
widget=None,
|
|
|
|
|
keymap=(),
|
|
|
|
|
draw_settings=draw_settings,
|
|
|
|
|
)
|
|
|
|
|
|
2020-07-01 19:19:30 +02:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def mask_by_color():
|
|
|
|
|
def draw_settings(_context, layout, tool):
|
|
|
|
|
props = tool.operator_properties("sculpt.mask_by_color")
|
|
|
|
|
layout.prop(props, "threshold")
|
|
|
|
|
layout.prop(props, "contiguous")
|
|
|
|
|
layout.prop(props, "invert")
|
|
|
|
|
layout.prop(props, "preserve_previous_mask")
|
|
|
|
|
|
|
|
|
|
return dict(
|
|
|
|
|
idname="builtin.mask_by_color",
|
2020-12-24 11:07:32 -06:00
|
|
|
label="Mask by Color",
|
2020-07-01 19:19:30 +02:00
|
|
|
icon="ops.sculpt.mask_by_color",
|
|
|
|
|
widget=None,
|
|
|
|
|
keymap=(),
|
|
|
|
|
draw_settings=draw_settings,
|
|
|
|
|
)
|
|
|
|
|
|
2020-08-11 19:24:01 +02:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def face_set_edit():
|
|
|
|
|
def draw_settings(_context, layout, tool):
|
|
|
|
|
props = tool.operator_properties("sculpt.face_set_edit")
|
|
|
|
|
layout.prop(props, "mode", expand=False)
|
|
|
|
|
layout.prop(props, "modify_hidden")
|
|
|
|
|
|
|
|
|
|
return dict(
|
|
|
|
|
idname="builtin.face_set_edit",
|
|
|
|
|
label="Edit Face Set",
|
|
|
|
|
icon="ops.sculpt.face_set_edit",
|
|
|
|
|
widget=None,
|
|
|
|
|
keymap="3D View Tool: Sculpt, Face Set Edit",
|
|
|
|
|
draw_settings=draw_settings,
|
|
|
|
|
)
|
|
|
|
|
|
2019-09-10 06:11:52 +10:00
|
|
|
|
2018-04-30 16:06:51 +02:00
|
|
|
class _defs_vertex_paint:
|
2023-02-14 10:30:49 +01:00
|
|
|
|
2018-08-29 16:21:48 +10:00
|
|
|
@staticmethod
|
|
|
|
|
def poll_select_mask(context):
|
2019-03-31 18:43:14 +02:00
|
|
|
if context is None:
|
|
|
|
|
return True
|
2018-09-21 19:24:29 +02:00
|
|
|
ob = context.active_object
|
2023-02-14 10:30:49 +01:00
|
|
|
return (ob and ob.type == 'MESH' and
|
|
|
|
|
(ob.data.use_paint_mask or
|
|
|
|
|
ob.data.use_paint_mask_vertex))
|
2018-08-29 16:21:48 +10:00
|
|
|
|
2018-04-30 15:21:04 +02:00
|
|
|
@staticmethod
|
|
|
|
|
def generate_from_brushes(context):
|
2018-11-06 12:08:39 +11:00
|
|
|
return generate_from_enum_ex(
|
|
|
|
|
context,
|
2019-03-15 14:18:21 +11:00
|
|
|
idname_prefix="builtin_brush.",
|
2018-04-30 16:06:51 +02:00
|
|
|
icon_prefix="brush.paint_vertex.",
|
2018-11-06 12:08:39 +11:00
|
|
|
type=bpy.types.Brush,
|
|
|
|
|
attr="vertex_tool",
|
2018-04-30 15:21:04 +02:00
|
|
|
)
|
2018-04-29 14:31:00 +02:00
|
|
|
|
2018-12-20 13:01:40 +11:00
|
|
|
|
2018-04-30 16:43:13 +02:00
|
|
|
class _defs_texture_paint:
|
2023-02-14 10:30:49 +01:00
|
|
|
|
2019-03-11 13:45:15 +01:00
|
|
|
@staticmethod
|
|
|
|
|
def poll_select_mask(context):
|
2019-03-31 18:43:14 +02:00
|
|
|
if context is None:
|
|
|
|
|
return True
|
2019-03-11 13:45:15 +01:00
|
|
|
ob = context.active_object
|
2023-02-14 10:30:49 +01:00
|
|
|
return (ob and ob.type == 'MESH' and
|
|
|
|
|
(ob.data.use_paint_mask))
|
2019-03-11 13:45:15 +01:00
|
|
|
|
2018-04-30 16:43:13 +02:00
|
|
|
@staticmethod
|
|
|
|
|
def generate_from_brushes(context):
|
2018-11-06 12:08:39 +11:00
|
|
|
return generate_from_enum_ex(
|
|
|
|
|
context,
|
2019-03-15 14:18:21 +11:00
|
|
|
idname_prefix="builtin_brush.",
|
2018-04-30 16:43:13 +02:00
|
|
|
icon_prefix="brush.paint_texture.",
|
2018-11-06 12:08:39 +11:00
|
|
|
type=bpy.types.Brush,
|
|
|
|
|
attr="image_tool",
|
2023-02-14 10:30:49 +01:00
|
|
|
cursor='PAINT_CROSS',
|
2018-04-30 16:43:13 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
2018-04-30 16:06:51 +02:00
|
|
|
class _defs_weight_paint:
|
2023-02-14 10:30:49 +01:00
|
|
|
|
2018-08-29 16:21:48 +10:00
|
|
|
@staticmethod
|
Fix #44834: Add bone selection icon next to face and vertex selection in weight paint mode
Currently, in weight paint mode, there is an icon for
face and vertex selection mode, but there isn't one
for the default mode where the user can select a bone
in any tool by alt clicking.
This lack of indication might lead to confusion for the users
when they are not able to select a bone by
alt clicking during weight painting.
By adding a bone selection icon when there is a pose
mode armature, we can communicate to the user that:
1. they can select a bone while the bone selection icon is active.
(when they are not in face or vertex selection mode)
2. they have forgot to select an armature when entering
weight paint mode by not showing the bone selection
icon at all when there is no pose mode armature.
When the bone selection icon is inactive,
the user can't select a bone.
(alt clicking selects face and vertex mode's respective element)
When no armature is selected when entering weight paint mode,
the bone selection icon doesn't show up indicating that the user
has forgot to select an armature.
(The user is also unable to select a bone by alt clicking.)
## Selection tool for bone selection mode
Currently, while selection tools exist for face and vertex
selection mode, one doesn't exist for the default mode
(bone selection mode). As the default mode will be getting
a clear indicator that it will function as a bone selection mode,
I added a selection tool entry for the bone selection mode.
Face and vertex selection modes has the shortcut 1 and 2,
so it seemed natural to give bone selection mode the shortcut of 3.
Pull Request: https://projects.blender.org/blender/blender/pulls/115409
2023-12-01 13:38:58 +01:00
|
|
|
def poll_select_tools(context):
|
2019-03-31 18:43:14 +02:00
|
|
|
if context is None:
|
Fix #44834: Add bone selection icon next to face and vertex selection in weight paint mode
Currently, in weight paint mode, there is an icon for
face and vertex selection mode, but there isn't one
for the default mode where the user can select a bone
in any tool by alt clicking.
This lack of indication might lead to confusion for the users
when they are not able to select a bone by
alt clicking during weight painting.
By adding a bone selection icon when there is a pose
mode armature, we can communicate to the user that:
1. they can select a bone while the bone selection icon is active.
(when they are not in face or vertex selection mode)
2. they have forgot to select an armature when entering
weight paint mode by not showing the bone selection
icon at all when there is no pose mode armature.
When the bone selection icon is inactive,
the user can't select a bone.
(alt clicking selects face and vertex mode's respective element)
When no armature is selected when entering weight paint mode,
the bone selection icon doesn't show up indicating that the user
has forgot to select an armature.
(The user is also unable to select a bone by alt clicking.)
## Selection tool for bone selection mode
Currently, while selection tools exist for face and vertex
selection mode, one doesn't exist for the default mode
(bone selection mode). As the default mode will be getting
a clear indicator that it will function as a bone selection mode,
I added a selection tool entry for the bone selection mode.
Face and vertex selection modes has the shortcut 1 and 2,
so it seemed natural to give bone selection mode the shortcut of 3.
Pull Request: https://projects.blender.org/blender/blender/pulls/115409
2023-12-01 13:38:58 +01:00
|
|
|
return VIEW3D_PT_tools_active._tools_select
|
2018-09-21 19:24:29 +02:00
|
|
|
ob = context.active_object
|
Fix #44834: Add bone selection icon next to face and vertex selection in weight paint mode
Currently, in weight paint mode, there is an icon for
face and vertex selection mode, but there isn't one
for the default mode where the user can select a bone
in any tool by alt clicking.
This lack of indication might lead to confusion for the users
when they are not able to select a bone by
alt clicking during weight painting.
By adding a bone selection icon when there is a pose
mode armature, we can communicate to the user that:
1. they can select a bone while the bone selection icon is active.
(when they are not in face or vertex selection mode)
2. they have forgot to select an armature when entering
weight paint mode by not showing the bone selection
icon at all when there is no pose mode armature.
When the bone selection icon is inactive,
the user can't select a bone.
(alt clicking selects face and vertex mode's respective element)
When no armature is selected when entering weight paint mode,
the bone selection icon doesn't show up indicating that the user
has forgot to select an armature.
(The user is also unable to select a bone by alt clicking.)
## Selection tool for bone selection mode
Currently, while selection tools exist for face and vertex
selection mode, one doesn't exist for the default mode
(bone selection mode). As the default mode will be getting
a clear indicator that it will function as a bone selection mode,
I added a selection tool entry for the bone selection mode.
Face and vertex selection modes has the shortcut 1 and 2,
so it seemed natural to give bone selection mode the shortcut of 3.
Pull Request: https://projects.blender.org/blender/blender/pulls/115409
2023-12-01 13:38:58 +01:00
|
|
|
if (ob and ob.type == 'MESH' and
|
|
|
|
|
(ob.data.use_paint_mask or
|
|
|
|
|
ob.data.use_paint_mask_vertex)):
|
|
|
|
|
return VIEW3D_PT_tools_active._tools_select
|
|
|
|
|
elif context.pose_object:
|
2024-02-29 17:59:21 +11:00
|
|
|
return VIEW3D_PT_tools_active._tools_select
|
Fix #44834: Add bone selection icon next to face and vertex selection in weight paint mode
Currently, in weight paint mode, there is an icon for
face and vertex selection mode, but there isn't one
for the default mode where the user can select a bone
in any tool by alt clicking.
This lack of indication might lead to confusion for the users
when they are not able to select a bone by
alt clicking during weight painting.
By adding a bone selection icon when there is a pose
mode armature, we can communicate to the user that:
1. they can select a bone while the bone selection icon is active.
(when they are not in face or vertex selection mode)
2. they have forgot to select an armature when entering
weight paint mode by not showing the bone selection
icon at all when there is no pose mode armature.
When the bone selection icon is inactive,
the user can't select a bone.
(alt clicking selects face and vertex mode's respective element)
When no armature is selected when entering weight paint mode,
the bone selection icon doesn't show up indicating that the user
has forgot to select an armature.
(The user is also unable to select a bone by alt clicking.)
## Selection tool for bone selection mode
Currently, while selection tools exist for face and vertex
selection mode, one doesn't exist for the default mode
(bone selection mode). As the default mode will be getting
a clear indicator that it will function as a bone selection mode,
I added a selection tool entry for the bone selection mode.
Face and vertex selection modes has the shortcut 1 and 2,
so it seemed natural to give bone selection mode the shortcut of 3.
Pull Request: https://projects.blender.org/blender/blender/pulls/115409
2023-12-01 13:38:58 +01:00
|
|
|
return ()
|
2018-08-29 16:21:48 +10:00
|
|
|
|
2018-04-30 16:06:51 +02:00
|
|
|
@staticmethod
|
|
|
|
|
def generate_from_brushes(context):
|
2018-11-06 12:08:39 +11:00
|
|
|
return generate_from_enum_ex(
|
|
|
|
|
context,
|
2019-03-15 14:18:21 +11:00
|
|
|
idname_prefix="builtin_brush.",
|
2018-04-30 16:06:51 +02:00
|
|
|
icon_prefix="brush.paint_weight.",
|
2018-11-06 12:08:39 +11:00
|
|
|
type=bpy.types.Brush,
|
2018-11-06 18:06:33 +11:00
|
|
|
attr="weight_tool",
|
2018-04-30 16:06:51 +02:00
|
|
|
)
|
|
|
|
|
|
2018-05-01 12:20:53 +02:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def sample_weight():
|
2021-03-06 18:21:17 +11:00
|
|
|
def draw_settings(context, layout, _tool):
|
2021-01-07 09:29:36 -08:00
|
|
|
if context.tool_settings.unified_paint_settings.use_unified_weight:
|
|
|
|
|
weight = context.tool_settings.unified_paint_settings.weight
|
|
|
|
|
elif context.tool_settings.weight_paint.brush:
|
|
|
|
|
weight = context.tool_settings.weight_paint.brush.weight
|
|
|
|
|
else:
|
|
|
|
|
return
|
|
|
|
|
layout.label(text="Weight: %.3f" % weight)
|
2018-05-01 12:20:53 +02:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.sample_weight",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Sample Weight",
|
2018-05-01 12:20:53 +02:00
|
|
|
icon="ops.paint.weight_sample",
|
2023-02-14 10:30:49 +01:00
|
|
|
cursor='EYEDROPPER',
|
2018-05-01 12:20:53 +02:00
|
|
|
widget=None,
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2022-12-15 17:24:23 +11:00
|
|
|
draw_settings=draw_settings,
|
2018-05-01 12:20:53 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def sample_weight_group():
|
|
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.sample_vertex_group",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Sample Vertex Group",
|
2018-05-01 12:20:53 +02:00
|
|
|
icon="ops.paint.weight_sample_group",
|
2023-02-14 10:30:49 +01:00
|
|
|
cursor='EYEDROPPER',
|
2018-05-01 12:20:53 +02:00
|
|
|
widget=None,
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-05-01 12:20:53 +02:00
|
|
|
)
|
|
|
|
|
|
2018-04-30 16:06:51 +02:00
|
|
|
@ToolDef.from_fn
|
2018-05-01 12:46:25 +02:00
|
|
|
def gradient():
|
2018-05-22 14:00:44 +02:00
|
|
|
def draw_settings(context, layout, tool):
|
2018-09-05 16:01:53 +10:00
|
|
|
brush = context.tool_settings.weight_paint.brush
|
|
|
|
|
if brush is not None:
|
2020-02-20 16:45:33 +01:00
|
|
|
from bl_ui.properties_paint_common import UnifiedPaintPanel
|
|
|
|
|
UnifiedPaintPanel.prop_unified(
|
|
|
|
|
layout,
|
|
|
|
|
context,
|
|
|
|
|
brush,
|
|
|
|
|
"weight",
|
|
|
|
|
unified_name="use_unified_weight",
|
|
|
|
|
slider=True,
|
2022-12-15 17:24:23 +11:00
|
|
|
header=True,
|
2020-02-20 16:45:33 +01:00
|
|
|
)
|
|
|
|
|
UnifiedPaintPanel.prop_unified(
|
|
|
|
|
layout,
|
|
|
|
|
context,
|
|
|
|
|
brush,
|
|
|
|
|
"strength",
|
|
|
|
|
unified_name="use_unified_strength",
|
2022-12-15 17:24:23 +11:00
|
|
|
header=True,
|
2020-02-20 16:45:33 +01:00
|
|
|
)
|
|
|
|
|
|
2018-09-05 16:05:00 +10:00
|
|
|
props = tool.operator_properties("paint.weight_gradient")
|
UI: Brush Settings overhaul
This makes a number of changes to the tool settings brush UI:
- All brush-related controls are now grouped together, so you can see which items are brush settings are which are not. Previously it was all jumbled together.
- The brush picker is in a separate panel, so that you can switch brushes without worrying about the settings, or vice versa.
- Custom Icon settings moved from the Display settings(now known as Cursor) to the Brushes panel.
- UnifiedPaintSettings panels are removed and the contained options are now next to their relevant setting with a globe icon toggle. This is not displayed in the header.
- 2D Falloff and Absolute Jitter toggles were changed into enums, to make it clearer what happens when they are on or off.
- Adjust Strength for Spacing option was in the Options panel in some modes, but in the Stroke panel in others. It is now always under Stroke.
- Display (now Cursor) panel was reorganized, settings renamed.
- 2-option enums are annoying as a drop-down menu, so they are now drawn with expand=True.
- Smooth Stroke and Stabilizer options in grease pencil and other paint modes are now both called "Stabilize Stroke", for consistency and clarity.
- De-duplicated some drawing code between various painting modes' brush options. I tried to keep de-duplication reasonable and easy to follow.
- A few more tweaks - see D5928 for the extensive list.
Most of the patch is written by Demeter Dzadik, with some additions by myself
Differential Revision: https://developer.blender.org/D5928
Reviewers: Pablo Dobarro, Bastien Montagne, Matias Mendiola
2019-12-14 18:48:18 +01:00
|
|
|
layout.prop(props, "type", expand=True)
|
Weightpaint Gradient tool: expose falloff to the UI
By default, we'll always get a falloff like this from the tool:
{F10559413}
But in the context of using vertexgroups in modifiers/modeling, a choice
on how the gradient falloff of the Weightpaint Gradient tool is shaped
would be desirable:
"real" linear:
{F10559416}
Custom:
{F10559421}
{F10559428}
The way the Weightpaint gradient tool works is a bit outside the usual
tools that use brushes [even though it creates a brush on the fly in
`WPGradient_userData`].
However, it does not have an entry in `eBrushWeightPaintTool` and adding
one there does not play nice for the same reasons (not "really" being
integrated in the brush-based tools).
So in order to expose the brush curve in the UI, we would have to do one
of the following:
- [1] try to use `VIEW3D_PT_tools_brush_falloff`, for this to work:
-- make all kinds of exception in python super classes [`FalloffPanel`,
`BrushPanel`, `UnifiedPaintPanel`, ... -- including making real entries
in `eBrushWeightPaintTool`] to get a proper tool mode and...
-- .. to also make sure Falloff Shape and Front-Face Falloff are not
available [which the tool seems to just not support in its current form]
- [2] just have a simple, contained panel for this tool alone
This patch implements [2] and adds it as part of the ToolDef (could also
be done in `VIEW3D_HT_tool_header`, but again, I think this is nice to
keep separate from the usual tools)
{F10559482}
{F10559485}
Testfile:
{F10559442}
Fixes T91636
Maniphest Tasks: T91636
Differential Revision: https://developer.blender.org/D12614
2021-09-23 15:48:32 +02:00
|
|
|
layout.popover("VIEW3D_PT_tools_weight_gradient")
|
2018-04-30 16:06:51 +02:00
|
|
|
|
|
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.gradient",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Gradient",
|
2018-05-01 12:46:25 +02:00
|
|
|
icon="ops.paint.weight_gradient",
|
2018-04-30 16:06:51 +02:00
|
|
|
widget=None,
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-05-01 12:46:25 +02:00
|
|
|
draw_settings=draw_settings,
|
2018-04-30 16:06:51 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
2023-07-03 16:34:30 +02:00
|
|
|
class _defs_paint_grease_pencil:
|
|
|
|
|
|
2024-01-26 15:23:41 +01:00
|
|
|
# FIXME: Replace brush tools with code below once they are all implemented:
|
|
|
|
|
#
|
|
|
|
|
# @staticmethod
|
|
|
|
|
# def generate_from_brushes(context):
|
|
|
|
|
# return generate_from_enum_ex(
|
|
|
|
|
# context,
|
|
|
|
|
# idname_prefix="builtin_brush.",
|
|
|
|
|
# icon_prefix="brush.gpencil_draw.",
|
|
|
|
|
# type=bpy.types.Brush,
|
|
|
|
|
# attr="gpencil_tool",
|
|
|
|
|
# cursor='DOT',
|
|
|
|
|
# )
|
|
|
|
|
|
2023-07-03 16:34:30 +02:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def draw():
|
|
|
|
|
return dict(
|
|
|
|
|
idname="builtin_brush.Draw",
|
|
|
|
|
label="Draw",
|
|
|
|
|
icon="brush.gpencil_draw.draw",
|
|
|
|
|
data_block='DRAW',
|
|
|
|
|
)
|
2023-07-21 14:23:49 +02:00
|
|
|
|
2023-07-20 13:56:23 +02:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def erase():
|
|
|
|
|
return dict(
|
|
|
|
|
idname="builtin_brush.Erase",
|
|
|
|
|
label="Erase",
|
|
|
|
|
icon="brush.gpencil_draw.erase",
|
|
|
|
|
data_block='ERASE',
|
|
|
|
|
)
|
2023-07-03 16:34:30 +02:00
|
|
|
|
|
|
|
|
|
2018-10-04 12:04:36 +10:00
|
|
|
class _defs_image_generic:
|
2023-02-14 10:30:49 +01:00
|
|
|
|
2018-10-05 13:07:01 +10:00
|
|
|
@staticmethod
|
|
|
|
|
def poll_uvedit(context):
|
2019-03-31 18:43:14 +02:00
|
|
|
if context is None:
|
|
|
|
|
return True
|
2018-10-05 13:07:01 +10:00
|
|
|
ob = context.edit_object
|
|
|
|
|
if ob is not None:
|
|
|
|
|
data = ob.data
|
|
|
|
|
if data is not None:
|
|
|
|
|
return bool(getattr(data, "uv_layers", False))
|
|
|
|
|
return False
|
|
|
|
|
|
2018-10-04 12:04:36 +10:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def cursor():
|
|
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.cursor",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Cursor",
|
2023-02-14 10:30:49 +01:00
|
|
|
description=(
|
|
|
|
|
"Set the cursor location, drag to transform"
|
|
|
|
|
),
|
2018-10-04 12:04:36 +10:00
|
|
|
icon="ops.generic.cursor",
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-10-04 12:04:36 +10:00
|
|
|
)
|
|
|
|
|
|
2019-03-07 14:03:59 +11:00
|
|
|
# Currently a place holder so we can switch away from the annotation tool.
|
|
|
|
|
# Falls back to default image editor action.
|
|
|
|
|
@ToolDef.from_fn
|
2019-03-07 18:02:52 +11:00
|
|
|
def sample():
|
2019-04-19 07:32:24 +02:00
|
|
|
def draw_settings(_context, layout, tool):
|
2019-03-07 18:02:52 +11:00
|
|
|
props = tool.operator_properties("image.sample")
|
2019-03-08 00:36:48 +11:00
|
|
|
layout.prop(props, "size")
|
2019-03-07 14:03:59 +11:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.sample",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Sample",
|
2023-02-14 10:30:49 +01:00
|
|
|
description=(
|
|
|
|
|
"Sample pixel values under the cursor"
|
|
|
|
|
),
|
2019-03-07 18:02:52 +11:00
|
|
|
icon="ops.paint.weight_sample", # XXX, needs own icon.
|
|
|
|
|
keymap="Image Editor Tool: Sample",
|
|
|
|
|
draw_settings=draw_settings,
|
2019-03-07 14:03:59 +11:00
|
|
|
)
|
|
|
|
|
|
2018-10-04 12:04:36 +10:00
|
|
|
|
|
|
|
|
class _defs_image_uv_transform:
|
2023-02-14 10:30:49 +01:00
|
|
|
|
2019-06-26 01:39:58 +10:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def translate():
|
|
|
|
|
return dict(
|
|
|
|
|
idname="builtin.move",
|
|
|
|
|
label="Move",
|
|
|
|
|
icon="ops.transform.translate",
|
2019-12-13 19:33:49 +11:00
|
|
|
widget="IMAGE_GGT_gizmo2d_translate",
|
2019-06-26 01:39:58 +10:00
|
|
|
operator="transform.translate",
|
2024-02-09 17:38:44 +11:00
|
|
|
keymap="Image Editor Tool: Uv, Move",
|
2019-06-26 01:39:58 +10:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def rotate():
|
|
|
|
|
return dict(
|
|
|
|
|
idname="builtin.rotate",
|
|
|
|
|
label="Rotate",
|
|
|
|
|
icon="ops.transform.rotate",
|
2019-12-13 19:33:49 +11:00
|
|
|
widget="IMAGE_GGT_gizmo2d_rotate",
|
2019-06-26 01:39:58 +10:00
|
|
|
operator="transform.rotate",
|
2024-02-09 17:38:44 +11:00
|
|
|
keymap="Image Editor Tool: Uv, Rotate",
|
2019-06-26 01:39:58 +10:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def scale():
|
|
|
|
|
return dict(
|
|
|
|
|
idname="builtin.scale",
|
|
|
|
|
label="Scale",
|
|
|
|
|
icon="ops.transform.resize",
|
2019-12-13 19:33:49 +11:00
|
|
|
widget="IMAGE_GGT_gizmo2d_resize",
|
2019-06-26 01:39:58 +10:00
|
|
|
operator="transform.resize",
|
2024-02-09 17:38:44 +11:00
|
|
|
keymap="Image Editor Tool: Uv, Scale",
|
2019-06-26 01:39:58 +10:00
|
|
|
)
|
|
|
|
|
|
2018-10-04 12:04:36 +10:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def transform():
|
|
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.transform",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Transform",
|
2023-02-14 10:30:49 +01:00
|
|
|
description=(
|
|
|
|
|
"Supports any combination of grab, rotate, and scale at once"
|
|
|
|
|
),
|
2018-10-04 12:04:36 +10:00
|
|
|
icon="ops.transform.transform",
|
|
|
|
|
widget="IMAGE_GGT_gizmo2d",
|
|
|
|
|
# No keymap default action, only for gizmo!
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class _defs_image_uv_select:
|
2023-02-14 10:30:49 +01:00
|
|
|
|
2018-05-16 18:41:11 +02:00
|
|
|
@ToolDef.from_fn
|
2018-11-22 16:05:28 +01:00
|
|
|
def select():
|
|
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.select",
|
2019-09-04 11:55:36 +02:00
|
|
|
label="Tweak",
|
2018-11-22 16:05:28 +01:00
|
|
|
icon="ops.generic.select",
|
|
|
|
|
widget=None,
|
|
|
|
|
keymap=(),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def box():
|
2019-04-19 07:32:24 +02:00
|
|
|
def draw_settings(_context, layout, tool):
|
2018-10-05 10:27:04 +10:00
|
|
|
props = tool.operator_properties("uv.select_box")
|
2019-05-06 15:59:34 +02:00
|
|
|
row = layout.row()
|
|
|
|
|
row.use_property_split = False
|
|
|
|
|
row.prop(props, "mode", text="", expand=True, icon_only=True)
|
2018-05-16 18:41:11 +02:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.select_box",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Select Box",
|
2018-10-05 10:27:04 +10:00
|
|
|
icon="ops.generic.select_box",
|
2018-05-16 18:41:11 +02:00
|
|
|
widget=None,
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-10-04 15:12:28 +10:00
|
|
|
draw_settings=draw_settings,
|
2018-05-16 18:41:11 +02:00
|
|
|
)
|
|
|
|
|
|
2018-11-13 14:05:20 +11:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def lasso():
|
2019-04-19 07:32:24 +02:00
|
|
|
def draw_settings(_context, layout, tool):
|
2018-11-23 17:52:28 +11:00
|
|
|
props = tool.operator_properties("uv.select_lasso")
|
2019-05-06 15:59:34 +02:00
|
|
|
row = layout.row()
|
|
|
|
|
row.use_property_split = False
|
|
|
|
|
row.prop(props, "mode", text="", expand=True, icon_only=True)
|
2018-11-13 14:05:20 +11:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.select_lasso",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Select Lasso",
|
2018-11-13 14:05:20 +11:00
|
|
|
icon="ops.generic.select_lasso",
|
|
|
|
|
widget=None,
|
2018-12-14 13:21:13 +11:00
|
|
|
keymap=(),
|
2018-11-23 17:52:28 +11:00
|
|
|
draw_settings=draw_settings,
|
2018-11-13 14:05:20 +11:00
|
|
|
)
|
|
|
|
|
|
2018-05-16 18:41:11 +02:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def circle():
|
2019-04-19 07:32:24 +02:00
|
|
|
def draw_settings(_context, layout, tool):
|
2018-10-04 15:12:28 +10:00
|
|
|
props = tool.operator_properties("uv.select_circle")
|
2019-05-06 15:59:34 +02:00
|
|
|
row = layout.row()
|
|
|
|
|
row.use_property_split = False
|
|
|
|
|
row.prop(props, "mode", text="", expand=True, icon_only=True)
|
2018-10-04 15:12:28 +10:00
|
|
|
layout.prop(props, "radius")
|
2019-05-30 21:28:04 +10:00
|
|
|
|
|
|
|
|
def draw_cursor(_context, tool, xy):
|
|
|
|
|
from gpu_extras.presets import draw_circle_2d
|
|
|
|
|
props = tool.operator_properties("uv.select_circle")
|
|
|
|
|
radius = props.radius
|
PyAPI: use keyword only arguments
Use keyword only arguments for the following functions.
- addon_utils.module_bl_info 2nd arg `info_basis`.
- addon_utils.modules 1st `module_cache`, 2nd arg `refresh`.
- addon_utils.modules_refresh 1st arg `module_cache`.
- bl_app_template_utils.activate 1nd arg `template_id`.
- bl_app_template_utils.import_from_id 2nd arg `ignore_not_found`.
- bl_app_template_utils.import_from_path 2nd arg `ignore_not_found`.
- bl_keymap_utils.keymap_from_toolbar.generate 2nd & 3rd args `use_fallback_keys` & `use_reset`.
- bl_keymap_utils.platform_helpers.keyconfig_data_oskey_from_ctrl 2nd arg `filter_fn`.
- bl_ui_utils.bug_report_url.url_prefill_from_blender 1st arg `addon_info`.
- bmesh.types.BMFace.copy 1st & 2nd args `verts`, `edges`.
- bmesh.types.BMesh.calc_volume 1st arg `signed`.
- bmesh.types.BMesh.from_mesh 2nd..4th args `face_normals`, `use_shape_key`, `shape_key_index`.
- bmesh.types.BMesh.from_object 3rd & 4th args `cage`, `face_normals`.
- bmesh.types.BMesh.transform 2nd arg `filter`.
- bmesh.types.BMesh.update_edit_mesh 2nd & 3rd args `loop_triangles`, `destructive`.
- bmesh.types.{BMVertSeq,BMEdgeSeq,BMFaceSeq}.sort 1st & 2nd arg `key`, `reverse`.
- bmesh.utils.face_split 4th..6th args `coords`, `use_exist`, `example`.
- bpy.data.libraries.load 2nd..4th args `link`, `relative`, `assets_only`.
- bpy.data.user_map 1st..3rd args `subset`, `key_types, `value_types`.
- bpy.msgbus.subscribe_rna 5th arg `options`.
- bpy.path.abspath 2nd & 3rd args `start` & `library`.
- bpy.path.clean_name 2nd arg `replace`.
- bpy.path.ensure_ext 3rd arg `case_sensitive`.
- bpy.path.module_names 2nd arg `recursive`.
- bpy.path.relpath 2nd arg `start`.
- bpy.types.EditBone.transform 2nd & 3rd arg `scale`, `roll`.
- bpy.types.Operator.as_keywords 1st arg `ignore`.
- bpy.types.Struct.{keyframe_insert,keyframe_delete} 2nd..5th args `index`, `frame`, `group`, `options`.
- bpy.types.WindowManager.popup_menu 2nd & 3rd arg `title`, `icon`.
- bpy.types.WindowManager.popup_menu_pie 3rd & 4th arg `title`, `icon`.
- bpy.utils.app_template_paths 1st arg `subdir`.
- bpy.utils.app_template_paths 1st arg `subdir`.
- bpy.utils.blend_paths 1st..3rd args `absolute`, `packed`, `local`.
- bpy.utils.execfile 2nd arg `mod`.
- bpy.utils.keyconfig_set 2nd arg `report`.
- bpy.utils.load_scripts 1st & 2nd `reload_scripts` & `refresh_scripts`.
- bpy.utils.preset_find 3rd & 4th args `display_name`, `ext`.
- bpy.utils.resource_path 2nd & 3rd arg `major`, `minor`.
- bpy.utils.script_paths 1st..4th args `subdir`, `user_pref`, `check_all`, `use_user`.
- bpy.utils.smpte_from_frame 2nd & 3rd args `fps`, `fps_base`.
- bpy.utils.smpte_from_seconds 2nd & 3rd args `fps`, `fps_base`.
- bpy.utils.system_resource 2nd arg `subdir`.
- bpy.utils.time_from_frame 2nd & 3rd args `fps`, `fps_base`.
- bpy.utils.time_to_frame 2nd & 3rd args `fps`, `fps_base`.
- bpy.utils.units.to_string 4th..6th `precision`, `split_unit`, `compatible_unit`.
- bpy.utils.units.to_value 4th arg `str_ref_unit`.
- bpy.utils.user_resource 2nd & 3rd args `subdir`, `create`
- bpy_extras.view3d_utils.location_3d_to_region_2d 4th arg `default`.
- bpy_extras.view3d_utils.region_2d_to_origin_3d 4th arg `clamp`.
- gpu.offscreen.unbind 1st arg `restore`.
- gpu_extras.batch.batch_for_shader 4th arg `indices`.
- gpu_extras.batch.presets.draw_circle_2d 4th arg `segments`.
- gpu_extras.presets.draw_circle_2d 4th arg `segments`.
- imbuf.types.ImBuf.resize 2nd arg `resize`.
- imbuf.write 2nd arg `filepath`.
- mathutils.kdtree.KDTree.find 2nd arg `filter`.
- nodeitems_utils.NodeCategory 3rd & 4th arg `descriptions`, `items`.
- nodeitems_utils.NodeItem 2nd..4th args `label`, `settings`, `poll`.
- nodeitems_utils.NodeItemCustom 1st & 2nd arg `poll`, `draw`.
- rna_prop_ui.draw 5th arg `use_edit`.
- rna_prop_ui.rna_idprop_ui_get 2nd arg `create`.
- rna_prop_ui.rna_idprop_ui_prop_clear 3rd arg `remove`.
- rna_prop_ui.rna_idprop_ui_prop_get 3rd arg `create`.
- rna_xml.xml2rna 2nd arg `root_rna`.
- rna_xml.xml_file_write 4th arg `skip_typemap`.
2021-06-08 18:03:14 +10:00
|
|
|
draw_circle_2d(xy, (1.0,) * 4, radius, segments=32)
|
2019-05-30 21:28:04 +10:00
|
|
|
|
2018-05-16 18:41:11 +02:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.select_circle",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Select Circle",
|
2018-05-16 18:41:11 +02:00
|
|
|
icon="ops.generic.select_circle",
|
|
|
|
|
widget=None,
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-10-04 15:12:28 +10:00
|
|
|
draw_settings=draw_settings,
|
2019-05-30 21:28:04 +10:00
|
|
|
draw_cursor=draw_cursor,
|
2018-05-16 18:41:11 +02:00
|
|
|
)
|
|
|
|
|
|
2018-07-31 21:06:08 +10:00
|
|
|
|
2020-07-06 21:14:12 +10:00
|
|
|
class _defs_image_uv_edit:
|
2023-02-14 10:30:49 +01:00
|
|
|
|
2020-07-06 21:14:12 +10:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def rip_region():
|
|
|
|
|
return dict(
|
|
|
|
|
idname="builtin.rip_region",
|
|
|
|
|
label="Rip Region",
|
|
|
|
|
icon="ops.mesh.rip",
|
|
|
|
|
# TODO: generic operator (UV version of `VIEW3D_GGT_tool_generic_handle_free`).
|
|
|
|
|
widget=None,
|
|
|
|
|
keymap=(),
|
2023-02-14 10:30:49 +01:00
|
|
|
options={'KEYMAP_FALLBACK'},
|
2020-07-06 21:14:12 +10:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
2018-10-05 13:07:01 +10:00
|
|
|
class _defs_image_uv_sculpt:
|
2023-02-14 10:30:49 +01:00
|
|
|
|
2018-10-05 13:07:01 +10:00
|
|
|
@staticmethod
|
|
|
|
|
def generate_from_brushes(context):
|
2019-05-01 18:10:34 +10:00
|
|
|
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:
|
|
|
|
|
return
|
|
|
|
|
ups = tool_settings.unified_paint_settings
|
|
|
|
|
if ups.use_unified_size:
|
|
|
|
|
radius = ups.size
|
|
|
|
|
else:
|
|
|
|
|
brush = tool_settings.uv_sculpt.brush
|
|
|
|
|
if brush is None:
|
|
|
|
|
return
|
|
|
|
|
radius = brush.size
|
2022-08-03 09:38:51 +12:00
|
|
|
draw_circle_2d(xy, (1.0,) * 4, radius)
|
2019-05-01 18:10:34 +10:00
|
|
|
|
2018-10-05 13:07:01 +10:00
|
|
|
return generate_from_enum_ex(
|
|
|
|
|
context,
|
2019-03-15 14:18:21 +11:00
|
|
|
idname_prefix="builtin_brush.",
|
2018-10-05 13:07:01 +10:00
|
|
|
icon_prefix="brush.uv_sculpt.",
|
2019-05-01 18:10:34 +10:00
|
|
|
type=bpy.types.Brush,
|
2018-10-05 13:07:01 +10:00
|
|
|
attr="uv_sculpt_tool",
|
2019-05-01 18:10:34 +10:00
|
|
|
tooldef_keywords=dict(
|
|
|
|
|
operator="sculpt.uv_sculpt_stroke",
|
2024-02-09 17:38:44 +11:00
|
|
|
keymap="Image Editor Tool: Uv, Sculpt Stroke",
|
2019-05-01 18:10:34 +10:00
|
|
|
draw_cursor=draw_cursor,
|
2023-02-14 10:30:49 +01:00
|
|
|
options={'KEYMAP_FALLBACK'},
|
2019-05-01 18:10:34 +10:00
|
|
|
),
|
2018-10-05 13:07:01 +10:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
class _defs_gpencil_paint:
|
2023-02-14 10:30:49 +01:00
|
|
|
|
2020-08-11 15:26:15 +02:00
|
|
|
@staticmethod
|
2021-03-06 18:21:17 +11:00
|
|
|
def gpencil_primitive_toolbar(context, layout, _tool, props):
|
2020-08-11 15:26:15 +02:00
|
|
|
paint = context.tool_settings.gpencil_paint
|
|
|
|
|
brush = paint.brush
|
|
|
|
|
|
|
|
|
|
if brush is None:
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
gp_settings = brush.gpencil_settings
|
|
|
|
|
|
|
|
|
|
row = layout.row(align=True)
|
|
|
|
|
tool_settings = context.scene.tool_settings
|
|
|
|
|
settings = tool_settings.gpencil_paint
|
|
|
|
|
row.template_ID_preview(settings, "brush", rows=3, cols=8, hide_buttons=True)
|
|
|
|
|
|
|
|
|
|
from bl_ui.properties_paint_common import (
|
|
|
|
|
brush_basic_gpencil_paint_settings,
|
|
|
|
|
brush_basic__draw_color_selector,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
brush_basic__draw_color_selector(context, layout, brush, gp_settings, props)
|
|
|
|
|
brush_basic_gpencil_paint_settings(layout, context, brush, compact=True)
|
2021-08-09 15:05:04 +10:00
|
|
|
return True
|
2020-08-11 15:26:15 +02:00
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
@staticmethod
|
|
|
|
|
def generate_from_brushes(context):
|
2018-11-06 12:08:39 +11:00
|
|
|
return generate_from_enum_ex(
|
|
|
|
|
context,
|
2019-03-15 14:18:21 +11:00
|
|
|
idname_prefix="builtin_brush.",
|
2018-11-03 20:33:59 +11:00
|
|
|
icon_prefix="brush.gpencil_draw.",
|
2018-11-06 12:08:39 +11:00
|
|
|
type=bpy.types.Brush,
|
|
|
|
|
attr="gpencil_tool",
|
2023-02-14 10:30:49 +01:00
|
|
|
cursor='DOT',
|
2018-11-02 09:10:23 +11:00
|
|
|
tooldef_keywords=dict(
|
|
|
|
|
operator="gpencil.draw",
|
|
|
|
|
),
|
2018-07-31 10:22:19 +02:00
|
|
|
)
|
|
|
|
|
|
2019-01-11 19:15:23 +01:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def cutter():
|
2021-03-06 18:21:17 +11:00
|
|
|
def draw_settings(_context, layout, tool):
|
2020-10-22 17:35:48 +02:00
|
|
|
props = tool.operator_properties("gpencil.stroke_cutter")
|
|
|
|
|
row = layout.row()
|
|
|
|
|
row.use_property_split = False
|
|
|
|
|
row.prop(props, "flat_caps")
|
2019-01-11 19:15:23 +01:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.cutter",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Cutter",
|
2019-01-11 19:15:23 +01:00
|
|
|
icon="ops.gpencil.stroke_cutter",
|
2023-02-14 10:30:49 +01:00
|
|
|
cursor='KNIFE',
|
2019-01-11 19:15:23 +01:00
|
|
|
widget=None,
|
|
|
|
|
keymap=(),
|
2020-10-22 17:35:48 +02:00
|
|
|
draw_settings=draw_settings,
|
2019-01-11 19:15:23 +01:00
|
|
|
)
|
|
|
|
|
|
2018-11-14 19:19:04 +11:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def line():
|
2020-08-11 15:26:15 +02:00
|
|
|
def draw_settings(context, layout, tool):
|
|
|
|
|
props = tool.operator_properties("gpencil.primitive_line")
|
|
|
|
|
_defs_gpencil_paint.gpencil_primitive_toolbar(context, layout, tool, props)
|
|
|
|
|
|
2018-11-09 17:05:32 +11:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.line",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Line",
|
2018-11-09 17:05:32 +11:00
|
|
|
icon="ops.gpencil.primitive_line",
|
2023-02-14 10:30:49 +01:00
|
|
|
cursor='CROSSHAIR',
|
2018-11-09 17:05:32 +11:00
|
|
|
widget=None,
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2020-08-11 15:26:15 +02:00
|
|
|
draw_settings=draw_settings,
|
2018-11-09 17:05:32 +11:00
|
|
|
)
|
|
|
|
|
|
2019-10-18 22:02:45 +01:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def polyline():
|
2020-08-11 15:26:15 +02:00
|
|
|
def draw_settings(context, layout, tool):
|
|
|
|
|
props = tool.operator_properties("gpencil.primitive_polyline")
|
|
|
|
|
_defs_gpencil_paint.gpencil_primitive_toolbar(context, layout, tool, props)
|
|
|
|
|
|
2019-10-18 22:02:45 +01:00
|
|
|
return dict(
|
|
|
|
|
idname="builtin.polyline",
|
|
|
|
|
label="Polyline",
|
|
|
|
|
icon="ops.gpencil.primitive_polyline",
|
2023-02-14 10:30:49 +01:00
|
|
|
cursor='CROSSHAIR',
|
2019-10-18 22:02:45 +01:00
|
|
|
widget=None,
|
|
|
|
|
keymap=(),
|
2020-08-11 15:26:15 +02:00
|
|
|
draw_settings=draw_settings,
|
2019-10-23 01:03:31 +11:00
|
|
|
)
|
2019-10-18 22:02:45 +01:00
|
|
|
|
2018-11-14 19:19:04 +11:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def box():
|
2020-08-11 15:26:15 +02:00
|
|
|
def draw_settings(context, layout, tool):
|
|
|
|
|
props = tool.operator_properties("gpencil.primitive_box")
|
|
|
|
|
_defs_gpencil_paint.gpencil_primitive_toolbar(context, layout, tool, props)
|
|
|
|
|
|
2018-11-09 17:05:32 +11:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.box",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Box",
|
2018-11-09 17:05:32 +11:00
|
|
|
icon="ops.gpencil.primitive_box",
|
2023-02-14 10:30:49 +01:00
|
|
|
cursor='CROSSHAIR',
|
2018-11-09 17:05:32 +11:00
|
|
|
widget=None,
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2020-08-11 15:26:15 +02:00
|
|
|
draw_settings=draw_settings,
|
2018-11-09 17:05:32 +11:00
|
|
|
)
|
|
|
|
|
|
2018-11-14 19:19:04 +11:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def circle():
|
2020-08-11 15:26:15 +02:00
|
|
|
def draw_settings(context, layout, tool):
|
|
|
|
|
props = tool.operator_properties("gpencil.primitive_circle")
|
|
|
|
|
_defs_gpencil_paint.gpencil_primitive_toolbar(context, layout, tool, props)
|
|
|
|
|
|
2018-11-09 17:05:32 +11:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.circle",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Circle",
|
2018-11-09 17:05:32 +11:00
|
|
|
icon="ops.gpencil.primitive_circle",
|
2023-02-14 10:30:49 +01:00
|
|
|
cursor='CROSSHAIR',
|
2018-11-09 17:05:32 +11:00
|
|
|
widget=None,
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2020-08-11 15:26:15 +02:00
|
|
|
draw_settings=draw_settings,
|
2018-11-09 17:05:32 +11:00
|
|
|
)
|
|
|
|
|
|
2018-12-03 14:55:57 +00:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def arc():
|
2020-08-11 15:26:15 +02:00
|
|
|
def draw_settings(context, layout, tool):
|
|
|
|
|
props = tool.operator_properties("gpencil.primitive_curve")
|
|
|
|
|
_defs_gpencil_paint.gpencil_primitive_toolbar(context, layout, tool, props)
|
|
|
|
|
|
2018-12-03 14:55:57 +00:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.arc",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Arc",
|
2018-12-03 14:55:57 +00:00
|
|
|
icon="ops.gpencil.primitive_arc",
|
2023-02-14 10:30:49 +01:00
|
|
|
cursor='CROSSHAIR',
|
2018-12-03 14:55:57 +00:00
|
|
|
widget=None,
|
|
|
|
|
keymap=(),
|
2020-08-11 15:26:15 +02:00
|
|
|
draw_settings=draw_settings,
|
2018-12-03 14:55:57 +00:00
|
|
|
)
|
2018-12-15 17:21:47 +01:00
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def curve():
|
2020-08-11 15:26:15 +02:00
|
|
|
def draw_settings(context, layout, tool):
|
|
|
|
|
props = tool.operator_properties("gpencil.primitive_curve")
|
|
|
|
|
_defs_gpencil_paint.gpencil_primitive_toolbar(context, layout, tool, props)
|
|
|
|
|
|
2018-12-15 17:21:47 +01:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.curve",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Curve",
|
2018-12-15 17:21:47 +01:00
|
|
|
icon="ops.gpencil.primitive_curve",
|
2023-02-14 10:30:49 +01:00
|
|
|
cursor='CROSSHAIR',
|
2018-12-15 17:21:47 +01:00
|
|
|
widget=None,
|
|
|
|
|
keymap=(),
|
2020-08-11 15:26:15 +02:00
|
|
|
draw_settings=draw_settings,
|
2019-10-23 01:03:31 +11:00
|
|
|
)
|
2018-07-31 10:22:19 +02:00
|
|
|
|
2019-10-11 13:28:22 +02:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def eyedropper():
|
2021-03-06 18:21:17 +11:00
|
|
|
def draw_settings(_context, layout, tool):
|
2020-03-09 16:27:24 +01:00
|
|
|
props = tool.operator_properties("ui.eyedropper_gpencil_color")
|
|
|
|
|
row = layout.row()
|
|
|
|
|
row.use_property_split = False
|
|
|
|
|
row.prop(props, "mode", expand=True)
|
2019-10-11 13:28:22 +02:00
|
|
|
return dict(
|
|
|
|
|
idname="builtin.eyedropper",
|
|
|
|
|
label="Eyedropper",
|
2019-10-30 11:11:26 +01:00
|
|
|
icon="ops.paint.eyedropper_add",
|
2023-02-14 10:30:49 +01:00
|
|
|
cursor='EYEDROPPER',
|
2019-10-11 13:28:22 +02:00
|
|
|
widget=None,
|
|
|
|
|
keymap=(),
|
2020-03-09 16:27:24 +01:00
|
|
|
draw_settings=draw_settings,
|
2019-10-11 13:28:22 +02:00
|
|
|
)
|
|
|
|
|
|
2021-02-19 17:18:12 +01:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def interpolate():
|
2021-03-06 18:21:17 +11:00
|
|
|
def draw_settings(_context, layout, tool):
|
2021-02-19 17:18:12 +01:00
|
|
|
props = tool.operator_properties("gpencil.interpolate")
|
2021-02-22 16:12:40 +01:00
|
|
|
layout.prop(props, "layers")
|
2022-11-28 19:32:18 +01:00
|
|
|
layout.prop(props, "exclude_breakdowns")
|
2021-02-22 16:12:40 +01:00
|
|
|
layout.prop(props, "flip")
|
|
|
|
|
layout.prop(props, "smooth_factor")
|
|
|
|
|
layout.prop(props, "smooth_steps")
|
2021-02-19 17:18:12 +01:00
|
|
|
|
|
|
|
|
return dict(
|
|
|
|
|
idname="builtin.interpolate",
|
|
|
|
|
label="Interpolate",
|
|
|
|
|
icon="ops.pose.breakdowner",
|
2023-02-14 10:30:49 +01:00
|
|
|
cursor='DEFAULT',
|
2021-02-19 17:18:12 +01:00
|
|
|
widget=None,
|
|
|
|
|
keymap=(),
|
|
|
|
|
draw_settings=draw_settings,
|
|
|
|
|
)
|
|
|
|
|
|
2019-10-12 10:22:09 +11:00
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
class _defs_gpencil_edit:
|
2020-03-25 17:34:11 +01:00
|
|
|
def is_segment(context):
|
2023-04-13 13:14:01 +10:00
|
|
|
tool_settings = context.scene.tool_settings
|
2023-02-14 10:30:49 +01:00
|
|
|
if context.mode == 'EDIT_GPENCIL':
|
2023-04-13 13:14:01 +10:00
|
|
|
return tool_settings.gpencil_selectmode_edit == 'SEGMENT'
|
2023-02-14 10:30:49 +01:00
|
|
|
elif context.mode == 'SCULPT_GPENCIL':
|
2023-04-13 13:14:01 +10:00
|
|
|
return tool_settings.use_gpencil_select_mask_segment
|
2023-02-14 10:30:49 +01:00
|
|
|
elif context.mode == 'VERTEX_GPENCIL':
|
2023-04-13 13:14:01 +10:00
|
|
|
return tool_settings.use_gpencil_vertex_select_mask_segment
|
2020-03-25 17:34:11 +01:00
|
|
|
else:
|
|
|
|
|
return False
|
|
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def bend():
|
|
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.bend",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Bend",
|
2018-07-31 10:22:19 +02:00
|
|
|
icon="ops.gpencil.edit_bend",
|
|
|
|
|
widget=None,
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-07-31 10:22:19 +02:00
|
|
|
)
|
|
|
|
|
|
2018-11-22 16:05:28 +01:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def select():
|
2019-04-19 07:32:24 +02:00
|
|
|
def draw_settings(context, layout, _tool):
|
2020-03-25 17:34:11 +01:00
|
|
|
if _defs_gpencil_edit.is_segment(context):
|
2023-02-14 10:30:49 +01:00
|
|
|
layout.prop(context.tool_settings.gpencil_sculpt, "intersection_threshold")
|
2018-11-22 16:05:28 +01:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.select",
|
2019-09-04 11:55:36 +02:00
|
|
|
label="Tweak",
|
2018-11-22 16:05:28 +01:00
|
|
|
icon="ops.generic.select",
|
|
|
|
|
widget=None,
|
|
|
|
|
keymap=(),
|
|
|
|
|
draw_settings=draw_settings,
|
|
|
|
|
)
|
|
|
|
|
|
2018-09-21 10:28:51 +02:00
|
|
|
@ToolDef.from_fn
|
2018-10-05 10:27:04 +10:00
|
|
|
def box_select():
|
2018-11-13 14:05:20 +11:00
|
|
|
def draw_settings(context, layout, tool):
|
|
|
|
|
props = tool.operator_properties("gpencil.select_box")
|
2019-05-06 15:59:34 +02:00
|
|
|
row = layout.row()
|
|
|
|
|
row.use_property_split = False
|
|
|
|
|
row.prop(props, "mode", text="", expand=True, icon_only=True)
|
2020-03-25 17:34:11 +01:00
|
|
|
if _defs_gpencil_edit.is_segment(context):
|
2023-02-14 10:30:49 +01:00
|
|
|
layout.prop(context.tool_settings.gpencil_sculpt, "intersection_threshold")
|
2018-09-21 10:28:51 +02:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.select_box",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Select Box",
|
2018-10-05 10:27:04 +10:00
|
|
|
icon="ops.generic.select_box",
|
2018-09-21 10:28:51 +02:00
|
|
|
widget=None,
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-11-13 14:05:20 +11:00
|
|
|
draw_settings=draw_settings,
|
2018-09-21 10:28:51 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
2018-11-13 14:05:20 +11:00
|
|
|
def lasso_select():
|
|
|
|
|
def draw_settings(context, layout, tool):
|
|
|
|
|
props = tool.operator_properties("gpencil.select_lasso")
|
2019-05-06 15:59:34 +02:00
|
|
|
row = layout.row()
|
|
|
|
|
row.use_property_split = False
|
|
|
|
|
row.prop(props, "mode", text="", expand=True, icon_only=True)
|
2020-03-25 17:34:11 +01:00
|
|
|
if _defs_gpencil_edit.is_segment(context):
|
2023-02-14 10:30:49 +01:00
|
|
|
layout.prop(context.tool_settings.gpencil_sculpt, "intersection_threshold")
|
2018-09-21 10:28:51 +02:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.select_lasso",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Select Lasso",
|
2018-11-13 14:05:20 +11:00
|
|
|
icon="ops.generic.select_lasso",
|
2018-09-21 10:28:51 +02:00
|
|
|
widget=None,
|
2018-11-15 12:22:36 +11:00
|
|
|
keymap=(),
|
2018-11-13 14:05:20 +11:00
|
|
|
draw_settings=draw_settings,
|
2018-09-21 10:28:51 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
2018-11-13 14:05:20 +11:00
|
|
|
def circle_select():
|
2019-01-11 19:15:23 +01:00
|
|
|
def draw_settings(context, layout, tool):
|
2019-03-05 22:26:45 +11:00
|
|
|
props = tool.operator_properties("gpencil.select_circle")
|
2019-05-06 15:59:34 +02:00
|
|
|
row = layout.row()
|
|
|
|
|
row.use_property_split = False
|
|
|
|
|
row.prop(props, "mode", text="", expand=True, icon_only=True)
|
2019-03-05 22:26:45 +11:00
|
|
|
layout.prop(props, "radius")
|
2020-03-25 17:34:11 +01:00
|
|
|
if _defs_gpencil_edit.is_segment(context):
|
2023-02-14 10:30:49 +01:00
|
|
|
layout.prop(context.tool_settings.gpencil_sculpt, "intersection_threshold")
|
2019-05-30 21:28:04 +10:00
|
|
|
|
|
|
|
|
def draw_cursor(_context, tool, xy):
|
|
|
|
|
from gpu_extras.presets import draw_circle_2d
|
|
|
|
|
props = tool.operator_properties("gpencil.select_circle")
|
|
|
|
|
radius = props.radius
|
PyAPI: use keyword only arguments
Use keyword only arguments for the following functions.
- addon_utils.module_bl_info 2nd arg `info_basis`.
- addon_utils.modules 1st `module_cache`, 2nd arg `refresh`.
- addon_utils.modules_refresh 1st arg `module_cache`.
- bl_app_template_utils.activate 1nd arg `template_id`.
- bl_app_template_utils.import_from_id 2nd arg `ignore_not_found`.
- bl_app_template_utils.import_from_path 2nd arg `ignore_not_found`.
- bl_keymap_utils.keymap_from_toolbar.generate 2nd & 3rd args `use_fallback_keys` & `use_reset`.
- bl_keymap_utils.platform_helpers.keyconfig_data_oskey_from_ctrl 2nd arg `filter_fn`.
- bl_ui_utils.bug_report_url.url_prefill_from_blender 1st arg `addon_info`.
- bmesh.types.BMFace.copy 1st & 2nd args `verts`, `edges`.
- bmesh.types.BMesh.calc_volume 1st arg `signed`.
- bmesh.types.BMesh.from_mesh 2nd..4th args `face_normals`, `use_shape_key`, `shape_key_index`.
- bmesh.types.BMesh.from_object 3rd & 4th args `cage`, `face_normals`.
- bmesh.types.BMesh.transform 2nd arg `filter`.
- bmesh.types.BMesh.update_edit_mesh 2nd & 3rd args `loop_triangles`, `destructive`.
- bmesh.types.{BMVertSeq,BMEdgeSeq,BMFaceSeq}.sort 1st & 2nd arg `key`, `reverse`.
- bmesh.utils.face_split 4th..6th args `coords`, `use_exist`, `example`.
- bpy.data.libraries.load 2nd..4th args `link`, `relative`, `assets_only`.
- bpy.data.user_map 1st..3rd args `subset`, `key_types, `value_types`.
- bpy.msgbus.subscribe_rna 5th arg `options`.
- bpy.path.abspath 2nd & 3rd args `start` & `library`.
- bpy.path.clean_name 2nd arg `replace`.
- bpy.path.ensure_ext 3rd arg `case_sensitive`.
- bpy.path.module_names 2nd arg `recursive`.
- bpy.path.relpath 2nd arg `start`.
- bpy.types.EditBone.transform 2nd & 3rd arg `scale`, `roll`.
- bpy.types.Operator.as_keywords 1st arg `ignore`.
- bpy.types.Struct.{keyframe_insert,keyframe_delete} 2nd..5th args `index`, `frame`, `group`, `options`.
- bpy.types.WindowManager.popup_menu 2nd & 3rd arg `title`, `icon`.
- bpy.types.WindowManager.popup_menu_pie 3rd & 4th arg `title`, `icon`.
- bpy.utils.app_template_paths 1st arg `subdir`.
- bpy.utils.app_template_paths 1st arg `subdir`.
- bpy.utils.blend_paths 1st..3rd args `absolute`, `packed`, `local`.
- bpy.utils.execfile 2nd arg `mod`.
- bpy.utils.keyconfig_set 2nd arg `report`.
- bpy.utils.load_scripts 1st & 2nd `reload_scripts` & `refresh_scripts`.
- bpy.utils.preset_find 3rd & 4th args `display_name`, `ext`.
- bpy.utils.resource_path 2nd & 3rd arg `major`, `minor`.
- bpy.utils.script_paths 1st..4th args `subdir`, `user_pref`, `check_all`, `use_user`.
- bpy.utils.smpte_from_frame 2nd & 3rd args `fps`, `fps_base`.
- bpy.utils.smpte_from_seconds 2nd & 3rd args `fps`, `fps_base`.
- bpy.utils.system_resource 2nd arg `subdir`.
- bpy.utils.time_from_frame 2nd & 3rd args `fps`, `fps_base`.
- bpy.utils.time_to_frame 2nd & 3rd args `fps`, `fps_base`.
- bpy.utils.units.to_string 4th..6th `precision`, `split_unit`, `compatible_unit`.
- bpy.utils.units.to_value 4th arg `str_ref_unit`.
- bpy.utils.user_resource 2nd & 3rd args `subdir`, `create`
- bpy_extras.view3d_utils.location_3d_to_region_2d 4th arg `default`.
- bpy_extras.view3d_utils.region_2d_to_origin_3d 4th arg `clamp`.
- gpu.offscreen.unbind 1st arg `restore`.
- gpu_extras.batch.batch_for_shader 4th arg `indices`.
- gpu_extras.batch.presets.draw_circle_2d 4th arg `segments`.
- gpu_extras.presets.draw_circle_2d 4th arg `segments`.
- imbuf.types.ImBuf.resize 2nd arg `resize`.
- imbuf.write 2nd arg `filepath`.
- mathutils.kdtree.KDTree.find 2nd arg `filter`.
- nodeitems_utils.NodeCategory 3rd & 4th arg `descriptions`, `items`.
- nodeitems_utils.NodeItem 2nd..4th args `label`, `settings`, `poll`.
- nodeitems_utils.NodeItemCustom 1st & 2nd arg `poll`, `draw`.
- rna_prop_ui.draw 5th arg `use_edit`.
- rna_prop_ui.rna_idprop_ui_get 2nd arg `create`.
- rna_prop_ui.rna_idprop_ui_prop_clear 3rd arg `remove`.
- rna_prop_ui.rna_idprop_ui_prop_get 3rd arg `create`.
- rna_xml.xml2rna 2nd arg `root_rna`.
- rna_xml.xml_file_write 4th arg `skip_typemap`.
2021-06-08 18:03:14 +10:00
|
|
|
draw_circle_2d(xy, (1.0,) * 4, radius, segments=32)
|
2019-05-30 21:28:04 +10:00
|
|
|
|
2018-09-21 10:28:51 +02:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.select_circle",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Select Circle",
|
2018-11-13 14:05:20 +11:00
|
|
|
icon="ops.generic.select_circle",
|
2018-09-21 10:28:51 +02:00
|
|
|
widget=None,
|
2018-11-15 13:34:47 +11:00
|
|
|
keymap=(),
|
2019-01-11 19:15:23 +01:00
|
|
|
draw_settings=draw_settings,
|
2019-05-30 21:28:04 +10:00
|
|
|
draw_cursor=draw_cursor,
|
2018-09-21 10:28:51 +02:00
|
|
|
)
|
|
|
|
|
|
2019-03-07 11:12:30 +01:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def radius():
|
|
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.radius",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Radius",
|
2023-02-14 10:30:49 +01:00
|
|
|
description=(
|
|
|
|
|
"Expand or contract the radius of the selected points"
|
|
|
|
|
),
|
2019-03-07 11:12:30 +01:00
|
|
|
icon="ops.gpencil.radius",
|
2023-02-14 10:30:49 +01:00
|
|
|
|
2019-03-07 11:12:30 +01:00
|
|
|
widget=None,
|
|
|
|
|
keymap=(),
|
|
|
|
|
)
|
|
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def shear():
|
|
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.shear",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Shear",
|
2018-07-31 10:22:19 +02:00
|
|
|
icon="ops.gpencil.edit_shear",
|
|
|
|
|
widget=None,
|
2018-11-15 13:34:47 +11:00
|
|
|
keymap=(),
|
2018-07-31 10:22:19 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def tosphere():
|
|
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.to_sphere",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="To Sphere",
|
2018-10-21 16:04:58 +11:00
|
|
|
icon="ops.transform.tosphere",
|
2018-07-31 10:22:19 +02:00
|
|
|
widget=None,
|
2018-11-15 13:34:47 +11:00
|
|
|
keymap=(),
|
2018-07-31 10:22:19 +02:00
|
|
|
)
|
|
|
|
|
|
2019-03-04 19:31:36 +01:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def extrude():
|
|
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.extrude",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Extrude",
|
2019-03-04 19:31:36 +01:00
|
|
|
icon="ops.gpencil.extrude_move",
|
|
|
|
|
widget="VIEW3D_GGT_xform_extrude",
|
|
|
|
|
keymap=(),
|
|
|
|
|
draw_settings=_template_widget.VIEW3D_GGT_xform_extrude.draw_settings,
|
|
|
|
|
)
|
|
|
|
|
|
2020-03-09 16:27:24 +01:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def transform_fill():
|
2021-03-06 18:21:17 +11:00
|
|
|
def draw_settings(_context, layout, tool):
|
2020-03-09 16:27:24 +01:00
|
|
|
props = tool.operator_properties("gpencil.transform_fill")
|
|
|
|
|
row = layout.row()
|
|
|
|
|
row.use_property_split = False
|
|
|
|
|
row.prop(props, "mode", expand=True)
|
|
|
|
|
|
|
|
|
|
return dict(
|
|
|
|
|
idname="builtin.transform_fill",
|
|
|
|
|
label="Transform Fill",
|
|
|
|
|
icon="ops.gpencil.transform_fill",
|
2023-02-14 10:30:49 +01:00
|
|
|
cursor='DEFAULT',
|
2020-03-09 16:27:24 +01:00
|
|
|
widget=None,
|
|
|
|
|
keymap=(),
|
|
|
|
|
draw_settings=draw_settings,
|
|
|
|
|
)
|
2018-07-31 10:22:19 +02:00
|
|
|
|
2021-02-19 17:18:12 +01:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def interpolate():
|
2021-03-06 18:21:17 +11:00
|
|
|
def draw_settings(_context, layout, tool):
|
2021-02-19 17:18:12 +01:00
|
|
|
props = tool.operator_properties("gpencil.interpolate")
|
2021-02-22 16:12:40 +01:00
|
|
|
layout.prop(props, "layers")
|
|
|
|
|
layout.prop(props, "interpolate_selected_only")
|
2022-11-28 19:32:18 +01:00
|
|
|
layout.prop(props, "exclude_breakdowns")
|
2021-02-22 16:12:40 +01:00
|
|
|
layout.prop(props, "flip")
|
|
|
|
|
layout.prop(props, "smooth_factor")
|
|
|
|
|
layout.prop(props, "smooth_steps")
|
2021-02-19 17:18:12 +01:00
|
|
|
|
|
|
|
|
return dict(
|
|
|
|
|
idname="builtin.interpolate",
|
|
|
|
|
label="Interpolate",
|
|
|
|
|
icon="ops.pose.breakdowner",
|
2023-02-14 10:30:49 +01:00
|
|
|
cursor='DEFAULT',
|
2021-02-19 17:18:12 +01:00
|
|
|
widget=None,
|
|
|
|
|
keymap=(),
|
|
|
|
|
draw_settings=draw_settings,
|
|
|
|
|
)
|
|
|
|
|
|
2020-10-02 10:15:51 +10:00
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
class _defs_gpencil_sculpt:
|
2023-02-14 10:30:49 +01:00
|
|
|
|
2019-08-10 17:19:54 +02:00
|
|
|
@staticmethod
|
|
|
|
|
def poll_select_mask(context):
|
|
|
|
|
if context is None:
|
|
|
|
|
return True
|
|
|
|
|
ob = context.active_object
|
2023-04-13 13:14:01 +10:00
|
|
|
tool_settings = context.scene.tool_settings
|
|
|
|
|
return (
|
|
|
|
|
ob is not None and
|
|
|
|
|
ob.type == 'GPENCIL' and (
|
|
|
|
|
tool_settings.use_gpencil_select_mask_point or
|
|
|
|
|
tool_settings.use_gpencil_select_mask_stroke or
|
|
|
|
|
tool_settings.use_gpencil_select_mask_segment
|
|
|
|
|
)
|
|
|
|
|
)
|
2019-08-10 17:19:54 +02:00
|
|
|
|
2018-11-13 16:52:39 +11:00
|
|
|
@staticmethod
|
|
|
|
|
def generate_from_brushes(context):
|
|
|
|
|
return generate_from_enum_ex(
|
|
|
|
|
context,
|
2019-03-15 14:18:21 +11:00
|
|
|
idname_prefix="builtin_brush.",
|
2018-11-13 16:52:39 +11:00
|
|
|
icon_prefix="ops.gpencil.sculpt_",
|
2020-03-09 16:27:24 +01:00
|
|
|
type=bpy.types.Brush,
|
|
|
|
|
attr="gpencil_sculpt_tool",
|
2019-06-06 15:53:11 +10:00
|
|
|
tooldef_keywords=dict(
|
|
|
|
|
operator="gpencil.sculpt_paint",
|
|
|
|
|
),
|
2018-07-31 10:22:19 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class _defs_gpencil_weight:
|
2023-02-14 10:30:49 +01:00
|
|
|
|
2018-11-13 16:52:39 +11:00
|
|
|
@staticmethod
|
|
|
|
|
def generate_from_brushes(context):
|
|
|
|
|
return generate_from_enum_ex(
|
|
|
|
|
context,
|
2019-03-15 14:18:21 +11:00
|
|
|
idname_prefix="builtin_brush.",
|
2018-11-13 16:52:39 +11:00
|
|
|
icon_prefix="ops.gpencil.sculpt_",
|
2020-03-09 16:27:24 +01:00
|
|
|
type=bpy.types.Brush,
|
|
|
|
|
attr="gpencil_weight_tool",
|
2019-06-11 09:20:33 +10:00
|
|
|
tooldef_keywords=dict(
|
2020-03-09 16:27:24 +01:00
|
|
|
operator="gpencil.weight_paint",
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
2022-02-18 09:12:41 +01:00
|
|
|
class _defs_curves_sculpt:
|
2023-02-14 10:30:49 +01:00
|
|
|
|
2023-04-14 20:12:05 +10:00
|
|
|
@staticmethod
|
|
|
|
|
def generate_from_brushes(context):
|
|
|
|
|
return generate_from_enum_ex(
|
|
|
|
|
context,
|
|
|
|
|
idname_prefix="builtin_brush.",
|
|
|
|
|
icon_prefix="ops.curves.sculpt_",
|
|
|
|
|
type=bpy.types.Brush,
|
|
|
|
|
attr="curves_sculpt_tool",
|
|
|
|
|
icon_map={
|
|
|
|
|
# Use the generic icon for selection painting.
|
|
|
|
|
"ops.curves.sculpt_selection_paint": "ops.generic.select_paint",
|
|
|
|
|
},
|
2022-06-30 15:09:13 +02:00
|
|
|
)
|
|
|
|
|
|
2022-02-18 09:12:41 +01:00
|
|
|
|
2020-03-09 16:27:24 +01:00
|
|
|
class _defs_gpencil_vertex:
|
2023-02-14 10:30:49 +01:00
|
|
|
|
2020-03-09 16:27:24 +01:00
|
|
|
@staticmethod
|
|
|
|
|
def poll_select_mask(context):
|
|
|
|
|
if context is None:
|
|
|
|
|
return True
|
|
|
|
|
ob = context.active_object
|
2023-04-13 13:14:01 +10:00
|
|
|
tool_settings = context.scene.tool_settings
|
|
|
|
|
return (
|
|
|
|
|
ob is not None and
|
|
|
|
|
ob.type == 'GPENCIL' and (
|
|
|
|
|
tool_settings.use_gpencil_vertex_select_mask_point or
|
|
|
|
|
tool_settings.use_gpencil_vertex_select_mask_stroke or
|
|
|
|
|
tool_settings.use_gpencil_vertex_select_mask_segment
|
|
|
|
|
)
|
|
|
|
|
)
|
2020-03-09 16:27:24 +01:00
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
|
def generate_from_brushes(context):
|
|
|
|
|
return generate_from_enum_ex(
|
|
|
|
|
context,
|
|
|
|
|
idname_prefix="builtin_brush.",
|
|
|
|
|
icon_prefix="brush.paint_vertex.",
|
|
|
|
|
type=bpy.types.Brush,
|
|
|
|
|
attr="gpencil_vertex_tool",
|
2023-02-14 10:30:49 +01:00
|
|
|
cursor='DOT',
|
2020-03-09 16:27:24 +01:00
|
|
|
tooldef_keywords=dict(
|
|
|
|
|
operator="gpencil.vertex_paint",
|
2019-06-11 09:20:33 +10:00
|
|
|
),
|
2018-07-31 10:22:19 +02:00
|
|
|
)
|
|
|
|
|
|
2018-05-16 18:41:11 +02:00
|
|
|
|
2018-11-27 18:39:29 +11:00
|
|
|
class _defs_node_select:
|
2023-02-14 10:30:49 +01:00
|
|
|
|
2018-11-27 18:39:29 +11:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def select():
|
|
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.select",
|
2019-09-04 11:55:36 +02:00
|
|
|
label="Tweak",
|
2018-11-27 18:39:29 +11:00
|
|
|
icon="ops.generic.select",
|
|
|
|
|
widget=None,
|
2019-09-04 11:55:36 +02:00
|
|
|
keymap="Node Tool: Tweak",
|
2018-11-27 18:39:29 +11:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def box():
|
2019-04-19 07:32:24 +02:00
|
|
|
def draw_settings(_context, layout, tool):
|
2018-11-27 18:39:29 +11:00
|
|
|
props = tool.operator_properties("node.select_box")
|
2019-05-06 15:59:34 +02:00
|
|
|
row = layout.row()
|
|
|
|
|
row.use_property_split = False
|
|
|
|
|
row.prop(props, "mode", text="", expand=True, icon_only=True)
|
2018-11-27 18:39:29 +11:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.select_box",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Select Box",
|
2018-11-27 18:39:29 +11:00
|
|
|
icon="ops.generic.select_box",
|
|
|
|
|
widget=None,
|
|
|
|
|
keymap="Node Tool: Select Box",
|
|
|
|
|
draw_settings=draw_settings,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def lasso():
|
2019-04-19 07:32:24 +02:00
|
|
|
def draw_settings(_context, layout, tool):
|
2018-11-27 18:39:29 +11:00
|
|
|
props = tool.operator_properties("node.select_lasso")
|
2019-05-06 15:59:34 +02:00
|
|
|
row = layout.row()
|
|
|
|
|
row.use_property_split = False
|
|
|
|
|
row.prop(props, "mode", text="", expand=True, icon_only=True)
|
2018-11-27 18:39:29 +11:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.select_lasso",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Select Lasso",
|
2018-11-27 18:39:29 +11:00
|
|
|
icon="ops.generic.select_lasso",
|
|
|
|
|
widget=None,
|
|
|
|
|
keymap="Node Tool: Select Lasso",
|
|
|
|
|
draw_settings=draw_settings,
|
|
|
|
|
)
|
|
|
|
|
|
2019-03-05 23:29:49 +11:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def circle():
|
2019-04-19 07:32:24 +02:00
|
|
|
def draw_settings(_context, layout, tool):
|
2019-03-05 23:29:49 +11:00
|
|
|
props = tool.operator_properties("node.select_circle")
|
2019-05-06 15:59:34 +02:00
|
|
|
row = layout.row()
|
|
|
|
|
row.use_property_split = False
|
|
|
|
|
row.prop(props, "mode", text="", expand=True, icon_only=True)
|
2019-03-05 23:29:49 +11:00
|
|
|
layout.prop(props, "radius")
|
2019-05-30 21:28:04 +10:00
|
|
|
|
|
|
|
|
def draw_cursor(_context, tool, xy):
|
|
|
|
|
from gpu_extras.presets import draw_circle_2d
|
|
|
|
|
props = tool.operator_properties("node.select_circle")
|
|
|
|
|
radius = props.radius
|
PyAPI: use keyword only arguments
Use keyword only arguments for the following functions.
- addon_utils.module_bl_info 2nd arg `info_basis`.
- addon_utils.modules 1st `module_cache`, 2nd arg `refresh`.
- addon_utils.modules_refresh 1st arg `module_cache`.
- bl_app_template_utils.activate 1nd arg `template_id`.
- bl_app_template_utils.import_from_id 2nd arg `ignore_not_found`.
- bl_app_template_utils.import_from_path 2nd arg `ignore_not_found`.
- bl_keymap_utils.keymap_from_toolbar.generate 2nd & 3rd args `use_fallback_keys` & `use_reset`.
- bl_keymap_utils.platform_helpers.keyconfig_data_oskey_from_ctrl 2nd arg `filter_fn`.
- bl_ui_utils.bug_report_url.url_prefill_from_blender 1st arg `addon_info`.
- bmesh.types.BMFace.copy 1st & 2nd args `verts`, `edges`.
- bmesh.types.BMesh.calc_volume 1st arg `signed`.
- bmesh.types.BMesh.from_mesh 2nd..4th args `face_normals`, `use_shape_key`, `shape_key_index`.
- bmesh.types.BMesh.from_object 3rd & 4th args `cage`, `face_normals`.
- bmesh.types.BMesh.transform 2nd arg `filter`.
- bmesh.types.BMesh.update_edit_mesh 2nd & 3rd args `loop_triangles`, `destructive`.
- bmesh.types.{BMVertSeq,BMEdgeSeq,BMFaceSeq}.sort 1st & 2nd arg `key`, `reverse`.
- bmesh.utils.face_split 4th..6th args `coords`, `use_exist`, `example`.
- bpy.data.libraries.load 2nd..4th args `link`, `relative`, `assets_only`.
- bpy.data.user_map 1st..3rd args `subset`, `key_types, `value_types`.
- bpy.msgbus.subscribe_rna 5th arg `options`.
- bpy.path.abspath 2nd & 3rd args `start` & `library`.
- bpy.path.clean_name 2nd arg `replace`.
- bpy.path.ensure_ext 3rd arg `case_sensitive`.
- bpy.path.module_names 2nd arg `recursive`.
- bpy.path.relpath 2nd arg `start`.
- bpy.types.EditBone.transform 2nd & 3rd arg `scale`, `roll`.
- bpy.types.Operator.as_keywords 1st arg `ignore`.
- bpy.types.Struct.{keyframe_insert,keyframe_delete} 2nd..5th args `index`, `frame`, `group`, `options`.
- bpy.types.WindowManager.popup_menu 2nd & 3rd arg `title`, `icon`.
- bpy.types.WindowManager.popup_menu_pie 3rd & 4th arg `title`, `icon`.
- bpy.utils.app_template_paths 1st arg `subdir`.
- bpy.utils.app_template_paths 1st arg `subdir`.
- bpy.utils.blend_paths 1st..3rd args `absolute`, `packed`, `local`.
- bpy.utils.execfile 2nd arg `mod`.
- bpy.utils.keyconfig_set 2nd arg `report`.
- bpy.utils.load_scripts 1st & 2nd `reload_scripts` & `refresh_scripts`.
- bpy.utils.preset_find 3rd & 4th args `display_name`, `ext`.
- bpy.utils.resource_path 2nd & 3rd arg `major`, `minor`.
- bpy.utils.script_paths 1st..4th args `subdir`, `user_pref`, `check_all`, `use_user`.
- bpy.utils.smpte_from_frame 2nd & 3rd args `fps`, `fps_base`.
- bpy.utils.smpte_from_seconds 2nd & 3rd args `fps`, `fps_base`.
- bpy.utils.system_resource 2nd arg `subdir`.
- bpy.utils.time_from_frame 2nd & 3rd args `fps`, `fps_base`.
- bpy.utils.time_to_frame 2nd & 3rd args `fps`, `fps_base`.
- bpy.utils.units.to_string 4th..6th `precision`, `split_unit`, `compatible_unit`.
- bpy.utils.units.to_value 4th arg `str_ref_unit`.
- bpy.utils.user_resource 2nd & 3rd args `subdir`, `create`
- bpy_extras.view3d_utils.location_3d_to_region_2d 4th arg `default`.
- bpy_extras.view3d_utils.region_2d_to_origin_3d 4th arg `clamp`.
- gpu.offscreen.unbind 1st arg `restore`.
- gpu_extras.batch.batch_for_shader 4th arg `indices`.
- gpu_extras.batch.presets.draw_circle_2d 4th arg `segments`.
- gpu_extras.presets.draw_circle_2d 4th arg `segments`.
- imbuf.types.ImBuf.resize 2nd arg `resize`.
- imbuf.write 2nd arg `filepath`.
- mathutils.kdtree.KDTree.find 2nd arg `filter`.
- nodeitems_utils.NodeCategory 3rd & 4th arg `descriptions`, `items`.
- nodeitems_utils.NodeItem 2nd..4th args `label`, `settings`, `poll`.
- nodeitems_utils.NodeItemCustom 1st & 2nd arg `poll`, `draw`.
- rna_prop_ui.draw 5th arg `use_edit`.
- rna_prop_ui.rna_idprop_ui_get 2nd arg `create`.
- rna_prop_ui.rna_idprop_ui_prop_clear 3rd arg `remove`.
- rna_prop_ui.rna_idprop_ui_prop_get 3rd arg `create`.
- rna_xml.xml2rna 2nd arg `root_rna`.
- rna_xml.xml_file_write 4th arg `skip_typemap`.
2021-06-08 18:03:14 +10:00
|
|
|
draw_circle_2d(xy, (1.0,) * 4, radius, segments=32)
|
2019-05-30 21:28:04 +10:00
|
|
|
|
2019-03-05 23:29:49 +11:00
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.select_circle",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Select Circle",
|
2019-03-05 23:29:49 +11:00
|
|
|
icon="ops.generic.select_circle",
|
|
|
|
|
widget=None,
|
|
|
|
|
keymap="Node Tool: Select Circle",
|
|
|
|
|
draw_settings=draw_settings,
|
2019-05-30 21:28:04 +10:00
|
|
|
draw_cursor=draw_cursor,
|
2019-03-05 23:29:49 +11:00
|
|
|
)
|
|
|
|
|
|
2018-11-27 18:39:29 +11:00
|
|
|
|
2018-11-28 17:37:40 +11:00
|
|
|
class _defs_node_edit:
|
2023-02-14 10:30:49 +01:00
|
|
|
|
2018-11-28 17:37:40 +11:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def links_cut():
|
|
|
|
|
return dict(
|
2019-03-15 14:18:21 +11:00
|
|
|
idname="builtin.links_cut",
|
2019-03-15 12:45:41 +11:00
|
|
|
label="Links Cut",
|
2019-03-11 23:22:41 +01:00
|
|
|
icon="ops.node.links_cut",
|
2018-11-28 17:37:40 +11:00
|
|
|
widget=None,
|
|
|
|
|
keymap="Node Tool: Links Cut",
|
2023-02-14 10:30:49 +01:00
|
|
|
options={'KEYMAP_FALLBACK'},
|
2018-11-28 17:37:40 +11:00
|
|
|
)
|
|
|
|
|
|
2020-02-16 21:39:12 +01:00
|
|
|
|
2020-01-22 14:54:44 +01:00
|
|
|
class _defs_sequencer_generic:
|
2023-02-14 10:30:49 +01:00
|
|
|
|
2021-10-07 12:32:04 +11:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def cursor():
|
|
|
|
|
return dict(
|
|
|
|
|
idname="builtin.cursor",
|
|
|
|
|
label="Cursor",
|
2023-02-14 10:30:49 +01:00
|
|
|
description=(
|
|
|
|
|
"Set the cursor location, drag to transform"
|
|
|
|
|
),
|
2021-10-07 12:32:04 +11:00
|
|
|
icon="ops.generic.cursor",
|
|
|
|
|
keymap="Sequencer Tool: Cursor",
|
|
|
|
|
)
|
|
|
|
|
|
2020-01-22 14:54:44 +01:00
|
|
|
@ToolDef.from_fn
|
2020-02-16 21:39:12 +01:00
|
|
|
def blade():
|
2020-01-22 14:54:44 +01:00
|
|
|
def draw_settings(_context, layout, tool):
|
2020-02-16 21:39:12 +01:00
|
|
|
props = tool.operator_properties("sequencer.split")
|
2020-01-22 14:54:44 +01:00
|
|
|
row = layout.row()
|
|
|
|
|
row.use_property_split = False
|
|
|
|
|
row.prop(props, "type", expand=True)
|
|
|
|
|
return dict(
|
2020-02-16 21:39:12 +01:00
|
|
|
idname="builtin.blade",
|
|
|
|
|
label="Blade",
|
2020-02-16 20:56:59 +01:00
|
|
|
icon="ops.sequencer.blade",
|
2023-02-14 10:30:49 +01:00
|
|
|
cursor='CROSSHAIR',
|
2020-01-22 14:54:44 +01:00
|
|
|
widget=None,
|
2020-02-16 21:39:12 +01:00
|
|
|
keymap="Sequencer Tool: Blade",
|
2020-01-22 14:54:44 +01:00
|
|
|
draw_settings=draw_settings,
|
2023-02-14 10:30:49 +01:00
|
|
|
options={'KEYMAP_FALLBACK'},
|
2020-01-22 14:54:44 +01:00
|
|
|
)
|
|
|
|
|
|
2020-04-13 00:28:27 +02:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def sample():
|
|
|
|
|
return dict(
|
|
|
|
|
idname="builtin.sample",
|
|
|
|
|
label="Sample",
|
2023-02-14 10:30:49 +01:00
|
|
|
description=(
|
|
|
|
|
"Sample pixel values under the cursor"
|
|
|
|
|
),
|
2020-04-13 00:28:27 +02:00
|
|
|
icon="ops.paint.weight_sample", # XXX, needs own icon.
|
|
|
|
|
keymap="Sequencer Tool: Sample",
|
|
|
|
|
)
|
|
|
|
|
|
2021-09-21 09:38:30 +02:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def translate():
|
|
|
|
|
return dict(
|
|
|
|
|
idname="builtin.move",
|
|
|
|
|
label="Move",
|
|
|
|
|
icon="ops.transform.translate",
|
|
|
|
|
widget="SEQUENCER_GGT_gizmo2d_translate",
|
|
|
|
|
operator="transform.translate",
|
|
|
|
|
keymap="Sequencer Tool: Move",
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def rotate():
|
|
|
|
|
return dict(
|
|
|
|
|
idname="builtin.rotate",
|
|
|
|
|
label="Rotate",
|
|
|
|
|
icon="ops.transform.rotate",
|
|
|
|
|
widget="SEQUENCER_GGT_gizmo2d_rotate",
|
|
|
|
|
operator="transform.rotate",
|
|
|
|
|
keymap="Sequencer Tool: Rotate",
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def scale():
|
|
|
|
|
return dict(
|
|
|
|
|
idname="builtin.scale",
|
|
|
|
|
label="Scale",
|
|
|
|
|
icon="ops.transform.resize",
|
|
|
|
|
widget="SEQUENCER_GGT_gizmo2d_resize",
|
|
|
|
|
operator="transform.resize",
|
|
|
|
|
keymap="Sequencer Tool: Scale",
|
|
|
|
|
)
|
|
|
|
|
|
2021-10-08 12:09:27 +02:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def transform():
|
|
|
|
|
return dict(
|
|
|
|
|
idname="builtin.transform",
|
|
|
|
|
label="Transform",
|
2023-02-14 10:30:49 +01:00
|
|
|
description=(
|
|
|
|
|
"Supports any combination of grab, rotate, and scale at once"
|
|
|
|
|
),
|
2021-10-08 12:09:27 +02:00
|
|
|
icon="ops.transform.transform",
|
|
|
|
|
widget="SEQUENCER_GGT_gizmo2d",
|
|
|
|
|
# No keymap default action, only for gizmo!
|
2022-04-19 15:05:55 +10:00
|
|
|
)
|
|
|
|
|
|
2020-02-16 20:56:59 +01:00
|
|
|
|
2020-01-22 14:54:44 +01:00
|
|
|
class _defs_sequencer_select:
|
|
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def select():
|
|
|
|
|
return dict(
|
|
|
|
|
idname="builtin.select",
|
2021-10-06 14:45:33 +11:00
|
|
|
label="Tweak",
|
2020-01-22 14:54:44 +01:00
|
|
|
icon="ops.generic.select",
|
|
|
|
|
widget=None,
|
2021-10-06 14:45:33 +11:00
|
|
|
keymap="Sequencer Tool: Tweak",
|
2020-01-22 14:54:44 +01:00
|
|
|
)
|
2020-10-02 10:15:51 +10:00
|
|
|
|
2020-01-22 14:54:44 +01:00
|
|
|
@ToolDef.from_fn
|
|
|
|
|
def box():
|
|
|
|
|
def draw_settings(_context, layout, tool):
|
|
|
|
|
props = tool.operator_properties("sequencer.select_box")
|
|
|
|
|
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",
|
|
|
|
|
icon="ops.generic.select_box",
|
|
|
|
|
widget=None,
|
|
|
|
|
keymap="Sequencer Tool: Select Box",
|
|
|
|
|
draw_settings=draw_settings,
|
|
|
|
|
)
|
|
|
|
|
|
2018-11-28 17:37:40 +11:00
|
|
|
|
2018-05-16 18:41:11 +02:00
|
|
|
class IMAGE_PT_tools_active(ToolSelectPanelHelper, Panel):
|
2023-02-14 10:30:49 +01:00
|
|
|
bl_space_type = 'IMAGE_EDITOR'
|
|
|
|
|
bl_region_type = 'TOOLS'
|
2018-05-16 18:41:11 +02:00
|
|
|
bl_label = "Tools" # not visible
|
2023-02-14 10:30:49 +01:00
|
|
|
bl_options = {'HIDE_HEADER'}
|
2018-05-16 18:41:11 +02:00
|
|
|
|
2023-04-18 10:42:00 +10:00
|
|
|
# Satisfy the `ToolSelectPanelHelper` API.
|
2018-07-14 09:02:36 +02:00
|
|
|
keymap_prefix = "Image Editor Tool:"
|
2018-05-16 18:41:11 +02:00
|
|
|
|
2019-12-07 03:45:50 +11:00
|
|
|
# Default group to use as a fallback.
|
|
|
|
|
tool_fallback_id = "builtin.select"
|
|
|
|
|
|
2018-05-16 18:41:11 +02:00
|
|
|
@classmethod
|
|
|
|
|
def tools_from_context(cls, context, mode=None):
|
|
|
|
|
if mode is None:
|
2018-08-17 12:59:24 +02:00
|
|
|
if context.space_data is None:
|
2023-02-14 10:30:49 +01:00
|
|
|
mode = 'VIEW'
|
2018-08-17 13:09:59 +02:00
|
|
|
else:
|
|
|
|
|
mode = context.space_data.mode
|
2018-05-16 18:41:11 +02:00
|
|
|
for tools in (cls._tools[None], cls._tools.get(mode, ())):
|
|
|
|
|
for item in tools:
|
|
|
|
|
if not (type(item) is ToolDef) and callable(item):
|
|
|
|
|
yield from item(context)
|
|
|
|
|
else:
|
|
|
|
|
yield item
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
def tools_all(cls):
|
|
|
|
|
yield from cls._tools.items()
|
|
|
|
|
|
2021-11-09 00:14:45 +11:00
|
|
|
# Private tool lists for convenient reuse in `_tools`.
|
|
|
|
|
|
2018-10-04 12:04:36 +10:00
|
|
|
_tools_transform = (
|
2019-06-26 01:39:58 +10:00
|
|
|
_defs_image_uv_transform.translate,
|
|
|
|
|
_defs_image_uv_transform.rotate,
|
|
|
|
|
_defs_image_uv_transform.scale,
|
2018-10-04 12:04:36 +10:00
|
|
|
_defs_image_uv_transform.transform,
|
|
|
|
|
)
|
|
|
|
|
|
2018-05-16 18:41:11 +02:00
|
|
|
_tools_select = (
|
|
|
|
|
(
|
2018-11-22 16:05:28 +01:00
|
|
|
_defs_image_uv_select.select,
|
|
|
|
|
_defs_image_uv_select.box,
|
2018-10-04 12:04:36 +10:00
|
|
|
_defs_image_uv_select.circle,
|
|
|
|
|
_defs_image_uv_select.lasso,
|
2018-05-16 18:41:11 +02:00
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
|
2018-08-21 01:17:15 +12:00
|
|
|
_tools_annotate = (
|
|
|
|
|
(
|
2018-11-27 17:33:52 +11:00
|
|
|
_defs_annotate.scribble,
|
|
|
|
|
_defs_annotate.line,
|
|
|
|
|
_defs_annotate.poly,
|
|
|
|
|
_defs_annotate.eraser,
|
2018-08-21 01:17:15 +12:00
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
|
2021-11-09 00:14:45 +11:00
|
|
|
# Private tools dictionary, store data to implement `tools_all` & `tools_from_context`.
|
2023-01-06 13:52:57 +11:00
|
|
|
# The keys match image spaces modes: `context.space_data.mode`.
|
2021-11-09 00:14:45 +11:00
|
|
|
# The values represent the tools, see `ToolSelectPanelHelper` for details.
|
2018-05-16 18:41:11 +02:00
|
|
|
_tools = {
|
|
|
|
|
None: [
|
|
|
|
|
# for all modes
|
|
|
|
|
],
|
2023-02-14 10:30:49 +01:00
|
|
|
'VIEW': [
|
2019-03-07 18:02:52 +11:00
|
|
|
_defs_image_generic.sample,
|
2019-03-07 14:03:59 +11:00
|
|
|
*_tools_annotate,
|
2018-10-19 20:10:14 +11:00
|
|
|
],
|
2023-02-14 10:30:49 +01:00
|
|
|
'UV': [
|
2018-05-16 18:41:11 +02:00
|
|
|
*_tools_select,
|
2018-11-16 09:27:53 +11:00
|
|
|
_defs_image_generic.cursor,
|
2018-10-04 12:04:36 +10:00
|
|
|
None,
|
|
|
|
|
*_tools_transform,
|
|
|
|
|
None,
|
2018-08-21 01:17:15 +12:00
|
|
|
*_tools_annotate,
|
2018-10-05 13:07:01 +10:00
|
|
|
None,
|
2020-07-06 21:14:12 +10:00
|
|
|
_defs_image_uv_edit.rip_region,
|
|
|
|
|
None,
|
2018-10-05 13:07:01 +10:00
|
|
|
lambda context: (
|
|
|
|
|
_defs_image_uv_sculpt.generate_from_brushes(context)
|
|
|
|
|
if _defs_image_generic.poll_uvedit(context)
|
|
|
|
|
else ()
|
|
|
|
|
),
|
2018-05-16 18:41:11 +02:00
|
|
|
],
|
2023-02-14 10:30:49 +01:00
|
|
|
'MASK': [
|
2018-05-16 18:41:11 +02:00
|
|
|
None,
|
|
|
|
|
],
|
2023-02-14 10:30:49 +01:00
|
|
|
'PAINT': [
|
2018-05-16 18:41:11 +02:00
|
|
|
_defs_texture_paint.generate_from_brushes,
|
2020-03-27 12:36:13 +01:00
|
|
|
None,
|
|
|
|
|
*_tools_annotate,
|
2018-05-16 18:41:11 +02:00
|
|
|
],
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-11-27 18:39:29 +11:00
|
|
|
class NODE_PT_tools_active(ToolSelectPanelHelper, Panel):
|
2023-02-14 10:30:49 +01:00
|
|
|
bl_space_type = 'NODE_EDITOR'
|
|
|
|
|
bl_region_type = 'TOOLS'
|
2018-11-27 18:39:29 +11:00
|
|
|
bl_label = "Tools" # not visible
|
2023-02-14 10:30:49 +01:00
|
|
|
bl_options = {'HIDE_HEADER'}
|
2018-11-27 18:39:29 +11:00
|
|
|
|
2023-04-18 10:42:00 +10:00
|
|
|
# Satisfy the `ToolSelectPanelHelper` API.
|
2018-11-27 18:39:29 +11:00
|
|
|
keymap_prefix = "Node Editor Tool:"
|
|
|
|
|
|
2019-12-07 03:45:50 +11:00
|
|
|
# Default group to use as a fallback.
|
|
|
|
|
tool_fallback_id = "builtin.select"
|
|
|
|
|
|
2018-11-27 18:39:29 +11:00
|
|
|
@classmethod
|
|
|
|
|
def tools_from_context(cls, context, mode=None):
|
|
|
|
|
if mode is None:
|
|
|
|
|
if context.space_data is None:
|
|
|
|
|
mode = None
|
|
|
|
|
else:
|
|
|
|
|
mode = context.space_data.tree_type
|
|
|
|
|
for tools in (cls._tools[None], cls._tools.get(mode, ())):
|
|
|
|
|
for item in tools:
|
|
|
|
|
if not (type(item) is ToolDef) and callable(item):
|
|
|
|
|
yield from item(context)
|
|
|
|
|
else:
|
|
|
|
|
yield item
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
def tools_all(cls):
|
|
|
|
|
yield from cls._tools.items()
|
|
|
|
|
|
2021-11-09 00:14:45 +11:00
|
|
|
# Private tool lists for convenient reuse in `_tools`.
|
|
|
|
|
|
2018-11-27 18:39:29 +11:00
|
|
|
_tools_select = (
|
|
|
|
|
(
|
|
|
|
|
_defs_node_select.select,
|
|
|
|
|
_defs_node_select.box,
|
|
|
|
|
_defs_node_select.lasso,
|
2019-03-05 23:29:49 +11:00
|
|
|
_defs_node_select.circle,
|
2018-11-27 18:39:29 +11:00
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
_tools_annotate = (
|
|
|
|
|
(
|
|
|
|
|
_defs_annotate.scribble,
|
|
|
|
|
_defs_annotate.line,
|
|
|
|
|
_defs_annotate.poly,
|
|
|
|
|
_defs_annotate.eraser,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
|
2021-11-09 00:14:45 +11:00
|
|
|
# Private tools dictionary, store data to implement `tools_all` & `tools_from_context`.
|
|
|
|
|
# The keys is always `None` since nodes don't use use modes to access different tools.
|
|
|
|
|
# The values represent the tools, see `ToolSelectPanelHelper` for details.
|
2018-11-27 18:39:29 +11:00
|
|
|
_tools = {
|
|
|
|
|
None: [
|
|
|
|
|
*_tools_select,
|
|
|
|
|
None,
|
|
|
|
|
*_tools_annotate,
|
2018-11-28 17:37:40 +11:00
|
|
|
None,
|
|
|
|
|
_defs_node_edit.links_cut,
|
2018-11-27 18:39:29 +11:00
|
|
|
],
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2017-10-21 16:19:48 +11:00
|
|
|
class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel):
|
2023-02-14 10:30:49 +01:00
|
|
|
bl_space_type = 'VIEW_3D'
|
|
|
|
|
bl_region_type = 'TOOLS'
|
2018-04-24 16:04:07 +02:00
|
|
|
bl_label = "Tools" # not visible
|
2023-02-14 10:30:49 +01:00
|
|
|
bl_options = {'HIDE_HEADER'}
|
2017-10-21 16:19:48 +11:00
|
|
|
|
2023-04-18 10:42:00 +10:00
|
|
|
# Satisfy the `ToolSelectPanelHelper` API.
|
2018-07-14 09:02:36 +02:00
|
|
|
keymap_prefix = "3D View Tool:"
|
2017-10-21 16:19:48 +11:00
|
|
|
|
2019-12-07 03:45:50 +11:00
|
|
|
# Default group to use as a fallback.
|
|
|
|
|
tool_fallback_id = "builtin.select"
|
|
|
|
|
|
2017-10-21 16:19:48 +11:00
|
|
|
@classmethod
|
2018-05-16 18:41:11 +02:00
|
|
|
def tools_from_context(cls, context, mode=None):
|
|
|
|
|
if mode is None:
|
|
|
|
|
mode = context.mode
|
|
|
|
|
for tools in (cls._tools[None], cls._tools.get(mode, ())):
|
2018-04-29 12:26:00 +02:00
|
|
|
for item in tools:
|
2018-04-30 13:46:01 +02:00
|
|
|
if not (type(item) is ToolDef) and callable(item):
|
2018-04-29 12:26:00 +02:00
|
|
|
yield from item(context)
|
|
|
|
|
else:
|
|
|
|
|
yield item
|
|
|
|
|
|
2017-10-21 16:19:48 +11:00
|
|
|
@classmethod
|
|
|
|
|
def tools_all(cls):
|
2018-04-26 14:43:32 +02:00
|
|
|
yield from cls._tools.items()
|
2017-10-21 16:19:48 +11:00
|
|
|
|
2021-11-09 00:14:45 +11:00
|
|
|
# Private tool lists for convenient reuse in `_tools`.
|
|
|
|
|
|
2017-10-21 16:19:48 +11:00
|
|
|
_tools_transform = (
|
2018-07-03 13:51:11 +02:00
|
|
|
_defs_transform.translate,
|
2018-04-27 13:23:29 +02:00
|
|
|
_defs_transform.rotate,
|
2018-04-24 09:19:28 +02:00
|
|
|
(
|
2018-04-27 13:23:29 +02:00
|
|
|
_defs_transform.scale,
|
|
|
|
|
_defs_transform.scale_cage,
|
2018-04-24 09:19:28 +02:00
|
|
|
),
|
2019-05-23 18:12:14 +02:00
|
|
|
_defs_transform.transform,
|
2017-10-21 16:19:48 +11:00
|
|
|
)
|
|
|
|
|
|
2018-04-29 16:36:31 +02:00
|
|
|
_tools_select = (
|
|
|
|
|
(
|
2018-11-22 16:05:28 +01:00
|
|
|
_defs_view3d_select.select,
|
|
|
|
|
_defs_view3d_select.box,
|
2018-04-29 16:36:31 +02:00
|
|
|
_defs_view3d_select.circle,
|
|
|
|
|
_defs_view3d_select.lasso,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
_tools_annotate = (
|
|
|
|
|
(
|
2018-11-27 17:33:52 +11:00
|
|
|
_defs_annotate.scribble,
|
|
|
|
|
_defs_annotate.line,
|
|
|
|
|
_defs_annotate.poly,
|
|
|
|
|
_defs_annotate.eraser,
|
2018-07-31 10:22:19 +02:00
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
|
2018-09-25 13:17:48 +02:00
|
|
|
_tools_gpencil_select = (
|
|
|
|
|
(
|
2018-11-22 16:05:28 +01:00
|
|
|
_defs_gpencil_edit.select,
|
2018-10-05 10:27:04 +10:00
|
|
|
_defs_gpencil_edit.box_select,
|
2018-09-25 13:17:48 +02:00
|
|
|
_defs_gpencil_edit.circle_select,
|
|
|
|
|
_defs_gpencil_edit.lasso_select,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
|
2020-05-28 14:34:17 +10:00
|
|
|
_tools_view3d_add = (
|
|
|
|
|
_defs_view3d_add.cube_add,
|
|
|
|
|
_defs_view3d_add.cone_add,
|
|
|
|
|
_defs_view3d_add.cylinder_add,
|
|
|
|
|
_defs_view3d_add.uv_sphere_add,
|
|
|
|
|
_defs_view3d_add.ico_sphere_add,
|
|
|
|
|
)
|
|
|
|
|
|
2018-11-30 09:06:36 +11:00
|
|
|
_tools_default = (
|
|
|
|
|
*_tools_select,
|
|
|
|
|
_defs_view3d_generic.cursor,
|
|
|
|
|
None,
|
|
|
|
|
*_tools_transform,
|
|
|
|
|
None,
|
|
|
|
|
*_tools_annotate,
|
2019-05-03 09:41:34 +02:00
|
|
|
_defs_view3d_generic.ruler,
|
2018-11-30 09:06:36 +11:00
|
|
|
)
|
|
|
|
|
|
2021-11-09 00:14:45 +11:00
|
|
|
# Private tools dictionary, store data to implement `tools_all` & `tools_from_context`.
|
2023-01-06 13:52:57 +11:00
|
|
|
# The keys match object-modes from: `context.mode`.
|
2021-11-09 00:14:45 +11:00
|
|
|
# The values represent the tools, see `ToolSelectPanelHelper` for details.
|
2017-10-21 16:19:48 +11:00
|
|
|
_tools = {
|
|
|
|
|
None: [
|
2018-08-23 12:12:11 +10:00
|
|
|
# Don't use this! because of paint modes.
|
|
|
|
|
# _defs_view3d_generic.cursor,
|
2017-11-02 23:05:13 +11:00
|
|
|
# End group.
|
2017-10-21 16:19:48 +11:00
|
|
|
],
|
2023-02-14 10:30:49 +01:00
|
|
|
'OBJECT': [
|
2018-11-30 09:06:36 +11:00
|
|
|
*_tools_default,
|
2021-01-16 11:23:44 +11:00
|
|
|
None,
|
|
|
|
|
_tools_view3d_add,
|
2017-10-21 16:19:48 +11:00
|
|
|
],
|
2023-02-14 10:30:49 +01:00
|
|
|
'POSE': [
|
2018-11-30 09:06:36 +11:00
|
|
|
*_tools_default,
|
2018-07-31 10:22:19 +02:00
|
|
|
None,
|
2018-05-15 12:40:50 +02:00
|
|
|
(
|
|
|
|
|
_defs_pose.breakdown,
|
|
|
|
|
_defs_pose.push,
|
|
|
|
|
_defs_pose.relax,
|
2018-07-31 10:22:19 +02:00
|
|
|
),
|
2017-10-21 16:19:48 +11:00
|
|
|
],
|
2023-02-14 10:30:49 +01:00
|
|
|
'EDIT_ARMATURE': [
|
2018-11-30 09:06:36 +11:00
|
|
|
*_tools_default,
|
2018-04-29 16:36:31 +02:00
|
|
|
None,
|
2018-04-27 13:23:29 +02:00
|
|
|
_defs_edit_armature.roll,
|
2018-05-15 10:24:26 +02:00
|
|
|
(
|
|
|
|
|
_defs_edit_armature.bone_size,
|
|
|
|
|
_defs_edit_armature.bone_envelope,
|
|
|
|
|
),
|
2017-10-21 16:19:48 +11:00
|
|
|
None,
|
2018-04-27 19:16:00 +02:00
|
|
|
(
|
|
|
|
|
_defs_edit_armature.extrude,
|
|
|
|
|
_defs_edit_armature.extrude_cursor,
|
2018-07-31 10:22:19 +02:00
|
|
|
),
|
2020-01-29 10:25:09 +11:00
|
|
|
_defs_transform.shear,
|
2017-10-21 16:19:48 +11:00
|
|
|
],
|
2023-02-14 10:30:49 +01:00
|
|
|
'EDIT_MESH': [
|
2018-11-30 09:06:36 +11:00
|
|
|
*_tools_default,
|
2023-02-14 10:30:49 +01:00
|
|
|
|
2021-01-16 11:23:44 +11:00
|
|
|
None,
|
|
|
|
|
_tools_view3d_add,
|
2020-05-28 14:34:17 +10:00
|
|
|
None,
|
2018-04-24 15:32:11 +02:00
|
|
|
(
|
2018-04-30 20:40:36 +02:00
|
|
|
_defs_edit_mesh.extrude,
|
2020-06-22 09:20:43 -03:00
|
|
|
_defs_edit_mesh.extrude_manifold,
|
2018-08-29 22:59:49 +10:00
|
|
|
_defs_edit_mesh.extrude_normals,
|
2018-04-30 20:40:36 +02:00
|
|
|
_defs_edit_mesh.extrude_individual,
|
|
|
|
|
_defs_edit_mesh.extrude_cursor,
|
2018-04-24 15:32:11 +02:00
|
|
|
),
|
2018-04-27 13:23:29 +02:00
|
|
|
_defs_edit_mesh.inset,
|
2018-04-27 22:48:23 +02:00
|
|
|
_defs_edit_mesh.bevel,
|
2018-04-27 22:59:51 +02:00
|
|
|
(
|
|
|
|
|
_defs_edit_mesh.loopcut_slide,
|
|
|
|
|
_defs_edit_mesh.offset_edge_loops_slide,
|
|
|
|
|
),
|
2018-04-24 15:32:11 +02:00
|
|
|
(
|
2018-04-30 20:40:36 +02:00
|
|
|
_defs_edit_mesh.knife,
|
|
|
|
|
_defs_edit_mesh.bisect,
|
|
|
|
|
),
|
|
|
|
|
_defs_edit_mesh.poly_build,
|
2024-02-09 13:01:55 +01:00
|
|
|
_defs_edit_mesh.spin,
|
2018-04-24 15:32:11 +02:00
|
|
|
(
|
2018-04-27 13:23:29 +02:00
|
|
|
_defs_edit_mesh.vertex_smooth,
|
|
|
|
|
_defs_edit_mesh.vertex_randomize,
|
2018-04-24 15:32:11 +02:00
|
|
|
),
|
2018-04-30 20:40:36 +02:00
|
|
|
(
|
|
|
|
|
_defs_edit_mesh.edge_slide,
|
|
|
|
|
_defs_edit_mesh.vert_slide,
|
|
|
|
|
),
|
2018-04-24 15:32:11 +02:00
|
|
|
(
|
2018-04-27 13:23:29 +02:00
|
|
|
_defs_edit_mesh.shrink_fatten,
|
|
|
|
|
_defs_edit_mesh.push_pull,
|
2018-04-24 15:32:11 +02:00
|
|
|
),
|
2018-08-28 20:41:48 +10:00
|
|
|
(
|
2020-01-29 10:25:09 +11:00
|
|
|
_defs_transform.shear,
|
2018-08-28 20:41:48 +10:00
|
|
|
_defs_edit_mesh.tosphere,
|
|
|
|
|
),
|
2017-11-02 23:05:13 +11:00
|
|
|
(
|
2018-04-30 20:40:36 +02:00
|
|
|
_defs_edit_mesh.rip_region,
|
|
|
|
|
_defs_edit_mesh.rip_edge,
|
2018-04-26 07:31:39 +02:00
|
|
|
),
|
2017-10-21 16:19:48 +11:00
|
|
|
],
|
2023-02-14 10:30:49 +01:00
|
|
|
'EDIT_CURVE': [
|
2018-11-30 09:06:36 +11:00
|
|
|
*_tools_default,
|
2018-07-31 10:22:19 +02:00
|
|
|
None,
|
2018-04-27 13:23:29 +02:00
|
|
|
_defs_edit_curve.draw,
|
2022-04-03 22:37:22 +05:30
|
|
|
_defs_edit_curve.pen,
|
2018-08-29 15:14:41 +10:00
|
|
|
(
|
|
|
|
|
_defs_edit_curve.extrude,
|
|
|
|
|
_defs_edit_curve.extrude_cursor,
|
2018-11-15 22:27:02 +11:00
|
|
|
),
|
2019-03-07 09:58:56 +01:00
|
|
|
None,
|
|
|
|
|
_defs_edit_curve.curve_radius,
|
|
|
|
|
_defs_edit_curve.tilt,
|
|
|
|
|
None,
|
2020-01-29 10:25:09 +11:00
|
|
|
_defs_transform.shear,
|
2019-03-07 09:58:56 +01:00
|
|
|
_defs_edit_curve.curve_vertex_randomize,
|
2017-10-21 16:19:48 +11:00
|
|
|
],
|
2023-02-14 10:30:49 +01:00
|
|
|
'EDIT_CURVES': [
|
2023-02-14 18:24:24 +01:00
|
|
|
*_tools_default,
|
2023-10-31 11:33:32 +01:00
|
|
|
None,
|
2023-12-11 19:44:19 +01:00
|
|
|
_defs_edit_curves.draw,
|
2023-12-16 12:08:28 -05:00
|
|
|
None,
|
|
|
|
|
_defs_edit_curve.curve_radius,
|
|
|
|
|
_defs_edit_curve.tilt,
|
2023-02-09 15:53:42 +01:00
|
|
|
],
|
2023-02-14 10:30:49 +01:00
|
|
|
'EDIT_SURFACE': [
|
2018-11-30 09:06:36 +11:00
|
|
|
*_tools_default,
|
2020-01-29 10:25:09 +11:00
|
|
|
None,
|
|
|
|
|
_defs_transform.shear,
|
2018-11-30 09:02:11 +11:00
|
|
|
],
|
2023-02-14 10:30:49 +01:00
|
|
|
'EDIT_METABALL': [
|
2018-11-30 09:06:36 +11:00
|
|
|
*_tools_default,
|
2020-01-29 10:25:09 +11:00
|
|
|
None,
|
|
|
|
|
_defs_transform.shear,
|
2018-11-20 18:52:27 +11:00
|
|
|
],
|
2023-02-14 10:30:49 +01:00
|
|
|
'EDIT_LATTICE': [
|
2018-11-30 09:06:36 +11:00
|
|
|
*_tools_default,
|
2020-01-29 10:25:09 +11:00
|
|
|
None,
|
|
|
|
|
_defs_transform.shear,
|
2018-11-20 21:41:39 +11:00
|
|
|
],
|
2023-02-14 10:30:49 +01:00
|
|
|
'EDIT_TEXT': [
|
2023-04-21 19:08:44 +02:00
|
|
|
_defs_edit_text.select_text,
|
2019-01-14 14:16:08 +11:00
|
|
|
_defs_view3d_generic.cursor,
|
|
|
|
|
None,
|
|
|
|
|
*_tools_annotate,
|
2019-05-03 09:41:34 +02:00
|
|
|
_defs_view3d_generic.ruler,
|
2019-01-14 14:16:08 +11:00
|
|
|
],
|
2023-06-21 16:47:18 +02:00
|
|
|
'EDIT_GREASE_PENCIL': [
|
|
|
|
|
*_tools_select,
|
2023-10-21 15:12:47 +02:00
|
|
|
_defs_view3d_generic.cursor,
|
|
|
|
|
None,
|
|
|
|
|
*_tools_transform,
|
|
|
|
|
None,
|
|
|
|
|
_defs_edit_curve.curve_radius,
|
|
|
|
|
_defs_transform.bend,
|
|
|
|
|
(
|
|
|
|
|
_defs_transform.shear,
|
|
|
|
|
_defs_edit_mesh.tosphere,
|
|
|
|
|
),
|
|
|
|
|
None,
|
|
|
|
|
*_tools_annotate,
|
2023-06-21 16:47:18 +02:00
|
|
|
],
|
2023-02-14 10:30:49 +01:00
|
|
|
'PARTICLE': [
|
2019-03-06 00:28:06 +11:00
|
|
|
*_tools_select,
|
2018-08-23 12:12:11 +10:00
|
|
|
_defs_view3d_generic.cursor,
|
2019-03-06 00:28:06 +11:00
|
|
|
None,
|
2018-08-02 17:41:11 +10:00
|
|
|
_defs_particle.generate_from_brushes,
|
2018-05-28 18:05:21 +02:00
|
|
|
],
|
2023-02-14 10:30:49 +01:00
|
|
|
'SCULPT': [
|
2018-04-29 14:31:00 +02:00
|
|
|
_defs_sculpt.generate_from_brushes,
|
2018-08-23 12:56:02 +10:00
|
|
|
None,
|
2019-06-07 10:35:07 +02:00
|
|
|
(
|
|
|
|
|
_defs_sculpt.mask_border,
|
|
|
|
|
_defs_sculpt.mask_lasso,
|
2020-10-21 16:44:28 +02:00
|
|
|
_defs_sculpt.mask_line,
|
2019-06-07 10:35:07 +02:00
|
|
|
),
|
2024-03-12 14:19:02 +01:00
|
|
|
(
|
|
|
|
|
_defs_sculpt.hide_border,
|
|
|
|
|
_defs_sculpt.hide_lasso
|
|
|
|
|
),
|
2020-10-21 16:44:28 +02:00
|
|
|
(
|
|
|
|
|
_defs_sculpt.face_set_box,
|
|
|
|
|
_defs_sculpt.face_set_lasso,
|
2020-09-05 20:06:27 +02:00
|
|
|
),
|
2020-10-21 16:44:28 +02:00
|
|
|
(
|
|
|
|
|
_defs_sculpt.trim_box,
|
|
|
|
|
_defs_sculpt.trim_lasso,
|
2020-09-29 22:46:38 +02:00
|
|
|
),
|
2020-10-21 16:44:28 +02:00
|
|
|
_defs_sculpt.project_line,
|
2019-05-03 09:41:34 +02:00
|
|
|
None,
|
2019-09-09 15:42:51 +02:00
|
|
|
_defs_sculpt.mesh_filter,
|
2020-06-01 22:36:26 +02:00
|
|
|
_defs_sculpt.cloth_filter,
|
2022-04-05 11:42:55 -07:00
|
|
|
_defs_sculpt.color_filter,
|
2020-07-01 19:19:30 +02:00
|
|
|
None,
|
2020-10-21 16:44:28 +02:00
|
|
|
_defs_sculpt.face_set_edit,
|
2022-04-22 08:05:22 +02:00
|
|
|
_defs_sculpt.mask_by_color,
|
2020-08-11 19:24:01 +02:00
|
|
|
None,
|
2019-09-10 19:55:15 +02:00
|
|
|
_defs_transform.translate,
|
|
|
|
|
_defs_transform.rotate,
|
|
|
|
|
_defs_transform.scale,
|
|
|
|
|
_defs_transform.transform,
|
|
|
|
|
None,
|
2019-05-03 09:41:34 +02:00
|
|
|
*_tools_annotate,
|
2018-04-29 14:31:00 +02:00
|
|
|
],
|
2023-02-14 10:30:49 +01:00
|
|
|
'PAINT_TEXTURE': [
|
2018-04-30 16:43:13 +02:00
|
|
|
_defs_texture_paint.generate_from_brushes,
|
2019-03-11 13:45:15 +01:00
|
|
|
None,
|
|
|
|
|
lambda context: (
|
|
|
|
|
VIEW3D_PT_tools_active._tools_select
|
|
|
|
|
if _defs_texture_paint.poll_select_mask(context)
|
|
|
|
|
else ()
|
|
|
|
|
),
|
2019-05-03 09:41:34 +02:00
|
|
|
*_tools_annotate,
|
2018-04-30 16:43:13 +02:00
|
|
|
],
|
2023-02-14 10:30:49 +01:00
|
|
|
'PAINT_VERTEX': [
|
2018-04-30 16:06:51 +02:00
|
|
|
_defs_vertex_paint.generate_from_brushes,
|
2018-08-29 16:21:48 +10:00
|
|
|
None,
|
|
|
|
|
lambda context: (
|
|
|
|
|
VIEW3D_PT_tools_active._tools_select
|
|
|
|
|
if _defs_vertex_paint.poll_select_mask(context)
|
|
|
|
|
else ()
|
|
|
|
|
),
|
2019-05-03 09:41:34 +02:00
|
|
|
*_tools_annotate,
|
2018-04-30 16:06:51 +02:00
|
|
|
],
|
2023-02-14 10:30:49 +01:00
|
|
|
'PAINT_WEIGHT': [
|
2018-04-30 16:59:16 +02:00
|
|
|
_defs_weight_paint.generate_from_brushes,
|
2019-03-08 15:07:18 +01:00
|
|
|
_defs_weight_paint.gradient,
|
2018-05-01 12:20:53 +02:00
|
|
|
None,
|
2019-03-08 15:07:18 +01:00
|
|
|
(
|
2019-03-20 10:44:13 +11:00
|
|
|
_defs_weight_paint.sample_weight,
|
|
|
|
|
_defs_weight_paint.sample_weight_group,
|
2019-03-08 15:07:18 +01:00
|
|
|
),
|
|
|
|
|
None,
|
2019-03-12 10:51:04 +11:00
|
|
|
lambda context: (
|
2021-11-09 15:43:34 +11:00
|
|
|
(
|
|
|
|
|
_defs_view3d_generic.cursor,
|
|
|
|
|
None,
|
|
|
|
|
*VIEW3D_PT_tools_active._tools_transform,
|
|
|
|
|
)
|
2019-03-31 18:43:14 +02:00
|
|
|
if context is None or context.pose_object
|
2019-03-12 10:51:04 +11:00
|
|
|
else ()
|
|
|
|
|
),
|
2018-05-01 12:20:53 +02:00
|
|
|
None,
|
Fix #44834: Add bone selection icon next to face and vertex selection in weight paint mode
Currently, in weight paint mode, there is an icon for
face and vertex selection mode, but there isn't one
for the default mode where the user can select a bone
in any tool by alt clicking.
This lack of indication might lead to confusion for the users
when they are not able to select a bone by
alt clicking during weight painting.
By adding a bone selection icon when there is a pose
mode armature, we can communicate to the user that:
1. they can select a bone while the bone selection icon is active.
(when they are not in face or vertex selection mode)
2. they have forgot to select an armature when entering
weight paint mode by not showing the bone selection
icon at all when there is no pose mode armature.
When the bone selection icon is inactive,
the user can't select a bone.
(alt clicking selects face and vertex mode's respective element)
When no armature is selected when entering weight paint mode,
the bone selection icon doesn't show up indicating that the user
has forgot to select an armature.
(The user is also unable to select a bone by alt clicking.)
## Selection tool for bone selection mode
Currently, while selection tools exist for face and vertex
selection mode, one doesn't exist for the default mode
(bone selection mode). As the default mode will be getting
a clear indicator that it will function as a bone selection mode,
I added a selection tool entry for the bone selection mode.
Face and vertex selection modes has the shortcut 1 and 2,
so it seemed natural to give bone selection mode the shortcut of 3.
Pull Request: https://projects.blender.org/blender/blender/pulls/115409
2023-12-01 13:38:58 +01:00
|
|
|
_defs_weight_paint.poll_select_tools,
|
2019-05-03 09:41:34 +02:00
|
|
|
*_tools_annotate,
|
2018-04-30 15:21:04 +02:00
|
|
|
],
|
2023-07-03 16:34:30 +02:00
|
|
|
'PAINT_GREASE_PENCIL': [
|
|
|
|
|
_defs_view3d_generic.cursor,
|
|
|
|
|
None,
|
|
|
|
|
_defs_paint_grease_pencil.draw,
|
2023-07-20 13:56:23 +02:00
|
|
|
_defs_paint_grease_pencil.erase,
|
2023-07-03 16:34:30 +02:00
|
|
|
],
|
2023-02-14 10:30:49 +01:00
|
|
|
'PAINT_GPENCIL': [
|
2018-11-09 17:05:32 +11:00
|
|
|
_defs_view3d_generic.cursor,
|
|
|
|
|
None,
|
2018-07-31 10:22:19 +02:00
|
|
|
_defs_gpencil_paint.generate_from_brushes,
|
2019-01-11 19:15:23 +01:00
|
|
|
_defs_gpencil_paint.cutter,
|
2018-11-09 17:05:32 +11:00
|
|
|
None,
|
2019-10-11 13:28:22 +02:00
|
|
|
_defs_gpencil_paint.eyedropper,
|
|
|
|
|
None,
|
2018-11-09 17:05:32 +11:00
|
|
|
_defs_gpencil_paint.line,
|
2019-10-18 22:02:45 +01:00
|
|
|
_defs_gpencil_paint.polyline,
|
2018-12-03 14:55:57 +00:00
|
|
|
_defs_gpencil_paint.arc,
|
2018-12-15 17:21:47 +01:00
|
|
|
_defs_gpencil_paint.curve,
|
2018-12-17 19:03:46 +01:00
|
|
|
_defs_gpencil_paint.box,
|
|
|
|
|
_defs_gpencil_paint.circle,
|
2020-01-07 11:29:42 +01:00
|
|
|
None,
|
2021-02-19 17:18:12 +01:00
|
|
|
_defs_gpencil_paint.interpolate,
|
|
|
|
|
None,
|
2020-01-07 11:29:42 +01:00
|
|
|
*_tools_annotate,
|
2018-07-31 10:22:19 +02:00
|
|
|
],
|
2023-02-14 10:30:49 +01:00
|
|
|
'EDIT_GPENCIL': [
|
2023-06-21 16:47:18 +02:00
|
|
|
*_tools_gpencil_select,
|
2018-11-16 09:27:53 +11:00
|
|
|
_defs_view3d_generic.cursor,
|
2018-07-31 10:22:19 +02:00
|
|
|
None,
|
2018-10-23 13:03:25 +02:00
|
|
|
*_tools_transform,
|
|
|
|
|
None,
|
2019-03-04 19:31:36 +01:00
|
|
|
_defs_gpencil_edit.extrude,
|
2019-03-07 11:12:30 +01:00
|
|
|
_defs_gpencil_edit.radius,
|
2018-07-31 10:22:19 +02:00
|
|
|
_defs_gpencil_edit.bend,
|
2019-03-07 11:12:30 +01:00
|
|
|
(
|
|
|
|
|
_defs_gpencil_edit.shear,
|
|
|
|
|
_defs_gpencil_edit.tosphere,
|
|
|
|
|
),
|
2020-03-09 16:27:24 +01:00
|
|
|
_defs_gpencil_edit.transform_fill,
|
|
|
|
|
None,
|
2021-02-19 17:18:12 +01:00
|
|
|
_defs_gpencil_edit.interpolate,
|
|
|
|
|
None,
|
2020-01-07 11:29:42 +01:00
|
|
|
*_tools_annotate,
|
2018-07-31 10:22:19 +02:00
|
|
|
],
|
2023-02-14 10:30:49 +01:00
|
|
|
'SCULPT_GPENCIL': [
|
2018-11-13 16:52:39 +11:00
|
|
|
_defs_gpencil_sculpt.generate_from_brushes,
|
2019-08-10 17:19:54 +02:00
|
|
|
None,
|
2020-01-07 11:29:42 +01:00
|
|
|
*_tools_annotate,
|
2019-08-10 17:19:54 +02:00
|
|
|
lambda context: (
|
|
|
|
|
VIEW3D_PT_tools_active._tools_gpencil_select
|
|
|
|
|
if _defs_gpencil_sculpt.poll_select_mask(context)
|
|
|
|
|
else ()
|
|
|
|
|
),
|
2018-07-31 10:22:19 +02:00
|
|
|
],
|
2023-02-14 10:30:49 +01:00
|
|
|
'WEIGHT_GPENCIL': [
|
2018-11-13 16:52:39 +11:00
|
|
|
_defs_gpencil_weight.generate_from_brushes,
|
2020-01-07 11:29:42 +01:00
|
|
|
None,
|
|
|
|
|
*_tools_annotate,
|
2018-07-31 10:22:19 +02:00
|
|
|
],
|
2023-02-14 10:30:49 +01:00
|
|
|
'VERTEX_GPENCIL': [
|
2020-03-09 16:27:24 +01:00
|
|
|
_defs_gpencil_vertex.generate_from_brushes,
|
|
|
|
|
None,
|
|
|
|
|
*_tools_annotate,
|
|
|
|
|
None,
|
|
|
|
|
lambda context: (
|
|
|
|
|
VIEW3D_PT_tools_active._tools_gpencil_select
|
|
|
|
|
if _defs_gpencil_vertex.poll_select_mask(context)
|
|
|
|
|
else ()
|
|
|
|
|
),
|
|
|
|
|
],
|
2023-02-14 10:30:49 +01:00
|
|
|
'SCULPT_CURVES': [
|
2023-04-14 20:12:05 +10:00
|
|
|
_defs_curves_sculpt.generate_from_brushes,
|
2022-05-31 19:00:24 +02:00
|
|
|
None,
|
|
|
|
|
*_tools_annotate,
|
2022-02-18 09:12:41 +01:00
|
|
|
],
|
2017-10-21 16:19:48 +11:00
|
|
|
}
|
2020-10-02 10:15:51 +10:00
|
|
|
|
|
|
|
|
|
2020-01-22 14:54:44 +01:00
|
|
|
class SEQUENCER_PT_tools_active(ToolSelectPanelHelper, Panel):
|
2023-02-14 10:30:49 +01:00
|
|
|
bl_space_type = 'SEQUENCE_EDITOR'
|
|
|
|
|
bl_region_type = 'TOOLS'
|
2020-01-22 14:54:44 +01:00
|
|
|
bl_label = "Tools" # not visible
|
2023-02-14 10:30:49 +01:00
|
|
|
bl_options = {'HIDE_HEADER'}
|
2020-01-22 14:54:44 +01:00
|
|
|
|
2023-04-18 10:42:00 +10:00
|
|
|
# Satisfy the `ToolSelectPanelHelper` API.
|
2020-01-22 14:54:44 +01:00
|
|
|
keymap_prefix = "Sequence Editor Tool:"
|
|
|
|
|
|
|
|
|
|
# Default group to use as a fallback.
|
|
|
|
|
tool_fallback_id = "builtin.select"
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
def tools_from_context(cls, context, mode=None):
|
|
|
|
|
if mode is None:
|
|
|
|
|
if context.space_data:
|
|
|
|
|
mode = context.space_data.view_type
|
|
|
|
|
for tools in (cls._tools[None], cls._tools.get(mode, ())):
|
|
|
|
|
for item in tools:
|
|
|
|
|
if not (type(item) is ToolDef) and callable(item):
|
|
|
|
|
yield from item(context)
|
|
|
|
|
else:
|
|
|
|
|
yield item
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
def tools_all(cls):
|
|
|
|
|
yield from cls._tools.items()
|
2017-10-21 16:19:48 +11:00
|
|
|
|
2021-11-09 00:14:45 +11:00
|
|
|
# Private tool lists for convenient reuse in `_tools`.
|
|
|
|
|
|
2020-01-22 14:54:44 +01:00
|
|
|
_tools_select = (
|
|
|
|
|
(
|
|
|
|
|
_defs_sequencer_select.select,
|
|
|
|
|
_defs_sequencer_select.box,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
_tools_annotate = (
|
|
|
|
|
(
|
|
|
|
|
_defs_annotate.scribble,
|
|
|
|
|
_defs_annotate.line,
|
|
|
|
|
_defs_annotate.poly,
|
|
|
|
|
_defs_annotate.eraser,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
|
2021-11-09 00:14:45 +11:00
|
|
|
# Private tools dictionary, store data to implement `tools_all` & `tools_from_context`.
|
2023-01-06 13:52:57 +11:00
|
|
|
# The keys match sequence editors view type: `context.space_data.view_type`.
|
2021-11-09 00:14:45 +11:00
|
|
|
# The values represent the tools, see `ToolSelectPanelHelper` for details.
|
2020-01-22 14:54:44 +01:00
|
|
|
_tools = {
|
2023-02-14 10:30:49 +01:00
|
|
|
None: [
|
|
|
|
|
],
|
|
|
|
|
'PREVIEW': [
|
2021-09-21 09:38:30 +02:00
|
|
|
*_tools_select,
|
2021-10-07 12:32:04 +11:00
|
|
|
_defs_sequencer_generic.cursor,
|
|
|
|
|
None,
|
2021-09-21 09:38:30 +02:00
|
|
|
_defs_sequencer_generic.translate,
|
|
|
|
|
_defs_sequencer_generic.rotate,
|
|
|
|
|
_defs_sequencer_generic.scale,
|
2021-10-08 12:09:27 +02:00
|
|
|
_defs_sequencer_generic.transform,
|
|
|
|
|
None,
|
2020-04-13 00:28:27 +02:00
|
|
|
_defs_sequencer_generic.sample,
|
2020-01-22 14:54:44 +01:00
|
|
|
*_tools_annotate,
|
|
|
|
|
],
|
2023-02-14 10:30:49 +01:00
|
|
|
'SEQUENCER': [
|
2020-01-22 14:54:44 +01:00
|
|
|
*_tools_select,
|
2020-02-16 21:39:12 +01:00
|
|
|
_defs_sequencer_generic.blade,
|
2020-01-22 14:54:44 +01:00
|
|
|
],
|
2023-02-14 10:30:49 +01:00
|
|
|
'SEQUENCER_PREVIEW': [
|
2020-01-22 14:54:44 +01:00
|
|
|
*_tools_select,
|
2021-10-07 12:32:04 +11:00
|
|
|
None,
|
2020-12-15 22:13:26 +01:00
|
|
|
*_tools_annotate,
|
2021-10-08 12:09:27 +02:00
|
|
|
None,
|
|
|
|
|
_defs_sequencer_generic.blade,
|
2020-01-22 14:54:44 +01:00
|
|
|
],
|
|
|
|
|
}
|
2018-11-04 10:25:27 +11:00
|
|
|
|
2020-02-16 21:39:12 +01:00
|
|
|
|
2017-10-21 16:19:48 +11:00
|
|
|
classes = (
|
2018-05-16 18:41:11 +02:00
|
|
|
IMAGE_PT_tools_active,
|
2018-11-27 18:39:29 +11:00
|
|
|
NODE_PT_tools_active,
|
2017-10-21 16:19:48 +11:00
|
|
|
VIEW3D_PT_tools_active,
|
2020-01-22 14:54:44 +01:00
|
|
|
SEQUENCER_PT_tools_active,
|
2017-10-21 16:19:48 +11:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__": # only for live edit.
|
|
|
|
|
from bpy.utils import register_class
|
|
|
|
|
for cls in classes:
|
|
|
|
|
register_class(cls)
|