From 9465bf6881ba3d9e17dc62b328bdadb448d7a2e8 Mon Sep 17 00:00:00 2001 From: Stephen Swaney Date: Sat, 26 Mar 2005 18:14:29 +0000 Subject: [PATCH] Updated Bpy method Object.getData() now supports new Text3d type. Contributed by Johnny Matthews. --- source/blender/python/api2_2x/Object.c | 3 +++ source/blender/python/api2_2x/Text3d.c | 29 ++++++++++++++++++++++---- source/blender/python/api2_2x/Text3d.h | 1 + 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/source/blender/python/api2_2x/Object.c b/source/blender/python/api2_2x/Object.c index 587555f405b..9e28ead52b9 100644 --- a/source/blender/python/api2_2x/Object.c +++ b/source/blender/python/api2_2x/Object.c @@ -831,6 +831,9 @@ static PyObject *Object_getData( BPy_Object *self, PyObject *a, PyObject *kwd ) case ID_TXT: data_object = Text_CreatePyObject( object->data ); break; + case OB_FONT: + data_object = Text3d_CreatePyObject( object->data ); + break; case ID_WO: break; default: diff --git a/source/blender/python/api2_2x/Text3d.c b/source/blender/python/api2_2x/Text3d.c index c8f834852a2..a086ceaf166 100644 --- a/source/blender/python/api2_2x/Text3d.c +++ b/source/blender/python/api2_2x/Text3d.c @@ -56,9 +56,9 @@ extern void freedisplist(struct ListBase *lb); static PyObject *M_Text3d_New( PyObject * self, PyObject * args ); static PyObject *M_Text3d_Get( PyObject * self, PyObject * args ); -/*****************************************************************************/ -/* Python callback function prototypes for the Text3D module. -/*****************************************************************************/ +/***************************************************************************** + * Python callback function prototypes for the Text3D module. + *****************************************************************************/ static PyObject *return_ModuleConstant( char *constant_name); static PyObject *generate_ModuleIntConstant(char *name, int value); @@ -558,7 +558,6 @@ static PyObject* Text3d_setDrawMode(BPy_Text3d* self,PyObject* args) //parse and set bits for (i = 0; i < size; i++) { PyObject *v; - BPy_constant *constant; int value; v = PySequence_GetItem(listObject, i); @@ -852,3 +851,25 @@ static PyObject *Text3d_setAlignment( BPy_Text3d * self, PyObject * args ) return EXPP_incr_ret( Py_None ); } + + +/***************************************************************************** + * Function: Text3d_CreatePyObject + * Description: This function will create a new BPy_Text3d from an existing + * Blender structure. + *****************************************************************************/ + +PyObject *Text3d_CreatePyObject( Text3d * text3d ) +{ + BPy_Text3d *pytext3d; + + pytext3d = ( BPy_Text3d * ) PyObject_NEW( BPy_Text3d, &Text3d_Type ); + + if( !pytext3d ) + return EXPP_ReturnPyObjError( PyExc_MemoryError, + "couldn't create BPy_Text3d object" ); + + pytext3d->curve = text3d; + + return ( PyObject * ) pytext3d; +} diff --git a/source/blender/python/api2_2x/Text3d.h b/source/blender/python/api2_2x/Text3d.h index 50566e98e9b..26bf1c197c9 100644 --- a/source/blender/python/api2_2x/Text3d.h +++ b/source/blender/python/api2_2x/Text3d.h @@ -52,6 +52,7 @@ typedef Curve Text3d; int Text3d_CheckPyObject( PyObject * py_obj ); PyObject *Text3d_Init( void ); struct Text3d *Text3d_FromPyObject( PyObject * py_obj ); +PyObject *Text3d_CreatePyObject( Text3d* text3d ); /* Python BPy_Text3d structure definition */ typedef struct {