From bc9848f7e67c3e695403179f8bcdb78b0e5764a3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 13 Feb 2008 13:55:22 +0000 Subject: Added a global string to be used for the tempdir. since the user preference is not loaded in background mode and the user preference is not validated and has no fallback. 'btempdir' is set with BLI_where_is_temp() - This tries to use U.tempdir but falls back to $TEMP or /tmp/ --- source/blender/python/BPY_extern.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/python/BPY_extern.h') diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h index e4986727ab1..28c4c2f55ff 100644 --- a/source/blender/python/BPY_extern.h +++ b/source/blender/python/BPY_extern.h @@ -34,6 +34,7 @@ #define BPY_EXTERN_H extern char bprogname[]; /* holds a copy of argv[0], from creator.c */ +extern char btempdir[]; /* use this to store a valid temp directory */ struct Text; /* defined in DNA_text_types.h */ struct ID; /* DNA_ID.h */ -- cgit v1.2.3 From cf27a896faf6e5fee7eeea9e70fbee1a9447572f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 20 Feb 2008 13:42:15 +0000 Subject: Python Bugfix, Setting the user preference for python scripts didnt add the bpymodules subdirectory to sys.path (python module search path). Also problems with entering and exiting- the old path was used until next restart. --- source/blender/python/BPY_extern.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/python/BPY_extern.h') diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h index 28c4c2f55ff..8b4760fe25d 100644 --- a/source/blender/python/BPY_extern.h +++ b/source/blender/python/BPY_extern.h @@ -85,6 +85,7 @@ extern "C" { void BPY_post_start_python( void ); void init_syspath( int first_time ); void syspath_append( char *dir ); + void BPY_rebuild_syspath( void ); int BPY_Err_getLinenumber( void ); const char *BPY_Err_getFilename( void ); -- cgit v1.2.3 From cd934aa1a80e29aebb173d993497685fd29657bf Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sun, 24 Feb 2008 06:38:42 +0000 Subject: Patch #8344: Submitted by: Thomas Knight (epat) Parts committed: 1) Fixed a few misspellings in some error strings. 2) Fixed a (theoretical) bug with pyconstraints where a text object could be deleted from python but would remain linked to the constraint it was assigned to - causing slight UI usage discontinuities! Not committed yet: 3) Particle system bugfix in this patch has not been committed. Could jahka or brecht check this. --- source/blender/python/BPY_extern.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/python/BPY_extern.h') diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h index 8b4760fe25d..c3aef82751d 100644 --- a/source/blender/python/BPY_extern.h +++ b/source/blender/python/BPY_extern.h @@ -79,6 +79,7 @@ extern "C" { void BPY_pyconstraint_target(struct bPythonConstraint *con, struct bConstraintTarget *ct); void BPY_pyconstraint_update(struct Object *owner, struct bConstraint *con); int BPY_is_pyconstraint(struct Text *text); + void BPY_free_pyconstraint_links(struct Text *text); void BPY_start_python( int argc, char **argv ); void BPY_end_python( void ); -- cgit v1.2.3 From 08f306c81cb8015db59fe63ad1ef2c977751652e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 6 Mar 2008 21:25:15 +0000 Subject: Made python scripts save and load in the blend file so you can have the same scripts running when you open a blend file. Also scripts will re-run on undo rather then closing. This is done by saving and loading the name of the script or textblock of the 'Script' datablock, connected to the ScriptSpace. This way when there is a name but the script dosnt run. Blender runs the script or text block if available. --- source/blender/python/BPY_extern.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source/blender/python/BPY_extern.h') diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h index c3aef82751d..d7bd4f22fc6 100644 --- a/source/blender/python/BPY_extern.h +++ b/source/blender/python/BPY_extern.h @@ -44,13 +44,13 @@ struct ScriptLink; /* DNA_scriptlink_types.h */ struct ListBase; /* DNA_listBase.h */ struct SpaceText; /* DNA_space_types.h */ struct SpaceScript; /* DNA_space_types.h */ -struct Script; /* BPI_script.h */ struct ScrArea; /* DNA_screen_types.h */ struct bScreen; /* DNA_screen_types.h */ struct bConstraint; /* DNA_constraint_types.h */ struct bPythonConstraint; /* DNA_constraint_types.h */ struct bConstraintOb; /* DNA_constraint_types.h */ struct bConstraintTarget; /* DNA_constraint_types.h*/ +struct Script; /* DNA_screen_types.h */ #ifdef __cplusplus extern "C" { #endif @@ -94,6 +94,7 @@ extern "C" { int BPY_txt_do_python_Text( struct Text *text ); int BPY_menu_do_python( short menutype, int event ); void BPY_run_python_script( char *filename ); + int BPY_run_script(struct Script *script); void BPY_free_compiled_text( struct Text *text ); void BPY_clear_bad_scriptlinks( struct Text *byebye ); @@ -126,6 +127,7 @@ extern "C" { unsigned short event, short val, char ascii ); void BPY_clear_script( struct Script *script ); void BPY_free_finished_script( struct Script *script ); + void BPY_scripts_clear_pyobjects( void ); /* void BPY_Err_Handle(struct Text *text); */ /* void BPY_clear_bad_scriptlink(struct ID *id, struct Text *byebye); */ -- cgit v1.2.3 From a5d31fc28e7737b9e6ef3d56986cb2e2f0493047 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 15 Mar 2008 18:53:42 +0000 Subject: fix for [#8559] Python script that uses FIleSelector and has an error in it segfaults Blender --- source/blender/python/BPY_extern.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source/blender/python/BPY_extern.h') diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h index d7bd4f22fc6..bf7c4d7ad62 100644 --- a/source/blender/python/BPY_extern.h +++ b/source/blender/python/BPY_extern.h @@ -128,7 +128,9 @@ extern "C" { void BPY_clear_script( struct Script *script ); void BPY_free_finished_script( struct Script *script ); void BPY_scripts_clear_pyobjects( void ); - + + void error_pyscript( void ); + /* void BPY_Err_Handle(struct Text *text); */ /* void BPY_clear_bad_scriptlink(struct ID *id, struct Text *byebye); */ /* void BPY_clear_bad_scriptlist(struct ListBase *, struct Text *byebye); */ -- cgit v1.2.3 From 5d0a207ecb843c4c73be897cfccbf3a0d2db574b Mon Sep 17 00:00:00 2001 From: Chris Want Date: Wed, 16 Apr 2008 22:40:48 +0000 Subject: Patch from GSR that a) fixes a whole bunch of GPL/BL license blocks that were previously missed; and b) greatly increase my ohloh stats! --- source/blender/python/BPY_extern.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'source/blender/python/BPY_extern.h') diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h index bf7c4d7ad62..41e8004e25b 100644 --- a/source/blender/python/BPY_extern.h +++ b/source/blender/python/BPY_extern.h @@ -1,15 +1,12 @@ /* * $Id$ * - * ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** + * ***** 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. The Blender - * Foundation also sells licenses for use in proprietary software under - * the Blender License. See http://www.blender.org/BL/ for information - * about this. + * 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 @@ -27,7 +24,7 @@ * * Contributor(s): Michel Selten, Willian P. Germano, Chris Keith * - * ***** END GPL/BL DUAL LICENSE BLOCK ***** + * ***** END GPL LICENSE BLOCK ***** */ #ifndef BPY_EXTERN_H -- cgit v1.2.3 From 4f49a3b906bd4974056ca734beda7241b70031dc Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 23 Apr 2008 14:04:05 +0000 Subject: added ipo script template from blenderartists forTe, made scripts refresh on load factory settings and replaced elysiun with blenderartist.org in headers --- source/blender/python/BPY_extern.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source/blender/python/BPY_extern.h') diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h index 41e8004e25b..f6a27b80733 100644 --- a/source/blender/python/BPY_extern.h +++ b/source/blender/python/BPY_extern.h @@ -84,7 +84,8 @@ extern "C" { void init_syspath( int first_time ); void syspath_append( char *dir ); void BPY_rebuild_syspath( void ); - + int BPY_path_update( void ); + int BPY_Err_getLinenumber( void ); const char *BPY_Err_getFilename( void ); -- cgit v1.2.3 From dbb61988fdaa6085912dee6ab8f5569e63ef88fb Mon Sep 17 00:00:00 2001 From: Ian Thompson Date: Tue, 15 Jul 2008 07:04:31 +0000 Subject: Any script can now register a unique key combination as part of its bpy header. For a supported space type, the user may press this shortcut to invoke the script. Space types that are to support shortcuts like this should call BPY_menu_do_shortcut(...) from the event queue read method (See winqreadtextspace in drawtext.c for example) --- source/blender/python/BPY_extern.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source/blender/python/BPY_extern.h') diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h index f6a27b80733..3a826d49542 100644 --- a/source/blender/python/BPY_extern.h +++ b/source/blender/python/BPY_extern.h @@ -91,6 +91,8 @@ extern "C" { int BPY_txt_do_python_Text( struct Text *text ); int BPY_menu_do_python( short menutype, int event ); + int BPY_menu_do_shortcut( short menutype, unsigned short key, unsigned short modifiers ); + int BPY_menu_invoke( struct BPyMenu *pym, short menutype ); void BPY_run_python_script( char *filename ); int BPY_run_script(struct Script *script); void BPY_free_compiled_text( struct Text *text ); -- cgit v1.2.3 From aeb4d0c631537d93de084301cac6a5dc981b6655 Mon Sep 17 00:00:00 2001 From: Ian Thompson Date: Tue, 15 Jul 2008 07:34:46 +0000 Subject: Created a BPy module BPyTextPlugin to centralize functions used across the text plugin scripts. Also created two more scripts to handle imports and member suggestions. --- source/blender/python/BPY_extern.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/python/BPY_extern.h') diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h index 3a826d49542..3d9b45051fb 100644 --- a/source/blender/python/BPY_extern.h +++ b/source/blender/python/BPY_extern.h @@ -48,6 +48,7 @@ struct bPythonConstraint; /* DNA_constraint_types.h */ struct bConstraintOb; /* DNA_constraint_types.h */ struct bConstraintTarget; /* DNA_constraint_types.h*/ struct Script; /* DNA_screen_types.h */ +struct BPyMenu; #ifdef __cplusplus extern "C" { #endif -- cgit v1.2.3 From 83bcb9deffb5eef2cbbb883c21f700840175d3fc Mon Sep 17 00:00:00 2001 From: Ian Thompson Date: Sat, 9 Aug 2008 18:11:40 +0000 Subject: Python errors originating in the active text are now displayed at the top of the text area. Errors in other files/scripts still pop up a message as before and all errors are still printed to the console. This removes the need to switch to the console for local errors. --- source/blender/python/BPY_extern.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/python/BPY_extern.h') diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h index 3d9b45051fb..a8b9cb48c16 100644 --- a/source/blender/python/BPY_extern.h +++ b/source/blender/python/BPY_extern.h @@ -89,6 +89,7 @@ extern "C" { int BPY_Err_getLinenumber( void ); const char *BPY_Err_getFilename( void ); + const char *BPY_Err_getMessage( void ); int BPY_txt_do_python_Text( struct Text *text ); int BPY_menu_do_python( short menutype, int event ); -- cgit v1.2.3 From ac86c04401686a9d119ea84ad489ca3db7403e5c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 15 Sep 2008 01:32:53 +0000 Subject: added BLI_convertstringcwd, used so command line blendfiles and python scripts can be relative to the current path. - was alredy doing this for blendfiles, but better to have in its own function. header_text.c - renamed PATH_MAX, was defined by system includes. --- source/blender/python/BPY_extern.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/python/BPY_extern.h') diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h index 3d9b45051fb..4b96ef3fdf0 100644 --- a/source/blender/python/BPY_extern.h +++ b/source/blender/python/BPY_extern.h @@ -94,7 +94,7 @@ extern "C" { int BPY_menu_do_python( short menutype, int event ); int BPY_menu_do_shortcut( short menutype, unsigned short key, unsigned short modifiers ); int BPY_menu_invoke( struct BPyMenu *pym, short menutype ); - void BPY_run_python_script( char *filename ); + void BPY_run_python_script( const char *filename ); int BPY_run_script(struct Script *script); void BPY_free_compiled_text( struct Text *text ); -- cgit v1.2.3 From 6ff74f45279aeea88fa9a93ba0ced726fdeafc5a Mon Sep 17 00:00:00 2001 From: Willian Padovani Germano Date: Thu, 18 Sep 2008 22:33:49 +0000 Subject: == Python Script Links == Bug #17599: Summary: Python constraints, good in 2.46 not working anymore in 2.47 http://projects.blender.org/tracker/?func=detail&atid=125&aid=17599&group_id=9 Improved my old hack to avoid frame changed scriptlinks from running when rendering stills, should fix this bug. It also causes REDRAW scriptlinks to be executed during renders, but that conforms to how FRAMECHANGED ones work. BTW: this can still be improved. The current system meant to disable all Python functionality at once needs imo to be replaced by one that allows to enable / disable per feature (scriptlinks, pyconstraints, pynodes, etc.). A better way to inform scriptlinks about what is going on (render, anim, render anim, etc.) would also help. Will discuss with others. --- source/blender/python/BPY_extern.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/python/BPY_extern.h') diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h index 4b96ef3fdf0..146093d6b99 100644 --- a/source/blender/python/BPY_extern.h +++ b/source/blender/python/BPY_extern.h @@ -100,7 +100,7 @@ extern "C" { void BPY_clear_bad_scriptlinks( struct Text *byebye ); int BPY_has_onload_script( void ); - void BPY_do_all_scripts( short event ); + void BPY_do_all_scripts( short event, short anim ); int BPY_check_all_scriptlinks( struct Text *text ); void BPY_do_pyscript( struct ID *id, short event ); void BPY_free_scriptlink( struct ScriptLink *slink ); -- cgit v1.2.3 From 905983229ae588d6ec31a202742b1433d46bc9b0 Mon Sep 17 00:00:00 2001 From: Willian Padovani Germano Date: Fri, 19 Sep 2008 18:53:05 +0000 Subject: == Python Space Handlers == Patch #9673: "Short patch to make spacehandler event scripts work more like normal python gui script handlers" by Steven Truppe: http://projects.blender.org/tracker/?func=detail&atid=127&aid=9673&group_id=9 This patch adds the Blender.eventValue variable available for space handlers, holding the event value (aka 1 for button and key presses, X or Y coordinate for mousex / mousey movement). Thanks, Steven. PS: this doesn't break existing scripts. --- source/blender/python/BPY_extern.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/python/BPY_extern.h') diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h index 146093d6b99..aac3c51b97e 100644 --- a/source/blender/python/BPY_extern.h +++ b/source/blender/python/BPY_extern.h @@ -112,7 +112,7 @@ extern "C" { int BPY_has_spacehandler(struct Text *text, struct ScrArea *sa); void BPY_screen_free_spacehandlers(struct bScreen *sc); int BPY_do_spacehandlers(struct ScrArea *sa, unsigned short event, - unsigned short space_event); + short eventValue, unsigned short space_event); void BPY_pydriver_update(void); float BPY_pydriver_eval(struct IpoDriver *driver); -- cgit v1.2.3