[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11318] branches/pyapi_devel/source/ blender/python/api2_2x: updated NLA to use new constants, more to come...
Campbell Barton
cbarton at metavr.com
Thu Jul 19 21:12:52 CEST 2007
Revision: 11318
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11318
Author: campbellbarton
Date: 2007-07-19 21:12:51 +0200 (Thu, 19 Jul 2007)
Log Message:
-----------
updated NLA to use new constants, more to come...
Modified Paths:
--------------
branches/pyapi_devel/source/blender/python/api2_2x/Armature.c
branches/pyapi_devel/source/blender/python/api2_2x/BezTriple.c
branches/pyapi_devel/source/blender/python/api2_2x/Image.c
branches/pyapi_devel/source/blender/python/api2_2x/Ipo.c
branches/pyapi_devel/source/blender/python/api2_2x/Ipo.h
branches/pyapi_devel/source/blender/python/api2_2x/Metaball.c
branches/pyapi_devel/source/blender/python/api2_2x/NLA.c
branches/pyapi_devel/source/blender/python/api2_2x/NLA.h
branches/pyapi_devel/source/blender/python/api2_2x/Object.c
branches/pyapi_devel/source/blender/python/api2_2x/bpy.c
branches/pyapi_devel/source/blender/python/api2_2x/bpy_types.c
branches/pyapi_devel/source/blender/python/api2_2x/sceneRender.c
branches/pyapi_devel/source/blender/python/api2_2x/sceneSequence.c
Modified: branches/pyapi_devel/source/blender/python/api2_2x/Armature.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Armature.c 2007-07-19 16:37:23 UTC (rev 11317)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Armature.c 2007-07-19 19:12:51 UTC (rev 11318)
@@ -1164,25 +1164,9 @@
//-------------------MODULE INITIALIZATION--------------------------------
void Armature_Init(void)
{
- //Initializes TypeObject.ob_type
PyType_Ready(&BonesDict_Type);
PyType_Ready(&EditBone_Type);
PyType_Ready(&Bone_Type);
- //Register the module
- //module = Py_InitModule3("Blender.Armature", NULL, "The Blender Armature module");
-
- //Add TYPEOBJECTS to the module
- /*
- PyModule_AddObject(module, "Bone",
- EXPP_incr_ret((PyObject *)&Bone_Type)); //*steals*
- PyModule_AddObject(module, "Editbone",
- EXPP_incr_ret((PyObject *)&EditBone_Type)); //*steals*
- */
ArmatureType_Init( );
-
- //Add SUBMODULES to the module
- //dict = PyModule_GetDict( module ); //borrowed
- //PyDict_SetItemString(dict, "NLA", NLA_Init()); //creates a *new* module
-
}
Modified: branches/pyapi_devel/source/blender/python/api2_2x/BezTriple.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/BezTriple.c 2007-07-19 16:37:23 UTC (rev 11317)
+++ branches/pyapi_devel/source/blender/python/api2_2x/BezTriple.c 2007-07-19 19:12:51 UTC (rev 11318)
@@ -332,7 +332,7 @@
static PyObject *BezTriple_getHandle2( BPy_BezTriple * self )
{
- return PyConst_NewInt( &handleTypes, self->beztriple->h2 );
+ return PyConst_NewInt( &handleTypes, self->beztriple->h2 );
}
static int BezTriple_setHandle1( BPy_BezTriple * self, PyObject *value )
@@ -565,26 +565,8 @@
NULL
};
-/*
- BezTriple_Init
-*/
-PyObject *BezTripleType_Init( void )
-{
- /* only allocate new dictionary once */
- if( BezTriple_Type.tp_dict == NULL ) {
- BezTriple_Type.tp_dict = PyDict_New();
- PyConstCategory_AddObjectToDict( BezTriple_Type.tp_dict, &handleTypes );
- PyType_Ready( &BezTriple_Type ) ;
- }
- return (PyObject *) &BezTriple_Type ;
-}
-void BezTriple_Init( void )
-{
- BezTripleType_Init();
-}
-
/* Three Python BezTriple_Type helper functions needed by the Object module: */
/****************************************************************************
@@ -646,3 +628,23 @@
return pyobj;
}
+
+/*
+ BezTriple_Init
+*/
+
+PyObject *BezTripleType_Init( void )
+{
+ /* only allocate new dictionary once */
+ if( BezTriple_Type.tp_dict == NULL ) {
+ BezTriple_Type.tp_dict = PyDict_New();
+ PyConstCategory_AddObjectToDict( BezTriple_Type.tp_dict, &handleTypes );
+ PyType_Ready( &BezTriple_Type ) ;
+ }
+ return (PyObject *) &BezTriple_Type ;
+}
+
+void BezTriple_Init( void )
+{
+ BezTripleType_Init();
+}
Modified: branches/pyapi_devel/source/blender/python/api2_2x/Image.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Image.c 2007-07-19 16:37:23 UTC (rev 11317)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Image.c 2007-07-19 19:12:51 UTC (rev 11318)
@@ -95,9 +95,7 @@
static PyObject *Image_save( BPy_Image * self );
static PyObject *Image_unpack( BPy_Image * self, PyObject * args );
static PyObject *Image_pack( BPy_Image * self );
-static PyObject *Image_makeCurrent( BPy_Image * self );
-
/*****************************************************************************/
/* Python BPy_Image methods table: */
/*****************************************************************************/
Modified: branches/pyapi_devel/source/blender/python/api2_2x/Ipo.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Ipo.c 2007-07-19 16:37:23 UTC (rev 11317)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Ipo.c 2007-07-19 19:12:51 UTC (rev 11318)
@@ -908,7 +908,6 @@
{
namefunc lookup_name;
int size;
- PyObject *dict;
int *vals = NULL;
char name[32];
PyObject *attr = Py_None;
Modified: branches/pyapi_devel/source/blender/python/api2_2x/Ipo.h
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Ipo.h 2007-07-19 16:37:23 UTC (rev 11317)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Ipo.h 2007-07-19 19:12:51 UTC (rev 11318)
@@ -50,6 +50,8 @@
#define BPy_Ipo_Check(v) ((v)->ob_type == &Ipo_Type) /* for type checking */
+/* Checks this is an IPO and it matches the ID */
+#define BPy_Ipo_BlockType_Check(v, idcode) (BPy_Ipo_Check(v) && ( idcode == ((BPy_Ipo *)v)->ipo->blocktype ))
/*
* prototypes
Modified: branches/pyapi_devel/source/blender/python/api2_2x/Metaball.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Metaball.c 2007-07-19 16:37:23 UTC (rev 11317)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Metaball.c 2007-07-19 19:12:51 UTC (rev 11318)
@@ -56,22 +56,6 @@
#define METAELEM_DEL_CHECK_INT(_ml) if (!_ml) return ( EXPP_ReturnIntError( PyExc_RuntimeError, "Metaball has been removed" ) );
/*****************************************************************************/
-/* Python API function prototypes for the Metaball module. */
-/*****************************************************************************/
-
-/*****************************************************************************/
-/* The following string definitions are used for documentation strings. */
-/* In Python these will be written to the console when doing a */
-/* Blender.Metaball.__doc__ */
-/*****************************************************************************/
-static char M_Metaball_doc[] =
- "The Blender Metaball module\n\n\nMetaballs are primitive shapes\
- such as balls, pipes, boxes and planes,\
- that can join each other to create smooth,\
- organic volumes\n. The shapes themseves are called\
- 'Metaelements' and can be accessed from the Metaball module.";
-
-/*****************************************************************************/
/* Python method structure definition for Blender.Metaball module: */
/*****************************************************************************/
struct PyMethodDef M_Metaball_methods[] = {
@@ -635,10 +619,9 @@
static int Metaelem_setType( BPy_Metaelem * self, PyObject * value )
{
- MetaElem *ml = MetaElem_get_pointer(self->bpymetaball->metaball, self->index);
- METAELEM_DEL_CHECK_INT(ml);
-
+ MetaElem *ml = MetaElem_get_pointer(self->bpymetaball->metaball, self->index);
constValue *c = Const_FromPyObject( &metaElemTypes, value);
+ METAELEM_DEL_CHECK_INT(ml);
if( !c )
return EXPP_ReturnIntError( PyExc_TypeError,
"expected Types constant or string" );
Modified: branches/pyapi_devel/source/blender/python/api2_2x/NLA.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/NLA.c 2007-07-19 16:37:23 UTC (rev 11317)
+++ branches/pyapi_devel/source/blender/python/api2_2x/NLA.c 2007-07-19 19:12:51 UTC (rev 11318)
@@ -35,6 +35,7 @@
#include "DNA_curve_types.h"
#include "DNA_scene_types.h"
#include "BKE_action.h"
+#include "BKE_utildefines.h"
#include "BKE_nla.h"
#include "BKE_global.h"
#include "BKE_main.h"
@@ -48,42 +49,102 @@
#include "gen_library.h"
#include "blendef.h"
#include "MEM_guardedalloc.h"
+#include "Const.h"
+enum mat_float_consts {
+ EXPP_NLA_ATTR_START = 0,
+ EXPP_NLA_ATTR_END,
+ EXPP_NLA_ATTR_ACTSTART,
+ EXPP_NLA_ATTR_ACTEND,
+ EXPP_NLA_ATTR_ACTOFFS,
+ EXPP_NLA_ATTR_STRIDELEN,
+ EXPP_NLA_ATTR_REPEAT,
+ EXPP_NLA_ATTR_BLENDIN,
+ EXPP_NLA_ATTR_BLENDOUT,
+};
+
+/* checks for the group being removed */
+#define ACTIONSTRIP_DEL_CHECK_PY(actstrip) if (!(actstrip->strip)) return ( EXPP_ReturnPyObjError( PyExc_RuntimeError, "ActionStrip has been removed" ) )
+#define ACTIONSTRIP_DEL_CHECK_INT(actstrip) if (!(actstrip->strip)) return ( EXPP_ReturnIntError( PyExc_RuntimeError, "ActionStrip has been removed" ) )
+
#define ACTSTRIP_STRIDEAXIS_X 0
#define ACTSTRIP_STRIDEAXIS_Y 1
#define ACTSTRIP_STRIDEAXIS_Z 2
+
/*****************************************************************************/
+/* PythonTypeObject constant declarations */
+/*****************************************************************************/
+
+/*
+ * structure of "tuples" of constant's string name and int value
+ *
+ * For example, these two structures will define the constant category
+ * "bpy.class.Object.DrawTypes" the constant
+ * "bpy.class.Object.DrawTypes.BOUNDBOX" and others.
+ */
+
+static constIdents strideAxisIdents[] = {
+ {"X", {(int)ACTSTRIP_STRIDEAXIS_X}},
+ {"Y", {(int)ACTSTRIP_STRIDEAXIS_Y}},
+ {"Z", {(int)ACTSTRIP_STRIDEAXIS_Z}},
+};
+
+/*
+ * structure with constant internal type (int), constant category name,
+ * and number of constant values in the category.
+ */
+
+static constDefinition strideAxis = {
+ EXPP_CONST_INT, "StrideAxis",
+ sizeof(strideAxisIdents)/sizeof(constIdents), strideAxisIdents
+};
+
+static constIdents blendModeIdents[] = {
+ {"BLEND", {(int)ACTSTRIPMODE_BLEND}},
+ {"ADD", {(int)ACTSTRIPMODE_ADD}},
+};
+
+/*
+ * structure with constant internal type (int), constant category name,
+ * and number of constant values in the category.
+ */
+
+static constDefinition blendMode = {
+ EXPP_CONST_INT, "BlendMode",
+ sizeof(blendModeIdents)/sizeof(constIdents), blendModeIdents
+};
+
+/*****************************************************************************/
/* Python BPy_Action methods declarations: */
/*****************************************************************************/
static PyObject *Action_getFrameNumbers(BPy_Action *self);
-static PyObject *Action_getChannelIpo( BPy_Action * self, PyObject * args );
-static PyObject *Action_getChannelNames( BPy_Action * self );
static PyObject *Action_renameChannel( BPy_Action * self, PyObject * args );
-static PyObject *Action_verifyChannel( BPy_Action * self, PyObject * args );
-static PyObject *Action_removeChannel( BPy_Action * self, PyObject * args );
-static PyObject *Action_getAllChannelIpos( BPy_Action * self );
+static PyObject *Action_setdefault( BPy_Action * self, PyObject * args );
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list