Cycles: svn merge -r41225:41232 ^/trunk/blender
[blender.git] / source / blender / makesrna / intern / rna_render.c
1 /*
2  * ***** BEGIN GPL LICENSE BLOCK *****
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  * Contributor(s): Blender Foundation (2009)
19  *
20  * ***** END GPL LICENSE BLOCK *****
21  */
22
23 /** \file blender/makesrna/intern/rna_render.c
24  *  \ingroup RNA
25  */
26
27
28 #include <stdlib.h>
29
30 #include "DNA_scene_types.h"
31
32 #include "RNA_define.h"
33 #include "RNA_enum_types.h"
34
35 #include "rna_internal.h"
36
37 #include "RE_engine.h"
38 #include "RE_pipeline.h"
39
40 #include "BKE_utildefines.h"
41
42 #ifdef RNA_RUNTIME
43
44 #include "MEM_guardedalloc.h"
45
46 #include "RNA_access.h"
47
48 #include "BKE_context.h"
49 #include "BKE_report.h"
50
51 void engine_tag_redraw(RenderEngine *engine)
52 {
53         engine->do_draw = 1;
54 }
55
56 void engine_tag_update(RenderEngine *engine)
57 {
58         engine->do_update = 1;
59 }
60
61 /* RenderEngine Callbacks */
62
63 static void engine_update(RenderEngine *engine, Main *bmain, Scene *scene)
64 {
65         extern FunctionRNA rna_RenderEngine_update_func;
66         PointerRNA ptr;
67         ParameterList list;
68         FunctionRNA *func;
69
70         RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr);
71         func= &rna_RenderEngine_update_func;
72
73         RNA_parameter_list_create(&list, &ptr, func);
74         RNA_parameter_set_lookup(&list, "data", &bmain);
75         RNA_parameter_set_lookup(&list, "scene", &scene);
76         engine->type->ext.call(NULL, &ptr, func, &list);
77
78         RNA_parameter_list_free(&list);
79 }
80
81 static void engine_render(RenderEngine *engine)
82 {
83         extern FunctionRNA rna_RenderEngine_render_func;
84         PointerRNA ptr;
85         ParameterList list;
86         FunctionRNA *func;
87
88         RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr);
89         func= &rna_RenderEngine_render_func;
90
91         RNA_parameter_list_create(&list, &ptr, func);
92         engine->type->ext.call(NULL, &ptr, func, &list);
93
94         RNA_parameter_list_free(&list);
95 }
96
97 static void engine_preview_update(RenderEngine *engine, const struct bContext *context, struct ID *id)
98 {
99         extern FunctionRNA rna_RenderEngine_preview_update_func;
100         PointerRNA ptr;
101         ParameterList list;
102         FunctionRNA *func;
103
104         RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr);
105         func= &rna_RenderEngine_preview_update_func;
106
107         RNA_parameter_list_create(&list, &ptr, func);
108         RNA_parameter_set_lookup(&list, "context", &context);
109         RNA_parameter_set_lookup(&list, "id", &id);
110         engine->type->ext.call(NULL, &ptr, func, &list);
111
112         RNA_parameter_list_free(&list);
113 }
114
115 static void engine_preview_render(RenderEngine *engine)
116 {
117         extern FunctionRNA rna_RenderEngine_preview_render_func;
118
119         PointerRNA ptr;
120         ParameterList list;
121         FunctionRNA *func;
122
123         RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr);
124         func= &rna_RenderEngine_preview_render_func;
125
126         RNA_parameter_list_create(&list, &ptr, func);
127         engine->type->ext.call(NULL, &ptr, func, &list);
128
129         RNA_parameter_list_free(&list);
130 }
131
132 static void engine_view_update(RenderEngine *engine, const struct bContext *context)
133 {
134         extern FunctionRNA rna_RenderEngine_view_update_func;
135         PointerRNA ptr;
136         ParameterList list;
137         FunctionRNA *func;
138
139         RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr);
140         func= &rna_RenderEngine_view_update_func;
141
142         RNA_parameter_list_create(&list, &ptr, func);
143         RNA_parameter_set_lookup(&list, "context", &context);
144         engine->type->ext.call(NULL, &ptr, func, &list);
145
146         RNA_parameter_list_free(&list);
147 }
148
149 static void engine_view_draw(RenderEngine *engine, const struct bContext *context)
150 {
151         extern FunctionRNA rna_RenderEngine_view_draw_func;
152         PointerRNA ptr;
153         ParameterList list;
154         FunctionRNA *func;
155
156         RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr);
157         func= &rna_RenderEngine_view_draw_func;
158
159         RNA_parameter_list_create(&list, &ptr, func);
160         RNA_parameter_set_lookup(&list, "context", &context);
161         engine->type->ext.call(NULL, &ptr, func, &list);
162
163         RNA_parameter_list_free(&list);
164 }
165
166 /* RenderEngine registration */
167
168 static void rna_RenderEngine_unregister(Main *UNUSED(bmain), StructRNA *type)
169 {
170         RenderEngineType *et= RNA_struct_blender_type_get(type);
171
172         if(!et)
173                 return;
174         
175         RNA_struct_free_extension(type, &et->ext);
176         BLI_freelinkN(&R_engines, et);
177         RNA_struct_free(&BLENDER_RNA, type);
178 }
179
180 static StructRNA *rna_RenderEngine_register(Main *bmain, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
181 {
182         RenderEngineType *et, dummyet = {NULL};
183         RenderEngine dummyengine= {NULL};
184         PointerRNA dummyptr;
185         int have_function[6];
186
187         /* setup dummy engine & engine type to store static properties in */
188         dummyengine.type= &dummyet;
189         RNA_pointer_create(NULL, &RNA_RenderEngine, &dummyengine, &dummyptr);
190
191         /* validate the python class */
192         if(validate(&dummyptr, data, have_function) != 0)
193                 return NULL;
194
195         if(strlen(identifier) >= sizeof(dummyet.idname)) {
196                 BKE_reportf(reports, RPT_ERROR, "registering render engine class: '%s' is too long, maximum length is %d",
197                                                 identifier, (int)sizeof(dummyet.idname));
198                 return NULL;
199         }
200
201         /* check if we have registered this engine type before, and remove it */
202         for(et=R_engines.first; et; et=et->next) {
203                 if(strcmp(et->idname, dummyet.idname) == 0) {
204                         if(et->ext.srna)
205                                 rna_RenderEngine_unregister(bmain, et->ext.srna);
206                         break;
207                 }
208         }
209         
210         /* create a new engine type */
211         et= MEM_callocN(sizeof(RenderEngineType), "python render engine");
212         memcpy(et, &dummyet, sizeof(dummyet));
213
214         et->ext.srna= RNA_def_struct(&BLENDER_RNA, et->idname, "RenderEngine"); 
215         et->ext.data= data;
216         et->ext.call= call;
217         et->ext.free= free;
218         RNA_struct_blender_type_set(et->ext.srna, et);
219
220         et->update= (have_function[0])? engine_update: NULL;
221         et->render= (have_function[1])? engine_render: NULL;
222         et->preview_update= (have_function[2])? engine_preview_update: NULL;
223         et->preview_render= (have_function[3])? engine_preview_render: NULL;
224         et->view_update= (have_function[4])? engine_view_update: NULL;
225         et->view_draw= (have_function[5])? engine_view_draw: NULL;
226
227         BLI_addtail(&R_engines, et);
228
229         return et->ext.srna;
230 }
231
232 static void **rna_RenderEngine_instance(PointerRNA *ptr)
233 {
234         RenderEngine *engine = ptr->data;
235         return &engine->py_instance;
236 }
237
238 static StructRNA* rna_RenderEngine_refine(PointerRNA *ptr)
239 {
240         RenderEngine *engine= (RenderEngine*)ptr->data;
241         return (engine->type && engine->type->ext.srna)? engine->type->ext.srna: &RNA_RenderEngine;
242 }
243
244 static void rna_RenderResult_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
245 {
246         RenderResult *rr= (RenderResult*)ptr->data;
247         rna_iterator_listbase_begin(iter, &rr->layers, NULL);
248 }
249
250 static void rna_RenderLayer_passes_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
251 {
252         RenderLayer *rl= (RenderLayer*)ptr->data;
253         rna_iterator_listbase_begin(iter, &rl->passes, NULL);
254 }
255
256 static int rna_RenderLayer_rect_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
257 {
258         RenderLayer *rl= (RenderLayer*)ptr->data;
259
260         length[0]= rl->rectx*rl->recty;
261         length[1]= 4;
262
263         return length[0]*length[1];
264 }
265
266 static void rna_RenderLayer_rect_get(PointerRNA *ptr, float *values)
267 {
268         RenderLayer *rl= (RenderLayer*)ptr->data;
269         memcpy(values, rl->rectf, sizeof(float)*rl->rectx*rl->recty*4);
270 }
271
272 void rna_RenderLayer_rect_set(PointerRNA *ptr, const float *values)
273 {
274         RenderLayer *rl= (RenderLayer*)ptr->data;
275         memcpy(rl->rectf, values, sizeof(float)*rl->rectx*rl->recty*4);
276 }
277
278 static int rna_RenderPass_rect_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
279 {
280         RenderPass *rpass= (RenderPass*)ptr->data;
281
282         length[0]= rpass->rectx*rpass->recty;
283         length[1]= rpass->channels;
284
285         return length[0]*length[1];
286 }
287
288 static void rna_RenderPass_rect_get(PointerRNA *ptr, float *values)
289 {
290         RenderPass *rpass= (RenderPass*)ptr->data;
291         memcpy(values, rpass->rect, sizeof(float)*rpass->rectx*rpass->recty*rpass->channels);
292 }
293
294 void rna_RenderPass_rect_set(PointerRNA *ptr, const float *values)
295 {
296         RenderPass *rpass= (RenderPass*)ptr->data;
297         memcpy(rpass->rect, values, sizeof(float)*rpass->rectx*rpass->recty*rpass->channels);
298 }
299
300 #else // RNA_RUNTIME
301
302 static void rna_def_render_engine(BlenderRNA *brna)
303 {
304         StructRNA *srna;
305         PropertyRNA *prop;
306         FunctionRNA *func;
307         
308         srna= RNA_def_struct(brna, "RenderEngine", NULL);
309         RNA_def_struct_sdna(srna, "RenderEngine");
310         RNA_def_struct_ui_text(srna, "Render Engine", "Render engine");
311         RNA_def_struct_refine_func(srna, "rna_RenderEngine_refine");
312         RNA_def_struct_register_funcs(srna, "rna_RenderEngine_register", "rna_RenderEngine_unregister", "rna_RenderEngine_instance");
313
314         /* final render callbacks */
315         func= RNA_def_function(srna, "update", NULL);
316         RNA_def_function_ui_description(func, "Export scene data for render");
317         RNA_def_function_flag(func, FUNC_REGISTER);
318         RNA_def_pointer(func, "data", "BlendData", "", "");
319         RNA_def_pointer(func, "scene", "Scene", "", "");
320
321         func= RNA_def_function(srna, "render", NULL);
322         RNA_def_function_ui_description(func, "Execute render");
323         RNA_def_function_flag(func, FUNC_REGISTER);
324
325         /* preview render callbacks */
326         func= RNA_def_function(srna, "preview_update", NULL);
327         RNA_def_function_ui_description(func, "Export scene data for preview render of the given datablock");
328         RNA_def_function_flag(func, FUNC_REGISTER);
329         RNA_def_pointer(func, "context", "Context", "", "");
330         RNA_def_pointer(func, "id", "ID", "", "");
331
332         func= RNA_def_function(srna, "preview_render", NULL);
333         RNA_def_function_ui_description(func, "Execute preview render");
334         RNA_def_function_flag(func, FUNC_REGISTER);
335
336         /* viewport render callbacks */
337         func= RNA_def_function(srna, "view_update", NULL);
338         RNA_def_function_ui_description(func, "Update on data changes for viewport render");
339         RNA_def_function_flag(func, FUNC_REGISTER);
340         RNA_def_pointer(func, "context", "Context", "", "");
341
342         func= RNA_def_function(srna, "view_draw", NULL);
343         RNA_def_function_ui_description(func, "Draw viewport render");
344         RNA_def_function_flag(func, FUNC_REGISTER);
345         RNA_def_pointer(func, "context", "Context", "", "");
346
347         /* tag for redraw */
348         RNA_def_function(srna, "tag_redraw", "engine_tag_redraw");
349
350         /* tag for update */
351         RNA_def_function(srna, "tag_update", "engine_tag_update");
352
353         func= RNA_def_function(srna, "begin_result", "RE_engine_begin_result");
354         prop= RNA_def_int(func, "x", 0, 0, INT_MAX, "X", "", 0, INT_MAX);
355         RNA_def_property_flag(prop, PROP_REQUIRED);
356         prop= RNA_def_int(func, "y", 0, 0, INT_MAX, "Y", "", 0, INT_MAX);
357         RNA_def_property_flag(prop, PROP_REQUIRED);
358         prop= RNA_def_int(func, "w", 0, 0, INT_MAX, "Width", "", 0, INT_MAX);
359         RNA_def_property_flag(prop, PROP_REQUIRED);
360         prop= RNA_def_int(func, "h", 0, 0, INT_MAX, "Height", "", 0, INT_MAX);
361         RNA_def_property_flag(prop, PROP_REQUIRED);
362         prop= RNA_def_pointer(func, "result", "RenderResult", "Result", "");
363         RNA_def_function_return(func, prop);
364
365         func= RNA_def_function(srna, "update_result", "RE_engine_update_result");
366         prop= RNA_def_pointer(func, "result", "RenderResult", "Result", "");
367         RNA_def_property_flag(prop, PROP_REQUIRED);
368
369         func= RNA_def_function(srna, "end_result", "RE_engine_end_result");
370         prop= RNA_def_pointer(func, "result", "RenderResult", "Result", "");
371         RNA_def_property_flag(prop, PROP_REQUIRED);
372
373         func= RNA_def_function(srna, "test_break", "RE_engine_test_break");
374         prop= RNA_def_boolean(func, "do_break", 0, "Break", "");
375         RNA_def_function_return(func, prop);
376
377         func= RNA_def_function(srna, "update_stats", "RE_engine_update_stats");
378         prop= RNA_def_string(func, "stats", "", 0, "Stats", "");
379         RNA_def_property_flag(prop, PROP_REQUIRED);
380         prop= RNA_def_string(func, "info", "", 0, "Info", "");
381         RNA_def_property_flag(prop, PROP_REQUIRED);
382
383         func= RNA_def_function(srna, "update_progress", "RE_engine_update_progress");
384         prop= RNA_def_float(func, "progress", 0, 0.0f, 1.0f, "", "Percentage of render that's done", 0.0f, 1.0f);
385         RNA_def_property_flag(prop, PROP_REQUIRED);
386
387         func= RNA_def_function(srna, "report", "RE_engine_report");
388         prop= RNA_def_enum_flag(func, "type", wm_report_items, 0, "Type", "");
389         RNA_def_property_flag(prop, PROP_REQUIRED);
390         prop= RNA_def_string(func, "message", "", 0, "Report Message", "");
391         RNA_def_property_flag(prop, PROP_REQUIRED);
392
393         /* registration */
394         RNA_define_verify_sdna(0);
395
396         prop= RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
397         RNA_def_property_string_sdna(prop, NULL, "type->idname");
398         RNA_def_property_flag(prop, PROP_REGISTER|PROP_NEVER_CLAMP);
399
400         prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_TRANSLATE);
401         RNA_def_property_string_sdna(prop, NULL, "type->name");
402         RNA_def_property_flag(prop, PROP_REGISTER);
403
404         prop= RNA_def_property(srna, "bl_use_preview", PROP_BOOLEAN, PROP_NONE);
405         RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_PREVIEW);
406         RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
407
408         prop= RNA_def_property(srna, "bl_use_postprocess", PROP_BOOLEAN, PROP_NONE);
409         RNA_def_property_boolean_negative_sdna(prop, NULL, "type->flag", RE_USE_POSTPROCESS);
410         RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
411
412         prop= RNA_def_property(srna, "bl_use_shading_nodes", PROP_BOOLEAN, PROP_NONE);
413         RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_SHADING_NODES);
414         RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
415
416         RNA_define_verify_sdna(1);
417 }
418
419 static void rna_def_render_result(BlenderRNA *brna)
420 {
421         StructRNA *srna;
422         FunctionRNA *func;
423         PropertyRNA *parm;
424         
425         srna= RNA_def_struct(brna, "RenderResult", NULL);
426         RNA_def_struct_ui_text(srna, "Render Result", "Result of rendering, including all layers and passes");
427
428         func= RNA_def_function(srna, "load_from_file", "RE_result_load_from_file");
429         RNA_def_function_ui_description(func, "Copies the pixels of this render result from an image file");
430         RNA_def_function_flag(func, FUNC_USE_REPORTS);
431         parm= RNA_def_string_file_name(func, "filename", "", FILE_MAX, "File Name",
432                                        "Filename to load into this render tile, must be no smaller than the render result");
433         RNA_def_property_flag(parm, PROP_REQUIRED);
434
435         RNA_define_verify_sdna(0);
436
437         parm= RNA_def_property(srna, "resolution_x", PROP_INT, PROP_NONE);
438         RNA_def_property_int_sdna(parm, NULL, "rectx");
439         RNA_def_property_clear_flag(parm, PROP_EDITABLE);
440
441         parm= RNA_def_property(srna, "resolution_y", PROP_INT, PROP_NONE);
442         RNA_def_property_int_sdna(parm, NULL, "recty");
443         RNA_def_property_clear_flag(parm, PROP_EDITABLE);
444
445         parm= RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE);
446         RNA_def_property_struct_type(parm, "RenderLayer");
447         RNA_def_property_collection_funcs(parm, "rna_RenderResult_layers_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL);
448
449         RNA_define_verify_sdna(1);
450 }
451
452 static void rna_def_render_layer(BlenderRNA *brna)
453 {
454         StructRNA *srna;
455         PropertyRNA *prop;
456         FunctionRNA *func;
457         
458         srna= RNA_def_struct(brna, "RenderLayer", NULL);
459         RNA_def_struct_ui_text(srna, "Render Layer", "");
460
461         func= RNA_def_function(srna, "load_from_file", "RE_layer_load_from_file");
462         RNA_def_function_ui_description(func, "Copies the pixels of this renderlayer from an image file");
463         RNA_def_function_flag(func, FUNC_USE_REPORTS);
464         prop= RNA_def_string(func, "filename", "", 0, "Filename",
465                              "Filename to load into this render tile, must be no smaller than the renderlayer");
466         RNA_def_property_flag(prop, PROP_REQUIRED);
467         RNA_def_int(func, "x", 0, 0, INT_MAX, "Offset X",
468                     "Offset the position to copy from if the image is larger than the render layer", 0, INT_MAX);
469         RNA_def_int(func, "y", 0, 0, INT_MAX, "Offset Y",
470                     "Offset the position to copy from if the image is larger than the render layer", 0, INT_MAX);
471
472         RNA_define_verify_sdna(0);
473
474         rna_def_render_layer_common(srna, 0);
475
476         prop= RNA_def_property(srna, "passes", PROP_COLLECTION, PROP_NONE);
477         RNA_def_property_struct_type(prop, "RenderPass");
478         RNA_def_property_collection_funcs(prop, "rna_RenderLayer_passes_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL);
479
480         prop= RNA_def_property(srna, "rect", PROP_FLOAT, PROP_NONE);
481         RNA_def_property_flag(prop, PROP_DYNAMIC);
482         RNA_def_property_multi_array(prop, 2, NULL);
483         RNA_def_property_dynamic_array_funcs(prop, "rna_RenderLayer_rect_get_length");
484         RNA_def_property_float_funcs(prop, "rna_RenderLayer_rect_get", "rna_RenderLayer_rect_set", NULL);
485
486         RNA_define_verify_sdna(1);
487 }
488
489 static void rna_def_render_pass(BlenderRNA *brna)
490 {
491         StructRNA *srna;
492         PropertyRNA *prop;
493
494         static EnumPropertyItem pass_type_items[]= {
495                 {SCE_PASS_COMBINED, "COMBINED", 0, "Combined", ""},
496                 {SCE_PASS_Z, "Z", 0, "Z", ""},
497                 {SCE_PASS_RGBA, "COLOR", 0, "Color", ""},
498                 {SCE_PASS_DIFFUSE, "DIFFUSE", 0, "Diffuse", ""},
499                 {SCE_PASS_SPEC, "SPECULAR", 0, "Specular", ""},
500                 {SCE_PASS_SHADOW, "SHADOW", 0, "Shadow", ""},
501                 {SCE_PASS_AO, "AO", 0, "AO", ""},
502                 {SCE_PASS_REFLECT, "REFLECTION", 0, "Reflection", ""},
503                 {SCE_PASS_NORMAL, "NORMAL", 0, "Normal", ""},
504                 {SCE_PASS_VECTOR, "VECTOR", 0, "Vector", ""},
505                 {SCE_PASS_REFRACT, "REFRACTION", 0, "Refraction", ""},
506                 {SCE_PASS_INDEXOB, "OBJECT_INDEX", 0, "Object Index", ""},
507                 {SCE_PASS_UV, "UV", 0, "UV", ""},
508                 {SCE_PASS_MIST, "MIST", 0, "Mist", ""},
509                 {SCE_PASS_EMIT, "EMIT", 0, "Emit", ""},
510                 {SCE_PASS_ENVIRONMENT, "ENVIRONMENT", 0, "Environment", ""},
511                 {SCE_PASS_INDEXMA, "MATERIAL_INDEX", 0, "Material Index", ""},
512                 {0, NULL, 0, NULL, NULL}};
513         
514         srna= RNA_def_struct(brna, "RenderPass", NULL);
515         RNA_def_struct_ui_text(srna, "Render Pass", "");
516
517         RNA_define_verify_sdna(0);
518
519         prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
520         RNA_def_property_string_sdna(prop, NULL, "name");
521         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
522         RNA_def_struct_name_property(srna, prop);
523
524         prop= RNA_def_property(srna, "channel_id", PROP_STRING, PROP_NONE);
525         RNA_def_property_string_sdna(prop, NULL, "chan_id");
526         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
527
528         prop= RNA_def_property(srna, "channels", PROP_INT, PROP_NONE);
529         RNA_def_property_int_sdna(prop, NULL, "channels");
530         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
531
532         prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
533         RNA_def_property_enum_sdna(prop, NULL, "passtype");
534         RNA_def_property_enum_items(prop, pass_type_items);
535         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
536
537         prop= RNA_def_property(srna, "rect", PROP_FLOAT, PROP_NONE);
538         RNA_def_property_flag(prop, PROP_DYNAMIC);
539         RNA_def_property_multi_array(prop, 2, NULL);
540         RNA_def_property_dynamic_array_funcs(prop, "rna_RenderPass_rect_get_length");
541         RNA_def_property_float_funcs(prop, "rna_RenderPass_rect_get", "rna_RenderPass_rect_set", NULL);
542
543         RNA_define_verify_sdna(1);
544 }
545
546 void RNA_def_render(BlenderRNA *brna)
547 {
548         rna_def_render_engine(brna);
549         rna_def_render_result(brna);
550         rna_def_render_layer(brna);
551         rna_def_render_pass(brna);
552 }
553
554 #endif // RNA_RUNTIME
555