Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorJoseph Gilbert <ascotan@gmail.com>2005-11-21 23:22:08 +0300
committerJoseph Gilbert <ascotan@gmail.com>2005-11-21 23:22:08 +0300
commit4d7ca2931ce38ec53f2713e994d89a9177cf3f9e (patch)
tree6571591cba997536b2a264d8f4c53bb6f8ad4d59 /source
parentd5f1fc13b7cd9ab3e4a3d2519433b7359ae6fab0 (diff)
* adds deformation properties to armatureType
Diffstat (limited to 'source')
-rw-r--r--source/blender/python/api2_2x/Armature.c120
-rw-r--r--source/blender/python/api2_2x/doc/Armature.py26
2 files changed, 125 insertions, 21 deletions
diff --git a/source/blender/python/api2_2x/Armature.c b/source/blender/python/api2_2x/Armature.c
index 3ea6b81b000..5ac5172d819 100644
--- a/source/blender/python/api2_2x/Armature.c
+++ b/source/blender/python/api2_2x/Armature.c
@@ -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
diff --git a/source/blender/python/api2_2x/doc/Armature.py b/source/blender/python/api2_2x/doc/Armature.py
index 8a0ff25eb6b..b821984b8e4 100644
--- a/source/blender/python/api2_2x/doc/Armature.py
+++ b/source/blender/python/api2_2x/doc/Armature.py
@@ -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.