I am using Blender 2.77 and want to render many smoke simulations in cycles from a script. The idea is to take one template smoke simulation, change the parameters as specified in a csv table, render with the changed parameters and then move on to the line in the csv table. Whenever I run my script, the rendered output of the smoke simulation is the same although the parameters are changed in the blend file. I suspect that I need to rerun the smoke simulation each time I want to render, but I am not sure how to do that.
# for each line in csv file do this for k in range(len(outputName)): # skip first line if k == 0: print (" skip header") else: # change smoke settings according to csv file # get the attributes from the Camera, Flow and Domain object myFlow = bpy.data.objects["Circle"].modifiers["Smoke"].flow_settings myDomain = bpy.data.objects["Smoke Domain"].modifiers["Smoke"].domain_settings # get the domain and flow attributes smokeVorticity = myDomain.vorticity # amount of turbulence smokeAlpha = myDomain.alpha smokeDensity = myFlow.density smokeTempDiff = myFlow.temperature # set domain and flow attributes smokeVorticity = vorticity[k] smokeAlpha = alpha[k] smokeDensity = density[k] # set windforce bpy.data.objects["Field"].field.strength = float(force[k]) # set render output settings bpy.data.scenes["Smoke"].cycles.seed = int(seed[k]) # set number of samples to render each pixel (the more the longer it takes) bpy.data.scenes["Smoke"].cycles.samples = 3 #crank this up to at least 300 # set end frame bpy.data.scenes["Smoke"].frame_end = 50 # change this to 100 later # set render path: fileName = bpy.path.basename(bpy.context.blend_data.filepath) fileName = os.path.splitext(fileName) bpy.data.scenes["Smoke"].render.filepath = os.path.join("//renderings", "smoke", outputName[k], outputName[k] + "_" ) # render the scene bpy.ops.render.render(animation =True) print(outputName[k] + " rendered, moving on to next file")