diff options
author | Joseph Gilbert <ascotan@gmail.com> | 2005-11-07 23:03:32 +0300 |
---|---|---|
committer | Joseph Gilbert <ascotan@gmail.com> | 2005-11-07 23:03:32 +0300 |
commit | f09a3611be65c8fa8581a87c3d80a10e5c6eb65a (patch) | |
tree | 5dbff810da7d86e3f4267c269713c1526c5a7ac5 /source/blender/python/api2_2x/Armature.h | |
parent | a39559ea11bf45c8a446fc84ad4fb079f72fdc29 (diff) |
*armature api for python
- don't get too excited
- allows you to get armatures from a scene
- makeEditable()/saveChanges() puts the armature into out of editmode (pythonically)
- Armature.bones is a dictionary that contains all the bones in the armature and can be iterated
- getters are available for:
name,
roll (dictionary) keys are BONESPACE, ARMATURESPACE
head (dictionary) keys are BONESPACE, ARMATURESPACE
tail (dictionary) keys are BONESPACE, ARMATURESPACE
matrix (dictionary) keys are BONESPACE, ARMATURESPACE
weight
deform_dist
subdivisions
options (list of constants)
parent
children
Setter work only in editmode. Some are not fully implemented.
Type class is embedded in the module. This means the construct is called as follows:
Blender.Armature.ArmatureType()
import Blender.Armature as Armature
arm = Armature.Get('myarm')
for name, bone in arm.bones.items():
...print name, bone, bone.matrix['ARMATURESPACE']
more documentation is forth coming. This is an alpha for this api.
Diffstat (limited to 'source/blender/python/api2_2x/Armature.h')
-rw-r--r-- | source/blender/python/api2_2x/Armature.h | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/source/blender/python/api2_2x/Armature.h b/source/blender/python/api2_2x/Armature.h index 91a409100b1..473a2392931 100644 --- a/source/blender/python/api2_2x/Armature.h +++ b/source/blender/python/api2_2x/Armature.h @@ -23,9 +23,7 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. * - * This is a new part of Blender. - * - * Contributor(s): Jordi Rovira i Bonet, Joseph gilbert + * Contributor(s): Joseph gilbert * * ***** END GPL/BL DUAL LICENSE BLOCK ***** */ @@ -36,18 +34,31 @@ #include <Python.h> #include "DNA_armature_types.h" -//---------------------Python BPy_Armature structure definition------- +//-------------------TYPE CHECKS--------------------------------- +#define ArmatureObject_Check(v) ((v)->ob_type == &Armature_Type) +#define BonesDictObject_Check(v) ((v)->ob_type == &BonesDict_Type) +//-------------------MODULE INIT--------------------------------- +PyObject *Armature_Init( void ); +//-------------------TYPEOBJECT---------------------------------- +PyTypeObject Armature_Type; +PyTypeObject BonesDict_Type; +//-------------------STRUCT DEFINITION--------------------------- + typedef struct { PyObject_HEAD - bArmature * armature; -} BPy_Armature; - -//--------------------visible prototypes------------------------------ + PyObject *dict; + PyObject *editBoneDict; + short editmode_flag; //1 = in , 0 = not in +} BPy_BonesDict; -PyObject *Armature_Init( void ); -PyObject *Armature_CreatePyObject( bArmature * armature ); -bArmature *Armature_FromPyObject( PyObject * py_obj ); -int Armature_CheckPyObject( PyObject * py_obj ); +typedef struct { + PyObject_HEAD + struct bArmature * armature; + PyObject *Bones; +} BPy_Armature; +//-------------------VISIBLE PROTOTYPES------------------------- +PyObject *PyArmature_FromArmature(struct bArmature *armature); +struct bArmature *PyArmature_AsArmature(BPy_Armature *py_armature); -#endif /* EXPP_ARMATURE_H */ +#endif |