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:
@@ -511,7 +511,7 @@ static PyObject *Armature_copy(BPy_Armature *self)
|
|||||||
bArmature *bl_armature;
|
bArmature *bl_armature;
|
||||||
bl_armature= copy_armature(self->armature);
|
bl_armature= copy_armature(self->armature);
|
||||||
bl_armature->id.us= 0;
|
bl_armature->id.us= 0;
|
||||||
py_armature= PyArmature_FromArmature( bl_armature );
|
py_armature= Armature_CreatePyObject( bl_armature );
|
||||||
return py_armature;
|
return py_armature;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1225,7 +1225,7 @@ static PyObject *M_Armature_Get(PyObject * self, PyObject * args)
|
|||||||
if(size == 0){ //GET ALL ARMATURES
|
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){
|
while (data){
|
||||||
py_armature = PyArmature_FromArmature(data); //*new*
|
py_armature = Armature_CreatePyObject(data); //*new*
|
||||||
sprintf(buffer, "%s", ((bArmature*)data)->id.name +2);
|
sprintf(buffer, "%s", ((bArmature*)data)->id.name +2);
|
||||||
if(PyDict_SetItemString(dict, buffer, py_armature) == -1){ //add to dictionary
|
if(PyDict_SetItemString(dict, buffer, py_armature) == -1){ //add to dictionary
|
||||||
EXPP_decr3(seq, dict, py_armature);
|
EXPP_decr3(seq, dict, py_armature);
|
||||||
@@ -1242,7 +1242,7 @@ static PyObject *M_Armature_Get(PyObject * self, PyObject * args)
|
|||||||
Py_DECREF(item);
|
Py_DECREF(item);
|
||||||
data = find_id("AR", name); //get data from library
|
data = find_id("AR", name); //get data from library
|
||||||
if (data != NULL){
|
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
|
if(PyDict_SetItemString(dict, name, py_armature) == -1){ //add to dictionary
|
||||||
EXPP_decr3(seq, dict, py_armature);
|
EXPP_decr3(seq, dict, py_armature);
|
||||||
goto RuntimeError;
|
goto RuntimeError;
|
||||||
@@ -1270,7 +1270,7 @@ static PyObject *M_Armature_Get(PyObject * self, PyObject * args)
|
|||||||
Py_DECREF(seq);
|
Py_DECREF(seq);
|
||||||
data = find_id("AR", name); //get data from library
|
data = find_id("AR", name); //get data from library
|
||||||
if (data != NULL){
|
if (data != NULL){
|
||||||
return PyArmature_FromArmature(data); //*new*
|
return Armature_CreatePyObject(data); //*new*
|
||||||
}else{
|
}else{
|
||||||
char buffer[128];
|
char buffer[128];
|
||||||
PyOS_snprintf( buffer, sizeof(buffer),
|
PyOS_snprintf( buffer, sizeof(buffer),
|
||||||
@@ -1304,7 +1304,7 @@ static PyObject *M_Armature_New(PyObject * self, PyObject * args)
|
|||||||
|
|
||||||
armature= add_armature();
|
armature= add_armature();
|
||||||
armature->id.us = 0;
|
armature->id.us = 0;
|
||||||
obj = (BPy_Armature *)PyArmature_FromArmature(armature); /*new*/
|
obj = (BPy_Armature *)Armature_CreatePyObject(armature); /*new*/
|
||||||
|
|
||||||
if( !obj )
|
if( !obj )
|
||||||
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
|
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
|
||||||
@@ -1345,7 +1345,7 @@ PyObject *Armature_RebuildBones(PyObject *pyarmature)
|
|||||||
}
|
}
|
||||||
//-----------------(internal)
|
//-----------------(internal)
|
||||||
//Converts a bArmature to a PyArmature
|
//Converts a bArmature to a PyArmature
|
||||||
PyObject *PyArmature_FromArmature(struct bArmature *armature)
|
PyObject *Armature_CreatePyObject(struct bArmature *armature)
|
||||||
{
|
{
|
||||||
BPy_Armature *py_armature = NULL;
|
BPy_Armature *py_armature = NULL;
|
||||||
PyObject *maindict = NULL, *weakref = NULL;
|
PyObject *maindict = NULL, *weakref = NULL;
|
||||||
@@ -1384,7 +1384,7 @@ PyObject *PyArmature_FromArmature(struct bArmature *armature)
|
|||||||
|
|
||||||
RuntimeError:
|
RuntimeError:
|
||||||
return EXPP_objError(PyExc_RuntimeError, "%s%s%s",
|
return EXPP_objError(PyExc_RuntimeError, "%s%s%s",
|
||||||
sModuleError, "PyArmature_FromArmature: ", "Internal Error Ocurred");
|
sModuleError, "Armature_CreatePyObject: ", "Internal Error Ocurred");
|
||||||
}
|
}
|
||||||
//-----------------(internal)
|
//-----------------(internal)
|
||||||
//Converts a PyArmature to a bArmature
|
//Converts a PyArmature to a bArmature
|
||||||
|
|||||||
@@ -4582,7 +4582,7 @@ static PyObject *get_obj_data( BPy_Object *self, int mesh )
|
|||||||
|
|
||||||
switch ( object->type ) {
|
switch ( object->type ) {
|
||||||
case OB_ARMATURE:
|
case OB_ARMATURE:
|
||||||
data_object = PyArmature_FromArmature( object->data );
|
data_object = Armature_CreatePyObject( object->data );
|
||||||
break;
|
break;
|
||||||
case OB_CAMERA:
|
case OB_CAMERA:
|
||||||
data_object = Camera_CreatePyObject( object->data );
|
data_object = Camera_CreatePyObject( object->data );
|
||||||
|
|||||||
@@ -971,9 +971,9 @@ static int PoseBone_setDisplayObject(BPy_PoseBone *self, PyObject *value, void *
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------PoseBone.ik (getter)
|
//------------------------PoseBone.hasIK (getter)
|
||||||
//Returns True/False if the bone has IK's
|
//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;
|
Object *obj = NULL;
|
||||||
|
|
||||||
@@ -1037,25 +1037,29 @@ static int PoseBone_setStiff(BPy_PoseBone *self, PyObject *value, void *axis)
|
|||||||
|
|
||||||
//------------------------PoseBone.* (getter)
|
//------------------------PoseBone.* (getter)
|
||||||
//Gets the pose bones flag
|
//Gets the pose bones flag
|
||||||
|
/*
|
||||||
static PyObject *PoseBone_getFlag(BPy_PoseBone *self, void *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;
|
Py_RETURN_TRUE;
|
||||||
else
|
else
|
||||||
Py_RETURN_FALSE;
|
Py_RETURN_FALSE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
//------------------------PoseBone.* (setter)
|
//------------------------PoseBone.* (setter)
|
||||||
//Gets the pose bones flag
|
//Gets the pose bones flag
|
||||||
|
/*
|
||||||
static int PoseBone_setFlag(BPy_PoseBone *self, PyObject *value, void *flag)
|
static int PoseBone_setFlag(BPy_PoseBone *self, PyObject *value, void *flag)
|
||||||
{
|
{
|
||||||
if ( PyObject_IsTrue(value) )
|
if ( PyObject_IsTrue(value) )
|
||||||
self->posechannel->ikflag |= (int)flag;
|
self->posechannel->flag |= (int)flag;
|
||||||
else
|
else
|
||||||
self->posechannel->ikflag &= ~(int)flag;
|
self->posechannel->flag &= ~(int)flag;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
//------------------------PoseBone.* (getter)
|
//------------------------PoseBone.* (getter)
|
||||||
//Gets the pose bones ikflag
|
//Gets the pose bones ikflag
|
||||||
@@ -1113,7 +1117,7 @@ static PyGetSetDef BPy_PoseBone_getset[] = {
|
|||||||
{"displayObject", (getter)PoseBone_getDisplayObject, (setter)PoseBone_setDisplayObject,
|
{"displayObject", (getter)PoseBone_getDisplayObject, (setter)PoseBone_setDisplayObject,
|
||||||
"The poseMode object to draw in place of this bone", NULL},
|
"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 },
|
"True if the pose bone has IK (readonly)", NULL },
|
||||||
|
|
||||||
{"stretch", (getter)PoseBone_getStretch, (setter)PoseBone_setStretch,
|
{"stretch", (getter)PoseBone_getStretch, (setter)PoseBone_setStretch,
|
||||||
|
|||||||
@@ -189,8 +189,8 @@ class PoseBone:
|
|||||||
@type limitmax: 3-item sequence
|
@type limitmax: 3-item sequence
|
||||||
@ivar limitmax: The x,y,z maximum limits on rotation when part of an IK
|
@ivar limitmax: The x,y,z maximum limits on rotation when part of an IK
|
||||||
|
|
||||||
@type ik: bool
|
@type hasIK: bool
|
||||||
@ivar ik: True if this pose bone is a part of an IK (readonly), when False, other IK related values have no affect.
|
@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
|
@type stretch: float
|
||||||
@ivar stretch: The amount to stretch to the ik target when part of an IK [0.0 - 1.0]
|
@ivar stretch: The amount to stretch to the ik target when part of an IK [0.0 - 1.0]
|
||||||
|
|||||||
Reference in New Issue
Block a user