analitics

Pages

Saturday, June 11, 2022

Blender 3D and python scripting - part 014.

In this tutorial I will show you how can add a shape key to the branch using this source code:
# now set up shape key in Blender
mesh=obj_branch.data
sk_basis = obj_branch.shape_key_add(name='Basis',from_mix=False)
sk_basis.interpolation = 'KEY_LINEAR'
# must set relative to false here
obj_branch.data.shape_keys.use_relative = False

# create new shape key
sk = obj_branch.shape_key_add(name='Deform',from_mix=False)
sk.interpolation = 'KEY_LINEAR'
sk.slider_min = 0
sk.slider_max = 2

# ... and add it to the scene