diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/blender.c | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/effect.c | 14 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/modifier.c | 2 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Armature.c | 2 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Blender.c | 2 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Ipo.c | 49 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Ipocurve.c | 70 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/Ipo.py | 124 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/Mathutils.py | 11 | ||||
-rw-r--r-- | source/blender/python/api2_2x/matrix.c | 27 | ||||
-rw-r--r-- | source/blender/python/api2_2x/point.c | 24 | ||||
-rw-r--r-- | source/blender/python/api2_2x/quat.c | 25 | ||||
-rw-r--r-- | source/blender/python/api2_2x/vector.c | 22 | ||||
-rw-r--r-- | source/blender/renderconverter/intern/convertBlenderScene.c | 21 | ||||
-rw-r--r-- | source/blender/src/space.c | 7 |
15 files changed, 210 insertions, 198 deletions
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index ed9da72c702..23c36b9573a 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -495,7 +495,6 @@ typedef struct UndoElem { MemFile memfile; } UndoElem; -#define MAXUNDO 32 static ListBase undobase={NULL, NULL}; static UndoElem *curundo= NULL; @@ -528,7 +527,8 @@ void BKE_write_undo(char *name) UndoElem *uel; if( (U.uiflag & USER_GLOBALUNDO)==0) return; - + if( U.undosteps==0) return; + /* remove all undos after (also when curundo==NULL) */ while(undobase.last != curundo) { uel= undobase.last; @@ -547,7 +547,7 @@ void BKE_write_undo(char *name) uel= undobase.last; while(uel) { nr++; - if(nr==MAXUNDO) break; + if(nr==U.undosteps) break; uel= uel->prev; } if(uel) { @@ -569,7 +569,7 @@ void BKE_write_undo(char *name) /* calculate current filename */ counter++; - counter= counter % MAXUNDO; + counter= counter % U.undosteps; sprintf(numstr, "%d.blend", counter); BLI_make_file_string("/", tstr, U.tempdir, numstr); diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index e2582c5d86c..17dbae4c0af 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -1530,16 +1530,15 @@ typedef struct pMatrixCache { static pMatrixCache *cache_object_matrices(Object *ob, int start, int end) { pMatrixCache *mcache, *mc; - Object *par; - float framelenold, sfrao; - int cfrao; + Object *par, ob_store; + float framelenold, cfrao; mcache= mc= MEM_mallocN( (end-start+1)*sizeof(pMatrixCache), "ob matrix cache"); framelenold= G.scene->r.framelen; G.scene->r.framelen= 1.0f; cfrao= G.scene->r.cfra; - sfrao= ob->sf; + ob_store= *ob; /* quick copy of all settings */ ob->sf= 0.0f; for(G.scene->r.cfra= start; G.scene->r.cfra<=end; G.scene->r.cfra++, mc++) { @@ -1566,13 +1565,12 @@ static pMatrixCache *cache_object_matrices(Object *ob, int start, int end) /* restore */ G.scene->r.cfra= cfrao; G.scene->r.framelen= framelenold; - ob->sf= sfrao; + *ob= ob_store; - /* restore hierarchy */ + /* restore hierarchy, weak code destroying potential depgraph stuff... */ par= ob; while(par) { /* do not do ob->ipo: keep insertkey */ - par->ctime= -1234567.0; /* hrms? */ do_ob_key(par); if(par->type==OB_ARMATURE) { @@ -1582,8 +1580,6 @@ static pMatrixCache *cache_object_matrices(Object *ob, int start, int end) par= par->parent; } - where_is_object(ob); - return mcache; } diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index ea65d311e53..7f0a4e07309 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -841,7 +841,7 @@ static void *decimateModifier_applyModifier(ModifierData *md, Object *ob, void * mf->v1 = tri[0]; mf->v2 = tri[1]; mf->v3 = tri[2]; - test_index_face(mface, NULL, NULL, 3); + test_index_face(mf, NULL, NULL, 3); } displistmesh_add_edges(ndlm); } diff --git a/source/blender/python/api2_2x/Armature.c b/source/blender/python/api2_2x/Armature.c index 23fe3a4158b..f9aa80c5aaf 100644 --- a/source/blender/python/api2_2x/Armature.c +++ b/source/blender/python/api2_2x/Armature.c @@ -1130,7 +1130,7 @@ static PyObject *M_Armature_Get(PyObject * self, PyObject * args) goto RuntimeError; } if(size == 0){ //GET ALL ARMATURES - data = &(G.main->armature).first; //get the first data ID from the armature library + data = G.main->armature.first; //get the first data ID from the armature library while (data){ py_armature = PyArmature_FromArmature(data); //*new* sprintf(buffer, "%s", ((bArmature*)data)->id.name +2); diff --git a/source/blender/python/api2_2x/Blender.c b/source/blender/python/api2_2x/Blender.c index e00d39ee4ff..1bbb91fac7f 100644 --- a/source/blender/python/api2_2x/Blender.c +++ b/source/blender/python/api2_2x/Blender.c @@ -234,7 +234,7 @@ static PyObject *Blender_Set( PyObject * self, PyObject * args ) /*****************************************************************************/ static PyObject *Blender_Get( PyObject * self, PyObject * args ) { - PyObject *ret = NULL, *dict = NULL; + PyObject *ret = NULL; char *str = NULL; if( !PyArg_ParseTuple( args, "s", &str ) ) diff --git a/source/blender/python/api2_2x/Ipo.c b/source/blender/python/api2_2x/Ipo.c index c81c6a2fef7..51a70706ae4 100644 --- a/source/blender/python/api2_2x/Ipo.c +++ b/source/blender/python/api2_2x/Ipo.c @@ -110,39 +110,37 @@ static PyMethodDef BPy_Ipo_methods[] = { {"setName", ( PyCFunction ) Ipo_setName, METH_VARARGS, "(str) - Change Ipo Data name"}, {"getBlocktype", ( PyCFunction ) Ipo_getBlocktype, METH_NOARGS, - "() - Return Ipo blocktype -"}, + "() - Return Ipo blocktype"}, {"setBlocktype", ( PyCFunction ) Ipo_setBlocktype, METH_VARARGS, "(str) - Change Ipo blocktype"}, {"getRctf", ( PyCFunction ) Ipo_getRctf, METH_NOARGS, - "() - Return Ipo rctf - "}, + "() - Return Ipo rctf"}, {"setRctf", ( PyCFunction ) Ipo_setRctf, METH_VARARGS, - "(str) - Change Ipo rctf"}, + "(flt,flt,flt,flt) - Change Ipo rctf"}, {"addCurve", ( PyCFunction ) Ipo_addCurve, METH_VARARGS, - "() - Return Ipo ncurves"}, + "() - Add a curve to Ipo"}, {"delCurve", ( PyCFunction ) Ipo_delCurve, METH_VARARGS, - "() - Delete Ipo curves"}, + "(str) - Delete curve from Ipo"}, {"getNcurves", ( PyCFunction ) Ipo_getNcurves, METH_NOARGS, - "() - Return Ipo ncurves"}, + "() - Return number of Ipo curves"}, {"getNBezPoints", ( PyCFunction ) Ipo_getNBezPoints, METH_VARARGS, - "() - Return curve number of Bez points"}, + "(int) - Return number of Bez points on an Ipo curve"}, {"delBezPoint", ( PyCFunction ) Ipo_DeleteBezPoints, METH_VARARGS, - "() - Return curve number of Bez points"}, + "(int) - deprecated: use ipocurve.delBezier()"}, {"getCurveBP", ( PyCFunction ) Ipo_getCurveBP, METH_VARARGS, - "() - Return Ipo ncurves"}, + "() - unsupported"}, {"EvaluateCurveOn", ( PyCFunction ) Ipo_EvaluateCurveOn, METH_VARARGS, - "() - Return curve value at given time"}, + "(int,flt) - deprecated: see ipocurve.evaluate()"}, {"getCurveCurval", ( PyCFunction ) Ipo_getCurvecurval, METH_VARARGS, - "() - Return curval"}, - {"getCurveBeztriple", ( PyCFunction ) Ipo_getCurveBeztriple, - METH_VARARGS, - "() - Return Ipo ncurves"}, - {"setCurveBeztriple", ( PyCFunction ) Ipo_setCurveBeztriple, - METH_VARARGS, - "() - Return curval"}, + "(int) - deprecated: see ipocurve.evaluate()"}, + {"getCurveBeztriple", ( PyCFunction ) Ipo_getCurveBeztriple, METH_VARARGS, + "(int,int) - deprecated: see ipocurve.bezierPoints[]"}, + {"setCurveBeztriple", ( PyCFunction ) Ipo_setCurveBeztriple, METH_VARARGS, + "(int,int,list) - set a BezTriple"}, {"getCurves", ( PyCFunction ) Ipo_getCurves, METH_NOARGS, - "() - Return curval"}, + "() - Return list of all defined Ipo curves"}, {"getCurve", ( PyCFunction ) Ipo_getCurve, METH_VARARGS, - "() - Return curval"}, + "(str|int) - Returns specified Ipo curve"}, {NULL, NULL, 0, NULL} }; @@ -321,13 +319,14 @@ static PyObject *M_Ipo_Get( PyObject * self, PyObject * args ) static PyObject *M_Ipo_Recalc( PyObject * self, PyObject * args ) { - void testhandles_ipocurve( IpoCurve * icu ); - PyObject *a; + PyObject *obj; IpoCurve *icu; - if( !PyArg_ParseTuple( args, "O", &a ) ) - return ( EXPP_ReturnPyObjError - ( PyExc_TypeError, "expected ipo argument)" ) ); - icu = IpoCurve_FromPyObject( a ); + + if( !PyArg_ParseTuple( args, "O!", &IpoCurve_Type, &obj ) ) + return EXPP_ReturnPyObjError( PyExc_TypeError, + "expected Ipo curve argument" ); + + icu = IpoCurve_FromPyObject( obj ); testhandles_ipocurve( icu ); Py_INCREF( Py_None ); diff --git a/source/blender/python/api2_2x/Ipocurve.c b/source/blender/python/api2_2x/Ipocurve.c index 6167223b1bd..3b6b9bdced4 100644 --- a/source/blender/python/api2_2x/Ipocurve.c +++ b/source/blender/python/api2_2x/Ipocurve.c @@ -677,53 +677,56 @@ char *getIpoCurveName( IpoCurve * icu ) } -static PyObject *IpoCurve_getDriver( C_IpoCurve * self ){ - IpoCurve *ipo = self->ipocurve; - if(ipo->driver == NULL){ +static PyObject *IpoCurve_getDriver( C_IpoCurve * self ) +{ + if( self->ipocurve->driver == NULL ) { return PyInt_FromLong( 0 ); } else { return PyInt_FromLong( 1 ); } } -static int IpoCurve_setDriver( C_IpoCurve * self, PyObject * args ){ +static int IpoCurve_setDriver( C_IpoCurve * self, PyObject * args ) +{ IpoCurve *ipo = self->ipocurve; short mode; - mode = (short)PyInt_AS_LONG ( args ); + if( !PyInt_CheckExact( args ) ) + return EXPP_ReturnIntError( PyExc_TypeError, + "expected int argument 0 or 1" ); + + mode = (short)PyInt_AS_LONG ( args ); if(mode == 1){ if(ipo->driver == NULL){ ipo->driver = MEM_callocN(sizeof(IpoDriver), "ipo driver"); ipo->driver->blocktype = ID_OB; ipo->driver->adrcode = OB_LOC_X; - } - return 0; + } } else if(mode == 0){ if(ipo->driver != NULL){ MEM_freeN(ipo->driver); ipo->driver= NULL; } - return 0; - } - return EXPP_ReturnIntError( PyExc_RuntimeError, - "expected int argument: 1 or 0 " ); -} + } else + return EXPP_ReturnIntError( PyExc_ValueError, + "expected int argument: 0 or 1" ); + return 0; +} -static PyObject *IpoCurve_getDriverObject( C_IpoCurve * self ){ - BPy_Object *blen_object; +static PyObject *IpoCurve_getDriverObject( C_IpoCurve * self ) +{ IpoCurve *ipo = self->ipocurve; - if(ipo->driver == NULL) - return Py_None; - - blen_object = ( BPy_Object * ) PyObject_NEW( BPy_Object,&Object_Type ); - blen_object->object = ipo->driver->ob; - return ( ( PyObject * ) blen_object ); + if( ipo->driver ) + return Object_CreatePyObject( ipo->driver->ob ); + + Py_RETURN_NONE; } -static int IpoCurve_setDriverObject( C_IpoCurve * self, PyObject * arg ){ +static int IpoCurve_setDriverObject( C_IpoCurve * self, PyObject * arg ) +{ IpoCurve *ipo = self->ipocurve; if(ipo->driver == NULL) @@ -731,28 +734,37 @@ static int IpoCurve_setDriverObject( C_IpoCurve * self, PyObject * arg ){ "This IpoCurve does not have an active driver" ); if(!BPy_Object_Check(arg) ) - return EXPP_ReturnIntError( PyExc_RuntimeError, + return EXPP_ReturnIntError( PyExc_TypeError, "expected an object argument" ); - ipo->driver->ob = ((BPy_Object *)arg)->object; + ipo->driver->ob = ((BPy_Object *)arg)->object; DAG_scene_sort(G.scene); return 0; } -static PyObject *IpoCurve_getDriverChannel( C_IpoCurve * self ){ + +static PyObject *IpoCurve_getDriverChannel( C_IpoCurve * self ) +{ + if( self->ipocurve->driver == NULL) + return EXPP_ReturnPyObjError( PyExc_RuntimeError, + "This IpoCurve does not have an active driver" ); + return PyInt_FromLong( self->ipocurve->driver->adrcode ); } -static int IpoCurve_setDriverChannel( C_IpoCurve * self, PyObject * args ){ - int code; + +static int IpoCurve_setDriverChannel( C_IpoCurve * self, PyObject * args ) +{ IpoCurve *ipo = self->ipocurve; if(ipo->driver == NULL) return EXPP_ReturnIntError( PyExc_RuntimeError, "This IpoCurve does not have an active driver" ); - code = (short)PyInt_AS_LONG ( args ); - ipo->driver->adrcode = (short)code; + if( !PyInt_CheckExact( args ) ) + return EXPP_ReturnIntError( PyExc_TypeError, + "expected int argument 0 or 1" ); + + ipo->driver->adrcode = (short)PyInt_AS_LONG( args ); return 0; - } diff --git a/source/blender/python/api2_2x/doc/Ipo.py b/source/blender/python/api2_2x/doc/Ipo.py index 4244f89a9d5..d7776553ff9 100644 --- a/source/blender/python/api2_2x/doc/Ipo.py +++ b/source/blender/python/api2_2x/doc/Ipo.py @@ -3,7 +3,9 @@ """ The Blender.Ipo submodule -B{New}: Ipo updates to both the program and bpython access. +B{New}: + - Ipo updates to both the program and Bpython access. + - access to Blender's new Ipo driver capabilities . This module provides access to the Ipo Data in Blender. An Ipo is composed of several IpoCurves. @@ -14,7 +16,7 @@ are given below. Example:: import Blender - ob = Blender.Ipo.Get('ipo') # retrieves an ipo object + ob = Blender.Ipo.Get('ipo') # retrieves an Ipo object ob.setName('ipo1') print ob.name print ipo.getRctf() @@ -27,7 +29,7 @@ def New (type, name): Creates a new Ipo. @type type: string @type name: string - @param type: The Ipo's blocktype. Depends on the object the ipo will be + @param type: The Ipo's blocktype. Depends on the object the Ipo will be linked to. Currently supported types are Object, Camera, World, Material, Texture, Lamp, Action, Constraint, Sequence, Curve, Key. @param name: The name for this Ipo. @@ -68,10 +70,12 @@ class Ipo: @return: A list (possibly void) containing all the IpoCurves associated to the Ipo object. """ - def getCurve(curvename): + def getCurve(curve): """ - Return the IpoCurve with the given name. The possible values for - 'curvename' are: + Return the specified IpoCurve. If the curve does not exist in the Ipo, + None is returned. I{curve} can be either a string or an integer, + denoting either the name of the Ipo curve or its internal adrcode. + The possible Ipo curve names are: 1. Camera Ipo: Lens, ClSta, ClEnd, Apert, FDist. 2. Material Ipo: R, G, B, SpecR, SpecG, SpecB, MirR, MirG, MirB, Ref, @@ -94,21 +98,24 @@ class Ipo: MinkMExp, DistM, ColT, iScale, DistA, MgType, MgH, Lacu, Oct, MgOff, MgGain, NBase1, NBase2. 7. Curve Ipo: Speed. - 8. Key Ipo: Speed, 'Key 1' - 'Key 63'. - 9. Action Ipo: LocX, LocY, LocZ, SizeX, SizeY, SizeZ, QuatX, QuatY, + 8. Action Ipo: LocX, LocY, LocZ, SizeX, SizeY, SizeZ, QuatX, QuatY, QuatZ, QuatW. - 10. Sequence Ipo: Fac. - 11. Constraint Ipo: Inf. + 9. Sequence Ipo: Fac. + 10. Constraint Ipo: Inf. - @type curvename : string + The adrcode for the Ipo curve can also be given; currently this is the + only way to access curves for Key Ipos. The adrcodes for Key Ipo are + numbered consecutively starting at 0. + @type curve : string or int @rtype: IpoCurve object @return: the corresponding IpoCurve, or None. + @raise ValueError: I{curve} is not a valid name or adrcode for this Ipo + type. """ def addCurve(curvename): """ - Add a new curve to the IPO object. Throws an exception if the curve - already exists in the IPO. The possible values for 'curvename' are: + Add a new curve to the Ipo object. The possible values for I{curvename} are: 1. Camera Ipo: Lens, ClSta, ClEnd, Apert, FDist. 2. Material Ipo: R, G, B, SpecR, SpecG, SpecB, MirR, MirG, MirB, Ref, Alpha, Emit, Amb, Spec, Hard, SpTra, Ior, Mode, HaSize, Translu, @@ -130,20 +137,20 @@ class Ipo: MinkMExp, DistM, ColT, iScale, DistA, MgType, MgH, Lacu, Oct, MgOff, MgGain, NBase1, NBase2. 7. Curve Ipo: Speed. - 8. Key Ipo: Speed, 'Key 1' - 'Key 63'. - 9. Action Ipo: LocX, LocY, LocZ, SizeX, SizeY, SizeZ, QuatX, QuatY, + 8. Action Ipo: LocX, LocY, LocZ, SizeX, SizeY, SizeZ, QuatX, QuatY, QuatZ, QuatW. - 10. Sequence Ipo: Fac. - 11. Constraint Ipo: Inf. + 9. Sequence Ipo: Fac. + 10. Constraint Ipo: Inf. @type curvename : string @rtype: IpoCurve object @return: the corresponding IpoCurve, or None. + @raise ValueError: I{curvename} is not valid or already exists """ def delCurve(curvename): """ - Delete an existing curve from the IPO object. See addCurve() for possible values for curvename. + Delete an existing curve from the Ipo object. See addCurve() for possible values for curvename. @type curvename : string @rtype: None @return: None. @@ -210,7 +217,7 @@ class Ipo: """ Gets a beztriple of the Ipo. @type curvepos: int - @param curvepos: the position of the curve in the ipo + @param curvepos: the position of the curve in the Ipo. @type pointpos: int @param pointpos: the position of the point in the curve. @rtype: list of 9 floats @@ -221,7 +228,7 @@ class Ipo: """ Sets the beztriple of the Ipo. @type curvepos: int - @param curvepos: the position of the curve in the ipo + @param curvepos: the position of the curve in the Ipo. @type pointpos: int @param pointpos: the position of the point in the curve. @type newbeztriple: list of 9 floats @@ -232,9 +239,10 @@ class Ipo: def getCurveCurval(curvepos): """ - Gets the current value of a curve of the Ipo. + Gets the current value of a curve of the Ipo (B{deprecated}). B{Note}: + new scripts should use L{IpoCurve.evaluate()}. @type curvepos: int or string - @param curvepos: the position of the curve in the ipo or the name of the + @param curvepos: the position of the curve in the Ipo or the name of the curve @rtype: float @return: the current value of the selected curve of the Ipo. @@ -242,11 +250,12 @@ class Ipo: def EvaluateCurveOn(curvepos,time): """ - Gets the current value of a curve of the Ipo. + Gets the value at a specific time of a curve of the Ipo (B{deprecated}). + B{Note}: new scripts should use L{IpoCurve.evaluate()}. @type curvepos: int - @param curvepos: the position of the curve in the ipo + @param curvepos: the position of the curve in the Ipo. @type time: float - @param time: the position of the curve in the ipo + @param time: the desired time. @rtype: float @return: the current value of the selected curve of the Ipo at the given time. @@ -256,32 +265,28 @@ class IpoCurve: """ The IpoCurve object =================== - This object gives access to generic data from all ipocurves objects in Blender. - - Important Notes for Rotation Curves:\n - For the rotation IpoCurves, the y values for points are in units of 10 degrees. For example, 45.0 degrees is stored as 4.50 degrees. These are the same numbers you see in the Transform Properties pupmenu ( NKey ) in the IPO Curve Editor window. Positive rotations are in a counter-clockwise direction, just like in math class. + This object gives access to generic data from all Ipo curves objects in Blender. + + Important Notes for Rotation Ipo Curves:\n + For the rotation Ipo curves, the y values for points are in units of 10 + degrees. For example, 45.0 degrees is stored as 4.50 degrees. These are the + same numbers you see in the Transform Properties pop-up menu ( NKey ) in + the IPO Curve Editor window. Positive rotations are in a counter-clockwise + direction, following the standard convention. - @ivar driver: Status of Driver - 1: on - 0: off - @type driver: int - @ivar driverObject: Object Used to Drive the IpoCurve - @type driverObject: Object - @ivar driverChannel: Object Channel Used to Drive the IpoCurve - Use module constants - IpoCurve.LOC_X - IpoCurve.LOC_Y - IpoCurve.LOC_Z - IpoCurve.ROT_X - IpoCurve.ROT_Y - IpoCurve.ROT_Z - IpoCurve.SIZE_X - IpoCurve.SIZE_Y - IpoCurve.SIZE_Z + @ivar driver: Status of the driver. 1= on, 0= off. + @type driver: int + @ivar driverObject: Object used to drive the Ipo curve. + @type driverObject: Blender Object or None + @ivar driverChannel: Object channel used to drive the Ipo curve. + Use module constants: IpoCurve.LOC_X, IpoCurve.LOC_Y, IpoCurve.LOC_Z, + IpoCurve.ROT_X, IpoCurve.ROT_Y, IpoCurve.ROT_Z, IpoCurve.SIZE_X, + IpoCurve.SIZE_Y, IpoCurve.SIZE_Z @type driverChannel: int - - @ivar name: The Curve Data name. - @ivar bezierPoints : The list of the Bezier points. + @ivar name: The IpoCurve data name. + @type name: string + @ivar bezierPoints : The list of the curve's bezier points. + @type bezierPoints : list """ def setExtrapolation(extendmode): @@ -344,7 +349,7 @@ class IpoCurve: def getName(): """ - Returns the name of the ipo curve. This name can be: + Returns the name of the Ipo curve. This name can be: 1. Camera Ipo: Lens, ClSta, ClEnd, Apert, FDist. 2. Material Ipo: R, G, B, SpecR, SpecG, SpecB, MirR, MirG, MirB, Ref, Alpha, Emit, Amb, Spec, Hard, SpTra, Ior, Mode, HaSize, Translu, @@ -366,26 +371,25 @@ class IpoCurve: MinkMExp, DistM, ColT, iScale, DistA, MgType, MgH, Lacu, Oct, MgOff, MgGain, NBase1, NBase2. 7. Curve Ipo: Speed. - 8. Key Ipo: Speed, 'Key 1' - 'Key 63'. - 9. Action Ipo: LocX, LocY, LocZ, SizeX, SizeY, SizeZ, QuatX, QuatY, + 8. Action Ipo: LocX, LocY, LocZ, SizeX, SizeY, SizeZ, QuatX, QuatY, QuatZ, QuatW. - 10. Sequence Ipo: Fac. - 11. Constraint Ipo: Inf. + 9. Sequence Ipo: Fac. + 10. Constraint Ipo: Inf. @rtype: string - @return: the name of the ipo curve. + @return: the name of the Ipo curve. """ def getPoints(): """ - Returns all the points of the ipo curve. + Returns all the points of the Ipo curve. @rtype: list of BezTriples - @return: the points of the ipo curve. + @return: the points of the Ipo curve. """ def evaluate( time ): """ - Compute the value of the IpoCurve at a particular time. + Compute the value of the Ipo curve at a particular time. @type time: float @param time: value along the X axis @rtype: float @@ -412,8 +416,8 @@ class BezTriple: def setPoints(newval): """ Sets the point xy coordinates of the Bezier knot point. After changing - coordinates, it is advisable to call L{IpoCurve.recalc()} to update the IPO - curves. + coordinates, it is advisable to call L{IpoCurve.recalc()} to update the + Ipo curves. @type newval: tuple of 2 floats @param newval: the x and y coordinates of the new Bezier point. @rtype: None diff --git a/source/blender/python/api2_2x/doc/Mathutils.py b/source/blender/python/api2_2x/doc/Mathutils.py index 4b00d045825..5f552a69494 100644 --- a/source/blender/python/api2_2x/doc/Mathutils.py +++ b/source/blender/python/api2_2x/doc/Mathutils.py @@ -653,19 +653,19 @@ class Quaternion: def negate(): """ - Set the quaternion to it's negative. + Set the quaternion to its negative. @return: a copy of itself """ def conjugate(): """ - Set the quaternion to it's conjugate. + Set the quaternion to its conjugate. @return: a copy of itself """ def inverse(): """ - Set the quaternion to it's inverse + Set the quaternion to its inverse @return: a copy of itself """ @@ -762,7 +762,7 @@ class Matrix: def transpose(): """ - Set the matrix to it's transpose. + Set the matrix to its transpose. @return: a copy of itself """ @@ -775,8 +775,9 @@ class Matrix: def invert(): """ - Set the matrix to it's inverse. + Set the matrix to its inverse. @return: a copy of itself + @raise ValueError: When matrix is singular. """ def rotationPart(): diff --git a/source/blender/python/api2_2x/matrix.c b/source/blender/python/api2_2x/matrix.c index 6b90a3a6494..d1e6a53bae5 100644 --- a/source/blender/python/api2_2x/matrix.c +++ b/source/blender/python/api2_2x/matrix.c @@ -228,7 +228,8 @@ PyObject *Matrix_Invert(MatrixObject * self) //transpose //Matrix_Transpose(self); } else { - printf("Matrix.invert: matrix does not have an inverse\n"); + return EXPP_ReturnPyObjError(PyExc_ValueError, + "matrix does not have an inverse"); } return EXPP_incr_ret((PyObject*)self); } @@ -733,22 +734,19 @@ PyObject* Matrix_inv(MatrixObject *self) then call vector.multiply(vector, scalar_cast_as_vector)*/ static int Matrix_coerce(PyObject ** m1, PyObject ** m2) { - PyObject *coerced = NULL; - if(!MatrixObject_Check(*m2)) { - if(VectorObject_Check(*m2) || PyFloat_Check(*m2) || PyInt_Check(*m2) || + if(VectorObject_Check(*m2) || PyFloat_Check(*m2) || PyInt_Check(*m2) || PointObject_Check(*m2)) { - coerced = EXPP_incr_ret(*m2); - *m2 = newMatrixObject(NULL,3,3,Py_NEW); - ((MatrixObject*)*m2)->coerced_object = coerced; - }else{ - return EXPP_ReturnIntError(PyExc_TypeError, - "matrix.coerce(): unknown operand - can't coerce for numeric protocols\n"); - } + PyObject *coerced = EXPP_incr_ret(*m2); + *m2 = newMatrixObject(NULL,3,3,Py_NEW); + ((MatrixObject*)*m2)->coerced_object = coerced; + Py_INCREF (*m1); + return 0; } - EXPP_incr2(*m1, *m2); - return 0; + + return EXPP_ReturnIntError(PyExc_TypeError, + "matrix.coerce(): unknown operand - can't coerce for numeric protocols"); } -//-----------------PROTCOL DECLARATIONS-------------------------- +//-----------------PROTOCOL DECLARATIONS-------------------------- static PySequenceMethods Matrix_SeqMethods = { (inquiry) Matrix_len, /* sq_length */ (binaryfunc) 0, /* sq_concat */ @@ -908,6 +906,7 @@ PyObject *newMatrixObject(float *mat, int rowSize, int colSize, int type) } } else { //or if no arguments are passed return identity matrix Matrix_Identity(self); + Py_DECREF(self); } self->wrapped = Py_NEW; }else{ //bad type diff --git a/source/blender/python/api2_2x/point.c b/source/blender/python/api2_2x/point.c index 2246f49b6ef..56e1eae5904 100644 --- a/source/blender/python/api2_2x/point.c +++ b/source/blender/python/api2_2x/point.c @@ -416,23 +416,19 @@ static PyObject *Point_neg(PointObject *self) then call vector.multiply(vector, scalar_cast_as_vector)*/ static int Point_coerce(PyObject ** p1, PyObject ** p2) { - PyObject *coerced = NULL; - - if(!PointObject_Check(*p2)) { - if(VectorObject_Check(*p2) || PyFloat_Check(*p2) || PyInt_Check(*p2) || + if(VectorObject_Check(*p2) || PyFloat_Check(*p2) || PyInt_Check(*p2) || MatrixObject_Check(*p2) || QuaternionObject_Check(*p2)) { - coerced = EXPP_incr_ret(*p2); - *p2 = newPointObject(NULL,3,Py_NEW); - ((PointObject*)*p2)->coerced_object = coerced; - }else{ - return EXPP_ReturnIntError(PyExc_TypeError, - "point.coerce(): unknown operand - can't coerce for numeric protocols\n"); - } + PyObject *coerced = EXPP_incr_ret(*p2); + *p2 = newPointObject(NULL,3,Py_NEW); + ((PointObject*)*p2)->coerced_object = coerced; + Py_INCREF (*p1); + return 0; } - EXPP_incr2(*p1, *p2); - return 0; + + return EXPP_ReturnIntError(PyExc_TypeError, + "point.coerce(): unknown operand - can't coerce for numeric protocols"); } -//-----------------PROTCOL DECLARATIONS-------------------------- +//-----------------PROTOCOL DECLARATIONS-------------------------- static PySequenceMethods Point_SeqMethods = { (inquiry) Point_len, /* sq_length */ (binaryfunc) 0, /* sq_concat */ diff --git a/source/blender/python/api2_2x/quat.c b/source/blender/python/api2_2x/quat.c index 3c7cb4b839a..1cd07b0f588 100644 --- a/source/blender/python/api2_2x/quat.c +++ b/source/blender/python/api2_2x/quat.c @@ -518,23 +518,19 @@ static PyObject *Quaternion_mul(PyObject * q1, PyObject * q2) then call vector.multiply(vector, scalar_cast_as_vector)*/ static int Quaternion_coerce(PyObject ** q1, PyObject ** q2) { - PyObject *coerced = NULL; - - if(!QuaternionObject_Check(*q2)) { - if(VectorObject_Check(*q2) || PyFloat_Check(*q2) || PyInt_Check(*q2) || + if(VectorObject_Check(*q2) || PyFloat_Check(*q2) || PyInt_Check(*q2) || PointObject_Check(*q2)) { - coerced = EXPP_incr_ret(*q2); - *q2 = newQuaternionObject(NULL,Py_NEW); - ((QuaternionObject*)*q2)->coerced_object = coerced; - }else{ - return EXPP_ReturnIntError(PyExc_TypeError, - "quaternion.coerce(): unknown operand - can't coerce for numeric protocols\n"); - } + PyObject *coerced = EXPP_incr_ret(*q2); + *q2 = newQuaternionObject(NULL,Py_NEW); + ((QuaternionObject*)*q2)->coerced_object = coerced; + Py_INCREF (*q1); + return 0; } - EXPP_incr2(*q1, *q2); - return 0; + + return EXPP_ReturnIntError(PyExc_TypeError, + "quaternion.coerce(): unknown operand - can't coerce for numeric protocols"); } -//-----------------PROTCOL DECLARATIONS-------------------------- +//-----------------PROTOCOL DECLARATIONS-------------------------- static PySequenceMethods Quaternion_SeqMethods = { (inquiry) Quaternion_len, /* sq_length */ (binaryfunc) 0, /* sq_concat */ @@ -646,6 +642,7 @@ PyObject *newQuaternionObject(float *quat, int type) self->quat = self->data.py_data; if(!quat) { //new empty Quaternion_Identity(self); + Py_DECREF(self); }else{ for(x = 0; x < 4; x++){ self->quat[x] = quat[x]; diff --git a/source/blender/python/api2_2x/vector.c b/source/blender/python/api2_2x/vector.c index a0afaf60c1e..bb862fe42f7 100644 --- a/source/blender/python/api2_2x/vector.c +++ b/source/blender/python/api2_2x/vector.c @@ -658,21 +658,17 @@ static PyObject *Vector_neg(VectorObject *self) then call vector.multiply(vector, scalar_cast_as_vector)*/ static int Vector_coerce(PyObject ** v1, PyObject ** v2) { - PyObject *coerced = NULL; - - if(!VectorObject_Check(*v2)) { - if(MatrixObject_Check(*v2) || PyFloat_Check(*v2) || PyInt_Check(*v2) || + if(MatrixObject_Check(*v2) || PyFloat_Check(*v2) || PyInt_Check(*v2) || QuaternionObject_Check(*v2) || PointObject_Check(*v2)) { - coerced = EXPP_incr_ret(*v2); - *v2 = newVectorObject(NULL,3,Py_NEW); - ((VectorObject*)*v2)->coerced_object = coerced; - }else{ - return EXPP_ReturnIntError(PyExc_TypeError, - "vector.coerce(): unknown operand - can't coerce for numeric protocols\n"); - } + PyObject *coerced = EXPP_incr_ret(*v2); + *v2 = newVectorObject(NULL,3,Py_NEW); + ((VectorObject*)*v2)->coerced_object = coerced; + Py_INCREF (*v1); + return 0; } - EXPP_incr2(*v1, *v2); - return 0; + + return EXPP_ReturnIntError(PyExc_TypeError, + "vector.coerce(): unknown operand - can't coerce for numeric protocols"); } //------------------------tp_doc static char VectorObject_doc[] = "This is a wrapper for vector objects."; diff --git a/source/blender/renderconverter/intern/convertBlenderScene.c b/source/blender/renderconverter/intern/convertBlenderScene.c index 14726c6ca84..a4dbad1000a 100644 --- a/source/blender/renderconverter/intern/convertBlenderScene.c +++ b/source/blender/renderconverter/intern/convertBlenderScene.c @@ -1382,13 +1382,13 @@ static void init_render_mesh(Object *ob) Material *ma; MSticky *ms = NULL; PartEff *paf; + DispListMesh *dlm = NULL; + DerivedMesh *dm; unsigned int *vertcol; float xn, yn, zn, imat[3][3], mat[4][4]; //nor[3], float *orco=0; int a, a1, ok, need_orco=0, totvlako, totverto, vertofs; - int end, do_autosmooth=0, totvert = 0; - DispListMesh *dlm = NULL; - DerivedMesh *dm; + int end, do_autosmooth=0, totvert = 0, dm_needsfree; me= ob->data; @@ -1424,7 +1424,18 @@ static void init_render_mesh(Object *ob) if(need_orco) orco = get_object_orco(ob); - dm = mesh_create_derived_render(ob); + /* duplicators don't call modifier stack */ + if(ob->flag&OB_FROMDUPLI) { + dm= ob->derivedFinal; + dm_needsfree= 0; + } + else { + dm = mesh_create_derived_render(ob); + dm_needsfree= 1; + } + + if(dm==NULL) return; /* in case duplicated object fails? */ + dlm = dm->convertToDispListMesh(dm, 1); mvert= dlm->mvert; @@ -1624,7 +1635,7 @@ static void init_render_mesh(Object *ob) calc_vertexnormals(totverto, totvlako); if(dlm) displistmesh_free(dlm); - dm->release(dm); + if(dm_needsfree) dm->release(dm); } /* ------------------------------------------------------------------------- */ diff --git a/source/blender/src/space.c b/source/blender/src/space.c index 32c1feb9718..9228455371e 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -89,6 +89,7 @@ #include "BIF_editarmature.h" #include "BIF_editconstraint.h" #include "BIF_editfont.h" +#include "BIF_editgroup.h" #include "BIF_editkey.h" #include "BIF_editlattice.h" #include "BIF_editmesh.h" @@ -2656,17 +2657,17 @@ void drawinfospace(ScrArea *sa, void *spacedata) uiBlockEndAlign(block); - uiDefBut(block, LABEL,0,"Editmode undo:", + uiDefBut(block, LABEL,0,"Undo:", (xpos+(2*edgsp)+mpref),y3label, mpref,buth, 0, 0, 0, 0, 0, ""); uiBlockBeginAlign(block); uiDefButS(block, NUMSLI, B_DRAWINFO, "Steps:", (xpos+edgsp+mpref+midsp),y2,mpref,buth, - &(U.undosteps), 0, 64, 0, 0, "Number of undo steps available in Edit Mode (smaller values conserve memory)"); + &(U.undosteps), 0, 64, 0, 0, "Number of undo steps available (smaller values conserve memory)"); uiDefButBitI(block, TOG, USER_GLOBALUNDO, B_DRAWINFO, "Global undo", (xpos+edgsp+mpref+midsp),y1,mpref,buth, - &(U.uiflag), 2, 64, 0, 0, ""); + &(U.uiflag), 2, 64, 0, 0, "Global undo works by keeping a full copy of the file itself in memory, so takes extra memory"); uiBlockEndAlign(block); |