diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-10-13 19:30:19 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-10-13 19:30:19 +0400 |
commit | edfe78aec90a679a5e95ca479192f6f9ecab7ff0 (patch) | |
tree | 514c8a86b0beeb7814c81b411511f17be7e6d71b /source/blender/editors/space_view3d/view3d_ops.c | |
parent | bdbae465190c99d5f9f4742f0c4cccc35fb8ea46 (diff) |
Context operators for adjusting context values directly to avoid adding operators for adjusting single values which also need duplicate notifiers.
wm.context_set(path="scene.tool_settings.someattr", somevalue)
wm.context_toggle(path="scene.tool_settings.somebool")
wm.context_toggle_values(path="scene.tool_settings.some_enum", value_1="somevalue", value_2="othervalue") # switch between 2 values
wm.context_cycle_enum(path="scene.tool_settings.some_enum", reverse=False)
the path value is taken from the context so the full path is
context.scene.tool_settings...
This means in keymaps you can cycle draw modes, change PET- anything with rna access.
If its not so nice to map keys to operators like wm.context_set we could use macro's to wrap it and have its own name
Use this for PET and setting pivot options
- Made userpref key shortcut Ctrl+Alt+U since its not used in 2.4x
- added pivot_point_align (Alt+Comma)
- added PET wasnt rna wrapped correctly.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_ops.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_ops.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c index 74074a04188..758bf803fb8 100644 --- a/source/blender/editors/space_view3d/view3d_ops.c +++ b/source/blender/editors/space_view3d/view3d_ops.c @@ -221,6 +221,31 @@ void view3d_keymap(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "VIEW3D_OT_snap_menu", SKEY, KM_PRESS, KM_SHIFT, 0); + /* context ops */ + km = WM_keymap_add_item(keymap, "WM_OT_context_set", COMMAKEY, KM_PRESS, 0, 0); + RNA_string_set(km->ptr, "path", "space_data.pivot_point"); + RNA_string_set(km->ptr, "value", "'BOUNDING_BOX_CENTER'"); + + km = WM_keymap_add_item(keymap, "WM_OT_context_set", COMMAKEY, KM_PRESS, KM_CTRL, 0); /* 2.4x allowed Comma+Shift too, rather not use both */ + RNA_string_set(km->ptr, "path", "space_data.pivot_point"); + RNA_string_set(km->ptr, "value", "'MEDIAN_POINT'"); + + km = WM_keymap_add_item(keymap, "WM_OT_context_toggle", COMMAKEY, KM_PRESS, KM_ALT, 0); /* new in 2.5 */ + RNA_string_set(km->ptr, "path", "space_data.pivot_point_align"); + + km = WM_keymap_add_item(keymap, "WM_OT_context_set", PERIODKEY, KM_PRESS, 0, 0); + RNA_string_set(km->ptr, "path", "space_data.pivot_point"); + RNA_string_set(km->ptr, "value", "'CURSOR'"); + + km = WM_keymap_add_item(keymap, "WM_OT_context_set", PERIODKEY, KM_PRESS, KM_CTRL, 0); + RNA_string_set(km->ptr, "path", "space_data.pivot_point"); + RNA_string_set(km->ptr, "value", "'INDIVIDUAL_CENTERS'"); + + km = WM_keymap_add_item(keymap, "WM_OT_context_set", PERIODKEY, KM_PRESS, KM_ALT, 0); + RNA_string_set(km->ptr, "path", "space_data.pivot_point"); + RNA_string_set(km->ptr, "value", "'ACTIVE_ELEMENT'"); + + transform_keymap_for_space(keyconf, keymap, SPACE_VIEW3D); fly_modal_keymap(keyconf); |