Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/blender/blender_session.cpp
| Show First 20 Lines • Show All 923 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| void BlenderSession::get_status(string& status, string& substatus) | void BlenderSession::get_status(string& status, string& substatus) | ||||
| { | { | ||||
| session->progress.get_status(status, substatus); | session->progress.get_status(status, substatus); | ||||
| } | } | ||||
| void BlenderSession::get_progress(float& progress, double& total_time, double& render_time) | void BlenderSession::get_progress(float& progress, double& total_time, double& render_time) | ||||
| { | { | ||||
| double tile_time; | session->progress.get_time(total_time, render_time); | ||||
brecht: Don't use `long`, this has different sizes on unix and windows. Best to use something like… | |||||
| int tile, sample, samples_per_tile; | progress = session->progress.get_progress(); | ||||
| int tile_total = session->tile_manager.state.num_tiles; | |||||
| int samples = session->tile_manager.state.sample + 1; | |||||
| int total_samples = session->tile_manager.get_num_effective_samples(); | |||||
| session->progress.get_tile(tile, total_time, render_time, tile_time); | |||||
| sample = session->progress.get_sample(); | |||||
| samples_per_tile = session->tile_manager.get_num_effective_samples(); | |||||
| if(background && samples_per_tile && tile_total) | |||||
| progress = ((float)sample / (float)(tile_total * samples_per_tile)); | |||||
| else if(!background && samples > 0 && total_samples != INT_MAX) | |||||
| progress = ((float)samples) / total_samples; | |||||
| else | |||||
| progress = 0.0; | |||||
| } | } | ||||
| void BlenderSession::update_bake_progress() | void BlenderSession::update_bake_progress() | ||||
| { | { | ||||
| float progress; | float progress = session->progress.get_progress(); | ||||
| int sample, samples_per_task, parts_total; | |||||
| sample = session->progress.get_sample(); | |||||
| samples_per_task = scene->bake_manager->num_samples; | |||||
| parts_total = scene->bake_manager->num_parts; | |||||
| if(samples_per_task) | |||||
| progress = ((float)sample / (float)(parts_total * samples_per_task)); | |||||
| else | |||||
| progress = 0.0; | |||||
| if(progress != last_progress) { | if(progress != last_progress) { | ||||
| b_engine.update_progress(progress); | b_engine.update_progress(progress); | ||||
| last_progress = progress; | last_progress = progress; | ||||
| } | } | ||||
| } | } | ||||
| void BlenderSession::update_status_progress() | void BlenderSession::update_status_progress() | ||||
| ▲ Show 20 Lines • Show All 392 Lines • Show Last 20 Lines | |||||
Don't use long, this has different sizes on unix and windows. Best to use something like int64_t if you need a large int.