[Bf-committers] Towards a solution for T45350
Martin Norris
martinjohnedwardnorris at gmail.com
Tue Aug 11 22:59:47 CEST 2015
Hi Everyone,
I have made progress on the problem reported as T45350 - confirmed in
the bug list
Digging into the scenario it is a little more constrained then the description
The description describes the steps needed as 'Free All' then 'Bake
All' or 'Free' then 'Bake'
In fact the free step is interchangeable and the scenario can be
reproduced with just the 'Bake' or 'Bake All' step
Essentially 'Free' or 'Free All' simply reset the point cache flag PTCACHE_BAKED
Either for a singular cache 'ptcache_free_bake_exec' or for all caches
in the scene 'ptcache_free_bake_all_exec'
Both of which execute 'ptcache_free_bake' for each cache
The problem is the difference in 'Bake' and 'Bake All'
Both 'Bake' via 'ptcache_bake_exec' and 'Bake All' via
'ptcache_bake_all_exec' invoke 'BKE_ptcache_bake'
The problem is in 'BKE_ptcache_bake' where the two things are then
treated slightly differently
There is a switch 'if (pid) { ...' for a single object and the 'else
{...' for a list of caches to bake
Within these clauses there is a cache clear call
'BKE_ptcache_id_clear' for each cache but the condition for each case
is different
For a single object
if (bake || cache->flag & PTCACHE_REDO_NEEDED)
BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, 0);
For an object from the list
if ((cache->flag & PTCACHE_REDO_NEEDED ||
(cache->flag & PTCACHE_SIMULATION_VALID)==0) &&
(render || bake))
{
BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, 0);
}
Investigating these two conditions with the debugger attached I found
that for 'Bake' since 'bake' is always set, the cache is always
cleared
But for 'Bake All' the condition is false so the cache is not cleared
The 'cache->flag' has a value 4 hence
'cache->flag & PTCACHE_REDO_NEEDED' where PTCACHE_REDO_NEEDED defined
as 258 is false
'(cache->flag & PTCACHE_SIMULATION_VALID)==0)' where
PTCACHE_SIMULATION_VALID defined as 4 is false
so
'<flags> && (render || bake)' is false
Question - why are these different?
I would think that the condition could be the same in both situations
This may not be the solution, I do not know enough about the rest of
the system to understand the lifecycle of the cache
Perhaps deleting the object {refer to the scenario} should set the
PTCACHE_REDO_NEEDED flag?
Hope this helps
Martin
More information about the Bf-committers
mailing list