// =========================================================================== // 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. // =========================================================================== proc int jlMultiMatch(string $name, string $match1, string $match2) { string $match = match($match1,$name); if (size($match)) return 1; $match = match($match2,$name); if (size($match)) return 1; return 0; } global proc int[] jointLabelInfoForString(string $item) { int $type = -1; int $side = -1; if (jlMultiMatch($item,"root","Root") || jlMultiMatch($item,"pelvis","Pelvis") || jlMultiMatch($item,"hips","Hips")) { $side = 0; $type = 1; } else if (jlMultiMatch($item,"hip","Hip") || jlMultiMatch($item,"upleg","UpLeg")) { $type = 2; } else if (jlMultiMatch($item,"knee","Knee") || jlMultiMatch($item,"leg","Leg")) { $type = 3; } else if (jlMultiMatch($item,"back","Back")) { $side = 0; $type = 6; } else if (jlMultiMatch($item,"spine","Spine")) { $side = 0; $type = 6; } else if (jlMultiMatch($item,"neck","Neck")) { $side = 0; $type = 7; } else if (jlMultiMatch($item,"head","Head")) { $side = 0; $type = 8; } else if (jlMultiMatch($item,"collar","Collar")) { $type = 9; } else if (jlMultiMatch($item,"elbow","Elbow") || jlMultiMatch($item,"forearm","ForeArm")) { $type = 11; } else if (jlMultiMatch($item,"shoulder","Shoulder") || jlMultiMatch($item,"arm","Arm")) { $type = 10; } else if (jlMultiMatch($item,"footthumb","FootThumb")) { $type = 29; } else if (jlMultiMatch($item,"thumb","Thumb")) { $type = 14; } else if (jlMultiMatch($item,"propa","PropA")) { $type = 15; } else if (jlMultiMatch($item,"propb","PropB")) { $type = 16; } else if (jlMultiMatch($item,"propc","PropC")) { $type = 17; } else if (jlMultiMatch($item,"other","Other")) { $type = 18; } else if (jlMultiMatch($item,"index","Index") && (jlMultiMatch($item,"finger","Finger") || jlMultiMatch($item,"hand","Hand"))) { $type = 19; } else if (jlMultiMatch($item,"middle","Middle") && (jlMultiMatch($item,"finger","Finger") || jlMultiMatch($item,"hand","Hand"))) { $type = 20; } else if (jlMultiMatch($item,"ring","Ring") && (jlMultiMatch($item,"finger","Finger") || jlMultiMatch($item,"hand","Hand"))) { $type = 21; } else if (jlMultiMatch($item,"pinky","Pinky") && (jlMultiMatch($item,"finger","Finger") || jlMultiMatch($item,"hand","Hand"))) { $type = 22; } else if (jlMultiMatch($item,"extra","Extra") && !jlMultiMatch($item,"foot","Foot") && (jlMultiMatch($item,"finger","Finger") || jlMultiMatch($item,"hand","Hand"))) { $type = 23; } else if (jlMultiMatch($item,"bigtoe","BigToe")) { $type = 24; } else if (jlMultiMatch($item,"index","Index") && (jlMultiMatch($item,"toe","Toe") || jlMultiMatch($item,"foot","Foot"))) { $type = 25; } else if (jlMultiMatch($item,"middle","Middle") && (jlMultiMatch($item,"toe","Toe") || jlMultiMatch($item,"foot","Foot"))) { $type = 26; } else if (jlMultiMatch($item,"ring","Ring") && (jlMultiMatch($item,"toe","Toe") || jlMultiMatch($item,"foot","Foot"))) { $type = 27; } else if (jlMultiMatch($item,"pinky","Pinky") && (jlMultiMatch($item,"toe","Toe") || jlMultiMatch($item,"foot","Foot"))) { $type = 28; } else if (jlMultiMatch($item,"extra","Extra") && (jlMultiMatch($item,"toe","Toe") || jlMultiMatch($item,"foot","Foot"))) { $type = 29; } else if (jlMultiMatch($item,"finger","Finger")) { $type = 13; } else if (jlMultiMatch($item,"toe","Toe")) { $type = 5; } else if (jlMultiMatch($item,"foot","Foot")) { $type = 4; } else if (jlMultiMatch($item,"hand","Hand")) { $type = 12; } if (jlMultiMatch($item,"left","Left")) { $side = 1; } else if (jlMultiMatch($item,"right","Right")) { $side = 2; } else if (jlMultiMatch($item,"center","Center")) { $side = 0; } if ($side == -1) { // check for labels starting with "l" or "r" such as // "L_Knee", "rtKnee", etc... // string $startLetter = substring($item,1,1); if ($startLetter == "l" || $startLetter == "L") { $side = 1; } else if ($startLetter == "r" || $startLetter == "R") { $side = 2; } } int $labelInfo[] = { $type, $side }; return $labelInfo; }