Variables not matching objects issue


#1

Ive been working through a DT series on really basic Pythin and theres this issue im having with Variables.

Basically im establishing that a polySphere and a Curve are Variables and then doing a parent constraint

weapCtrl = “anim_weapon01”
weapGRP = “weaponGRP”
mc.parentConstraint(“weapCtrl”, “weapGRP”, mo=True, weight=1)

I am using the exact file and code from the Tutorial

I keep getting this error, but it doesnt make any sense when the object weapCtrl does match an object name, its a defined Variable.

Error: ValueError: file <maya console> line 4: No object matches name: weapCtrl

I know this is basic coding, but im stuck cause i’m new. id really appreciate any explanation as to why it doesnt work for me, but it works for the guy doing the Tutorial lol.Thanks.


#2

You use a string, not a variable name in the parentConstraint function:

weapCtrl = "anim_weapon01"
 weapGRP = "weaponGRP"
 mc.parentConstraint("weapCtrl", "weapGRP", mo=True, weight=1)

has to be:

weapCtrl = "anim_weapon01"
 weapGRP = "weaponGRP"
 mc.parentConstraint(weapCtrl, weapGRP, mo=True, weight=1)

#3

Got it

Thanks!