Skip to main content
deleted 8 characters in body; edited tags
Source Link
David
  • 49.7k
  • 40
  • 162
  • 318

I have the following code and want to add a driver to the rest length of the stretch to constraint (bone constraint), but the console says that the property path is invalid. What am I doing wrong?

armature = Name of my armature
str(GrpName)+"_bone" = Name of the armatures bone

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

The code before the driver_add parentheses is definatelydefinitely correct, I tested it with the rotation quaternion of the bone and it worked. But it doesn't work with the bone constraint.

I have the following code and want to add a driver to the rest length of the stretch to constraint (bone constraint), but the console says that the property path is invalid. What am I doing wrong?

armature = Name of my armature
str(GrpName)+"_bone" = Name of the armatures bone

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

The code before the driver_add parentheses is definately correct, I tested it with the rotation quaternion of the bone and it worked. But it doesn't work with the bone constraint.

I have the following code and want to add a driver to the rest length of the stretch to constraint (bone constraint), but the console says that the property path is invalid. What am I doing wrong?

armature = Name of my armature
str(GrpName)+"_bone" = Name of the armatures bone

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

The code before the driver_add parentheses is definitely correct, I tested it with the rotation quaternion of the bone and it worked. But it doesn't work with the bone constraint.

Tweeted twitter.com/#!/StackBlender/status/508129106991779840
grammar
Source Link
gandalf3
  • 158.3k
  • 60
  • 612
  • 1.1k

PYTHON Bone Constraints and Driver Creating a driver on a constraint with python?

Hei Guys,

i have a short question. I have the following code and want to add a driver to the rest lenghtlength of the stretch to constraint  (Bone Constraintbone constraint). But everytime, but the console says that the Property Pathproperty path is invalid. What am iI doing wrong  ?

Variables armature = Name of my armature str(GrpName)+"_bone" = Name of the armatures bone

armature = Name of my armature
str(GrpName)+"_bone" = Name of the armatures bone

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

PS: The Codecode before the driver_adddriver_add parentheses is definately correct i, I tested it with the rotation quaternion of the bone and it worked but not. But it doesn't work with the bone constraint.

I hope someone can give me an advice :)

PYTHON Bone Constraints and Driver?

Hei Guys,

i have a short question. I have the following code and want to add a driver to the rest lenght of the stretch to constraint(Bone Constraint). But everytime the console says that the Property Path is invalid. What am i doing wrong  ?

Variables armature = Name of my armature str(GrpName)+"_bone" = Name of the armatures bone

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

PS: The Code before the driver_add parentheses is definately correct i tested it with the rotation quaternion of the bone and it worked but not the bone constraint.

I hope someone can give me an advice :)

Creating a driver on a constraint with python?

I have the following code and want to add a driver to the rest length of the stretch to constraint  (bone constraint), but the console says that the property path is invalid. What am I doing wrong?

armature = Name of my armature
str(GrpName)+"_bone" = Name of the armatures bone

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

The code before the driver_add parentheses is definately correct, I tested it with the rotation quaternion of the bone and it worked. But it doesn't work with the bone constraint.

Source Link

PYTHON Bone Constraints and Driver?

Hei Guys,

i have a short question. I have the following code and want to add a driver to the rest lenght of the stretch to constraint(Bone Constraint). But everytime the console says that the Property Path is invalid. What am i doing wrong ?

Variables armature = Name of my armature str(GrpName)+"_bone" = Name of the armatures bone

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

PS: The Code before the driver_add parentheses is definately correct i tested it with the rotation quaternion of the bone and it worked but not the bone constraint.

I hope someone can give me an advice :)