Changeset View
Changeset View
Standalone View
Standalone View
source/blender/windowmanager/intern/wm_keymap_utils.c
| Show First 20 Lines • Show All 211 Lines • ▼ Show 20 Lines | wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname) | ||||
| * BOID_OT | * BOID_OT | ||||
| * BUTTONS_OT | * BUTTONS_OT | ||||
| * CONSTRAINT_OT | * CONSTRAINT_OT | ||||
| * PAINT_OT | * PAINT_OT | ||||
| * ED_OT | * ED_OT | ||||
| * FLUID_OT | * FLUID_OT | ||||
| * TEXTURE_OT | * TEXTURE_OT | ||||
| * UI_OT | * UI_OT | ||||
| * VIEW2D_OT | |||||
| * WORLD_OT | * WORLD_OT | ||||
| */ | */ | ||||
| wmKeyMap *km = NULL; | wmKeyMap *km = NULL; | ||||
| wmWindowManager *wm = CTX_wm_manager(C); | wmWindowManager *wm = CTX_wm_manager(C); | ||||
| SpaceLink *sl = CTX_wm_space_data(C); | SpaceLink *sl = CTX_wm_space_data(C); | ||||
| /* Window */ | /* Window */ | ||||
| ▲ Show 20 Lines • Show All 110 Lines • ▼ Show 20 Lines | switch (CTX_data_mode_enum(C)) { | ||||
| break; | break; | ||||
| case CTX_MODE_SCULPT: | case CTX_MODE_SCULPT: | ||||
| km = WM_keymap_find_all(wm, "Sculpt", 0, 0); | km = WM_keymap_find_all(wm, "Sculpt", 0, 0); | ||||
| break; | break; | ||||
| default: | default: | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| /* General 2D View, not bound to a specific spacetype. */ | |||||
| else if (STRPREFIX(opname, "VIEW2D_OT")) { | |||||
| km = WM_keymap_find_all_spaceid_or_empty(wm, "View2D", sl->spacetype, 0); | |||||
Severin: Why not use `WM_keymap_find_all()` with a spacetype of 0, like done for other cases here?
So… | |||||
lichtwerkAuthorUnsubmitted Not Done Inline ActionsYeah, was my first intuition as well (see the patch description), but since there is a dedicated function which includes just that I thought it would be more descriptive, but you asking the question is already proof enough that it isnt :) So I guess, go with WM_keymap_find_all? lichtwerk: Yeah, was my first intuition as well (see the patch description), but since there is a… | |||||
SeverinUnsubmitted Not Done Inline ActionsYeah, _spaceid_or_empty also isn't too helpful as a description, had to look up the definition to see what it does. Severin: Yeah, `_spaceid_or_empty` also isn't too helpful as a description, had to look up the… | |||||
| } | |||||
| /* Image Editor */ | /* Image Editor */ | ||||
| else if (STRPREFIX(opname, "IMAGE_OT")) { | else if (STRPREFIX(opname, "IMAGE_OT")) { | ||||
| km = WM_keymap_find_all(wm, "Image", sl->spacetype, 0); | km = WM_keymap_find_all(wm, "Image", sl->spacetype, 0); | ||||
| } | } | ||||
| /* Clip Editor */ | /* Clip Editor */ | ||||
| else if (STRPREFIX(opname, "CLIP_OT")) { | else if (STRPREFIX(opname, "CLIP_OT")) { | ||||
| km = WM_keymap_find_all(wm, "Clip", sl->spacetype, 0); | km = WM_keymap_find_all(wm, "Clip", sl->spacetype, 0); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 167 Lines • Show Last 20 Lines | |||||
Why not use WM_keymap_find_all() with a spacetype of 0, like done for other cases here?
So: