Trying to change behaviour based on which of the three select tools (box, lasso, circle) is being used for the Drag operation in the transform tools (move scale, rotate, transform)
Tried figuring this out but the furthest I can get it is knowing that all three have a tool_fallback_id = 'builtin.select'
Here’s the script:
class VIEW3D_select_through(bpy.types.Operator):
"""Select Occluded Elements"""
bl_idname = "view3d.select_through"
bl_label = "Select Through Operator"
def execute(self, context):
from bl_ui.space_toolsystem_common import ToolSelectPanelHelper
space_type = context.space_data.type
tool_settings = context.tool_settings
if tool_settings.independent_select_through == True:
current_tool = bpy.context.workspace.tools.from_space_view3d_mode('EDIT_MESH', create=False).idname
if current_tool == "builtin.select_box":
tool_settings.select_through_box ^= True
elif current_tool == "builtin.select_circle":
tool_settings.select_through_circle ^= True
elif current_tool == "builtin.select_lasso":
tool_settings.select_through_lasso ^= True
elif current_tool == "builtin.move" or "builtin.rotate" or "builtin.scale" or "builtin.transform":
if tool_settings.workspace_tool_type == 'FALLBACK':
cls = ToolSelectPanelHelper._tool_class_from_space_type(space_type)
tool = cls.tool_fallback_id
#tool = cls._tool_get_by_id(context, cls.tool_fallback_id)
print(tool)
if tool == "builtin.select_box":
tool_settings.select_through_box ^= True
elif tool == "builtin.select_circle":
tool_settings.select_through_circle ^= True
elif tool == "builtin.select_lasso":
tool_settings.select_through_lasso ^= True
else:
tool_settings.select_through ^= True
return{'FINISHED'}
Tried to get any information that is different between the three (box, lasso, circle) by doing
tool = cls._tool_get_by_id(context, cls.tool_fallback_id)
but it’s the same regardless.
What it prints for each of the three tools:
(ToolDef(idname='builtin.select', label='Tweak', description=None, icon='ops.generic.select', cursor=None, widget=None, keymap=['3D View Tool: Tweak'], data_block=None, operator=None, draw_settings=None, draw_cursor=None), 0)
(ToolDef(idname='builtin.select', label='Tweak', description=None, icon='ops.generic.select', cursor=None, widget=None, keymap=['3D View Tool: Tweak'], data_block=None, operator=None, draw_settings=None, draw_cursor=None), 0)
(ToolDef(idname='builtin.select', label='Tweak', description=None, icon='ops.generic.select', cursor=None, widget=None, keymap=['3D View Tool: Tweak'], data_block=None, operator=None, draw_settings=None, draw_cursor=None), 0)
I know there’s gotta be something else I can use to distinguish between the three, thanks for any help