[Bf-blender-cvs] [fa1945c] master: Allow accessing modal keymap strings directly from keymap

Julian Eisel noreply at git.blender.org
Sat Aug 1 18:00:42 CEST 2015


Commit: fa1945c9e52e7afea9db20447335b9b4e108de2f
Author: Julian Eisel
Date:   Sat Aug 1 13:01:30 2015 +0200
Branches: master
https://developer.blender.org/rBfa1945c9e52e7afea9db20447335b9b4e108de2f

Allow accessing modal keymap strings directly from keymap

Previously you had to pass operator which in some cases might not be available or hard to get.

===================================================================

M	source/blender/windowmanager/WM_keymap.h
M	source/blender/windowmanager/intern/wm_keymap.c

===================================================================

diff --git a/source/blender/windowmanager/WM_keymap.h b/source/blender/windowmanager/WM_keymap.h
index cd42f36..28a8340 100644
--- a/source/blender/windowmanager/WM_keymap.h
+++ b/source/blender/windowmanager/WM_keymap.h
@@ -82,6 +82,8 @@ int			WM_keymap_item_compare(struct wmKeyMapItem *k1, struct wmKeyMapItem *k2);
 
 /* Modal Keymap */
 
+int WM_modalkeymap_items_to_string(
+        struct wmKeyMap *km, const int propvalue, const bool compact, const int len, char *r_str);
 int WM_modalkeymap_operator_items_to_string(
         struct wmOperatorType *ot, const int propvalue, const bool compact, const int len, char *r_str);
 char *WM_modalkeymap_operator_items_to_string_buf(
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index e65ce47..17cb84b 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -975,10 +975,9 @@ int WM_keymap_item_to_string(wmKeyMapItem *kmi, const bool compact, const int le
 	            compact, len, r_str);
 }
 
-int WM_modalkeymap_operator_items_to_string(
-        wmOperatorType *ot, const int propvalue, const bool compact, const int len, char *r_str)
+int WM_modalkeymap_items_to_string(
+        wmKeyMap *km, const int propvalue, const bool compact, const int len, char *r_str)
 {
-	wmKeyMap *km = ot->modalkeymap;
 	int totlen = 0;
 	bool add_sep = false;
 
@@ -1004,6 +1003,12 @@ int WM_modalkeymap_operator_items_to_string(
 	return totlen;
 }
 
+int WM_modalkeymap_operator_items_to_string(
+        wmOperatorType *ot, const int propvalue, const bool compact, const int len, char *r_str)
+{
+    return WM_modalkeymap_items_to_string(ot->modalkeymap, propvalue, compact, len, r_str);
+}
+
 char *WM_modalkeymap_operator_items_to_string_buf(
         wmOperatorType *ot, const int propvalue, const bool compact,
         const int max_len, int *r_available_len, char **r_str)




More information about the Bf-blender-cvs mailing list