renamed posebone.ik to hasIK, removed unused code, made the function name of Armatue's py object from Blender object consistant with others.

This commit is contained in:
2007-02-21 23:14:01 +00:00
parent f12d312275
commit a2ce2600d9
4 changed files with 20 additions and 16 deletions

View File

@@ -511,7 +511,7 @@ static PyObject *Armature_copy(BPy_Armature *self)
bArmature *bl_armature;
bl_armature= copy_armature(self->armature);
bl_armature->id.us= 0;
py_armature= PyArmature_FromArmature( bl_armature );
py_armature= Armature_CreatePyObject( bl_armature );
return py_armature;
}
@@ -1225,7 +1225,7 @@ static PyObject *M_Armature_Get(PyObject * self, PyObject * args)
if(size == 0){ //GET ALL ARMATURES
data = G.main->armature.first; //get the first data ID from the armature library
while (data){
py_armature = PyArmature_FromArmature(data); //*new*
py_armature = Armature_CreatePyObject(data); //*new*
sprintf(buffer, "%s", ((bArmature*)data)->id.name +2);
if(PyDict_SetItemString(dict, buffer, py_armature) == -1){ //add to dictionary
EXPP_decr3(seq, dict, py_armature);
@@ -1242,7 +1242,7 @@ static PyObject *M_Armature_Get(PyObject * self, PyObject * args)
Py_DECREF(item);
data = find_id("AR", name); //get data from library
if (data != NULL){
py_armature = PyArmature_FromArmature(data); //*new*
py_armature = Armature_CreatePyObject(data); //*new*
if(PyDict_SetItemString(dict, name, py_armature) == -1){ //add to dictionary
EXPP_decr3(seq, dict, py_armature);
goto RuntimeError;
@@ -1270,7 +1270,7 @@ static PyObject *M_Armature_Get(PyObject * self, PyObject * args)
Py_DECREF(seq);
data = find_id("AR", name); //get data from library
if (data != NULL){
return PyArmature_FromArmature(data); //*new*
return Armature_CreatePyObject(data); //*new*
}else{
char buffer[128];
PyOS_snprintf( buffer, sizeof(buffer),
@@ -1304,7 +1304,7 @@ static PyObject *M_Armature_New(PyObject * self, PyObject * args)
armature= add_armature();
armature->id.us = 0;
obj = (BPy_Armature *)PyArmature_FromArmature(armature); /*new*/
obj = (BPy_Armature *)Armature_CreatePyObject(armature); /*new*/
if( !obj )
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
@@ -1345,7 +1345,7 @@ PyObject *Armature_RebuildBones(PyObject *pyarmature)
}
//-----------------(internal)
//Converts a bArmature to a PyArmature
PyObject *PyArmature_FromArmature(struct bArmature *armature)
PyObject *Armature_CreatePyObject(struct bArmature *armature)
{
BPy_Armature *py_armature = NULL;
PyObject *maindict = NULL, *weakref = NULL;
@@ -1384,7 +1384,7 @@ PyObject *PyArmature_FromArmature(struct bArmature *armature)
RuntimeError:
return EXPP_objError(PyExc_RuntimeError, "%s%s%s",
sModuleError, "PyArmature_FromArmature: ", "Internal Error Ocurred");
sModuleError, "Armature_CreatePyObject: ", "Internal Error Ocurred");
}
//-----------------(internal)
//Converts a PyArmature to a bArmature

View File

@@ -4582,7 +4582,7 @@ static PyObject *get_obj_data( BPy_Object *self, int mesh )
switch ( object->type ) {
case OB_ARMATURE:
data_object = PyArmature_FromArmature( object->data );
data_object = Armature_CreatePyObject( object->data );
break;
case OB_CAMERA:
data_object = Camera_CreatePyObject( object->data );

View File

@@ -971,9 +971,9 @@ static int PoseBone_setDisplayObject(BPy_PoseBone *self, PyObject *value, void *
return 0;
}
//------------------------PoseBone.ik (getter)
//------------------------PoseBone.hasIK (getter)
//Returns True/False if the bone has IK's
static PyObject *PoseBone_getIK(BPy_PoseBone *self, void *closure)
static PyObject *PoseBone_hasIK(BPy_PoseBone *self, void *closure)
{
Object *obj = NULL;
@@ -1037,25 +1037,29 @@ static int PoseBone_setStiff(BPy_PoseBone *self, PyObject *value, void *axis)
//------------------------PoseBone.* (getter)
//Gets the pose bones flag
/*
static PyObject *PoseBone_getFlag(BPy_PoseBone *self, void *flag)
{
if (self->posechannel->ikflag & (int)flag)
if (self->posechannel->flag & (int)flag)
Py_RETURN_TRUE;
else
Py_RETURN_FALSE;
}
*/
//------------------------PoseBone.* (setter)
//Gets the pose bones flag
/*
static int PoseBone_setFlag(BPy_PoseBone *self, PyObject *value, void *flag)
{
if ( PyObject_IsTrue(value) )
self->posechannel->ikflag |= (int)flag;
self->posechannel->flag |= (int)flag;
else
self->posechannel->ikflag &= ~(int)flag;
self->posechannel->flag &= ~(int)flag;
return 0;
}
*/
//------------------------PoseBone.* (getter)
//Gets the pose bones ikflag
@@ -1113,7 +1117,7 @@ static PyGetSetDef BPy_PoseBone_getset[] = {
{"displayObject", (getter)PoseBone_getDisplayObject, (setter)PoseBone_setDisplayObject,
"The poseMode object to draw in place of this bone", NULL},
{"ik", (getter)PoseBone_getIK, (setter)NULL,
{"hasIK", (getter)PoseBone_hasIK, (setter)NULL,
"True if the pose bone has IK (readonly)", NULL },
{"stretch", (getter)PoseBone_getStretch, (setter)PoseBone_setStretch,

View File

@@ -189,8 +189,8 @@ class PoseBone:
@type limitmax: 3-item sequence
@ivar limitmax: The x,y,z maximum limits on rotation when part of an IK
@type ik: bool
@ivar ik: True if this pose bone is a part of an IK (readonly), when False, other IK related values have no affect.
@type hasIK: bool
@ivar hasIK: True if this pose bone is a part of an IK (readonly), when False, other IK related values have no affect.
@type stretch: float
@ivar stretch: The amount to stretch to the ik target when part of an IK [0.0 - 1.0]