Hello!
I'm trying to set the orientation of the 3D cursor to "Geometry" in the keymapping preferences in Blender but having some difficulty. If anyone can point me in the right direction, I would really appreciate it!
Thank you.
There are different ways to change the key map:
You can change the user keymapping at runtime (although i'm not quite sure what the advantage would be over using the UI):
bpy.context.window_manager.keyconfigs['Blender user'].keymaps['3D View'].keymap_items['view3d.cursor3d'].properties.orientation = 'GEOM'
See docs for the operator properties: https://docs.blender.org/api/3.2/bpy.ops.view3d.html#bpy.ops.view3d.cursor3d
You need to call bpy.ops.wm.save_userpref to make this persistent, otherwise the change is discarded when closing Blender.
You can change the "factory default" by changing the properties in <Blender install>/<version>/scripts/presets/keyconfig/keymap_data/blender_default.py
. I wouldn't recommend this unless you are actually planning to submit a patch.
# 3D cursor
if params.cursor_tweak_event:
items.extend([
("view3d.cursor3d", params.cursor_set_event, {"properties": [("orientation": 'GEOM')]}),
("transform.translate", params.cursor_tweak_event,
{"properties": [("release_confirm", True), ("cursor_transform", True)]}),
])
else:
items.extend([
("view3d.cursor3d", params.cursor_set_event, {"properties": [("orientation": 'GEOM')]}
])