[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50817] trunk/blender/source/blender/ makesrna/intern/rna_wm.c: Make "name" member of RNA KeymapItem struct return the translated name of the underlying operator .

Bastien Montagne montagne29 at wanadoo.fr
Sat Sep 22 22:07:32 CEST 2012


Revision: 50817
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50817
Author:   mont29
Date:     2012-09-22 20:07:30 +0000 (Sat, 22 Sep 2012)
Log Message:
-----------
Make "name" member of RNA KeymapItem struct return the translated name of the underlying operator. Else, op names are usually not translated in keymap part of the user preferences! Thx to Mikl?\195?\179s Poms?\195?\161r for pointing this bug. :)

Modified Paths:
--------------
    trunk/blender/source/blender/makesrna/intern/rna_wm.c

Modified: trunk/blender/source/blender/makesrna/intern/rna_wm.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_wm.c	2012-09-22 17:45:52 UTC (rev 50816)
+++ trunk/blender/source/blender/makesrna/intern/rna_wm.c	2012-09-22 20:07:30 UTC (rev 50817)
@@ -765,14 +765,14 @@
 {
 	wmKeyMapItem *kmi = ptr->data;
 	wmOperatorType *ot = WM_operatortype_find(kmi->idname, 1);
-	strcpy(value, ot ? ot->name : kmi->idname);
+	strcpy(value, ot ? RNA_struct_ui_name(ot->srna) : kmi->idname);
 }
 
 static int rna_wmKeyMapItem_name_length(PointerRNA *ptr)
 {
 	wmKeyMapItem *kmi = ptr->data;
 	wmOperatorType *ot = WM_operatortype_find(kmi->idname, 1);
-	return strlen(ot ? ot->name : kmi->idname);
+	return strlen(ot ? RNA_struct_ui_name(ot->srna) : kmi->idname);
 }
 
 static int rna_KeyMapItem_userdefined_get(PointerRNA *ptr)
@@ -1793,7 +1793,7 @@
 	 * fallback on the operator ID */
 	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-	RNA_def_property_ui_text(prop, "Name", "Name of operator to call on input event");
+	RNA_def_property_ui_text(prop, "Name", "Name of operator (translated) to call on input event");
 	RNA_def_property_string_funcs(prop, "rna_wmKeyMapItem_name_get", "rna_wmKeyMapItem_name_length", NULL);
 	
 	prop = RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);




More information about the Bf-blender-cvs mailing list