~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

Viewing changes to source/blender/python/api2_2x/sceneRender.c

  • Committer: Bazaar Package Importer
  • Author(s): Lukas Fittl
  • Date: 2006-09-20 01:57:27 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20060920015727-gmoqlxwstx9wwqs3
Tags: 2.42a-1ubuntu1
* Merge from Debian unstable (Closes: Malone #55903). Remaining changes:
  - debian/genpot: Add python scripts from Lee June <blender@eyou.com> to
    generate a reasonable PO template from the sources. Since gettext is used
    in a highly nonstandard way, xgettext does not work for this job.
  - debian/rules: Call the scripts, generate po/blender.pot, and clean it up
    in the clean target.
  - Add a proper header to the generated PO template.
* debian/control: Build depend on libavformat-dev >= 3:0.cvs20060823-3.1,
  otherwise this package will FTBFS

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* 
2
 
 * $Id: sceneRender.c,v 1.24 2005/11/23 15:20:44 ton Exp $
 
2
 * $Id: sceneRender.c,v 1.44 2006/07/04 00:08:40 khughes Exp $
3
3
 *
4
4
 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
5
5
 *
33
33
 
34
34
#include "sceneRender.h" /*This must come first*/
35
35
 
36
 
#include "BIF_renderwin.h"
37
36
#include "DNA_image_types.h"
 
37
 
 
38
#include "BKE_image.h"
 
39
#include "BKE_global.h"
 
40
#include "BKE_screen.h"
 
41
#include "BKE_scene.h"
 
42
 
38
43
#include "BIF_drawscene.h"
 
44
#include "BIF_renderwin.h"
 
45
 
39
46
#include "BLI_blenlib.h"
40
 
#include "BKE_image.h"
41
 
#include "BKE_global.h"
 
47
 
 
48
#include "RE_pipeline.h"
 
49
 
42
50
#include "mydevice.h"
43
51
#include "butspace.h"
44
 
#include "render.h" /* RE_animrender() */
45
52
#include "blendef.h"
46
53
#include "gen_utils.h"
47
54
 
48
 
//local defines
 
55
#include "Scene.h"
 
56
 
 
57
/* local defines */
49
58
#define PY_NONE         0
50
59
#define PY_LOW          1
51
60
#define PY_MEDIUM       2
55
64
#define PY_SKYDOME      1
56
65
#define PY_FULL  2
57
66
 
58
 
extern RE_Render R;
59
 
extern void schrijfplaatje(char *name);
60
 
extern void waitcursor(int);
61
 
 
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------
 
67
enum rend_constants {
 
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,
 
75
        EXPP_RENDER_ATTR_FPS,
 
76
        EXPP_RENDER_ATTR_SIZEX,
 
77
        EXPP_RENDER_ATTR_SIZEY,
 
78
        EXPP_RENDER_ATTR_GAUSSFILTER,
 
79
        EXPP_RENDER_ATTR_MBLURFACTOR,
 
80
};
 
81
 
 
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
 
110
 
 
111
extern void save_rendered_image_cb_real(char *name, int zbuf, int confirm);
 
112
 
 
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,
74
 
         METH_NOARGS,
75
 
         "() - close the rendering window\n"},
76
 
        {"EnableDispView", ( PyCFunction ) M_Render_EnableDispView,
77
 
         METH_NOARGS,
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,
82
 
         METH_VARARGS,
83
 
         "([string list]) - position the rendering window in around the edge of the screen\n"},
84
 
        {"EnableEdgeShift", ( PyCFunction ) M_Render_EnableEdgeShift,
85
 
         METH_VARARGS,
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"},
89
 
        {NULL, NULL, 0, NULL}
90
 
};
91
 
//------------------------------------BPy_RenderData methods/callbacks--
 
115
 
 
116
/* deprecated callbacks */
 
117
static PyObject *RenderData_SetRenderPath( BPy_RenderData *self,
 
118
                PyObject *args );
 
119
static PyObject *RenderData_SetBackbufPath( BPy_RenderData *self,
 
120
                PyObject *args );
 
121
static PyObject *RenderData_SetFtypePath( BPy_RenderData *self,
 
122
                PyObject *args );
 
123
static PyObject *RenderData_SetOversamplingLevel( BPy_RenderData * self,
 
124
                PyObject * args );
 
125
static PyObject *RenderData_SetRenderWinSize( BPy_RenderData * self,
 
126
                PyObject * args );
 
127
static PyObject *RenderData_SetBorder( BPy_RenderData * self,
 
128
                PyObject * args );
 
129
static PyObject *RenderData_SetRenderer( BPy_RenderData * self,
 
130
                PyObject * args );
 
131
static PyObject *RenderData_SetImageType( BPy_RenderData * self,
 
132
                PyObject * args );
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,
97
 
                                           PyObject * args );
98
 
static PyObject *RenderData_GetRenderPath( BPy_RenderData * self );
99
 
static PyObject *RenderData_SetBackbufPath( BPy_RenderData * self,
100
 
                                            PyObject * args );
101
 
static PyObject *RenderData_GetBackbufPath( BPy_RenderData * self );
102
 
static PyObject *RenderData_EnableBackbuf( BPy_RenderData * self,
103
 
                                           PyObject * args );
104
 
static PyObject *RenderData_SetFtypePath( BPy_RenderData * self,
105
 
                                          PyObject * args );
106
 
static PyObject *RenderData_GetFtypePath( BPy_RenderData * self );
107
 
static PyObject *RenderData_EnableExtensions( BPy_RenderData * self,
108
 
                                              PyObject * args );
109
 
static PyObject *RenderData_EnableSequencer( BPy_RenderData * self,
110
 
                                             PyObject * args );
111
 
static PyObject *RenderData_EnableRenderDaemon( BPy_RenderData * self,
112
 
                                                PyObject * args );
113
 
static PyObject *RenderData_EnableToonShading( BPy_RenderData * self,
114
 
                                               PyObject * args );
115
 
static PyObject *RenderData_EdgeIntensity( BPy_RenderData * self,
116
 
                                           PyObject * args );
117
 
static PyObject *RenderData_SetEdgeColor( BPy_RenderData * self,
118
 
                                          PyObject * args );
119
 
static PyObject *RenderData_GetEdgeColor( BPy_RenderData * self );
120
 
static PyObject *RenderData_EdgeAntiShift( BPy_RenderData * self,
121
 
                                           PyObject * args );
122
 
static PyObject *RenderData_EnableOversampling( BPy_RenderData * self,
123
 
                                                PyObject * args );
124
 
static PyObject *RenderData_SetOversamplingLevel( BPy_RenderData * self,
125
 
                                                  PyObject * args );
126
 
static PyObject *RenderData_EnableMotionBlur( BPy_RenderData * self,
127
 
                                              PyObject * args );
128
 
static PyObject *RenderData_MotionBlurLevel( BPy_RenderData * self,
129
 
                                             PyObject * args );
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,
136
 
                                          PyObject * args );
137
 
static PyObject *RenderData_EnablePanorama( BPy_RenderData * self,
138
 
                                            PyObject * args );
139
 
static PyObject *RenderData_EnableEnvironmentMap( BPy_RenderData * self,
140
 
                                                  PyObject * args );
141
 
static PyObject *RenderData_EnableRayTracing( BPy_RenderData * self,
142
 
                                              PyObject * args );
143
 
static PyObject *RenderData_EnableRadiosityRender( BPy_RenderData * self,
144
 
                                                   PyObject * args );
145
 
static PyObject *RenderData_SetRenderWinSize( BPy_RenderData * self,
146
 
                                              PyObject * args );
147
 
static PyObject *RenderData_EnableFieldRendering( BPy_RenderData * self,
148
 
                                                  PyObject * args );
149
 
static PyObject *RenderData_EnableOddFieldFirst( BPy_RenderData * self,
150
 
                                                 PyObject * args );
151
 
static PyObject *RenderData_EnableFieldTimeDisable( BPy_RenderData * self,
152
 
                                                    PyObject * args );
153
 
static PyObject *RenderData_EnableGaussFilter( BPy_RenderData * self,
154
 
                                               PyObject * args );
155
 
static PyObject *RenderData_EnableBorderRender( BPy_RenderData * self,
156
 
                                                PyObject * args );
157
 
static PyObject *RenderData_SetBorder( BPy_RenderData * self,
158
 
                                       PyObject * args );
159
 
static PyObject *RenderData_EnableGammaCorrection( BPy_RenderData * self,
160
 
                                                   PyObject * args );
161
 
static PyObject *RenderData_GaussFilterSize( BPy_RenderData * self,
162
 
                                             PyObject * args );
163
 
static PyObject *RenderData_StartFrame( BPy_RenderData * self,
164
 
                                        PyObject * args );
165
 
static PyObject *RenderData_CurrentFrame( BPy_RenderData * self,
166
 
                                          PyObject * args );
167
 
static PyObject *RenderData_EndFrame( BPy_RenderData * self, PyObject * args );
168
 
static PyObject *RenderData_ImageSizeX( BPy_RenderData * self,
169
 
                                        PyObject * args );
170
 
static PyObject *RenderData_ImageSizeY( BPy_RenderData * self,
171
 
                                        PyObject * args );
172
 
static PyObject *RenderData_AspectRatioX( BPy_RenderData * self,
173
 
                                          PyObject * args );
174
 
static PyObject *RenderData_AspectRatioY( BPy_RenderData * self,
175
 
                                          PyObject * args );
176
 
static PyObject *RenderData_SetRenderer( BPy_RenderData * self,
177
 
                                         PyObject * args );
178
 
static PyObject *RenderData_EnableCropping( BPy_RenderData * self,
179
 
                                            PyObject * args );
180
 
static PyObject *RenderData_SetImageType( BPy_RenderData * self,
181
 
                                          PyObject * args );
182
 
static PyObject *RenderData_Quality( BPy_RenderData * self, PyObject * args );
183
 
static PyObject *RenderData_FramesPerSec( BPy_RenderData * self,
184
 
                                          PyObject * args );
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,
189
 
                                        PyObject * args );
190
 
static PyObject *RenderData_EnableUnifiedRenderer( BPy_RenderData * self,
191
 
                                                   PyObject * args );
192
 
static PyObject *RenderData_SetYafrayGIQuality( BPy_RenderData * self,
193
 
                                                PyObject * args );
194
 
static PyObject *RenderData_SetYafrayGIMethod( BPy_RenderData * self,
195
 
                                               PyObject * args );
196
 
static PyObject *RenderData_YafrayGIPower( BPy_RenderData * self,
197
 
                                           PyObject * args );
198
 
static PyObject *RenderData_YafrayGIDepth( BPy_RenderData * self,
199
 
                                           PyObject * args );
200
 
static PyObject *RenderData_YafrayGICDepth( BPy_RenderData * self,
201
 
                                            PyObject * args );
202
 
static PyObject *RenderData_EnableYafrayGICache( BPy_RenderData * self,
203
 
                                                 PyObject * args );
204
 
static PyObject *RenderData_EnableYafrayGIPhotons( BPy_RenderData * self,
205
 
                                                   PyObject * args );
206
 
static PyObject *RenderData_YafrayGIPhotonCount( BPy_RenderData * self,
207
 
                                                 PyObject * args );
208
 
static PyObject *RenderData_YafrayGIPhotonRadius( BPy_RenderData * self,
209
 
                                                  PyObject * args );
210
 
static PyObject *RenderData_YafrayGIPhotonMixCount( BPy_RenderData * self,
211
 
                                                    PyObject * args );
212
 
static PyObject *RenderData_EnableYafrayGITunePhotons( BPy_RenderData * self,
213
 
                                                       PyObject * args );
214
 
static PyObject *RenderData_YafrayGIShadowQuality( BPy_RenderData * self,
215
 
                                                   PyObject * args );
216
 
static PyObject *RenderData_YafrayGIPixelsPerSample( BPy_RenderData * self,
217
 
                                                     PyObject * args );
218
 
static PyObject *RenderData_YafrayGIRefinement( BPy_RenderData * self,
219
 
                                                PyObject * args );
220
 
static PyObject *RenderData_YafrayRayBias( BPy_RenderData * self,
221
 
                                           PyObject * args );
222
 
static PyObject *RenderData_YafrayRayDepth( BPy_RenderData * self,
223
 
                                            PyObject * args );
224
 
static PyObject *RenderData_YafrayGamma( BPy_RenderData * self,
225
 
                                         PyObject * args );
226
 
static PyObject *RenderData_YafrayExposure( BPy_RenderData * self,
227
 
                                            PyObject * args );
228
 
static PyObject *RenderData_YafrayProcessorCount( BPy_RenderData * self,
229
 
                                                  PyObject * args );
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,
234
 
                                               PyObject * args );
235
 
static PyObject *RenderData_GetGameFrameColor( BPy_RenderData * self );
236
 
static PyObject *RenderData_GammaLevel( BPy_RenderData * self,
237
 
                                        PyObject * args );
238
 
static PyObject *RenderData_PostProcessAdd( BPy_RenderData * self,
239
 
                                            PyObject * args );
240
 
static PyObject *RenderData_PostProcessMultiply( BPy_RenderData * self,
241
 
                                                 PyObject * args );
242
 
static PyObject *RenderData_PostProcessGamma( BPy_RenderData * self,
243
 
                                              PyObject * args );
244
 
static PyObject *RenderData_SGIMaxsize( BPy_RenderData * self,
245
 
                                        PyObject * args );
246
 
static PyObject *RenderData_EnableSGICosmo( BPy_RenderData * self,
247
 
                                            PyObject * args );
248
 
static PyObject *RenderData_OldMapValue( BPy_RenderData * self,
249
 
                                         PyObject * args );
250
 
static PyObject *RenderData_NewMapValue( BPy_RenderData * self,
251
 
                                         PyObject * args );
252
 
 
253
 
static PyObject *RenderData_getTimeCode( BPy_RenderData * self);
254
 
 
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,
269
 
         METH_VARARGS,
270
 
         "(string) - get/set the path to output the rendered images to\n"},
271
 
        {"getRenderPath", ( PyCFunction ) RenderData_GetRenderPath,
272
 
         METH_NOARGS,
273
 
         "() - get the path to directory where rendered images will go\n"},
274
 
        {"setBackbufPath", ( PyCFunction ) RenderData_SetBackbufPath,
275
 
         METH_VARARGS,
276
 
         "(string) - get/set the path to a background image and load it\n"},
277
 
        {"getBackbufPath", ( PyCFunction ) RenderData_GetBackbufPath,
278
 
         METH_NOARGS,
279
 
         "() - get the path to background image file\n"},
280
 
        {"enableBackbuf", ( PyCFunction ) RenderData_EnableBackbuf,
281
 
         METH_VARARGS,
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,
288
 
         METH_VARARGS,
289
 
         "(bool) - enable/disable windows extensions for output files\n"},
290
 
        {"enableSequencer", ( PyCFunction ) RenderData_EnableSequencer,
291
 
         METH_VARARGS,
292
 
         "(bool) - enable/disable Do Sequence\n"},
293
 
        {"enableRenderDaemon", ( PyCFunction ) RenderData_EnableRenderDaemon,
294
 
         METH_VARARGS,
295
 
         "(bool) - enable/disable Scene daemon\n"},
296
 
        {"enableToonShading", ( PyCFunction ) RenderData_EnableToonShading,
297
 
         METH_VARARGS,
298
 
         "(bool) - enable/disable Edge rendering\n"},
299
 
        {"edgeIntensity", ( PyCFunction ) RenderData_EdgeIntensity,
300
 
         METH_VARARGS,
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,
307
 
         METH_VARARGS,
308
 
         "(int) - with the unified renderer to reduce intensity on boundaries.\n"},
309
 
        {"enableOversampling", ( PyCFunction ) RenderData_EnableOversampling,
310
 
         METH_VARARGS,
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,
316
 
         METH_VARARGS,
317
 
         "(bool) - enable/disable MBlur.\n"},
318
 
        {"motionBlurLevel", ( PyCFunction ) RenderData_MotionBlurLevel,
319
 
         METH_VARARGS,
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,
328
 
         METH_NOARGS,
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,
335
 
         METH_VARARGS,
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,
341
 
         METH_VARARGS,
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,
347
 
         METH_VARARGS,
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,
353
 
         METH_VARARGS,
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,
359
 
         METH_VARARGS,
360
 
         "(bool) - enable/disable Gauss sampling filter for antialiasing\n"},
361
 
        {"enableBorderRender", ( PyCFunction ) RenderData_EnableBorderRender,
362
 
         METH_VARARGS,
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,
370
 
         METH_VARARGS,
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,
391
 
         METH_VARARGS,
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,
400
 
         METH_NOARGS,
401
 
         "() - images are saved with BW (grayscale) data\n"},
402
 
        {"enableRGBColor", ( PyCFunction ) RenderData_EnableRGBColor,
403
 
         METH_NOARGS,
404
 
         "() - images are saved with RGB (color) data\n"},
405
 
        {"enableRGBAColor", ( PyCFunction ) RenderData_EnableRGBAColor,
406
 
         METH_NOARGS,
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,
414
 
         METH_VARARGS,
415
 
         "(enum) - get/set yafray global Illumination quality\n"},
416
 
        {"setYafrayGIMethod", ( PyCFunction ) RenderData_SetYafrayGIMethod,
417
 
         METH_VARARGS,
418
 
         "(enum) - get/set yafray global Illumination method\n"},
419
 
        {"yafrayGIPower", ( PyCFunction ) RenderData_YafrayGIPower,
420
 
         METH_VARARGS,
421
 
         "(float) - get/set GI lighting intensity scale\n"},
422
 
        {"yafrayGIDepth", ( PyCFunction ) RenderData_YafrayGIDepth,
423
 
         METH_VARARGS,
424
 
         "(int) - get/set number of bounces of the indirect light\n"},
425
 
        {"yafrayGICDepth", ( PyCFunction ) RenderData_YafrayGICDepth,
426
 
         METH_VARARGS,
427
 
         "(int) - get/set number of bounces inside objects (for caustics)\n"},
428
 
        {"enableYafrayGICache", ( PyCFunction ) RenderData_EnableYafrayGICache,
429
 
         METH_VARARGS,
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,
435
 
         METH_VARARGS,
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,
453
 
         METH_VARARGS,
454
 
         "(float) - get/setthreshold to refine shadows EXPERIMENTAL. 1 = no refinement\n"},
455
 
        {"yafrayRayBias", ( PyCFunction ) RenderData_YafrayRayBias,
456
 
         METH_VARARGS,
457
 
         "(float) - get/set shadow ray bias to avoid self shadowing\n"},
458
 
        {"yafrayRayDepth", ( PyCFunction ) RenderData_YafrayRayDepth,
459
 
         METH_VARARGS,
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,
464
 
         METH_VARARGS,
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,
476
 
         METH_NOARGS,
477
 
         "() - enable show the entire viewport in the display window, using bar horizontally or vertically\n"},
478
 
        {"setGameFrameColor", ( PyCFunction ) RenderData_SetGameFrameColor,
479
 
         METH_VARARGS,
480
 
         "(f,f,f) - set the red, green, blue component of the bars\n"},
481
 
        {"getGameFrameColor", ( PyCFunction ) RenderData_GetGameFrameColor,
482
 
         METH_NOARGS,
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,
487
 
         METH_VARARGS,
488
 
         "(float) - get/set post processing add\n"},
489
 
        {"postProcessMultiply", ( PyCFunction ) RenderData_PostProcessMultiply,
490
 
         METH_VARARGS,
491
 
         "(float) - get/set post processing multiply\n"},
492
 
        {"postProcessGamma", ( PyCFunction ) RenderData_PostProcessGamma,
493
 
         METH_VARARGS,
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,
498
 
         METH_VARARGS,
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}
505
 
};
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 */
511
 
        0,                      /* tp_itemsize */
512
 
        /* methods */
513
 
        ( destructor ) RenderData_dealloc,      /* tp_dealloc */
514
 
        0,                      /* tp_print */
515
 
        ( getattrfunc ) RenderData_getAttr,     /* tp_getattr */
516
 
        0,                      /* tp_setattr */
517
 
        0,                      /* tp_compare */
518
 
        ( reprfunc ) RenderData_repr,   /* tp_repr */
519
 
        0,                      /* tp_as_number */
520
 
        0,                      /* tp_as_sequence */
521
 
        0,                      /* tp_as_mapping */
522
 
        0,                      /* tp_as_hash */
523
 
        0, 0, 0, 0, 0, 0,
524
 
        0,                      /* tp_doc */
525
 
        0, 0, 0, 0, 0, 0,
526
 
        BPy_RenderData_methods, /* tp_methods */
527
 
        0,                      /* tp_members */
528
 
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
529
 
};
530
 
//---------------------------------------------------Render Module Init--
531
 
PyObject *Render_Init( void )
532
 
{
533
 
        PyObject *submodule;
534
 
 
535
 
        RenderData_Type.ob_type = &PyType_Type;
536
 
 
537
 
        submodule = Py_InitModule3( "Blender.Scene.Render",
538
 
                                    M_Render_methods, M_Render_doc );
539
 
 
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 );
572
 
 
573
 
        return ( submodule );
574
 
}
575
 
 
576
 
//-----------------------------------BPy_RenderData Internal Protocols---
577
 
//-------------------------------------------------dealloc---------------
 
134
 
 
135
/* BPy_RenderData Internal Protocols */
 
136
 
578
137
static void RenderData_dealloc( BPy_RenderData * self )
579
138
{
580
139
        PyObject_DEL( self );
581
140
}
582
141
 
583
 
//-------------------------------------------------getAttr---------------
584
 
static PyObject *RenderData_getAttr( BPy_RenderData * self, char *name )
585
 
{
586
 
        return Py_FindMethod( BPy_RenderData_methods, ( PyObject * ) self,
587
 
                              name );
588
 
}
589
 
 
590
 
//-------------------------------------------------repr------------------
591
142
static PyObject *RenderData_repr( BPy_RenderData * self )
592
143
{
593
144
        if( self->renderContext )
597
148
                return PyString_FromString( "NULL" );
598
149
}
599
150
 
600
 
//------------------------------BPy_RenderData Callbacks-----------------
601
 
//--------------------------------------CreatePyObject-------------------
602
 
PyObject *RenderData_CreatePyObject( struct Scene * scene )
603
 
{
604
 
        BPy_RenderData *py_renderdata;
605
 
 
606
 
        py_renderdata =
607
 
                ( BPy_RenderData * ) PyObject_NEW( BPy_RenderData,
608
 
                                                   &RenderData_Type );
609
 
 
610
 
        if( py_renderdata == NULL ) {
611
 
                return ( NULL );
612
 
        }
613
 
        py_renderdata->renderContext = &scene->r;
614
 
        py_renderdata->scene = scene;
615
 
 
616
 
        return ( ( PyObject * ) py_renderdata );
617
 
}
618
 
 
619
 
//------------------------------CheckPyObject----------------------------
620
 
int RenderData_CheckPyObject( PyObject * py_obj )
621
 
{
622
 
        return ( py_obj->ob_type == &RenderData_Type );
623
 
}
624
 
 
625
 
//------------------------------------BitToggleInt-----------------------
 
151
/***************************************************************************/
 
152
/* local utility routines for manipulating data                            */
 
153
/***************************************************************************/
626
154
static PyObject *M_Render_BitToggleInt( PyObject * args, int setting,
627
155
                                        int *structure )
628
156
{
648
176
 
649
177
}
650
178
 
651
 
//------------------------------------BitToggleShort---------------------
652
179
static PyObject *M_Render_BitToggleShort( PyObject * args, short setting,
653
180
                                          short *structure )
654
181
{
674
201
 
675
202
}
676
203
 
677
 
//------------------------------------GetSetAttributeFloat---------------
678
204
static PyObject *M_Render_GetSetAttributeFloat( PyObject * args,
679
205
                                                float *structure, float min,
680
206
                                                float max )
701
227
                return Py_BuildValue( "f", *structure );
702
228
}
703
229
 
704
 
//------------------------------------GetSetAttributeShort---------------
705
230
static PyObject *M_Render_GetSetAttributeShort( PyObject * args,
706
231
                                                short *structure, int min,
707
232
                                                int max )
728
253
                return Py_BuildValue( "h", *structure );
729
254
}
730
255
 
731
 
//------------------------------------GetSetAttributeInt-----------------
732
256
static PyObject *M_Render_GetSetAttributeInt( PyObject * args, int *structure,
733
257
                                              int min, int max )
734
258
{
754
278
                return Py_BuildValue( "i", *structure );
755
279
}
756
280
 
757
 
//------------------------------------DoSizePrese -----------------------
 
281
 
758
282
static void M_Render_DoSizePreset( BPy_RenderData * self, short xsch,
759
283
                                   short ysch, short xasp, short yasp,
760
284
                                   short size, short xparts, short yparts,
775
299
        EXPP_allqueue( REDRAWVIEWCAM, 0 );
776
300
}
777
301
 
778
 
//------------------------------------Render Module Function Definitions-
779
 
//------------------------------------Render.CloseRenderWindow() --------
 
302
/***************************************************************************/
 
303
/* Render Module Function Definitions                                      */
 
304
/***************************************************************************/
 
305
 
780
306
PyObject *M_Render_CloseRenderWindow( PyObject * self )
781
307
{
782
308
        BIF_close_render_display(  );
783
309
        return EXPP_incr_ret( Py_None );
784
310
}
785
311
 
786
 
//------------------------------------Render.SetRenderWinPos() ----------
787
312
PyObject *M_Render_SetRenderWinPos( PyObject * self, PyObject * args )
788
313
{
789
314
        PyObject *list = NULL;
798
323
        for( x = 0; x < PyList_Size( list ); x++ ) {
799
324
                if( !PyArg_Parse( PyList_GetItem( list, x ), "s", &loc ) ) {
800
325
                        return EXPP_ReturnPyObjError( PyExc_TypeError,
801
 
                                                      "python list not parseable\n" );
 
326
                                                      "python list not parseable" );
802
327
                }
803
328
                if( strcmp( loc, "SW" ) == 0 || strcmp( loc, "sw" ) == 0 )
804
329
                        G.winpos |= 1;
820
345
                        G.winpos |= 256;
821
346
                else
822
347
                        return EXPP_ReturnPyObjError( PyExc_AttributeError,
823
 
                                                      "list contains unknown string\n" );
 
348
                                                      "list contains unknown string" );
824
349
        }
825
350
        EXPP_allqueue( REDRAWBUTSSCENE, 0 );
826
351
 
827
352
        return EXPP_incr_ret( Py_None );
828
353
}
829
354
 
830
 
//------------------------------------Render.EnableDispView() -----------
831
355
PyObject *M_Render_EnableDispView( PyObject * self )
832
356
{
833
 
        G.displaymode = R_DISPLAYVIEW;
 
357
        G.displaymode = R_DISPLAYIMAGE;
834
358
        EXPP_allqueue( REDRAWBUTSSCENE, 0 );
835
359
 
836
360
        return EXPP_incr_ret( Py_None );
837
361
}
838
362
 
839
 
//------------------------------------Render.EnableDispWin() ------------
840
363
PyObject *M_Render_EnableDispWin( PyObject * self )
841
364
{
842
365
        G.displaymode = R_DISPLAYWIN;
845
368
        return EXPP_incr_ret( Py_None );
846
369
}
847
370
 
848
 
//------------------------------------Render.EnableEdgeShift() ----------
849
371
PyObject *M_Render_EnableEdgeShift( PyObject * self, PyObject * args )
850
372
{
851
373
        return M_Render_BitToggleInt( args, 1, &G.compat );
852
374
}
853
375
 
854
 
//------------------------------------Render.EnableEdgeAll() ------------
855
376
PyObject *M_Render_EnableEdgeAll( PyObject * self, PyObject * args )
856
377
{
857
378
        return M_Render_BitToggleInt( args, 1, &G.notonlysolid );
858
379
}
859
380
 
860
 
//----------------------------BPy_RenderData Function Definitions--------
 
381
/***************************************************************************/
 
382
/* BPy_RenderData Function Definitions                                     */
 
383
/***************************************************************************/
861
384
 
862
 
//------------------------------------RenderData.Render() ---------------
863
385
PyObject *RenderData_Render( BPy_RenderData * self )
864
386
{
865
387
        Scene *oldsce;
872
394
        }
873
395
 
874
396
        else { /* background mode (blender -b file.blend -P script) */
 
397
                Render *re= RE_NewRender("Render");
875
398
 
876
399
                int end_frame = G.scene->r.efra; /* is of type short currently */
877
400
 
881
404
 
882
405
                G.scene->r.efra = G.scene->r.sfra;
883
406
 
884
 
                RE_animrender(NULL);
 
407
                RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra);
885
408
 
886
409
                G.scene->r.efra = (short)end_frame;
887
410
        }
888
411
 
889
412
        return EXPP_incr_ret( Py_None );
890
413
}
891
 
//------------------------------------RenderData.Render() ---------------
892
 
//This will save the rendered image to an output file path already defined
 
414
 
 
415
/* 
 
416
 * This will save the rendered image to an output file path already defined.
 
417
 */
893
418
PyObject *RenderData_SaveRenderedImage ( BPy_RenderData * self, PyObject *args )
894
419
{
895
 
        char dir[FILE_MAXDIR * 2], str[FILE_MAXFILE * 2], strn[256];
 
420
        char dir[FILE_MAXDIR * 2], str[FILE_MAXFILE * 2];
896
421
        char *name_str, filepath[FILE_MAXDIR+FILE_MAXFILE];
 
422
        RenderResult *rr = NULL;
 
423
        int zbuff = 0;
897
424
 
898
 
        if( !PyArg_ParseTuple( args, "s", &name_str ) )
 
425
        if( !PyArg_ParseTuple( args, "s|i", &name_str, &zbuff ) )
899
426
                return EXPP_ReturnPyObjError( PyExc_TypeError,
900
 
                                                "expected a filename (string)" );
 
427
                                "expected a filename (string) and optional int" );
901
428
 
902
 
        if( strlen(self->renderContext->pic) + strlen(name_str) >
903
 
                        sizeof(filepath)-1 )
 
429
        if( strlen(self->renderContext->pic) + strlen(name_str)
 
430
                        >= sizeof(filepath) )
904
431
                return EXPP_ReturnPyObjError( PyExc_ValueError,
905
 
                                                "full filename too long" );
 
432
                                "full filename too long" );
 
433
 
 
434
        if (zbuff !=0   ) zbuff = 1; /*required 1/0 */
906
435
 
907
436
        BLI_strncpy( filepath, self->renderContext->pic, sizeof(filepath) );
908
437
        strcat(filepath, name_str);
909
 
        
910
 
        if(!R.rectot) {
911
 
                return EXPP_ReturnPyObjError (PyExc_RuntimeError,
912
 
                        "No image rendered");
 
438
 
 
439
        rr = RE_GetResult(RE_GetRender(G.scene->id.name));
 
440
        if(!rr) {
 
441
                return EXPP_ReturnPyObjError (PyExc_ValueError, "No image rendered");
913
442
        } else {
914
443
                if(G.ima[0]==0) {
915
444
                        strcpy(dir, G.sce);
916
445
                        BLI_splitdirstring(dir, str);
917
446
                        strcpy(G.ima, dir);
918
447
                }
919
 
                
920
 
                R.r.imtype= G.scene->r.imtype;
921
 
                R.r.quality= G.scene->r.quality;
922
 
                R.r.planes= G.scene->r.planes;
923
 
        
924
 
                strcpy(strn, filepath);
925
 
                BLI_convertstringcode(strn, G.sce, G.scene->r.cfra);
926
 
                if(BLI_testextensie(strn,".blend")) {
927
 
                        return EXPP_ReturnPyObjError (PyExc_RuntimeError,
928
 
                                "Wrong filename");
929
 
                }
930
 
 
931
 
                waitcursor(1);
932
 
                schrijfplaatje(strn);
933
 
                strcpy(G.ima, filepath);
934
 
                waitcursor(0);
 
448
                save_rendered_image_cb_real(filepath, zbuff,0);
935
449
        }
936
 
 
937
450
        return EXPP_incr_ret(Py_None);
938
451
}
939
 
//------------------------------------RenderData.RenderAnim() -----------
 
452
 
940
453
PyObject *RenderData_RenderAnim( BPy_RenderData * self )
941
454
{
942
455
        Scene *oldsce;
948
461
                set_scene( oldsce );
949
462
        }
950
463
        else { /* background mode (blender -b file.blend -P script) */
 
464
                Render *re= RE_NewRender("Render");
 
465
                
951
466
                if (G.scene != self->scene)
952
467
                        return EXPP_ReturnPyObjError (PyExc_RuntimeError,
953
468
                                "scene to render in bg mode must be the active scene");
955
470
                if (G.scene->r.sfra > G.scene->r.efra)
956
471
                        return EXPP_ReturnPyObjError (PyExc_RuntimeError,
957
472
                                "start frame must be less or equal to end frame");
958
 
                RE_animrender(NULL);
 
473
                
 
474
                RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra);
959
475
        }
960
476
        return EXPP_incr_ret( Py_None );
961
477
}
962
478
 
963
 
//------------------------------------RenderData.Play() -----------------
964
479
PyObject *RenderData_Play( BPy_RenderData * self )
965
480
{
966
481
        char file[FILE_MAXDIR + FILE_MAXFILE];
975
490
                strcpy( file, self->renderContext->pic );
976
491
                BLI_convertstringcode( file, (char *) self->scene,
977
492
                                       self->renderContext->cfra );
978
 
                RE_make_existing_file( file );
 
493
                BLI_make_existing_file( file );
979
494
                if( BLI_strcasecmp( file + strlen( file ) - 4, ".mov" ) ) {
980
495
                        sprintf( txt, "%04d_%04d.mov",
981
496
                                 ( self->renderContext->sfra ),
989
504
                strcpy( file, self->renderContext->pic );
990
505
                BLI_convertstringcode( file, G.sce,
991
506
                                       self->renderContext->cfra );
992
 
                RE_make_existing_file( file );
 
507
                BLI_make_existing_file( file );
993
508
                if( BLI_strcasecmp( file + strlen( file ) - 4, ".avi" ) ) {
994
509
                        sprintf( txt, "%04d_%04d.avi",
995
510
                                 ( self->renderContext->sfra ),
998
513
                }
999
514
        }
1000
515
        if( BLI_exist( file ) ) {
1001
 
                calc_renderwin_rectangle( G.winpos, pos, size );
 
516
                calc_renderwin_rectangle(640, 480, G.winpos, pos, size);
1002
517
                sprintf( str, "%s -a -p %d %d \"%s\"", bprogname, pos[0],
1003
518
                         pos[1], file );
1004
519
                system( str );
1005
520
        } else {
1006
 
                makepicstring( file, self->renderContext->sfra );
 
521
                BKE_makepicstring( file, self->renderContext->sfra );
1007
522
                if( BLI_exist( file ) ) {
1008
 
                        calc_renderwin_rectangle( G.winpos, pos, size );
 
523
                        calc_renderwin_rectangle(640, 480, G.winpos, pos, size);
1009
524
                        sprintf( str, "%s -a -p %d %d \"%s\"", bprogname,
1010
525
                                 pos[0], pos[1], file );
1011
526
                        system( str );
1016
531
        return EXPP_incr_ret( Py_None );
1017
532
}
1018
533
 
1019
 
//------------------------------------RenderData.StRenderPath() ---------
1020
 
PyObject *RenderData_SetRenderPath( BPy_RenderData * self, PyObject * args )
1021
 
{
1022
 
        char *name;
1023
 
 
1024
 
        if( !PyArg_ParseTuple( args, "s", &name ) )
1025
 
                return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
1026
 
                                                "expected a string" ) );
1027
 
 
1028
 
        if( strlen( name ) > 160 )
1029
 
                return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
1030
 
                                                "path is too long (SetRenderPath)" ) );
1031
 
 
1032
 
        strcpy( self->renderContext->pic, name );
1033
 
        EXPP_allqueue( REDRAWBUTSSCENE, 0 );
1034
 
 
1035
 
        return EXPP_incr_ret( Py_None );
1036
 
}
1037
 
 
1038
 
//------------------------------------RenderData.GetRenderPath() --------
1039
 
PyObject *RenderData_GetRenderPath( BPy_RenderData * self )
1040
 
{
1041
 
        return Py_BuildValue( "s", self->renderContext->pic );
1042
 
}
1043
 
 
1044
 
//------------------------------------RenderData.SetBackbufPath() -------
1045
 
PyObject *RenderData_SetBackbufPath( BPy_RenderData * self, PyObject * args )
1046
 
{
1047
 
        char *name;
1048
 
        Image *ima;
1049
 
 
1050
 
        if( !PyArg_ParseTuple( args, "s", &name ) )
1051
 
                return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
1052
 
                                                "expected a string" ) );
1053
 
 
1054
 
        if( strlen( name ) > 160 )
1055
 
                return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
1056
 
                                                "path is too long (SetBackbufPath)" ) );
1057
 
 
1058
 
        strcpy( self->renderContext->backbuf, name );
1059
 
        EXPP_allqueue( REDRAWBUTSSCENE, 0 );
1060
 
 
1061
 
        ima = add_image( name );
1062
 
        if( ima ) {
1063
 
                free_image_buffers( ima );
1064
 
                ima->ok = 1;
1065
 
        }
1066
 
 
1067
 
        return EXPP_incr_ret( Py_None );
1068
 
}
1069
 
 
1070
 
//------------------------------------RenderData.GetBackbufPath() -------
1071
 
PyObject *RenderData_GetBackbufPath( BPy_RenderData * self )
1072
 
{
1073
 
        return Py_BuildValue( "s", self->renderContext->backbuf );
1074
 
}
1075
 
 
1076
 
//------------------------------------RenderData.EnableBackbuf() --------
1077
534
PyObject *RenderData_EnableBackbuf( BPy_RenderData * self, PyObject * args )
1078
535
{
1079
536
        return M_Render_BitToggleShort( args, 1,
1080
537
                                        &self->renderContext->bufflag );
1081
538
}
1082
539
 
1083
 
//------------------------------------RenderData.SetFtypePath() ---------
1084
 
PyObject *RenderData_SetFtypePath( BPy_RenderData * self, PyObject * args )
1085
 
{
1086
 
        char *name;
1087
 
 
1088
 
        if( !PyArg_ParseTuple( args, "s", &name ) )
1089
 
                return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
1090
 
                                                "expected a string" ) );
1091
 
 
1092
 
        if( strlen( name ) > 160 )
1093
 
                return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
1094
 
                                                "path is too long (SetFtypePath)" ) );
1095
 
 
1096
 
        strcpy( self->renderContext->ftype, name );
1097
 
        EXPP_allqueue( REDRAWBUTSSCENE, 0 );
1098
 
 
1099
 
        return EXPP_incr_ret( Py_None );
1100
 
}
1101
 
 
1102
 
//------------------------------------RenderData.GetFtypePath() ---------
1103
 
PyObject *RenderData_GetFtypePath( BPy_RenderData * self )
1104
 
{
1105
 
        return Py_BuildValue( "s", self->renderContext->ftype );
1106
 
}
1107
 
 
1108
 
//------------------------------------RenderData.EnableExtensions() -----
 
540
PyObject *RenderData_EnableThreads( BPy_RenderData * self, PyObject * args )
 
541
{
 
542
        return M_Render_BitToggleInt( args, R_THREADS,
 
543
                                        &self->renderContext->mode );
 
544
}
 
545
 
1109
546
PyObject *RenderData_EnableExtensions( BPy_RenderData * self, PyObject * args )
1110
547
{
1111
548
        return M_Render_BitToggleShort( args, R_EXTENSION,
1112
549
                                        &self->renderContext->scemode );
1113
550
}
1114
551
 
1115
 
//------------------------------------RenderData.EnableSequencer() ------
1116
552
PyObject *RenderData_EnableSequencer( BPy_RenderData * self, PyObject * args )
1117
553
{
1118
554
        return M_Render_BitToggleShort( args, R_DOSEQ,
1119
555
                                        &self->renderContext->scemode );
1120
556
}
1121
557
 
1122
 
//------------------------------------RenderData.EnableRenderDaemon() ---
1123
558
PyObject *RenderData_EnableRenderDaemon( BPy_RenderData * self,
1124
559
                                         PyObject * args )
1125
560
{
1127
562
                                        &self->renderContext->scemode );
1128
563
}
1129
564
 
1130
 
//------------------------------------RenderData.EnableToonShading() ----
1131
565
PyObject *RenderData_EnableToonShading( BPy_RenderData * self,
1132
566
                                        PyObject * args )
1133
567
{
1135
569
                                      &self->renderContext->mode );
1136
570
}
1137
571
 
1138
 
//------------------------------------RenderData.EdgeIntensity() --------
1139
572
PyObject *RenderData_EdgeIntensity( BPy_RenderData * self, PyObject * args )
1140
573
{
1141
574
        return M_Render_GetSetAttributeShort( args,
1143
576
                                              255 );
1144
577
}
1145
578
 
1146
 
//------------------------------------RenderData.SetEdgeColor() ---------
1147
579
PyObject *RenderData_SetEdgeColor( BPy_RenderData * self, PyObject * args )
1148
580
{
1149
 
        float red = 0.0f;
1150
 
        float green = 0.0f;
1151
 
        float blue = 0.0f;
 
581
        float red, green, blue;
1152
582
 
1153
583
        if( !PyArg_ParseTuple( args, "fff", &red, &green, &blue ) )
1154
584
                return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
1171
601
        return EXPP_incr_ret( Py_None );
1172
602
}
1173
603
 
1174
 
//------------------------------------RenderData.GetEdgeColor() ---------
1175
604
PyObject *RenderData_GetEdgeColor( BPy_RenderData * self )
1176
605
{
1177
606
        char rgb[24];
1178
607
 
1179
 
        sprintf( rgb, "[%.3f,%.3f,%.3f]\n", self->renderContext->edgeR,
 
608
        sprintf( rgb, "[%.3f,%.3f,%.3f]", self->renderContext->edgeR,
1180
609
                 self->renderContext->edgeG, self->renderContext->edgeB );
1181
610
        return PyString_FromString( rgb );
1182
611
}
1183
612
 
1184
 
//------------------------------------RenderData.EdgeAntiShift() --------
1185
613
PyObject *RenderData_EdgeAntiShift( BPy_RenderData * self, PyObject * args )
1186
614
{
1187
615
        return M_Render_GetSetAttributeShort( args,
1189
617
                                              same_mat_redux, 0, 255 );
1190
618
}
1191
619
 
1192
 
//------------------------------------RenderData.EnableOversampling() ---
1193
620
PyObject *RenderData_EnableOversampling( BPy_RenderData * self,
1194
621
                                         PyObject * args )
1195
622
{
1197
624
                                      &self->renderContext->mode );
1198
625
}
1199
626
 
1200
 
//------------------------------------RenderData.SetOversamplingLevel() -
1201
 
PyObject *RenderData_SetOversamplingLevel( BPy_RenderData * self,
1202
 
                                           PyObject * args )
 
627
static int RenderData_setOSALevel( BPy_RenderData * self,
 
628
                PyObject * value )
1203
629
{
1204
630
        int level;
1205
631
 
1206
 
        if( !PyArg_ParseTuple( args, "i", &level ) )
1207
 
                return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
1208
 
                                                "expected int" ) );
 
632
        if( !PyInt_CheckExact( value ) )
 
633
                return EXPP_ReturnIntError( PyExc_TypeError,
 
634
                                "expected int argument" );
1209
635
 
 
636
        level = PyInt_AsLong( value );
1210
637
        if( level != 5 && level != 8 && level != 11 && level != 16 )
1211
 
                return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
1212
 
                                                "expected 5,8,11, or 16" ) );
 
638
                return EXPP_ReturnIntError( PyExc_ValueError,
 
639
                                "expected 5, 8, 11, or 16" );
1213
640
 
1214
641
        self->renderContext->osa = (short)level;
1215
642
        EXPP_allqueue( REDRAWBUTSSCENE, 0 );
1216
643
 
1217
 
        return EXPP_incr_ret( Py_None );
 
644
        return 0;
1218
645
}
1219
646
 
1220
 
//------------------------------------RenderData.EnableMotionBlur() -----
1221
647
PyObject *RenderData_EnableMotionBlur( BPy_RenderData * self, PyObject * args )
1222
648
{
1223
649
        return M_Render_BitToggleInt( args, R_MBLUR,
1224
650
                                      &self->renderContext->mode );
1225
651
}
1226
652
 
1227
 
//------------------------------------RenderData.MotionBlurLevel() ------
1228
653
PyObject *RenderData_MotionBlurLevel( BPy_RenderData * self, PyObject * args )
1229
654
{
1230
655
        return M_Render_GetSetAttributeFloat( args,
1232
657
                                              0.01f, 5.0f );
1233
658
}
1234
659
 
1235
 
//------------------------------------RenderData.PartsX() ---------------
1236
660
PyObject *RenderData_PartsX( BPy_RenderData * self, PyObject * args )
1237
661
{
1238
662
        return M_Render_GetSetAttributeShort( args,
1239
663
                                              &self->renderContext->xparts, 1,
1240
 
                                              64 );
 
664
                                              512 );
1241
665
}
1242
666
 
1243
 
//------------------------------------RenderData.PartsY() ---------------
1244
667
PyObject *RenderData_PartsY( BPy_RenderData * self, PyObject * args )
1245
668
{
1246
669
        return M_Render_GetSetAttributeShort( args,
1248
671
                                              64 );
1249
672
}
1250
673
 
1251
 
//------------------------------------RenderData.EnableSky() ------------
1252
674
PyObject *RenderData_EnableSky( BPy_RenderData * self )
1253
675
{
1254
676
        self->renderContext->alphamode = R_ADDSKY;
1257
679
        return EXPP_incr_ret( Py_None );
1258
680
}
1259
681
 
1260
 
//------------------------------------RenderData.EnablePremultiply() ----
1261
682
PyObject *RenderData_EnablePremultiply( BPy_RenderData * self )
1262
683
{
1263
684
        self->renderContext->alphamode = R_ALPHAPREMUL;
1266
687
        return EXPP_incr_ret( Py_None );
1267
688
}
1268
689
 
1269
 
//------------------------------------RenderData.EnableKey() ------------
1270
690
PyObject *RenderData_EnableKey( BPy_RenderData * self )
1271
691
{
1272
692
        self->renderContext->alphamode = R_ALPHAKEY;
1275
695
        return EXPP_incr_ret( Py_None );
1276
696
}
1277
697
 
1278
 
//------------------------------------RenderData.EnableShadow() ---------
1279
698
PyObject *RenderData_EnableShadow( BPy_RenderData * self, PyObject * args )
1280
699
{
1281
700
        return M_Render_BitToggleInt( args, R_SHADOW,
1282
701
                                      &self->renderContext->mode );
1283
702
}
1284
703
 
1285
 
//------------------------------------RenderData.EnvironmentMap() -------
1286
704
PyObject *RenderData_EnableEnvironmentMap( BPy_RenderData * self,
1287
705
                                           PyObject * args )
1288
706
{
1290
708
                                      &self->renderContext->mode );
1291
709
}
1292
710
 
1293
 
//------------------------------------RenderData.EnablePanorama() -------
1294
711
PyObject *RenderData_EnablePanorama( BPy_RenderData * self, PyObject * args )
1295
712
{
1296
713
        return M_Render_BitToggleInt( args, R_PANORAMA,
1297
714
                                      &self->renderContext->mode );
1298
715
}
1299
716
 
1300
 
//------------------------------------RenderData.EnableRayTracing() -----
1301
717
PyObject *RenderData_EnableRayTracing( BPy_RenderData * self, PyObject * args )
1302
718
{
1303
719
        return M_Render_BitToggleInt( args, R_RAYTRACE,
1304
720
                                      &self->renderContext->mode );
1305
721
}
1306
722
 
1307
 
//------------------------------------RenderData.EnableRadiosityRender() 
1308
723
PyObject *RenderData_EnableRadiosityRender( BPy_RenderData * self,
1309
724
                                            PyObject * args )
1310
725
{
1311
726
        return M_Render_BitToggleInt( args, R_RADIO,
1312
727
                                      &self->renderContext->mode );
1313
728
}
1314
 
 
1315
 
//------------------------------------RenderData.SetRenderWinSize() -----
1316
 
PyObject *RenderData_SetRenderWinSize( BPy_RenderData * self, PyObject * args )
1317
 
{
1318
 
        int size;
1319
 
 
1320
 
        if( !PyArg_ParseTuple( args, "i", &size ) )
1321
 
                return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
1322
 
                                                "expected int" ) );
1323
 
 
1324
 
        if( size != 25 && size != 50 && size != 75 && size != 100 )
1325
 
                return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
1326
 
                                                "expected 25, 50, 75, or 100" ) );
1327
 
 
1328
 
        self->renderContext->size = (short)size;
1329
 
        EXPP_allqueue( REDRAWBUTSSCENE, 0 );
1330
 
 
1331
 
        return EXPP_incr_ret( Py_None );
1332
 
}
1333
 
 
1334
 
//------------------------------------RenderData.EnableFieldRendering() -
1335
729
PyObject *RenderData_EnableFieldRendering( BPy_RenderData * self,
1336
730
                                           PyObject * args )
1337
731
{
1339
733
                                      &self->renderContext->mode );
1340
734
}
1341
735
 
1342
 
//------------------------------------RenderData.EnableOddFieldFirst() --
1343
736
PyObject *RenderData_EnableOddFieldFirst( BPy_RenderData * self,
1344
737
                                          PyObject * args )
1345
738
{
1347
740
                                      &self->renderContext->mode );
1348
741
}
1349
742
 
1350
 
//------------------------------------RenderData.EnableFieldTimeDisable()
1351
743
PyObject *RenderData_EnableFieldTimeDisable( BPy_RenderData * self,
1352
744
                                             PyObject * args )
1353
745
{
1355
747
                                      &self->renderContext->mode );
1356
748
}
1357
749
 
1358
 
//------------------------------------RenderData.EnableGaussFilter() ----
1359
750
PyObject *RenderData_EnableGaussFilter( BPy_RenderData * self,
1360
751
                                        PyObject * args )
1361
752
{
1367
758
        /* choices are listed in DNA_scene_types.h (search filtertype) */
1368
759
}
1369
760
 
1370
 
//------------------------------------RenderData.EnableBorderRender() ---
1371
761
PyObject *RenderData_EnableBorderRender( BPy_RenderData * self,
1372
762
                                         PyObject * args )
1373
763
{
1375
765
                                      &self->renderContext->mode );
1376
766
}
1377
767
 
1378
 
//------------------------------------RenderData.SetBorder() ------------
1379
 
PyObject *RenderData_SetBorder( BPy_RenderData * self, PyObject * args )
 
768
static int RenderData_setBorder( BPy_RenderData * self, PyObject * args )
1380
769
{
1381
 
        float xmin = 0.0f, ymin = 0.0f, xmax = 0.0f, ymax = 0.0f;
1382
 
        int status = 0;
1383
 
        PyObject *ob_args;
1384
 
 
1385
 
        //left,botton | right,top coords - in that order
1386
 
        if( PyObject_Length( args ) == 4 ) {
1387
 
                status = PyArg_ParseTuple( args, "ffff", &xmin, &ymin, &xmax,
1388
 
                                           &ymax );
1389
 
        } else {
1390
 
                if( PyArg_ParseTuple( args, "O", &ob_args ) ) {
1391
 
                        if( PyList_Check( ob_args ) )
1392
 
                                status = PyArg_ParseTuple( args, "(ffff)",
1393
 
                                                           &xmin, &ymin, &xmax,
1394
 
                                                           &ymax );
1395
 
                        else {
1396
 
                                status = 0;
1397
 
                        }
1398
 
                } else {
1399
 
                        status = 0;
1400
 
                }
 
770
        float xmin, ymin, xmax, ymax;
 
771
 
 
772
        if( PyList_Check( args ) )
 
773
                args = PySequence_Tuple( args );
 
774
        else
 
775
                Py_INCREF( args );
 
776
 
 
777
        if( !PyArg_ParseTuple( args, "ffff", &xmin, &ymin, &xmax, &ymax ) ) {
 
778
                Py_DECREF( args );
 
779
                return EXPP_ReturnIntError( PyExc_TypeError,
 
780
                                                "expected four floats" );
1401
781
        }
1402
 
        if( !status )           /* parsing args failed */
1403
 
                return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
1404
 
                                                "expected four floats" ) );
1405
 
        if( xmin > 1.0 || xmin < 0.0 || ymin > 1.0 || ymin < 0.0 ||
1406
 
            xmax > 1.0 || xmax < 0.0 || ymax > 1.0 || ymax < 0.0 )
1407
 
                return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
1408
 
                                                "all values must be between 0.0 and 1.0" ) );
1409
782
 
1410
 
        self->renderContext->border.xmin = xmin;
1411
 
        self->renderContext->border.ymin = ymin;
1412
 
        self->renderContext->border.xmax = xmax;
1413
 
        self->renderContext->border.ymax = ymax;
 
783
        self->renderContext->border.xmin = EXPP_ClampFloat( xmin, 0.0, 1.0 );
 
784
        self->renderContext->border.xmax = EXPP_ClampFloat( xmax, 0.0, 1.0 );
 
785
        self->renderContext->border.ymin = EXPP_ClampFloat( ymin, 0.0, 1.0 );
 
786
        self->renderContext->border.ymax = EXPP_ClampFloat( ymax, 0.0, 1.0 );
1414
787
 
1415
788
        EXPP_allqueue( REDRAWVIEWCAM, 1 );
1416
789
 
1417
 
        return EXPP_incr_ret( Py_None );
1418
 
}
1419
 
 
1420
 
//------------------------------------RenderData.EnableGammaCorrection() 
 
790
        Py_DECREF( args );
 
791
        return 0;
 
792
}
 
793
 
 
794
static PyObject *RenderData_getBorder( BPy_RenderData * self )
 
795
{
 
796
        return Py_BuildValue( "[ffff]", 
 
797
                        self->renderContext->border.xmin,
 
798
                        self->renderContext->border.ymin,
 
799
                        self->renderContext->border.xmax,
 
800
                        self->renderContext->border.ymax );
 
801
}
 
802
 
1421
803
PyObject *RenderData_EnableGammaCorrection( BPy_RenderData * self,
1422
804
                                            PyObject * args )
1423
805
{
1425
807
                                      &self->renderContext->mode );
1426
808
}
1427
809
 
1428
 
//------------------------------------RenderData.GaussFilterSize() ------
1429
810
PyObject *RenderData_GaussFilterSize( BPy_RenderData * self, PyObject * args )
1430
811
{
1431
812
        return M_Render_GetSetAttributeFloat( args,
1433
814
                                              0.5f, 1.5f );
1434
815
}
1435
816
 
1436
 
//------------------------------------RenderData.StartFrame() -----------
1437
817
PyObject *RenderData_StartFrame( BPy_RenderData * self, PyObject * args )
1438
818
{
1439
 
        return M_Render_GetSetAttributeShort( args, &self->renderContext->sfra,
1440
 
                                              1, MAXFRAME );
 
819
        return M_Render_GetSetAttributeInt( args, &self->renderContext->sfra,
 
820
                                            1, MAXFRAME );
1441
821
}
1442
822
 
1443
 
//------------------------------------RenderData.CurrentFrame() ---------
1444
823
PyObject *RenderData_CurrentFrame( BPy_RenderData * self, PyObject * args )
1445
824
{
1446
 
        return M_Render_GetSetAttributeShort( args, &self->renderContext->cfra,
1447
 
                                              1, MAXFRAME );
 
825
        return M_Render_GetSetAttributeInt( args, &self->renderContext->cfra,
 
826
                                            1, MAXFRAME );
1448
827
}
1449
828
 
1450
 
//------------------------------------RenderData.EndFrame() -------------
1451
829
PyObject *RenderData_EndFrame( BPy_RenderData * self, PyObject * args )
1452
830
{
1453
 
        return M_Render_GetSetAttributeShort( args, &self->renderContext->efra,
1454
 
                                              1, MAXFRAME );
 
831
        return M_Render_GetSetAttributeInt( args, &self->renderContext->efra,
 
832
                                            1, MAXFRAME );
1455
833
}
1456
834
 
1457
 
 //------------------------------------RenderData.ImageSizeX() ----------
1458
835
PyObject *RenderData_ImageSizeX( BPy_RenderData * self, PyObject * args )
1459
836
{
1460
837
        return M_Render_GetSetAttributeShort( args, &self->renderContext->xsch,
1461
838
                                              4, 10000 );
1462
839
}
1463
840
 
1464
 
//------------------------------------RenderData.ImageSizeY() -----------
1465
841
PyObject *RenderData_ImageSizeY( BPy_RenderData * self, PyObject * args )
1466
842
{
1467
843
        return M_Render_GetSetAttributeShort( args, &self->renderContext->ysch,
1468
844
                                              4, 10000 );
1469
845
}
1470
846
 
1471
 
//------------------------------------RenderData.AspectRatioX() ---------
1472
847
PyObject *RenderData_AspectRatioX( BPy_RenderData * self, PyObject * args )
1473
848
{
1474
849
        return M_Render_GetSetAttributeShort( args, &self->renderContext->xasp,
1475
850
                                              1, 200 );
1476
851
}
1477
852
 
1478
 
//------------------------------------RenderData.AspectRatioY() ---------
1479
853
PyObject *RenderData_AspectRatioY( BPy_RenderData * self, PyObject * args )
1480
854
{
1481
855
        return M_Render_GetSetAttributeShort( args, &self->renderContext->yasp,
1482
856
                                              1, 200 );
1483
857
}
1484
858
 
1485
 
//------------------------------------RenderData.SetRenderer() ----------
1486
 
PyObject *RenderData_SetRenderer( BPy_RenderData * self, PyObject * args )
 
859
static int RenderData_setRenderer( BPy_RenderData * self, PyObject * value )
1487
860
{
1488
861
        int type;
1489
862
 
1490
 
        if( !PyArg_ParseTuple( args, "i", &type ) )
1491
 
                return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
1492
 
                                                "expected constant INTERN or YAFRAY" ) );
 
863
        if( !PyInt_CheckExact( value ) )
 
864
                return EXPP_ReturnIntError( PyExc_TypeError,
 
865
                                "expected constant INTERNAL or YAFRAY" );
1493
866
 
 
867
        type = PyInt_AsLong( value );
1494
868
        if( type == R_INTERN )
1495
869
                self->renderContext->renderer = R_INTERN;
1496
870
        else if( type == R_YAFRAY )
1497
871
                self->renderContext->renderer = R_YAFRAY;
1498
872
        else
1499
 
                return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
1500
 
                                                "expected INTERN or YAFRAY" ) );
 
873
                return EXPP_ReturnIntError( PyExc_ValueError,
 
874
                                "expected constant INTERNAL or YAFRAY" );
1501
875
 
1502
876
        EXPP_allqueue( REDRAWBUTSSCENE, 0 );
1503
 
        return EXPP_incr_ret( Py_None );
 
877
        return 0;
1504
878
}
1505
879
 
1506
 
//------------------------------------RenderData.EnableCropping() -------
1507
 
PyObject *RenderData_EnableCropping( BPy_RenderData * self, PyObject * args )
 
880
PyObject *RenderData_EnableCropping( void )
1508
881
{
1509
 
        return M_Render_BitToggleInt( args, R_MOVIECROP,
 
882
/*      return M_Render_BitToggleInt( args, R_MOVIECROP,
1510
883
                                      &self->renderContext->mode );
 
884
*/
 
885
        printf("cropping option is now default, obsolete\n");
 
886
        Py_RETURN_NONE;
1511
887
}
1512
888
 
1513
 
//------------------------------------RenderData.SetImageType() ---------
1514
 
PyObject *RenderData_SetImageType( BPy_RenderData * self, PyObject * args )
 
889
 
 
890
static int RenderData_setImageType( BPy_RenderData *self, PyObject *value )
1515
891
{
1516
892
        int type;
1517
893
 
1518
 
        if( !PyArg_ParseTuple( args, "i", &type ) )
1519
 
                return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
1520
 
                                                "expected constant" ) );
1521
 
 
1522
 
        if( type == R_AVIRAW )
1523
 
                self->renderContext->imtype = R_AVIRAW;
1524
 
        else if( type == R_AVIJPEG )
1525
 
                self->renderContext->imtype = R_AVIJPEG;
 
894
        if( !PyInt_CheckExact( value ) )
 
895
                return EXPP_ReturnIntError( PyExc_TypeError,
 
896
                                "expected int constant" );
 
897
 
 
898
        type = PyInt_AS_LONG( value );
 
899
 
 
900
        /*
 
901
         * this same logic and more is in buttons_scene.c imagetype_pup code but
 
902
         * only in generating strings for the popup menu, no way to reuse that :(
 
903
         */
 
904
 
 
905
        switch( type ) {
 
906
        case R_AVIRAW :
 
907
        case R_AVIJPEG :
 
908
        case R_TARGA :
 
909
        case R_RAWTGA :
 
910
        case R_RADHDR :
 
911
        case R_PNG :
 
912
        case R_BMP :
 
913
        case R_JPEG90 :
 
914
        case R_HAMX :
 
915
        case R_IRIS :
 
916
        case R_IRIZ :
 
917
        case R_FTYPE :
 
918
        case R_TIFF :
 
919
        case R_CINEON :
 
920
        case R_DPX :
1526
921
#ifdef _WIN32
1527
 
        else if( type == R_AVICODEC )
1528
 
                self->renderContext->imtype = R_AVICODEC;
1529
 
#endif
1530
 
        else if( type == R_QUICKTIME && G.have_quicktime )
1531
 
                self->renderContext->imtype = R_QUICKTIME;
1532
 
        else if( type == R_TARGA )
1533
 
                self->renderContext->imtype = R_TARGA;
1534
 
        else if( type == R_RAWTGA )
1535
 
                self->renderContext->imtype = R_RAWTGA;
1536
 
        else if( type == R_RADHDR )
1537
 
                self->renderContext->imtype = R_RADHDR;
1538
 
        else if( type == R_PNG )
1539
 
                self->renderContext->imtype = R_PNG;
1540
 
        else if( type == R_BMP )
1541
 
                self->renderContext->imtype = R_BMP;
1542
 
        else if( type == R_JPEG90 )
1543
 
                self->renderContext->imtype = R_JPEG90;
1544
 
        else if( type == R_HAMX )
1545
 
                self->renderContext->imtype = R_HAMX;
1546
 
        else if( type == R_IRIS )
1547
 
                self->renderContext->imtype = R_IRIS;
1548
 
        else if( type == R_IRIZ )
1549
 
                self->renderContext->imtype = R_IRIZ;
1550
 
        else if( type == R_FTYPE )
1551
 
                self->renderContext->imtype = R_FTYPE;
1552
 
        else
1553
 
                return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
1554
 
                                                "unknown constant - see modules dict for help" ) );
 
922
        case R_AVICODEC :
 
923
#endif
 
924
#ifdef WITH_OPENEXR
 
925
        case R_OPENEXR :
 
926
#endif
 
927
#ifdef WITH_FFMPEG
 
928
        case R_FFMPEG :
 
929
#endif
 
930
                self->renderContext->imtype = type;
 
931
                break;
 
932
        case R_QUICKTIME :
 
933
                if( G.have_quicktime ) {
 
934
                        self->renderContext->imtype = R_QUICKTIME;
 
935
                        break;
 
936
                }
 
937
        default:
 
938
                return EXPP_ReturnIntError( PyExc_ValueError,
 
939
                                "unknown constant - see modules dict for help" );
 
940
        }
1555
941
 
1556
942
        EXPP_allqueue( REDRAWBUTSSCENE, 0 );
1557
 
        return EXPP_incr_ret( Py_None );
 
943
        return 0;
1558
944
}
1559
945
 
1560
 
//------------------------------------RenderData.Quality() --------------
1561
946
PyObject *RenderData_Quality( BPy_RenderData * self, PyObject * args )
1562
947
{
1563
948
        return M_Render_GetSetAttributeShort( args,
1565
950
                                              10, 100 );
1566
951
}
1567
952
 
1568
 
//------------------------------------RenderData.FramesPerSec() ---------
1569
953
PyObject *RenderData_FramesPerSec( BPy_RenderData * self, PyObject * args )
1570
954
{
1571
955
        return M_Render_GetSetAttributeShort( args,
1573
957
                                              120 );
1574
958
}
1575
959
 
1576
 
//------------------------------------RenderData.EnableGrayscale() ------
1577
960
PyObject *RenderData_EnableGrayscale( BPy_RenderData * self )
1578
961
{
1579
962
        self->renderContext->planes = R_PLANESBW;
1582
965
        return EXPP_incr_ret( Py_None );
1583
966
}
1584
967
 
1585
 
//------------------------------------RenderData.EnableRGBColor() -------
1586
968
PyObject *RenderData_EnableRGBColor( BPy_RenderData * self )
1587
969
{
1588
970
        self->renderContext->planes = R_PLANES24;
1591
973
        return EXPP_incr_ret( Py_None );
1592
974
}
1593
975
 
1594
 
//------------------------------------RenderData.EnableRGBAColor() ------
1595
976
PyObject *RenderData_EnableRGBAColor( BPy_RenderData * self )
1596
977
{
1597
978
        self->renderContext->planes = R_PLANES32;
1600
981
        return EXPP_incr_ret( Py_None );
1601
982
}
1602
983
 
1603
 
//------------------------------------RenderData.SizePreset() -----------
1604
984
PyObject *RenderData_SizePreset( BPy_RenderData * self, PyObject * args )
1605
985
{
1606
986
        int type;
1673
1053
        return EXPP_incr_ret( Py_None );
1674
1054
}
1675
1055
 
1676
 
//------------------------------------RenderData.EnableUnifiedRenderer() 
1677
1056
PyObject *RenderData_EnableUnifiedRenderer( BPy_RenderData * self,
1678
1057
                                            PyObject * args )
1679
1058
{
1681
1060
                                      &self->renderContext->mode );
1682
1061
}
1683
1062
 
1684
 
//------------------------------------RenderData.SetYafrayGIQuality() ---
1685
1063
PyObject *RenderData_SetYafrayGIQuality( BPy_RenderData * self,
1686
1064
                                         PyObject * args )
1687
1065
{
1703
1081
        return EXPP_incr_ret( Py_None );
1704
1082
}
1705
1083
 
1706
 
//------------------------------------RenderData.SetYafrayGIMethod() ----
1707
1084
PyObject *RenderData_SetYafrayGIMethod( BPy_RenderData * self,
1708
1085
                                        PyObject * args )
1709
1086
{
1723
1100
        return EXPP_incr_ret( Py_None );
1724
1101
}
1725
1102
 
1726
 
//------------------------------------RenderData.YafrayGIPower() --------
1727
1103
PyObject *RenderData_YafrayGIPower( BPy_RenderData * self, PyObject * args )
1728
1104
{
1729
1105
        if( self->renderContext->GImethod > 0 ) {
1736
1112
                                                "YafrayGIMethod must be set to 'SKYDOME' or 'FULL'" ) );
1737
1113
}
1738
1114
 
1739
 
//------------------------------------RenderData.YafrayGIDepth() --------
 
1115
PyObject *RenderData_YafrayGIIndirPower( BPy_RenderData * self, PyObject * args )
 
1116
{
 
1117
        return M_Render_GetSetAttributeFloat( args,
 
1118
                                                  &self->renderContext->
 
1119
                                                  GIindirpower, 0.01f,
 
1120
                                                  100.00f );
 
1121
}
 
1122
 
1740
1123
PyObject *RenderData_YafrayGIDepth( BPy_RenderData * self, PyObject * args )
1741
1124
{
1742
1125
        if( self->renderContext->GImethod == 2 ) {
1748
1131
                                                "YafrayGIMethod must be set to 'FULL'" ) );
1749
1132
}
1750
1133
 
1751
 
//------------------------------------RenderData.afrayGICDepth() --------
1752
1134
PyObject *RenderData_YafrayGICDepth( BPy_RenderData * self, PyObject * args )
1753
1135
{
1754
1136
        if( self->renderContext->GImethod == 2 ) {
1760
1142
                                                "YafrayGIMethod must be set to 'FULL'" ) );
1761
1143
}
1762
1144
 
1763
 
//------------------------------------RenderData.EnableYafrayGICache() --
1764
1145
PyObject *RenderData_EnableYafrayGICache( BPy_RenderData * self,
1765
1146
                                          PyObject * args )
1766
1147
{
1773
1154
                                                "YafrayGIMethod must be set to 'FULL'" ) );
1774
1155
}
1775
1156
 
1776
 
//------------------------------------RenderData.EnableYafrayGIPhotons() 
1777
1157
PyObject *RenderData_EnableYafrayGIPhotons( BPy_RenderData * self,
1778
1158
                                            PyObject * args )
1779
1159
{
1786
1166
                                                "YafrayGIMethod must be set to 'FULL'" ) );
1787
1167
}
1788
1168
 
1789
 
//------------------------------------RenderData.YafrayGIPhotonCount() --
1790
1169
PyObject *RenderData_YafrayGIPhotonCount( BPy_RenderData * self,
1791
1170
                                          PyObject * args )
1792
1171
{
1798
1177
                                                    10000000 );
1799
1178
        } else
1800
1179
                return ( EXPP_ReturnPyObjError( PyExc_StandardError,
1801
 
                                                "YafrayGIMethod must be set to 'FULL' and GIPhotons must be enabled\n" ) );
 
1180
                                                "YafrayGIMethod must be set to 'FULL' and GIPhotons must be enabled" ) );
1802
1181
}
1803
1182
 
1804
 
//------------------------------------RenderData.YafrayGIPhotonRadius() -
1805
1183
PyObject *RenderData_YafrayGIPhotonRadius( BPy_RenderData * self,
1806
1184
                                           PyObject * args )
1807
1185
{
1813
1191
                                                      100.0f );
1814
1192
        } else
1815
1193
                return ( EXPP_ReturnPyObjError( PyExc_StandardError,
1816
 
                                                "YafrayGIMethod must be set to 'FULL' and GIPhotons must be enabled\n" ) );
 
1194
                                                "YafrayGIMethod must be set to 'FULL' and GIPhotons must be enabled" ) );
1817
1195
}
1818
1196
 
1819
 
//------------------------------------RenderData.YafrayGIPhotonMixCount()
1820
1197
PyObject *RenderData_YafrayGIPhotonMixCount( BPy_RenderData * self,
1821
1198
                                             PyObject * args )
1822
1199
{
1827
1204
                                                    GImixphotons, 0, 1000 );
1828
1205
        } else
1829
1206
                return ( EXPP_ReturnPyObjError( PyExc_StandardError,
1830
 
                                                "YafrayGIMethod must be set to 'FULL' and GIPhotons must be enabled\n" ) );
 
1207
                                                "YafrayGIMethod must be set to 'FULL' and GIPhotons must be enabled" ) );
1831
1208
}
1832
1209
 
1833
 
//--------------------------RenderData.EnableYafrayGITunePhotons() ------
1834
1210
PyObject *RenderData_EnableYafrayGITunePhotons( BPy_RenderData * self,
1835
1211
                                                PyObject * args )
1836
1212
{
1844
1220
                                                "YafrayGIMethod must be set to 'FULL' and GIPhotons must be enabled" ) );
1845
1221
}
1846
1222
 
1847
 
//------------------------------------RenderData.YafrayGIShadowQuality() 
1848
1223
PyObject *RenderData_YafrayGIShadowQuality( BPy_RenderData * self,
1849
1224
                                            PyObject * args )
1850
1225
{
1856
1231
                                                      1.0f );
1857
1232
        } else
1858
1233
                return ( EXPP_ReturnPyObjError( PyExc_StandardError,
1859
 
                                                "YafrayGIMethod must be set to 'FULL' and GICache must be enabled\n" ) );
 
1234
                                                "YafrayGIMethod must be set to 'FULL' and GICache must be enabled" ) );
1860
1235
}
1861
1236
 
1862
 
//------------------------------------RenderData.YafrayGIPixelsPerSample()
1863
1237
PyObject *RenderData_YafrayGIPixelsPerSample( BPy_RenderData * self,
1864
1238
                                              PyObject * args )
1865
1239
{
1870
1244
                                                    GIpixelspersample, 1, 50 );
1871
1245
        } else
1872
1246
                return ( EXPP_ReturnPyObjError( PyExc_StandardError,
1873
 
                                                "YafrayGIMethod must be set to 'FULL' and GICache must be enabled\n" ) );
 
1247
                                                "YafrayGIMethod must be set to 'FULL' and GICache must be enabled" ) );
1874
1248
}
1875
1249
 
1876
 
//------------------------------------RenderData.YafrayGIRefinement() ----
1877
1250
PyObject *RenderData_YafrayGIRefinement( BPy_RenderData * self,
1878
1251
                                         PyObject * args )
1879
1252
{
1885
1258
                                                      1.0f );
1886
1259
        } else
1887
1260
                return ( EXPP_ReturnPyObjError( PyExc_StandardError,
1888
 
                                                "YafrayGIMethod must be set to 'FULL' and GICache must be enabled\n" ) );
 
1261
                                                "YafrayGIMethod must be set to 'FULL' and GICache must be enabled" ) );
1889
1262
}
1890
1263
 
1891
 
//------------------------------------RenderData.YafrayRayBias() ---------
1892
1264
PyObject *RenderData_YafrayRayBias( BPy_RenderData * self, PyObject * args )
1893
1265
{
1894
1266
        return M_Render_GetSetAttributeFloat( args,
1896
1268
                                              0.0f, 10.0f );
1897
1269
}
1898
1270
 
1899
 
//------------------------------------RenderData.YafrayRayDepth() --------
1900
1271
PyObject *RenderData_YafrayRayDepth( BPy_RenderData * self, PyObject * args )
1901
1272
{
1902
1273
        return M_Render_GetSetAttributeInt( args,
1904
1275
                                            1, 80 );
1905
1276
}
1906
1277
 
1907
 
//------------------------------------RenderData.YafrayGamma() -----------
1908
1278
PyObject *RenderData_YafrayGamma( BPy_RenderData * self, PyObject * args )
1909
1279
{
1910
1280
        return M_Render_GetSetAttributeFloat( args,
1912
1282
                                              0.001f, 5.0f );
1913
1283
}
1914
1284
 
1915
 
//------------------------------------RenderData.YafrayExposure() --------
1916
1285
PyObject *RenderData_YafrayExposure( BPy_RenderData * self, PyObject * args )
1917
1286
{
1918
1287
        return M_Render_GetSetAttributeFloat( args,
1920
1289
                                              YF_exposure, 0.0f, 10.0f );
1921
1290
}
1922
1291
 
1923
 
//------------------------------------RenderData.YafrayProcessorCount() --
1924
1292
PyObject *RenderData_YafrayProcessorCount( BPy_RenderData * self,
1925
1293
                                           PyObject * args )
1926
1294
{
1929
1297
                                            1, 8 );
1930
1298
}
1931
1299
 
1932
 
//------------------------------------RenderData.EnableGameFrameStretch() -----------------------------------------------------------
1933
1300
PyObject *RenderData_EnableGameFrameStretch( BPy_RenderData * self )
1934
1301
{
1935
1302
        self->scene->framing.type = SCE_GAMEFRAMING_SCALE;
1936
1303
        return EXPP_incr_ret( Py_None );
1937
1304
}
1938
1305
 
1939
 
//------------------------------------RenderData.EnableGameFrameExpose() -
1940
1306
PyObject *RenderData_EnableGameFrameExpose( BPy_RenderData * self )
1941
1307
{
1942
1308
        self->scene->framing.type = SCE_GAMEFRAMING_EXTEND;
1943
1309
        return EXPP_incr_ret( Py_None );
1944
1310
}
1945
1311
 
1946
 
//------------------------------------RenderData.EnableGameFrameBars() ---
1947
1312
PyObject *RenderData_EnableGameFrameBars( BPy_RenderData * self )
1948
1313
{
1949
1314
        self->scene->framing.type = SCE_GAMEFRAMING_BARS;
1950
1315
        return EXPP_incr_ret( Py_None );
1951
1316
}
1952
1317
 
1953
 
//------------------------------------RenderData.SetGameFrameColor() -----
1954
1318
PyObject *RenderData_SetGameFrameColor( BPy_RenderData * self,
1955
1319
                                        PyObject * args )
1956
1320
{
1979
1343
        return EXPP_incr_ret( Py_None );
1980
1344
}
1981
1345
 
1982
 
//------------------------------------RenderData.GetGameFrameColor() -----
1983
1346
PyObject *RenderData_GetGameFrameColor( BPy_RenderData * self )
1984
1347
{
1985
1348
        char rgb[24];
1986
1349
 
1987
 
        sprintf( rgb, "[%.3f,%.3f,%.3f]\n", self->scene->framing.col[0],
 
1350
        sprintf( rgb, "[%.3f,%.3f,%.3f]", self->scene->framing.col[0],
1988
1351
                 self->scene->framing.col[1], self->scene->framing.col[2] );
1989
1352
        return PyString_FromString( rgb );
1990
1353
}
1991
1354
 
1992
 
//------------------------------------RenderData.GammaLevel() ------------
1993
1355
PyObject *RenderData_GammaLevel( BPy_RenderData * self, PyObject * args )
1994
1356
{
1995
1357
        if( self->renderContext->mode & R_UNIFIED ) {
2001
1363
                                                "Unified Render must be enabled" ) );
2002
1364
}
2003
1365
 
2004
 
//------------------------------------RenderData.PostProcessAdd() --------
2005
1366
PyObject *RenderData_PostProcessAdd( BPy_RenderData * self, PyObject * args )
2006
1367
{
2007
1368
        if( self->renderContext->mode & R_UNIFIED ) {
2013
1374
                                                "Unified Render must be enabled" ) );
2014
1375
}
2015
1376
 
2016
 
//------------------------------------RenderData.PostProcessMultiply() ---
2017
1377
PyObject *RenderData_PostProcessMultiply( BPy_RenderData * self,
2018
1378
                                          PyObject * args )
2019
1379
{
2026
1386
                                                "Unified Render must be enabled" ) );
2027
1387
}
2028
1388
 
2029
 
//------------------------------------RenderData.PostProcessGamma() ------
2030
1389
PyObject *RenderData_PostProcessGamma( BPy_RenderData * self, PyObject * args )
2031
1390
{
2032
1391
        if( self->renderContext->mode & R_UNIFIED ) {
2038
1397
                                                "Unified Render must be enabled" ) );
2039
1398
}
2040
1399
 
2041
 
//------------------------------------RenderData.SGIMaxsize() ------------
 
1400
#ifdef __sgi
2042
1401
PyObject *RenderData_SGIMaxsize( BPy_RenderData * self, PyObject * args )
2043
1402
{
2044
 
#ifdef __sgi
2045
1403
        return M_Render_GetSetAttributeShort( args,
2046
1404
                                              &self->renderContext->maximsize,
2047
1405
                                              0, 500 );
2048
 
#else
2049
 
        return ( EXPP_ReturnPyObjError( PyExc_StandardError,
2050
 
                                        "SGI is not defined on this machine" ) );
2051
 
#endif
2052
1406
}
2053
1407
 
2054
 
//------------------------------------RenderData.EnableSGICosmo() --------
2055
 
PyObject *RenderData_EnableSGICosmo( BPy_RenderData * self, PyObject * args )
 
1408
PyObject *RenderData_EnableSGICosmo( BPy_RenderData *self, PyObject *args )
2056
1409
{
2057
 
#ifdef __sgi
2058
1410
        return M_Render_BitToggleInt( args, R_COSMO,
2059
1411
                                      &self->renderContext->mode );
 
1412
}
2060
1413
#else
2061
 
        return ( EXPP_ReturnPyObjError( PyExc_StandardError,
2062
 
                                        "SGI is not defined on this machine" ) );
 
1414
PyObject *RenderData_SGIMaxsize( void )
 
1415
{
 
1416
        return EXPP_ReturnPyObjError( PyExc_StandardError,
 
1417
                        "SGI is not defined on this machine" );
 
1418
}
 
1419
 
 
1420
PyObject *RenderData_EnableSGICosmo( void )
 
1421
{
 
1422
        return EXPP_ReturnPyObjError( PyExc_StandardError,
 
1423
                        "SGI is not defined on this machine" );
 
1424
}
2063
1425
#endif
2064
 
}
2065
1426
 
2066
 
//------------------------------------RenderData.OldMapValue() -----------
2067
1427
PyObject *RenderData_OldMapValue( BPy_RenderData * self, PyObject * args )
2068
1428
{
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;
2073
1433
        return tmp;
2074
1434
}
2075
1435
 
2076
 
//------------------------------------RenderData.NewMapValue() -----------
2077
1436
PyObject *RenderData_NewMapValue( BPy_RenderData * self, PyObject * args )
2078
1437
{
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;
2083
1442
        return tmp;
2084
1443
}
2085
1444
 
2086
 
//------------------------------------RenderData.getTimeCode() -----------
2087
 
PyObject *RenderData_getTimeCode( BPy_RenderData * self){
2088
 
    PyObject *ret = NULL;
 
1445
static PyObject *RenderData_getTimeCode( BPy_RenderData * self) {
2089
1446
    char tc[12];
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;
2092
1448
    
2093
1449
    fps = self->renderContext->frs_sec;
2094
1450
    cfa = self->renderContext->cfra-1;
2095
 
    fi =  cfa % fps;
2096
 
                    
2097
 
    hi   = (cfa) / (fps*60*60);
2098
 
    hold = (cfa) % (fps*60*60);     
2099
 
    mi   = hold / (fps*60);
2100
 
    hold = hold % (fps*60);
2101
 
    si   = hold / fps;
2102
 
    
2103
 
    if(hi > 99){
2104
 
        ret = PyString_FromString("Time Greater than 99 Hours!");       
2105
 
    }
2106
 
     else{
2107
 
        if(hi > 9)
2108
 
            sprintf(h,"%d",hi);
2109
 
        else
2110
 
            sprintf(h,"0%d",hi);
2111
 
        if(mi > 9)
2112
 
            sprintf(m,"%d",mi);
2113
 
        else
2114
 
            sprintf(m,"0%d",mi);            
2115
 
        if(si > 9)
2116
 
            sprintf(s,"%d",si);
2117
 
        else
2118
 
            sprintf(s,"0%d",si);
2119
 
        if(fi > 9)
2120
 
            sprintf(f,"%d",fi);
2121
 
        else
2122
 
            sprintf(f,"0%d",fi);
2123
 
            sprintf(tc,"%s:%s:%s:%s",h,m,s,f);
2124
 
        ret = PyString_FromString(tc);
2125
 
    } 
2126
 
    return ret;    
 
1451
        s = cfa / fps;
 
1452
        m = s / 60;
 
1453
        h = m / 60;
 
1454
    if( h > 99 )
 
1455
        return PyString_FromString("Time Greater than 99 Hours!");      
 
1456
 
 
1457
        sprintf( tc, "%02d:%02d:%02d:%02d", h%60, m%60, s%60, cfa%fps);
 
1458
        return PyString_FromString(tc);
2127
1459
}            
 
1460
 
 
1461
/***************************************************************************/
 
1462
/* generic handlers for getting/setting attributes                         */
 
1463
/***************************************************************************/
 
1464
 
 
1465
/*
 
1466
 * get floating point attributes
 
1467
 */
 
1468
 
 
1469
static PyObject *RenderData_getFloatAttr( BPy_RenderData *self, void *type )
 
1470
{
 
1471
        float param;
 
1472
 
 
1473
        switch( (int)type ) {
 
1474
        case EXPP_RENDER_ATTR_GAUSSFILTER:
 
1475
                param = self->renderContext->gauss;
 
1476
                break;
 
1477
        case EXPP_RENDER_ATTR_MBLURFACTOR:
 
1478
                param = self->renderContext->blurfac;
 
1479
                break;
 
1480
        default:
 
1481
                return EXPP_ReturnPyObjError( PyExc_RuntimeError,
 
1482
                                "undefined type constant in RenderData_getFloatAttr" );
 
1483
        }
 
1484
        return PyFloat_FromDouble( param );
 
1485
}
 
1486
 
 
1487
/*
 
1488
 * set floating point attributes which require clamping
 
1489
 */
 
1490
 
 
1491
static int RenderData_setFloatAttrClamp( BPy_RenderData *self, PyObject *value,
 
1492
                void *type )
 
1493
{
 
1494
        float *param;
 
1495
        float min, max;
 
1496
 
 
1497
        switch( (int)type ) {
 
1498
        case EXPP_RENDER_ATTR_GAUSSFILTER:
 
1499
                min = 0.5f;
 
1500
                max = 1.5f;
 
1501
                param = &self->renderContext->gauss;
 
1502
                break;
 
1503
        case EXPP_RENDER_ATTR_MBLURFACTOR:
 
1504
            min = 0.01f;
 
1505
                max = 5.0f;
 
1506
                param = &self->renderContext->blurfac;
 
1507
                break;
 
1508
        default:
 
1509
                return EXPP_ReturnIntError( PyExc_RuntimeError,
 
1510
                                "undefined type constant in RenderData_setFloatAttrClamp" );
 
1511
        }
 
1512
        return EXPP_setFloatClamped( value, param, min, max );
 
1513
}
 
1514
 
 
1515
/*
 
1516
 * get integer attributes
 
1517
 */
 
1518
 
 
1519
static PyObject *RenderData_getIValueAttr( BPy_RenderData *self, void *type )
 
1520
{
 
1521
        long param;
 
1522
 
 
1523
        switch( (int)type ) {
 
1524
        case EXPP_RENDER_ATTR_XPARTS:
 
1525
                param = (long)self->renderContext->xparts;
 
1526
                break;
 
1527
        case EXPP_RENDER_ATTR_YPARTS:
 
1528
                param = (long)self->renderContext->yparts;
 
1529
                break;
 
1530
        case EXPP_RENDER_ATTR_ASPECTX:
 
1531
                param = (long)self->renderContext->xasp;
 
1532
                break;
 
1533
        case EXPP_RENDER_ATTR_ASPECTY:
 
1534
                param = (long)self->renderContext->yasp;
 
1535
                break;
 
1536
        case EXPP_RENDER_ATTR_CFRAME:
 
1537
                param = (long)self->renderContext->cfra;
 
1538
                break;
 
1539
        case EXPP_RENDER_ATTR_EFRAME:
 
1540
                param = (long)self->renderContext->efra;
 
1541
                break;
 
1542
        case EXPP_RENDER_ATTR_SFRAME:
 
1543
                param = (long)self->renderContext->sfra;
 
1544
                break;
 
1545
        case EXPP_RENDER_ATTR_FPS:
 
1546
                param = self->renderContext->frs_sec;
 
1547
                break;
 
1548
        case EXPP_RENDER_ATTR_SIZEX:
 
1549
                param = self->renderContext->xsch;
 
1550
                break;
 
1551
        case EXPP_RENDER_ATTR_SIZEY:
 
1552
                param = self->renderContext->ysch;
 
1553
                break;
 
1554
        default:
 
1555
                return EXPP_ReturnPyObjError( PyExc_RuntimeError,
 
1556
                                "undefined type constant in RenderData_setIValueAttrClamp" );
 
1557
        }
 
1558
        return PyInt_FromLong( param );
 
1559
}
 
1560
 
 
1561
/*
 
1562
 * set integer attributes which require clamping
 
1563
 */
 
1564
 
 
1565
static int RenderData_setIValueAttrClamp( BPy_RenderData *self, PyObject *value,
 
1566
                void *type )
 
1567
{
 
1568
        void *param;
 
1569
        int min, max, size;
 
1570
 
 
1571
        switch( (int)type ) {
 
1572
        case EXPP_RENDER_ATTR_XPARTS:
 
1573
                min = 1;
 
1574
                max = 512;
 
1575
                size = 'h';
 
1576
                param = &self->renderContext->xparts;
 
1577
                break;
 
1578
        case EXPP_RENDER_ATTR_YPARTS:
 
1579
                min = 1;
 
1580
                max = 64;
 
1581
                size = 'h';
 
1582
                param = &self->renderContext->yparts;
 
1583
                break;
 
1584
        case EXPP_RENDER_ATTR_ASPECTX:
 
1585
                min = 1;
 
1586
                max = 200;
 
1587
                size = 'h';
 
1588
                param = &self->renderContext->xasp;
 
1589
                break;
 
1590
        case EXPP_RENDER_ATTR_ASPECTY:
 
1591
                min = 1;
 
1592
                max = 200;
 
1593
                size = 'h';
 
1594
                param = &self->renderContext->yasp;
 
1595
                break;
 
1596
        case EXPP_RENDER_ATTR_CFRAME:
 
1597
                min = 1;
 
1598
                max = MAXFRAME;
 
1599
                size = 'h';
 
1600
                param = &self->renderContext->cfra;
 
1601
                break;
 
1602
        case EXPP_RENDER_ATTR_EFRAME:
 
1603
                min = 1;
 
1604
                max = MAXFRAME;
 
1605
                size = 'h';
 
1606
                param = &self->renderContext->efra;
 
1607
                break;
 
1608
        case EXPP_RENDER_ATTR_SFRAME:
 
1609
                min = 1;
 
1610
            max = MAXFRAME;
 
1611
                size = 'h';
 
1612
                param = &self->renderContext->sfra;
 
1613
                break;
 
1614
        case EXPP_RENDER_ATTR_FPS:
 
1615
                min = 1;
 
1616
                max = 120;
 
1617
                size = 'h';
 
1618
                param = &self->renderContext->frs_sec;
 
1619
                break;
 
1620
        case EXPP_RENDER_ATTR_SIZEX:
 
1621
                min = 4;
 
1622
                max = 10000;
 
1623
                size = 'h';
 
1624
                param = &self->renderContext->xsch;
 
1625
                break;
 
1626
        case EXPP_RENDER_ATTR_SIZEY:
 
1627
                min = 4;
 
1628
                max = 10000;
 
1629
                size = 'h';
 
1630
                param = &self->renderContext->ysch;
 
1631
                break;
 
1632
        default:
 
1633
                return EXPP_ReturnIntError( PyExc_RuntimeError,
 
1634
                                "undefined type constant in RenderData_setIValueAttrClamp" );
 
1635
        }
 
1636
        return EXPP_setIValueClamped( value, param, min, max, size );
 
1637
}
 
1638
 
 
1639
/***************************************************************************/
 
1640
/* handlers for other getting/setting attributes                           */
 
1641
/***************************************************************************/
 
1642
 
 
1643
static PyObject *RenderData_getModeBit( BPy_RenderData *self, void* type )
 
1644
{
 
1645
        return EXPP_getBitfield( &self->renderContext->mode,
 
1646
                        (int)type, 'i' );
 
1647
}
 
1648
 
 
1649
static int RenderData_setModeBit( BPy_RenderData* self, PyObject *value,
 
1650
                void* type )
 
1651
{
 
1652
        return EXPP_setBitfield( value, &self->renderContext->mode,
 
1653
                        (int)type, 'i' );
 
1654
}
 
1655
 
 
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 )
 
1659
 
 
1660
static PyObject *RenderData_getMode( BPy_RenderData *self )
 
1661
{
 
1662
        return PyInt_FromLong( (long)(self->renderContext->mode & MODE_MASK) );
 
1663
}
 
1664
 
 
1665
static int RenderData_setMode( BPy_RenderData* self, PyObject *arg )
 
1666
{
 
1667
        int value;
 
1668
 
 
1669
        if( !PyInt_CheckExact( arg ) )
 
1670
                return EXPP_ReturnIntError( PyExc_TypeError,
 
1671
                                "expected int argument" );
 
1672
 
 
1673
        value = PyInt_AsLong( arg );
 
1674
        if( value & ~MODE_MASK )
 
1675
                return EXPP_ReturnIntError( PyExc_ValueError, 
 
1676
                                "unexpected bits set in argument" );
 
1677
 
 
1678
        self->renderContext->mode = (short)value;
 
1679
        EXPP_allqueue( REDRAWBUTSSCENE, 0 );
 
1680
 
 
1681
        return 0;
 
1682
}
 
1683
 
 
1684
static PyObject *RenderData_getSceModeBits( BPy_RenderData *self, void* type )
 
1685
{
 
1686
        return EXPP_getBitfield( &self->renderContext->scemode, (int)type, 'h' );
 
1687
}
 
1688
 
 
1689
static int RenderData_setSceModeBits( BPy_RenderData* self, PyObject *value,
 
1690
                void* type )
 
1691
{
 
1692
        return EXPP_setBitfield( value, &self->renderContext->scemode,
 
1693
                        (int)type, 'h' );
 
1694
}
 
1695
 
 
1696
static PyObject *RenderData_getSceMode( BPy_RenderData *self )
 
1697
{
 
1698
        return PyInt_FromLong ( (long)self->renderContext->scemode );
 
1699
}
 
1700
 
 
1701
static int RenderData_setSceMode( BPy_RenderData* self, PyObject *arg )
 
1702
{
 
1703
        int value;
 
1704
 
 
1705
        if( !PyInt_CheckExact( arg ) )
 
1706
                return EXPP_ReturnIntError( PyExc_TypeError,
 
1707
                                "expected int argument" );
 
1708
 
 
1709
        value = PyInt_AsLong( arg );
 
1710
        if( value & ~( R_EXTENSION | R_DOSEQ ) )
 
1711
                return EXPP_ReturnIntError( PyExc_ValueError, 
 
1712
                                "unexpected bits set in argument" );
 
1713
 
 
1714
        self->renderContext->scemode = (short)value;
 
1715
        EXPP_allqueue( REDRAWBUTSSCENE, 0 );
 
1716
 
 
1717
        return 0;
 
1718
}
 
1719
 
 
1720
static PyObject *RenderData_getFramingType( BPy_RenderData *self )
 
1721
{
 
1722
        return PyInt_FromLong( (long)self->scene->framing.type );
 
1723
}
 
1724
 
 
1725
static int RenderData_setFramingType( BPy_RenderData *self, PyObject *value )
 
1726
{
 
1727
        return EXPP_setIValueRange( value, &self->scene->framing.type,
 
1728
                        SCE_GAMEFRAMING_BARS, SCE_GAMEFRAMING_SCALE, 'b' );
 
1729
}
 
1730
 
 
1731
static PyObject *RenderData_getEdgeColor( BPy_RenderData * self )
 
1732
{
 
1733
        return Py_BuildValue( "[fff]", self->renderContext->edgeR,
 
1734
                        self->renderContext->edgeG, self->renderContext->edgeB );
 
1735
}
 
1736
 
 
1737
static int RenderData_setEdgeColor( BPy_RenderData * self, PyObject * args )
 
1738
{
 
1739
        float red, green, blue;
 
1740
 
 
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 );
 
1744
        else
 
1745
                Py_INCREF( args );
 
1746
 
 
1747
        if( !PyArg_ParseTuple( args, "fff", &red, &green, &blue ) ) {
 
1748
                Py_DECREF( args );
 
1749
                return EXPP_ReturnIntError( PyExc_TypeError, "expected three floats" );
 
1750
        }
 
1751
        Py_DECREF( args );
 
1752
 
 
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 );
 
1756
        return 0;
 
1757
}
 
1758
 
 
1759
static PyObject *RenderData_getOSALevel( BPy_RenderData * self )
 
1760
{
 
1761
        return PyInt_FromLong( (long)self->renderContext->osa );
 
1762
}
 
1763
 
 
1764
static PyObject *RenderData_getRenderer( BPy_RenderData * self )
 
1765
{
 
1766
        return PyInt_FromLong( (long)self->renderContext->renderer ); 
 
1767
}
 
1768
 
 
1769
static PyObject *RenderData_getImageType( BPy_RenderData * self )
 
1770
{
 
1771
        return PyInt_FromLong( (long) self->renderContext->imtype );
 
1772
}
 
1773
 
 
1774
static int RenderData_setGameFrameColor( BPy_RenderData * self,
 
1775
                PyObject * args )
 
1776
{
 
1777
        float red, green, blue;
 
1778
 
 
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 );
 
1782
        else
 
1783
                Py_INCREF( args );
 
1784
 
 
1785
        if( !PyArg_ParseTuple( args, "fff", &red, &green, &blue ) ) {
 
1786
                Py_DECREF( args );
 
1787
                return EXPP_ReturnIntError( PyExc_TypeError, "expected three floats" );
 
1788
        }
 
1789
        Py_DECREF( args );
 
1790
 
 
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 );
 
1794
        return 0;
 
1795
}
 
1796
 
 
1797
static PyObject *RenderData_getGameFrameColor( BPy_RenderData * self )
 
1798
{
 
1799
        return Py_BuildValue( "[fff]", self->scene->framing.col[0],
 
1800
                 self->scene->framing.col[1], self->scene->framing.col[2] );
 
1801
}
 
1802
 
 
1803
static PyObject *RenderData_getBackbuf( BPy_RenderData * self )
 
1804
{
 
1805
        return EXPP_getBitfield( &self->renderContext->bufflag,
 
1806
                        R_BACKBUF, 'h' );
 
1807
}
 
1808
 
 
1809
static int RenderData_setBackbuf( BPy_RenderData* self, PyObject *value )
 
1810
{
 
1811
        return EXPP_setBitfield( value, &self->renderContext->bufflag,
 
1812
                        R_BACKBUF, 'h' );
 
1813
}
 
1814
 
 
1815
static int RenderData_setImagePlanes( BPy_RenderData *self, PyObject *value )
 
1816
{
 
1817
        int depth;
 
1818
        char *errstr = "expected int argument of 8, 24, or 32";
 
1819
 
 
1820
        if( !PyInt_CheckExact( value ) )
 
1821
                return EXPP_ReturnIntError( PyExc_TypeError, errstr );
 
1822
 
 
1823
        depth = PyInt_AsLong( value );
 
1824
        if( depth != 8 && depth != 24 && depth != 32 )
 
1825
                return EXPP_ReturnIntError( PyExc_ValueError, errstr );
 
1826
 
 
1827
        self->renderContext->planes = (short)depth;
 
1828
 
 
1829
        return 0;
 
1830
}
 
1831
 
 
1832
static PyObject *RenderData_getImagePlanes( BPy_RenderData * self )
 
1833
{
 
1834
        return PyInt_FromLong( (long) self->renderContext->planes );
 
1835
}
 
1836
 
 
1837
static int RenderData_setAlphaMode( BPy_RenderData *self, PyObject *value )
 
1838
{
 
1839
        return EXPP_setIValueRange( value, &self->renderContext->alphamode,
 
1840
                        R_ADDSKY, R_ALPHAKEY, 'h' );
 
1841
}
 
1842
 
 
1843
static PyObject *RenderData_getAlphaMode( BPy_RenderData * self )
 
1844
{
 
1845
        return PyInt_FromLong( (long) self->renderContext->alphamode );
 
1846
}
 
1847
 
 
1848
static PyObject *RenderData_getDisplayMode( void )
 
1849
{
 
1850
        return PyInt_FromLong( (long) G.displaymode );
 
1851
}
 
1852
 
 
1853
static int RenderData_setDisplayMode( BPy_RenderData *self,
 
1854
                PyObject *value )
 
1855
{
 
1856
        return EXPP_setIValueRange( value, &G.displaymode,
 
1857
                        R_DISPLAYIMAGE, R_DISPLAYSCREEN, 'h' );
 
1858
}
 
1859
 
 
1860
static PyObject *RenderData_getRenderPath( BPy_RenderData * self )
 
1861
{
 
1862
        return PyString_FromString( self->renderContext->pic );
 
1863
}
 
1864
 
 
1865
static int RenderData_setRenderPath( BPy_RenderData * self, PyObject * value )
 
1866
{
 
1867
        char *name;
 
1868
 
 
1869
        name = PyString_AsString( value );
 
1870
        if( !name )
 
1871
                return EXPP_ReturnIntError( PyExc_TypeError,
 
1872
                                                "expected a string" );
 
1873
 
 
1874
        if( strlen( name ) >= sizeof(self->renderContext->pic) )
 
1875
                return EXPP_ReturnIntError( PyExc_ValueError,
 
1876
                                                "render path is too long" );
 
1877
 
 
1878
        strcpy( self->renderContext->pic, name );
 
1879
        EXPP_allqueue( REDRAWBUTSSCENE, 0 );
 
1880
 
 
1881
        return 0;
 
1882
}
 
1883
 
 
1884
PyObject *RenderData_getBackbufPath( BPy_RenderData * self )
 
1885
{
 
1886
        return PyString_FromString( self->renderContext->backbuf );
 
1887
}
 
1888
 
 
1889
static int RenderData_setBackbufPath( BPy_RenderData *self, PyObject *value )
 
1890
{
 
1891
        char *name;
 
1892
        Image *ima;
 
1893
 
 
1894
        name = PyString_AsString( value );
 
1895
        if( !name )
 
1896
                return EXPP_ReturnIntError( PyExc_TypeError, "expected a string" );
 
1897
 
 
1898
        if( strlen( name ) >= sizeof(self->renderContext->backbuf) )
 
1899
                return EXPP_ReturnIntError( PyExc_ValueError,
 
1900
                                "backbuf path is too long" );
 
1901
 
 
1902
        strcpy( self->renderContext->backbuf, name );
 
1903
        EXPP_allqueue( REDRAWBUTSSCENE, 0 );
 
1904
 
 
1905
        ima = add_image( name );
 
1906
        if( ima ) {
 
1907
                free_image_buffers( ima );
 
1908
                ima->ok = 1;
 
1909
        }
 
1910
 
 
1911
        return 0;
 
1912
}
 
1913
 
 
1914
PyObject *RenderData_getFtypePath( BPy_RenderData * self )
 
1915
{
 
1916
        return PyString_FromString( self->renderContext->ftype );
 
1917
}
 
1918
 
 
1919
static int RenderData_setFtypePath( BPy_RenderData *self, PyObject *value )
 
1920
{
 
1921
        char *name;
 
1922
 
 
1923
        name = PyString_AsString( value );
 
1924
        if( !name )
 
1925
                return EXPP_ReturnIntError( PyExc_TypeError, "expected a string" );
 
1926
 
 
1927
        if( strlen( name ) >= sizeof(self->renderContext->ftype) )
 
1928
                return EXPP_ReturnIntError( PyExc_ValueError,
 
1929
                                "ftype path is too long" );
 
1930
 
 
1931
        strcpy( self->renderContext->ftype, name );
 
1932
        EXPP_allqueue( REDRAWBUTSSCENE, 0 );
 
1933
 
 
1934
        return 0;
 
1935
}
 
1936
 
 
1937
PyObject *RenderData_getRenderWinSize( BPy_RenderData * self )
 
1938
{
 
1939
        return PyInt_FromLong( (long) self->renderContext->size );
 
1940
}
 
1941
 
 
1942
static int RenderData_setRenderWinSize( BPy_RenderData *self, PyObject *value )
 
1943
{
 
1944
        int size;
 
1945
        char *errstr = "expected int argument of 25, 50, 75, or 100";
 
1946
 
 
1947
        if( !PyInt_CheckExact( value ) )
 
1948
                return EXPP_ReturnIntError( PyExc_TypeError, errstr );
 
1949
 
 
1950
        size = PyInt_AsLong( value );
 
1951
        if( size != 25 && size != 50 && size != 75 && size != 100 )
 
1952
                return EXPP_ReturnIntError( PyExc_ValueError, errstr );
 
1953
 
 
1954
        self->renderContext->size = (short)size;
 
1955
        EXPP_allqueue( REDRAWBUTSSCENE, 0 );
 
1956
 
 
1957
        return 0;
 
1958
}
 
1959
 
 
1960
static PyObject *RenderData_getMapOld( BPy_RenderData *self )
 
1961
{
 
1962
        return PyInt_FromLong( (long)self->renderContext->framapto );
 
1963
}
 
1964
 
 
1965
static int RenderData_setMapOld( BPy_RenderData *self, PyObject *value )
 
1966
{
 
1967
        int result = EXPP_setIValueClamped( value, &self->renderContext->framapto,
 
1968
                        1, 900, 'h' );
 
1969
        self->renderContext->framelen =
 
1970
                (float)self->renderContext->framapto / self->renderContext->images;
 
1971
        return result;
 
1972
}
 
1973
 
 
1974
static PyObject *RenderData_getMapNew( BPy_RenderData *self )
 
1975
{
 
1976
        return PyInt_FromLong( (long)self->renderContext->images );
 
1977
}
 
1978
 
 
1979
static int RenderData_setMapNew( BPy_RenderData *self, PyObject *value )
 
1980
{
 
1981
        int result = EXPP_setIValueClamped( value, &self->renderContext->images,
 
1982
                        1, 900, 'h' );
 
1983
        self->renderContext->framelen =
 
1984
                (float)self->renderContext->framapto / self->renderContext->images;
 
1985
        return result;
 
1986
}
 
1987
 
 
1988
static PyObject *RenderData_getSet( BPy_RenderData *self )
 
1989
{
 
1990
        if( self->scene->set )
 
1991
                return Scene_CreatePyObject( self->scene->set );
 
1992
        Py_RETURN_NONE;
 
1993
}
 
1994
 
 
1995
static int RenderData_setSet( BPy_RenderData *self, PyObject *value )
 
1996
{
 
1997
        BPy_Scene *sc;
 
1998
 
 
1999
        /* if "None", delete the link to the scene */
 
2000
        if( value == Py_None ) {
 
2001
                self->scene->set = NULL;
 
2002
                return 0;
 
2003
        }
 
2004
 
 
2005
        /* be sure argument is a Scene */
 
2006
        if( !BPy_Scene_Check( value ) )
 
2007
                return EXPP_ReturnIntError( PyExc_TypeError,
 
2008
                                "expected Scene as argument" );
 
2009
 
 
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" );
 
2015
 
 
2016
        /*
 
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.
 
2019
         */
 
2020
 
 
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" );
 
2025
 
 
2026
        return 0;
 
2027
}
 
2028
 
 
2029
/***************************************************************************/
 
2030
/* BPy_RenderData attribute def                                            */
 
2031
/***************************************************************************/
 
2032
static PyGetSetDef BPy_RenderData_getseters[] = {
 
2033
        {"oversampling",
 
2034
         (getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
 
2035
         "Oversampling (anti-aliasing) enabled",
 
2036
         (void *)R_OSA},
 
2037
        {"shadow",
 
2038
         (getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
 
2039
         "Shadow calculation enabled",
 
2040
         (void *)R_SHADOW},
 
2041
        {"gammaCorrection",
 
2042
         (getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
 
2043
         "Gamma correction enabled",
 
2044
         (void *)R_GAMMA},
 
2045
/* R_ORTHO      unused */
 
2046
        {"environmentMap",
 
2047
         (getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
 
2048
         "Environment map rendering enabled",
 
2049
         (void *)R_ENVMAP},
 
2050
        {"toonShading",
 
2051
         (getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
 
2052
         "Toon edge shading enabled",
 
2053
         (void *)R_EDGE},
 
2054
        {"fieldRendering", 
 
2055
         (getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
 
2056
         "Field rendering enabled",
 
2057
         (void *)R_FIELDS},
 
2058
        {"fieldTimeDisable",
 
2059
         (getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
 
2060
         "Time difference in field calculations disabled ('X' in UI)",
 
2061
         (void *)R_FIELDSTILL},
 
2062
        {"radiosityRender",
 
2063
         (getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
 
2064
         "Radiosity rendering enabled",
 
2065
         (void *)R_RADIO},
 
2066
        {"borderRender",
 
2067
         (getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
 
2068
         "Small cut-out rendering enabled",
 
2069
         (void *)R_BORDER},
 
2070
        {"panorama",
 
2071
         (getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
 
2072
         "Panorama rendering enabled",
 
2073
         (void *)R_PANORAMA},
 
2074
        {"crop",
 
2075
         (getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
 
2076
         "Crop image during border renders",
 
2077
         (void *)R_CROP},
 
2078
/* R_COSMO      unsupported */
 
2079
        {"oddFieldFirst",
 
2080
         (getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
 
2081
         "Odd field first rendering enabled",
 
2082
         (void *)R_ODDFIELD},
 
2083
        {"motionBlur",
 
2084
         (getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
 
2085
         "Motion blur enabled",
 
2086
         (void *)R_MBLUR},
 
2087
        {"unified",
 
2088
         (getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
 
2089
         "Unified Renderer enabled",
 
2090
         (void *)R_UNIFIED},
 
2091
        {"rayTracing",
 
2092
         (getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
 
2093
         "Ray tracing enabled",
 
2094
         (void *)R_RAYTRACE},
 
2095
/* R_GAUSS unused */
 
2096
/* R_FBUF unused */
 
2097
        {"threads",
 
2098
         (getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
 
2099
         "Render in two threads enabled",
 
2100
         (void *)R_THREADS},
 
2101
/* R_SPEED unused */
 
2102
        {"mode",
 
2103
         (getter)RenderData_getMode, (setter)RenderData_setMode,
 
2104
         "Mode bitfield",
 
2105
         NULL},
 
2106
 
 
2107
        {"extensions",
 
2108
     (getter)RenderData_getSceModeBits, (setter)RenderData_setSceModeBits,
 
2109
     "Add extensions to output (when rendering animations) enabled",
 
2110
     (void *)R_EXTENSION},
 
2111
        {"sequencer",
 
2112
     (getter)RenderData_getSceModeBits, (setter)RenderData_setSceModeBits,
 
2113
     "'Do Sequence' enabled",
 
2114
     (void *)R_DOSEQ},
 
2115
        {"sceneMode",
 
2116
     (getter)RenderData_getSceMode, (setter)RenderData_setSceMode,
 
2117
     "Scene mode bitfield",
 
2118
     NULL},
 
2119
/* R_BG_RENDER unused */
 
2120
 
 
2121
        {"gameFrame",
 
2122
         (getter)RenderData_getFramingType, (setter)RenderData_setFramingType,
 
2123
         "Game framing type",
 
2124
         NULL},
 
2125
 
 
2126
        {"renderPath",
 
2127
         (getter)RenderData_getRenderPath, (setter)RenderData_setRenderPath,
 
2128
         "The path to output the rendered images to",
 
2129
         NULL},
 
2130
        {"backbufPath",
 
2131
         (getter)RenderData_getBackbufPath, (setter)RenderData_setBackbufPath,
 
2132
         "Path to a background image (setting loads image)",
 
2133
         NULL},
 
2134
        {"ftypePath",
 
2135
         (getter)RenderData_getFtypePath, (setter)RenderData_setFtypePath,
 
2136
         "The path to Ftype file",
 
2137
         NULL},
 
2138
        {"edgeColor",
 
2139
         (getter)RenderData_getEdgeColor, (setter)RenderData_setEdgeColor,
 
2140
         "RGB color triplet for edges in Toon shading (unified renderer)",
 
2141
         NULL},
 
2142
        {"OSALevel",
 
2143
         (getter)RenderData_getOSALevel, (setter)RenderData_setOSALevel,
 
2144
         "Oversampling (anti-aliasing) level",
 
2145
         NULL},
 
2146
        {"renderwinSize",
 
2147
         (getter)RenderData_getRenderWinSize, (setter)RenderData_setRenderWinSize,
 
2148
         "Size of the rendering window (25, 50, 75, or 100)",
 
2149
         NULL},
 
2150
        {"border",
 
2151
         (getter)RenderData_getBorder, (setter)RenderData_setBorder,
 
2152
         "The border for border rendering",
 
2153
         NULL},
 
2154
        {"timeCode",
 
2155
         (getter)RenderData_getTimeCode, (setter)NULL,
 
2156
         "Get the current frame in HH:MM:SS:FF format",
 
2157
         NULL},
 
2158
        {"renderer",
 
2159
         (getter)RenderData_getRenderer, (setter)RenderData_setRenderer,
 
2160
         "Rendering engine choice",
 
2161
         NULL},
 
2162
        {"imageType",
 
2163
         (getter)RenderData_getImageType, (setter)RenderData_setImageType,
 
2164
         "File format for saving images",
 
2165
         NULL},
 
2166
        {"gameFrameColor",
 
2167
         (getter)RenderData_getGameFrameColor,(setter)RenderData_setGameFrameColor,
 
2168
         "RGB color triplet for bars",
 
2169
         NULL},
 
2170
        {"backbuf",
 
2171
         (getter)RenderData_getBackbuf, (setter)RenderData_setBackbuf,
 
2172
         "Backbuffer image enabled",
 
2173
         NULL},
 
2174
        {"imagePlanes",
 
2175
         (getter)RenderData_getImagePlanes, (setter)RenderData_setImagePlanes,
 
2176
         "Image depth (8, 24, or 32 bits)",
 
2177
         NULL},
 
2178
        {"alphaMode",
 
2179
         (getter)RenderData_getAlphaMode, (setter)RenderData_setAlphaMode,
 
2180
         "Setting for sky/background.",
 
2181
         NULL},
 
2182
        {"displayMode",
 
2183
         (getter)RenderData_getDisplayMode, (setter)RenderData_setDisplayMode,
 
2184
         "Render output in separate window or 3D view",
 
2185
         NULL},
 
2186
 
 
2187
        {"xParts",
 
2188
         (getter)RenderData_getIValueAttr, (setter)RenderData_setIValueAttrClamp,
 
2189
         "Number of horizontal parts for image render",
 
2190
         (void *)EXPP_RENDER_ATTR_XPARTS},
 
2191
        {"yParts",
 
2192
         (getter)RenderData_getIValueAttr, (setter)RenderData_setIValueAttrClamp,
 
2193
         "Number of vertical parts for image render",
 
2194
         (void *)EXPP_RENDER_ATTR_YPARTS},
 
2195
        {"aspectX",
 
2196
         (getter)RenderData_getIValueAttr, (setter)RenderData_setIValueAttrClamp,
 
2197
         "Horizontal aspect ratio",
 
2198
         (void *)EXPP_RENDER_ATTR_ASPECTX},
 
2199
        {"aspectY",
 
2200
         (getter)RenderData_getIValueAttr, (setter)RenderData_setIValueAttrClamp,
 
2201
         "Vertical aspect ratio",
 
2202
         (void *)EXPP_RENDER_ATTR_ASPECTY},
 
2203
        {"cFrame",
 
2204
         (getter)RenderData_getIValueAttr, (setter)RenderData_setIValueAttrClamp,
 
2205
         "The current frame for rendering",
 
2206
         (void *)EXPP_RENDER_ATTR_CFRAME},
 
2207
        {"sFrame",
 
2208
         (getter)RenderData_getIValueAttr, (setter)RenderData_setIValueAttrClamp,
 
2209
         "Starting frame for rendering",
 
2210
         (void *)EXPP_RENDER_ATTR_SFRAME},
 
2211
        {"eFrame",
 
2212
         (getter)RenderData_getIValueAttr, (setter)RenderData_setIValueAttrClamp,
 
2213
         "Ending frame for rendering",
 
2214
         (void *)EXPP_RENDER_ATTR_EFRAME},
 
2215
        {"fps",
 
2216
         (getter)RenderData_getIValueAttr, (setter)RenderData_setIValueAttrClamp,
 
2217
         "Frames per second",
 
2218
         (void *)EXPP_RENDER_ATTR_FPS},
 
2219
        {"sizeX",
 
2220
         (getter)RenderData_getIValueAttr, (setter)RenderData_setIValueAttrClamp,
 
2221
         "Image width (in pixels)",
 
2222
         (void *)EXPP_RENDER_ATTR_SIZEX},
 
2223
        {"sizeY",
 
2224
         (getter)RenderData_getIValueAttr, (setter)RenderData_setIValueAttrClamp,
 
2225
         "Image height (in pixels)",
 
2226
         (void *)EXPP_RENDER_ATTR_SIZEY},
 
2227
 
 
2228
        {"gaussFilter",
 
2229
         (getter)RenderData_getFloatAttr, (setter)RenderData_setFloatAttrClamp,
 
2230
         "Gauss filter size",
 
2231
         (void *)EXPP_RENDER_ATTR_GAUSSFILTER},
 
2232
        {"mblurFactor",
 
2233
         (getter)RenderData_getFloatAttr, (setter)RenderData_setFloatAttrClamp,
 
2234
         "Motion blur factor",
 
2235
         (void *)EXPP_RENDER_ATTR_MBLURFACTOR},
 
2236
        {"mapOld",
 
2237
         (getter)RenderData_getMapOld, (setter)RenderData_setMapOld,
 
2238
         "Number of frames the Map Old will last",
 
2239
         NULL},
 
2240
        {"mapNew",
 
2241
         (getter)RenderData_getMapNew, (setter)RenderData_setMapNew,
 
2242
         "New mapping value (in frames)",
 
2243
         NULL},
 
2244
        {"set",
 
2245
         (getter)RenderData_getSet, (setter)RenderData_setSet,
 
2246
         "Scene link 'set' value",
 
2247
         NULL},
 
2248
        {NULL,NULL,NULL,NULL,NULL}
 
2249
};
 
2250
 
 
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,
 
2264
         METH_VARARGS,
 
2265
         "(string) - get/set the path to output the rendered images to"},
 
2266
        {"getRenderPath", ( PyCFunction ) RenderData_getRenderPath,
 
2267
         METH_NOARGS,
 
2268
         "() - get the path to directory where rendered images will go"},
 
2269
        {"setBackbufPath", ( PyCFunction ) RenderData_SetBackbufPath,
 
2270
         METH_VARARGS,
 
2271
         "(string) - get/set the path to a background image and load it"},
 
2272
        {"getBackbufPath", ( PyCFunction ) RenderData_getBackbufPath,
 
2273
         METH_NOARGS,
 
2274
         "() - get the path to background image file"},
 
2275
        {"enableBackbuf", ( PyCFunction ) RenderData_EnableBackbuf,
 
2276
         METH_VARARGS,
 
2277
         "(bool) - enable/disable the backbuf image"},
 
2278
        {"enableThreads", ( PyCFunction ) RenderData_EnableThreads,
 
2279
         METH_VARARGS,
 
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,
 
2286
         METH_VARARGS,
 
2287
         "(bool) - enable/disable windows extensions for output files"},
 
2288
        {"enableSequencer", ( PyCFunction ) RenderData_EnableSequencer,
 
2289
         METH_VARARGS,
 
2290
         "(bool) - enable/disable Do Sequence"},
 
2291
        {"enableRenderDaemon", ( PyCFunction ) RenderData_EnableRenderDaemon,
 
2292
         METH_VARARGS,
 
2293
         "(bool) - enable/disable Scene daemon"},
 
2294
        {"enableToonShading", ( PyCFunction ) RenderData_EnableToonShading,
 
2295
         METH_VARARGS,
 
2296
         "(bool) - enable/disable Edge rendering"},
 
2297
        {"edgeIntensity", ( PyCFunction ) RenderData_EdgeIntensity,
 
2298
         METH_VARARGS,
 
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,
 
2305
         METH_VARARGS,
 
2306
         "(int) - with the unified renderer to reduce intensity on boundaries."},
 
2307
        {"enableOversampling", ( PyCFunction ) RenderData_EnableOversampling,
 
2308
         METH_VARARGS,
 
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,
 
2314
         METH_VARARGS,
 
2315
         "(bool) - enable/disable MBlur."},
 
2316
        {"motionBlurLevel", ( PyCFunction ) RenderData_MotionBlurLevel,
 
2317
         METH_VARARGS,
 
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,
 
2326
         METH_NOARGS,
 
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,
 
2333
         METH_VARARGS,
 
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,
 
2339
         METH_VARARGS,
 
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,
 
2345
         METH_NOARGS,
 
2346
         "() - get the size of the render window"},
 
2347
        {"setRenderWinSize", ( PyCFunction ) RenderData_SetRenderWinSize,
 
2348
         METH_VARARGS,
 
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,
 
2354
         METH_VARARGS,
 
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,
 
2360
         METH_VARARGS,
 
2361
         "(bool) - enable/disable Gauss sampling filter for antialiasing"},
 
2362
        {"enableBorderRender", ( PyCFunction ) RenderData_EnableBorderRender,
 
2363
         METH_VARARGS,
 
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,
 
2371
         METH_VARARGS,
 
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,
 
2392
         METH_VARARGS,
 
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,
 
2401
         METH_NOARGS,
 
2402
         "() - images are saved with BW (grayscale) data"},
 
2403
        {"enableRGBColor", ( PyCFunction ) RenderData_EnableRGBColor,
 
2404
         METH_NOARGS,
 
2405
         "() - images are saved with RGB (color) data"},
 
2406
        {"enableRGBAColor", ( PyCFunction ) RenderData_EnableRGBAColor,
 
2407
         METH_NOARGS,
 
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,
 
2415
         METH_VARARGS,
 
2416
         "(enum) - get/set yafray global Illumination quality"},
 
2417
        {"setYafrayGIMethod", ( PyCFunction ) RenderData_SetYafrayGIMethod,
 
2418
         METH_VARARGS,
 
2419
         "(enum) - get/set yafray global Illumination method"},
 
2420
        {"yafrayGIPower", ( PyCFunction ) RenderData_YafrayGIPower,
 
2421
         METH_VARARGS,
 
2422
         "(float) - get/set GI lighting intensity scale"},
 
2423
        {"yafrayGIIndirPower", ( PyCFunction ) RenderData_YafrayGIIndirPower,
 
2424
         METH_VARARGS,
 
2425
         "(float) - get/set GI indifect lighting intensity scale"},
 
2426
        {"yafrayGIDepth", ( PyCFunction ) RenderData_YafrayGIDepth,
 
2427
         METH_VARARGS,
 
2428
         "(int) - get/set number of bounces of the indirect light"},
 
2429
        {"yafrayGICDepth", ( PyCFunction ) RenderData_YafrayGICDepth,
 
2430
         METH_VARARGS,
 
2431
         "(int) - get/set number of bounces inside objects (for caustics)"},
 
2432
        {"enableYafrayGICache", ( PyCFunction ) RenderData_EnableYafrayGICache,
 
2433
         METH_VARARGS,
 
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,
 
2439
         METH_VARARGS,
 
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,
 
2457
         METH_VARARGS,
 
2458
         "(float) - get/setthreshold to refine shadows EXPERIMENTAL. 1 = no refinement"},
 
2459
        {"yafrayRayBias", ( PyCFunction ) RenderData_YafrayRayBias,
 
2460
         METH_VARARGS,
 
2461
         "(float) - get/set shadow ray bias to avoid self shadowing"},
 
2462
        {"yafrayRayDepth", ( PyCFunction ) RenderData_YafrayRayDepth,
 
2463
         METH_VARARGS,
 
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,
 
2468
         METH_VARARGS,
 
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,
 
2480
         METH_NOARGS,
 
2481
         "() - enable show the entire viewport in the display window, using bar horizontally or vertically"},
 
2482
        {"setGameFrameColor", ( PyCFunction ) RenderData_SetGameFrameColor,
 
2483
         METH_VARARGS,
 
2484
         "(f,f,f) - set the red, green, blue component of the bars"},
 
2485
        {"getGameFrameColor", ( PyCFunction ) RenderData_GetGameFrameColor,
 
2486
         METH_NOARGS,
 
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,
 
2491
         METH_VARARGS,
 
2492
         "(float) - get/set post processing add"},
 
2493
        {"postProcessMultiply", ( PyCFunction ) RenderData_PostProcessMultiply,
 
2494
         METH_VARARGS,
 
2495
         "(float) - get/set post processing multiply"},
 
2496
        {"postProcessGamma", ( PyCFunction ) RenderData_PostProcessGamma,
 
2497
         METH_VARARGS,
 
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,
 
2502
         METH_VARARGS,
 
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}
 
2509
};
 
2510
 
 
2511
/*------------------------------------BPy_RenderData Type defintion------ */
 
2512
PyTypeObject RenderData_Type = {
 
2513
        PyObject_HEAD_INIT( NULL )  /* required py macro */
 
2514
        0,                          /* ob_size */
 
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 */
 
2519
 
 
2520
        /* Methods to implement standard operations */
 
2521
 
 
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; */
 
2528
 
 
2529
        /* Method suites for standard classes */
 
2530
 
 
2531
        NULL,                       /* PyNumberMethods *tp_as_number; */
 
2532
        NULL,                       /* PySequenceMethods *tp_as_sequence; */
 
2533
        NULL,                       /* PyMappingMethods *tp_as_mapping; */
 
2534
 
 
2535
        /* More standard operations (here for binary compatibility) */
 
2536
 
 
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; */
 
2542
 
 
2543
        /* Functions to access object as input/output buffer */
 
2544
        NULL,                       /* PyBufferProcs *tp_as_buffer; */
 
2545
 
 
2546
  /*** Flags to define presence of optional/expanded features ***/
 
2547
        Py_TPFLAGS_DEFAULT,         /* long tp_flags; */
 
2548
 
 
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; */
 
2553
 
 
2554
        /* delete references to contained objects */
 
2555
        NULL,                       /* inquiry tp_clear; */
 
2556
 
 
2557
  /***  Assigned meaning in release 2.1 ***/
 
2558
  /*** rich comparisons ***/
 
2559
        NULL,                       /* richcmpfunc tp_richcompare; */
 
2560
 
 
2561
  /***  weak reference enabler ***/
 
2562
        0,                          /* long tp_weaklistoffset; */
 
2563
 
 
2564
  /*** Added in release 2.2 ***/
 
2565
        /*   Iterators */
 
2566
        NULL,                       /* getiterfunc tp_iter; */
 
2567
        NULL,                       /* iternextfunc tp_iternext; */
 
2568
 
 
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; */
 
2591
        NULL
 
2592
};
 
2593
 
 
2594
/***************************************************************************/
 
2595
/* Render method def                                                       */
 
2596
/***************************************************************************/
 
2597
struct PyMethodDef M_Render_methods[] = {
 
2598
        {"CloseRenderWindow", ( PyCFunction ) M_Render_CloseRenderWindow,
 
2599
         METH_NOARGS,
 
2600
         "() - close the rendering window"},
 
2601
        {"EnableDispView", ( PyCFunction ) M_Render_EnableDispView,
 
2602
         METH_NOARGS,
 
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,
 
2607
         METH_VARARGS,
 
2608
         "([string list]) - position the rendering window in around the edge of the screen"},
 
2609
        {"EnableEdgeShift", ( PyCFunction ) M_Render_EnableEdgeShift,
 
2610
         METH_VARARGS,
 
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}
 
2615
};
 
2616
 
 
2617
static PyObject *M_Render_ModesDict( void )
 
2618
{
 
2619
        PyObject *M = PyConstant_New(  );
 
2620
 
 
2621
        if( M ) {
 
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 ) );
 
2639
        }
 
2640
        return M;
 
2641
}
 
2642
 
 
2643
static PyObject *M_Render_SceModesDict( void )
 
2644
{
 
2645
        PyObject *M = PyConstant_New(  );
 
2646
 
 
2647
        if( M ) {
 
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 ) );
 
2651
        }
 
2652
        return M;
 
2653
}
 
2654
 
 
2655
static PyObject *M_Render_GameFramingDict( void )
 
2656
{
 
2657
        PyObject *M = PyConstant_New(  );
 
2658
 
 
2659
        if( M ) {
 
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 ) );
 
2667
        }
 
2668
        return M;
 
2669
}
 
2670
 
 
2671
/***************************************************************************/
 
2672
/* Render Module Init                                                      */
 
2673
/***************************************************************************/
 
2674
PyObject *Render_Init( void )
 
2675
{
 
2676
        PyObject *submodule;
 
2677
        PyObject *ModesDict = M_Render_ModesDict( );
 
2678
        PyObject *SceModesDict = M_Render_SceModesDict( );
 
2679
        PyObject *GFramingDict = M_Render_GameFramingDict( );
 
2680
 
 
2681
        if( PyType_Ready( &RenderData_Type ) < 0 )
 
2682
                return NULL;
 
2683
 
 
2684
        submodule = Py_InitModule3( "Blender.Scene.Render",
 
2685
                                    M_Render_methods, M_Render_doc );
 
2686
 
 
2687
        if( ModesDict )
 
2688
                PyModule_AddObject( submodule, "Modes", ModesDict );
 
2689
        if( SceModesDict )
 
2690
                PyModule_AddObject( submodule, "SceModes", SceModesDict );
 
2691
        if( GFramingDict )
 
2692
                PyModule_AddObject( submodule, "FramingModes", GFramingDict );
 
2693
 
 
2694
        /* ugh: why aren't these in a constant dict? */
 
2695
 
 
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 );
 
2733
 
 
2734
        return ( submodule );
 
2735
}
 
2736
 
 
2737
/***************************************************************************/
 
2738
/* BPy_RenderData Callbacks                                                */
 
2739
/***************************************************************************/
 
2740
 
 
2741
PyObject *RenderData_CreatePyObject( struct Scene * scene )
 
2742
{
 
2743
        BPy_RenderData *py_renderdata;
 
2744
 
 
2745
        py_renderdata =
 
2746
                ( BPy_RenderData * ) PyObject_NEW( BPy_RenderData,
 
2747
                                                   &RenderData_Type );
 
2748
 
 
2749
        if( py_renderdata == NULL ) {
 
2750
                return ( NULL );
 
2751
        }
 
2752
        py_renderdata->renderContext = &scene->r;
 
2753
        py_renderdata->scene = scene;
 
2754
 
 
2755
        return ( ( PyObject * ) py_renderdata );
 
2756
}
 
2757
 
 
2758
int RenderData_CheckPyObject( PyObject * py_obj )
 
2759
{
 
2760
        return ( py_obj->ob_type == &RenderData_Type );
 
2761
}
 
2762
 
 
2763
/* #####DEPRECATED###### */
 
2764
 
 
2765
static PyObject *RenderData_SetRenderPath( BPy_RenderData *self,
 
2766
                PyObject *args )
 
2767
{
 
2768
        return EXPP_setterWrapper( (void *)self, args,
 
2769
                        (setter)RenderData_setRenderPath );
 
2770
}
 
2771
 
 
2772
static PyObject *RenderData_SetBackbufPath( BPy_RenderData *self,
 
2773
                PyObject *args )
 
2774
{
 
2775
        return EXPP_setterWrapper( (void *)self, args,
 
2776
                        (setter)RenderData_setBackbufPath );
 
2777
}
 
2778
 
 
2779
static PyObject *RenderData_SetFtypePath( BPy_RenderData *self,
 
2780
                PyObject *args )
 
2781
{
 
2782
        return EXPP_setterWrapperTuple( (void *)self, args,
 
2783
                        (setter)RenderData_setFtypePath );
 
2784
}
 
2785
 
 
2786
static PyObject *RenderData_SetOversamplingLevel( BPy_RenderData * self,
 
2787
                PyObject * args )
 
2788
{
 
2789
        return EXPP_setterWrapper( (void *)self, args,
 
2790
                        (setter)RenderData_setOSALevel );
 
2791
}
 
2792
 
 
2793
static PyObject *RenderData_SetRenderWinSize( BPy_RenderData * self,
 
2794
                PyObject * args )
 
2795
{
 
2796
        return EXPP_setterWrapper( (void *)self, args,
 
2797
                        (setter)RenderData_setRenderWinSize );
 
2798
}
 
2799
 
 
2800
static PyObject *RenderData_SetBorder( BPy_RenderData * self,
 
2801
                PyObject * args )
 
2802
{
 
2803
        return EXPP_setterWrapperTuple( (void *)self, args,
 
2804
                        (setter)RenderData_setBorder );
 
2805
}
 
2806
 
 
2807
static PyObject *RenderData_SetRenderer( BPy_RenderData * self,
 
2808
                PyObject * args )
 
2809
{
 
2810
        return EXPP_setterWrapper( (void *)self, args,
 
2811
                        (setter)RenderData_setRenderer );
 
2812
}
 
2813
 
 
2814
static PyObject *RenderData_SetImageType( BPy_RenderData * self,
 
2815
                PyObject * args )
 
2816
{
 
2817
        return EXPP_setterWrapper( (void *)self, args,
 
2818
                        (setter)RenderData_setImageType );
 
2819
}