- More renaming all around to follow our conventions

- Implemented partially Blender.Sys
- Worked on issues related to sys, path
- Took away most "debug" printfs
This commit is contained in:
2003-06-28 07:38:21 +00:00
parent 569a32a2ea
commit eaf1cdd383
44 changed files with 1147 additions and 801 deletions

View File

@@ -42,34 +42,34 @@ PyObject *g_blenderdict;
/*****************************************************************************/
PyObject *Blender_Set (PyObject *self, PyObject *args)
{
char * name;
PyObject * arg;
int framenum;
if (!PyArg_ParseTuple(args, "sO", &name, &arg))
{
/* TODO: Do we need to generate a nice error message here? */
return (NULL);
}
char * name;
PyObject * arg;
int framenum;
if (!PyArg_ParseTuple(args, "sO", &name, &arg))
{
/* TODO: Do we need to generate a nice error message here? */
return (NULL);
}
if (StringEqual (name, "curframe"))
{
if (!PyArg_Parse(arg, "i", &framenum))
{
/* TODO: Do we need to generate a nice error message here? */
return (NULL);
}
if (StringEqual (name, "curframe"))
{
if (!PyArg_Parse(arg, "i", &framenum))
{
/* TODO: Do we need to generate a nice error message here? */
return (NULL);
}
G.scene->r.cfra = framenum;
G.scene->r.cfra = framenum;
update_for_newframe();
}
else
{
return (PythonReturnErrorObject (PyExc_AttributeError,
"bad request identifier"));
}
return ( PythonIncRef (Py_None) );
update_for_newframe();
}
else
{
return (PythonReturnErrorObject (PyExc_AttributeError,
"bad request identifier"));
}
return ( PythonIncRef (Py_None) );
}
/*****************************************************************************/
@@ -78,78 +78,76 @@ PyObject *Blender_Set (PyObject *self, PyObject *args)
/*****************************************************************************/
PyObject *Blender_Get (PyObject *self, PyObject *args)
{
PyObject * object;
PyObject * dict;
char * str;
PyObject * object;
PyObject * dict;
char * str;
printf ("In Blender_Get()\n");
if (!PyArg_ParseTuple (args, "O", &object))
{
/* TODO: Do we need to generate a nice error message here? */
return (NULL);
}
if (!PyArg_ParseTuple (args, "O", &object))
{
/* TODO: Do we need to generate a nice error message here? */
return (NULL);
}
if (PyString_Check (object))
{
str = PyString_AsString (object);
if (PyString_Check (object))
{
str = PyString_AsString (object);
if (StringEqual (str, "curframe"))
{
return ( PyInt_FromLong (G.scene->r.cfra) );
}
if (StringEqual (str, "curtime"))
{
return ( PyFloat_FromDouble (frame_to_float (G.scene->r.cfra) ) );
}
if (StringEqual (str, "staframe"))
{
return ( PyInt_FromLong (G.scene->r.sfra) );
}
if (StringEqual (str, "endframe"))
{
return ( PyInt_FromLong (G.scene->r.efra) );
}
if (StringEqual (str, "filename"))
{
return ( PyString_FromString (G.sce) );
}
/* According to the old file (opy_blender.c), the following if
statement is a quick hack and needs some clean up. */
if (StringEqual (str, "vrmloptions"))
{
dict = PyDict_New ();
if (StringEqual (str, "curframe"))
{
return ( PyInt_FromLong (G.scene->r.cfra) );
}
if (StringEqual (str, "curtime"))
{
return ( PyFloat_FromDouble (frame_to_float (G.scene->r.cfra) ) );
}
if (StringEqual (str, "staframe"))
{
return ( PyInt_FromLong (G.scene->r.sfra) );
}
if (StringEqual (str, "endframe"))
{
return ( PyInt_FromLong (G.scene->r.efra) );
}
if (StringEqual (str, "filename"))
{
return ( PyString_FromString (G.sce) );
}
/* According to the old file (opy_blender.c), the following if
statement is a quick hack and needs some clean up. */
if (StringEqual (str, "vrmloptions"))
{
dict = PyDict_New ();
PyDict_SetItemString (dict, "twoside",
PyInt_FromLong (U.vrmlflag & USERDEF_VRML_TWOSIDED));
PyDict_SetItemString (dict, "twoside",
PyInt_FromLong (U.vrmlflag & USERDEF_VRML_TWOSIDED));
PyDict_SetItemString (dict, "layers",
PyInt_FromLong (U.vrmlflag & USERDEF_VRML_LAYERS));
PyDict_SetItemString (dict, "layers",
PyInt_FromLong (U.vrmlflag & USERDEF_VRML_LAYERS));
PyDict_SetItemString (dict, "autoscale",
PyInt_FromLong (U.vrmlflag & USERDEF_VRML_AUTOSCALE));
PyDict_SetItemString (dict, "autoscale",
PyInt_FromLong (U.vrmlflag & USERDEF_VRML_AUTOSCALE));
return (dict);
} /* End 'quick hack' part. */
if (StringEqual (str, "version"))
{
return ( PyInt_FromLong (G.version) );
}
/* TODO: Do we want to display a usefull message here that the
requested data is unknown?
else
{
return (PythonReturnErrorObject (..., "message") );
}
*/
}
else
{
return (PythonReturnErrorObject (PyExc_AttributeError,
"expected string argument"));
}
return (dict);
} /* End 'quick hack' part. */
if (StringEqual (str, "version"))
{
return ( PyInt_FromLong (G.version) );
}
/* TODO: Do we want to display a usefull message here that the
requested data is unknown?
else
{
return (PythonReturnErrorObject (..., "message") );
}
*/
}
else
{
return (PythonReturnErrorObject (PyExc_AttributeError,
"expected string argument"));
}
return (PythonReturnErrorObject (PyExc_AttributeError,
return (PythonReturnErrorObject (PyExc_AttributeError,
"bad request identifier"));
}
@@ -160,17 +158,15 @@ PyObject *Blender_Get (PyObject *self, PyObject *args)
PyObject *Blender_Redraw(PyObject *self, PyObject *args)
{
int wintype = SPACE_VIEW3D;
int wintype = SPACE_VIEW3D;
printf ("In Blender_Redraw()\n");
if (!PyArg_ParseTuple (args, "|i", &wintype))
{
return EXPP_ReturnPyObjError (PyExc_TypeError,
if (!PyArg_ParseTuple (args, "|i", &wintype))
{
return EXPP_ReturnPyObjError (PyExc_TypeError,
"expected int argument (or nothing)");
}
}
return M_Window_Redraw(self, Py_BuildValue("(i)", wintype));
return M_Window_Redraw(self, Py_BuildValue("(i)", wintype));
}
/*****************************************************************************/
@@ -187,15 +183,13 @@ PyObject *Blender_Redraw(PyObject *self, PyObject *args)
/*****************************************************************************/
PyObject *Blender_ReleaseGlobalDict(PyObject *self, PyObject *args)
{
printf ("In Blender_ReleaseGlobalDict()\n");
if (!PyArg_ParseTuple (args, "|i", &EXPP_releaseGlobalDict))
{
return EXPP_ReturnPyObjError (PyExc_TypeError,
if (!PyArg_ParseTuple (args, "|i", &EXPP_releaseGlobalDict))
{
return EXPP_ReturnPyObjError (PyExc_TypeError,
"expected int argument (or nothing)");
}
}
return Py_BuildValue("i", (EXPP_releaseGlobalDict?1:0));
return Py_BuildValue("i", (EXPP_releaseGlobalDict?1:0));
}
/*****************************************************************************/
@@ -203,33 +197,33 @@ PyObject *Blender_ReleaseGlobalDict(PyObject *self, PyObject *args)
/*****************************************************************************/
void M_Blender_Init (void)
{
PyObject * module;
PyObject * dict;
PyObject * module;
PyObject * dict;
printf ("In M_Blender_Init()\n");
g_blenderdict = NULL;
g_blenderdict = NULL;
/* TODO: create a docstring for the Blender module */
module = Py_InitModule3("Blender", Blender_methods, NULL);
/* TODO: create a docstring for the Blender module */
module = Py_InitModule3("Blender", Blender_methods, NULL);
dict = PyModule_GetDict (module);
g_blenderdict = dict;
PyDict_SetItemString (dict, "Scene", Scene_Init());
PyDict_SetItemString (dict, "Object", M_Object_Init());
PyDict_SetItemString (dict, "Types", Types_Init());
PyDict_SetItemString (dict, "NMesh", NMesh_Init());
PyDict_SetItemString (dict, "Material", Material_Init());
PyDict_SetItemString (dict, "Camera", Camera_Init());
PyDict_SetItemString (dict, "Lamp", Lamp_Init());
PyDict_SetItemString (dict, "Curve", M_Curve_Init());
PyDict_SetItemString (dict, "Armature", M_Armature_Init());
PyDict_SetItemString (dict, "Ipo", M_Ipo_Init());
PyDict_SetItemString (dict, "Metaball", M_Metaball_Init());
PyDict_SetItemString (dict, "Image", Image_Init());
PyDict_SetItemString (dict, "Window", Window_Init());
PyDict_SetItemString (dict, "Draw", Draw_Init());
PyDict_SetItemString (dict, "BGL", BGL_Init());
PyDict_SetItemString (dict, "Effect", M_Effect_Init());
PyDict_SetItemString (dict, "Text", Text_Init());
PyDict_SetItemString (dict, "World", M_World_Init());
dict = PyModule_GetDict (module);
g_blenderdict = dict;
PyDict_SetItemString (dict, "sys", sys_Init());
PyDict_SetItemString (dict, "Scene", Scene_Init());
PyDict_SetItemString (dict, "Object", Object_Init());
PyDict_SetItemString (dict, "Types", Types_Init());
PyDict_SetItemString (dict, "NMesh", NMesh_Init());
PyDict_SetItemString (dict, "Material", Material_Init());
PyDict_SetItemString (dict, "Camera", Camera_Init());
PyDict_SetItemString (dict, "Lamp", Lamp_Init());
PyDict_SetItemString (dict, "Curve", Curve_Init());
PyDict_SetItemString (dict, "Armature", Armature_Init());
PyDict_SetItemString (dict, "Ipo", Ipo_Init());
PyDict_SetItemString (dict, "Metaball", Metaball_Init());
PyDict_SetItemString (dict, "Image", Image_Init());
PyDict_SetItemString (dict, "Window", Window_Init());
PyDict_SetItemString (dict, "Draw", Draw_Init());
PyDict_SetItemString (dict, "BGL", BGL_Init());
PyDict_SetItemString (dict, "Effect", Effect_Init());
PyDict_SetItemString (dict, "Text", Text_Init());
PyDict_SetItemString (dict, "World", World_Init());
}