[Bf-python] scriptlinks in exppython
Yann Vernier
yann at algonet.se
Sun Jun 22 19:32:26 CEST 2003
Seems scriptlinks are a bit confused. Not all types are handled in
setScriptLinks yet, but more importantly, bylink and link are _only_ set
by scriptlinks. This means hitting alt+p may or may not have them set -
and if set, will have them from a previous scriptlink run. Here's a
small patch that seems to fix that.
--
PGP fingerprint = 9242 DC15 2502 FEAB E15F 84C6 D538 EC09 5380 5746
-------------- next part --------------
? Makefile.in
? scriptlinks.diff
? api2_2x/Makefile.in
Index: BPY_interface.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/python/BPY_interface.c,v
retrieving revision 1.12
diff -u -b -r1.12 BPY_interface.c
--- BPY_interface.c 14 Jun 2003 10:09:59 -0000 1.12
+++ BPY_interface.c 22 Jun 2003 17:27:55 -0000
@@ -240,6 +240,8 @@
else
dict = PyModule_GetDict(PyImport_AddModule("__main__"));
+ clearScriptLinks();
+
ret = RunPython (st->text, dict); /* Run the script */
if (!ret) { /* Failed execution of the script */
Index: api2_2x/EXPP_interface.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/python/api2_2x/EXPP_interface.c,v
retrieving revision 1.2
diff -u -b -r1.2 EXPP_interface.c
--- api2_2x/EXPP_interface.c 17 May 2003 13:46:15 -0000 1.2
+++ api2_2x/EXPP_interface.c 22 Jun 2003 17:27:55 -0000
@@ -54,6 +54,16 @@
M_Blender_Init ();
}
+void clearScriptLinks (void)
+{
+ Py_INCREF(Py_False);
+ PyDict_SetItemString(g_blenderdict, "bylink", Py_False);
+ /* Old API meant link could be unset. Or even valid when bylink is false.
+ * This way, you can import it and check its value afterwards, ignoring bylink. */
+ Py_INCREF(Py_None);
+ PyDict_SetItemString(g_blenderdict, "link", Py_None);
+}
+
ScriptLink * setScriptLinks(ID *id, short event)
{
ScriptLink * scriptlink;
Index: api2_2x/EXPP_interface.h
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/python/api2_2x/EXPP_interface.h,v
retrieving revision 1.1
diff -u -b -r1.1 EXPP_interface.h
--- api2_2x/EXPP_interface.h 8 May 2003 03:06:46 -0000 1.1
+++ api2_2x/EXPP_interface.h 22 Jun 2003 17:27:55 -0000
@@ -32,4 +32,5 @@
#include <DNA_ID.h>
void initBlenderApi2_2x (void);
+void clearScriptLinks (void);
ScriptLink * setScriptLinks(ID *id, short event);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20030622/cb0f8db9/attachment.sig>
More information about the Bf-python
mailing list