Cycles: Cleanup, code style

This commit is contained in:
Sergey Sharybin 2018-11-15 17:19:26 +01:00
parent c617fcad10
commit 8610b57271
4 changed files with 18 additions and 18 deletions

View File

@ -180,12 +180,12 @@ void BlenderSession::reset_session(BL::BlendData& b_data, BL::Depsgraph& b_depsg
this->b_depsgraph = b_depsgraph;
this->b_scene = b_depsgraph.scene_eval();
if (preview_osl) {
if(preview_osl) {
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
RNA_boolean_set(&cscene, "shading_system", preview_osl);
}
if (b_v3d) {
if(b_v3d) {
this->b_render = b_scene.render();
}
else {
@ -194,11 +194,11 @@ void BlenderSession::reset_session(BL::BlendData& b_data, BL::Depsgraph& b_depsg
height = render_resolution_y(b_render);
}
if (session == NULL) {
if(session == NULL) {
create();
}
if (b_v3d) {
if(b_v3d) {
/* NOTE: We need to create session, but all the code from below
* will make viewport render to stuck on initialization.
*/
@ -1413,7 +1413,7 @@ void BlenderSession::update_resumable_tile_manager(int num_samples)
void BlenderSession::free_blender_memory_if_possible()
{
if (!background) {
if(!background) {
/* During interactive render we can not free anything: attempts to save
* memory would cause things to be allocated and evaluated for every
* updated sample.

View File

@ -1236,7 +1236,7 @@ void BlenderSync::sync_materials(BL::Depsgraph& b_depsgraph, bool update_all)
BL::Depsgraph::ids_iterator b_id;
for(b_depsgraph.ids.begin(b_id); b_id != b_depsgraph.ids.end(); ++b_id) {
if (!b_id->is_a(&RNA_Material)) {
if(!b_id->is_a(&RNA_Material)) {
continue;
}
@ -1409,7 +1409,7 @@ void BlenderSync::sync_lights(BL::Depsgraph& b_depsgraph, bool update_all)
BL::Depsgraph::ids_iterator b_id;
for(b_depsgraph.ids.begin(b_id); b_id != b_depsgraph.ids.end(); ++b_id) {
if (!b_id->is_a(&RNA_Light)) {
if(!b_id->is_a(&RNA_Light)) {
continue;
}

View File

@ -111,21 +111,21 @@ void BlenderSync::sync_recalc(BL::Depsgraph& b_depsgraph)
BL::ID b_id(b_update->id());
/* Material */
if (b_id.is_a(&RNA_Material)) {
if(b_id.is_a(&RNA_Material)) {
BL::Material b_mat(b_id);
shader_map.set_recalc(b_mat);
}
/* Light */
else if (b_id.is_a(&RNA_Light)) {
else if(b_id.is_a(&RNA_Light)) {
BL::Light b_light(b_id);
shader_map.set_recalc(b_light);
}
/* Object */
else if (b_id.is_a(&RNA_Object)) {
else if(b_id.is_a(&RNA_Object)) {
BL::Object b_ob(b_id);
const bool updated_geometry = !b_update->is_dirty_geometry();
if (!b_update->is_dirty_transform()) {
if(!b_update->is_dirty_transform()) {
object_map.set_recalc(b_ob);
light_map.set_recalc(b_ob);
}
@ -151,12 +151,12 @@ void BlenderSync::sync_recalc(BL::Depsgraph& b_depsgraph)
}
}
/* Mesh */
else if (b_id.is_a(&RNA_Mesh)) {
else if(b_id.is_a(&RNA_Mesh)) {
BL::Mesh b_mesh(b_id);
mesh_map.set_recalc(b_mesh);
}
/* World */
else if (b_id.is_a(&RNA_World)) {
else if(b_id.is_a(&RNA_World)) {
BL::World b_world(b_id);
if(world_map == b_world.ptr.data) {
world_recalc = true;
@ -165,13 +165,13 @@ void BlenderSync::sync_recalc(BL::Depsgraph& b_depsgraph)
}
/* Updates shader with object dependency if objects changed. */
if (has_updated_objects) {
if(has_updated_objects) {
if(scene->default_background->has_object_dependency) {
world_recalc = true;
}
foreach(Shader *shader, scene->shaders) {
if (shader->has_object_dependency) {
if(shader->has_object_dependency) {
shader->need_sync_object = true;
}
}
@ -619,7 +619,7 @@ void BlenderSync::free_data_after_sync(BL::Depsgraph& b_depsgraph)
const bool is_interface_locked = b_engine.render() &&
b_engine.render().use_lock_interface();
const bool can_free_caches = BlenderSession::headless || is_interface_locked;
if (!can_free_caches) {
if(!can_free_caches) {
return;
}
/* TODO(sergey): We can actually remove the whole dependency graph,

View File

@ -203,7 +203,7 @@ bool Device::bind_fallback_display_space_shader(const float width, const float h
fallback_shader_program = bind_fallback_shader();
fallback_status = FALLBACK_SHADER_STATUS_ERROR;
if (fallback_shader_program == 0) {
if(fallback_shader_program == 0) {
return false;
}
@ -266,7 +266,7 @@ void Device::draw_pixels(
GLint shader_program;
if(use_fallback_shader) {
if (!bind_fallback_display_space_shader(dw, dh)) {
if(!bind_fallback_display_space_shader(dw, dh)) {
return;
}
shader_program = fallback_shader_program;