enzyme69 / blendersushi

Blender Sushi related scripts. Mostly about Sverchok, Geometry Nodes, Animation Nodes, and related Python scripts.
243 stars 33 forks source link

LIVENODING 928 / Baking Cycles Procedural Texture #301

Open enzyme69 opened 6 years ago

enzyme69 commented 6 years ago

cycle_surface_baker_003_2018_01_28_01_23.zip

screen shot 2018-01-28 at 12 23 00 pm

A basic example setup to bake Cycles Texture.

enzyme69 commented 6 years ago
# Script to bake multiple frame material

import bpy

for i in range(1,31):

    # advance frame by one
    #bpy.context.scene.frame_current = i # crap this one does not update while rendering, using one below

    bpy.context.scene.frame_set(i)

    print("Baking now frame.....", i) 
    # bake button
    bpy.ops.object.bake(type='COMBINED')

    print("Saving now frame .....", i)

    pathtofile="/Users/jimmygunawan/Desktop/face_AR_004/bake_{:03d}.png".format(i)
    bpy.data.images['FACE_RANDOM'].save_render(filepath=pathtofile)
enzyme69 commented 6 years ago

IMPORTANT: Before hitting the "Bake" button, ensure you have Image node pointing at an image to save and 3D Mesh "active".