Gizmo(bpy_struct)¶
base class — bpy_struct
-
class
bpy.types.
Gizmo
(bpy_struct)¶ Collection of gizmos
-
alpha
¶ - Type
float in [0, 1], default 0.0
-
alpha_highlight
¶ - Type
float in [0, 1], default 0.0
-
bl_idname
¶ - Type
string, default “”, (never None)
-
color
¶ - Type
float array of 3 items in [0, inf], default (0.0, 0.0, 0.0)
-
color_highlight
¶ - Type
float array of 3 items in [0, inf], default (0.0, 0.0, 0.0)
-
group
¶ Gizmo group this gizmo is a member of
- Type
GizmoGroup
, (readonly)
-
hide
¶ - Type
boolean, default False
-
hide_keymap
¶ Ignore the key-map for this gizmo
- Type
boolean, default False
-
hide_select
¶ - Type
boolean, default False
-
is_highlight
¶ - Type
boolean, default False, (readonly)
-
is_modal
¶ - Type
boolean, default False, (readonly)
-
line_width
¶ - Type
float in [0, inf], default 0.0
-
matrix_basis
¶ - Type
float 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))
-
matrix_offset
¶ - Type
float 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))
-
matrix_space
¶ - Type
float 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))
-
matrix_world
¶ - Type
float 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)
-
properties
¶ - Type
GizmoProperties
, (readonly, never None)
-
scale_basis
¶ - Type
float in [0, inf], default 0.0
-
select
¶ - Type
boolean, default False
-
select_bias
¶ Depth bias used for selection
- Type
float in [-inf, inf], default 0.0
-
use_draw_hover
¶ - Type
boolean, default False
-
use_draw_modal
¶ Show while dragging
- Type
boolean, default False
-
use_draw_offset_scale
¶ Scale the offset matrix (use to apply screen-space offset)
- Type
boolean, default False
-
use_draw_scale
¶ Use scale when calculating the matrix
- Type
boolean, default False
-
use_draw_value
¶ Show an indicator for the current value while dragging
- Type
boolean, default False
-
use_event_handle_all
¶ When highlighted, do not pass events through to be handled by other keymaps
- Type
boolean, default False
-
use_grab_cursor
¶ - Type
boolean, default False
-
use_operator_tool_properties
¶ Merge active tool properties on activation (does not overwrite existing)
- Type
boolean, default False
-
use_select_background
¶ Don’t write into the depth buffer
- Type
boolean, default False
-
use_tooltip
¶ Use tooltips when hovering over this gizmo
- Type
boolean, default False
-
draw
(context)¶
-
draw_select
(context, select_id=0)¶
-
test_select
(context, location)¶ - Parameters
location (int array of 2 items in [-inf, inf], (never None)) – Location, Region coordinates
- Returns
Use -1 to skip this gizmo
- Return type
int in [-1, inf]
-
modal
(context, event, tweak)¶ - Parameters
tweak (enum set in {'PRECISE', 'SNAP'}) – Tweak
- Returns
result
RUNNING_MODAL
Running Modal – Keep the operator running with blender.CANCELLED
Cancelled – The operator exited without doing anything, so no undo entry should be pushed.FINISHED
Finished – The operator exited after completing its action.PASS_THROUGH
Pass Through – Do nothing and pass the event on.INTERFACE
Interface – Handled but not executed (popup menus).
- Return type
enum set in {‘RUNNING_MODAL’, ‘CANCELLED’, ‘FINISHED’, ‘PASS_THROUGH’, ‘INTERFACE’}
-
setup
()¶
-
invoke
(context, event)¶ - Returns
result
RUNNING_MODAL
Running Modal – Keep the operator running with blender.CANCELLED
Cancelled – The operator exited without doing anything, so no undo entry should be pushed.FINISHED
Finished – The operator exited after completing its action.PASS_THROUGH
Pass Through – Do nothing and pass the event on.INTERFACE
Interface – Handled but not executed (popup menus).
- Return type
enum set in {‘RUNNING_MODAL’, ‘CANCELLED’, ‘FINISHED’, ‘PASS_THROUGH’, ‘INTERFACE’}
-
exit
(context, cancel)¶ - Parameters
cancel (boolean) – Cancel, otherwise confirm
-
select_refresh
()¶
-
draw_preset_box
(matrix, select_id=- 1)¶ Draw a box
- Parameters
matrix (float multi-dimensional array of 4 * 4 items in [-inf, inf]) – The matrix to transform
select_id (int in [-1, inf], (optional)) – Zero when not selecting
-
draw_preset_arrow
(matrix, axis='POS_Z', select_id=- 1)¶ Draw a box
- Parameters
matrix (float multi-dimensional array of 4 * 4 items in [-inf, inf]) – The matrix to transform
axis (enum in ['POS_X', 'POS_Y', 'POS_Z', 'NEG_X', 'NEG_Y', 'NEG_Z'], (optional)) – Arrow Orientation
select_id (int in [-1, inf], (optional)) – Zero when not selecting
-
draw_preset_circle
(matrix, axis='POS_Z', select_id=- 1)¶ Draw a box
- Parameters
matrix (float multi-dimensional array of 4 * 4 items in [-inf, inf]) – The matrix to transform
axis (enum in ['POS_X', 'POS_Y', 'POS_Z', 'NEG_X', 'NEG_Y', 'NEG_Z'], (optional)) – Arrow Orientation
select_id (int in [-1, inf], (optional)) – Zero when not selecting
-
draw_preset_facemap
(object, face_map, select_id=- 1)¶ Draw the face-map of a mesh object
- Parameters
object (
Object
, (never None)) – Objectface_map (int in [0, inf]) – Face map index
select_id (int in [-1, inf], (optional)) – Zero when not selecting
-
target_set_prop
(target, data, property, index=- 1)¶ - Parameters
target (string, (never None)) – Target property
data (
AnyType
, (never None)) – Data from which to take propertyproperty (string, (never None)) – Identifier of property in data
-
target_set_operator
(operator, index=0)¶ Operator to run when activating the gizmo (overrides property targets)
- Parameters
operator (string, (never None)) – Target operator
index (int in [0, 255], (optional)) – Part index
- Returns
Operator properties to fill in
- Return type
-
target_is_valid
(property)¶ - Parameters
property (string, (never None)) – Property identifier
- Return type
boolean
-
draw_custom_shape
(shape, *, matrix=None, select_id=None)¶ Draw a shape created form
bpy.types.Gizmo.draw_custom_shape
.- Parameters
shape (Undefined.) – The cached shape to draw.
matrix (
mathutils.Matrix
) – 4x4 matrix, when not givenbpy.types.Gizmo.matrix_world
is used.select_id – The selection id. Only use when drawing within
bpy.types.Gizmo.draw_select
.
-
static
new_custom_shape
(type, verts)¶ Create a new shape that can be passed to
bpy.types.Gizmo.draw_custom_shape
.- Parameters
type (string) – The type of shape to create in (POINTS, LINES, TRIS, LINE_STRIP).
verts (sequence of of 2D or 3D coordinates.) – Coordinates.
display_name (Callable that takes a string and returns a string.) – Optional callback that takes the full path, returns the name to display.
- Returns
The newly created shape.
- Return type
Undefined (it may change)
-
classmethod
bl_rna_get_subclass
(id, default=None)¶ - Parameters
id (string) – The RNA type identifier.
- Returns
The RNA type or default when not found.
- Return type
bpy.types.Struct
subclass
-
classmethod
bl_rna_get_subclass_py
(id, default=None)¶ - Parameters
id (string) – The RNA type identifier.
- 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 pair.
-
target_get_value(target):
Get the value of this target property.
- Parameters
target (string) – Target property name.
- Returns
The value of the target property.
- Return type
Single value or array based on the target type
-
target_set_handler(target, get, set, range=None):
Assigns callbacks to a gizmos property.
- Parameters
get (callable) – Function that returns the value for this property (single value or sequence).
set (callable) – Function that takes a single value argument and applies it.
range (callable) – Function that returns a (min, max) tuple for gizmos that use a range.
-
target_set_value(target):
Set the value of this target property.
- Parameters
target (string) – Target property name.
-
Inherited Properties
Inherited Functions
References