iaccess to the IPOs of a Camera, a World, or of a Material
This commit is contained in:
@@ -246,8 +246,23 @@ Camera * GetCameraByName (char * name)
|
||||
/*****************************************************************************/
|
||||
/* Python BPy_Camera methods: */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
#include <DNA_ipo_types.h>
|
||||
|
||||
|
||||
static PyObject *Camera_getIpo(BPy_Camera *self)
|
||||
{
|
||||
PyObject *Ipo_CreatePyObject (Ipo *ipo);
|
||||
struct Ipo*ipo = self->camera->ipo;
|
||||
if (!ipo) return EXPP_ReturnPyObjError(PyExc_RuntimeError,"Camera has no Ipo");
|
||||
return Ipo_CreatePyObject (ipo);
|
||||
}
|
||||
|
||||
|
||||
static PyObject *Camera_getName(BPy_Camera *self)
|
||||
{
|
||||
|
||||
PyObject *attr = PyString_FromString(self->camera->id.name+2);
|
||||
|
||||
if (attr) return attr;
|
||||
@@ -316,6 +331,23 @@ static PyObject *Camera_getDrawSize(BPy_Camera *self)
|
||||
"couldn't get Camera.drawSize attribute");
|
||||
}
|
||||
|
||||
|
||||
static PyObject *Camera_setIpo(BPy_Camera *self, PyObject *args)
|
||||
{
|
||||
int camera_assignIpo(Camera*,Ipo*);
|
||||
PyObject *ipo = 0;
|
||||
Ipo*ptr;
|
||||
Ipo *Ipo_FromPyObject (PyObject *pyobj);
|
||||
|
||||
if (!PyArg_ParseTuple(args, "O", &ipo))
|
||||
return EXPP_ReturnPyObjError (PyExc_TypeError,
|
||||
"expected ipo argument");
|
||||
ptr = Ipo_FromPyObject(ipo);
|
||||
//camera_assignIpo(self->camera, ptr);
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
static PyObject *Camera_setName(BPy_Camera *self, PyObject *args)
|
||||
{
|
||||
char *name;
|
||||
@@ -502,6 +534,11 @@ static PyObject *Camera_getAttr (BPy_Camera *self, char *name)
|
||||
{
|
||||
PyObject *attr = Py_None;
|
||||
|
||||
if (strcmp(name, "ipo") == 0)
|
||||
{
|
||||
struct Ipo*ipo = self->camera->ipo;
|
||||
if (ipo) attr = Ipo_CreatePyObject (ipo);
|
||||
}
|
||||
if (strcmp(name, "name") == 0)
|
||||
attr = PyString_FromString(self->camera->id.name+2);
|
||||
else if (strcmp(name, "type") == 0)
|
||||
|
||||
@@ -116,6 +116,7 @@ struct PyMethodDef M_Camera_methods[] = {
|
||||
/*****************************************************************************/
|
||||
/* Python BPy_Camera methods declarations: */
|
||||
/*****************************************************************************/
|
||||
static PyObject *Camera_getIpo(BPy_Camera *self);
|
||||
static PyObject *Camera_getName(BPy_Camera *self);
|
||||
static PyObject *Camera_getType(BPy_Camera *self);
|
||||
static PyObject *Camera_getMode(BPy_Camera *self);
|
||||
@@ -123,6 +124,7 @@ static PyObject *Camera_getLens(BPy_Camera *self);
|
||||
static PyObject *Camera_getClipStart(BPy_Camera *self);
|
||||
static PyObject *Camera_getClipEnd(BPy_Camera *self);
|
||||
static PyObject *Camera_getDrawSize(BPy_Camera *self);
|
||||
static PyObject *Camera_setIpo(BPy_Camera *self, PyObject *args);
|
||||
static PyObject *Camera_setName(BPy_Camera *self, PyObject *args);
|
||||
static PyObject *Camera_setType(BPy_Camera *self, PyObject *args);
|
||||
static PyObject *Camera_setIntType(BPy_Camera *self, PyObject *args);
|
||||
@@ -138,6 +140,8 @@ static PyObject *Camera_setDrawSize(BPy_Camera *self, PyObject *args);
|
||||
/*****************************************************************************/
|
||||
static PyMethodDef BPy_Camera_methods[] = {
|
||||
/* name, method, flags, doc */
|
||||
{"getIpo", (PyCFunction)Camera_getIpo, METH_NOARGS,
|
||||
"() - Return Camera Data Ipo's"},
|
||||
{"getName", (PyCFunction)Camera_getName, METH_NOARGS,
|
||||
"() - Return Camera Data name"},
|
||||
{"getType", (PyCFunction)Camera_getType, METH_NOARGS,
|
||||
@@ -153,6 +157,8 @@ static PyMethodDef BPy_Camera_methods[] = {
|
||||
"() - Return Camera clip end value"},
|
||||
{"getDrawSize", (PyCFunction)Camera_getDrawSize, METH_NOARGS,
|
||||
"() - Return Camera draw size value"},
|
||||
{"setIpo", (PyCFunction)Camera_setIpo, METH_VARARGS,
|
||||
"(O) - Set Camera Ipo"},
|
||||
{"setName", (PyCFunction)Camera_setName, METH_VARARGS,
|
||||
"(s) - Set Camera Data name"},
|
||||
{"setType", (PyCFunction)Camera_setType, METH_VARARGS,
|
||||
|
||||
@@ -317,6 +317,7 @@ PyObject *Material_Init (void)
|
||||
/*****************************************************************************/
|
||||
/* Python BPy_Material methods declarations: */
|
||||
/*****************************************************************************/
|
||||
static PyObject *Material_getIpo(BPy_Material *self);
|
||||
static PyObject *Material_getName(BPy_Material *self);
|
||||
static PyObject *Material_getMode(BPy_Material *self);
|
||||
static PyObject *Material_getRGBCol(BPy_Material *self);
|
||||
@@ -624,6 +625,16 @@ Material * GetMaterialByName (char * name)
|
||||
/*****************************************************************************/
|
||||
/* Python BPy_Material methods: */
|
||||
/*****************************************************************************/
|
||||
|
||||
static PyObject *Material_getIpo(BPy_Material *self)
|
||||
{
|
||||
typedef struct Ipo Ipo;
|
||||
PyObject *Ipo_CreatePyObject (Ipo *ipo);
|
||||
struct Ipo*ipo = self->material->ipo;
|
||||
if (!ipo) return EXPP_ReturnPyObjError(PyExc_RuntimeError,"Material has no Ipo");
|
||||
return Ipo_CreatePyObject (ipo);
|
||||
}
|
||||
|
||||
static PyObject *Material_getName(BPy_Material *self)
|
||||
{
|
||||
PyObject *attr = PyString_FromString(self->material->id.name+2);
|
||||
|
||||
@@ -226,14 +226,15 @@ PyObject *World_Init (void)
|
||||
/* Python BPy_World methods: */
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* \defgroup World_Methods World Method Functions
|
||||
*
|
||||
* These are the World PyObject method functions. They are used to get and
|
||||
* set values for the World Data member variables.
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
|
||||
static PyObject *World_getIpo(BPy_World *self)
|
||||
{
|
||||
PyObject *Ipo_CreatePyObject (Ipo *ipo);
|
||||
struct Ipo*ipo = self->world->ipo;
|
||||
if (!ipo) return EXPP_ReturnPyObjError(PyExc_RuntimeError,"World has no Ipo");
|
||||
return Ipo_CreatePyObject (ipo);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief World PyMethod getName
|
||||
|
||||
@@ -79,6 +79,7 @@ struct PyMethodDef M_World_methods[] = {
|
||||
/*****************************************************************************/
|
||||
/* Python BPy_World methods declarations: */
|
||||
/*****************************************************************************/
|
||||
static PyObject *World_getIpo(BPy_World *self);
|
||||
static PyObject *World_getName(BPy_World *self);
|
||||
static PyObject *World_setName(BPy_World *self, PyObject *args);
|
||||
static PyObject *World_getSkytype(BPy_World *self);
|
||||
@@ -100,6 +101,8 @@ static PyObject *World_setMist(BPy_World *self, PyObject *args );
|
||||
/* Python BPy_World methods table: */
|
||||
/*****************************************************************************/
|
||||
static PyMethodDef BPy_World_methods[] = {
|
||||
{"getIpo", (PyCFunction)World_getIpo, METH_NOARGS,
|
||||
"() - Return World Ipo"},
|
||||
{"getName", (PyCFunction)World_getName, METH_NOARGS,
|
||||
"() - Return World Data name"},
|
||||
{"setName", (PyCFunction)World_setName, METH_VARARGS,
|
||||
|
||||
Reference in New Issue
Block a user