diff options
author | Campbell Barton <ideasman42@gmail.com> | 2008-12-25 17:17:54 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2008-12-25 17:17:54 +0300 |
commit | de9437e57ab34b7ef3e1f8777e7ac1fa09efa785 (patch) | |
tree | 7b7f19a7aacf64b7143d10a7221f8c6692eb6420 /source/blender/editors/space_script/script_ops.c | |
parent | d7e8becefe6772ae635fa77ef4e483bed92a85a5 (diff) |
* temporary PKey in the script and 3D view runs "./test.py" (for testing PyOperators that need to run in the user interface context atm)
* added ED_SCRIPT_OT_run_pyfile that takes a filename argument.
* RNA_property_string_set didn't add a value to ID props if the prop wasnt there (like ints, floats and bools do)
* bpy_operator.c - raise an error when unknown keyword args are passed to any operator .
Examples of bpy operator api...
bpyoperator.ED_VIEW3D_OT_viewhome(center=1)
bpyoperator.ED_SCR_OT_frame_offset(delta=10)
bpyoperator.ED_VIEW3D_OT_make_parent(type='OBJECT')
At the moment there is no way to stop the operators .invoke() function from running so ED_VIEW3D_OT_make_parent still opens the menu even though it doesn't need to.
Diffstat (limited to 'source/blender/editors/space_script/script_ops.c')
-rw-r--r-- | source/blender/editors/space_script/script_ops.c | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/source/blender/editors/space_script/script_ops.c b/source/blender/editors/space_script/script_ops.c new file mode 100644 index 00000000000..f6e4fa73cae --- /dev/null +++ b/source/blender/editors/space_script/script_ops.c @@ -0,0 +1,72 @@ +/** + * $Id: + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * The Original Code is Copyright (C) 2008 Blender Foundation. + * All rights reserved. + * + * + * Contributor(s): Blender Foundation + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include <stdlib.h> +#include <math.h> + +#include "MEM_guardedalloc.h" + +#include "DNA_scene_types.h" +#include "DNA_screen_types.h" +#include "DNA_space_types.h" +#include "DNA_userdef_types.h" +#include "DNA_windowmanager_types.h" + +#include "BLI_arithb.h" +#include "BLI_blenlib.h" + +#include "BKE_context.h" +#include "BKE_global.h" +#include "BKE_utildefines.h" + +#include "RNA_access.h" +#include "RNA_define.h" + +#include "WM_api.h" +#include "WM_types.h" + +#include "ED_screen.h" + +#include "script_intern.h" + + +/* ************************** registration **********************************/ + +void script_operatortypes(void) +{ + WM_operatortype_append(ED_SCRIPT_OT_run_pyfile); +} + +void script_keymap(wmWindowManager *wm) +{ + ListBase *keymap= WM_keymap_listbase(wm, "Script", SPACE_SCRIPT, 0); + + /* TODO - this is just while we have no way to load a text datablock */ + RNA_string_set(WM_keymap_add_item(keymap, "ED_SCRIPT_OT_run_pyfile", PKEY, KM_PRESS, 0, 0)->ptr, "filename", "test.py"); +} + |