4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 * The Original Code is Copyright (C) 2009 Blender Foundation.
21 * All rights reserved.
24 * Contributor(s): Joshua Leung, Arystanbek Dyussenov
26 * ***** END GPL LICENSE BLOCK *****
32 #include "RNA_define.h"
34 #include "DNA_anim_types.h"
35 #include "DNA_object_types.h"
36 #include "DNA_scene_types.h"
37 #include "BKE_utildefines.h"
41 #include "BKE_animsys.h"
42 #include "BKE_depsgraph.h"
43 #include "BKE_global.h"
44 #include "BKE_image.h"
45 #include "BKE_scene.h"
46 #include "BKE_writeavi.h"
50 static void rna_Scene_frame_set(Scene *scene, int frame, float subframe)
53 scene->r.subframe= subframe;
55 CLAMP(scene->r.cfra, MINAFRAME, MAXFRAME);
56 scene_update_for_newframe(G.main, scene, (1<<20) - 1);
58 WM_main_add_notifier(NC_SCENE|ND_FRAME, scene);
61 static void rna_Scene_update_tagged(Scene *scene)
63 scene_update_tagged(G.main, scene);
66 static void rna_SceneRender_get_frame_path(RenderData *rd, int frame, char *name)
68 if(BKE_imtype_is_movie(rd->imtype))
69 BKE_makeanimstring(name, rd);
71 BKE_makepicstring(name, rd->pic, (frame==INT_MIN) ? rd->cfra : frame, rd->imtype, rd->scemode & R_EXTENSION);
76 #include "../../collada/collada.h"
78 static void rna_Scene_collada_export(Scene *scene, char *filepath)
80 /* XXX not really nice, as this will bring essentially in COLLADA as dependency for
81 * blenderplayer. For now stubbing in blc. */
82 collada_export(scene, filepath);
89 void RNA_api_scene(StructRNA *srna)
94 func= RNA_def_function(srna, "frame_set", "rna_Scene_frame_set");
95 RNA_def_function_ui_description(func, "Set scene frame updating all objects immediately.");
96 parm= RNA_def_int(func, "frame", 0, MINAFRAME, MAXFRAME, "", "Frame number to set.", MINAFRAME, MAXFRAME);
97 RNA_def_property_flag(parm, PROP_REQUIRED);
98 parm= RNA_def_float(func, "subframe", 0.0, 0.0, 1.0, "", "Sub-frame time, between 0.0 and 1.0", 0.0, 1.0);
100 func= RNA_def_function(srna, "update", "rna_Scene_update_tagged");
101 RNA_def_function_ui_description(func, "Update data tagged to be updated from previous access to data or operators.");
104 func= RNA_def_function(srna, "collada_export", "rna_Scene_collada_export");
105 parm= RNA_def_string(func, "filepath", "", FILE_MAX, "File Path", "File path to write Collada file.");
106 RNA_def_property_flag(parm, PROP_REQUIRED);
107 RNA_def_property_subtype(parm, PROP_FILEPATH); /* allow non utf8 */
108 RNA_def_function_ui_description(func, "Export to collada file.");
112 void RNA_api_scene_render(StructRNA *srna)
117 func= RNA_def_function(srna, "frame_path", "rna_SceneRender_get_frame_path");
118 RNA_def_function_ui_description(func, "Return the absolute path to the filename to be written for a given frame.");
119 parm= RNA_def_int(func, "frame", INT_MIN, INT_MIN, INT_MAX, "", "Frame number to use, if unset the current frame will be used.", MINAFRAME, MAXFRAME);
120 parm= RNA_def_string(func, "filepath", "", FILE_MAX, "File Path", "the resulting filepath from the scenes render settings.");
121 RNA_def_property_flag(parm, PROP_THICK_WRAP); /* needed for string return value */
122 RNA_def_property_subtype(parm, PROP_FILEPATH); /* allow non utf8 */
123 RNA_def_function_output(func, parm);