The following updates have been contributed by Willian P. Germano:

* Implemented BPY_end_python function.
* Implemented error handling. This results in rerunning a script after an
  error has occurred. No need to restart blender anymore.
* Camera module supports dir()
* variable assignment now calls the Python equivalent function - this has
  type checking and should be safer now.
* Implemented the Lamp module. Used the Camera module as a template.
* Implemented the Image module.
* Added EXPP_ClampFloat and EXPP_intError functions to gen_utils.[ch]
* Implemented 'constant' object.
This commit is contained in:
2003-04-08 19:54:14 +00:00
parent 0850182872
commit ec669df6ee
13 changed files with 3585 additions and 209 deletions

View File

@@ -24,7 +24,7 @@
*
* This is a new part of Blender.
*
* Contributor(s): Michel Selten
* Contributor(s): Michel Selten, Willian P. Germano
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
@@ -96,12 +96,12 @@ void BPY_start_python(void)
}
/*****************************************************************************/
/* Description: */
/* Notes: Not implemented yet */
/* Description: This function will terminate the Python interpreter */
/*****************************************************************************/
void BPY_end_python(void)
{
printf ("In BPY_end_python\n");
Py_Finalize();
return;
}
@@ -145,6 +145,15 @@ struct _object *BPY_txt_do_python(struct SpaceText* st)
/* dict = newGlobalDictionary(); */
ret = RunPython (st->text, dict);
/* If errors have occurred, set the error filename to the name of the
script.
*/
if (!ret)
{
sprintf(g_script_error.filename, "%s", st->text->id.name+2);
return NULL;
}
return dict;
}
@@ -307,6 +316,17 @@ PyObject * RunPython(Text *text, PyObject *globaldict)
buf = txt_to_buf(text);
ret = PyRun_String (buf, Py_file_input, globaldict, globaldict);
if (!ret)
{
/* an exception was raised, handle it here */
PyErr_Print(); /* this function also clears the error
indicator */
}
else
{
PyErr_Clear(); /* seems necessary, at least now */
}
MEM_freeN (buf);
return ret;
}