Message 1 of 2
Not applicable
07-22-2019
02:59 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
For my script, I am using a function that collects the world space transform values from an object. I'm getting a "Cannot convert data of type float[] to type float" error when executing a function for a specific part of my script. I don't know why this error occurs as I have labeled my data types correctly.
Part of the script that uses the function:
string $jointChildren[], $startJoint, $endJoint;
float $startTrans[], $endTrans[];
$startJoint = "joint1";
$jointChildren = `listRelatives -ad $startJoint`;
$endJoint = $jointChildren[0];
$startTrans = `getTransform($startJoint)`;
$endTrans = `getTransform($endJoint)`;
print($startTrans);
print($endTrans);
makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 -pn 1;
joint -e -oj xzy -secondaryAxisOrient zup -ch -zso;
createIKSpline($selJoints[0], $selJoints[1]);The function that it calls:
// Get the transform values of an object
global proc float[] getTransform(string $obj) {
float $xTrans = `getAttr $obj.translateX`;
float $yTrans = `getAttr $obj.translateY`;
float $zTrans = `getAttr $obj.translateZ`;
float $trans[3] = {$xTrans, $yTrans, $zTrans};
return $trans;
}
Solved! Go to Solution.