2
$\begingroup$

I'm trying to bake externally a single cache smoke domain, with multiple/other domains in the same scene file which I don't want to cache, but when I run the below it simply returns {'FINISHED'} as a result without executing the external bake to disk.

Am I needing to specify another element or flag in the modifier's attributes before I execute it?

I'm close to getting a solution to this and can see all the attribs but it's tricky getting a clear guideline as to what's making this refuse to bake to an external cache location.

import bpy        

def cacheThisSmokeSim(smokeCacheName):
    for scene in bpy.data.scenes:
        for object in scene.objects:
            for modifier in object.modifiers:
                if modifier.type =='SMOKE':
                    if object.name == smokeCacheName:
                        override = {'blend_data': bpy.data,'scene': scene, 'active_object': object.name,'point_cache': modifier.domain_settings.point_cache}                
                        #bpy.ops.ptcache.bake_all(override)
                        print ("CACHE THIS*:",smokeCacheName,"\n")
                        result =  bpy.ops.ptcache.bake(override,bake=True)
                        print ("END OF CACHE")
                    else:
                        print ("BUT NOT THIS:",object.name)
    return result

cacheResult = cacheThisSmokeSim('SMOKEDOMAIN')

Please also note that I'm able to bake everything well enough but for big scenes when you want to simply adjust one cache this would be super helpful without having to execute:

bpy.ops.ptcache.bake_all(override) 

which works perfectly.

$\endgroup$

1 Answer 1

2
$\begingroup$

make sure use_disk_cache is enabled or enable it before baking the cache :

object.modifiers['Smoke'].domain_settings.point_cache.use_disk_cache = True
$\endgroup$
6
  • $\begingroup$ Yeap, this is on in all cases but it seems to either not cache if believes that the baked flag is True at the current frame and doesn't check around it. Would love to know which attrib it is that definitively tells it to write out from scratch. Trying to ascertain if it's some combination of out_of_date_cache attrib etc Trying to remove_all and remove of bakes ahead of it seems to have some success. I'm testing some of this (above for example) within Blender desktop session so that may behave differently from the cmdline -P method. $\endgroup$ Mar 3, 2015 at 15:24
  • $\begingroup$ Execution on commandline is reliably baking the domain when I remove_bake but even though I'm picking out the domain with the above it's baking both. $\endgroup$ Mar 3, 2015 at 19:31
  • $\begingroup$ Another thing, and I think this has been explained when the ptcache systems were added to Blender, was that there was no means to bake only one cache at a time. Next issue is to tell the following Blender scene that the commandline generated bake to disk data is up to date and usable. $\endgroup$ Mar 4, 2015 at 20:01
  • $\begingroup$ @JamieMurray are you now able to bake the cache to disk , and the problem is in baking individual object cache ? $\endgroup$
    – Chebhou
    Mar 4, 2015 at 20:27
  • $\begingroup$ it is. Exploring how to cache one of the two smoke domains using command line executed script and how to go about rendering the frames of the newly updated sim caches using the same scene file that generated the updated cache/bake also via command line. $\endgroup$ Mar 4, 2015 at 21:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .