[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11362] branches/pyapi_devel/source/ blender/python/api2_2x: sceneRender update finished,

Campbell Barton cbarton at metavr.com
Tue Jul 24 21:01:30 CEST 2007


Revision: 11362
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11362
Author:   campbellbarton
Date:     2007-07-24 21:01:30 +0200 (Tue, 24 Jul 2007)

Log Message:
-----------
sceneRender update finished,
* use new constants, 
* design is safe from crashing (removing the scene that the renderData used would crash previously)
* use color PyType for dealing with colors.

Need to add renderlayer support still

Modified Paths:
--------------
    branches/pyapi_devel/source/blender/python/api2_2x/Mesh.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/Window.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/sceneRender.h

Modified: branches/pyapi_devel/source/blender/python/api2_2x/Mesh.h
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Mesh.h	2007-07-24 17:17:19 UTC (rev 11361)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Mesh.h	2007-07-24 19:01:30 UTC (rev 11362)
@@ -62,7 +62,7 @@
 #define BPyMFace_Check(v)		((v)->ob_type == &BPyMFace_Type)
 #define BPyMEdge_Check(v)		((v)->ob_type == &BPyMEdge_Type)
 #define BPyMVert_Check(v)		((v)->ob_type == &BPyMVert_Type)
-#define BPyPVert_Check(v)			((v)->ob_type == &BPyPVert_Type)
+#define BPyPVert_Check(v)		((v)->ob_type == &BPyPVert_Type)
 
 /* Typedefs for the new types */
 

Modified: branches/pyapi_devel/source/blender/python/api2_2x/Scene.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Scene.c	2007-07-24 17:17:19 UTC (rev 11361)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Scene.c	2007-07-24 19:01:30 UTC (rev 11362)
@@ -100,7 +100,6 @@
 /*-----------------------BPySceneObject  method declarations--------------------*/
 static PyObject *Scene_copy( BPySceneObject * self, PyObject * arg );
 static PyObject *Scene_update( BPySceneObject * self, PyObject * args );
-static PyObject *Scene_getRenderingContext( BPySceneObject * self );
 static PyObject *Scene_getRadiosityContext( BPySceneObject * self );
 static PyObject *Scene_getSequence( BPySceneObject * self );
 static PyObject *Scene_play( BPySceneObject * self, PyObject * args );
@@ -247,7 +246,7 @@
 	 "Scenes timeline (read only)",
 	 NULL},
 	{"render",
-	 (getter)Scene_getRenderingContext, (setter)NULL,
+	 (getter)RenderData_CreatePyObject, (setter)NULL,
 	 "Scenes rendering context (read only)",
 	 NULL},
 	{"radiosity",
@@ -382,28 +381,6 @@
 	NULL
 };
 
-/*-----------------------Scene module Init())-----------------------------*/
-PyObject *Scene_Init( void )
-{
-
-	PyObject *submodule;
-	PyObject *dict;
-	
-	if( PyType_Ready( &BPyScene_Type ) < 0 )
-		return NULL;
-	if( PyType_Ready( &SceneObSeq_Type ) < 0 )
-		return NULL;
-	
-	submodule = Py_InitModule3( "Blender.Scene", NULL, "Scene Doc Dummy" );
-
-	dict = PyModule_GetDict( submodule );
-	PyDict_SetItemString( dict, "Render", Render_Init(  ) );
-	PyDict_SetItemString( dict, "Radio", Radio_Init(  ) );
-	PyDict_SetItemString( dict, "Sequence", Sequence_Init(  ) );
-	
-	return submodule;
-}
-
 /*-----------------------compare----------------------------------------*/
 static int Scene_compare( BPySceneObject * a, BPySceneObject * b )
 {
@@ -492,13 +469,6 @@
 	Py_RETURN_NONE;
 }
 
-/*-----------------------Scene.getRenderingContext()---------------------*/
-static PyObject *Scene_getRenderingContext( BPySceneObject * self )
-{
-	SCENE_DEL_CHECK_PY(self);
-	return RenderData_CreatePyObject( self->scene );
-}
-
 static PyObject *Scene_getRadiosityContext( BPySceneObject * self )
 {
 	SCENE_DEL_CHECK_PY(self);
@@ -1323,3 +1293,35 @@
 	NULL,                       /* PyObject *tp_weaklist; */
 	NULL
 };
+
+PyObject *SceneType_Init( void )
+{
+	PyType_Ready( &BPyScene_Type );
+	return (PyObject *) &BPyScene_Type;
+}
+
+PyObject *SceneObSeqType_Init( void )
+{
+	PyType_Ready( &SceneObSeq_Type );
+	return (PyObject *) &SceneObSeq_Type;
+}
+
+/*-----------------------Scene module Init())-----------------------------*/
+PyObject *Scene_Init( void )
+{
+
+	PyObject *submodule;
+	PyObject *dict;
+	
+	SceneType_Init();
+	SceneObSeqType_Init();
+	
+	
+	submodule = Py_InitModule3( "Blender.Scene", NULL, "Scene Doc Dummy" );
+
+	dict = PyModule_GetDict( submodule );
+	PyDict_SetItemString( dict, "Radio", Radio_Init(  ) );
+	PyDict_SetItemString( dict, "Sequence", Sequence_Init(  ) );
+	
+	return submodule;
+}
\ No newline at end of file

Modified: branches/pyapi_devel/source/blender/python/api2_2x/Scene.h
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Scene.h	2007-07-24 17:17:19 UTC (rev 11361)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Scene.h	2007-07-24 19:01:30 UTC (rev 11362)
@@ -73,6 +73,8 @@
 
 
 PyObject *Scene_Init( void );
+PyObject *SceneType_Init( void );
+PyObject *SceneObSeqType_Init( void );
 PyObject *Scene_CreatePyObject( Scene * scene );
 PyObject *Scene_object_new( Scene * scene, PyObject *args );
 #define Scene_FromPyObject(py_obj) (( ( BPySceneObject * ) py_obj )->scene)

Modified: branches/pyapi_devel/source/blender/python/api2_2x/Window.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Window.c	2007-07-24 17:17:19 UTC (rev 11361)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Window.c	2007-07-24 19:01:30 UTC (rev 11362)
@@ -44,6 +44,7 @@
 #include "BSE_filesel.h"
 #include "BIF_editmesh.h"	/* for undo_push_mesh() */
 #include "BIF_screen.h"
+#include "BIF_renderwin.h"
 #include "BIF_space.h"
 #include "BIF_drawtext.h"
 #include "DNA_view3d_types.h"
@@ -66,6 +67,8 @@
 /*****************************************************************************/
 /* Python API function prototypes for the Window module.		*/
 /*****************************************************************************/
+
+PyObject *M_Window_CloseRenderWindow( PyObject * self );
 PyObject *M_Window_Redraw( PyObject * self, PyObject * args );
 static PyObject *M_Window_RedrawAll( PyObject * self, PyObject * args );
 static PyObject *M_Window_QRedrawAll( PyObject * self, PyObject * args );
@@ -113,6 +116,9 @@
 /*****************************************************************************/
 static char M_Window_doc[] = "The Blender Window module\n\n";
 
+static char M_Window_CloseRenderWindow_doc[] =
+	"() - Close the render window";
+
 static char M_Window_Redraw_doc[] =
 	"() - Force a redraw of a specific Window Type (see Window.Types)";
 
@@ -285,6 +291,7 @@
 /* Python method structure definition for Blender.Window module:	*/
 /*****************************************************************************/
 struct PyMethodDef M_Window_methods[] = {
+	{"Redraw", M_Window_CloseRenderWindow, METH_NOARGS, M_Window_CloseRenderWindow_doc},
 	{"Redraw", M_Window_Redraw, METH_VARARGS, M_Window_Redraw_doc},
 	{"RedrawAll", M_Window_RedrawAll, METH_VARARGS,
 	 M_Window_RedrawAll_doc},
@@ -369,6 +376,12 @@
 	{NULL, NULL, 0, NULL}
 };
 
+PyObject *M_Window_CloseRenderWindow( PyObject * self )
+{
+	BIF_close_render_display(  );
+	Py_RETURN_NONE;
+}
+
 /*****************************************************************************/
 /* Function:	M_Window_Redraw						*/
 /* Python equivalent:	Blender.Window.Redraw				*/

Modified: branches/pyapi_devel/source/blender/python/api2_2x/bpy_types.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/bpy_types.c	2007-07-24 17:17:19 UTC (rev 11361)
+++ branches/pyapi_devel/source/blender/python/api2_2x/bpy_types.c	2007-07-24 19:01:30 UTC (rev 11362)
@@ -115,6 +115,7 @@
 #include "Constraint.h"
 #include "color.h"
 #include "Pose.h"
+#include "sceneRender.h"
 
 #include "vector.h"
 #include "matrix.h"
@@ -142,6 +143,10 @@
 	PyModule_AddObject( module, "Const",			ConstType_Init() );
 	PyModule_AddObject( module, "ConstCategory",	ConstCategoryType_Init() );
 	
+	PyModule_AddObject( module, "Scene",			SceneType_Init() );
+	 PyModule_AddObject( module, "SceneObSeq",		SceneObSeqType_Init() );
+	 PyModule_AddObject( module, "Render",			RenderType_Init() );
+	
 	PyModule_AddObject( module, "Object",			ObjectType_Init() );
 	PyModule_AddObject( module, "Lamp",				LampType_Init() );
 	PyModule_AddObject( module, "Mesh",				MeshType_Init() );

Modified: branches/pyapi_devel/source/blender/python/api2_2x/sceneRender.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/sceneRender.c	2007-07-24 17:17:19 UTC (rev 11361)
+++ branches/pyapi_devel/source/blender/python/api2_2x/sceneRender.c	2007-07-24 19:01:30 UTC (rev 11362)
@@ -53,7 +53,8 @@
 #include "blendef.h"
 #include "gen_utils.h"
 #include "gen_library.h"
-
+#include "Const.h"
+#include "color.h"
 #include "Scene.h"
 
 /* local defines */
@@ -64,6 +65,7 @@
 #define PY_HIGHER	     4
 #define PY_BEST		     5
 #define PY_USEAOSETTINGS 6
+
 #define PY_SKYDOME	     1
 #define PY_FULL	         2
 
@@ -114,11 +116,160 @@
 	EXPP_RENDER_ATTR_YF_EXPOSURE,
 	EXPP_RENDER_ATTR_YF_AAPXSIZE,
 	EXPP_RENDER_ATTR_YF_AATHRESH,
+	EXPP_RENDER_ATTR_OSA,		/* get only */
+	EXPP_RENDER_ATTR_PLANES,	/* get only */
+	EXPP_RENDER_ATTR_WINSIZE,	/* get only */
 };
 
-/* Render doc strings */
-static char M_Render_doc[] = "The Blender Render module";
+enum rend_const_constants {
+	EXPP_RENDER_ATTR_FORMAT = 0,
+	EXPP_RENDER_ATTR_PRESET,
+	EXPP_RENDER_ATTR_GITYPE,
+	EXPP_RENDER_ATTR_GIQUALITY,
+	EXPP_RENDER_ATTR_WINPOS,
+	EXPP_RENDER_ATTR_GAMEFRAME,
+	EXPP_RENDER_ATTR_RENDERER,
+	EXPP_RENDER_ATTR_ALPHA,
+	EXPP_RENDER_ATTR_DISPLAY,
+};
 
+/* checks for the scene being removed */
+#define REND_DEL_CHECK_PY(self) if (!(self->bpysce->scene)) return ( EXPP_ReturnPyObjError( PyExc_RuntimeError, "Scene has been removed" ) )
+#define REND_DEL_CHECK_INT(self) if (!(self->bpysce->scene)) return ( EXPP_ReturnIntError( PyExc_RuntimeError, "Scene has been removed" ) )
+
+static constIdents formatTypesIdents[] = {
+	{"TARGA",			{(int)R_TARGA}},	
+	{"IRIS",			{(int)R_IRIS}},
+	{"HAMX",			{(int)R_HAMX}},
+	{"FTYPE",			{(int)R_FTYPE}},
+	{"JPEG",			{(int)R_JPEG90}},
+	{"MOVIE",			{(int)R_MOVIE}},
+	{"IRISZ",			{(int)R_IRIZ}},
+	{"RAWTGA",			{(int)R_RAWTGA}},
+	{"AVIRAW",			{(int)R_AVIRAW}},
+	{"AVIJPEG",			{(int)R_AVIJPEG}},
+	{"PNG",				{(int)R_PNG}},
+	{"AVICODEC",		{(int)R_AVICODEC}},
+	{"QUICKTIME",		{(int)R_QUICKTIME}},
+	{"BMP",				{(int)R_BMP}},
+	{"HDR",				{(int)R_RADHDR}},
+	{"TIFF",			{(int)R_TIFF}},
+	{"OPENEXR",			{(int)R_OPENEXR}},
+	{"FFMPEG",			{(int)R_FFMPEG}},
+	{"FRAMESERVER",		{(int)R_FRAMESERVER}},
+	{"CINEON",			{(int)R_CINEON}},
+	{"DPX",				{(int)R_DPX}},
+	{"MULTILAYER",		{(int)R_MULTILAYER}},
+	{"DDS",				{(int)R_DDS}},
+};
+static constDefinition formatTypes = {
+	EXPP_CONST_INT, "Formats",
+		sizeof(formatTypesIdents)/sizeof(constIdents), formatTypesIdents
+};
+
+static constIdents sizePresetsIdents[] = {
+	{"PAL",				{(int)B_PR_PAL}},
+	{"NTSC",			{(int)B_PR_NTSC}},
+	{"DEFAULT",			{(int)B_PR_PRESET}},
+	{"PREVIEW",			{(int)B_PR_PRV}},
+	{"PC",				{(int)B_PR_PC}},
+	{"PAL169",			{(int)B_PR_PAL169}},

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list