| 
									
										
										
										
											2003-06-21 11:44:10 +00:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * ***** BEGIN GPL/BL DUAL 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. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  |  * GNU General Public License for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * You should have received a copy of the GNU General Public License | 
					
						
							|  |  |  |  * along with this program; if not, write to the Free Software Foundation, | 
					
						
							|  |  |  |  * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. | 
					
						
							|  |  |  |  * All rights reserved. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This is a new part of Blender. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Contributor(s): Jacques Guignot | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * ***** END GPL/BL DUAL LICENSE BLOCK ***** | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "Build.h"
 | 
					
						
							|  |  |  | #include "Effect.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-11-22 23:30:40 +00:00
										 |  |  | /*****************************************************************************/ | 
					
						
							|  |  |  | /* Python BPy_Build methods table:                                             */ | 
					
						
							|  |  |  | /*****************************************************************************/ | 
					
						
							|  |  |  | static PyMethodDef BPy_Build_methods[] = { | 
					
						
							|  |  |  |   {"getLen",(PyCFunction)Build_getLen, | 
					
						
							|  |  |  | 	 METH_NOARGS,"()-Return Build len"}, | 
					
						
							|  |  |  |   {"setLen",(PyCFunction)Build_setLen, METH_VARARGS, | 
					
						
							|  |  |  | 	 "()- Sets Build len"}, | 
					
						
							|  |  |  |   {"getSfra",(PyCFunction)Build_getSfra, | 
					
						
							|  |  |  | 	 METH_NOARGS,"()-Return Build sfra"}, | 
					
						
							|  |  |  |   {"setSfra",(PyCFunction)Build_setSfra, METH_VARARGS, | 
					
						
							|  |  |  | 	 "()- Sets Build sfra"}, | 
					
						
							|  |  |  | 	{0} | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-06-21 11:44:10 +00:00
										 |  |  | /*****************************************************************************/ | 
					
						
							|  |  |  | /* Python Build_Type structure definition:                                   */ | 
					
						
							|  |  |  | /*****************************************************************************/ | 
					
						
							|  |  |  | PyTypeObject Build_Type = | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   PyObject_HEAD_INIT(NULL) | 
					
						
							|  |  |  |   0,                                      /* ob_size */ | 
					
						
							|  |  |  |   "Build",                               /* tp_name */ | 
					
						
							| 
									
										
										
										
											2003-06-27 07:46:29 +00:00
										 |  |  |   sizeof (BPy_Build),                      /* tp_basicsize */ | 
					
						
							| 
									
										
										
										
											2003-06-21 11:44:10 +00:00
										 |  |  |   0,                                      /* tp_itemsize */ | 
					
						
							|  |  |  |   /* methods */ | 
					
						
							|  |  |  |   (destructor)BuildDeAlloc,              /* tp_dealloc */ | 
					
						
							| 
									
										
										
										
											2003-11-22 23:30:40 +00:00
										 |  |  |   0,                                     /* tp_print */ | 
					
						
							| 
									
										
										
										
											2003-06-21 11:44:10 +00:00
										 |  |  |   (getattrfunc)BuildGetAttr,             /* tp_getattr */ | 
					
						
							|  |  |  |   (setattrfunc)BuildSetAttr,             /* tp_setattr */ | 
					
						
							|  |  |  |   0,                                      /* tp_compare */ | 
					
						
							|  |  |  |   (reprfunc)BuildRepr,                   /* tp_repr */ | 
					
						
							|  |  |  |   0,                                      /* tp_as_number */ | 
					
						
							|  |  |  |   0,                                      /* tp_as_sequence */ | 
					
						
							|  |  |  |   0,                                      /* tp_as_mapping */ | 
					
						
							|  |  |  |   0,                                      /* tp_as_hash */ | 
					
						
							|  |  |  |   0,0,0,0,0,0, | 
					
						
							|  |  |  |   0,                                      /* tp_doc */  | 
					
						
							|  |  |  |   0,0,0,0,0,0, | 
					
						
							| 
									
										
										
										
											2003-06-27 07:46:29 +00:00
										 |  |  |   BPy_Build_methods,                       /* tp_methods */ | 
					
						
							| 
									
										
										
										
											2003-06-21 11:44:10 +00:00
										 |  |  |   0,                                      /* tp_members */ | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-11-22 23:30:40 +00:00
										 |  |  | /*****************************************************************************/ | 
					
						
							|  |  |  | /* The following string definitions are used for documentation strings.      */ | 
					
						
							|  |  |  | /* In Python these will be written to the console when doing a               */ | 
					
						
							|  |  |  | /* Blender.Camera.__doc__                                                    */ | 
					
						
							|  |  |  | /*****************************************************************************/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static char M_Build_doc[] = | 
					
						
							|  |  |  | "The Blender Build module\n\
 | 
					
						
							|  |  |  | This module provides access to **Build Data** objects in Blender\n"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static char M_Build_New_doc[] = | 
					
						
							|  |  |  | "Build.New ():\n\
 | 
					
						
							|  |  |  |         Return a new Build Data object with the given type and name."; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static char M_Build_Get_doc[] = | 
					
						
							|  |  |  | "Build.Get (name = None):\n\
 | 
					
						
							|  |  |  |         Return the build data with the given 'name', None if not found, or\n\ | 
					
						
							|  |  |  |         Return a list with all Build Data objects in the current scene,\n\ | 
					
						
							|  |  |  |         if no argument was given."; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-06-21 11:44:10 +00:00
										 |  |  | /*****************************************************************************/ | 
					
						
							|  |  |  | /* Function:              M_Build_New                                        */ | 
					
						
							|  |  |  | /* Python equivalent:     Blender.Effect.Build.New                           */ | 
					
						
							|  |  |  | /*****************************************************************************/ | 
					
						
							|  |  |  | PyObject *M_Build_New(PyObject *self, PyObject *args) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | int type =   EFF_BUILD; | 
					
						
							| 
									
										
										
										
											2003-06-27 07:46:29 +00:00
										 |  |  |   BPy_Effect    *pyeffect;  | 
					
						
							| 
									
										
										
										
											2003-06-21 11:44:10 +00:00
										 |  |  |   Effect      *bleffect = 0;  | 
					
						
							|  |  |  |    | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   bleffect = add_effect(type); | 
					
						
							|  |  |  |   if (bleffect == NULL)  | 
					
						
							|  |  |  |     return (EXPP_ReturnPyObjError (PyExc_RuntimeError, | 
					
						
							|  |  |  | 	     "couldn't create Effect Data in Blender")); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-06-27 07:46:29 +00:00
										 |  |  |   pyeffect = (BPy_Effect *)PyObject_NEW(BPy_Effect, &Effect_Type); | 
					
						
							| 
									
										
										
										
											2003-06-21 11:44:10 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |       | 
					
						
							|  |  |  |   if (pyeffect == NULL) return (EXPP_ReturnPyObjError (PyExc_MemoryError, | 
					
						
							|  |  |  | 		     "couldn't create Effect Data object")); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   pyeffect->effect = bleffect;  | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return (PyObject *)pyeffect; | 
					
						
							|  |  |  |   return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*****************************************************************************/ | 
					
						
							|  |  |  | /* Function:              M_Build_Get                                        */ | 
					
						
							|  |  |  | /* Python equivalent:     Blender.Effect.Build.Get                           */ | 
					
						
							|  |  |  | /*****************************************************************************/ | 
					
						
							|  |  |  | PyObject *M_Build_Get(PyObject *self, PyObject *args) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   /*arguments : string object name
 | 
					
						
							|  |  |  |     int : position of effect in the obj's effect list  */ | 
					
						
							|  |  |  |   char     *name = 0; | 
					
						
							|  |  |  |   Object   *object_iter; | 
					
						
							|  |  |  |   Effect *eff; | 
					
						
							| 
									
										
										
										
											2003-06-27 07:46:29 +00:00
										 |  |  |   BPy_Build *wanted_eff; | 
					
						
							| 
									
										
										
										
											2003-06-21 11:44:10 +00:00
										 |  |  |   int num,i; | 
					
						
							|  |  |  |   if (!PyArg_ParseTuple(args, "si", &name, &num )) | 
					
						
							|  |  |  |     return(EXPP_ReturnPyObjError(PyExc_AttributeError,\ | 
					
						
							|  |  |  | 				 "expected string int argument")); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   object_iter = G.main->object.first; | 
					
						
							|  |  |  |   if (!object_iter)return(EXPP_ReturnPyObjError(PyExc_AttributeError,\ | 
					
						
							|  |  |  | 						"Scene contains no object")); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   while (object_iter) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       if (strcmp(name,object_iter->id.name+2)) | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 	  object_iter = object_iter->id.next; | 
					
						
							|  |  |  | 	  continue; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |        | 
					
						
							|  |  |  |       if (object_iter->effect.first != NULL) | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 	  eff = object_iter->effect.first; | 
					
						
							|  |  |  | 	  for(i = 0;i<num;i++) | 
					
						
							|  |  |  | 	    { | 
					
						
							|  |  |  | 	      if (eff->type != EFF_BUILD)continue; | 
					
						
							|  |  |  | 	      eff = eff->next; | 
					
						
							|  |  |  | 	      if (!eff) | 
					
						
							| 
									
										
										
										
											2003-06-27 07:46:29 +00:00
										 |  |  | 		return(EXPP_ReturnPyObjError(PyExc_AttributeError,"object not created")); | 
					
						
							| 
									
										
										
										
											2003-06-21 11:44:10 +00:00
										 |  |  | 	    } | 
					
						
							| 
									
										
										
										
											2003-06-27 07:46:29 +00:00
										 |  |  | 	  wanted_eff = (BPy_Build *)PyObject_NEW(BPy_Build, &Build_Type); | 
					
						
							| 
									
										
										
										
											2003-06-21 11:44:10 +00:00
										 |  |  | 	  wanted_eff->build = eff; | 
					
						
							|  |  |  | 	  return (PyObject*)wanted_eff;   | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  |       object_iter = object_iter->id.next; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   Py_INCREF(Py_None); | 
					
						
							|  |  |  |   return Py_None; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-06-27 07:46:29 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct PyMethodDef M_Build_methods[] = { | 
					
						
							|  |  |  |   {"New",(PyCFunction)M_Build_New, METH_VARARGS, M_Build_New_doc}, | 
					
						
							|  |  |  |   {"Get",         M_Build_Get,         METH_VARARGS, M_Build_Get_doc}, | 
					
						
							|  |  |  |   {"get",         M_Build_Get,         METH_VARARGS,M_Build_Get_doc}, | 
					
						
							|  |  |  |   {NULL, NULL, 0, NULL} | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-06-21 11:44:10 +00:00
										 |  |  | /*****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2003-06-28 07:38:21 +00:00
										 |  |  | /* Function:              Build_Init                                         */ | 
					
						
							| 
									
										
										
										
											2003-06-21 11:44:10 +00:00
										 |  |  | /*****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2003-11-22 23:30:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-06-28 07:38:21 +00:00
										 |  |  | PyObject *Build_Init (void) | 
					
						
							| 
									
										
										
										
											2003-06-21 11:44:10 +00:00
										 |  |  | { | 
					
						
							|  |  |  |   PyObject  *submodule; | 
					
						
							| 
									
										
										
										
											2003-06-28 07:38:21 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-06-21 11:44:10 +00:00
										 |  |  |   Build_Type.ob_type = &PyType_Type; | 
					
						
							| 
									
										
										
										
											2003-06-27 07:46:29 +00:00
										 |  |  |   submodule = Py_InitModule3("Blender.Build",M_Build_methods,M_Build_doc ); | 
					
						
							| 
									
										
										
										
											2003-06-21 11:44:10 +00:00
										 |  |  |   return (submodule); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2003-06-27 07:46:29 +00:00
										 |  |  | /* Python BPy_Build methods:                                                  */ | 
					
						
							| 
									
										
										
										
											2003-06-21 11:44:10 +00:00
										 |  |  | /*****************************************************************************/ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-06-27 07:46:29 +00:00
										 |  |  | PyObject *Build_getLen(BPy_Build *self) | 
					
						
							| 
									
										
										
										
											2003-06-21 11:44:10 +00:00
										 |  |  | { | 
					
						
							|  |  |  |   BuildEff*ptr = (BuildEff*)self->build; | 
					
						
							|  |  |  |   return PyFloat_FromDouble(ptr->len); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-06-27 07:46:29 +00:00
										 |  |  | PyObject *Build_setLen(BPy_Build *self,PyObject *args) | 
					
						
							| 
									
										
										
										
											2003-06-21 11:44:10 +00:00
										 |  |  | {  | 
					
						
							|  |  |  |   BuildEff*ptr = (BuildEff*)self->build; | 
					
						
							|  |  |  |   float val = 0; | 
					
						
							|  |  |  | if (!PyArg_ParseTuple(args, "f", &val )) | 
					
						
							|  |  |  |     return(EXPP_ReturnPyObjError(PyExc_AttributeError,\ | 
					
						
							|  |  |  | 				 "expected float argument")); | 
					
						
							|  |  |  |   ptr->len = val; | 
					
						
							|  |  |  |   Py_INCREF(Py_None); | 
					
						
							|  |  |  |   return Py_None; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-06-27 07:46:29 +00:00
										 |  |  | PyObject *Build_getSfra(BPy_Build *self) | 
					
						
							| 
									
										
										
										
											2003-06-21 11:44:10 +00:00
										 |  |  | { | 
					
						
							|  |  |  |   BuildEff*ptr = (BuildEff*)self->build; | 
					
						
							|  |  |  |   return PyFloat_FromDouble(ptr->sfra); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-06-27 07:46:29 +00:00
										 |  |  | PyObject *Build_setSfra(BPy_Build *self,PyObject *args) | 
					
						
							| 
									
										
										
										
											2003-06-21 11:44:10 +00:00
										 |  |  | {  | 
					
						
							|  |  |  |   BuildEff*ptr = (BuildEff*)self->build; | 
					
						
							|  |  |  |   float val = 0; | 
					
						
							|  |  |  |  if (!PyArg_ParseTuple(args, "f", &val )) | 
					
						
							|  |  |  |     return(EXPP_ReturnPyObjError(PyExc_AttributeError,"expected float argument")); | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  |   ptr->sfra = val; | 
					
						
							|  |  |  |   Py_INCREF(Py_None); | 
					
						
							|  |  |  |   return Py_None; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*****************************************************************************/ | 
					
						
							|  |  |  | /* Function:    BuildDeAlloc                                                 */ | 
					
						
							| 
									
										
										
										
											2003-06-27 07:46:29 +00:00
										 |  |  | /* Description: This is a callback function for the BPy_Build type. It is      */ | 
					
						
							| 
									
										
										
										
											2003-06-21 11:44:10 +00:00
										 |  |  | /*              the destructor function.                                     */ | 
					
						
							|  |  |  | /*****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2003-06-27 07:46:29 +00:00
										 |  |  | void BuildDeAlloc (BPy_Build *self) | 
					
						
							| 
									
										
										
										
											2003-06-21 11:44:10 +00:00
										 |  |  | { | 
					
						
							|  |  |  |   BuildEff*ptr = (BuildEff*)self; | 
					
						
							|  |  |  |   PyObject_DEL (ptr); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*****************************************************************************/ | 
					
						
							|  |  |  | /* Function:    BuildGetAttr                                                 */ | 
					
						
							| 
									
										
										
										
											2003-06-27 07:46:29 +00:00
										 |  |  | /* Description: This is a callback function for the BPy_Build type. It is      */ | 
					
						
							|  |  |  | /*              the function that accesses BPy_Build "member variables" and    */ | 
					
						
							| 
									
										
										
										
											2003-06-21 11:44:10 +00:00
										 |  |  | /*              methods.                                                     */ | 
					
						
							|  |  |  | /*****************************************************************************/ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-06-27 07:46:29 +00:00
										 |  |  | PyObject *BuildGetAttr (BPy_Build *self, char *name) | 
					
						
							| 
									
										
										
										
											2003-06-21 11:44:10 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 	if (!strcmp(name,"sfra"))return Build_getSfra( self); | 
					
						
							|  |  |  | 	if (!strcmp(name,"len"))return Build_getLen( self); | 
					
						
							| 
									
										
										
										
											2003-06-27 07:46:29 +00:00
										 |  |  |   return Py_FindMethod(BPy_Build_methods, (PyObject *)self, name); | 
					
						
							| 
									
										
										
										
											2003-06-21 11:44:10 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*****************************************************************************/ | 
					
						
							|  |  |  | /* Function:    BuildSetAttr                                                  */ | 
					
						
							| 
									
										
										
										
											2003-06-27 07:46:29 +00:00
										 |  |  | /* Description: This is a callback function for the BPy_Build type. It is the   */ | 
					
						
							| 
									
										
										
										
											2003-06-21 11:44:10 +00:00
										 |  |  | /*              function that sets Build Data attributes (member variables).  */ | 
					
						
							|  |  |  | /*****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2003-06-27 07:46:29 +00:00
										 |  |  | int BuildSetAttr (BPy_Build *self, char *name, PyObject *value) | 
					
						
							| 
									
										
										
										
											2003-06-21 11:44:10 +00:00
										 |  |  | { | 
					
						
							|  |  |  |   PyObject *valtuple;  | 
					
						
							|  |  |  |   PyObject *error = NULL; | 
					
						
							|  |  |  |   valtuple = Py_BuildValue("(N)", value); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (!valtuple)  | 
					
						
							|  |  |  |     return EXPP_ReturnIntError(PyExc_MemoryError, | 
					
						
							|  |  |  |                          "CameraSetAttr: couldn't create PyTuple"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (!strcmp (name, "sfra")) error = Build_setSfra (self, valtuple); | 
					
						
							|  |  |  |   else if (!strcmp (name, "len"))  error = Build_setLen (self, valtuple); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   else {  | 
					
						
							|  |  |  |     Py_DECREF(valtuple); | 
					
						
							|  |  |  |       return (EXPP_ReturnIntError (PyExc_KeyError, | 
					
						
							|  |  |  |                    "attribute not found")); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/*  Py_DECREF(valtuple);*/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (error != Py_None) return -1; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   Py_DECREF(Py_None); | 
					
						
							|  |  |  |   return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*****************************************************************************/ | 
					
						
							|  |  |  | /* Function:    BuildPrint                                                   */ | 
					
						
							| 
									
										
										
										
											2003-06-27 07:46:29 +00:00
										 |  |  | /* Description: This is a callback function for the BPy_Build type. It         */ | 
					
						
							| 
									
										
										
										
											2003-06-21 11:44:10 +00:00
										 |  |  | /*              builds a meaninful string to 'print' build objects.          */ | 
					
						
							|  |  |  | /*****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2003-07-04 16:06:39 +00:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2003-06-27 07:46:29 +00:00
										 |  |  | int BuildPrint(BPy_Build *self, FILE *fp, int flags)  | 
					
						
							| 
									
										
										
										
											2003-06-21 11:44:10 +00:00
										 |  |  | {  | 
					
						
							|  |  |  |   return 0; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2003-07-04 16:06:39 +00:00
										 |  |  | */ | 
					
						
							| 
									
										
										
										
											2003-06-21 11:44:10 +00:00
										 |  |  | /*****************************************************************************/ | 
					
						
							|  |  |  | /* Function:    BuildRepr                                                    */ | 
					
						
							| 
									
										
										
										
											2003-06-27 07:46:29 +00:00
										 |  |  | /* Description: This is a callback function for the BPy_Build type. It         */ | 
					
						
							| 
									
										
										
										
											2003-06-21 11:44:10 +00:00
										 |  |  | /*              builds a meaninful string to represent build objects.        */ | 
					
						
							|  |  |  | /*****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2003-06-27 07:46:29 +00:00
										 |  |  | PyObject *BuildRepr (BPy_Build *self)  | 
					
						
							| 
									
										
										
										
											2003-06-21 11:44:10 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2003-07-04 16:06:39 +00:00
										 |  |  |   return PyString_FromString("Build effect"); | 
					
						
							| 
									
										
										
										
											2003-06-21 11:44:10 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | PyObject* BuildCreatePyObject (struct Effect *build) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2003-06-27 07:46:29 +00:00
										 |  |  |  BPy_Build    * blen_object; | 
					
						
							| 
									
										
										
										
											2003-06-21 11:44:10 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-06-27 07:46:29 +00:00
										 |  |  |     blen_object = (BPy_Build*)PyObject_NEW (BPy_Build, &Build_Type); | 
					
						
							| 
									
										
										
										
											2003-06-21 11:44:10 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     if (blen_object == NULL) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return (NULL); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     blen_object->build = build; | 
					
						
							|  |  |  |     return ((PyObject*)blen_object); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int BuildCheckPyObject (PyObject *py_obj) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | return (py_obj->ob_type == &Build_Type); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct Build* BuildFromPyObject (PyObject *py_obj) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2003-06-27 07:46:29 +00:00
										 |  |  |  BPy_Build    * blen_obj; | 
					
						
							| 
									
										
										
										
											2003-06-21 11:44:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-06-27 07:46:29 +00:00
										 |  |  |     blen_obj = (BPy_Build*)py_obj; | 
					
						
							| 
									
										
										
										
											2003-06-21 11:44:10 +00:00
										 |  |  |     return ((struct Build*)blen_obj->build); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 |