Cleanup: Various changes in modifier simulation cache
- Remove unused variable added in 397663a7cb
- Fix private/public naming
This commit is contained in:
@@ -165,11 +165,10 @@ class ModifierSimulationCache {
|
||||
|
||||
friend ModifierSimulationState;
|
||||
|
||||
public:
|
||||
CacheState cache_state_ = CacheState::Valid;
|
||||
bool failed_finding_bake_ = false;
|
||||
|
||||
float last_fps_ = 0.0f;
|
||||
public:
|
||||
CacheState cache_state = CacheState::Valid;
|
||||
|
||||
void try_discover_bake(StringRefNull absolute_bake_dir);
|
||||
|
||||
@@ -181,12 +180,7 @@ class ModifierSimulationCache {
|
||||
|
||||
void invalidate()
|
||||
{
|
||||
cache_state_ = CacheState::Invalid;
|
||||
}
|
||||
|
||||
CacheState cache_state() const
|
||||
{
|
||||
return cache_state_;
|
||||
this->cache_state = CacheState::Invalid;
|
||||
}
|
||||
|
||||
void reset();
|
||||
|
||||
@@ -92,7 +92,7 @@ void ModifierSimulationCache::try_discover_bake(const StringRefNull absolute_bak
|
||||
}
|
||||
|
||||
bdata_sharing_ = std::make_unique<BDataSharing>();
|
||||
cache_state_ = CacheState::Baked;
|
||||
this->cache_state = CacheState::Baked;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ void ModifierSimulationCache::reset()
|
||||
std::lock_guard lock(states_at_frames_mutex_);
|
||||
states_at_frames_.clear();
|
||||
bdata_sharing_.reset();
|
||||
cache_state_ = CacheState::Valid;
|
||||
this->cache_state = CacheState::Valid;
|
||||
}
|
||||
|
||||
} // namespace blender::bke::sim
|
||||
|
||||
@@ -342,7 +342,7 @@ static void bake_simulation_job_startjob(void *customdata,
|
||||
NodesModifierData &nmd = *modifier_bake_data.nmd;
|
||||
if (nmd.simulation_cache) {
|
||||
/* Tag the caches as being baked so that they are not changed anymore. */
|
||||
nmd.simulation_cache->ptr->cache_state_ = CacheState::Baked;
|
||||
nmd.simulation_cache->ptr->cache_state = CacheState::Baked;
|
||||
}
|
||||
}
|
||||
DEG_id_tag_update(&object_bake_data.object->id, ID_RECALC_GEOMETRY);
|
||||
|
||||
@@ -695,7 +695,7 @@ static void timeline_cache_draw_simulation_nodes(
|
||||
|
||||
float color[4];
|
||||
UI_GetThemeColor4fv(TH_SIMULATED_FRAMES, color);
|
||||
switch (cache.cache_state()) {
|
||||
switch (cache.cache_state) {
|
||||
case blender::bke::sim::CacheState::Invalid: {
|
||||
color[3] = 0.4f;
|
||||
break;
|
||||
|
||||
@@ -665,7 +665,7 @@ static void prepare_simulation_states_for_evaluation(const NodesModifierData &nm
|
||||
{
|
||||
/* Try to use baked data. */
|
||||
const StringRefNull bmain_path = BKE_main_blendfile_path(bmain);
|
||||
if (simulation_cache.cache_state() != bke::sim::CacheState::Baked && !bmain_path.is_empty()) {
|
||||
if (simulation_cache.cache_state != bke::sim::CacheState::Baked && !bmain_path.is_empty()) {
|
||||
if (!StringRef(nmd.simulation_bake_directory).is_empty()) {
|
||||
if (const char *base_path = ID_BLEND_PATH(bmain, &ctx.object->id)) {
|
||||
char absolute_bake_dir[FILE_MAX];
|
||||
@@ -682,7 +682,7 @@ static void prepare_simulation_states_for_evaluation(const NodesModifierData &nm
|
||||
{
|
||||
/* Invalidate cached data on user edits. */
|
||||
if (nmd.modifier.flag & eModifierFlag_UserModified) {
|
||||
if (simulation_cache.cache_state() != bke::sim::CacheState::Baked) {
|
||||
if (simulation_cache.cache_state != bke::sim::CacheState::Baked) {
|
||||
simulation_cache.invalidate();
|
||||
}
|
||||
}
|
||||
@@ -692,7 +692,7 @@ static void prepare_simulation_states_for_evaluation(const NodesModifierData &nm
|
||||
/* Reset cached data if necessary. */
|
||||
const bke::sim::StatesAroundFrame sim_states = simulation_cache.get_states_around_frame(
|
||||
current_frame);
|
||||
if (simulation_cache.cache_state() == bke::sim::CacheState::Invalid &&
|
||||
if (simulation_cache.cache_state == bke::sim::CacheState::Invalid &&
|
||||
(current_frame == start_frame ||
|
||||
(sim_states.current == nullptr && sim_states.prev == nullptr &&
|
||||
sim_states.next != nullptr)))
|
||||
@@ -703,7 +703,7 @@ static void prepare_simulation_states_for_evaluation(const NodesModifierData &nm
|
||||
/* Decide if a new simulation state should be created in this evaluation. */
|
||||
const bke::sim::StatesAroundFrame sim_states = simulation_cache.get_states_around_frame(
|
||||
current_frame);
|
||||
if (simulation_cache.cache_state() != bke::sim::CacheState::Baked) {
|
||||
if (simulation_cache.cache_state != bke::sim::CacheState::Baked) {
|
||||
if (sim_states.current == nullptr) {
|
||||
if (is_start_frame || !simulation_cache.has_states()) {
|
||||
bke::sim::ModifierSimulationState ¤t_sim_state =
|
||||
|
||||
Reference in New Issue
Block a user