Skip to main content
added 1 character in body
Source Link
CodeManX
  • 29.7k
  • 3
  • 92
  • 131

Add the driver to the object, isthe data path is relative to that:

# We want Object.pose.bones[...].constraints[...].rest_length
# So use an object and the data_path 'pose.bones[...].constraints[...].rest_length'

BaseLenghtDrv = bpy.data.objects[armature].driver_add('pose.bones["'+str(GrpName)+'_bone"].constraints["Stretch To"].rest_length').driver

Add the driver to the object, is data path is relative to that:

# We want Object.pose.bones[...].constraints[...].rest_length
# So use an object and the data_path 'pose.bones[...].constraints[...].rest_length'

BaseLenghtDrv = bpy.data.objects[armature].driver_add('pose.bones["'+str(GrpName)+'_bone"].constraints["Stretch To"].rest_length').driver

Add the driver to the object, the data path is relative to that:

# We want Object.pose.bones[...].constraints[...].rest_length
# So use an object and the data_path 'pose.bones[...].constraints[...].rest_length'

BaseLenghtDrv = bpy.data.objects[armature].driver_add('pose.bones["'+str(GrpName)+'_bone"].constraints["Stretch To"].rest_length').driver
Source Link
CodeManX
  • 29.7k
  • 3
  • 92
  • 131

Add the driver to the object, is data path is relative to that:

# We want Object.pose.bones[...].constraints[...].rest_length
# So use an object and the data_path 'pose.bones[...].constraints[...].rest_length'

BaseLenghtDrv = bpy.data.objects[armature].driver_add('pose.bones["'+str(GrpName)+'_bone"].constraints["Stretch To"].rest_length').driver