[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [10888] trunk/blender/source/blender/ python/api2_2x: yafray settings access from Py API
Campbell Barton
cbarton at metavr.com
Wed Jun 6 21:12:07 CEST 2007
Revision: 10888
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=10888
Author: campbellbarton
Date: 2007-06-06 21:12:07 +0200 (Wed, 06 Jun 2007)
Log Message:
-----------
yafray settings access from Py API
Modified Paths:
--------------
trunk/blender/source/blender/python/api2_2x/doc/Render.py
trunk/blender/source/blender/python/api2_2x/sceneRender.c
Modified: trunk/blender/source/blender/python/api2_2x/doc/Render.py
===================================================================
--- trunk/blender/source/blender/python/api2_2x/doc/Render.py 2007-06-06 19:09:45 UTC (rev 10887)
+++ trunk/blender/source/blender/python/api2_2x/doc/Render.py 2007-06-06 19:12:07 UTC (rev 10888)
@@ -105,14 +105,15 @@
@var PAL169: Output format. Use with renderdata.sizePreset()
@var B_PR_FULL: Output format. Use with renderdata.sizePreset()
- at var NONE: Yafray GI Quality. Use with renderdata.setYafrayGIQuality()
+ at var NONE: Yafray GI Quality / Method. Use with renderdata.setYafrayGIQuality()
@var LOW: Yafray GI Quality. Use with renderdata.setYafrayGIQuality()
@var MEDIUM: Yafray GI Quality. Use with renderdata.setYafrayGIQuality()
@var HIGH: Yafray GI Quality. Use with renderdata.setYafrayGIQuality()
@var HIGHER: Yafray GI Quality. Use with renderdata.setYafrayGIQuality()
@var BEST: Yafray GI Quality. Use with renderdata.setYafrayGIQuality()
- at var SKYDOME: Yafray GI Quality. Use with renderdata.setYafrayGIQuality()
- at var GIFULL: Yafray GI Quality. Use with renderdata.setYafrayGIQuality()
+ at var USEAOSETTINGS: Yafray GI Quality. Use with renderdata.setYafrayGIQuality()
+ at var SKYDOME: Yafray GI Method. Use with renderdata.setYafrayGIMethod()
+ at var GIFULL: Yafray GI Method. Use with renderdata.setYafrayGIMethod()
"""
def CloseRenderWindow():
@@ -324,8 +325,45 @@
scene or None (setting to None clears the set). The scene argument cannot
cause a circular link.
@type set: BPy_Scene or None
+ @ivar yafrayGIMethod: Global Illumination method.
+ Valid values are NONE (0), SKYDOME (1) or FULL (2).
+ @type yafrayGIMethod: int
+ @ivar yafrayGIQuality: Global Illumination quality.
+ @type yafrayGIQuality: int {NONE (0), LOW (1), MEDIUM (2), HIGH (3), HIGHER (4), BEST (5), USEAOSETTINGS (6)}
+ @ivar yafrayExportToXML: If true export to an xml file and call yafray instead of plugin.
+ @type yafrayExportToXML: boolean
+ @ivar yafrayAutoAntiAliasing: Automatic anti-aliasing enabled/disabled.
+ @type yafrayAutoAntiAliasing: boolean
+ @ivar yafrayClampRGB: Clamp RGB enabled/disabled.
+ @type yafrayClampRGB: boolean
+ @ivar yafrayAntiAliasingPasses: Number of anti-aliasing passes (0 is no Anti-Aliasing).
+ @type yafrayAntiAliasingPasses: int [0, 64]
+ @ivar yafrayAntiAliasingSamples: Number of samples per pass.
+ @type yafrayAntiAliasingSamples: int [0, 2048]
+ @ivar yafrayAntiAliasingPixelSize: Anti-aliasing pixel filter size.
+ @type yafrayAntiAliasingPixelSize: float [1.0, 2.0]
+ @ivar yafrayAntiAliasingThreshold: Anti-aliasing threshold.
+ @type yafrayAntiAliasingThreshold: float [0.05, 1.0]
+ @ivar yafrayNumberOfProcessors: Number of processors to use.
+ @type yafrayNumberOfProcessors: int [1, 8]
+ @ivar yafrayGIMethod: Global illumination method.
+ @type yafrayGIMethod: int {NONE (0), SKYDOME (1), GIFULL (2)}
+ @ivar yafrayGICache: Cache occlusion/irradiance samples (faster).
+ @type yafrayGICache: boolean
+ @ivar yafrayGICacheBumpNormals: Enable/disable bumpnormals for cache.
+ @type yafrayGICacheBumpNormals: boolean
+ @ivar yafrayGICacheShadowQuality: Shadow quality, keep it under 0.95 :-).
+ @type yafrayGICacheShadowQuality: float [0.01, 1.0]
+ @ivar yafrayGICachePixelsPerSample: Maximum number of pixels without samples, the lower the better and slower.
+ @type yafrayGICachePixelsPerSample: int [1, 50]
+ @ivar yafrayGICacheRefinement: Threshold to refine shadows EXPERIMENTAL. 1 = no refinement.
+ @type yafrayGICacheRefinement: float [0.001, 1.0]
+ @ivar yafrayGIPhotons: Enable/disable use of global photons to help in GI.
+ @type yafrayGIPhotons: boolean
+ @ivar yafrayGITunePhotons: If true the photonmap is shown directly in the render for tuning.
+ @type yafrayGITunePhotons: boolean
"""
-
+
def currentFrame(frame = None):
"""
Get/set the current frame.
@@ -824,8 +862,23 @@
- HIGH
- HIGHER
- BEST
+ - USEAOSETTINGS
"""
+ def getYafrayGIQuality():
+ """
+ Get yafray global Illumination quality.
+ @rtype: enum constant
+ @return: one of 6 constants:
+ - NONE
+ - LOW
+ - MEDIUM
+ - HIGH
+ - HIGHER
+ - BEST
+ - USEAOSETTINGS
+ """
+
def setYafrayGIMethod(type):
"""
Set yafray global Illumination method.
@@ -836,6 +889,17 @@
- GIFULL: Use Full method
"""
+ def getYafrayGIMethod():
+ # (dietrich) 2007/06/01
+ """
+ Get yafray global Illumination method.
+ @rtype: enum constant -
+ @return: Current yafray global illumination method:
+ - NONE: Do not use GI illumination
+ - SKYDOME: Use Skydome method
+ - GIFULL: Use Full method
+ """
+
def yafrayGIPower(power = None):
"""
Get/set GI lighting intensity scale.
Modified: trunk/blender/source/blender/python/api2_2x/sceneRender.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/sceneRender.c 2007-06-06 19:09:45 UTC (rev 10887)
+++ trunk/blender/source/blender/python/api2_2x/sceneRender.c 2007-06-06 19:12:07 UTC (rev 10888)
@@ -25,7 +25,7 @@
*
* This is a new part of Blender.
*
- * Contributor(s): Joseph Gilbert
+ * Contributor(s): Joseph Gilbert, Dietrich Bollmann
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
@@ -56,14 +56,15 @@
#include "Scene.h"
/* local defines */
-#define PY_NONE 0
-#define PY_LOW 1
-#define PY_MEDIUM 2
-#define PY_HIGH 3
-#define PY_HIGHER 4
-#define PY_BEST 5
-#define PY_SKYDOME 1
-#define PY_FULL 2
+#define PY_NONE 0
+#define PY_LOW 1
+#define PY_MEDIUM 2
+#define PY_HIGH 3
+#define PY_HIGHER 4
+#define PY_BEST 5
+#define PY_USEAOSETTINGS 6
+#define PY_SKYDOME 1
+#define PY_FULL 2
enum rend_constants {
EXPP_RENDER_ATTR_XPARTS = 0,
@@ -301,6 +302,85 @@
EXPP_allqueue( REDRAWVIEWCAM, 0 );
}
+/** set / get boolean */
+
+static int M_Render_setBooleanShort( BPy_RenderData * self, PyObject *value, short* var )
+{
+ if( !PyInt_Check( value ) )
+ return EXPP_ReturnIntError( PyExc_TypeError,
+ "expected boolean value" );
+
+ *var = (PyInt_AsLong( value )) ? 1 : 0;
+
+ EXPP_allqueue( REDRAWBUTSSCENE, 0 );
+ return 0;
+}
+
+static PyObject *M_Render_getBooleanShort( BPy_RenderData * self, short var )
+{
+ return PyInt_FromLong( (long) var );
+}
+
+/** set / get float */
+
+static int M_Render_setFloat( BPy_RenderData *self, PyObject *value, float *var, float min, float max )
+{
+ float val;
+ char error[48];
+
+ if( !PyFloat_Check( value ) )
+ return EXPP_ReturnIntError( PyExc_TypeError,
+ "expected float value" );
+
+ val = (float) PyFloat_AsDouble( value );
+
+ /* check range */
+ if ( val < min || val > max ) {
+ sprintf( error, "out of range - expected %f to %f", min, max );
+ return EXPP_ReturnIntError( PyExc_TypeError,error );
+ }
+
+ *var = val;
+
+ EXPP_allqueue( REDRAWBUTSSCENE, 0 );
+ return 0;
+}
+
+static PyObject *M_Render_getFloat( BPy_RenderData *self, float var )
+{
+ return PyFloat_FromDouble( (double) var );
+}
+
+/** set / get integer */
+
+static int M_Render_setInt( BPy_RenderData *self, PyObject *value, int *var, int min, int max )
+{
+ int val;
+ char error[48];
+
+ if( !PyInt_Check( value ) )
+ return EXPP_ReturnIntError( PyExc_TypeError,
+ "expected integer value" );
+
+ val = (int) PyInt_AsLong( value );
+
+ /* check range */
+ if ( val < min || val > max ) {
+ sprintf( error, "out of range - expected %d to %d", min, max );
+ return EXPP_ReturnIntError( PyExc_TypeError,error );
+ }
+
+ *var = val;
+
+ EXPP_allqueue( REDRAWBUTSSCENE, 0 );
+ return 0;
+}
+
+static PyObject *M_Render_getInt( BPy_RenderData *self, int var )
+{
+ return PyInt_FromLong( (long) var );
+}
+
/***************************************************************************/
/* Render Module Function Definitions */
/***************************************************************************/
@@ -1038,6 +1118,8 @@
Py_RETURN_NONE;
}
+/*
+
PyObject *RenderData_SetYafrayGIQuality( BPy_RenderData * self,
PyObject * args )
{
@@ -1077,7 +1159,277 @@
EXPP_allqueue( REDRAWBUTSSCENE, 0 );
Py_RETURN_NONE;
}
+*/
+/* (die) beg */
+
+/* YafRay - Yafray GI Method */
+
+static int RenderData_setYafrayGIQuality( BPy_RenderData * self, PyObject * value )
+{
+ long type;
+
+ if( !PyInt_Check( value ) )
+ return EXPP_ReturnIntError( PyExc_TypeError,
+ "expected constant" );
+
+ type = PyInt_AsLong( value );
+
+ if( type == PY_NONE || type == PY_LOW ||
+ type == PY_MEDIUM || type == PY_HIGH ||
+ type == PY_HIGHER || type == PY_BEST ||
+ type == PY_USEAOSETTINGS
+ ) {
+ self->renderContext->GIquality = (short)type;
+ } else {
+ return EXPP_ReturnIntError( PyExc_TypeError,
+ "expected constant NONE, LOW, MEDIUM, HIGHER or BEST" );
+ }
+
+ EXPP_allqueue( REDRAWBUTSSCENE, 0 );
+ return 0;
+}
+
+static PyObject *RenderData_getYafrayGIQuality( BPy_RenderData * self )
+{
+ return PyInt_FromLong( (long) self->renderContext->GIquality );
+}
+
+static PyObject *RenderData_SetYafrayGIQuality( BPy_RenderData * self,
+ PyObject * args )
+{
+ return EXPP_setterWrapper( (void*) self, args,
+ (setter) RenderData_setYafrayGIQuality );
+}
+
+static PyObject *RenderData_GetYafrayGIQuality( BPy_RenderData * self )
+{
+ return RenderData_getYafrayGIQuality(self);
+}
+
+/* YafRay - Yafray GI Method */
+
+static int RenderData_setYafrayGIMethod( BPy_RenderData * self, PyObject * value )
+{
+ int type;
+
+ if( !PyInt_Check( value ) )
+ return EXPP_ReturnIntError( PyExc_TypeError,
+ "expected constant NONE, SKYDOME or FULL" );
+
+ type = PyInt_AsLong( value );
+ if( type == PY_NONE || type == PY_SKYDOME || type == PY_FULL ) {
+ self->renderContext->GImethod = (short)type;
+ } else {
+ return EXPP_ReturnIntError( PyExc_TypeError,
+ "expected constant NONE, SKYDOME or FULL" );
+ }
+
+ EXPP_allqueue( REDRAWBUTSSCENE, 0 );
+ return 0;
+}
+
+static PyObject *RenderData_getYafrayGIMethod( BPy_RenderData * self )
+{
+ return PyInt_FromLong( (long)self->renderContext->GImethod );
+}
+
+static PyObject *RenderData_GetYafrayGIMethod( BPy_RenderData * self )
+{
+ return RenderData_getYafrayGIMethod(self);
+}
+
+static PyObject *RenderData_SetYafrayGIMethod( BPy_RenderData * self,
+ PyObject * args )
+{
+ return EXPP_setterWrapper( (void *)self, args,
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list