* adds deformation properties to armatureType
authorJoseph Gilbert <ascotan@gmail.com>
Mon, 21 Nov 2005 20:22:08 +0000 (20:22 +0000)
committerJoseph Gilbert <ascotan@gmail.com>
Mon, 21 Nov 2005 20:22:08 +0000 (20:22 +0000)
source/blender/python/api2_2x/Armature.c
source/blender/python/api2_2x/doc/Armature.py

index 3ea6b81b0004cd9479e3b6163c5bda7e2d81d7f1..5ac5172d81984c24db131667b000640e87f2660c 100644 (file)
@@ -519,6 +519,118 @@ static PyObject *Armature_saveChanges(BPy_Armature *self)
        return EXPP_incr_ret(Py_None);
 }
 //------------------ATTRIBUTE IMPLEMENTATION---------------------------
+//------------------------Armature.delayDeform (getter)
+static PyObject *Armature_getDelayDeform(BPy_Armature *self, void *closure)
+{
+       if (self->armature->flag & ARM_DELAYDEFORM)
+               Py_RETURN_TRUE;
+       else
+               Py_RETURN_FALSE;
+}
+//------------------------Armature.delayDeform (setter)
+static int Armature_setDelayDeform(BPy_Armature *self, PyObject *value, void *closure)
+{
+       if(value){
+               if(PyBool_Check(value)){
+                       if (value == Py_True){
+                               self->armature->flag |= ARM_DELAYDEFORM;
+                               return 0;
+                       }else if (value == Py_False){
+                               self->armature->flag &= ~ARM_DELAYDEFORM;
+                               return 0;
+                       }
+               }
+       }
+       goto AttributeError;
+
+AttributeError:
+       return EXPP_intError(PyExc_AttributeError, "%s%s", 
+               sArmatureBadArgs, "Expects True or False");
+}
+//------------------------Armature.restPosition (getter)
+static PyObject *Armature_getRestPosition(BPy_Armature *self, void *closure)
+{
+       if (self->armature->flag & ARM_RESTPOS)
+               Py_RETURN_TRUE;
+       else
+               Py_RETURN_FALSE;
+}
+//------------------------Armature.restPosition (setter)
+static int Armature_setRestPosition(BPy_Armature *self, PyObject *value, void *closure)
+{
+       if(value){
+               if(PyBool_Check(value)){
+                       if (value == Py_True){
+                               self->armature->flag |= ARM_RESTPOS;
+                               return 0;
+                       }else if (value == Py_False){
+                               self->armature->flag &= ~ARM_RESTPOS;
+                               return 0;
+                       }
+               }
+       }
+       goto AttributeError;
+
+AttributeError:
+       return EXPP_intError(PyExc_AttributeError, "%s%s", 
+               sArmatureBadArgs, "Expects True or False");
+}
+//------------------------Armature.envelopes (getter)
+static PyObject *Armature_getEnvelopes(BPy_Armature *self, void *closure)
+{
+       if (self->armature->deformflag & ARM_DEF_ENVELOPE)
+               Py_RETURN_TRUE;
+       else
+               Py_RETURN_FALSE;
+}
+//------------------------Armature.envelopes (setter)
+static int Armature_setEnvelopes(BPy_Armature *self, PyObject *value, void *closure)
+{
+       if(value){
+               if(PyBool_Check(value)){
+                       if (value == Py_True){
+                               self->armature->deformflag |= ARM_DEF_ENVELOPE;
+                               return 0;
+                       }else if (value == Py_False){
+                               self->armature->deformflag &= ~ARM_DEF_ENVELOPE;
+                               return 0;
+                       }
+               }
+       }
+       goto AttributeError;
+
+AttributeError:
+       return EXPP_intError(PyExc_AttributeError, "%s%s", 
+               sArmatureBadArgs, "Expects True or False");
+}
+//------------------------Armature.vertexGroups (getter)
+static PyObject *Armature_getVertexGroups(BPy_Armature *self, void *closure)
+{
+       if (self->armature->deformflag & ARM_DEF_VGROUP)
+               Py_RETURN_TRUE;
+       else
+               Py_RETURN_FALSE;
+}
+//------------------------Armature.vertexGroups (setter)
+static int Armature_setVertexGroups(BPy_Armature *self, PyObject *value, void *closure)
+{
+       if(value){
+               if(PyBool_Check(value)){
+                       if (value == Py_True){
+                               self->armature->deformflag |= ARM_DEF_VGROUP;
+                               return 0;
+                       }else if (value == Py_False){
+                               self->armature->deformflag &= ~ARM_DEF_VGROUP;
+                               return 0;
+                       }
+               }
+       }
+       goto AttributeError;
+
+AttributeError:
+       return EXPP_intError(PyExc_AttributeError, "%s%s", 
+               sArmatureBadArgs, "Expects True or False");
+}
 //------------------------Armature.name (getter)
 //Gets the name of the armature
 static PyObject *Armature_getName(BPy_Armature *self, void *closure)
@@ -586,6 +698,14 @@ static PyGetSetDef BPy_Armature_getset[] = {
                "The armature's name", NULL},
        {"bones", (getter)Armature_getBoneDict, (setter)Armature_setBoneDict, 
                "The armature's Bone dictionary", NULL},
+       {"vertexGroups", (getter)Armature_getVertexGroups, (setter)Armature_setVertexGroups, 
+               "Enable/Disable vertex group defined deformation", NULL},
+       {"envelopes", (getter)Armature_getEnvelopes, (setter)Armature_setEnvelopes, 
+               "Enable/Disable bone envelope defined deformation", NULL},
+       {"restPosition", (getter)Armature_getRestPosition, (setter)Armature_setRestPosition, 
+               "Show armature rest position - disables posing", NULL},
+       {"delayDeform", (getter)Armature_getDelayDeform, (setter)Armature_setDelayDeform, 
+               "Don't deform children when manipulating bones in pose mode", NULL},
        {NULL}
 };
 //------------------------tp_new
index 8a0ff25eb6b999e689990a130124e86f9881b28a..b821984b8e402d92a21557ff233bb72290d953a2 100644 (file)
@@ -41,6 +41,10 @@ class ArmatureType:
     This object gives access to Armature-specific data in Blender.
   @ivar name: The Armature name.
   @ivar bones: A Dictionary of Bones that make up this armature.
+  @ivar vertexGroups: (bool) Whether vertex groups define deformation
+  @ivar envelopes: (bool) Whether bone envelopes define deformation
+  @ivar restPosition: (bool) Show rest position (no posing possible)
+  @ivar delayDeform: (bool) Dont deform children when manipulating bones
   """
 
   def __init__(name = 'myArmature'):
@@ -51,27 +55,7 @@ class ArmatureType:
     @param name: The name for the new armature
     @type name: string
     """
-
-  def getName():
-    """
-    Get the name of this Armature object.
-    @rtype: string
-    """
-
-  def setName(name):
-    """
-    Set the name of this Armature object.
-    @type name: string
-    @param name: The new name.
-    """
-
-  def getBones():
-    """
-    Get all the Armature bones.
-    @rtype: PyBonesDict
-    @return: a list of PyBone objects that make up the armature.
-    """
-   
+  
   def makeEditable():
     """
     Put the armature into EditMode for editing purposes.