3

I thought this would have been stored in context.tool_settings or scene.tool_settings but it doesn't seem to be. I can access the default keymap value like this:

km.keymap_items['view3d.select_circle'].properties.radius

But this doesn't update after decreasing or increasing the radius any time durring or after you use the tool. Should also mention I'm not interested in accessing the Toolbar version of Circle Select radius property. I'm interested in accessing the radius property of the operator itself (view3d.select_circle). You can demonstrate to yourself how these properties differ by pressing the C hotkey vs accessing Circle Select via the Toolbar and changing the radius value on both.

Presumably the value is being stored somewhere because both the Toolbar version and direct operator radius values are stored separately. Also bpy.types.VIEW3D_OT_select_circle doesn't seem accessible, so I'm assuming I'm out of luck but thought I would double check.

Sicut Unum
  • 419
  • 3
  • 17

2 Answers2

5

Operator Properties Last

The window manager has some useful methods re looking up operators and their properties. Of particular use is WindowManager.operator_properties_last(...)

If we feed in the operator, in this case "view3d.select_circle"

>>> sc = C.window_manager.operator_properties_last("view3d.select_circle")
>>> sc.radius
273

it will return the last used properties of the operator.

If the operator has not been used (or does not exist) sc will be None

This is not read only. Changing the value will set it for the next run of the operator

>>> sc.radius = 40

Defaults

Possibly worth mentioning too, to get the default value use

>>> rna = bpy.ops.view3d.select_circle.get_rna_type()
>>> rna.properties['radius'].default
25

as it does seem that although the class name is as expected

>>> bpy.ops.view3d.select_circle.idname()
'VIEW3D_OT_select_circle'

after a change in API (around 2.79 IIRC) not all classes are accessible via bpy.types

>>> getattr(bpy.types, 'VIEW3D_OT_select_circle', None) is None
True
batFINGER
  • 84,216
  • 10
  • 108
  • 233
0

By looking into Blender source was able to write this bpy.context.workspace.tools['builtin.select_circle'].operator_properties("view3d.select_circle").radius = 10

you can set mode as well

bpy.context.workspace.tools['builtin.select_circle'].operator_properties("view3d.select_circle").mode = "ADD"

Sources https://github.com/blender/blender/blob/d8edc2c6345306b943d73d2806bea18b67c66bc3/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py#L432

Eyad Ahmed
  • 688
  • 5
  • 14