2
$\begingroup$

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.

$\endgroup$
4
$\begingroup$

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
| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.