* added MTex uvlayer string attribute
* added Pose attribute "ik" True/False depending on the pose bones IK. limitX/Y/Z bool's lockX/Y/ZRot bool's stiffX/Y/Z floats stretch (ikstretch) float
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
#include "MTex.h" /*This must come first*/
|
||||
|
||||
#include "BKE_utildefines.h"
|
||||
#include "BLI_blenlib.h"
|
||||
#include "Texture.h"
|
||||
#include "Object.h"
|
||||
#include "gen_utils.h"
|
||||
@@ -78,6 +79,7 @@ static PyObject *MTex_repr( BPy_MTex * self );
|
||||
MTEXGETSET(Tex)
|
||||
MTEXGETSET(TexCo)
|
||||
MTEXGETSET(Object)
|
||||
MTEXGETSET(UVLayer)
|
||||
MTEXGETSET(MapTo)
|
||||
MTEXGETSET(Col)
|
||||
MTEXGETSET(DVar)
|
||||
@@ -107,6 +109,8 @@ static PyGetSetDef MTex_getseters[] = {
|
||||
"Texture coordinate space (UV, Global, etc.)", NULL },
|
||||
{ "object", (getter) MTex_getObject, (setter) MTex_setObject,
|
||||
"Object whose space to use when texco is Object", NULL },
|
||||
{ "uvlayer", (getter) MTex_getUVLayer, (setter) MTex_setUVLayer,
|
||||
"Name of the UV layer to use", NULL },
|
||||
{ "mapto", (getter) MTex_getMapTo, (setter) MTex_setMapTo,
|
||||
"What values the texture affects", NULL },
|
||||
{ "col", (getter) MTex_getCol, (setter) MTex_setCol,
|
||||
@@ -416,6 +420,20 @@ static int MTex_setObject( BPy_MTex *self, PyObject *value, void *closure)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static PyObject *MTex_getUVLayer( BPy_MTex *self, void *closure )
|
||||
{
|
||||
return PyString_FromString(self->mtex->uvname);
|
||||
}
|
||||
|
||||
static int MTex_setUVLayer( BPy_MTex *self, PyObject *value, void *closure)
|
||||
{
|
||||
if ( !PyString_Check(value) )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected string value" );
|
||||
BLI_strncpy(self->mtex->uvname, PyString_AsString(value), 31);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static PyObject *MTex_getMapTo( BPy_MTex *self, void *closure )
|
||||
{
|
||||
return PyInt_FromLong( self->mtex->mapto );
|
||||
|
||||
@@ -938,7 +938,7 @@ static int PoseBone_setSelect(BPy_PoseBone *self, PyObject *value, void *closure
|
||||
|
||||
|
||||
//------------------------PoseBone.parent (getter)
|
||||
//Gets the pose bones selection
|
||||
//Gets the bones parent if any
|
||||
static PyObject *PoseBone_getParent(BPy_PoseBone *self, void *closure)
|
||||
{
|
||||
if (self->posechannel->parent)
|
||||
@@ -948,7 +948,7 @@ static PyObject *PoseBone_getParent(BPy_PoseBone *self, void *closure)
|
||||
}
|
||||
|
||||
//------------------------PoseBone.displayObject (getter)
|
||||
//Gets the pose bones selection
|
||||
//Gets the pose bones object used for display
|
||||
static PyObject *PoseBone_getDisplayObject(BPy_PoseBone *self, void *closure)
|
||||
{
|
||||
if (self->posechannel->custom)
|
||||
@@ -958,7 +958,7 @@ static PyObject *PoseBone_getDisplayObject(BPy_PoseBone *self, void *closure)
|
||||
}
|
||||
|
||||
//------------------------PoseBone.displayObject (setter)
|
||||
//Gets the pose bones selection
|
||||
//Sets the pose bones object used for display
|
||||
static int PoseBone_setDisplayObject(BPy_PoseBone *self, PyObject *value, void *closure)
|
||||
{
|
||||
if (value == Py_None) {
|
||||
@@ -971,6 +971,115 @@ static int PoseBone_setDisplayObject(BPy_PoseBone *self, PyObject *value, void *
|
||||
return 0;
|
||||
}
|
||||
|
||||
//------------------------PoseBone.ik (getter)
|
||||
//Returns True/False if the bone has IK's
|
||||
static PyObject *PoseBone_getIK(BPy_PoseBone *self, void *closure)
|
||||
{
|
||||
Object *obj = NULL;
|
||||
|
||||
obj = Object_FromPoseChannel(self->posechannel);
|
||||
if (obj==NULL)
|
||||
Py_RETURN_FALSE;
|
||||
|
||||
if( pose_channel_in_IK_chain(obj, self->posechannel) )
|
||||
Py_RETURN_TRUE;
|
||||
|
||||
Py_RETURN_FALSE;
|
||||
}
|
||||
|
||||
//------------------------PoseBone.stretch (getter)
|
||||
//Gets the pose bones IK Stretch value
|
||||
static PyObject *PoseBone_getStretch(BPy_PoseBone *self, void *closure)
|
||||
{
|
||||
return PyFloat_FromDouble( self->posechannel->ikstretch );
|
||||
}
|
||||
|
||||
//------------------------PoseBone.stretch (setter)
|
||||
//Sets the pose bones IK Stretch value
|
||||
static int PoseBone_setStretch(BPy_PoseBone *self, PyObject *value, void *closure)
|
||||
{
|
||||
float ikstretch;
|
||||
|
||||
if( !PyNumber_Check( value ) )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected float argument" );
|
||||
|
||||
ikstretch = PyFloat_AsDouble(value);
|
||||
if (ikstretch<0) ikstretch = 0.0;
|
||||
if (ikstretch>1) ikstretch = 1.0;
|
||||
self->posechannel->ikstretch = ikstretch;
|
||||
return 0;
|
||||
}
|
||||
|
||||
//------------------------PoseBone.stiffX/Y/Z (getter)
|
||||
//Gets the pose bones IK stiffness
|
||||
static PyObject *PoseBone_getStiff(BPy_PoseBone *self, void *axis)
|
||||
{
|
||||
return PyFloat_FromDouble( self->posechannel->stiffness[(int)axis] );
|
||||
}
|
||||
|
||||
//------------------------PoseBone.stiffX/Y/Z (setter)
|
||||
//Sets the pose bones IK stiffness
|
||||
static int PoseBone_setStiff(BPy_PoseBone *self, PyObject *value, void *axis)
|
||||
{
|
||||
float stiff;
|
||||
|
||||
if( !PyNumber_Check( value ) )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected float argument" );
|
||||
|
||||
stiff = PyFloat_AsDouble(value);
|
||||
if (stiff<0) stiff = 0;
|
||||
if (stiff>0.990) stiff = 0.990;
|
||||
self->posechannel->stiffness[(int)axis] = stiff;
|
||||
return 0;
|
||||
}
|
||||
|
||||
//------------------------PoseBone.* (getter)
|
||||
//Gets the pose bones flag
|
||||
static PyObject *PoseBone_getFlag(BPy_PoseBone *self, void *flag)
|
||||
{
|
||||
if (self->posechannel->ikflag & (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;
|
||||
else
|
||||
self->posechannel->ikflag &= ~(int)flag;
|
||||
return 0;
|
||||
}
|
||||
|
||||
//------------------------PoseBone.* (getter)
|
||||
//Gets the pose bones ikflag
|
||||
static PyObject *PoseBone_getIKFlag(BPy_PoseBone *self, void *flag)
|
||||
{
|
||||
if (self->posechannel->ikflag & (int)flag)
|
||||
Py_RETURN_TRUE;
|
||||
else
|
||||
Py_RETURN_FALSE;
|
||||
|
||||
}
|
||||
|
||||
//------------------------PoseBone.* (setter)
|
||||
//Sets the pose bones ikflag
|
||||
static int PoseBone_setIKFlag(BPy_PoseBone *self, PyObject *value, void *flag)
|
||||
{
|
||||
if ( PyObject_IsTrue(value) )
|
||||
self->posechannel->ikflag |= (int)flag;
|
||||
else
|
||||
self->posechannel->ikflag &= ~(int)flag;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//------------------TYPE_OBECT IMPLEMENTATION---------------------------
|
||||
//------------------------tp_getset
|
||||
//This contains methods for attributes that require checking
|
||||
@@ -1003,6 +1112,34 @@ static PyGetSetDef BPy_PoseBone_getset[] = {
|
||||
"The bones parent (read only for posebones)", NULL},
|
||||
{"displayObject", (getter)PoseBone_getDisplayObject, (setter)PoseBone_setDisplayObject,
|
||||
"The poseMode object to draw in place of this bone", NULL},
|
||||
|
||||
{"ik", (getter)PoseBone_getIK, (setter)NULL,
|
||||
"True if the pose bone has IK (readonly)", NULL },
|
||||
|
||||
{"stretch", (getter)PoseBone_getStretch, (setter)PoseBone_setStretch,
|
||||
"Stretch the bone to the IK Target", NULL },
|
||||
|
||||
{"stiffX", (getter)PoseBone_getStiff, (setter)PoseBone_setStiff,
|
||||
"bones stiffness on the X axis", (void *)0 },
|
||||
{"stiffY", (getter)PoseBone_getStiff, (setter)PoseBone_setStiff,
|
||||
"bones stiffness on the Y axis", (void *)1 },
|
||||
{"stiffZ", (getter)PoseBone_getStiff, (setter)PoseBone_setStiff,
|
||||
"bones stiffness on the Z axis", (void *)2 },
|
||||
|
||||
{"limitX", (getter)PoseBone_getIKFlag, (setter)PoseBone_setIKFlag,
|
||||
"limit rotation over X axis when part of an IK", (void *)BONE_IK_XLIMIT },
|
||||
{"limitY", (getter)PoseBone_getIKFlag, (setter)PoseBone_setIKFlag,
|
||||
"limit rotation over Y axis when part of an IK", (void *)BONE_IK_YLIMIT },
|
||||
{"limitZ", (getter)PoseBone_getIKFlag, (setter)PoseBone_setIKFlag,
|
||||
"limit rotation over Z axis when part of an IK", (void *)BONE_IK_ZLIMIT },
|
||||
|
||||
{"lockXRot", (getter)PoseBone_getIKFlag, (setter)PoseBone_setIKFlag,
|
||||
"disable X DoF when part of an IK", (void *)BONE_IK_NO_XDOF },
|
||||
{"lockYRot", (getter)PoseBone_getIKFlag, (setter)PoseBone_setIKFlag,
|
||||
"disable Y DoF when part of an IK", (void *)BONE_IK_NO_YDOF },
|
||||
{"lockZRot", (getter)PoseBone_getIKFlag, (setter)PoseBone_setIKFlag,
|
||||
"disable Z DoF when part of an IK", (void *)BONE_IK_NO_ZDOF },
|
||||
|
||||
{NULL, NULL, NULL, NULL, NULL}
|
||||
};
|
||||
//------------------------tp_dealloc
|
||||
|
||||
@@ -289,6 +289,8 @@ class Material:
|
||||
@type zOffset: float
|
||||
@ivar lightGroup: Limits lights that affect this material to a group.
|
||||
@type lightGroup: Group or None
|
||||
@ivar uvlayer: The uv layer name to use, when UV mapping is enabled.
|
||||
@type uvlayer: string
|
||||
@warning: Most member variables assume values in some [Min, Max] interval.
|
||||
When trying to set them, the given parameter will be clamped to lie in
|
||||
that range: if val < Min, then val = Min, if val > Max, then val = Max.
|
||||
|
||||
@@ -184,11 +184,38 @@ class PoseBone:
|
||||
@type poseMatrix: Matrix object
|
||||
@type constraints: BPy_ConstraintSeq
|
||||
@ivar constraints: a sequence of constraints for the object
|
||||
@type limitmin: A 3-item sequence
|
||||
@type limitmin: 3-item sequence
|
||||
@ivar limitmin: The x,y,z minimum limits on rotation when part of an IK
|
||||
@type limitmax: A 3-item sequence
|
||||
@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 stretch: float
|
||||
@ivar stretch: The amount to stretch to the ik target when part of an IK [0.0 - 1.0]
|
||||
|
||||
@type stiffX: float
|
||||
@ivar stiffX: The x stiffness when part of an IK [0.0 - 0.990]
|
||||
@type stiffY: float
|
||||
@ivar stiffY: The x stiffness when part of an IK [0.0 - 0.990]
|
||||
@type stiffZ: float
|
||||
@ivar stiffZ: The x stiffness when part of an IK [0.0 - 0.990]
|
||||
|
||||
@type limitX: bool
|
||||
@ivar limitX: Limit rotation over X axis when part of an IK.
|
||||
@type limitY: bool
|
||||
@ivar limitY: Limit rotation over Y axis when part of an IK.
|
||||
@type limitZ: bool
|
||||
@ivar limitZ: Limit rotation over Z axis when part of an IK.
|
||||
|
||||
@type lockXRot: bool
|
||||
@ivar lockXRot: Disable X DoF when part of an IK.
|
||||
@type lockYRot: bool
|
||||
@ivar lockYRot: Disable Y DoF when part of an IK.
|
||||
@type lockZRot: bool
|
||||
@ivar lockZRot: Disable Z DoF when part of an IK.
|
||||
|
||||
"""
|
||||
|
||||
def insertKey(parentObject, frameNumber, type):
|
||||
|
||||
Reference in New Issue
Block a user