// =========================================================================== // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // =========================================================================== global proc int poseInterpolatorExportSelectedNodes() { // get the selected poseInterpolator nodes string $tpls[] = getPoseEditorTreeviewSelection(1); string $tplGroupsSelected[] = getPoseEditorTreeviewSelection(0); for ($item in $tplGroupsSelected) $tpls = stringArrayCatenate($tpls, getTplsInGroup(stringRemovePrefix($item, "-"))); // get the file path string $shpFileFilter = getPluginResource("poseInterpolator", "kPose") + " (*.pose) (*.pose)"; string $title = getPluginResource("poseInterpolator", "kExportPoses"); string $result[] = `fileDialog2 -fileFilter $shpFileFilter -caption $title`; if (size($result) == 0) { // for example Cancel button is clicked. return -1; } string $filePath = $result[0]; return poseInterpolatorExport($filePath, $tpls, 1); } global proc string[] getTplsInGroup(string $directoryIndex) { string $tpls[]; int $childIndices[] = `getAttr ("poseInterpolatorManager.poseInterpolatorDirectory[" + $directoryIndex + "].childIndices")`; for ($child in $childIndices) { if ($child < 0) $tpls = stringArrayCatenate($tpls, getTplsInGroup(-$child)); else { string $connectedTpls[] = `listConnections -s on -d off ("poseInterpolatorManager.poseInterpolatorParent[" + $child + "]")`; if (size($connectedTpls) == 1) $tpls[size($tpls)] = $connectedTpls[0]; } } return $tpls; }