0
$\begingroup$

How can I get(not set) the active tool in Python? I know there is:

>>> bpy.context.workspace.tools.from_space_view3d_mode("EDIT_MESH", create=False).idname
'builtin.knife'

But it begs the question: How can I get the current "space view3d mode"(EDIT_MESH in this case)? I tried:

>>> bpy.context.object.mode
'EDIT'

But it returned things like EDIT and can't be used for bpy.context.workspace.tools.from_space_view3d_mode.

$\endgroup$
1
  • 2
    $\begingroup$ context.mode? $\endgroup$
    – batFINGER
    Commented Jul 5, 2021 at 23:36

1 Answer 1

2
$\begingroup$
>>> bpy.context.mode

options are [EDIT_MESH’, ‘EDIT_CURVE’, ‘EDIT_SURFACE’, ‘EDIT_TEXT’, ‘EDIT_ARMATURE’, ‘EDIT_METABALL’, ‘EDIT_LATTICE’, ‘POSE’, ‘SCULPT’, ‘PAINT_WEIGHT’, ‘PAINT_VERTEX’, ‘PAINT_TEXTURE’, ‘PARTICLE’, ‘OBJECT’, ‘PAINT_GPENCIL’, ‘EDIT_GPENCIL’, ‘SCULPT_GPENCIL’, ‘WEIGHT_GPENCIL’]

https://docs.blender.org/api/current/bpy.context.html#bpy.context.mode

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .