705
707
return EXPP_intError(PyExc_AttributeError, "%s%s%s",
706
708
sPoseBoneError, ".poseMatrix: ", "not able to set this property");
708
////------------------------PoseBone.constraints (getter)
709
////Gets the constraints list
710
//static PyObject *PoseBone_getConstraints(BPy_PoseBone *self, void *closure)
712
// PyObject *list = NULL, *py_constraint = NULL;
713
// bConstraint *constraint = NULL;
715
// list = PyList_New(0);
716
// for (constraint = self->posechannel->constraints.first; constraint; constraint = constraint->next){
717
// py_constraint = PyConstraint_FromConstraint(constraint);
718
// if (!py_constraint)
720
// if (PyList_Append(list, py_constraint) == -1){
721
// Py_DECREF(py_constraint);
722
// goto RuntimeError;
724
// Py_DECREF(py_constraint);
729
// return EXPP_objError(PyExc_RuntimeError, "%s%s%s",
730
// sPoseBoneError, ".constraints: ", "unable to build constraint list");
732
////------------------------PoseBone.constraints (setter)
733
////Sets the constraints list
734
//static int PoseBone_setConstraints(BPy_PoseBone *self, PyObject *value, void *closure)
736
// printf("This is not implemented yet...");
710
//------------------------PoseBone.constraints (getter)
711
//Gets the constraints sequence
712
static PyObject *PoseBone_getConstraints(BPy_PoseBone *self, void *closure)
714
return PoseConstraintSeq_CreatePyObject( self->posechannel );
716
//------------------------PoseBone.limitmin (getter)
717
//Gets the pose bone limitmin value
718
static PyObject *PoseBone_getLimitMin(BPy_PoseBone *self, void *closure)
723
obj = Object_FromPoseChannel(self->posechannel);
725
return EXPP_ReturnPyObjError(PyExc_AttributeError, "Bone data is not found");
730
if(pose_channel_in_IK_chain(obj, self->posechannel)){
731
if ((self->posechannel->ikflag & BONE_IK_NO_XDOF)==0) {
732
if ((self->posechannel->ikflag & BONE_IK_XLIMIT)) {
733
mylimitmin[0] = self->posechannel->limitmin[0];
736
if ((self->posechannel->ikflag & BONE_IK_NO_YDOF)==0) {
737
if ((self->posechannel->ikflag & BONE_IK_YLIMIT)) {
738
mylimitmin[1] = self->posechannel->limitmin[1];
741
if ((self->posechannel->ikflag & BONE_IK_NO_ZDOF)==0) {
742
if ((self->posechannel->ikflag & BONE_IK_ZLIMIT)) {
743
mylimitmin[2] = self->posechannel->limitmin[2];
747
return newVectorObject(mylimitmin, 3, Py_NEW);
749
//------------------------PoseBone.limitmin (setter)
750
//Sets the pose bone limitmin value
751
static int PoseBone_setLimitMin(BPy_PoseBone *self, PyObject *value, void *closure)
753
float newlimitmin[3];
756
if(!PySequence_Check(value)){
757
return EXPP_ReturnIntError(PyExc_AttributeError, "Argument is not a sequence");
759
if (PySequence_Size(value) !=3){
760
return EXPP_ReturnIntError(PyExc_AttributeError, "Argument size must be 3");
765
for (x = 0; x<3;x++){
767
item = PySequence_GetItem(value, x); //new reference
768
if (PyFloat_Check(item)){
769
newlimitmin[x] = (float)PyFloat_AsDouble(item);
770
}else if (PyInt_Check(item)){
771
newlimitmin[x] = (float)PyInt_AsLong(item);
775
obj = Object_FromPoseChannel(self->posechannel);
777
return EXPP_ReturnIntError(PyExc_AttributeError, "Bone data is not found");
779
if(!pose_channel_in_IK_chain(obj, self->posechannel)){
780
return EXPP_ReturnIntError(PyExc_AttributeError, "Bone is not part of an IK chain");
782
if ((self->posechannel->ikflag & BONE_IK_NO_XDOF)==0) {
783
if ((self->posechannel->ikflag & BONE_IK_XLIMIT)) {
784
self->posechannel->limitmin[0] = EXPP_ClampFloat(newlimitmin[0], -180.0f, 0.0f);
787
if ((self->posechannel->ikflag & BONE_IK_NO_YDOF)==0) {
788
if ((self->posechannel->ikflag & BONE_IK_YLIMIT)) {
789
self->posechannel->limitmin[1] = EXPP_ClampFloat(newlimitmin[1], -180.0f, 0.0f);
792
if ((self->posechannel->ikflag & BONE_IK_NO_ZDOF)==0) {
793
if ((self->posechannel->ikflag & BONE_IK_ZLIMIT)) {
794
self->posechannel->limitmin[2] = EXPP_ClampFloat(newlimitmin[2], -180.0f, 0.0f);
797
DAG_object_flush_update(G.scene, obj, OB_RECALC_DATA);
801
//------------------------PoseBone.limitmax (getter)
802
//Gets the pose bone limitmax value
803
static PyObject *PoseBone_getLimitMax(BPy_PoseBone *self, void *closure)
808
obj = Object_FromPoseChannel(self->posechannel);
810
return EXPP_ReturnPyObjError(PyExc_AttributeError, "Bone data is not found");
815
if(pose_channel_in_IK_chain(obj, self->posechannel)){
816
if ((self->posechannel->ikflag & BONE_IK_NO_XDOF)==0) {
817
if ((self->posechannel->ikflag & BONE_IK_XLIMIT)) {
818
mylimitmax[0] = self->posechannel->limitmax[0];
821
if ((self->posechannel->ikflag & BONE_IK_NO_YDOF)==0) {
822
if ((self->posechannel->ikflag & BONE_IK_YLIMIT)) {
823
mylimitmax[1] = self->posechannel->limitmax[1];
826
if ((self->posechannel->ikflag & BONE_IK_NO_ZDOF)==0) {
827
if ((self->posechannel->ikflag & BONE_IK_ZLIMIT)) {
828
mylimitmax[2] = self->posechannel->limitmax[2];
832
return newVectorObject(mylimitmax, 3, Py_NEW);
834
//------------------------PoseBone.limitmax (setter)
835
//Sets the pose bone limitmax value
836
static int PoseBone_setLimitMax(BPy_PoseBone *self, PyObject *value, void *closure)
838
float newlimitmax[3];
841
if(!PySequence_Check(value)){
842
return EXPP_ReturnIntError(PyExc_AttributeError, "Argument is not a sequence");
844
if (PySequence_Size(value) !=3){
845
return EXPP_ReturnIntError(PyExc_AttributeError, "Argument size must be 3");
850
for (x = 0; x<3;x++){
852
item = PySequence_GetItem(value, x); //new reference
853
if (PyFloat_Check(item)){
854
newlimitmax[x] = (float)PyFloat_AsDouble(item);
855
}else if (PyInt_Check(item)){
856
newlimitmax[x] = (float)PyInt_AsLong(item);
860
obj = Object_FromPoseChannel(self->posechannel);
862
return EXPP_ReturnIntError(PyExc_AttributeError, "Bone data is not found");
864
if(!pose_channel_in_IK_chain(obj, self->posechannel)){
865
return EXPP_ReturnIntError(PyExc_AttributeError, "Bone is not part of an IK chain");
867
if ((self->posechannel->ikflag & BONE_IK_NO_XDOF)==0) {
868
if ((self->posechannel->ikflag & BONE_IK_XLIMIT)) {
869
self->posechannel->limitmax[0] = EXPP_ClampFloat(newlimitmax[0], 0.0f, 180.0f);
872
if ((self->posechannel->ikflag & BONE_IK_NO_YDOF)==0) {
873
if ((self->posechannel->ikflag & BONE_IK_YLIMIT)) {
874
self->posechannel->limitmax[1] = EXPP_ClampFloat(newlimitmax[1], 0.0f, 180.0f);
877
if ((self->posechannel->ikflag & BONE_IK_NO_ZDOF)==0) {
878
if ((self->posechannel->ikflag & BONE_IK_ZLIMIT)) {
879
self->posechannel->limitmax[2] = EXPP_ClampFloat(newlimitmax[2], 0.0f, 180.0f);
882
DAG_object_flush_update(G.scene, obj, OB_RECALC_DATA);
739
885
//------------------------PoseBone.head (getter)
740
886
//Gets the pose head position
741
887
static PyObject *PoseBone_getHead(BPy_PoseBone *self, void *closure)
782
928
"The pose bone's head positon", NULL},
783
929
{"tail", (getter)PoseBone_getTail, (setter)PoseBone_setTail,
784
930
"The pose bone's tail positon", NULL},
785
//{"constraints", (getter)PoseBone_getConstraints, (setter)PoseBone_setConstraints,
786
// "The list of contraints that pertain to this pose bone", NULL},
931
{"limitMin", (getter)PoseBone_getLimitMin, (setter)PoseBone_setLimitMin,
932
"The pose bone dof min", NULL},
933
{"limitMax", (getter)PoseBone_getLimitMax, (setter)PoseBone_setLimitMax,
934
"The pose bone dof max", NULL},
935
{"constraints", (getter)PoseBone_getConstraints, (setter)NULL,
936
"The list of contraints that pertain to this pose bone", NULL},
787
937
{NULL, NULL, NULL, NULL, NULL}
789
939
//------------------------tp_dealloc