[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11398] branches/pyapi_devel/source/ blender/python/api2_2x: * use constants for lamps

Campbell Barton cbarton at metavr.com
Sat Jul 28 08:28:33 CEST 2007


Revision: 11398
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11398
Author:   campbellbarton
Date:     2007-07-28 08:28:33 +0200 (Sat, 28 Jul 2007)

Log Message:
-----------
* use constants for lamps
* Changed all the type checking functions (like Mesh_Check()) to allow subclasses of blender types.
* Made curve into 1 base type that surf, text3d and curve can subtype.

Modified Paths:
--------------
    branches/pyapi_devel/source/blender/python/api2_2x/Armature.h
    branches/pyapi_devel/source/blender/python/api2_2x/BezTriple.h
    branches/pyapi_devel/source/blender/python/api2_2x/Blender.c
    branches/pyapi_devel/source/blender/python/api2_2x/Bone.h
    branches/pyapi_devel/source/blender/python/api2_2x/Camera.h
    branches/pyapi_devel/source/blender/python/api2_2x/Const.h
    branches/pyapi_devel/source/blender/python/api2_2x/Constraint.h
    branches/pyapi_devel/source/blender/python/api2_2x/CurNurb.h
    branches/pyapi_devel/source/blender/python/api2_2x/Curve.c
    branches/pyapi_devel/source/blender/python/api2_2x/Curve.h
    branches/pyapi_devel/source/blender/python/api2_2x/Effect.h
    branches/pyapi_devel/source/blender/python/api2_2x/Font.h
    branches/pyapi_devel/source/blender/python/api2_2x/Group.h
    branches/pyapi_devel/source/blender/python/api2_2x/Image.h
    branches/pyapi_devel/source/blender/python/api2_2x/Ipo.h
    branches/pyapi_devel/source/blender/python/api2_2x/Lamp.c
    branches/pyapi_devel/source/blender/python/api2_2x/Lamp.h
    branches/pyapi_devel/source/blender/python/api2_2x/Lattice.h
    branches/pyapi_devel/source/blender/python/api2_2x/Library.h
    branches/pyapi_devel/source/blender/python/api2_2x/MTex.h
    branches/pyapi_devel/source/blender/python/api2_2x/Material.h
    branches/pyapi_devel/source/blender/python/api2_2x/Mesh.c
    branches/pyapi_devel/source/blender/python/api2_2x/Mesh.h
    branches/pyapi_devel/source/blender/python/api2_2x/Metaball.h
    branches/pyapi_devel/source/blender/python/api2_2x/Modifier.h
    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/Object.h
    branches/pyapi_devel/source/blender/python/api2_2x/Particle.h
    branches/pyapi_devel/source/blender/python/api2_2x/Pose.h
    branches/pyapi_devel/source/blender/python/api2_2x/Scene.c
    branches/pyapi_devel/source/blender/python/api2_2x/Scene.h
    branches/pyapi_devel/source/blender/python/api2_2x/Sound.h
    branches/pyapi_devel/source/blender/python/api2_2x/SurfNurb.h
    branches/pyapi_devel/source/blender/python/api2_2x/Text.h
    branches/pyapi_devel/source/blender/python/api2_2x/Texture.h
    branches/pyapi_devel/source/blender/python/api2_2x/Types.c
    branches/pyapi_devel/source/blender/python/api2_2x/Window.c
    branches/pyapi_devel/source/blender/python/api2_2x/World.h
    branches/pyapi_devel/source/blender/python/api2_2x/bpy_config.h
    branches/pyapi_devel/source/blender/python/api2_2x/bpy_data.c
    branches/pyapi_devel/source/blender/python/api2_2x/bpy_data.h
    branches/pyapi_devel/source/blender/python/api2_2x/bpy_float.c
    branches/pyapi_devel/source/blender/python/api2_2x/bpy_float.h
    branches/pyapi_devel/source/blender/python/api2_2x/bpy_list.h
    branches/pyapi_devel/source/blender/python/api2_2x/bpy_types.c
    branches/pyapi_devel/source/blender/python/api2_2x/color.h
    branches/pyapi_devel/source/blender/python/api2_2x/euler.h
    branches/pyapi_devel/source/blender/python/api2_2x/gen_library.c
    branches/pyapi_devel/source/blender/python/api2_2x/layer_set.h
    branches/pyapi_devel/source/blender/python/api2_2x/logic.h
    branches/pyapi_devel/source/blender/python/api2_2x/matrix.h
    branches/pyapi_devel/source/blender/python/api2_2x/object_softbody.h
    branches/pyapi_devel/source/blender/python/api2_2x/quat.h
    branches/pyapi_devel/source/blender/python/api2_2x/sceneRender.h
    branches/pyapi_devel/source/blender/python/api2_2x/sceneSequence.h
    branches/pyapi_devel/source/blender/python/api2_2x/sceneTimeLine.h
    branches/pyapi_devel/source/blender/python/api2_2x/vector.h

Added Paths:
-----------
    branches/pyapi_devel/source/blender/python/api2_2x/CurveText.c
    branches/pyapi_devel/source/blender/python/api2_2x/CurveText.h
    branches/pyapi_devel/source/blender/python/api2_2x/sceneObSeq.c
    branches/pyapi_devel/source/blender/python/api2_2x/sceneObSeq.h

Removed Paths:
-------------
    branches/pyapi_devel/source/blender/python/api2_2x/Text3d.c
    branches/pyapi_devel/source/blender/python/api2_2x/Text3d.h

Modified: branches/pyapi_devel/source/blender/python/api2_2x/Armature.h
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Armature.h	2007-07-28 04:22:24 UTC (rev 11397)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Armature.h	2007-07-28 06:28:33 UTC (rev 11398)
@@ -35,8 +35,8 @@
 #include "DNA_armature_types.h"
 
 //-------------------TYPE CHECKS---------------------------------
-#define BPyArmature_Check(v) ((v)->ob_type == &BPyArmature_Type)
-#define BPyBonesDict_Check(v) ((v)->ob_type == &BPyBonesDict_Type)
+#define BPyArmature_Check(v) PyObject_TypeCheck(v, &BPyArmature_Type)
+#define BPyBonesDict_Check(v) PyObject_TypeCheck(v, &BPyBonesDict_Type)
 //-------------------MODULE INIT---------------------------------
 void Armature_Init( void );
 PyObject *ArmatureType_Init( void );

Modified: branches/pyapi_devel/source/blender/python/api2_2x/BezTriple.h
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/BezTriple.h	2007-07-28 04:22:24 UTC (rev 11397)
+++ branches/pyapi_devel/source/blender/python/api2_2x/BezTriple.h	2007-07-28 06:28:33 UTC (rev 11398)
@@ -39,8 +39,7 @@
 extern PyTypeObject BPyBezTriple_Type;
 
 /* type check macro */
-#define BPyBezTriple_Check(o) \
- ( (o)->ob_type == &BPyBezTriple_Type)
+#define BPyBezTriple_Check(v) PyObject_TypeCheck(v, &BPyBezTriple_Type)
 
 /****************************************************************************
  Python BPyBezTripleObject structure definition:              

Modified: branches/pyapi_devel/source/blender/python/api2_2x/Blender.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Blender.c	2007-07-28 04:22:24 UTC (rev 11397)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Blender.c	2007-07-28 06:28:33 UTC (rev 11398)
@@ -88,7 +88,7 @@
 #include "SurfNurb.h"
 #include "Sys.h"
 #include "Text.h"
-#include "Text3d.h"
+#include "CurveText.h"
 #include "Texture.h"
 #include "Window.h"
 #include "World.h"
@@ -943,7 +943,7 @@
 	PyDict_SetItemString(dict, "BGL", BGL_Init());
 	PyDict_SetItemString(dict, "CurNurb", CurNurb_Init());
 	Constraint_Init();
-	PyDict_SetItemString(dict, "Curve", Curve_Init());
+	/*PyDict_SetItemString(dict, "Curve", Curve_Init());*/
 	Camera_Init(); /*PyDict_SetItemString(dict, "Camera", Camera_Init());*/
 	PyDict_SetItemString(dict, "Draw", Draw_Init());
 	Effect_Init();
@@ -970,7 +970,7 @@
 	PyDict_SetItemString(dict, "sys", sys_Init());
 	PyDict_SetItemString(dict, "Types", Types_Init());
 	PyDict_SetItemString(dict, "Text", Text_Init());
-	Text3d_Init();
+	//CurveText_Init();
 	Texture_Init();
 	PyDict_SetItemString(dict, "Window", Window_Init());
 	World_Init();

Modified: branches/pyapi_devel/source/blender/python/api2_2x/Bone.h
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Bone.h	2007-07-28 04:22:24 UTC (rev 11397)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Bone.h	2007-07-28 06:28:33 UTC (rev 11398)
@@ -35,8 +35,8 @@
 #include "DNA_armature_types.h"
 
 /*-------------------TYPE CHECKS---------------------------------*/
-#define BPyBone_Check(v) ((v)->ob_type == &BPyBone_Type)
-#define BPyEditBone_Check(v) ((v)->ob_type == &BPyEditBone_Type)
+#define BPyBone_Check(v) PyObject_TypeCheck(v, &BPyBone_Type)
+#define BPyEditBone_Check(v) PyObject_TypeCheck(v, &BPyEditBone_Type)
 /*-------------------TYPEOBJECT----------------------------------*/
 extern PyTypeObject BPyEditBone_Type;
 extern PyTypeObject BPyBone_Type;

Modified: branches/pyapi_devel/source/blender/python/api2_2x/Camera.h
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Camera.h	2007-07-28 04:22:24 UTC (rev 11397)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Camera.h	2007-07-28 06:28:33 UTC (rev 11398)
@@ -38,8 +38,7 @@
 
 extern PyTypeObject BPyCamera_Type;
 
-#define BPyCamera_Check(v) \
-    ((v)->ob_type == &BPyCamera_Type)	/* for type checking */
+#define BPyCamera_Check(v) PyObject_TypeCheck(v, &BPyCamera_Type)
 
 /* Python BPyCameraObject structure definition */
 typedef struct {

Modified: branches/pyapi_devel/source/blender/python/api2_2x/Const.h
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Const.h	2007-07-28 04:22:24 UTC (rev 11397)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Const.h	2007-07-28 06:28:33 UTC (rev 11398)
@@ -40,11 +40,10 @@
 extern PyTypeObject Const_Type;
 extern PyTypeObject ConstCategoty_Type;
 /*-------------------TYPE CHECKS-------------------------------*/
-#define BPyConst_Check(v) ((v)->ob_type==&Const_Type)
+#define BPyConst_Check(v) PyObject_TypeCheck(v, &Const_Type)
 #define BPyConstType_Check(d,v) (BPyConst_Check(v)&&(v)->defn==d)
-#define BPyConstCategory_Check(v) ((v)->ob_type==&Const_Type)
-#define BPyConstCategoryType_Check(d,v) \
-	(BPyConstCategory_Check(v)&&(v)->defn==d)
+#define BPyConstCategory_Check(v) PyObject_TypeCheck(v, &ConstCategoty_Type)
+#define BPyConstCategoryType_Check(d,v) (BPyConstCategory_Check(v)&&(v)->defn==d)
 
 /*-------------------TYPE ENUMS--------------------------------*/
 enum const_types {

Modified: branches/pyapi_devel/source/blender/python/api2_2x/Constraint.h
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Constraint.h	2007-07-28 04:22:24 UTC (rev 11397)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Constraint.h	2007-07-28 06:28:33 UTC (rev 11398)
@@ -53,7 +53,7 @@
 
 extern PyTypeObject BPyConstraint_Type;
 
-#define BPyConstraint_Check(v)  ((v)->ob_type == &BPyConstraint_Type)	/* for type checking */
+#define BPyConstraint_Check(v) PyObject_TypeCheck(v, &BPyConstraint_Type) /* for type checking */
 typedef struct {
 	PyObject_HEAD		/* required macro */
 	Object *obj;		/* "parent" object */

Modified: branches/pyapi_devel/source/blender/python/api2_2x/CurNurb.h
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/CurNurb.h	2007-07-28 04:22:24 UTC (rev 11397)
+++ branches/pyapi_devel/source/blender/python/api2_2x/CurNurb.h	2007-07-28 06:28:33 UTC (rev 11398)
@@ -37,7 +37,7 @@
 
 extern PyTypeObject BPyCurNurb_Type;
 
-#define BPyCurNurb_Check(v)  ((v)->ob_type == &BPyCurNurb_Type)	/* for type checking */
+#define BPyCurNurb_Check(v) PyObject_TypeCheck(v, &BPyCurNurb_Type) /* for type checking */
 
 /* Python BPyCurNurbObject structure definition */
 typedef struct {

Modified: branches/pyapi_devel/source/blender/python/api2_2x/Curve.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Curve.c	2007-07-28 04:22:24 UTC (rev 11397)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Curve.c	2007-07-28 06:28:33 UTC (rev 11398)
@@ -29,8 +29,10 @@
  * ***** END GPL/BL DUAL LICENSE BLOCK *****
  */
 
-#include "Curve.h" /*This must come first*/
+#include "Curve.h"		/* This must come first */
+#include "CurveBase.h"	/* subtype CurveBase */
 
+#include "BLI_blenlib.h"
 #include "BKE_main.h"
 #include "BKE_displist.h"
 #include "BKE_global.h"
@@ -49,732 +51,36 @@
 #include "bpy_list.h"
 
 
-/*****************************************************************************/
-/* The following string definitions are used for documentation strings.      */
-/* In Python these will be written to the console when doing a               */
-/*  Blender.Curve.__doc__                                                    */
-/*****************************************************************************/
 
-char M_Curve_doc[] = "";
-
-/*****************************************************************************/
-/*  Python API function prototypes for the Curve module.                     */
-/*****************************************************************************/
-
-/*****************************************************************************/
-/*  Python BPyCurveObject instance methods declarations:                          */
-/*****************************************************************************/
-
-static PyObject *Curve_getPathLen( BPyCurveObject * self );
-static int Curve_setPathLen( BPyCurveObject * self, PyObject * args );
-static PyObject *Curve_getControlPoint( BPyCurveObject * self, PyObject * args );
-static PyObject * Curve_setControlPoint( BPyCurveObject * self, PyObject * args );
-static PyObject *Curve_getLoc( BPyCurveObject * self );
-static int Curve_setLoc( BPyCurveObject * self, PyObject * args );
-static PyObject *Curve_getRot( BPyCurveObject * self );
-static int Curve_setRot( BPyCurveObject * self, PyObject * args );
-static PyObject *Curve_getSize( BPyCurveObject * self );
-static int Curve_setSize( BPyCurveObject * self, PyObject * args );
-static PyObject *Curve_getNumCurves( BPyCurveObject * self );
-static PyObject *Curve_getKey( BPyCurveObject * self );
-static PyObject *Curve_isNurb( BPyCurveObject * self, PyObject * args );
-static PyObject *Curve_isCyclic( BPyCurveObject * self, PyObject * args);
-static PyObject *Curve_getNumPoints( BPyCurveObject * self, PyObject * args );
-
-static PyObject *Curve_appendPoint( BPyCurveObject * self, PyObject * args );
-static PyObject *Curve_appendNurb( BPyCurveObject * self, PyObject * args );
-
-static PyObject *Curve_getBevOb( BPyCurveObject * self );
-static int Curve_setBevOb( BPyCurveObject * self, PyObject * args );
-
-static PyObject *Curve_getTaperOb( BPyCurveObject * self );
-static int Curve_setTaperOb( BPyCurveObject * self, PyObject * args );
-static PyObject *Curve_copy( BPyCurveObject * self );
-
-static PyObject *Curve_getIter( BPyCurveObject * self );
-static PyObject *Curve_iterNext( BPyCurveObject * self );
-
-PyObject *Curve_getNurb( BPyCurveObject * self, int n );
-static int Curve_length( PyInstanceObject * inst );
-
-
-struct chartrans *text_to_curve( Object * ob, int mode );
-/*****************************************************************************/
-/* Python BPyCurveObject methods:                                                 */
-/* gives access to                                                           */

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list