[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18490] branches/blender2.5/blender/source /blender/editors/space_view3d/view3d_ops.c: 2.5 / Keymap definition

Nathan Letwory jesterking at letwory.net
Tue Jan 13 22:18:06 CET 2009


Revision: 18490
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18490
Author:   jesterking
Date:     2009-01-13 22:18:05 +0100 (Tue, 13 Jan 2009)

Log Message:
-----------
2.5 / Keymap definition
* For some reason builds on Windows would crash when tabbing into edit mode with default .b.blend
  Problem is that it is not very clear why it happens. The debug trace I managed to get pointed at
  SCRIPT_OT_run_pyfile being run when pressing TAB.
  Changing the way how this quickhack for running scripts is added made the crash go away, but this
  points at a potential problem in the creation of keymaps. The original form is the plenty used:
  
  RNA_string_set(WM_keymap_add_item(keymap, "SCRIPT_OT_run_pyfile", PKEY, KM_PRESS, 0, 0)->ptr, "filename", "test.py");

  But changing that to:

  km = WM_keymap_add_item(keymap, "SCRIPT_OT_run_pyfile", PKEY, KM_PRESS, 0, 0);
  RNA_string_set(km->ptr, "filename", "test.py");

  Properly prevents the execution of the script operator. It looks like somewhere
  something goes wrong, but no idea what, yet. Probably a good thing to investigate now!
  Apparently this doesn't happen on Linux (and probably not on OSX either).

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_ops.c

Modified: branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_ops.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_ops.c	2009-01-13 20:50:07 UTC (rev 18489)
+++ branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_ops.c	2009-01-13 21:18:05 UTC (rev 18490)
@@ -163,7 +163,8 @@
 	WM_keymap_add_item(keymap, "VIEW3D_OT_wpaint_toggle", TABKEY, KM_PRESS, KM_CTRL, 0);
 
 	/* TODO - this is just while we have no way to load a text datablock */
-	RNA_string_set(WM_keymap_add_item(keymap, "SCRIPT_OT_run_pyfile", PKEY, KM_PRESS, 0, 0)->ptr, "filename", "test.py");
+	km = WM_keymap_add_item(keymap, "SCRIPT_OT_run_pyfile", PKEY, KM_PRESS, 0, 0);
+	RNA_string_set(km->ptr, "filename", "test.py");
 
 	transform_keymap_for_space(wm, keymap, SPACE_VIEW3D);
 





More information about the Bf-blender-cvs mailing list