Gizmo(bpy_struct)
base class — bpy_struct
- class bpy.types.Gizmo(bpy_struct)
Collection of gizmos
- alpha
(in [0, 1], default 0.0)
- Type:
float
- alpha_highlight
(in [0, 1], default 0.0)
- Type:
float
- bl_idname
(default “”, never None)
- Type:
str
- color
(array of 3 items, in [0, inf], default (0.0, 0.0, 0.0))
- Type:
- color_highlight
(array of 3 items, in [0, inf], default (0.0, 0.0, 0.0))
- Type:
- group
Gizmo group this gizmo is a member of (readonly)
- Type:
- hide
(default False)
- Type:
bool
- hide_keymap
Ignore the key-map for this gizmo (default False)
- Type:
bool
- hide_select
(default False)
- Type:
bool
- is_highlight
(default False, readonly)
- Type:
bool
- is_modal
(default False, readonly)
- Type:
bool
- line_width
(in [0, inf], default 0.0)
- Type:
float
- matrix_basis
(multi-dimensional array of 4 * 4 items, in [-inf, inf], default ((0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0)))
- Type:
- matrix_offset
(multi-dimensional array of 4 * 4 items, in [-inf, inf], default ((0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0)))
- Type:
- matrix_space
(multi-dimensional array of 4 * 4 items, in [-inf, inf], default ((0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0)))
- Type:
- matrix_world
(multi-dimensional array of 4 * 4 items, in [-inf, inf], default ((0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0)), readonly)
- Type:
- properties
(readonly, never None)
- Type:
- scale_basis
(in [0, inf], default 0.0)
- Type:
float
- select
(default False)
- Type:
bool
- select_bias
Depth bias used for selection (in [-inf, inf], default 0.0)
- Type:
float
- use_draw_hover
(default False)
- Type:
bool
- use_draw_modal
Show while dragging (default False)
- Type:
bool
- use_draw_offset_scale
Scale the offset matrix (use to apply screen-space offset) (default False)
- Type:
bool
- use_draw_scale
Use scale when calculating the matrix (default True)
- Type:
bool
- use_draw_value
Show an indicator for the current value while dragging (default False)
- Type:
bool
- use_event_handle_all
When highlighted, do not pass events through to be handled by other keymaps (default False)
- Type:
bool
- use_grab_cursor
(default False)
- Type:
bool
- use_operator_tool_properties
Merge active tool properties on activation (does not overwrite existing) (default False)
- Type:
bool
- use_select_background
Don’t write into the depth buffer (default False)
- Type:
bool
- use_tooltip
Use tooltips when hovering over this gizmo (default True)
- Type:
bool
- draw_select(context, *, select_id=0)
- Parameters:
context (
Context) – (never None)select_id (int) – (in [0, inf], optional)
- test_select(context, location)
- Parameters:
context (
Context) – (never None)location (Sequence[int]) – Location, Region coordinates (array of 2 items, in [-inf, inf], never None)
- Returns:
Use -1 to skip this gizmo (in [-1, inf])
- Return type:
int
- modal(context, event, tweak)
- Parameters:
- Returns:
result
- Return type:
set[Literal[Operator Return Items]]
- setup()
- invoke(context, event)
- Parameters:
- Returns:
result
- Return type:
set[Literal[Operator Return Items]]
- exit(context, cancel)
- Parameters:
context (
Context) – (never None)cancel (bool) – Cancel, otherwise confirm
- select_refresh()
- draw_preset_box(matrix, *, select_id=-1)
Draw a box
- Parameters:
matrix (
mathutils.Matrix) – The matrix to transform (multi-dimensional array of 4 * 4 items, in [-inf, inf])select_id (int) – ID to use when gizmo is selectable. Use -1 when not selecting., (in [-1, inf], optional)
- draw_preset_arrow(matrix, *, axis='POS_Z', select_id=-1)
Draw a box
- Parameters:
matrix (
mathutils.Matrix) – The matrix to transform (multi-dimensional array of 4 * 4 items, in [-inf, inf])axis (Literal[Object Axis Items]) – Arrow Orientation (optional)
select_id (int) – ID to use when gizmo is selectable. Use -1 when not selecting., (in [-1, inf], optional)
- draw_preset_circle(matrix, *, axis='POS_Z', select_id=-1)
Draw a box
- Parameters:
matrix (
mathutils.Matrix) – The matrix to transform (multi-dimensional array of 4 * 4 items, in [-inf, inf])axis (Literal[Object Axis Items]) – Arrow Orientation (optional)
select_id (int) – ID to use when gizmo is selectable. Use -1 when not selecting., (in [-1, inf], optional)
- target_set_prop(target, data, property, *, index=-1)
- Parameters:
target (str) – Target property (never None)
data (
AnyType) – Data from which to take property (never None)property (str) – Identifier of property in data (never None)
index (int) – (in [-1, inf], optional)
- target_set_operator(operator, *, index=0)
Operator to run when activating the gizmo (overrides property targets)
- Parameters:
operator (str) – Target operator (never None)
index (int) – Part index, (in [0, 255], optional)
- Returns:
Operator properties to fill in
- Return type:
- target_is_valid(property)
- Parameters:
property (str) – Property identifier (never None)
- Return type:
bool
- draw_custom_shape(shape, *, matrix=None, select_id=None)
Draw a shape created form
Gizmo.draw_custom_shape.- Parameters:
shape (Any) – The cached shape to draw.
matrix (
mathutils.Matrix| None) – 4x4 matrix, when not givenGizmo.matrix_worldis used.select_id (int | None) – The selection id. Only use when drawing within
Gizmo.draw_select.
- static new_custom_shape(type, verts)
Create a new shape that can be passed to
Gizmo.draw_custom_shape.- Parameters:
type (Literal['POINTS', 'LINES', 'TRIS', 'LINE_STRIP']) – The type of shape to create.
verts (Sequence[Sequence[float]]) – Sequence of 2D or 3D coordinates.
- Returns:
The newly created shape (the return type make change).
- Return type:
Any
- classmethod bl_rna_get_subclass(id, default=None, /)
- Parameters:
id (str) – The RNA type identifier.
default (
bpy.types.Struct| None) – The value to return when not found.
- Returns:
The RNA type or default when not found.
- Return type:
- classmethod bl_rna_get_subclass_py(id, default=None, /)
- Parameters:
id (str) – The RNA type identifier.
default (type | None) – The value to return when not found.
- Returns:
The class or default when not found.
- Return type:
type
- target_get_range(target)
Get the range for this target property.
- Parameters:
target – Target property name.
- Returns:
The range of this property (min, max).
- Return type:
tuple[float, float]
- target_get_value(target)
Get the value of this target property.
- Parameters:
target (str) – Target property name.
- Returns:
The value of the target property as a value or array based on the target type.
- Return type:
float | tuple[float, …]
- target_set_handler(target, get, set, range=None)
Assigns callbacks to a gizmos property.
- Parameters:
target (str) – Target property name.
get (Callable[[], float | Sequence[float]]) – Function that returns the value for this property (single value or sequence).
set (Callable[[tuple[float, ...]], Any]) – Function that takes a single value argument and applies it.
range (Callable[[], tuple[float, float]] | None) – Function that returns a (min, max) tuple for gizmos that use a range. The returned value is not used.
- target_set_value(target)
Set the value of this target property.
- Parameters:
target (str) – Target property name.