2 * Copyright 2011, Blender Foundation.
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.
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.
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.
19 #ifndef __BLENDER_SYNC_H__
20 #define __BLENDER_SYNC_H__
22 #include "MEM_guardedalloc.h"
23 #include "RNA_types.h"
24 #include "RNA_access.h"
25 #include "RNA_blender_cpp.h"
27 #include "blender_util.h"
34 #include "util_transform.h"
35 #include "util_vector.h"
52 BlenderSync(BL::BlendData b_data, BL::Scene b_scene, Scene *scene_, bool preview_);
57 void sync_data(BL::SpaceView3D b_v3d, const char *layer = 0);
58 void sync_camera(int width, int height);
59 void sync_view(BL::SpaceView3D b_v3d, BL::RegionView3D b_rv3d, int width, int height);
62 static SceneParams get_scene_params(BL::Scene b_scene, bool background);
63 static SessionParams get_session_params(BL::UserPreferences b_userpref, BL::Scene b_scene, bool background);
64 static bool get_session_pause(BL::Scene b_scene, bool background);
65 static BufferParams get_buffer_params(BL::Scene b_scene, BL::RegionView3D b_rv3d, int width, int height);
70 void sync_materials();
71 void sync_objects(BL::SpaceView3D b_v3d);
73 void sync_integrator();
76 void sync_render_layers(BL::SpaceView3D b_v3d, const char *layer);
79 void sync_nodes(Shader *shader, BL::ShaderNodeTree b_ntree);
80 Mesh *sync_mesh(BL::Object b_ob, bool holdout, bool object_updated);
81 void sync_object(BL::Object b_parent, int b_index, BL::Object b_object, Transform& tfm, uint layer_flag);
82 void sync_light(BL::Object b_parent, int b_index, BL::Object b_ob, Transform& tfm);
83 void sync_background_light();
86 void find_shader(BL::ID id, vector<uint>& used_shaders, int default_shader);
87 bool object_is_modified(BL::Object b_ob);
88 bool object_is_mesh(BL::Object b_ob);
89 bool object_is_light(BL::Object b_ob);
95 id_map<void*, Shader> shader_map;
96 id_map<ObjectKey, Object> object_map;
97 id_map<void*, Mesh> mesh_map;
98 id_map<ObjectKey, Light> light_map;
99 set<Mesh*> mesh_synced;
107 struct RenderLayerInfo {
109 : scene_layer(0), layer(0),
110 material_override(PointerRNA_NULL)
117 BL::Material material_override;
123 #endif /* __BLENDER_SYNC_H__ */