[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12523] trunk/blender/source/blender/ python/api2_2x/Constraint.c: Bugfix #7682: Constraint. InsertKey works odd for PoseBones
Joshua Leung
aligorith at gmail.com
Thu Nov 8 10:49:49 CET 2007
Revision: 12523
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12523
Author: aligorith
Date: 2007-11-08 10:49:49 +0100 (Thu, 08 Nov 2007)
Log Message:
-----------
Bugfix #7682: Constraint.InsertKey works odd for PoseBones
Constraint.InsertKey was inserting keyframes for the wrong action-channel. It was doing so for the active bone, not the owner of the constraint.
Modified Paths:
--------------
trunk/blender/source/blender/python/api2_2x/Constraint.c
Modified: trunk/blender/source/blender/python/api2_2x/Constraint.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Constraint.c 2007-11-08 08:27:21 UTC (rev 12522)
+++ trunk/blender/source/blender/python/api2_2x/Constraint.c 2007-11-08 09:49:49 UTC (rev 12523)
@@ -409,12 +409,13 @@
*/
static PyObject *Constraint_insertKey( BPy_Constraint * self, PyObject * value )
{
+ bConstraint *con = self->con;
+ Object *ob = self->obj;
+ bPoseChannel *pchan = self->pchan;
IpoCurve *icu;
float cfra = (float)PyFloat_AsDouble(value);
char actname[32] = "";
- Object *ob = self->obj;
- bConstraint *con = self->con;
-
+
if( !self->con )
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
"This constraint has been removed!" );
@@ -423,9 +424,22 @@
if( PyFloat_Check(value) )
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected a float argument" );
-
- /* constraint_active_func(ob_v, con_v); */
- get_constraint_ipo_context( ob, actname );
+
+ /* find actname for locating that action-channel that a constraint channel should be added to */
+ if (ob) {
+ if (pchan) {
+ /* actname is the name of the pchan that this constraint belongs to */
+ BLI_strncpy(actname, pchan->name, 32);
+ }
+ else {
+ /* hardcoded achan name -> "Object" (this may change in future) */
+ strcpy(actname, "Object");
+ }
+ }
+ else {
+ return EXPP_ReturnPyObjError( PyExc_RuntimeError,
+ "constraint doesn't belong to anything" );
+ }
icu= verify_ipocurve((ID *)ob, ID_CO, actname, con->name, CO_ENFORCE);
if (!icu)
More information about the Bf-blender-cvs
mailing list