This adds support for the new-ish options:
authorMatt Ebb <matt@mke3.net>
Thu, 18 Sep 2008 00:51:51 +0000 (00:51 +0000)
committerMatt Ebb <matt@mke3.net>
Thu, 18 Sep 2008 00:51:51 +0000 (00:51 +0000)
QUATERNION
B_BONE_REST
INVERT_VERTGROUP
MULTIMODIFIER

to the bpy armature modifier API.

It also fixes a significant problem - In the docs, it refers to
the 'VERTGROUP' field as being a string value, shared
by lattice, armature, etc, referring to the 'VGroup' field in the
armature modifier that defines a vertex group 'mask'
which the armature's effect is restricted to.

However, previously, for some very mistaken reason, in processing
the getters/setters for the armature modifier, the
VERTGROUP field was pointing to the quite different 'Vert. Groups'
toggle in the armature modifier, that enables or
disables using vertex groups for deformation (as opposed to
envelopes).

I've fixed this, so VERTGROUP points to the VGroup string, as is
already defined in the docs and consistent with other
modifiers like Lattice. A new field: 'VGROUPS' has been added,
which is the analog to the 'Vert Groups' toggle.

source/blender/python/api2_2x/Modifier.c
source/blender/python/api2_2x/doc/Modifier.py

index 9775bce2235b81fd54c0c212bcfeb52d8c4efa1b..3bef0eead09fa46704b8fde92e7a7aa41e74fcb5 100644 (file)
@@ -83,7 +83,12 @@ enum mod_constants {
        EXPP_MOD_UV,
        
        /*ARMATURE SPECIFIC*/
+       EXPP_MOD_VGROUPS,
        EXPP_MOD_ENVELOPES,
+       EXPP_MOD_QUATERNION,
+       EXPP_MOD_B_BONE_REST,
+       EXPP_MOD_INVERT_VERTGROUP,
+       EXPP_MOD_MULTIMODIFIER,
        
        /*ARRAY SPECIFIC*/
        EXPP_MOD_OBJECT_OFFSET,
@@ -376,12 +381,23 @@ static PyObject *armature_getter( BPy_Modifier * self, int type )
        case EXPP_MOD_OBJECT:
                return Object_CreatePyObject( md->object );
        case EXPP_MOD_VERTGROUP:
-               return PyBool_FromLong( ( long )( md->deformflag & 1 ) ) ;
+               return PyString_FromString( md->defgrp_name ) ;
+       case EXPP_MOD_VGROUPS:
+               return EXPP_getBitfield( &md->deformflag, ARM_DEF_VGROUP, 'h' );
        case EXPP_MOD_ENVELOPES:
-               return PyBool_FromLong( ( long )( md->deformflag & 2 ) ) ;
+               return EXPP_getBitfield( &md->deformflag, ARM_DEF_ENVELOPE, 'h' );
+       case EXPP_MOD_QUATERNION:
+               return EXPP_getBitfield( &md->deformflag, ARM_DEF_QUATERNION, 'h' );
+       case EXPP_MOD_B_BONE_REST:
+               return EXPP_getBitfield( &md->deformflag, ARM_DEF_B_BONE_REST, 'h' );
+       case EXPP_MOD_INVERT_VERTGROUP:
+               return EXPP_getBitfield( &md->deformflag, ARM_DEF_INVERT_VGROUP, 'h' );
+       case EXPP_MOD_MULTIMODIFIER:
+               return EXPP_getBitfield( &md->multi, 1, 'h' );
        default:
                return EXPP_ReturnPyObjError( PyExc_KeyError, "key not found" );
        }
+       return 0;
 }
 
 static int armature_setter( BPy_Modifier *self, int type, PyObject *value )
@@ -391,13 +407,30 @@ static int armature_setter( BPy_Modifier *self, int type, PyObject *value )
        switch( type ) {
        case EXPP_MOD_OBJECT: 
                return GenericLib_assignData(value, (void **) &md->object, 0, 0, ID_OB, OB_ARMATURE);
-       case EXPP_MOD_VERTGROUP:
-               return EXPP_setBitfield( value, &md->deformflag, 1, 'h' );
+       case EXPP_MOD_VERTGROUP: {
+               char *defgrp_name = PyString_AsString( value );
+               if( !defgrp_name )
+                       return EXPP_ReturnIntError( PyExc_TypeError,
+                                       "expected string arg" );
+               BLI_strncpy( md->defgrp_name, defgrp_name, sizeof( md->defgrp_name ) );
+               break;
+               }
+       case EXPP_MOD_VGROUPS:
+               return EXPP_setBitfield( value, &md->deformflag, ARM_DEF_VGROUP, 'h' );
        case EXPP_MOD_ENVELOPES:
-               return EXPP_setBitfield( value, &md->deformflag, 2, 'h' );
+               return EXPP_setBitfield( value, &md->deformflag, ARM_DEF_ENVELOPE, 'h' );
+       case EXPP_MOD_QUATERNION:
+               return EXPP_setBitfield( value, &md->deformflag, ARM_DEF_QUATERNION, 'h' );
+       case EXPP_MOD_B_BONE_REST:
+               return EXPP_setBitfield( value, &md->deformflag, ARM_DEF_B_BONE_REST, 'h' );
+       case EXPP_MOD_INVERT_VERTGROUP:
+               return EXPP_setBitfield( value, &md->deformflag, ARM_DEF_INVERT_VGROUP, 'h' );
+       case EXPP_MOD_MULTIMODIFIER:
+               return EXPP_setBitfield( value, &md->multi, 1, 'h' );
        default:
                return EXPP_ReturnIntError( PyExc_KeyError, "key not found" );
        }
+       return 0;
 }
 
 static PyObject *lattice_getter( BPy_Modifier * self, int type )
@@ -1595,8 +1628,18 @@ for var in st.replace(',','').split('\n'):
                                PyInt_FromLong( EXPP_MOD_OPTIMAL ) );
                        PyConstant_Insert( d, "UV", 
                                PyInt_FromLong( EXPP_MOD_UV ) );
+                       PyConstant_Insert( d, "VGROUPS", 
+                               PyInt_FromLong( EXPP_MOD_VGROUPS ) );
                        PyConstant_Insert( d, "ENVELOPES", 
                                PyInt_FromLong( EXPP_MOD_ENVELOPES ) );
+                       PyConstant_Insert( d, "QUATERNION", 
+                               PyInt_FromLong( EXPP_MOD_QUATERNION ) );
+                       PyConstant_Insert( d, "B_BONE_REST", 
+                               PyInt_FromLong( EXPP_MOD_B_BONE_REST ) );
+                       PyConstant_Insert( d, "INVERT_VERTGROUP", 
+                               PyInt_FromLong( EXPP_MOD_INVERT_VERTGROUP ) );
+                       PyConstant_Insert( d, "MULTIMODIFIER", 
+                               PyInt_FromLong( EXPP_MOD_MULTIMODIFIER ) );
                        PyConstant_Insert( d, "OBJECT_OFFSET", 
                                PyInt_FromLong( EXPP_MOD_OBJECT_OFFSET ) );
                        PyConstant_Insert( d, "OBJECT_CURVE", 
index 1d7d2e121c9989e4af1b65a9536fcb9470a1ee46..47f72e566b23bae7e2d04cf7fc5742a271cfdd0b 100644 (file)
@@ -93,7 +93,12 @@ Example::
        - SCALE_VEC - Used for Array only (3d Vector)
        - MERGE_DIST - Used for Array only (float)
 
+       - INVERT_VERTGROUP - Used for Armature only (bool)
        - ENVELOPES - Used for Armature only (bool)
+       - VGROUPS - Used for Armature only (bool)
+       - QUATERNION - Used for Armature only (bool)
+       - B_BONE_REST - Used for Armature only (bool)
+       - MULTIMODIFIER - Used for Armature only (bool)
        
        - START - Used for Build only (int)
        - SEED - Used for Build only (int)