From de21846e690dd5a4606a42b776d55f119e5620d7 Mon Sep 17 00:00:00 2001 From: Willian Padovani Germano Date: Sat, 3 Jan 2004 03:50:58 +0000 Subject: BPython: - Fixed small typo in doc file Object.py, reported by user Bill. - Fixed bug #803: Bug #803's Summary: print, type() or BezTriple broken Trying to print type(BezTriple) was crashing Blender because that type wasn't being initialized to PyType_Type. The other problem is that the getName method for ipocurves only works for object ipos. A warning was added for when users try to use it with other blocktypes, we'll later update ipo related stuff in bpython to work for all types. --- source/blender/python/api2_2x/Ipocurve.c | 4 ++++ source/blender/python/api2_2x/Types.c | 2 ++ source/blender/python/api2_2x/Types.h | 2 +- source/blender/python/api2_2x/doc/Object.py | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/python/api2_2x/Ipocurve.c b/source/blender/python/api2_2x/Ipocurve.c index 9ba3b3c3e87..56bb5f75226 100644 --- a/source/blender/python/api2_2x/Ipocurve.c +++ b/source/blender/python/api2_2x/Ipocurve.c @@ -193,6 +193,10 @@ static PyObject* IpoCurve_getName (C_IpoCurve *self) { char * nametab[24] = {"LocX","LocY","LocZ","dLocX","dLocY","dLocZ","RotX","RotY","RotZ","dRotX","dRotY","dRotZ","SizeX","SizeY","SizeZ","dSizeX","dSizeY","dSizeZ","Layer","Time","ColR","ColG","ColB","ColA"}; + if (self->ipocurve->blocktype != ID_OB) + return EXPP_ReturnPyObjError (PyExc_TypeError, + "This function doesn't support this ipocurve type yet"); + // printf("IpoCurve_getName %d\n",self->ipocurve->vartype); if (self->ipocurve->adrcode <=0 ) return PyString_FromString("Index too small"); diff --git a/source/blender/python/api2_2x/Types.c b/source/blender/python/api2_2x/Types.c index dbda9e936e2..0a45ceb89df 100644 --- a/source/blender/python/api2_2x/Types.c +++ b/source/blender/python/api2_2x/Types.c @@ -49,6 +49,7 @@ PyObject *Types_Init (void) constant_Type.ob_type = &PyType_Type; buffer_Type.ob_type = &PyType_Type; Button_Type.ob_type = &PyType_Type; + BezTriple_Type.ob_type = &PyType_Type; /* Another one that needs to be here: */ Text_Type.ob_type = &PyType_Type; @@ -99,6 +100,7 @@ PyObject *Types_Init (void) PyDict_SetItemString(dict, "bufferType", (PyObject *)&buffer_Type); PyDict_SetItemString(dict, "constantType", (PyObject *)&constant_Type); PyDict_SetItemString(dict, "rgbTupleType", (PyObject *)&rgbTuple_Type); + PyDict_SetItemString(dict, "BezTripleType", (PyObject *)&BezTriple_Type); return submodule; } diff --git a/source/blender/python/api2_2x/Types.h b/source/blender/python/api2_2x/Types.h index 838b45c9d79..ea098cfb3eb 100644 --- a/source/blender/python/api2_2x/Types.h +++ b/source/blender/python/api2_2x/Types.h @@ -47,7 +47,7 @@ extern PyTypeObject Curve_Type, Ipo_Type, Metaball_Type; extern PyTypeObject Lattice_Type; extern PyTypeObject vector_Type, buffer_Type, rgbTuple_Type, - constant_Type; + constant_Type, BezTriple_Type; static char M_Types_doc[] = "The Blender Types module\n\n\ diff --git a/source/blender/python/api2_2x/doc/Object.py b/source/blender/python/api2_2x/doc/Object.py index bd0e9be32f9..ddbba307169 100644 --- a/source/blender/python/api2_2x/doc/Object.py +++ b/source/blender/python/api2_2x/doc/Object.py @@ -8,7 +8,7 @@ This module provides access to the B{Object Data} in Blender. Example:: import Blender - scene = Blencer.Scene.getCurrent () # get the current scene + scene = Blender.Scene.getCurrent () # get the current scene ob = Blender.Object.New ('Camera') # make camera object cam = Blender.Camera.New ('ortho') # make ortho camera data object ob.link (cam) # link camera data with the object -- cgit v1.2.3