Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2016-01-30 16:18:29 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2016-01-30 17:08:57 +0300
commit74c7707e8c763a60c2936e95c2f0ad13dfd33f43 (patch)
tree08dddce249a8821e54728355f32fea976d324ac1 /intern/cycles/blender/blender_sync.h
parent0e4e1993e619caad3dfbecc20ab9fb20cdf6cd06 (diff)
Cycles: Pass Blender's C++ RNA structures by reference
This way we avoid passing structures which could be up to few hundred bytes by value to the utility functions. Ideally we'll also have to add `const` qualifier in majority of the calls, but C++ RNA does not allow us to do that because it does not know if some function modifies contents or not.
Diffstat (limited to 'intern/cycles/blender/blender_sync.h')
-rw-r--r--intern/cycles/blender/blender_sync.h92
1 files changed, 59 insertions, 33 deletions
diff --git a/intern/cycles/blender/blender_sync.h b/intern/cycles/blender/blender_sync.h
index 2eb153a6f74..d3edfcb657f 100644
--- a/intern/cycles/blender/blender_sync.h
+++ b/intern/cycles/blender/blender_sync.h
@@ -48,41 +48,57 @@ class ShaderNode;
class BlenderSync {
public:
- BlenderSync(BL::RenderEngine b_engine_, BL::BlendData b_data, BL::Scene b_scene, Scene *scene_, bool preview_, Progress &progress_, bool is_cpu_);
+ BlenderSync(BL::RenderEngine& b_engine,
+ BL::BlendData& b_data,
+ BL::Scene& b_scene,
+ Scene *scene,
+ bool preview,
+ Progress &progress,
+ bool is_cpu);
~BlenderSync();
/* sync */
bool sync_recalc();
- void sync_data(BL::RenderSettings b_render,
- BL::SpaceView3D b_v3d,
- BL::Object b_override,
+ void sync_data(BL::RenderSettings& b_render,
+ BL::SpaceView3D& b_v3d,
+ BL::Object& b_override,
int width, int height,
void **python_thread_state,
const char *layer = 0);
- void sync_render_layers(BL::SpaceView3D b_v3d, const char *layer);
+ void sync_render_layers(BL::SpaceView3D& b_v3d, const char *layer);
void sync_integrator();
- void sync_camera(BL::RenderSettings b_render, BL::Object b_override, int width, int height);
- void sync_view(BL::SpaceView3D b_v3d, BL::RegionView3D b_rv3d, int width, int height);
- int get_layer_samples() { return render_layer.samples; }
- int get_layer_bound_samples() { return render_layer.bound_samples; }
+ void sync_camera(BL::RenderSettings& b_render,
+ BL::Object& b_override,
+ int width, int height);
+ void sync_view(BL::SpaceView3D& b_v3d,
+ BL::RegionView3D& b_rv3d,
+ int width, int height);
+ inline int get_layer_samples() { return render_layer.samples; }
+ inline int get_layer_bound_samples() { return render_layer.bound_samples; }
/* get parameters */
- static SceneParams get_scene_params(BL::Scene b_scene, bool background, bool is_cpu);
- static SessionParams get_session_params(BL::RenderEngine b_engine,
- BL::UserPreferences b_userpref,
- BL::Scene b_scene,
+ static SceneParams get_scene_params(BL::Scene& b_scene,
+ bool background,
+ bool is_cpu);
+ static SessionParams get_session_params(BL::RenderEngine& b_engine,
+ BL::UserPreferences& b_userpref,
+ BL::Scene& b_scene,
bool background);
- static bool get_session_pause(BL::Scene b_scene, bool background);
- static BufferParams get_buffer_params(BL::RenderSettings b_render, BL::SpaceView3D b_v3d, BL::RegionView3D b_rv3d, Camera *cam, int width, int height);
+ static bool get_session_pause(BL::Scene& b_scene, bool background);
+ static BufferParams get_buffer_params(BL::RenderSettings& b_render,
+ BL::SpaceView3D& b_v3d,
+ BL::RegionView3D& b_rv3d,
+ Camera *cam,
+ int width, int height);
private:
/* sync */
void sync_lamps(bool update_all);
void sync_materials(bool update_all);
- void sync_objects(BL::SpaceView3D b_v3d, float motion_time = 0.0f);
- void sync_motion(BL::RenderSettings b_render,
- BL::SpaceView3D b_v3d,
- BL::Object b_override,
+ void sync_objects(BL::SpaceView3D& b_v3d, float motion_time = 0.0f);
+ void sync_motion(BL::RenderSettings& b_render,
+ BL::SpaceView3D& b_v3d,
+ BL::Object& b_override,
int width, int height,
void **python_thread_state);
void sync_film();
@@ -91,12 +107,16 @@ private:
void sync_shaders();
void sync_curve_settings();
- void sync_nodes(Shader *shader, BL::ShaderNodeTree b_ntree);
- Mesh *sync_mesh(BL::Object b_ob, bool object_updated, bool hide_tris);
- void sync_curves(Mesh *mesh, BL::Mesh b_mesh, BL::Object b_ob, bool motion, int time_index = 0);
- Object *sync_object(BL::Object b_parent,
+ void sync_nodes(Shader *shader, BL::ShaderNodeTree& b_ntree);
+ Mesh *sync_mesh(BL::Object& b_ob, bool object_updated, bool hide_tris);
+ void sync_curves(Mesh *mesh,
+ BL::Mesh& b_mesh,
+ BL::Object& b_ob,
+ bool motion,
+ int time_index = 0);
+ Object *sync_object(BL::Object& b_parent,
int persistent_id[OBJECT_PERSISTENT_ID_SIZE],
- BL::DupliObject b_dupli_ob,
+ BL::DupliObject& b_dupli_ob,
Transform& tfm,
uint layer_flag,
float motion_time,
@@ -104,25 +124,31 @@ private:
bool use_camera_cull,
float camera_cull_margin,
bool *use_portal);
- void sync_light(BL::Object b_parent, int persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::Object b_ob, Transform& tfm, bool *use_portal);
+ void sync_light(BL::Object& b_parent,
+ int persistent_id[OBJECT_PERSISTENT_ID_SIZE],
+ BL::Object& b_ob,
+ Transform& tfm,
+ bool *use_portal);
void sync_background_light(bool use_portal);
- void sync_mesh_motion(BL::Object b_ob, Object *object, float motion_time);
- void sync_camera_motion(BL::RenderSettings b_render,
- BL::Object b_ob,
+ void sync_mesh_motion(BL::Object& b_ob, Object *object, float motion_time);
+ void sync_camera_motion(BL::RenderSettings& b_render,
+ BL::Object& b_ob,
int width, int height,
float motion_time);
/* particles */
- bool sync_dupli_particle(BL::Object b_ob, BL::DupliObject b_dup, Object *object);
+ bool sync_dupli_particle(BL::Object& b_ob,
+ BL::DupliObject& b_dup,
+ Object *object);
/* Images. */
void sync_images();
/* util */
- void find_shader(BL::ID id, vector<uint>& used_shaders, int default_shader);
- bool BKE_object_is_modified(BL::Object b_ob);
- bool object_is_mesh(BL::Object b_ob);
- bool object_is_light(BL::Object b_ob);
+ void find_shader(BL::ID& id, vector<uint>& used_shaders, int default_shader);
+ bool BKE_object_is_modified(BL::Object& b_ob);
+ bool object_is_mesh(BL::Object& b_ob);
+ bool object_is_light(BL::Object& b_ob);
/* variables */
BL::RenderEngine b_engine;