PyAPI Simple Bugfix:
authorJoshua Leung <aligorith@gmail.com>
Thu, 26 Jul 2007 06:11:58 +0000 (06:11 +0000)
committerJoshua Leung <aligorith@gmail.com>
Thu, 26 Jul 2007 06:11:58 +0000 (06:11 +0000)
This fixes a bug reported in IRC. getParentBoneName() was returning a string (most likely from an old bone-parent that got removed), even when the parent wasn't an Armature.

source/blender/python/api2_2x/Object.c

index 1b69df657fc55e5f1e7667cf3c396b2eaec0c004..0620b156a0fa0f0045158e66dd031fd124056890 100644 (file)
@@ -1329,7 +1329,7 @@ static PyObject *Object_getParent( BPy_Object * self )
 
 static PyObject *Object_getParentBoneName( BPy_Object * self )
 {
-       if( self->object->parent && self->object->parsubstr[0] != '\0' )
+       if( self->object->parent && self->object->parent->type==OB_ARMATURE && self->object->parsubstr[0] != '\0' )
                return PyString_FromString( self->object->parsubstr );
        Py_RETURN_NONE;
 }