55
64
#define PY_SKYDOME 1
59
extern void schrijfplaatje(char *name);
60
extern void waitcursor(int);
62
//---------------------------------------Render prototypes-------------
63
static PyObject *M_Render_CloseRenderWindow( PyObject * self );
64
static PyObject *M_Render_EnableDispView( PyObject * self );
65
static PyObject *M_Render_EnableDispWin( PyObject * self );
66
static PyObject *M_Render_SetRenderWinPos( PyObject * self, PyObject * args );
67
static PyObject *M_Render_EnableEdgeShift( PyObject * self, PyObject * args );
68
static PyObject *M_Render_EnableEdgeAll( PyObject * self, PyObject * args );
69
//----------------------------------------------Render doc strings------
68
EXPP_RENDER_ATTR_XPARTS = 0,
69
EXPP_RENDER_ATTR_YPARTS,
70
EXPP_RENDER_ATTR_ASPECTX,
71
EXPP_RENDER_ATTR_ASPECTY,
72
EXPP_RENDER_ATTR_CFRAME,
73
EXPP_RENDER_ATTR_SFRAME,
74
EXPP_RENDER_ATTR_EFRAME,
76
EXPP_RENDER_ATTR_SIZEX,
77
EXPP_RENDER_ATTR_SIZEY,
78
EXPP_RENDER_ATTR_GAUSSFILTER,
79
EXPP_RENDER_ATTR_MBLURFACTOR,
82
#define EXPP_RENDER_ATTR_CFRA 2
83
#define EXPP_RENDER_ATTR_ANTISHIFT 3
84
#define EXPP_RENDER_ATTR_EDGEINT 4
85
#define EXPP_RENDER_ATTR_EFRA 5
86
#define EXPP_RENDER_ATTR_QUALITY 11
87
#define EXPP_RENDER_ATTR_GAUSS 13
88
#define EXPP_RENDER_ATTR_BLURFAC 14
89
#define EXPP_RENDER_ATTR_POSTADD 15
90
#define EXPP_RENDER_ATTR_POSTGAMMA 16
91
#define EXPP_RENDER_ATTR_POSTMUL 17
92
#define EXPP_RENDER_ATTR_POSTHUE 18
93
#define EXPP_RENDER_ATTR_POSTSAT 19
94
#define EXPP_RENDER_ATTR_YF_EXPOSURE 20
95
#define EXPP_RENDER_ATTR_YF_GAMMA 21
96
#define EXPP_RENDER_ATTR_YF_GIDEPTH 22
97
#define EXPP_RENDER_ATTR_YF_GICDEPTH 23
98
#define EXPP_RENDER_ATTR_YF_GIPHOTONCOUNT 24
99
#define EXPP_RENDER_ATTR_YF_GIPHOTONMIXCOUNT 25
100
#define EXPP_RENDER_ATTR_YF_GIPHOTONRADIUS 26
101
#define EXPP_RENDER_ATTR_YF_GIPIXPERSAMPLE 27
102
#define EXPP_RENDER_ATTR_YF_GIPOWER 28
103
#define EXPP_RENDER_ATTR_YF_GIREFINE 29
104
#define EXPP_RENDER_ATTR_YF_GISHADOWQUAL 30
105
#define EXPP_RENDER_ATTR_YF_RAYBIAS 31
106
#define EXPP_RENDER_ATTR_YF_PROCCOUNT 32
107
#define EXPP_RENDER_ATTR_YF_RAYDEPTH 33
108
#define EXPP_RENDER_ATTR_YF_GIMETHOD 34
109
#define EXPP_RENDER_ATTR_YF_GIQUALITY 35
111
extern void save_rendered_image_cb_real(char *name, int zbuf, int confirm);
113
/* Render doc strings */
70
114
static char M_Render_doc[] = "The Blender Render module";
71
//----------------------------------------------Render method def-------
72
struct PyMethodDef M_Render_methods[] = {
73
{"CloseRenderWindow", ( PyCFunction ) M_Render_CloseRenderWindow,
75
"() - close the rendering window\n"},
76
{"EnableDispView", ( PyCFunction ) M_Render_EnableDispView,
78
"(bool) - enable Sceneing in view\n"},
79
{"EnableDispWin", ( PyCFunction ) M_Render_EnableDispWin, METH_NOARGS,
80
"(bool) - enable Sceneing in new window\n"},
81
{"SetRenderWinPos", ( PyCFunction ) M_Render_SetRenderWinPos,
83
"([string list]) - position the rendering window in around the edge of the screen\n"},
84
{"EnableEdgeShift", ( PyCFunction ) M_Render_EnableEdgeShift,
86
"(bool) - with the unified renderer the outlines are shifted a bit.\n"},
87
{"EnableEdgeAll", ( PyCFunction ) M_Render_EnableEdgeAll, METH_VARARGS,
88
"(bool) - also consider transparent faces for edge-rendering with the unified renderer\n"},
91
//------------------------------------BPy_RenderData methods/callbacks--
116
/* deprecated callbacks */
117
static PyObject *RenderData_SetRenderPath( BPy_RenderData *self,
119
static PyObject *RenderData_SetBackbufPath( BPy_RenderData *self,
121
static PyObject *RenderData_SetFtypePath( BPy_RenderData *self,
123
static PyObject *RenderData_SetOversamplingLevel( BPy_RenderData * self,
125
static PyObject *RenderData_SetRenderWinSize( BPy_RenderData * self,
127
static PyObject *RenderData_SetBorder( BPy_RenderData * self,
129
static PyObject *RenderData_SetRenderer( BPy_RenderData * self,
131
static PyObject *RenderData_SetImageType( BPy_RenderData * self,
92
133
static PyObject *RenderData_Render( BPy_RenderData * self );
93
static PyObject *RenderData_SaveRenderedImage( BPy_RenderData *self, PyObject *args);
94
static PyObject *RenderData_RenderAnim( BPy_RenderData * self );
95
static PyObject *RenderData_Play( BPy_RenderData * self );
96
static PyObject *RenderData_SetRenderPath( BPy_RenderData * self,
98
static PyObject *RenderData_GetRenderPath( BPy_RenderData * self );
99
static PyObject *RenderData_SetBackbufPath( BPy_RenderData * self,
101
static PyObject *RenderData_GetBackbufPath( BPy_RenderData * self );
102
static PyObject *RenderData_EnableBackbuf( BPy_RenderData * self,
104
static PyObject *RenderData_SetFtypePath( BPy_RenderData * self,
106
static PyObject *RenderData_GetFtypePath( BPy_RenderData * self );
107
static PyObject *RenderData_EnableExtensions( BPy_RenderData * self,
109
static PyObject *RenderData_EnableSequencer( BPy_RenderData * self,
111
static PyObject *RenderData_EnableRenderDaemon( BPy_RenderData * self,
113
static PyObject *RenderData_EnableToonShading( BPy_RenderData * self,
115
static PyObject *RenderData_EdgeIntensity( BPy_RenderData * self,
117
static PyObject *RenderData_SetEdgeColor( BPy_RenderData * self,
119
static PyObject *RenderData_GetEdgeColor( BPy_RenderData * self );
120
static PyObject *RenderData_EdgeAntiShift( BPy_RenderData * self,
122
static PyObject *RenderData_EnableOversampling( BPy_RenderData * self,
124
static PyObject *RenderData_SetOversamplingLevel( BPy_RenderData * self,
126
static PyObject *RenderData_EnableMotionBlur( BPy_RenderData * self,
128
static PyObject *RenderData_MotionBlurLevel( BPy_RenderData * self,
130
static PyObject *RenderData_PartsX( BPy_RenderData * self, PyObject * args );
131
static PyObject *RenderData_PartsY( BPy_RenderData * self, PyObject * args );
132
static PyObject *RenderData_EnableSky( BPy_RenderData * self );
133
static PyObject *RenderData_EnablePremultiply( BPy_RenderData * self );
134
static PyObject *RenderData_EnableKey( BPy_RenderData * self );
135
static PyObject *RenderData_EnableShadow( BPy_RenderData * self,
137
static PyObject *RenderData_EnablePanorama( BPy_RenderData * self,
139
static PyObject *RenderData_EnableEnvironmentMap( BPy_RenderData * self,
141
static PyObject *RenderData_EnableRayTracing( BPy_RenderData * self,
143
static PyObject *RenderData_EnableRadiosityRender( BPy_RenderData * self,
145
static PyObject *RenderData_SetRenderWinSize( BPy_RenderData * self,
147
static PyObject *RenderData_EnableFieldRendering( BPy_RenderData * self,
149
static PyObject *RenderData_EnableOddFieldFirst( BPy_RenderData * self,
151
static PyObject *RenderData_EnableFieldTimeDisable( BPy_RenderData * self,
153
static PyObject *RenderData_EnableGaussFilter( BPy_RenderData * self,
155
static PyObject *RenderData_EnableBorderRender( BPy_RenderData * self,
157
static PyObject *RenderData_SetBorder( BPy_RenderData * self,
159
static PyObject *RenderData_EnableGammaCorrection( BPy_RenderData * self,
161
static PyObject *RenderData_GaussFilterSize( BPy_RenderData * self,
163
static PyObject *RenderData_StartFrame( BPy_RenderData * self,
165
static PyObject *RenderData_CurrentFrame( BPy_RenderData * self,
167
static PyObject *RenderData_EndFrame( BPy_RenderData * self, PyObject * args );
168
static PyObject *RenderData_ImageSizeX( BPy_RenderData * self,
170
static PyObject *RenderData_ImageSizeY( BPy_RenderData * self,
172
static PyObject *RenderData_AspectRatioX( BPy_RenderData * self,
174
static PyObject *RenderData_AspectRatioY( BPy_RenderData * self,
176
static PyObject *RenderData_SetRenderer( BPy_RenderData * self,
178
static PyObject *RenderData_EnableCropping( BPy_RenderData * self,
180
static PyObject *RenderData_SetImageType( BPy_RenderData * self,
182
static PyObject *RenderData_Quality( BPy_RenderData * self, PyObject * args );
183
static PyObject *RenderData_FramesPerSec( BPy_RenderData * self,
185
static PyObject *RenderData_EnableGrayscale( BPy_RenderData * self );
186
static PyObject *RenderData_EnableRGBColor( BPy_RenderData * self );
187
static PyObject *RenderData_EnableRGBAColor( BPy_RenderData * self );
188
static PyObject *RenderData_SizePreset( BPy_RenderData * self,
190
static PyObject *RenderData_EnableUnifiedRenderer( BPy_RenderData * self,
192
static PyObject *RenderData_SetYafrayGIQuality( BPy_RenderData * self,
194
static PyObject *RenderData_SetYafrayGIMethod( BPy_RenderData * self,
196
static PyObject *RenderData_YafrayGIPower( BPy_RenderData * self,
198
static PyObject *RenderData_YafrayGIDepth( BPy_RenderData * self,
200
static PyObject *RenderData_YafrayGICDepth( BPy_RenderData * self,
202
static PyObject *RenderData_EnableYafrayGICache( BPy_RenderData * self,
204
static PyObject *RenderData_EnableYafrayGIPhotons( BPy_RenderData * self,
206
static PyObject *RenderData_YafrayGIPhotonCount( BPy_RenderData * self,
208
static PyObject *RenderData_YafrayGIPhotonRadius( BPy_RenderData * self,
210
static PyObject *RenderData_YafrayGIPhotonMixCount( BPy_RenderData * self,
212
static PyObject *RenderData_EnableYafrayGITunePhotons( BPy_RenderData * self,
214
static PyObject *RenderData_YafrayGIShadowQuality( BPy_RenderData * self,
216
static PyObject *RenderData_YafrayGIPixelsPerSample( BPy_RenderData * self,
218
static PyObject *RenderData_YafrayGIRefinement( BPy_RenderData * self,
220
static PyObject *RenderData_YafrayRayBias( BPy_RenderData * self,
222
static PyObject *RenderData_YafrayRayDepth( BPy_RenderData * self,
224
static PyObject *RenderData_YafrayGamma( BPy_RenderData * self,
226
static PyObject *RenderData_YafrayExposure( BPy_RenderData * self,
228
static PyObject *RenderData_YafrayProcessorCount( BPy_RenderData * self,
230
static PyObject *RenderData_EnableGameFrameStretch( BPy_RenderData * self );
231
static PyObject *RenderData_EnableGameFrameExpose( BPy_RenderData * self );
232
static PyObject *RenderData_EnableGameFrameBars( BPy_RenderData * self );
233
static PyObject *RenderData_SetGameFrameColor( BPy_RenderData * self,
235
static PyObject *RenderData_GetGameFrameColor( BPy_RenderData * self );
236
static PyObject *RenderData_GammaLevel( BPy_RenderData * self,
238
static PyObject *RenderData_PostProcessAdd( BPy_RenderData * self,
240
static PyObject *RenderData_PostProcessMultiply( BPy_RenderData * self,
242
static PyObject *RenderData_PostProcessGamma( BPy_RenderData * self,
244
static PyObject *RenderData_SGIMaxsize( BPy_RenderData * self,
246
static PyObject *RenderData_EnableSGICosmo( BPy_RenderData * self,
248
static PyObject *RenderData_OldMapValue( BPy_RenderData * self,
250
static PyObject *RenderData_NewMapValue( BPy_RenderData * self,
253
static PyObject *RenderData_getTimeCode( BPy_RenderData * self);
255
static void RenderData_dealloc( BPy_RenderData * self );
256
static PyObject *RenderData_getAttr( BPy_RenderData * self, char *name );
257
static PyObject *RenderData_repr( BPy_RenderData * self );
258
//------------------------------------BPy_RenderData method def--------
259
static PyMethodDef BPy_RenderData_methods[] = {
260
{"render", ( PyCFunction ) RenderData_Render, METH_NOARGS,
261
"() - render the scene\n"},
262
{"saveRenderedImage", (PyCFunction)RenderData_SaveRenderedImage, METH_VARARGS,
263
"(filename) - save an image generated by a call to render() (set output path first)\n"},
264
{"renderAnim", ( PyCFunction ) RenderData_RenderAnim, METH_NOARGS,
265
"() - render a sequence from start frame to end frame\n"},
266
{"play", ( PyCFunction ) RenderData_Play, METH_NOARGS,
267
"() - play animation of rendered images/avi (searches Pics: field)\n"},
268
{"setRenderPath", ( PyCFunction ) RenderData_SetRenderPath,
270
"(string) - get/set the path to output the rendered images to\n"},
271
{"getRenderPath", ( PyCFunction ) RenderData_GetRenderPath,
273
"() - get the path to directory where rendered images will go\n"},
274
{"setBackbufPath", ( PyCFunction ) RenderData_SetBackbufPath,
276
"(string) - get/set the path to a background image and load it\n"},
277
{"getBackbufPath", ( PyCFunction ) RenderData_GetBackbufPath,
279
"() - get the path to background image file\n"},
280
{"enableBackbuf", ( PyCFunction ) RenderData_EnableBackbuf,
282
"(bool) - enable/disable the backbuf image\n"},
283
{"setFtypePath", ( PyCFunction ) RenderData_SetFtypePath, METH_VARARGS,
284
"(string) - get/set the path to output the Ftype file\n"},
285
{"getFtypePath", ( PyCFunction ) RenderData_GetFtypePath, METH_NOARGS,
286
"() - get the path to Ftype file\n"},
287
{"enableExtensions", ( PyCFunction ) RenderData_EnableExtensions,
289
"(bool) - enable/disable windows extensions for output files\n"},
290
{"enableSequencer", ( PyCFunction ) RenderData_EnableSequencer,
292
"(bool) - enable/disable Do Sequence\n"},
293
{"enableRenderDaemon", ( PyCFunction ) RenderData_EnableRenderDaemon,
295
"(bool) - enable/disable Scene daemon\n"},
296
{"enableToonShading", ( PyCFunction ) RenderData_EnableToonShading,
298
"(bool) - enable/disable Edge rendering\n"},
299
{"edgeIntensity", ( PyCFunction ) RenderData_EdgeIntensity,
301
"(int) - get/set edge intensity for toon shading\n"},
302
{"setEdgeColor", ( PyCFunction ) RenderData_SetEdgeColor, METH_VARARGS,
303
"(f,f,f) - set the edge color for toon shading - Red,Green,Blue expected.\n"},
304
{"getEdgeColor", ( PyCFunction ) RenderData_GetEdgeColor, METH_NOARGS,
305
"() - get the edge color for toon shading - Red,Green,Blue expected.\n"},
306
{"edgeAntiShift", ( PyCFunction ) RenderData_EdgeAntiShift,
308
"(int) - with the unified renderer to reduce intensity on boundaries.\n"},
309
{"enableOversampling", ( PyCFunction ) RenderData_EnableOversampling,
311
"(bool) - enable/disable oversampling (anit-aliasing).\n"},
312
{"setOversamplingLevel",
313
( PyCFunction ) RenderData_SetOversamplingLevel, METH_VARARGS,
314
"(enum) - get/set the level of oversampling (anit-aliasing).\n"},
315
{"enableMotionBlur", ( PyCFunction ) RenderData_EnableMotionBlur,
317
"(bool) - enable/disable MBlur.\n"},
318
{"motionBlurLevel", ( PyCFunction ) RenderData_MotionBlurLevel,
320
"(float) - get/set the length of shutter time for motion blur.\n"},
321
{"partsX", ( PyCFunction ) RenderData_PartsX, METH_VARARGS,
322
"(int) - get/set the number of parts to divide the render in the X direction\n"},
323
{"partsY", ( PyCFunction ) RenderData_PartsY, METH_VARARGS,
324
"(int) - get/set the number of parts to divide the render in the Y direction\n"},
325
{"enableSky", ( PyCFunction ) RenderData_EnableSky, METH_NOARGS,
326
"() - enable render background with sky\n"},
327
{"enablePremultiply", ( PyCFunction ) RenderData_EnablePremultiply,
329
"() - enable premultiply alpha\n"},
330
{"enableKey", ( PyCFunction ) RenderData_EnableKey, METH_NOARGS,
331
"() - enable alpha and colour values remain unchanged\n"},
332
{"enableShadow", ( PyCFunction ) RenderData_EnableShadow, METH_VARARGS,
333
"(bool) - enable/disable shadow calculation\n"},
334
{"enablePanorama", ( PyCFunction ) RenderData_EnablePanorama,
336
"(bool) - enable/disable panorama rendering (output width is multiplied by Xparts)\n"},
337
{"enableEnvironmentMap",
338
( PyCFunction ) RenderData_EnableEnvironmentMap, METH_VARARGS,
339
"(bool) - enable/disable environment map rendering\n"},
340
{"enableRayTracing", ( PyCFunction ) RenderData_EnableRayTracing,
342
"(bool) - enable/disable ray tracing\n"},
343
{"enableRadiosityRender",
344
( PyCFunction ) RenderData_EnableRadiosityRender, METH_VARARGS,
345
"(bool) - enable/disable radiosity rendering\n"},
346
{"setRenderWinSize", ( PyCFunction ) RenderData_SetRenderWinSize,
348
"(enum) - get/set the size of the render window\n"},
349
{"enableFieldRendering",
350
( PyCFunction ) RenderData_EnableFieldRendering, METH_VARARGS,
351
"(bool) - enable/disable field rendering\n"},
352
{"enableOddFieldFirst", ( PyCFunction ) RenderData_EnableOddFieldFirst,
354
"(bool) - enable/disable Odd field first rendering (Default: Even field)\n"},
355
{"enableFieldTimeDisable",
356
( PyCFunction ) RenderData_EnableFieldTimeDisable, METH_VARARGS,
357
"(bool) - enable/disable time difference in field calculations\n"},
358
{"enableGaussFilter", ( PyCFunction ) RenderData_EnableGaussFilter,
360
"(bool) - enable/disable Gauss sampling filter for antialiasing\n"},
361
{"enableBorderRender", ( PyCFunction ) RenderData_EnableBorderRender,
363
"(bool) - enable/disable small cut-out rendering\n"},
364
{"setBorder", ( PyCFunction ) RenderData_SetBorder, METH_VARARGS,
365
"(f,f,f,f) - set the border for border rendering\n"},
366
{"enableGammaCorrection",
367
( PyCFunction ) RenderData_EnableGammaCorrection, METH_VARARGS,
368
"(bool) - enable/disable gamma correction\n"},
369
{"gaussFilterSize", ( PyCFunction ) RenderData_GaussFilterSize,
371
"(float) - get/sets the Gauss filter size\n"},
372
{"startFrame", ( PyCFunction ) RenderData_StartFrame, METH_VARARGS,
373
"(int) - get/set the starting frame for rendering\n"},
374
{"currentFrame", ( PyCFunction ) RenderData_CurrentFrame, METH_VARARGS,
375
"(int) - get/set the current frame for rendering\n"},
376
{"endFrame", ( PyCFunction ) RenderData_EndFrame, METH_VARARGS,
377
"(int) - get/set the ending frame for rendering\n"},
378
{"getTimeCode", ( PyCFunction ) RenderData_getTimeCode, METH_NOARGS,
379
"get the current frame in HH:MM:SS:FF format\n"},
380
{"imageSizeX", ( PyCFunction ) RenderData_ImageSizeX, METH_VARARGS,
381
"(int) - get/set the image width in pixels\n"},
382
{"imageSizeY", ( PyCFunction ) RenderData_ImageSizeY, METH_VARARGS,
383
"(int) - get/set the image height in pixels\n"},
384
{"aspectRatioX", ( PyCFunction ) RenderData_AspectRatioX, METH_VARARGS,
385
"(int) - get/set the horizontal aspect ratio\n"},
386
{"aspectRatioY", ( PyCFunction ) RenderData_AspectRatioY, METH_VARARGS,
387
"(int) - get/set the vertical aspect ratio\n"},
388
{"setRenderer", ( PyCFunction ) RenderData_SetRenderer, METH_VARARGS,
389
"(enum) - get/set which renderer to render the output\n"},
390
{"enableCropping", ( PyCFunction ) RenderData_EnableCropping,
392
"(bool) - enable/disable exclusion of border rendering from total image\n"},
393
{"setImageType", ( PyCFunction ) RenderData_SetImageType, METH_VARARGS,
394
"(enum) - get/set the type of image to output from the render\n"},
395
{"quality", ( PyCFunction ) RenderData_Quality, METH_VARARGS,
396
"(int) - get/set quality get/setting for JPEG images, AVI Jpeg and SGI movies\n"},
397
{"framesPerSec", ( PyCFunction ) RenderData_FramesPerSec, METH_VARARGS,
398
"(int) - get/set frames per second\n"},
399
{"enableGrayscale", ( PyCFunction ) RenderData_EnableGrayscale,
401
"() - images are saved with BW (grayscale) data\n"},
402
{"enableRGBColor", ( PyCFunction ) RenderData_EnableRGBColor,
404
"() - images are saved with RGB (color) data\n"},
405
{"enableRGBAColor", ( PyCFunction ) RenderData_EnableRGBAColor,
407
"() - images are saved with RGB and Alpha data (if supported)\n"},
408
{"sizePreset", ( PyCFunction ) RenderData_SizePreset, METH_VARARGS,
409
"(enum) - get/set the render to one of a few preget/sets\n"},
410
{"enableUnifiedRenderer",
411
( PyCFunction ) RenderData_EnableUnifiedRenderer, METH_VARARGS,
412
"(bool) - use the unified renderer\n"},
413
{"setYafrayGIQuality", ( PyCFunction ) RenderData_SetYafrayGIQuality,
415
"(enum) - get/set yafray global Illumination quality\n"},
416
{"setYafrayGIMethod", ( PyCFunction ) RenderData_SetYafrayGIMethod,
418
"(enum) - get/set yafray global Illumination method\n"},
419
{"yafrayGIPower", ( PyCFunction ) RenderData_YafrayGIPower,
421
"(float) - get/set GI lighting intensity scale\n"},
422
{"yafrayGIDepth", ( PyCFunction ) RenderData_YafrayGIDepth,
424
"(int) - get/set number of bounces of the indirect light\n"},
425
{"yafrayGICDepth", ( PyCFunction ) RenderData_YafrayGICDepth,
427
"(int) - get/set number of bounces inside objects (for caustics)\n"},
428
{"enableYafrayGICache", ( PyCFunction ) RenderData_EnableYafrayGICache,
430
"(bool) - enable/disable cache irradiance samples (faster)\n"},
431
{"enableYafrayGIPhotons",
432
( PyCFunction ) RenderData_EnableYafrayGIPhotons, METH_VARARGS,
433
"(bool) - enable/disable use global photons to help in GI\n"},
434
{"yafrayGIPhotonCount", ( PyCFunction ) RenderData_YafrayGIPhotonCount,
436
"(int) - get/set number of photons to shoot\n"},
437
{"yafrayGIPhotonRadius",
438
( PyCFunction ) RenderData_YafrayGIPhotonRadius, METH_VARARGS,
439
"(float) - get/set radius to search for photons to mix (blur)\n"},
440
{"yafrayGIPhotonMixCount",
441
( PyCFunction ) RenderData_YafrayGIPhotonMixCount, METH_VARARGS,
442
"(int) - get/set number of photons to shoot\n"},
443
{"enableYafrayGITunePhotons",
444
( PyCFunction ) RenderData_EnableYafrayGITunePhotons, METH_VARARGS,
445
"(bool) - enable/disable show the photonmap directly in the render for tuning\n"},
446
{"yafrayGIShadowQuality",
447
( PyCFunction ) RenderData_YafrayGIShadowQuality, METH_VARARGS,
448
"(float) - get/set the shadow quality, keep it under 0.95\n"},
449
{"yafrayGIPixelsPerSample",
450
( PyCFunction ) RenderData_YafrayGIPixelsPerSample, METH_VARARGS,
451
"(int) - get/set maximum number of pixels without samples, the lower the better and slower\n"},
452
{"yafrayGIRefinement", ( PyCFunction ) RenderData_YafrayGIRefinement,
454
"(float) - get/setthreshold to refine shadows EXPERIMENTAL. 1 = no refinement\n"},
455
{"yafrayRayBias", ( PyCFunction ) RenderData_YafrayRayBias,
457
"(float) - get/set shadow ray bias to avoid self shadowing\n"},
458
{"yafrayRayDepth", ( PyCFunction ) RenderData_YafrayRayDepth,
460
"(int) - get/set maximum render ray depth from the camera\n"},
461
{"yafrayGamma", ( PyCFunction ) RenderData_YafrayGamma, METH_VARARGS,
462
"(float) - get/set gamma correction, 1 is off\n"},
463
{"yafrayExposure", ( PyCFunction ) RenderData_YafrayExposure,
465
"(float) - get/set exposure adjustment, 0 is off\n"},
466
{"yafrayProcessorCount",
467
( PyCFunction ) RenderData_YafrayProcessorCount, METH_VARARGS,
468
"(int) - get/set number of processors to use\n"},
469
{"enableGameFrameStretch",
470
( PyCFunction ) RenderData_EnableGameFrameStretch, METH_NOARGS,
471
"(l) - enble stretch or squeeze the viewport to fill the display window\n"},
472
{"enableGameFrameExpose",
473
( PyCFunction ) RenderData_EnableGameFrameExpose, METH_NOARGS,
474
"(l) - enable show the entire viewport in the display window, viewing more horizontally or vertically\n"},
475
{"enableGameFrameBars", ( PyCFunction ) RenderData_EnableGameFrameBars,
477
"() - enable show the entire viewport in the display window, using bar horizontally or vertically\n"},
478
{"setGameFrameColor", ( PyCFunction ) RenderData_SetGameFrameColor,
480
"(f,f,f) - set the red, green, blue component of the bars\n"},
481
{"getGameFrameColor", ( PyCFunction ) RenderData_GetGameFrameColor,
483
"() - get the red, green, blue component of the bars\n"},
484
{"gammaLevel", ( PyCFunction ) RenderData_GammaLevel, METH_VARARGS,
485
"(float) - get/set the gamma value for blending oversampled images (1.0 = no correction\n"},
486
{"postProcessAdd", ( PyCFunction ) RenderData_PostProcessAdd,
488
"(float) - get/set post processing add\n"},
489
{"postProcessMultiply", ( PyCFunction ) RenderData_PostProcessMultiply,
491
"(float) - get/set post processing multiply\n"},
492
{"postProcessGamma", ( PyCFunction ) RenderData_PostProcessGamma,
494
"(float) - get/set post processing gamma\n"},
495
{"SGIMaxsize", ( PyCFunction ) RenderData_SGIMaxsize, METH_VARARGS,
496
"(int) - get/set maximum size per frame to save in an SGI movie\n"},
497
{"enableSGICosmo", ( PyCFunction ) RenderData_EnableSGICosmo,
499
"(bool) - enable/disable attempt to save SGI movies using Cosmo hardware\n"},
500
{"oldMapValue", ( PyCFunction ) RenderData_OldMapValue, METH_VARARGS,
501
"(int) - get/set specify old map value in frames\n"},
502
{"newMapValue", ( PyCFunction ) RenderData_NewMapValue, METH_VARARGS,
503
"(int) - get/set specify new map value in frames\n"},
504
{NULL, NULL, 0, NULL}
506
//------------------------------------BPy_RenderData Type defintion------
507
PyTypeObject RenderData_Type = {
508
PyObject_HEAD_INIT( NULL ) 0, /* ob_size */
509
"Blender RenderData", /* tp_name */
510
sizeof( BPy_RenderData ), /* tp_basicsize */
513
( destructor ) RenderData_dealloc, /* tp_dealloc */
515
( getattrfunc ) RenderData_getAttr, /* tp_getattr */
518
( reprfunc ) RenderData_repr, /* tp_repr */
519
0, /* tp_as_number */
520
0, /* tp_as_sequence */
521
0, /* tp_as_mapping */
526
BPy_RenderData_methods, /* tp_methods */
528
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
530
//---------------------------------------------------Render Module Init--
531
PyObject *Render_Init( void )
535
RenderData_Type.ob_type = &PyType_Type;
537
submodule = Py_InitModule3( "Blender.Scene.Render",
538
M_Render_methods, M_Render_doc );
540
PyModule_AddIntConstant( submodule, "INTERNAL", R_INTERN );
541
PyModule_AddIntConstant( submodule, "YAFRAY", R_YAFRAY );
542
PyModule_AddIntConstant( submodule, "AVIRAW", R_AVIRAW );
543
PyModule_AddIntConstant( submodule, "AVIJPEG", R_AVIJPEG );
544
PyModule_AddIntConstant( submodule, "AVICODEC", R_AVICODEC );
545
PyModule_AddIntConstant( submodule, "QUICKTIME", R_QUICKTIME );
546
PyModule_AddIntConstant( submodule, "TARGA", R_TARGA );
547
PyModule_AddIntConstant( submodule, "RAWTGA", R_RAWTGA );
548
PyModule_AddIntConstant( submodule, "HDR", R_RADHDR );
549
PyModule_AddIntConstant( submodule, "PNG", R_PNG );
550
PyModule_AddIntConstant( submodule, "BMP", R_BMP );
551
PyModule_AddIntConstant( submodule, "JPEG", R_JPEG90 );
552
PyModule_AddIntConstant( submodule, "HAMX", R_HAMX );
553
PyModule_AddIntConstant( submodule, "IRIS", R_IRIS );
554
PyModule_AddIntConstant( submodule, "IRISZ", R_IRIZ );
555
PyModule_AddIntConstant( submodule, "FTYPE", R_FTYPE );
556
PyModule_AddIntConstant( submodule, "PAL", B_PR_PAL );
557
PyModule_AddIntConstant( submodule, "NTSC", B_PR_NTSC );
558
PyModule_AddIntConstant( submodule, "DEFAULT", B_PR_PRESET );
559
PyModule_AddIntConstant( submodule, "PREVIEW", B_PR_PRV );
560
PyModule_AddIntConstant( submodule, "PC", B_PR_PC );
561
PyModule_AddIntConstant( submodule, "PAL169", B_PR_PAL169 );
562
PyModule_AddIntConstant( submodule, "PANO", B_PR_PANO );
563
PyModule_AddIntConstant( submodule, "FULL", B_PR_FULL );
564
PyModule_AddIntConstant( submodule, "NONE", PY_NONE );
565
PyModule_AddIntConstant( submodule, "LOW", PY_LOW );
566
PyModule_AddIntConstant( submodule, "MEDIUM", PY_MEDIUM );
567
PyModule_AddIntConstant( submodule, "HIGH", PY_HIGH );
568
PyModule_AddIntConstant( submodule, "HIGHER", PY_HIGHER );
569
PyModule_AddIntConstant( submodule, "BEST", PY_BEST );
570
PyModule_AddIntConstant( submodule, "SKYDOME", PY_SKYDOME );
571
PyModule_AddIntConstant( submodule, "GIFULL", PY_FULL );
573
return ( submodule );
576
//-----------------------------------BPy_RenderData Internal Protocols---
577
//-------------------------------------------------dealloc---------------
135
/* BPy_RenderData Internal Protocols */
578
137
static void RenderData_dealloc( BPy_RenderData * self )
580
139
PyObject_DEL( self );
583
//-------------------------------------------------getAttr---------------
584
static PyObject *RenderData_getAttr( BPy_RenderData * self, char *name )
586
return Py_FindMethod( BPy_RenderData_methods, ( PyObject * ) self,
590
//-------------------------------------------------repr------------------
591
142
static PyObject *RenderData_repr( BPy_RenderData * self )
593
144
if( self->renderContext )
2038
1397
"Unified Render must be enabled" ) );
2041
//------------------------------------RenderData.SGIMaxsize() ------------
2042
1401
PyObject *RenderData_SGIMaxsize( BPy_RenderData * self, PyObject * args )
2045
1403
return M_Render_GetSetAttributeShort( args,
2046
1404
&self->renderContext->maximsize,
2049
return ( EXPP_ReturnPyObjError( PyExc_StandardError,
2050
"SGI is not defined on this machine" ) );
2054
//------------------------------------RenderData.EnableSGICosmo() --------
2055
PyObject *RenderData_EnableSGICosmo( BPy_RenderData * self, PyObject * args )
1408
PyObject *RenderData_EnableSGICosmo( BPy_RenderData *self, PyObject *args )
2058
1410
return M_Render_BitToggleInt( args, R_COSMO,
2059
1411
&self->renderContext->mode );
2061
return ( EXPP_ReturnPyObjError( PyExc_StandardError,
2062
"SGI is not defined on this machine" ) );
1414
PyObject *RenderData_SGIMaxsize( void )
1416
return EXPP_ReturnPyObjError( PyExc_StandardError,
1417
"SGI is not defined on this machine" );
1420
PyObject *RenderData_EnableSGICosmo( void )
1422
return EXPP_ReturnPyObjError( PyExc_StandardError,
1423
"SGI is not defined on this machine" );
2066
//------------------------------------RenderData.OldMapValue() -----------
2067
1427
PyObject *RenderData_OldMapValue( BPy_RenderData * self, PyObject * args )
2069
PyObject *tmp = M_Render_GetSetAttributeShort(args,
1429
PyObject *tmp = M_Render_GetSetAttributeInt(args,
2070
1430
&self->renderContext->framapto, 1, 900);
2071
1431
self->renderContext->framelen =
2072
1432
(float)self->renderContext->framapto / self->renderContext->images;
2076
//------------------------------------RenderData.NewMapValue() -----------
2077
1436
PyObject *RenderData_NewMapValue( BPy_RenderData * self, PyObject * args )
2079
PyObject *tmp = M_Render_GetSetAttributeShort(args,
1438
PyObject *tmp = M_Render_GetSetAttributeInt(args,
2080
1439
&self->renderContext->images, 1, 900);
2081
1440
self->renderContext->framelen =
2082
1441
(float)self->renderContext->framapto / self->renderContext->images;
2086
//------------------------------------RenderData.getTimeCode() -----------
2087
PyObject *RenderData_getTimeCode( BPy_RenderData * self){
2088
PyObject *ret = NULL;
1445
static PyObject *RenderData_getTimeCode( BPy_RenderData * self) {
2090
char h[3],m[3],s[3],f[3];
2091
int hi,mi,si,fi,hold,fps,cfa;
1447
int h, m, s, fps, cfa;
2093
1449
fps = self->renderContext->frs_sec;
2094
1450
cfa = self->renderContext->cfra-1;
2097
hi = (cfa) / (fps*60*60);
2098
hold = (cfa) % (fps*60*60);
2099
mi = hold / (fps*60);
2100
hold = hold % (fps*60);
2104
ret = PyString_FromString("Time Greater than 99 Hours!");
2110
sprintf(h,"0%d",hi);
2114
sprintf(m,"0%d",mi);
2118
sprintf(s,"0%d",si);
2122
sprintf(f,"0%d",fi);
2123
sprintf(tc,"%s:%s:%s:%s",h,m,s,f);
2124
ret = PyString_FromString(tc);
1455
return PyString_FromString("Time Greater than 99 Hours!");
1457
sprintf( tc, "%02d:%02d:%02d:%02d", h%60, m%60, s%60, cfa%fps);
1458
return PyString_FromString(tc);
1461
/***************************************************************************/
1462
/* generic handlers for getting/setting attributes */
1463
/***************************************************************************/
1466
* get floating point attributes
1469
static PyObject *RenderData_getFloatAttr( BPy_RenderData *self, void *type )
1473
switch( (int)type ) {
1474
case EXPP_RENDER_ATTR_GAUSSFILTER:
1475
param = self->renderContext->gauss;
1477
case EXPP_RENDER_ATTR_MBLURFACTOR:
1478
param = self->renderContext->blurfac;
1481
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
1482
"undefined type constant in RenderData_getFloatAttr" );
1484
return PyFloat_FromDouble( param );
1488
* set floating point attributes which require clamping
1491
static int RenderData_setFloatAttrClamp( BPy_RenderData *self, PyObject *value,
1497
switch( (int)type ) {
1498
case EXPP_RENDER_ATTR_GAUSSFILTER:
1501
param = &self->renderContext->gauss;
1503
case EXPP_RENDER_ATTR_MBLURFACTOR:
1506
param = &self->renderContext->blurfac;
1509
return EXPP_ReturnIntError( PyExc_RuntimeError,
1510
"undefined type constant in RenderData_setFloatAttrClamp" );
1512
return EXPP_setFloatClamped( value, param, min, max );
1516
* get integer attributes
1519
static PyObject *RenderData_getIValueAttr( BPy_RenderData *self, void *type )
1523
switch( (int)type ) {
1524
case EXPP_RENDER_ATTR_XPARTS:
1525
param = (long)self->renderContext->xparts;
1527
case EXPP_RENDER_ATTR_YPARTS:
1528
param = (long)self->renderContext->yparts;
1530
case EXPP_RENDER_ATTR_ASPECTX:
1531
param = (long)self->renderContext->xasp;
1533
case EXPP_RENDER_ATTR_ASPECTY:
1534
param = (long)self->renderContext->yasp;
1536
case EXPP_RENDER_ATTR_CFRAME:
1537
param = (long)self->renderContext->cfra;
1539
case EXPP_RENDER_ATTR_EFRAME:
1540
param = (long)self->renderContext->efra;
1542
case EXPP_RENDER_ATTR_SFRAME:
1543
param = (long)self->renderContext->sfra;
1545
case EXPP_RENDER_ATTR_FPS:
1546
param = self->renderContext->frs_sec;
1548
case EXPP_RENDER_ATTR_SIZEX:
1549
param = self->renderContext->xsch;
1551
case EXPP_RENDER_ATTR_SIZEY:
1552
param = self->renderContext->ysch;
1555
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
1556
"undefined type constant in RenderData_setIValueAttrClamp" );
1558
return PyInt_FromLong( param );
1562
* set integer attributes which require clamping
1565
static int RenderData_setIValueAttrClamp( BPy_RenderData *self, PyObject *value,
1571
switch( (int)type ) {
1572
case EXPP_RENDER_ATTR_XPARTS:
1576
param = &self->renderContext->xparts;
1578
case EXPP_RENDER_ATTR_YPARTS:
1582
param = &self->renderContext->yparts;
1584
case EXPP_RENDER_ATTR_ASPECTX:
1588
param = &self->renderContext->xasp;
1590
case EXPP_RENDER_ATTR_ASPECTY:
1594
param = &self->renderContext->yasp;
1596
case EXPP_RENDER_ATTR_CFRAME:
1600
param = &self->renderContext->cfra;
1602
case EXPP_RENDER_ATTR_EFRAME:
1606
param = &self->renderContext->efra;
1608
case EXPP_RENDER_ATTR_SFRAME:
1612
param = &self->renderContext->sfra;
1614
case EXPP_RENDER_ATTR_FPS:
1618
param = &self->renderContext->frs_sec;
1620
case EXPP_RENDER_ATTR_SIZEX:
1624
param = &self->renderContext->xsch;
1626
case EXPP_RENDER_ATTR_SIZEY:
1630
param = &self->renderContext->ysch;
1633
return EXPP_ReturnIntError( PyExc_RuntimeError,
1634
"undefined type constant in RenderData_setIValueAttrClamp" );
1636
return EXPP_setIValueClamped( value, param, min, max, size );
1639
/***************************************************************************/
1640
/* handlers for other getting/setting attributes */
1641
/***************************************************************************/
1643
static PyObject *RenderData_getModeBit( BPy_RenderData *self, void* type )
1645
return EXPP_getBitfield( &self->renderContext->mode,
1649
static int RenderData_setModeBit( BPy_RenderData* self, PyObject *value,
1652
return EXPP_setBitfield( value, &self->renderContext->mode,
1656
#define MODE_MASK ( R_OSA | R_SHADOW | R_GAMMA | R_ENVMAP | R_EDGE | \
1657
R_FIELDS | R_FIELDSTILL | R_RADIO | R_BORDER | R_PANORAMA | R_CROP | \
1658
R_ODDFIELD | R_MBLUR | R_UNIFIED | R_RAYTRACE | R_THREADS )
1660
static PyObject *RenderData_getMode( BPy_RenderData *self )
1662
return PyInt_FromLong( (long)(self->renderContext->mode & MODE_MASK) );
1665
static int RenderData_setMode( BPy_RenderData* self, PyObject *arg )
1669
if( !PyInt_CheckExact( arg ) )
1670
return EXPP_ReturnIntError( PyExc_TypeError,
1671
"expected int argument" );
1673
value = PyInt_AsLong( arg );
1674
if( value & ~MODE_MASK )
1675
return EXPP_ReturnIntError( PyExc_ValueError,
1676
"unexpected bits set in argument" );
1678
self->renderContext->mode = (short)value;
1679
EXPP_allqueue( REDRAWBUTSSCENE, 0 );
1684
static PyObject *RenderData_getSceModeBits( BPy_RenderData *self, void* type )
1686
return EXPP_getBitfield( &self->renderContext->scemode, (int)type, 'h' );
1689
static int RenderData_setSceModeBits( BPy_RenderData* self, PyObject *value,
1692
return EXPP_setBitfield( value, &self->renderContext->scemode,
1696
static PyObject *RenderData_getSceMode( BPy_RenderData *self )
1698
return PyInt_FromLong ( (long)self->renderContext->scemode );
1701
static int RenderData_setSceMode( BPy_RenderData* self, PyObject *arg )
1705
if( !PyInt_CheckExact( arg ) )
1706
return EXPP_ReturnIntError( PyExc_TypeError,
1707
"expected int argument" );
1709
value = PyInt_AsLong( arg );
1710
if( value & ~( R_EXTENSION | R_DOSEQ ) )
1711
return EXPP_ReturnIntError( PyExc_ValueError,
1712
"unexpected bits set in argument" );
1714
self->renderContext->scemode = (short)value;
1715
EXPP_allqueue( REDRAWBUTSSCENE, 0 );
1720
static PyObject *RenderData_getFramingType( BPy_RenderData *self )
1722
return PyInt_FromLong( (long)self->scene->framing.type );
1725
static int RenderData_setFramingType( BPy_RenderData *self, PyObject *value )
1727
return EXPP_setIValueRange( value, &self->scene->framing.type,
1728
SCE_GAMEFRAMING_BARS, SCE_GAMEFRAMING_SCALE, 'b' );
1731
static PyObject *RenderData_getEdgeColor( BPy_RenderData * self )
1733
return Py_BuildValue( "[fff]", self->renderContext->edgeR,
1734
self->renderContext->edgeG, self->renderContext->edgeB );
1737
static int RenderData_setEdgeColor( BPy_RenderData * self, PyObject * args )
1739
float red, green, blue;
1741
/* if we get a list, convert to a tuple; otherwise hope for the best */
1742
if( PyList_Check( args ) )
1743
args = PySequence_Tuple( args );
1747
if( !PyArg_ParseTuple( args, "fff", &red, &green, &blue ) ) {
1749
return EXPP_ReturnIntError( PyExc_TypeError, "expected three floats" );
1753
self->renderContext->edgeR = EXPP_ClampFloat( red, 0.0, 1.0 );
1754
self->renderContext->edgeG = EXPP_ClampFloat( green, 0.0, 1.0 );
1755
self->renderContext->edgeB = EXPP_ClampFloat( blue, 0.0, 1.0 );
1759
static PyObject *RenderData_getOSALevel( BPy_RenderData * self )
1761
return PyInt_FromLong( (long)self->renderContext->osa );
1764
static PyObject *RenderData_getRenderer( BPy_RenderData * self )
1766
return PyInt_FromLong( (long)self->renderContext->renderer );
1769
static PyObject *RenderData_getImageType( BPy_RenderData * self )
1771
return PyInt_FromLong( (long) self->renderContext->imtype );
1774
static int RenderData_setGameFrameColor( BPy_RenderData * self,
1777
float red, green, blue;
1779
/* if we get a list, convert to a tuple; otherwise hope for the best */
1780
if( PyList_Check( args ) )
1781
args = PySequence_Tuple( args );
1785
if( !PyArg_ParseTuple( args, "fff", &red, &green, &blue ) ) {
1787
return EXPP_ReturnIntError( PyExc_TypeError, "expected three floats" );
1791
self->scene->framing.col[0] = EXPP_ClampFloat( red, 0.0, 1.0 );
1792
self->scene->framing.col[1] = EXPP_ClampFloat( green, 0.0, 1.0 );
1793
self->scene->framing.col[2] = EXPP_ClampFloat( blue, 0.0, 1.0 );
1797
static PyObject *RenderData_getGameFrameColor( BPy_RenderData * self )
1799
return Py_BuildValue( "[fff]", self->scene->framing.col[0],
1800
self->scene->framing.col[1], self->scene->framing.col[2] );
1803
static PyObject *RenderData_getBackbuf( BPy_RenderData * self )
1805
return EXPP_getBitfield( &self->renderContext->bufflag,
1809
static int RenderData_setBackbuf( BPy_RenderData* self, PyObject *value )
1811
return EXPP_setBitfield( value, &self->renderContext->bufflag,
1815
static int RenderData_setImagePlanes( BPy_RenderData *self, PyObject *value )
1818
char *errstr = "expected int argument of 8, 24, or 32";
1820
if( !PyInt_CheckExact( value ) )
1821
return EXPP_ReturnIntError( PyExc_TypeError, errstr );
1823
depth = PyInt_AsLong( value );
1824
if( depth != 8 && depth != 24 && depth != 32 )
1825
return EXPP_ReturnIntError( PyExc_ValueError, errstr );
1827
self->renderContext->planes = (short)depth;
1832
static PyObject *RenderData_getImagePlanes( BPy_RenderData * self )
1834
return PyInt_FromLong( (long) self->renderContext->planes );
1837
static int RenderData_setAlphaMode( BPy_RenderData *self, PyObject *value )
1839
return EXPP_setIValueRange( value, &self->renderContext->alphamode,
1840
R_ADDSKY, R_ALPHAKEY, 'h' );
1843
static PyObject *RenderData_getAlphaMode( BPy_RenderData * self )
1845
return PyInt_FromLong( (long) self->renderContext->alphamode );
1848
static PyObject *RenderData_getDisplayMode( void )
1850
return PyInt_FromLong( (long) G.displaymode );
1853
static int RenderData_setDisplayMode( BPy_RenderData *self,
1856
return EXPP_setIValueRange( value, &G.displaymode,
1857
R_DISPLAYIMAGE, R_DISPLAYSCREEN, 'h' );
1860
static PyObject *RenderData_getRenderPath( BPy_RenderData * self )
1862
return PyString_FromString( self->renderContext->pic );
1865
static int RenderData_setRenderPath( BPy_RenderData * self, PyObject * value )
1869
name = PyString_AsString( value );
1871
return EXPP_ReturnIntError( PyExc_TypeError,
1872
"expected a string" );
1874
if( strlen( name ) >= sizeof(self->renderContext->pic) )
1875
return EXPP_ReturnIntError( PyExc_ValueError,
1876
"render path is too long" );
1878
strcpy( self->renderContext->pic, name );
1879
EXPP_allqueue( REDRAWBUTSSCENE, 0 );
1884
PyObject *RenderData_getBackbufPath( BPy_RenderData * self )
1886
return PyString_FromString( self->renderContext->backbuf );
1889
static int RenderData_setBackbufPath( BPy_RenderData *self, PyObject *value )
1894
name = PyString_AsString( value );
1896
return EXPP_ReturnIntError( PyExc_TypeError, "expected a string" );
1898
if( strlen( name ) >= sizeof(self->renderContext->backbuf) )
1899
return EXPP_ReturnIntError( PyExc_ValueError,
1900
"backbuf path is too long" );
1902
strcpy( self->renderContext->backbuf, name );
1903
EXPP_allqueue( REDRAWBUTSSCENE, 0 );
1905
ima = add_image( name );
1907
free_image_buffers( ima );
1914
PyObject *RenderData_getFtypePath( BPy_RenderData * self )
1916
return PyString_FromString( self->renderContext->ftype );
1919
static int RenderData_setFtypePath( BPy_RenderData *self, PyObject *value )
1923
name = PyString_AsString( value );
1925
return EXPP_ReturnIntError( PyExc_TypeError, "expected a string" );
1927
if( strlen( name ) >= sizeof(self->renderContext->ftype) )
1928
return EXPP_ReturnIntError( PyExc_ValueError,
1929
"ftype path is too long" );
1931
strcpy( self->renderContext->ftype, name );
1932
EXPP_allqueue( REDRAWBUTSSCENE, 0 );
1937
PyObject *RenderData_getRenderWinSize( BPy_RenderData * self )
1939
return PyInt_FromLong( (long) self->renderContext->size );
1942
static int RenderData_setRenderWinSize( BPy_RenderData *self, PyObject *value )
1945
char *errstr = "expected int argument of 25, 50, 75, or 100";
1947
if( !PyInt_CheckExact( value ) )
1948
return EXPP_ReturnIntError( PyExc_TypeError, errstr );
1950
size = PyInt_AsLong( value );
1951
if( size != 25 && size != 50 && size != 75 && size != 100 )
1952
return EXPP_ReturnIntError( PyExc_ValueError, errstr );
1954
self->renderContext->size = (short)size;
1955
EXPP_allqueue( REDRAWBUTSSCENE, 0 );
1960
static PyObject *RenderData_getMapOld( BPy_RenderData *self )
1962
return PyInt_FromLong( (long)self->renderContext->framapto );
1965
static int RenderData_setMapOld( BPy_RenderData *self, PyObject *value )
1967
int result = EXPP_setIValueClamped( value, &self->renderContext->framapto,
1969
self->renderContext->framelen =
1970
(float)self->renderContext->framapto / self->renderContext->images;
1974
static PyObject *RenderData_getMapNew( BPy_RenderData *self )
1976
return PyInt_FromLong( (long)self->renderContext->images );
1979
static int RenderData_setMapNew( BPy_RenderData *self, PyObject *value )
1981
int result = EXPP_setIValueClamped( value, &self->renderContext->images,
1983
self->renderContext->framelen =
1984
(float)self->renderContext->framapto / self->renderContext->images;
1988
static PyObject *RenderData_getSet( BPy_RenderData *self )
1990
if( self->scene->set )
1991
return Scene_CreatePyObject( self->scene->set );
1995
static int RenderData_setSet( BPy_RenderData *self, PyObject *value )
1999
/* if "None", delete the link to the scene */
2000
if( value == Py_None ) {
2001
self->scene->set = NULL;
2005
/* be sure argument is a Scene */
2006
if( !BPy_Scene_Check( value ) )
2007
return EXPP_ReturnIntError( PyExc_TypeError,
2008
"expected Scene as argument" );
2010
/* check for attempt to link to ourselves */
2011
sc = (BPy_Scene *)value;
2012
if( self->scene == sc->scene )
2013
return EXPP_ReturnIntError( PyExc_ValueError,
2014
"cannot link a scene to itself" );
2017
* Accept the set link, then check for a circular link. If circular link
2018
* exists, scene_check_setscene() sets self->scene->set to NULL.
2021
self->scene->set = sc->scene;
2022
if( !scene_check_setscene( self->scene ) )
2023
return EXPP_ReturnIntError( PyExc_ValueError,
2024
"linking scene would create a cycle" );
2029
/***************************************************************************/
2030
/* BPy_RenderData attribute def */
2031
/***************************************************************************/
2032
static PyGetSetDef BPy_RenderData_getseters[] = {
2034
(getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
2035
"Oversampling (anti-aliasing) enabled",
2038
(getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
2039
"Shadow calculation enabled",
2042
(getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
2043
"Gamma correction enabled",
2045
/* R_ORTHO unused */
2047
(getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
2048
"Environment map rendering enabled",
2051
(getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
2052
"Toon edge shading enabled",
2055
(getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
2056
"Field rendering enabled",
2058
{"fieldTimeDisable",
2059
(getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
2060
"Time difference in field calculations disabled ('X' in UI)",
2061
(void *)R_FIELDSTILL},
2063
(getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
2064
"Radiosity rendering enabled",
2067
(getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
2068
"Small cut-out rendering enabled",
2071
(getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
2072
"Panorama rendering enabled",
2073
(void *)R_PANORAMA},
2075
(getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
2076
"Crop image during border renders",
2078
/* R_COSMO unsupported */
2080
(getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
2081
"Odd field first rendering enabled",
2082
(void *)R_ODDFIELD},
2084
(getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
2085
"Motion blur enabled",
2088
(getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
2089
"Unified Renderer enabled",
2092
(getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
2093
"Ray tracing enabled",
2094
(void *)R_RAYTRACE},
2095
/* R_GAUSS unused */
2098
(getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
2099
"Render in two threads enabled",
2101
/* R_SPEED unused */
2103
(getter)RenderData_getMode, (setter)RenderData_setMode,
2108
(getter)RenderData_getSceModeBits, (setter)RenderData_setSceModeBits,
2109
"Add extensions to output (when rendering animations) enabled",
2110
(void *)R_EXTENSION},
2112
(getter)RenderData_getSceModeBits, (setter)RenderData_setSceModeBits,
2113
"'Do Sequence' enabled",
2116
(getter)RenderData_getSceMode, (setter)RenderData_setSceMode,
2117
"Scene mode bitfield",
2119
/* R_BG_RENDER unused */
2122
(getter)RenderData_getFramingType, (setter)RenderData_setFramingType,
2123
"Game framing type",
2127
(getter)RenderData_getRenderPath, (setter)RenderData_setRenderPath,
2128
"The path to output the rendered images to",
2131
(getter)RenderData_getBackbufPath, (setter)RenderData_setBackbufPath,
2132
"Path to a background image (setting loads image)",
2135
(getter)RenderData_getFtypePath, (setter)RenderData_setFtypePath,
2136
"The path to Ftype file",
2139
(getter)RenderData_getEdgeColor, (setter)RenderData_setEdgeColor,
2140
"RGB color triplet for edges in Toon shading (unified renderer)",
2143
(getter)RenderData_getOSALevel, (setter)RenderData_setOSALevel,
2144
"Oversampling (anti-aliasing) level",
2147
(getter)RenderData_getRenderWinSize, (setter)RenderData_setRenderWinSize,
2148
"Size of the rendering window (25, 50, 75, or 100)",
2151
(getter)RenderData_getBorder, (setter)RenderData_setBorder,
2152
"The border for border rendering",
2155
(getter)RenderData_getTimeCode, (setter)NULL,
2156
"Get the current frame in HH:MM:SS:FF format",
2159
(getter)RenderData_getRenderer, (setter)RenderData_setRenderer,
2160
"Rendering engine choice",
2163
(getter)RenderData_getImageType, (setter)RenderData_setImageType,
2164
"File format for saving images",
2167
(getter)RenderData_getGameFrameColor,(setter)RenderData_setGameFrameColor,
2168
"RGB color triplet for bars",
2171
(getter)RenderData_getBackbuf, (setter)RenderData_setBackbuf,
2172
"Backbuffer image enabled",
2175
(getter)RenderData_getImagePlanes, (setter)RenderData_setImagePlanes,
2176
"Image depth (8, 24, or 32 bits)",
2179
(getter)RenderData_getAlphaMode, (setter)RenderData_setAlphaMode,
2180
"Setting for sky/background.",
2183
(getter)RenderData_getDisplayMode, (setter)RenderData_setDisplayMode,
2184
"Render output in separate window or 3D view",
2188
(getter)RenderData_getIValueAttr, (setter)RenderData_setIValueAttrClamp,
2189
"Number of horizontal parts for image render",
2190
(void *)EXPP_RENDER_ATTR_XPARTS},
2192
(getter)RenderData_getIValueAttr, (setter)RenderData_setIValueAttrClamp,
2193
"Number of vertical parts for image render",
2194
(void *)EXPP_RENDER_ATTR_YPARTS},
2196
(getter)RenderData_getIValueAttr, (setter)RenderData_setIValueAttrClamp,
2197
"Horizontal aspect ratio",
2198
(void *)EXPP_RENDER_ATTR_ASPECTX},
2200
(getter)RenderData_getIValueAttr, (setter)RenderData_setIValueAttrClamp,
2201
"Vertical aspect ratio",
2202
(void *)EXPP_RENDER_ATTR_ASPECTY},
2204
(getter)RenderData_getIValueAttr, (setter)RenderData_setIValueAttrClamp,
2205
"The current frame for rendering",
2206
(void *)EXPP_RENDER_ATTR_CFRAME},
2208
(getter)RenderData_getIValueAttr, (setter)RenderData_setIValueAttrClamp,
2209
"Starting frame for rendering",
2210
(void *)EXPP_RENDER_ATTR_SFRAME},
2212
(getter)RenderData_getIValueAttr, (setter)RenderData_setIValueAttrClamp,
2213
"Ending frame for rendering",
2214
(void *)EXPP_RENDER_ATTR_EFRAME},
2216
(getter)RenderData_getIValueAttr, (setter)RenderData_setIValueAttrClamp,
2217
"Frames per second",
2218
(void *)EXPP_RENDER_ATTR_FPS},
2220
(getter)RenderData_getIValueAttr, (setter)RenderData_setIValueAttrClamp,
2221
"Image width (in pixels)",
2222
(void *)EXPP_RENDER_ATTR_SIZEX},
2224
(getter)RenderData_getIValueAttr, (setter)RenderData_setIValueAttrClamp,
2225
"Image height (in pixels)",
2226
(void *)EXPP_RENDER_ATTR_SIZEY},
2229
(getter)RenderData_getFloatAttr, (setter)RenderData_setFloatAttrClamp,
2230
"Gauss filter size",
2231
(void *)EXPP_RENDER_ATTR_GAUSSFILTER},
2233
(getter)RenderData_getFloatAttr, (setter)RenderData_setFloatAttrClamp,
2234
"Motion blur factor",
2235
(void *)EXPP_RENDER_ATTR_MBLURFACTOR},
2237
(getter)RenderData_getMapOld, (setter)RenderData_setMapOld,
2238
"Number of frames the Map Old will last",
2241
(getter)RenderData_getMapNew, (setter)RenderData_setMapNew,
2242
"New mapping value (in frames)",
2245
(getter)RenderData_getSet, (setter)RenderData_setSet,
2246
"Scene link 'set' value",
2248
{NULL,NULL,NULL,NULL,NULL}
2251
/***************************************************************************/
2252
/* BPy_RenderData method def */
2253
/***************************************************************************/
2254
static PyMethodDef BPy_RenderData_methods[] = {
2255
{"render", ( PyCFunction ) RenderData_Render, METH_NOARGS,
2256
"() - render the scene"},
2257
{"saveRenderedImage", (PyCFunction)RenderData_SaveRenderedImage, METH_VARARGS,
2258
"(filename) - save an image generated by a call to render() (set output path first)"},
2259
{"renderAnim", ( PyCFunction ) RenderData_RenderAnim, METH_NOARGS,
2260
"() - render a sequence from start frame to end frame"},
2261
{"play", ( PyCFunction ) RenderData_Play, METH_NOARGS,
2262
"() - play animation of rendered images/avi (searches Pics: field)"},
2263
{"setRenderPath", ( PyCFunction ) RenderData_SetRenderPath,
2265
"(string) - get/set the path to output the rendered images to"},
2266
{"getRenderPath", ( PyCFunction ) RenderData_getRenderPath,
2268
"() - get the path to directory where rendered images will go"},
2269
{"setBackbufPath", ( PyCFunction ) RenderData_SetBackbufPath,
2271
"(string) - get/set the path to a background image and load it"},
2272
{"getBackbufPath", ( PyCFunction ) RenderData_getBackbufPath,
2274
"() - get the path to background image file"},
2275
{"enableBackbuf", ( PyCFunction ) RenderData_EnableBackbuf,
2277
"(bool) - enable/disable the backbuf image"},
2278
{"enableThreads", ( PyCFunction ) RenderData_EnableThreads,
2280
"(bool) - enable/disable threaded rendering"},
2281
{"setFtypePath", ( PyCFunction ) RenderData_SetFtypePath, METH_VARARGS,
2282
"(string) - get/set the path to output the Ftype file"},
2283
{"getFtypePath", ( PyCFunction ) RenderData_getFtypePath, METH_NOARGS,
2284
"() - get the path to Ftype file"},
2285
{"enableExtensions", ( PyCFunction ) RenderData_EnableExtensions,
2287
"(bool) - enable/disable windows extensions for output files"},
2288
{"enableSequencer", ( PyCFunction ) RenderData_EnableSequencer,
2290
"(bool) - enable/disable Do Sequence"},
2291
{"enableRenderDaemon", ( PyCFunction ) RenderData_EnableRenderDaemon,
2293
"(bool) - enable/disable Scene daemon"},
2294
{"enableToonShading", ( PyCFunction ) RenderData_EnableToonShading,
2296
"(bool) - enable/disable Edge rendering"},
2297
{"edgeIntensity", ( PyCFunction ) RenderData_EdgeIntensity,
2299
"(int) - get/set edge intensity for toon shading"},
2300
{"setEdgeColor", ( PyCFunction ) RenderData_SetEdgeColor, METH_VARARGS,
2301
"(f,f,f) - set the edge color for toon shading - Red,Green,Blue expected."},
2302
{"getEdgeColor", ( PyCFunction ) RenderData_GetEdgeColor, METH_NOARGS,
2303
"() - get the edge color for toon shading - Red,Green,Blue expected."},
2304
{"edgeAntiShift", ( PyCFunction ) RenderData_EdgeAntiShift,
2306
"(int) - with the unified renderer to reduce intensity on boundaries."},
2307
{"enableOversampling", ( PyCFunction ) RenderData_EnableOversampling,
2309
"(bool) - enable/disable oversampling (anit-aliasing)."},
2310
{"setOversamplingLevel",
2311
( PyCFunction ) RenderData_SetOversamplingLevel, METH_VARARGS,
2312
"(enum) - get/set the level of oversampling (anit-aliasing)."},
2313
{"enableMotionBlur", ( PyCFunction ) RenderData_EnableMotionBlur,
2315
"(bool) - enable/disable MBlur."},
2316
{"motionBlurLevel", ( PyCFunction ) RenderData_MotionBlurLevel,
2318
"(float) - get/set the length of shutter time for motion blur."},
2319
{"partsX", ( PyCFunction ) RenderData_PartsX, METH_VARARGS,
2320
"(int) - get/set the number of parts to divide the render in the X direction"},
2321
{"partsY", ( PyCFunction ) RenderData_PartsY, METH_VARARGS,
2322
"(int) - get/set the number of parts to divide the render in the Y direction"},
2323
{"enableSky", ( PyCFunction ) RenderData_EnableSky, METH_NOARGS,
2324
"() - enable render background with sky"},
2325
{"enablePremultiply", ( PyCFunction ) RenderData_EnablePremultiply,
2327
"() - enable premultiply alpha"},
2328
{"enableKey", ( PyCFunction ) RenderData_EnableKey, METH_NOARGS,
2329
"() - enable alpha and colour values remain unchanged"},
2330
{"enableShadow", ( PyCFunction ) RenderData_EnableShadow, METH_VARARGS,
2331
"(bool) - enable/disable shadow calculation"},
2332
{"enablePanorama", ( PyCFunction ) RenderData_EnablePanorama,
2334
"(bool) - enable/disable panorama rendering (output width is multiplied by Xparts)"},
2335
{"enableEnvironmentMap",
2336
( PyCFunction ) RenderData_EnableEnvironmentMap, METH_VARARGS,
2337
"(bool) - enable/disable environment map rendering"},
2338
{"enableRayTracing", ( PyCFunction ) RenderData_EnableRayTracing,
2340
"(bool) - enable/disable ray tracing"},
2341
{"enableRadiosityRender",
2342
( PyCFunction ) RenderData_EnableRadiosityRender, METH_VARARGS,
2343
"(bool) - enable/disable radiosity rendering"},
2344
{"getRenderWinSize", ( PyCFunction ) RenderData_getRenderWinSize,
2346
"() - get the size of the render window"},
2347
{"setRenderWinSize", ( PyCFunction ) RenderData_SetRenderWinSize,
2349
"(int) - set the size of the render window"},
2350
{"enableFieldRendering",
2351
( PyCFunction ) RenderData_EnableFieldRendering, METH_VARARGS,
2352
"(bool) - enable/disable field rendering"},
2353
{"enableOddFieldFirst", ( PyCFunction ) RenderData_EnableOddFieldFirst,
2355
"(bool) - enable/disable Odd field first rendering (Default: Even field)"},
2356
{"enableFieldTimeDisable",
2357
( PyCFunction ) RenderData_EnableFieldTimeDisable, METH_VARARGS,
2358
"(bool) - enable/disable time difference in field calculations"},
2359
{"enableGaussFilter", ( PyCFunction ) RenderData_EnableGaussFilter,
2361
"(bool) - enable/disable Gauss sampling filter for antialiasing"},
2362
{"enableBorderRender", ( PyCFunction ) RenderData_EnableBorderRender,
2364
"(bool) - enable/disable small cut-out rendering"},
2365
{"setBorder", ( PyCFunction ) RenderData_SetBorder, METH_VARARGS,
2366
"(f,f,f,f) - set the border for border rendering"},
2367
{"enableGammaCorrection",
2368
( PyCFunction ) RenderData_EnableGammaCorrection, METH_VARARGS,
2369
"(bool) - enable/disable gamma correction"},
2370
{"gaussFilterSize", ( PyCFunction ) RenderData_GaussFilterSize,
2372
"(float) - get/sets the Gauss filter size"},
2373
{"startFrame", ( PyCFunction ) RenderData_StartFrame, METH_VARARGS,
2374
"(int) - get/set the starting frame for rendering"},
2375
{"currentFrame", ( PyCFunction ) RenderData_CurrentFrame, METH_VARARGS,
2376
"(int) - get/set the current frame for rendering"},
2377
{"endFrame", ( PyCFunction ) RenderData_EndFrame, METH_VARARGS,
2378
"(int) - get/set the ending frame for rendering"},
2379
{"getTimeCode", ( PyCFunction ) RenderData_getTimeCode, METH_NOARGS,
2380
"get the current frame in HH:MM:SS:FF format"},
2381
{"imageSizeX", ( PyCFunction ) RenderData_ImageSizeX, METH_VARARGS,
2382
"(int) - get/set the image width in pixels"},
2383
{"imageSizeY", ( PyCFunction ) RenderData_ImageSizeY, METH_VARARGS,
2384
"(int) - get/set the image height in pixels"},
2385
{"aspectRatioX", ( PyCFunction ) RenderData_AspectRatioX, METH_VARARGS,
2386
"(int) - get/set the horizontal aspect ratio"},
2387
{"aspectRatioY", ( PyCFunction ) RenderData_AspectRatioY, METH_VARARGS,
2388
"(int) - get/set the vertical aspect ratio"},
2389
{"setRenderer", ( PyCFunction ) RenderData_SetRenderer, METH_VARARGS,
2390
"(enum) - get/set which renderer to render the output"},
2391
{"enableCropping", ( PyCFunction ) RenderData_EnableCropping,
2393
"(bool) - enable/disable exclusion of border rendering from total image"},
2394
{"setImageType", ( PyCFunction ) RenderData_SetImageType, METH_VARARGS,
2395
"(enum) - get/set the type of image to output from the render"},
2396
{"quality", ( PyCFunction ) RenderData_Quality, METH_VARARGS,
2397
"(int) - get/set quality get/setting for JPEG images, AVI Jpeg and SGI movies"},
2398
{"framesPerSec", ( PyCFunction ) RenderData_FramesPerSec, METH_VARARGS,
2399
"(int) - get/set frames per second"},
2400
{"enableGrayscale", ( PyCFunction ) RenderData_EnableGrayscale,
2402
"() - images are saved with BW (grayscale) data"},
2403
{"enableRGBColor", ( PyCFunction ) RenderData_EnableRGBColor,
2405
"() - images are saved with RGB (color) data"},
2406
{"enableRGBAColor", ( PyCFunction ) RenderData_EnableRGBAColor,
2408
"() - images are saved with RGB and Alpha data (if supported)"},
2409
{"sizePreset", ( PyCFunction ) RenderData_SizePreset, METH_VARARGS,
2410
"(enum) - get/set the render to one of a few preget/sets"},
2411
{"enableUnifiedRenderer",
2412
( PyCFunction ) RenderData_EnableUnifiedRenderer, METH_VARARGS,
2413
"(bool) - use the unified renderer"},
2414
{"setYafrayGIQuality", ( PyCFunction ) RenderData_SetYafrayGIQuality,
2416
"(enum) - get/set yafray global Illumination quality"},
2417
{"setYafrayGIMethod", ( PyCFunction ) RenderData_SetYafrayGIMethod,
2419
"(enum) - get/set yafray global Illumination method"},
2420
{"yafrayGIPower", ( PyCFunction ) RenderData_YafrayGIPower,
2422
"(float) - get/set GI lighting intensity scale"},
2423
{"yafrayGIIndirPower", ( PyCFunction ) RenderData_YafrayGIIndirPower,
2425
"(float) - get/set GI indifect lighting intensity scale"},
2426
{"yafrayGIDepth", ( PyCFunction ) RenderData_YafrayGIDepth,
2428
"(int) - get/set number of bounces of the indirect light"},
2429
{"yafrayGICDepth", ( PyCFunction ) RenderData_YafrayGICDepth,
2431
"(int) - get/set number of bounces inside objects (for caustics)"},
2432
{"enableYafrayGICache", ( PyCFunction ) RenderData_EnableYafrayGICache,
2434
"(bool) - enable/disable cache irradiance samples (faster)"},
2435
{"enableYafrayGIPhotons",
2436
( PyCFunction ) RenderData_EnableYafrayGIPhotons, METH_VARARGS,
2437
"(bool) - enable/disable use global photons to help in GI"},
2438
{"yafrayGIPhotonCount", ( PyCFunction ) RenderData_YafrayGIPhotonCount,
2440
"(int) - get/set number of photons to shoot"},
2441
{"yafrayGIPhotonRadius",
2442
( PyCFunction ) RenderData_YafrayGIPhotonRadius, METH_VARARGS,
2443
"(float) - get/set radius to search for photons to mix (blur)"},
2444
{"yafrayGIPhotonMixCount",
2445
( PyCFunction ) RenderData_YafrayGIPhotonMixCount, METH_VARARGS,
2446
"(int) - get/set number of photons to shoot"},
2447
{"enableYafrayGITunePhotons",
2448
( PyCFunction ) RenderData_EnableYafrayGITunePhotons, METH_VARARGS,
2449
"(bool) - enable/disable show the photonmap directly in the render for tuning"},
2450
{"yafrayGIShadowQuality",
2451
( PyCFunction ) RenderData_YafrayGIShadowQuality, METH_VARARGS,
2452
"(float) - get/set the shadow quality, keep it under 0.95"},
2453
{"yafrayGIPixelsPerSample",
2454
( PyCFunction ) RenderData_YafrayGIPixelsPerSample, METH_VARARGS,
2455
"(int) - get/set maximum number of pixels without samples, the lower the better and slower"},
2456
{"yafrayGIRefinement", ( PyCFunction ) RenderData_YafrayGIRefinement,
2458
"(float) - get/setthreshold to refine shadows EXPERIMENTAL. 1 = no refinement"},
2459
{"yafrayRayBias", ( PyCFunction ) RenderData_YafrayRayBias,
2461
"(float) - get/set shadow ray bias to avoid self shadowing"},
2462
{"yafrayRayDepth", ( PyCFunction ) RenderData_YafrayRayDepth,
2464
"(int) - get/set maximum render ray depth from the camera"},
2465
{"yafrayGamma", ( PyCFunction ) RenderData_YafrayGamma, METH_VARARGS,
2466
"(float) - get/set gamma correction, 1 is off"},
2467
{"yafrayExposure", ( PyCFunction ) RenderData_YafrayExposure,
2469
"(float) - get/set exposure adjustment, 0 is off"},
2470
{"yafrayProcessorCount",
2471
( PyCFunction ) RenderData_YafrayProcessorCount, METH_VARARGS,
2472
"(int) - get/set number of processors to use"},
2473
{"enableGameFrameStretch",
2474
( PyCFunction ) RenderData_EnableGameFrameStretch, METH_NOARGS,
2475
"(l) - enble stretch or squeeze the viewport to fill the display window"},
2476
{"enableGameFrameExpose",
2477
( PyCFunction ) RenderData_EnableGameFrameExpose, METH_NOARGS,
2478
"(l) - enable show the entire viewport in the display window, viewing more horizontally or vertically"},
2479
{"enableGameFrameBars", ( PyCFunction ) RenderData_EnableGameFrameBars,
2481
"() - enable show the entire viewport in the display window, using bar horizontally or vertically"},
2482
{"setGameFrameColor", ( PyCFunction ) RenderData_SetGameFrameColor,
2484
"(f,f,f) - set the red, green, blue component of the bars"},
2485
{"getGameFrameColor", ( PyCFunction ) RenderData_GetGameFrameColor,
2487
"() - get the red, green, blue component of the bars"},
2488
{"gammaLevel", ( PyCFunction ) RenderData_GammaLevel, METH_VARARGS,
2489
"(float) - get/set the gamma value for blending oversampled images (1.0 = no correction"},
2490
{"postProcessAdd", ( PyCFunction ) RenderData_PostProcessAdd,
2492
"(float) - get/set post processing add"},
2493
{"postProcessMultiply", ( PyCFunction ) RenderData_PostProcessMultiply,
2495
"(float) - get/set post processing multiply"},
2496
{"postProcessGamma", ( PyCFunction ) RenderData_PostProcessGamma,
2498
"(float) - get/set post processing gamma"},
2499
{"SGIMaxsize", ( PyCFunction ) RenderData_SGIMaxsize, METH_VARARGS,
2500
"(int) - get/set maximum size per frame to save in an SGI movie"},
2501
{"enableSGICosmo", ( PyCFunction ) RenderData_EnableSGICosmo,
2503
"(bool) - enable/disable attempt to save SGI movies using Cosmo hardware"},
2504
{"oldMapValue", ( PyCFunction ) RenderData_OldMapValue, METH_VARARGS,
2505
"(int) - get/set specify old map value in frames"},
2506
{"newMapValue", ( PyCFunction ) RenderData_NewMapValue, METH_VARARGS,
2507
"(int) - get/set specify new map value in frames"},
2508
{NULL, NULL, 0, NULL}
2511
/*------------------------------------BPy_RenderData Type defintion------ */
2512
PyTypeObject RenderData_Type = {
2513
PyObject_HEAD_INIT( NULL ) /* required py macro */
2515
/* For printing, in format "<module>.<name>" */
2516
"Blender RenderData", /* char *tp_name; */
2517
sizeof( BPy_RenderData ), /* int tp_basicsize; */
2518
0, /* tp_itemsize; For allocation */
2520
/* Methods to implement standard operations */
2522
( destructor ) RenderData_dealloc,/* destructor tp_dealloc; */
2523
NULL, /* printfunc tp_print; */
2524
NULL, /* getattrfunc tp_getattr; */
2525
NULL, /* setattrfunc tp_setattr; */
2526
NULL, /* cmpfunc tp_compare; */
2527
( reprfunc ) RenderData_repr, /* reprfunc tp_repr; */
2529
/* Method suites for standard classes */
2531
NULL, /* PyNumberMethods *tp_as_number; */
2532
NULL, /* PySequenceMethods *tp_as_sequence; */
2533
NULL, /* PyMappingMethods *tp_as_mapping; */
2535
/* More standard operations (here for binary compatibility) */
2537
NULL, /* hashfunc tp_hash; */
2538
NULL, /* ternaryfunc tp_call; */
2539
NULL, /* reprfunc tp_str; */
2540
NULL, /* getattrofunc tp_getattro; */
2541
NULL, /* setattrofunc tp_setattro; */
2543
/* Functions to access object as input/output buffer */
2544
NULL, /* PyBufferProcs *tp_as_buffer; */
2546
/*** Flags to define presence of optional/expanded features ***/
2547
Py_TPFLAGS_DEFAULT, /* long tp_flags; */
2549
NULL, /* char *tp_doc; Documentation string */
2550
/*** Assigned meaning in release 2.0 ***/
2551
/* call function for all accessible objects */
2552
NULL, /* traverseproc tp_traverse; */
2554
/* delete references to contained objects */
2555
NULL, /* inquiry tp_clear; */
2557
/*** Assigned meaning in release 2.1 ***/
2558
/*** rich comparisons ***/
2559
NULL, /* richcmpfunc tp_richcompare; */
2561
/*** weak reference enabler ***/
2562
0, /* long tp_weaklistoffset; */
2564
/*** Added in release 2.2 ***/
2566
NULL, /* getiterfunc tp_iter; */
2567
NULL, /* iternextfunc tp_iternext; */
2569
/*** Attribute descriptor and subclassing stuff ***/
2570
BPy_RenderData_methods, /* struct PyMethodDef *tp_methods; */
2571
NULL, /* struct PyMemberDef *tp_members; */
2572
BPy_RenderData_getseters, /* struct PyGetSetDef *tp_getset; */
2573
NULL, /* struct _typeobject *tp_base; */
2574
NULL, /* PyObject *tp_dict; */
2575
NULL, /* descrgetfunc tp_descr_get; */
2576
NULL, /* descrsetfunc tp_descr_set; */
2577
0, /* long tp_dictoffset; */
2578
NULL, /* initproc tp_init; */
2579
NULL, /* allocfunc tp_alloc; */
2580
NULL, /* newfunc tp_new; */
2581
/* Low-level free-memory routine */
2582
NULL, /* freefunc tp_free; */
2583
/* For PyObject_IS_GC */
2584
NULL, /* inquiry tp_is_gc; */
2585
NULL, /* PyObject *tp_bases; */
2586
/* method resolution order */
2587
NULL, /* PyObject *tp_mro; */
2588
NULL, /* PyObject *tp_cache; */
2589
NULL, /* PyObject *tp_subclasses; */
2590
NULL, /* PyObject *tp_weaklist; */
2594
/***************************************************************************/
2595
/* Render method def */
2596
/***************************************************************************/
2597
struct PyMethodDef M_Render_methods[] = {
2598
{"CloseRenderWindow", ( PyCFunction ) M_Render_CloseRenderWindow,
2600
"() - close the rendering window"},
2601
{"EnableDispView", ( PyCFunction ) M_Render_EnableDispView,
2603
"(bool) - enable Sceneing in view"},
2604
{"EnableDispWin", ( PyCFunction ) M_Render_EnableDispWin, METH_NOARGS,
2605
"(bool) - enable Sceneing in new window"},
2606
{"SetRenderWinPos", ( PyCFunction ) M_Render_SetRenderWinPos,
2608
"([string list]) - position the rendering window in around the edge of the screen"},
2609
{"EnableEdgeShift", ( PyCFunction ) M_Render_EnableEdgeShift,
2611
"(bool) - with the unified renderer the outlines are shifted a bit."},
2612
{"EnableEdgeAll", ( PyCFunction ) M_Render_EnableEdgeAll, METH_VARARGS,
2613
"(bool) - also consider transparent faces for edge-rendering with the unified renderer"},
2614
{NULL, NULL, 0, NULL}
2617
static PyObject *M_Render_ModesDict( void )
2619
PyObject *M = PyConstant_New( );
2622
BPy_constant *d = ( BPy_constant * ) M;
2623
PyConstant_Insert( d, "OSA", PyInt_FromLong( R_OSA ) );
2624
PyConstant_Insert( d, "SHADOW", PyInt_FromLong( R_SHADOW ) );
2625
PyConstant_Insert( d, "GAMMA", PyInt_FromLong( R_GAMMA ) );
2626
PyConstant_Insert( d, "ENVMAP", PyInt_FromLong( R_ENVMAP ) );
2627
PyConstant_Insert( d, "TOONSHADING", PyInt_FromLong( R_EDGE ) );
2628
PyConstant_Insert( d, "FIELDRENDER", PyInt_FromLong( R_FIELDS ) );
2629
PyConstant_Insert( d, "FIELDTIME", PyInt_FromLong( R_FIELDSTILL ) );
2630
PyConstant_Insert( d, "RADIOSITY", PyInt_FromLong( R_RADIO ) );
2631
PyConstant_Insert( d, "BORDER_RENDER", PyInt_FromLong( R_BORDER ) );
2632
PyConstant_Insert( d, "PANORAMA", PyInt_FromLong( R_PANORAMA ) );
2633
PyConstant_Insert( d, "CROP", PyInt_FromLong( R_CROP ) );
2634
PyConstant_Insert( d, "ODDFIELD", PyInt_FromLong( R_ODDFIELD ) );
2635
PyConstant_Insert( d, "MBLUR", PyInt_FromLong( R_MBLUR ) );
2636
PyConstant_Insert( d, "UNIFIED", PyInt_FromLong( R_UNIFIED ) );
2637
PyConstant_Insert( d, "RAYTRACING", PyInt_FromLong( R_RAYTRACE ) );
2638
PyConstant_Insert( d, "THREADS", PyInt_FromLong( R_THREADS ) );
2643
static PyObject *M_Render_SceModesDict( void )
2645
PyObject *M = PyConstant_New( );
2648
BPy_constant *d = ( BPy_constant * ) M;
2649
PyConstant_Insert( d, "SEQUENCER", PyInt_FromLong( R_DOSEQ ) );
2650
PyConstant_Insert( d, "EXTENSION", PyInt_FromLong( R_EXTENSION ) );
2655
static PyObject *M_Render_GameFramingDict( void )
2657
PyObject *M = PyConstant_New( );
2660
BPy_constant *d = ( BPy_constant * ) M;
2661
PyConstant_Insert( d, "BARS",
2662
PyInt_FromLong( SCE_GAMEFRAMING_BARS ) );
2663
PyConstant_Insert( d, "EXTEND",
2664
PyInt_FromLong( SCE_GAMEFRAMING_EXTEND ) );
2665
PyConstant_Insert( d, "SCALE",
2666
PyInt_FromLong( SCE_GAMEFRAMING_SCALE ) );
2671
/***************************************************************************/
2672
/* Render Module Init */
2673
/***************************************************************************/
2674
PyObject *Render_Init( void )
2676
PyObject *submodule;
2677
PyObject *ModesDict = M_Render_ModesDict( );
2678
PyObject *SceModesDict = M_Render_SceModesDict( );
2679
PyObject *GFramingDict = M_Render_GameFramingDict( );
2681
if( PyType_Ready( &RenderData_Type ) < 0 )
2684
submodule = Py_InitModule3( "Blender.Scene.Render",
2685
M_Render_methods, M_Render_doc );
2688
PyModule_AddObject( submodule, "Modes", ModesDict );
2690
PyModule_AddObject( submodule, "SceModes", SceModesDict );
2692
PyModule_AddObject( submodule, "FramingModes", GFramingDict );
2694
/* ugh: why aren't these in a constant dict? */
2696
PyModule_AddIntConstant( submodule, "INTERNAL", R_INTERN );
2697
PyModule_AddIntConstant( submodule, "YAFRAY", R_YAFRAY );
2698
PyModule_AddIntConstant( submodule, "AVIRAW", R_AVIRAW );
2699
PyModule_AddIntConstant( submodule, "AVIJPEG", R_AVIJPEG );
2700
PyModule_AddIntConstant( submodule, "AVICODEC", R_AVICODEC );
2701
PyModule_AddIntConstant( submodule, "QUICKTIME", R_QUICKTIME );
2702
PyModule_AddIntConstant( submodule, "TARGA", R_TARGA );
2703
PyModule_AddIntConstant( submodule, "RAWTGA", R_RAWTGA );
2704
PyModule_AddIntConstant( submodule, "HDR", R_RADHDR );
2705
PyModule_AddIntConstant( submodule, "PNG", R_PNG );
2706
PyModule_AddIntConstant( submodule, "BMP", R_BMP );
2707
PyModule_AddIntConstant( submodule, "JPEG", R_JPEG90 );
2708
PyModule_AddIntConstant( submodule, "HAMX", R_HAMX );
2709
PyModule_AddIntConstant( submodule, "IRIS", R_IRIS );
2710
PyModule_AddIntConstant( submodule, "IRISZ", R_IRIZ );
2711
PyModule_AddIntConstant( submodule, "FTYPE", R_FTYPE );
2712
PyModule_AddIntConstant( submodule, "PAL", B_PR_PAL );
2713
PyModule_AddIntConstant( submodule, "NTSC", B_PR_NTSC );
2714
PyModule_AddIntConstant( submodule, "DEFAULT", B_PR_PRESET );
2715
PyModule_AddIntConstant( submodule, "PREVIEW", B_PR_PRV );
2716
PyModule_AddIntConstant( submodule, "PC", B_PR_PC );
2717
PyModule_AddIntConstant( submodule, "PAL169", B_PR_PAL169 );
2718
PyModule_AddIntConstant( submodule, "PANO", B_PR_PANO );
2719
PyModule_AddIntConstant( submodule, "FULL", B_PR_FULL );
2720
PyModule_AddIntConstant( submodule, "NONE", PY_NONE );
2721
PyModule_AddIntConstant( submodule, "LOW", PY_LOW );
2722
PyModule_AddIntConstant( submodule, "MEDIUM", PY_MEDIUM );
2723
PyModule_AddIntConstant( submodule, "HIGH", PY_HIGH );
2724
PyModule_AddIntConstant( submodule, "HIGHER", PY_HIGHER );
2725
PyModule_AddIntConstant( submodule, "BEST", PY_BEST );
2726
PyModule_AddIntConstant( submodule, "SKYDOME", PY_SKYDOME );
2727
PyModule_AddIntConstant( submodule, "GIFULL", PY_FULL );
2728
PyModule_AddIntConstant( submodule, "OPENEXR", R_OPENEXR );
2729
PyModule_AddIntConstant( submodule, "TIFF", R_TIFF );
2730
PyModule_AddIntConstant( submodule, "FFMPEG", R_FFMPEG );
2731
PyModule_AddIntConstant( submodule, "CINEON", R_CINEON );
2732
PyModule_AddIntConstant( submodule, "DPX", R_DPX );
2734
return ( submodule );
2737
/***************************************************************************/
2738
/* BPy_RenderData Callbacks */
2739
/***************************************************************************/
2741
PyObject *RenderData_CreatePyObject( struct Scene * scene )
2743
BPy_RenderData *py_renderdata;
2746
( BPy_RenderData * ) PyObject_NEW( BPy_RenderData,
2749
if( py_renderdata == NULL ) {
2752
py_renderdata->renderContext = &scene->r;
2753
py_renderdata->scene = scene;
2755
return ( ( PyObject * ) py_renderdata );
2758
int RenderData_CheckPyObject( PyObject * py_obj )
2760
return ( py_obj->ob_type == &RenderData_Type );
2763
/* #####DEPRECATED###### */
2765
static PyObject *RenderData_SetRenderPath( BPy_RenderData *self,
2768
return EXPP_setterWrapper( (void *)self, args,
2769
(setter)RenderData_setRenderPath );
2772
static PyObject *RenderData_SetBackbufPath( BPy_RenderData *self,
2775
return EXPP_setterWrapper( (void *)self, args,
2776
(setter)RenderData_setBackbufPath );
2779
static PyObject *RenderData_SetFtypePath( BPy_RenderData *self,
2782
return EXPP_setterWrapperTuple( (void *)self, args,
2783
(setter)RenderData_setFtypePath );
2786
static PyObject *RenderData_SetOversamplingLevel( BPy_RenderData * self,
2789
return EXPP_setterWrapper( (void *)self, args,
2790
(setter)RenderData_setOSALevel );
2793
static PyObject *RenderData_SetRenderWinSize( BPy_RenderData * self,
2796
return EXPP_setterWrapper( (void *)self, args,
2797
(setter)RenderData_setRenderWinSize );
2800
static PyObject *RenderData_SetBorder( BPy_RenderData * self,
2803
return EXPP_setterWrapperTuple( (void *)self, args,
2804
(setter)RenderData_setBorder );
2807
static PyObject *RenderData_SetRenderer( BPy_RenderData * self,
2810
return EXPP_setterWrapper( (void *)self, args,
2811
(setter)RenderData_setRenderer );
2814
static PyObject *RenderData_SetImageType( BPy_RenderData * self,
2817
return EXPP_setterWrapper( (void *)self, args,
2818
(setter)RenderData_setImageType );