diff options
author | Toni Alatalo <antont@kyperjokki.fi> | 2006-02-02 01:21:46 +0300 |
---|---|---|
committer | Toni Alatalo <antont@kyperjokki.fi> | 2006-02-02 01:21:46 +0300 |
commit | afb5a2acf51ec391c86be0b66e2cd0f220b0f7ba (patch) | |
tree | 46deebaf805eb70a144ee8648634e7dcb97e67c5 /source | |
parent | dc2cab13bde32fd99ea2e694b9b49ef1d9608a03 (diff) |
yet another temporary strange but straightforward hack for a script at orange to work! that is: while Joseph is working on the actual Constraint API for bones etc., this allows our armature script to set influences with a simple call: armatureobject.setConstraintInfluenceForBone(bonename, constraintname, influence); fails silently at failure ('cause the c calls used do and no retvals are checked) and is in the strange place (as the current api is largely not object level) but works for us for now (e.g. next few weeks).
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/python/api2_2x/Object.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/source/blender/python/api2_2x/Object.c b/source/blender/python/api2_2x/Object.c index 29018f2692d..fc81bf36976 100644 --- a/source/blender/python/api2_2x/Object.c +++ b/source/blender/python/api2_2x/Object.c @@ -229,6 +229,7 @@ static PyObject *Object_insertPoseKey( BPy_Object * self, PyObject * args ); static PyObject *Object_insertCurrentPoseKey( BPy_Object * self, PyObject * args ); static PyObject *Object_insertMatrixKey( BPy_Object * self, PyObject * args ); static PyObject *Object_bake_to_action( BPy_Object * self, PyObject * args ); +static PyObject *Object_setConstraintInfluenceForBone( BPy_Object * self, PyObject * args ); static PyObject *Object_setLocation( BPy_Object * self, PyObject * args ); static PyObject *Object_setMaterials( BPy_Object * self, PyObject * args ); static PyObject *Object_setName( BPy_Object * self, PyObject * args ); @@ -562,6 +563,8 @@ works only if self and the object specified are of the same type."}, "( ) - Inserts a key into Action based on current/giventime object matrix"}, {"bake_to_action", ( PyCFunction ) Object_bake_to_action, METH_VARARGS, "( ) - creates a new action with the information from object animations"}, + {"setConstraintInfluenceForBone", ( PyCFunction ) Object_setConstraintInfluenceForBone, METH_VARARGS, + "( ) - sets a constraint influence for a certain bone in this (armature)object."}, {"getAllProperties", ( PyCFunction ) Object_getAllProperties, METH_NOARGS, "() - Get all the properties from this object"}, @@ -2512,6 +2515,22 @@ static PyObject *Object_bake_to_action( BPy_Object * self, PyObject * args ) return EXPP_incr_ret( Py_None ); } +static PyObject *Object_setConstraintInfluenceForBone( BPy_Object * self, PyObject * args ) { + char *boneName, *constName; + float influence; + + IpoCurve *icu; + + if( !PyArg_ParseTuple( args, "ssf", &boneName, &constName, &influence ) ) + return ( EXPP_ReturnPyObjError( PyExc_AttributeError, "expects: bonename, constraintname, influenceval" ) ); + + icu = verify_ipocurve((ID *)self->object, ID_CO, boneName, constName, CO_ENFORCE); + insert_vert_ipo(icu, CFRA, influence); + + Py_INCREF( Py_None ); + return ( Py_None ); +} + static PyObject *Object_setLocation( BPy_Object * self, PyObject * args ) { float loc1; |