I'm trying to copy one mesh's curveWarp attribute to multiple other meshes curveWarp attributes using a for loop. Thing is, I don't know how to access a node's curveWarp attribute in a smart way. I can get it to work if I hardcode it like:
pm.setAttr("curveWarp6.lengthScale", pm.getAttr("curveWarp5.lengthScale"))
but this requires I find the number following "curveWarp" so that setAttr() knows where I'm copying to, which defeats the purpose of scripting if you have 30 or 40 meshes.
Another possible solution that didn't work:
pm.copyAttr("pSolid2", "pSolid3", values = True, attribute = ["curveWarp"]) #curveWarp.lengthScale?
where pSolid2 and 3 are both meshes with curveWarp nodes...
I thought copyAttr() would also let me just copy all the attributes associated with curveWarp like curveWarp.lengthScale, curveWarp.scaleCurve_Position, curveWarp.scaleCurve_Value, etc from one mesh to another, but running it gives me the error: "# Warning: Skipping attribute 'curveWarp5'. It did not exist on one or both of the selected objects."
I'm thinking I'm using the wrong flag to denote all curveWarp attributes, if so, what is it? There is nothing on curveWarp in the pyMel API.
Replies
Just a guess on the copyAttr, the docs show them using only the attribute name. Try 'lengthScale' instead of 'curvewarp.lengthScale'?
http://forums.cgsociety.org/showthread.php?p=8365118#post8365118
although he uses functions I've yet to learn, which makes sense since I've only started learning Pymel.