1184 lines
47 KiB
Plaintext
1184 lines
47 KiB
Plaintext
|
//copyright Yasushi Emoto
|
||
|
//version1.04 2024-08-22
|
||
|
|
||
|
global proc FACEMOTION3D_addNewShelfTab()
|
||
|
{
|
||
|
global string $gShelfTopLevel;
|
||
|
string $Install_shelfName = "FACEMOTION3D";
|
||
|
int $Install_shelfExists = `layout -q -ex $Install_shelfName`;
|
||
|
if ($Install_shelfExists == 0)
|
||
|
{
|
||
|
addNewShelfTab $Install_shelfName;
|
||
|
}
|
||
|
shelfTabLayout -e -selectTab $Install_shelfName $gShelfTopLevel;
|
||
|
}
|
||
|
|
||
|
global proc FACEMOTION3D_addNewShelfButton()
|
||
|
{
|
||
|
string $FACEMOTION3D_allString = "global string $FACEMOTION3D_combinedString = \"\";\n\
|
||
|
global int $FACEMOTION3D_bakeAnimationFlag = 0;\n\
|
||
|
global int $FACEMOTION3D_loopCount = 0;\n\
|
||
|
global float $FACEMOTION3D_startTime = 0.0;\n\
|
||
|
global float $FACEMOTION3D_nowTime = 0.0;\n\
|
||
|
global float $FACEMOTION3D_preTime = 0.0;\n\
|
||
|
global int $FACEMOTION3D_nowFrame = 0;\n\
|
||
|
global int $FACEMOTION3D_preFrame = -1000;\n\
|
||
|
global float $FACEMOTION3D_currentfpsReciprocal = 24.0;\n\
|
||
|
global int $FACEMOTION3D_Maya2022BugStatus = 0;\n\
|
||
|
global string $FACEMOTION3D_compressAlgorithm = \"zlib_\";\n\
|
||
|
global float $FACEMOTION3D_StrengthOfBlendShapes = 1.0;\n\
|
||
|
\n\
|
||
|
\n\
|
||
|
global proc FACEMOTION3D_compressAlgorithmCheck()\n\
|
||
|
{\n\
|
||
|
global string $FACEMOTION3D_compressAlgorithm;\n\
|
||
|
string $maya_version = `about -v`;\n\
|
||
|
int $maya_versionInt = 2020;\n\
|
||
|
catchQuiet($maya_versionInt = (int)$maya_version);\n\
|
||
|
if($maya_versionInt > 2020)\n\
|
||
|
{\n\
|
||
|
$FACEMOTION3D_compressAlgorithm = \"lzma_\";\n\
|
||
|
}\n\
|
||
|
else\n\
|
||
|
{\n\
|
||
|
$FACEMOTION3D_compressAlgorithm = \"zlib_\";\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
global proc FACEMOTION3D_Maya2022BugStatusCheck()\n\
|
||
|
{\n\
|
||
|
global int $FACEMOTION3D_Maya2022BugStatus;\n\
|
||
|
\n\
|
||
|
string $maya_version = `about -v`;\n\
|
||
|
int $maya_version_num = 2020;\n\
|
||
|
int $isdecimal = python(\"u'\"+$maya_version+\"'.isdecimal()\");\n\
|
||
|
if($isdecimal == 1)\n\
|
||
|
{\n\
|
||
|
$maya_version_num = int($maya_version);\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
if($maya_version_num >= \2022\)\n\
|
||
|
{\n\
|
||
|
if($FACEMOTION3D_Maya2022BugStatus == 0)\n\
|
||
|
{\n\
|
||
|
string $PORT_NUM = \":44444\";\n\
|
||
|
catchQuiet(`commandPort -n $PORT_NUM`);\n\
|
||
|
catchQuiet(`commandPort -cl -n $PORT_NUM`);\n\
|
||
|
if(catchQuiet(`commandPort -n $PORT_NUM`))\n\
|
||
|
{\n\
|
||
|
$FACEMOTION3D_Maya2022BugStatus = 1;\n\
|
||
|
}\n\
|
||
|
else\n\
|
||
|
{\n\
|
||
|
catchQuiet(`commandPort -cl -n $PORT_NUM`);\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
global proc FACEMOTION3D_setAttrBlendShape(string $attr,float $value)\n\
|
||
|
{\n\
|
||
|
global int $FACEMOTION3D_nowFrame;\n\
|
||
|
global int $FACEMOTION3D_bakeAnimationFlag;\n\
|
||
|
global int $FACEMOTION3D_loopCount;\n\
|
||
|
global float $FACEMOTION3D_StrengthOfBlendShapes;\n\
|
||
|
if(`objExists $attr`)\n\
|
||
|
{\n\
|
||
|
if($FACEMOTION3D_bakeAnimationFlag == 1)\n\
|
||
|
{\n\
|
||
|
if( $FACEMOTION3D_loopCount == 0 || $FACEMOTION3D_nowFrame != -1 )\n\
|
||
|
{\n\
|
||
|
setKeyframe -t $FACEMOTION3D_nowFrame -v($value*$FACEMOTION3D_StrengthOfBlendShapes) $attr;\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
else\n\
|
||
|
{\n\
|
||
|
setAttr $attr ($value*$FACEMOTION3D_StrengthOfBlendShapes);\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
global proc FACEMOTION3D_setAttrObjectAtributeThree(string $objName,string $attr,float $value1,float $value2,float $value3)\n\
|
||
|
{\n\
|
||
|
global int $FACEMOTION3D_nowFrame;\n\
|
||
|
global int $FACEMOTION3D_bakeAnimationFlag;\n\
|
||
|
global int $FACEMOTION3D_loopCount;\n\
|
||
|
string $objAttr = $objName+\".\"+$attr;\n\
|
||
|
\n\
|
||
|
if(`objExists $objAttr`)\n\
|
||
|
{\n\
|
||
|
if($FACEMOTION3D_bakeAnimationFlag == 1)\n\
|
||
|
{\n\
|
||
|
if($FACEMOTION3D_loopCount == 0 || $FACEMOTION3D_nowFrame != -1)\n\
|
||
|
{\n\
|
||
|
setKeyframe -t $FACEMOTION3D_nowFrame -v $value1 ($objAttr+\"X\");\n\
|
||
|
setKeyframe -t $FACEMOTION3D_nowFrame -v $value2 ($objAttr+\"Y\");\n\
|
||
|
setKeyframe -t $FACEMOTION3D_nowFrame -v $value3 ($objAttr+\"Z\");\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
else\n\
|
||
|
{\n\
|
||
|
setAttr $objAttr $value1 $value2 $value3;\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
global proc FACEMOTION3D_getNowFrame(float $n,float $p,int $s)\n\
|
||
|
{\n\
|
||
|
global int $FACEMOTION3D_nowFrame;\n\
|
||
|
global int $FACEMOTION3D_preFrame;\n\
|
||
|
global float $FACEMOTION3D_currentfpsReciprocal;\n\
|
||
|
int $n_FACEMOTION3D_currentfpsReciprocal = int($n/$FACEMOTION3D_currentfpsReciprocal);\n\
|
||
|
\n\
|
||
|
if($n_FACEMOTION3D_currentfpsReciprocal != int($p/$FACEMOTION3D_currentfpsReciprocal))\n\
|
||
|
{\n\
|
||
|
$FACEMOTION3D_nowFrame = $s + $n_FACEMOTION3D_currentfpsReciprocal;\n\
|
||
|
}\n\
|
||
|
else\n\
|
||
|
{\n\
|
||
|
$FACEMOTION3D_nowFrame = -1;\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
global proc FACEMOTION3D_ExecString(string $recievedString)\n\
|
||
|
{\n\
|
||
|
global string $FACEMOTION3D_combinedString;\n\
|
||
|
global int $FACEMOTION3D_bakeAnimationFlag;\n\
|
||
|
global int $FACEMOTION3D_loopCount;\n\
|
||
|
global float $FACEMOTION3D_startTime;\n\
|
||
|
global float $FACEMOTION3D_nowTime;\n\
|
||
|
global float $FACEMOTION3D_preTime;\n\
|
||
|
\n\
|
||
|
$FACEMOTION3D_combinedString += $recievedString;\n\
|
||
|
string $splited[] = python(\"r'\"+$FACEMOTION3D_combinedString+\"'.split('___FACEMOTION3D')\");\n\
|
||
|
int $splited_len = `size($splited)`;\n\
|
||
|
if($splited_len!=1)\n\
|
||
|
{\n\
|
||
|
int $counter = 0;\n\
|
||
|
for($n in $splited)\n\
|
||
|
{\n\
|
||
|
$FACEMOTION3D_combinedString = $n;\n\
|
||
|
$counter += 1;\n\
|
||
|
if($counter < $splited_len)\n\
|
||
|
{\n\
|
||
|
if($FACEMOTION3D_bakeAnimationFlag == 1)\n\
|
||
|
{\n\
|
||
|
float $time = python(\"import time;time.time()\");\n\
|
||
|
if($FACEMOTION3D_loopCount == 0)\n\
|
||
|
{\n\
|
||
|
$FACEMOTION3D_startTime = $time;\n\
|
||
|
$FACEMOTION3D_nowTime = 0.0;\n\
|
||
|
}\n\
|
||
|
else\n\
|
||
|
{\n\
|
||
|
$FACEMOTION3D_preTime = $FACEMOTION3D_nowTime;\n\
|
||
|
$FACEMOTION3D_nowTime = $time - $FACEMOTION3D_startTime;\n\
|
||
|
}\n\
|
||
|
FACEMOTION3D_getNowFrame($FACEMOTION3D_nowTime,$FACEMOTION3D_preTime,0);\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
if(!`gmatch $FACEMOTION3D_combinedString \"*python(*\"` && !`gmatch $FACEMOTION3D_combinedString \"*sysFile*\"`)\n\
|
||
|
catchQuiet(eval($FACEMOTION3D_combinedString));\n\
|
||
|
\n\
|
||
|
$FACEMOTION3D_combinedString = \"\";\n\
|
||
|
$FACEMOTION3D_loopCount+=1;\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
\n\
|
||
|
global proc compressedHexStringToDecompressedAudioData(string $hexString,string $audioFileFullPath)\n\
|
||
|
{\n\
|
||
|
global string $FACEMOTION3D_compressAlgorithm;\n\
|
||
|
\n\
|
||
|
if($FACEMOTION3D_compressAlgorithm == \"zlib_\")\n\
|
||
|
{\n\
|
||
|
catchQuiet(`python(\"import zlib;bytes_data='\"+$hexString+\"'.decode('hex');bytes_data_decompressed = zlib.decompress(bytes_data,-15);wf = open('\"+$audioFileFullPath+\"', 'wb');wf.write(bytes_data_decompressed);\")`);\n\
|
||
|
}\n\
|
||
|
else if($FACEMOTION3D_compressAlgorithm == \"lzma_\")\n\
|
||
|
{\n\
|
||
|
catchQuiet(`python(\"import lzma;bytes_data= bytes.fromhex('\"+$hexString+\"');bytes_data_decompressed = lzma.decompress(bytes_data);wf = open('\"+$audioFileFullPath+\"', 'wb');wf.write(bytes_data_decompressed);\")`);\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
global proc string compressedHexStringToDecompressedString(string $hexString)\n\
|
||
|
{\n\
|
||
|
global string $FACEMOTION3D_compressAlgorithm;\n\
|
||
|
\n\
|
||
|
string $returnString = $hexString;\n\
|
||
|
\n\
|
||
|
if($FACEMOTION3D_compressAlgorithm == \"zlib_\")\n\
|
||
|
{\n\
|
||
|
catchQuiet($returnString = `python(\"import zlib;bm=r'\"+$returnString+\"'.decode('hex');bmm = zlib.decompress(bm,-15);bmm.decode('utf-8')\")`);\n\
|
||
|
}\n\
|
||
|
else if($FACEMOTION3D_compressAlgorithm == \"lzma_\")\n\
|
||
|
{\n\
|
||
|
catchQuiet($returnString = `python(\"import lzma;bm = bytes.fromhex(r'\"+$returnString+\"');bmm = lzma.decompress(bm); bmm.decode('utf-8')\")`);\n\
|
||
|
}\n\
|
||
|
return $returnString;\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
global proc FACEMOTION3D_bakeRecordedAnimation(string $recievedString)\n\
|
||
|
{\n\
|
||
|
global string $FACEMOTION3D_combinedString;\n\
|
||
|
global int $FACEMOTION3D_loopCount;\n\
|
||
|
global float $FACEMOTION3D_startTime;\n\
|
||
|
global float $FACEMOTION3D_nowTime;\n\
|
||
|
global float $FACEMOTION3D_preTime;\n\
|
||
|
global int $FACEMOTION3D_nowFrame;\n\
|
||
|
\n\
|
||
|
\n\
|
||
|
$FACEMOTION3D_combinedString += $recievedString;\n\
|
||
|
int $fm_count = 0;\n\
|
||
|
catchQuiet($fm_count = `python(\"r'\"+$FACEMOTION3D_combinedString+\"'.count('___FACEMOTION3D')\")`);\n\
|
||
|
if($fm_count >= 1)\n\
|
||
|
{\n\
|
||
|
$FACEMOTION3D_combinedString = python(\"r'\"+$FACEMOTION3D_combinedString+\"'.replace('___FACEMOTION3D','')\");\n\
|
||
|
\n\
|
||
|
if(!`gmatch $FACEMOTION3D_combinedString \"*python(*\"` && !`gmatch $FACEMOTION3D_combinedString \"*sysFile*\"` && !`gmatch $FACEMOTION3D_combinedString \"*system*\"`)\n\
|
||
|
{\n\
|
||
|
if($FACEMOTION3D_combinedString == \"noRecordedData\")\n\
|
||
|
{\n\
|
||
|
confirmDialog -title \"There is no recorded data\" -message \"Please execute after recording the animation on the iOS application side.\"\n\
|
||
|
-button \"OK\" -defaultButton \"OK\";\n\
|
||
|
}\n\
|
||
|
else\n\
|
||
|
{\n\
|
||
|
string $sendMessage = \"NowBakingMaya_FACEMOTION3D\";\n\
|
||
|
string $iosipAddress = `textField -q -text \"FACEMOTION3D_iosipAddressTextField\"`;\n\
|
||
|
FACEMOTION3D_sendMessageToiOS($sendMessage);\n\
|
||
|
\n\
|
||
|
string $bakeStartFrameString = `textField -q -text FACEMOTION3D_bakeStartFrame`;\n\
|
||
|
int $bakeStartFrame = int($bakeStartFrameString);\n\
|
||
|
int $bakeAudioStartFrame = $bakeStartFrame + 5;\n\
|
||
|
\n\
|
||
|
int $recieveAudioCheckBoxValue = `checkBox -q -v recieveAudioCheckBox`;\n\
|
||
|
string $splitedString[];\n\
|
||
|
float $bakeRecordTimeList[];\n\
|
||
|
string $audioFileFullPath = \"\";\n\
|
||
|
if($recieveAudioCheckBoxValue == 1)\n\
|
||
|
{\n\
|
||
|
$splitedString = python(\"r'\"+$FACEMOTION3D_combinedString+\"'.split('===')\");\n\
|
||
|
$FACEMOTION3D_combinedString = compressedHexStringToDecompressedString($splitedString[0]);\n\
|
||
|
$splitedString[0] = \"\";\n\
|
||
|
\n\
|
||
|
string $dirPathTextFieldValue = `textField -q -text FACEMOTION3D_audioSaveFolder`;\n\
|
||
|
string $dirPath = fromNativePath($dirPathTextFieldValue);\n\
|
||
|
string $audioFileName = `textField -q -text FACEMOTION3D_audioFileName`;\n\
|
||
|
$audioFileFullPath = $dirPath + \"/\" + $audioFileName + \".wav\";\n\
|
||
|
\n\
|
||
|
compressedHexStringToDecompressedAudioData($splitedString[1],$audioFileFullPath);\n\
|
||
|
$splitedString[1] = \"\";\n\
|
||
|
if(`size $splitedString` > 2)\n\
|
||
|
{\n\
|
||
|
string $bakeRecordTimeListString = compressedHexStringToDecompressedString($splitedString[2]);\n\
|
||
|
$bakeRecordTimeList = python(\"import json;json.loads(r'\"+$bakeRecordTimeListString+\"')\");\n\
|
||
|
}\n\
|
||
|
$splitedString = {};\n\
|
||
|
}\n\
|
||
|
else\n\
|
||
|
{\n\
|
||
|
$splitedString = python(\"r'\"+$FACEMOTION3D_combinedString+\"'.split('===')\");\n\
|
||
|
$FACEMOTION3D_combinedString = compressedHexStringToDecompressedString($splitedString[0]);\n\
|
||
|
$splitedString[0] = \"\";\n\
|
||
|
\n\
|
||
|
if(`size $splitedString` > 1)\n\
|
||
|
{\n\
|
||
|
string $bakeRecordTimeListString = compressedHexStringToDecompressedString($splitedString[1]);\n\
|
||
|
$bakeRecordTimeList = python(\"import json;json.loads(r'\"+$bakeRecordTimeListString+\"')\");\n\
|
||
|
}\n\
|
||
|
$splitedString = {};\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
string $messageRecordList[] = python(\"import json;json.loads(r'\"+$FACEMOTION3D_combinedString+\"')\");\n\
|
||
|
$FACEMOTION3D_combinedString = \"\";\n\
|
||
|
\n\
|
||
|
int $maxCount = `size $messageRecordList`;\n\
|
||
|
progressWindow -title \"Now Baking...\" -progress $FACEMOTION3D_loopCount -max $maxCount;\n\
|
||
|
\n\
|
||
|
for($message in $messageRecordList)\n\
|
||
|
{\n\
|
||
|
progressWindow -edit -progress $FACEMOTION3D_loopCount;\n\
|
||
|
if($FACEMOTION3D_loopCount == 0)\n\
|
||
|
{\n\
|
||
|
$FACEMOTION3D_startTime = 0.0;\n\
|
||
|
$FACEMOTION3D_nowTime = 0.0;\n\
|
||
|
}\n\
|
||
|
else\n\
|
||
|
{\n\
|
||
|
if($FACEMOTION3D_loopCount == 0)\n\
|
||
|
{\n\
|
||
|
$FACEMOTION3D_preTime = (1.0/60.0)*($FACEMOTION3D_loopCount - 1);\n\
|
||
|
$FACEMOTION3D_nowTime = (1.0/60.0)*$FACEMOTION3D_loopCount;\n\
|
||
|
}\n\
|
||
|
else\n\
|
||
|
{\n\
|
||
|
$FACEMOTION3D_preTime = $bakeRecordTimeList[$FACEMOTION3D_loopCount - 1];\n\
|
||
|
$FACEMOTION3D_nowTime = $bakeRecordTimeList[$FACEMOTION3D_loopCount];\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
FACEMOTION3D_getNowFrame($FACEMOTION3D_nowTime,$FACEMOTION3D_preTime,$bakeStartFrame);\n\
|
||
|
if($FACEMOTION3D_nowFrame!=-1)\n\
|
||
|
{\n\
|
||
|
catchQuiet(eval($message));\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
$FACEMOTION3D_loopCount+=1;\n\
|
||
|
}\n\
|
||
|
progressWindow -endProgress;\n\
|
||
|
\n\
|
||
|
if($recieveAudioCheckBoxValue == 1)\n\
|
||
|
{\n\
|
||
|
python(\"import time;time.sleep(2.5);\");\n\
|
||
|
catchQuiet(doSoundImportArgList (\"1\", {$audioFileFullPath,string($bakeAudioStartFrame)}));\n\
|
||
|
}\n\
|
||
|
$sendMessage = \"BakeFinishMaya_FACEMOTION3D\";\n\
|
||
|
FACEMOTION3D_sendMessageToiOS($sendMessage);\n\
|
||
|
\n\
|
||
|
confirmDialog -title \"Bake Complete!\" -message \"The animation bake is complete.\"\n\
|
||
|
-button \"OK\" -defaultButton \"OK\";\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
FACEMOTION3D_wait_bakeRecordedAnimationClose();\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
global proc FACEMOTION3D_wait_connectionTapped()\n\
|
||
|
{\n\
|
||
|
select -cl;\n\
|
||
|
string $buttonLabel = `button -q -label \"FACEMOTION3D_waitConnectionButton\"`;\n\
|
||
|
if($buttonLabel==\"Stream Live\")\n\
|
||
|
{\n\
|
||
|
button -edit -label \"Disconnect stream\" \"FACEMOTION3D_waitConnectionButton\";\n\
|
||
|
FACEMOTION3D_wait_connection();\n\
|
||
|
}\n\
|
||
|
else if($buttonLabel==\"Disconnect stream\")\n\
|
||
|
{\n\
|
||
|
button -edit -label \"Stream Live\" \"FACEMOTION3D_waitConnectionButton\";\n\
|
||
|
FACEMOTION3D_disconnect();\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
global proc FACEMOTION3D_wait_connection()\n\
|
||
|
{\n\
|
||
|
global string $FACEMOTION3D_combinedString;\n\
|
||
|
global int $FACEMOTION3D_bakeAnimationFlag;\n\
|
||
|
global int $FACEMOTION3D_loopCount;\n\
|
||
|
global float $FACEMOTION3D_startTime;\n\
|
||
|
global float $FACEMOTION3D_nowTime;\n\
|
||
|
global float $FACEMOTION3D_preTime;\n\
|
||
|
global int $FACEMOTION3D_preFrame;\n\
|
||
|
$FACEMOTION3D_combinedString = \"\";\n\
|
||
|
$FACEMOTION3D_bakeAnimationFlag = 0;\n\
|
||
|
$FACEMOTION3D_loopCount = 0;\n\
|
||
|
$FACEMOTION3D_startTime = 0.0;\n\
|
||
|
$FACEMOTION3D_nowTime = 0.0;\n\
|
||
|
$FACEMOTION3D_preTime = 0.0;\n\
|
||
|
$FACEMOTION3D_preFrame = -1000;\n\
|
||
|
global int $FACEMOTION3D_Maya2022BugStatus;\n\
|
||
|
\n\
|
||
|
int $autoConnectCheckBoxValue = `checkBox -q -v autoConnectCheckBox`;\n\
|
||
|
optionVar -sv \"autoConnectCheckBoxValue\" $autoConnectCheckBoxValue;\n\
|
||
|
\n\
|
||
|
string $localipAddress = `textField -q -text \"FACEMOTION3D_localipAddressTextField\"`;\n\
|
||
|
$localipAddress = python(\"r'\"+$localipAddress+\"'.replace(' ','')\");\n\
|
||
|
\n\
|
||
|
optionVar -sv \"FACEMOTION3D_localipAddressTextField\" $localipAddress;\n\
|
||
|
\n\
|
||
|
string $iosipAddress = `textField -q -text \"FACEMOTION3D_iosipAddressTextField\"`;\n\
|
||
|
$iosipAddress = python(\"r'\"+$iosipAddress+\"'.replace(' ','')\");\n\
|
||
|
\n\
|
||
|
optionVar -sv \"FACEMOTION3D_iosipAddressTextField\" $iosipAddress;\n\
|
||
|
\n\
|
||
|
string $sendMessage = \"MayaDirectRecieve_FACEMOTION3Dpayea\";\n\
|
||
|
\n\
|
||
|
string $streamPort = `textField -q -text \"FACEMOTION3D_streamPortTextField\"`;\n\
|
||
|
string $PORT_NUM = $localipAddress+\":\"+$streamPort;\n\
|
||
|
if(`commandPort -q $PORT_NUM`)\n\
|
||
|
{\n\
|
||
|
if($FACEMOTION3D_Maya2022BugStatus == 0)\n\
|
||
|
{\n\
|
||
|
commandPort -cl -n $PORT_NUM;\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
commandPort -pre \"FACEMOTION3D_ExecString\" -bufferSize 8192 -n $PORT_NUM;\n\
|
||
|
if($autoConnectCheckBoxValue == 1)\n\
|
||
|
{\n\
|
||
|
FACEMOTION3D_sendMessageToiOS($sendMessage);\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
else\n\
|
||
|
{\n\
|
||
|
if(catchQuiet(`commandPort -pre \"FACEMOTION3D_ExecString\" -bufferSize 8192 -n $PORT_NUM`))\n\
|
||
|
{\n\
|
||
|
confirmDialog -title \"FACEMOTION3D warning\" -message \"Please execute after disconnecting FACEMOTION3D on other window\"\n\
|
||
|
-button \"OK\" -defaultButton \"OK\";\n\
|
||
|
}\n\
|
||
|
else\n\
|
||
|
{\n\
|
||
|
if($autoConnectCheckBoxValue == 1)\n\
|
||
|
{\n\
|
||
|
FACEMOTION3D_sendMessageToiOS($sendMessage);\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
global proc FACEMOTION3D_wait_bakeRecordedAnimationClose()\n\
|
||
|
{\n\
|
||
|
global int $FACEMOTION3D_Maya2022BugStatus;\n\
|
||
|
string $localipAddress = `textField -q -text \"FACEMOTION3D_localipAddressTextField\"`;\n\
|
||
|
$localipAddress = python(\"r'\"+$localipAddress+\"'.replace(' ','')\");\n\
|
||
|
\n\
|
||
|
string $bakePort = `textField -q -text \"FACEMOTION3D_bakePortTextField\"`;\n\
|
||
|
string $PORT_NUM = $localipAddress+\":\"+$bakePort;\n\
|
||
|
if(`commandPort -q $PORT_NUM`)\n\
|
||
|
{\n\
|
||
|
if($FACEMOTION3D_Maya2022BugStatus == 0)\n\
|
||
|
{\n\
|
||
|
commandPort -cl -n $PORT_NUM;\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
global proc FACEMOTION3D_wait_bakeRecordedAnimationPreSettings()\n\
|
||
|
{\n\
|
||
|
string $audioFileFullPath = \"\";\n\
|
||
|
\n\
|
||
|
int $recieveAudioCheckBoxValue = `checkBox -q -v recieveAudioCheckBox`;\n\
|
||
|
if($recieveAudioCheckBoxValue == 1)\n\
|
||
|
{\n\
|
||
|
string $dirPathTextFieldValue = `textField -q -text FACEMOTION3D_audioSaveFolder`;\n\
|
||
|
string $dirPath = fromNativePath($dirPathTextFieldValue);\n\
|
||
|
string $audioFileName = `textField -q -text FACEMOTION3D_audioFileName`;\n\
|
||
|
$audioFileFullPath = $dirPath + \"/\" + $audioFileName + \".wav\";\n\
|
||
|
\n\
|
||
|
int $fileExists = python(\"import os;os.path.exists('\"+$audioFileFullPath+\"')\");\n\
|
||
|
if($fileExists == 1)\n\
|
||
|
{\n\
|
||
|
string $check = `confirmDialog -title \"Audio file already exists.\" -message \"An audio file with the same path already exists. Do you want to delete it before executing it?\" -button \"Yes\" -button \"No\" -defaultButton \"Yes\" -cancelButton \"No\" -dismissString \"No\"`;\n\
|
||
|
if($check == \"Yes\")\n\
|
||
|
{\n\
|
||
|
catchQuiet(`python(\"import os;os.remove('\"+$audioFileFullPath+\"')\")`);\n\
|
||
|
FACEMOTION3D_wait_bakeRecordedAnimation();\n\
|
||
|
}\n\
|
||
|
else if($check == \"No\")\n\
|
||
|
{\n\
|
||
|
return;\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
else\n\
|
||
|
{\n\
|
||
|
FACEMOTION3D_wait_bakeRecordedAnimation();\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
else\n\
|
||
|
{\n\
|
||
|
FACEMOTION3D_wait_bakeRecordedAnimation();\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
global proc FACEMOTION3D_wait_bakeRecordedAnimation()\n\
|
||
|
{\n\
|
||
|
global int $FACEMOTION3D_Maya2022BugStatus;\n\
|
||
|
global string $FACEMOTION3D_combinedString;\n\
|
||
|
global int $FACEMOTION3D_bakeAnimationFlag;\n\
|
||
|
global int $FACEMOTION3D_loopCount;\n\
|
||
|
global float $FACEMOTION3D_startTime;\n\
|
||
|
global float $FACEMOTION3D_nowTime;\n\
|
||
|
global float $FACEMOTION3D_preTime;\n\
|
||
|
global float $FACEMOTION3D_currentfpsReciprocal;\n\
|
||
|
global string $FACEMOTION3D_compressAlgorithm;\n\
|
||
|
\n\
|
||
|
string $buttonLabel = `button -q -label \"FACEMOTION3D_waitConnectionButton\"`;\n\
|
||
|
if($buttonLabel==\"Disconnect stream\")\n\
|
||
|
{\n\
|
||
|
confirmDialog -title \"Error\" -message \"This feature is not available during streaming.\"\n\
|
||
|
-button \"OK\" -defaultButton \"OK\";\n\
|
||
|
}\n\
|
||
|
else\n\
|
||
|
{\n\
|
||
|
$FACEMOTION3D_combinedString = \"\";\n\
|
||
|
$FACEMOTION3D_bakeAnimationFlag = 1;\n\
|
||
|
$FACEMOTION3D_loopCount = 0;\n\
|
||
|
$FACEMOTION3D_startTime = 0.0;\n\
|
||
|
$FACEMOTION3D_nowTime = 0.0;\n\
|
||
|
$FACEMOTION3D_preTime = 0.0;\n\
|
||
|
$FACEMOTION3D_currentfpsReciprocal = 1.0/`currentTimeUnitToFPS`;\n\
|
||
|
\n\
|
||
|
FACEMOTION3D_wait_bakeRecordedAnimationClose();\n\
|
||
|
\n\
|
||
|
string $audioFolderPath = `textField -q -text FACEMOTION3D_audioSaveFolder`;\n\
|
||
|
optionVar -sv \"FACEMOTION3D_audioSaveFolder\" $audioFolderPath;\n\
|
||
|
\n\
|
||
|
string $localipAddress = `textField -q -text \"FACEMOTION3D_localipAddressTextField\"`;\n\
|
||
|
$localipAddress = python(\"r'\"+$localipAddress+\"'.replace(' ','')\");\n\
|
||
|
\n\
|
||
|
optionVar -sv \"FACEMOTION3D_localipAddressTextField\" $localipAddress;\n\
|
||
|
\n\
|
||
|
int $recieveAudioCheckBoxValue = `checkBox -q -v recieveAudioCheckBox`;\n\
|
||
|
optionVar -sv \"recieveAudioCheckBoxValue\" $recieveAudioCheckBoxValue;\n\
|
||
|
string $sendMessage = \"\";\n\
|
||
|
if($recieveAudioCheckBoxValue == 1)\n\
|
||
|
{\n\
|
||
|
$sendMessage = \"CorrectBake_BakeRecordedAnimationAndAudio_FACEMOTION3D\";\n\
|
||
|
$sendMessage = $FACEMOTION3D_compressAlgorithm + $sendMessage;\n\
|
||
|
\n\
|
||
|
int $existsFolder = python(\"import os;os.path.isdir(r'\"+$audioFolderPath+\"')\");\n\
|
||
|
if($existsFolder == 0)\n\
|
||
|
{\n\
|
||
|
confirmDialog -title \"The folder cannot be found.\" -message \"Please enter the correct audio folder path before executing.\"\n\
|
||
|
-button \"OK\" -defaultButton \"OK\";\n\
|
||
|
return;\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
string $audioFileName = `textField -q -text FACEMOTION3D_audioFileName`;\n\
|
||
|
optionVar -sv \"FACEMOTION3D_audioFileName\" $audioFileName;\n\
|
||
|
\n\
|
||
|
if($audioFileName == \"\")\n\
|
||
|
{\n\
|
||
|
confirmDialog -title \"Audio file name error.\" -message \"The name of the audio file is blank.\"\n\
|
||
|
-button \"OK\" -defaultButton \"OK\";\n\
|
||
|
return;\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
string $textFieldValue = `textField -q -text FACEMOTION3D_bakeStartFrame`;\n\
|
||
|
int $number_or_not = python(\"'\"+$textFieldValue+\"'.isdigit()\");\n\
|
||
|
if($number_or_not != 1)\n\
|
||
|
{\n\
|
||
|
textField -edit -text \"0\" FACEMOTION3D_bakeStartFrame;\n\
|
||
|
confirmDialog -title \"Error\" -message \"Please enter the correct 'Bake start frame'.\" -button \"OK\" -defaultButton \"OK\";\n\
|
||
|
return;\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
else\n\
|
||
|
{\n\
|
||
|
$sendMessage = \"CorrectBake_BakeRecordedAnimation_FACEMOTION3D\";\n\
|
||
|
$sendMessage = $FACEMOTION3D_compressAlgorithm + $sendMessage;\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
string $bakePort = `textField -q -text \"FACEMOTION3D_bakePortTextField\"`;\n\
|
||
|
string $PORT_NUM = $localipAddress+\":\"+$bakePort;\n\
|
||
|
if(`commandPort -q $PORT_NUM`)\n\
|
||
|
{\n\
|
||
|
if($FACEMOTION3D_Maya2022BugStatus == 0)\n\
|
||
|
{\n\
|
||
|
commandPort -cl -n $PORT_NUM;\n\
|
||
|
}\n\
|
||
|
commandPort -pre \"FACEMOTION3D_bakeRecordedAnimation\" -n $PORT_NUM;\n\
|
||
|
FACEMOTION3D_sendMessageToiOS($sendMessage);\n\
|
||
|
}\n\
|
||
|
else\n\
|
||
|
{\n\
|
||
|
if(catchQuiet(`commandPort -pre \"FACEMOTION3D_bakeRecordedAnimation\" -n $PORT_NUM`))\n\
|
||
|
{\n\
|
||
|
FACEMOTION3D_sendMessageToiOS($sendMessage);\n\
|
||
|
}\n\
|
||
|
else\n\
|
||
|
{\n\
|
||
|
FACEMOTION3D_sendMessageToiOS($sendMessage);\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
global proc FACEMOTION3D_disconnect()\n\
|
||
|
{\n\
|
||
|
global int $FACEMOTION3D_Maya2022BugStatus;\n\
|
||
|
string $localipAddress = `textField -q -text \"FACEMOTION3D_localipAddressTextField\"`;\n\
|
||
|
$localipAddress = python(\"r'\"+$localipAddress+\"'.replace(' ','')\");\n\
|
||
|
\n\
|
||
|
optionVar -sv \"FACEMOTION3D_localipAddressTextField\" $localipAddress;\n\
|
||
|
\n\
|
||
|
string $sendMessage = \"StopStreaming_FACEMOTION3D\";\n\
|
||
|
FACEMOTION3D_sendMessageToiOS($sendMessage);\n\
|
||
|
\n\
|
||
|
string $streamPort = `textField -q -text \"FACEMOTION3D_streamPortTextField\"`;\n\
|
||
|
string $PORT_NUM = $localipAddress+\":\"+$streamPort;\n\
|
||
|
if(`commandPort -q $PORT_NUM`)\n\
|
||
|
{\n\
|
||
|
if($FACEMOTION3D_Maya2022BugStatus == 0)\n\
|
||
|
{\n\
|
||
|
commandPort -cl -n $PORT_NUM;\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
global proc FACEMOTION3D_connectionPriorityOptionMenuChanged()\n\
|
||
|
{\n\
|
||
|
string $optionMenuValue = `optionMenu -q -v FACEMOTION3D_connectionPriorityOptionMenu`;\n\
|
||
|
optionVar -sv \"FACEMOTION3D_connectionPriorityOptionMenu\" $optionMenuValue;\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
global proc ipAddressSettingsFrameLayoutCollapsed()\n\
|
||
|
{\n\
|
||
|
optionVar -iv \"FACEMOTION3D_ipAddressSettingsFrameLayoutCollapsed\" 1;\n\
|
||
|
window -edit -h 131 FACEMOTION3DPanel;\n\
|
||
|
}\n\
|
||
|
global proc ipAddressSettingsFrameLayoutCollapsedExpand()\n\
|
||
|
{\n\
|
||
|
optionVar -iv \"FACEMOTION3D_ipAddressSettingsFrameLayoutCollapsed\" 0;\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
global proc portSettingsFrameLayoutCollapsed()\n\
|
||
|
{\n\
|
||
|
optionVar -iv \"FACEMOTION3D_portSettingsFrameLayoutCollapsed\" 1;\n\
|
||
|
window -edit -h 131 FACEMOTION3DPanel;\n\
|
||
|
} \n\
|
||
|
global proc portSettingsFrameLayoutCollapsedExpand()\n\
|
||
|
{\n\
|
||
|
optionVar -iv \"FACEMOTION3D_portSettingsFrameLayoutCollapsed\" 0;\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
global proc settingBakeAnimationFrameLayoutCollapsed()\n\
|
||
|
{\n\
|
||
|
optionVar -iv \"FACEMOTION3D_settingBakeAnimationFrameLayoutCollapsed\" 1;\n\
|
||
|
window -edit -h 131 FACEMOTION3DPanel;\n\
|
||
|
}\n\
|
||
|
global proc settingBakeAnimationFrameLayoutCollapsedExpand()\n\
|
||
|
{\n\
|
||
|
optionVar -iv \"FACEMOTION3D_settingBakeAnimationFrameLayoutCollapsed\" 0;\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
global proc settingFrameLayoutCollapsed()\n\
|
||
|
{\n\
|
||
|
optionVar -iv \"FACEMOTION3D_settingFrameLayoutCollapsed\" 1;\n\
|
||
|
window -edit -h 131 FACEMOTION3DPanel;\n\
|
||
|
}\n\
|
||
|
global proc settingFrameLayoutExpand()\n\
|
||
|
{\n\
|
||
|
optionVar -iv \"FACEMOTION3D_settingFrameLayoutCollapsed\" 0;\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
global proc FACEMOTION3D_bakeAnimationTapped()\n\
|
||
|
{\n\
|
||
|
string $buttonLabel = `button -q -label \"FACEMOTION3D_bakeAnimationButton\"`;\n\
|
||
|
if($buttonLabel==\"bake animation\")\n\
|
||
|
{\n\
|
||
|
button -edit -label \"stop bake animation\" \"FACEMOTION3D_bakeAnimationButton\";\n\
|
||
|
FACEMOTION3D_bakeAnimation();\n\
|
||
|
}\n\
|
||
|
else if($buttonLabel==\"stop bake animation\")\n\
|
||
|
{\n\
|
||
|
button -edit -label \"bake animation\" \"FACEMOTION3D_bakeAnimationButton\";\n\
|
||
|
FACEMOTION3D_stopBakeAnimation();\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
global proc FACEMOTION3D_bakeAnimation()\n\
|
||
|
{\n\
|
||
|
global float $FACEMOTION3D_startTime;\n\
|
||
|
global float $FACEMOTION3D_nowTime;\n\
|
||
|
global float $FACEMOTION3D_preTime;\n\
|
||
|
global int $FACEMOTION3D_loopCount;\n\
|
||
|
global int $FACEMOTION3D_bakeAnimationFlag;\n\
|
||
|
global float $FACEMOTION3D_currentfpsReciprocal;\n\
|
||
|
global int $FACEMOTION3D_preFrame;\n\
|
||
|
\n\
|
||
|
$FACEMOTION3D_startTime = 0.0;\n\
|
||
|
$FACEMOTION3D_nowTime = 0.0;\n\
|
||
|
$FACEMOTION3D_preTime = 0.0;\n\
|
||
|
$FACEMOTION3D_loopCount = 0;\n\
|
||
|
$FACEMOTION3D_bakeAnimationFlag = 1;\n\
|
||
|
$FACEMOTION3D_currentfpsReciprocal = 1.0/`currentTimeUnitToFPS`;\n\
|
||
|
$FACEMOTION3D_preFrame = -1000;\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
global proc FACEMOTION3D_stopBakeAnimation()\n\
|
||
|
{\n\
|
||
|
global float $FACEMOTION3D_startTime;\n\
|
||
|
global float $FACEMOTION3D_nowTime;\n\
|
||
|
global float $FACEMOTION3D_preTime;\n\
|
||
|
global int $FACEMOTION3D_loopCount;\n\
|
||
|
global int $FACEMOTION3D_bakeAnimationFlag;\n\
|
||
|
\n\
|
||
|
$FACEMOTION3D_startTime = 0.0;\n\
|
||
|
$FACEMOTION3D_nowTime = 0.0;\n\
|
||
|
$FACEMOTION3D_preTime = 0.0;\n\
|
||
|
$FACEMOTION3D_loopCount = 0;\n\
|
||
|
$FACEMOTION3D_bakeAnimationFlag = 0;\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
global proc FACEMOTION3D_startRecording()\n\
|
||
|
{\n\
|
||
|
int $playBackStartOfRecordingCheckBoxValue = `checkBox -q -v playBackStartOfRecordingCheckBox`;\n\
|
||
|
optionVar -sv \"playBackStartOfRecordingCheckBoxValue\" $playBackStartOfRecordingCheckBoxValue;\n\
|
||
|
if($playBackStartOfRecordingCheckBoxValue == 1)\n\
|
||
|
{\n\
|
||
|
string $bakeStartFrameString = `textField -q -text FACEMOTION3D_bakeStartFrame`;\n\
|
||
|
int $bakeStartFrame = int($bakeStartFrameString);\n\
|
||
|
currentTime -edit $bakeStartFrame;\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
int $streamStartOfRecordingCheckBoxValue = `checkBox -q -v streamStartOfRecordingCheckBox`;\n\
|
||
|
optionVar -sv \"streamStartOfRecordingCheckBoxValue\" $streamStartOfRecordingCheckBoxValue;\n\
|
||
|
if($streamStartOfRecordingCheckBoxValue == 1)\n\
|
||
|
{\n\
|
||
|
string $buttonLabel = `button -q -label \"FACEMOTION3D_waitConnectionButton\"`;\n\
|
||
|
if($buttonLabel==\"Stream Live\")\n\
|
||
|
{\n\
|
||
|
FACEMOTION3D_wait_connectionTapped();\n\
|
||
|
python(\"import time;time.sleep(0.1);\");\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
string $sendMessage = \"FACEMOTION3D_StartRecording\";\n\
|
||
|
FACEMOTION3D_sendMessageToiOS($sendMessage);\n\
|
||
|
\n\
|
||
|
if($playBackStartOfRecordingCheckBoxValue == 1)\n\
|
||
|
{\n\
|
||
|
play -forward true;\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
global proc FACEMOTION3D_sendMessageToiOS(string $sendMessage)\n\
|
||
|
{\n\
|
||
|
string $iosipAddress = `textField -q -text \"FACEMOTION3D_iosipAddressTextField\"`;\n\
|
||
|
$iosipAddress = python(\"r'\"+$iosipAddress+\"'.replace(' ','')\");\n\
|
||
|
\n\
|
||
|
optionVar -sv \"FACEMOTION3D_iosipAddressTextField\" $iosipAddress;\n\
|
||
|
for($i = 0;$i<10;$i++)\n\
|
||
|
{\n\
|
||
|
python(\"from socket import socket,AF_INET,SOCK_DGRAM,SOL_SOCKET,SO_BROADCAST;s = socket(AF_INET, SOCK_DGRAM);s.setsockopt(SOL_SOCKET, SO_BROADCAST, 1);s.sendto('\"+$sendMessage+\"'.encode(), ('\"+$iosipAddress+\"', 49993));\");\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
string $optionMenuValue = `optionMenu -q -v FACEMOTION3D_connectionPriorityOptionMenu`;\n\
|
||
|
if($optionMenuValue == \"connection accuracy\")\n\
|
||
|
{\n\
|
||
|
python(\"exec(\\'if not \\\\\\'.255\\\\\\' in \\\\\\'\"+$iosipAddress+\"\\\\\\':\\\\n\\ttry:\\\\n\\t\tfrom socket import socket, AF_INET, SOCK_STREAM\\\\n\\t\ts = socket(AF_INET, SOCK_STREAM)\\\\n\\t\ts.settimeout(3.0)\\\\n\\t\ttry:\\\\n\\t\t\ts.connect((\\\\\\'\"+$iosipAddress+\"\\\\\\', 49994))\\\\n\\t\t\ts.sendall(\\\\\\'\"+$sendMessage+\"\\\\\\'.encode())\\\\n\\t\tfinally:\\\\n\\t\t\ts.close()\\\\n\\texcept:\\\\n\\t\tpass\\')\");\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
global proc FACEMOTION3D_stopRecording()\n\
|
||
|
{\n\
|
||
|
int $playBackStartOfRecordingCheckBoxValue = `checkBox -q -v playBackStartOfRecordingCheckBox`;\n\
|
||
|
optionVar -sv \"playBackStartOfRecordingCheckBoxValue\" $playBackStartOfRecordingCheckBoxValue;\n\
|
||
|
if($playBackStartOfRecordingCheckBoxValue == 1)\n\
|
||
|
{\n\
|
||
|
play -st off;\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
int $streamStartOfRecordingCheckBoxValue = `checkBox -q -v streamStartOfRecordingCheckBox`;\n\
|
||
|
optionVar -sv \"streamStartOfRecordingCheckBoxValue\" $streamStartOfRecordingCheckBoxValue;\n\
|
||
|
if($streamStartOfRecordingCheckBoxValue == 1)\n\
|
||
|
{\n\
|
||
|
FACEMOTION3D_wait_connectionTapped();\n\
|
||
|
python(\"import time;time.sleep(0.1);\");\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
string $sendMessage = \"FACEMOTION3D_StopRecording\";\n\
|
||
|
FACEMOTION3D_sendMessageToiOS($sendMessage);\n\
|
||
|
\n\
|
||
|
int $bakeAfterRecordingCheckBoxValue = `checkBox -q -v bakeAfterRecordingCheckBox`;\n\
|
||
|
optionVar -sv \"bakeAfterRecordingCheckBoxValue\" $bakeAfterRecordingCheckBoxValue;\n\
|
||
|
\n\
|
||
|
if($bakeAfterRecordingCheckBoxValue == 1)\n\
|
||
|
{\n\
|
||
|
python(\"import time;time.sleep(0.05);\");\n\
|
||
|
FACEMOTION3D_wait_bakeRecordedAnimationPreSettings();\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
global proc FACEMOTION3D_StartRecordingButtonTapped()\n\
|
||
|
{\n\
|
||
|
string $buttonLabel = `button -q -label \"FACEMOTION3D_StartRecordingButton\"`;\n\
|
||
|
if($buttonLabel==\"Start Recording\")\n\
|
||
|
{\n\
|
||
|
button -edit -label \"Stop Recording\" \"FACEMOTION3D_StartRecordingButton\";\n\
|
||
|
FACEMOTION3D_startRecording();\n\
|
||
|
}\n\
|
||
|
else if($buttonLabel==\"Stop Recording\")\n\
|
||
|
{\n\
|
||
|
button -edit -label \"Start Recording\" \"FACEMOTION3D_StartRecordingButton\";\n\
|
||
|
FACEMOTION3D_stopRecording();\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
global proc FACEMOTION3D_audioFolderPathDialog()\n\
|
||
|
{\n\
|
||
|
string $result[] = `fileDialog2 -okCaption \"OK\" -fileMode 3 -dialogStyle 2`;\n\
|
||
|
if(`size $result` != 0)\n\
|
||
|
{\n\
|
||
|
string $audioFolderPath = $result[0];\n\
|
||
|
textField -edit -text $audioFolderPath FACEMOTION3D_audioSaveFolder;\n\
|
||
|
optionVar -sv \"FACEMOTION3D_audioSaveFolder\" $audioFolderPath;\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
global proc FACEMOTION3D_StrengthOfBlendShapes_changed()\n\
|
||
|
{\n\
|
||
|
global float $FACEMOTION3D_StrengthOfBlendShapes;\n\
|
||
|
string $textfiledValue = `textField -q -text \"FACEMOTION3D_StrengthOfBlendShapes_TextField\"`;\n\
|
||
|
$FACEMOTION3D_StrengthOfBlendShapes = float($textfiledValue);\n\
|
||
|
optionVar -fv \"FACEMOTION3D_StrengthOfBlendShapes\" $FACEMOTION3D_StrengthOfBlendShapes;\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
global proc otherSettingsFrameLayoutCollapsed()\n\
|
||
|
{\n\
|
||
|
optionVar -iv \"FACEMOTION3D_otherSettingsFrameLayoutCollapsed\" 1;\n\
|
||
|
window -edit -h 131 FACEMOTION3DPanel;\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
global proc otherSettingsFrameLayoutCollapsedExpand()\n\
|
||
|
{\n\
|
||
|
optionVar -iv \"FACEMOTION3D_otherSettingsFrameLayoutCollapsed\" 0;\n\
|
||
|
}\n\
|
||
|
global proc recordingSettingsFrameLayoutCollapsed()\n\
|
||
|
{\n\
|
||
|
optionVar -iv \"FACEMOTION3D_recordingSettingsFrameLayoutCollapsed\" 1;\n\
|
||
|
window -edit -h 131 FACEMOTION3DPanel;\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
global proc recordingSettingsFrameLayoutCollapsedExpand()\n\
|
||
|
{\n\
|
||
|
optionVar -iv \"FACEMOTION3D_recordingSettingsFrameLayoutCollapsed\" 0;\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
global proc FACEMOTION3D_windowCloseCommand()\n\
|
||
|
{\n\
|
||
|
global int $FACEMOTION3D_Maya2022BugStatus;\n\
|
||
|
string $localipAddress = `textField -q -text \"FACEMOTION3D_localipAddressTextField\"`;\n\
|
||
|
$localipAddress = python(\"r'\"+$localipAddress+\"'.replace(' ','')\");\n\
|
||
|
\n\
|
||
|
string $streamPort = `textField -q -text \"FACEMOTION3D_streamPortTextField\"`;\n\
|
||
|
string $PORT_NUM = $localipAddress+\":\"+$streamPort;\n\
|
||
|
if(`commandPort -q $PORT_NUM`)\n\
|
||
|
{\n\
|
||
|
if($FACEMOTION3D_Maya2022BugStatus == 0)\n\
|
||
|
{\n\
|
||
|
commandPort -cl -n $PORT_NUM;\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
string $bakePort = `textField -q -text \"FACEMOTION3D_bakePortTextField\"`;\n\
|
||
|
$PORT_NUM = $localipAddress+\":\"+$bakePort;\n\
|
||
|
if(`commandPort -q $PORT_NUM`)\n\
|
||
|
{\n\
|
||
|
if($FACEMOTION3D_Maya2022BugStatus == 0)\n\
|
||
|
{\n\
|
||
|
commandPort -cl -n $PORT_NUM;\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
global proc FACEMOTION3D_window()\n\
|
||
|
{\n\
|
||
|
FACEMOTION3D_Maya2022BugStatusCheck();\n\
|
||
|
FACEMOTION3D_compressAlgorithmCheck();\n\
|
||
|
global float $FACEMOTION3D_StrengthOfBlendShapes;\n\
|
||
|
\n\
|
||
|
if (`window -ex FACEMOTION3DPanel` )deleteUI FACEMOTION3DPanel;\n\
|
||
|
$window = `window -cc \"FACEMOTION3D_windowCloseCommand\" -s 1 -title \"FACEMOTION3D Panel\" -widthHeight 200 100 FACEMOTION3DPanel`;\n\
|
||
|
columnLayout -adjustableColumn true;\n\
|
||
|
button -h 60 -label \"Stream Live\" -command (\"FACEMOTION3D_wait_connectionTapped()\") \"FACEMOTION3D_waitConnectionButton\";\n\
|
||
|
text -h 5 -label \"\";\n\
|
||
|
button -h 40 -label \"Start Recording\" -command (\"FACEMOTION3D_StartRecordingButtonTapped()\") \"FACEMOTION3D_StartRecordingButton\";\n\
|
||
|
text -h 5 -label \"\";\n\
|
||
|
button -h 40 -label \"Bake Recorded Animation\" -command (\"FACEMOTION3D_wait_bakeRecordedAnimationPreSettings()\");\n\
|
||
|
\n\
|
||
|
int $collapsedFlag = 0;\n\
|
||
|
if(`optionVar -exists \"FACEMOTION3D_settingFrameLayoutCollapsed\"`)\n\
|
||
|
$collapsedFlag = `optionVar -q \"FACEMOTION3D_settingFrameLayoutCollapsed\"`;\n\
|
||
|
\n\
|
||
|
frameLayout -collapsable 1 -cl $collapsedFlag -label \"Settings\" -collapseCommand settingFrameLayoutCollapsed -expandCommand settingFrameLayoutExpand;\n\
|
||
|
columnLayout -adjustableColumn 1;\n\
|
||
|
\n\
|
||
|
string $os_system = \"Windows\";\n\
|
||
|
catchQuiet($os_system = python(\"import platform;platform.system()\"));\n\
|
||
|
\n\
|
||
|
string $localipAddress = \"0.0.0.0\";\n\
|
||
|
if(`optionVar -exists \"FACEMOTION3D_localipAddressTextField\"`)\n\
|
||
|
{\n\
|
||
|
$localipAddress =`optionVar -q \"FACEMOTION3D_localipAddressTextField\"`;\n\
|
||
|
$localipAddress = python(\"r'\"+$localipAddress+\"'.replace(' ','')\");\n\
|
||
|
}\n\
|
||
|
else\n\
|
||
|
{\n\
|
||
|
if($os_system == \"Windows\")\n\
|
||
|
{\n\
|
||
|
catchQuiet($localipAddress = python(\"import socket;socket.gethostbyname(socket.gethostname())\"));\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
string $iosipAddress = \"255.255.255.255\";\n\
|
||
|
if(`optionVar -exists \"FACEMOTION3D_iosipAddressTextField\"`)\n\
|
||
|
{\n\
|
||
|
$iosipAddress =`optionVar -q \"FACEMOTION3D_iosipAddressTextField\"`;\n\
|
||
|
}\n\
|
||
|
else\n\
|
||
|
{\n\
|
||
|
if($os_system == \"Windows\")\n\
|
||
|
{\n\
|
||
|
if(catchQuiet($iosipAddress = python(\"import socket;socket.gethostbyname(socket.gethostname())\")))\n\
|
||
|
{\n\
|
||
|
\n\
|
||
|
}\n\
|
||
|
else\n\
|
||
|
{\n\
|
||
|
catchQuiet($iosipAddress = python(\"ip_str='\"+$iosipAddress+\"';sp=ip_str.split('.');sp[3] = '255';'.'.join(sp)\"));\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
int $collapsedFlag2 = 0;\n\
|
||
|
if(`optionVar -exists \"FACEMOTION3D_ipAddressSettingsFrameLayoutCollapsed\"`)\n\
|
||
|
$collapsedFlag2 = `optionVar -q \"FACEMOTION3D_ipAddressSettingsFrameLayoutCollapsed\"`;\n\
|
||
|
\n\
|
||
|
frameLayout -collapsable 1 -cl $collapsedFlag2 -label \"IP Address Settings\" -collapseCommand ipAddressSettingsFrameLayoutCollapsed -expandCommand ipAddressSettingsFrameLayoutCollapsedExpand;\n\
|
||
|
columnLayout -adjustableColumn 1;\n\
|
||
|
\n\
|
||
|
int $autoConnectCheckBoxValue = 1;\n\
|
||
|
if(`optionVar -exists \"autoConnectCheckBoxValue\"`)\n\
|
||
|
{\n\
|
||
|
$autoConnectCheckBoxValue = `optionVar -q \"autoConnectCheckBoxValue\"`;\n\
|
||
|
}\n\
|
||
|
rowLayout -numberOfColumns 2 -columnWidth2 10 170 -adjustableColumn 2;\n\
|
||
|
checkBox -label \"\" -v $autoConnectCheckBoxValue autoConnectCheckBox;\n\
|
||
|
text -label \"wait and connect\";\n\
|
||
|
setParent ..;\n\
|
||
|
\n\
|
||
|
optionMenu -label \"Prioritize\" -changeCommand FACEMOTION3D_connectionPriorityOptionMenuChanged FACEMOTION3D_connectionPriorityOptionMenu;\n\
|
||
|
menuItem -label \"connection accuracy\" -p FACEMOTION3D_connectionPriorityOptionMenu;\n\
|
||
|
menuItem -label \"connection speed\" -p FACEMOTION3D_connectionPriorityOptionMenu;\n\
|
||
|
\n\
|
||
|
string $FACEMOTION3D_connectionPriorityOptionMenu = \"connection speed\";\n\
|
||
|
if(`optionVar -exists \"FACEMOTION3D_connectionPriorityOptionMenu\"`)\n\
|
||
|
{\n\
|
||
|
$FACEMOTION3D_connectionPriorityOptionMenu = `optionVar -q \"FACEMOTION3D_connectionPriorityOptionMenu\"`;\n\
|
||
|
}\n\
|
||
|
optionMenu -e -v $FACEMOTION3D_connectionPriorityOptionMenu FACEMOTION3D_connectionPriorityOptionMenu;\n\
|
||
|
\n\
|
||
|
rowLayout -numberOfColumns 2 -columnWidth2 150 30 -adjustableColumn 2;\n\
|
||
|
text -label \"IP address of iOS \";\n\
|
||
|
textField -text $iosipAddress \"FACEMOTION3D_iosipAddressTextField\";\n\
|
||
|
setParent ..;\n\
|
||
|
\n\
|
||
|
text -h 5 -label \"\";\n\
|
||
|
\n\
|
||
|
rowLayout -numberOfColumns 2 -columnWidth2 150 30 -adjustableColumn 2;\n\
|
||
|
text -label \"IP address of this PC \";\n\
|
||
|
textField -text $localipAddress \"FACEMOTION3D_localipAddressTextField\";\n\
|
||
|
setParent ..;\n\
|
||
|
\n\
|
||
|
setParent ..;\n\
|
||
|
setParent ..;\n\
|
||
|
\n\
|
||
|
int $collapsedFlag_portFrame = 1;\n\
|
||
|
if(`optionVar -exists \"FACEMOTION3D_portSettingsFrameLayoutCollapsed\"`)\n\
|
||
|
$collapsedFlag_portFrame = `optionVar -q \"FACEMOTION3D_portSettingsFrameLayoutCollapsed\"`;\n\
|
||
|
\n\
|
||
|
frameLayout -collapsable 1 -cl $collapsedFlag_portFrame -label \"Port Settings\" -collapseCommand portSettingsFrameLayoutCollapsed -expandCommand portSettingsFrameLayoutCollapsedExpand;\n\
|
||
|
columnLayout -adjustableColumn 1;\n\
|
||
|
\n\
|
||
|
string $FACEMOTION3D_streamPortTextField = \"50001\";\n\
|
||
|
if(`optionVar -exists \"FACEMOTION3D_realtimePortTextField\"`)\n\
|
||
|
{\n\
|
||
|
$FACEMOTION3D_streamPortTextField =`optionVar -q \"FACEMOTION3D_streamPortTextField\"`;\n\
|
||
|
}\n\
|
||
|
rowLayout -numberOfColumns 2 -columnWidth2 150 30 -adjustableColumn 2;\n\
|
||
|
text -label \"Port for stream \";\n\
|
||
|
textField -text $FACEMOTION3D_streamPortTextField \"FACEMOTION3D_streamPortTextField\";\n\
|
||
|
setParent ..;\n\
|
||
|
\n\
|
||
|
text -h 5 -label \"\";\n\
|
||
|
\n\
|
||
|
string $FACEMOTION3D_bakePortTextField = \"55001\";\n\
|
||
|
if(`optionVar -exists \"FACEMOTION3D_bakePortTextField\"`)\n\
|
||
|
{\n\
|
||
|
$FACEMOTION3D_bakePortTextField =`optionVar -q \"FACEMOTION3D_bakePortTextField\"`;\n\
|
||
|
}\n\
|
||
|
rowLayout -numberOfColumns 2 -columnWidth2 150 30 -adjustableColumn 2;\n\
|
||
|
text -label \"Port for baking \";\n\
|
||
|
textField -text $FACEMOTION3D_bakePortTextField \"FACEMOTION3D_bakePortTextField\";\n\
|
||
|
setParent ..;\n\
|
||
|
\n\
|
||
|
setParent ..;\n\
|
||
|
setParent ..;\n\
|
||
|
\n\
|
||
|
int $collapsedFlag3 = 0;\n\
|
||
|
if(`optionVar -exists \"FACEMOTION3D_settingBakeAnimationFrameLayoutCollapsed\"`)\n\
|
||
|
{\n\
|
||
|
$collapsedFlag3 = `optionVar -q \"FACEMOTION3D_settingBakeAnimationFrameLayoutCollapsed\"`;\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
frameLayout -collapsable 1 -cl $collapsedFlag3 -label \"Settings for bake animation\" -collapseCommand settingBakeAnimationFrameLayoutCollapsed -expandCommand settingBakeAnimationFrameLayoutCollapsedExpand;\n\
|
||
|
columnLayout -adjustableColumn 1;\n\
|
||
|
\n\
|
||
|
int $recieveAudioCheckBoxValue = 1;\n\
|
||
|
if(`optionVar -exists \"recieveAudioCheckBoxValue\"`)\n\
|
||
|
{\n\
|
||
|
$recieveAudioCheckBoxValue = `optionVar -q \"recieveAudioCheckBoxValue\"`;\n\
|
||
|
}\n\
|
||
|
rowLayout -numberOfColumns 2 -columnWidth2 10 170 -adjustableColumn 2;\n\
|
||
|
checkBox -label \"\" -v $recieveAudioCheckBoxValue recieveAudioCheckBox;\n\
|
||
|
text -label \"Receive audio files\";\n\
|
||
|
setParent ..;\n\
|
||
|
\n\
|
||
|
\n\
|
||
|
string $audioFolderPath = \"\";\n\
|
||
|
$audioFolderPath = python(\"import os;os.path.expanduser('~/Desktop')\");\n\
|
||
|
if(`optionVar -exists \"FACEMOTION3D_audioSaveFolder\"`)\n\
|
||
|
{\n\
|
||
|
$audioFolderPath =`optionVar -q \"FACEMOTION3D_audioSaveFolder\"`;\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
rowLayout -numberOfColumns 3 -columnWidth3 100 60 20 -adjustableColumn 2;\n\
|
||
|
text -label \"Audio folder path\";\n\
|
||
|
textField -text $audioFolderPath FACEMOTION3D_audioSaveFolder;\n\
|
||
|
button -label \"...\" -command (\"FACEMOTION3D_audioFolderPathDialog()\");\n\
|
||
|
setParent ..;\n\
|
||
|
\n\
|
||
|
string $audioFileName = \"recordedAudio\";\n\
|
||
|
if(`optionVar -exists \"FACEMOTION3D_audioFileName\"`)\n\
|
||
|
{\n\
|
||
|
$audioFileName =`optionVar -q \"FACEMOTION3D_audioFileName\"`;\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
rowLayout -numberOfColumns 3 -columnWidth3 130 40 10 -adjustableColumn 2;\n\
|
||
|
text -label \"Audio file name\";\n\
|
||
|
textField -text $audioFileName FACEMOTION3D_audioFileName;\n\
|
||
|
text -label \".wav\";\n\
|
||
|
setParent ..;\n\
|
||
|
\n\
|
||
|
rowLayout -numberOfColumns 2 -columnWidth2 160 20 -adjustableColumn 2;\n\
|
||
|
text -label \"Bake/Play start frame\";\n\
|
||
|
textField -text \"0\" FACEMOTION3D_bakeStartFrame;\n\
|
||
|
setParent ..;\n\
|
||
|
\n\
|
||
|
setParent ..;\n\
|
||
|
setParent ..;\n\
|
||
|
\n\
|
||
|
int $collapsedFlag4 = 0;\n\
|
||
|
if(`optionVar -exists \"FACEMOTION3D_recordingSettingsFrameLayoutCollapsed\"`)\n\
|
||
|
{\n\
|
||
|
$collapsedFlag4 = `optionVar -q \"FACEMOTION3D_recordingSettingsFrameLayoutCollapsed\"`;\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
frameLayout -collapsable 1 -cl $collapsedFlag4 -label \"Settings for recording\" -collapseCommand recordingSettingsFrameLayoutCollapsed -expandCommand recordingSettingsFrameLayoutCollapsedExpand;\n\
|
||
|
columnLayout -adjustableColumn 1;\n\
|
||
|
\n\
|
||
|
int $bakeAfterRecordingCheckBoxValue = 1;\n\
|
||
|
if(`optionVar -exists \"bakeAfterRecordingCheckBoxValue\"`)\n\
|
||
|
{\n\
|
||
|
$bakeAfterRecordingCheckBoxValue = `optionVar -q \"bakeAfterRecordingCheckBoxValue\"`;\n\
|
||
|
}\n\
|
||
|
rowLayout -numberOfColumns 2 -columnWidth2 10 170 -adjustableColumn 2;\n\
|
||
|
checkBox -label \"\" -v $bakeAfterRecordingCheckBoxValue bakeAfterRecordingCheckBox;\n\
|
||
|
text -label \"Bake after the end of recording\";\n\
|
||
|
setParent ..;\n\
|
||
|
\n\
|
||
|
int $playBackStartOfRecordingCheckBoxValue = 1;\n\
|
||
|
if(`optionVar -exists \"playBackStartOfRecordingCheckBoxValue\"`)\n\
|
||
|
{\n\
|
||
|
$playBackStartOfRecordingCheckBoxValue = `optionVar -q \"playBackStartOfRecordingCheckBoxValue\"`;\n\
|
||
|
}\n\
|
||
|
rowLayout -numberOfColumns 2 -columnWidth2 10 170 -adjustableColumn 2;\n\
|
||
|
checkBox -label \"\" -v $playBackStartOfRecordingCheckBoxValue playBackStartOfRecordingCheckBox;\n\
|
||
|
text -label \"Playback at the start of recording\";\n\
|
||
|
setParent ..;\n\
|
||
|
\n\
|
||
|
int $streamStartOfRecordingCheckBoxValue = 1;\n\
|
||
|
if(`optionVar -exists \"streamStartOfRecordingCheckBoxValue\"`)\n\
|
||
|
{\n\
|
||
|
$streamStartOfRecordingCheckBoxValue = `optionVar -q \"streamStartOfRecordingCheckBoxValue\"`;\n\
|
||
|
}\n\
|
||
|
rowLayout -numberOfColumns 2 -columnWidth2 10 170 -adjustableColumn 2;\n\
|
||
|
checkBox -label \"\" -v $streamStartOfRecordingCheckBoxValue streamStartOfRecordingCheckBox;\n\
|
||
|
text -label \"Stream at the start of recording\";\n\
|
||
|
setParent ..;\n\
|
||
|
setParent ..;\n\
|
||
|
setParent ..;\n\
|
||
|
\n\
|
||
|
int $collapsedFlag5 = 0;\n\
|
||
|
if(`optionVar -exists \"FACEMOTION3D_otherSettingsFrameLayoutCollapsed\"`)\n\
|
||
|
{\n\
|
||
|
$collapsedFlag5 = `optionVar -q \"FACEMOTION3D_otherSettingsFrameLayoutCollapsed\"`;\n\
|
||
|
}\n\
|
||
|
\n\
|
||
|
frameLayout -collapsable 1 -cl $collapsedFlag5 -label \"Other Settings\" -collapseCommand otherSettingsFrameLayoutCollapsed -expandCommand otherSettingsFrameLayoutCollapsedExpand;\n\
|
||
|
columnLayout -adjustableColumn 1;\n\
|
||
|
\n\
|
||
|
if(`optionVar -exists \"FACEMOTION3D_StrengthOfBlendShapes\"`)\n\
|
||
|
{\n\
|
||
|
$FACEMOTION3D_StrengthOfBlendShapes =`optionVar -q \"FACEMOTION3D_StrengthOfBlendShapes\"`;\n\
|
||
|
}\n\
|
||
|
rowLayout -numberOfColumns 2 -columnWidth2 150 30 -adjustableColumn 2;\n\
|
||
|
text -label \"Strength Of BlendShapes \";\n\
|
||
|
textField -text $FACEMOTION3D_StrengthOfBlendShapes -cc \"FACEMOTION3D_StrengthOfBlendShapes_changed\" FACEMOTION3D_StrengthOfBlendShapes_TextField;\n\
|
||
|
setParent ..;\n\
|
||
|
setParent ..;\n\
|
||
|
\n\
|
||
|
\n\
|
||
|
\n\
|
||
|
setParent ..;\n\
|
||
|
setParent ..;\n\
|
||
|
setParent ..;\n\
|
||
|
showWindow $window;\n\
|
||
|
window -edit -h 131 FACEMOTION3DPanel;\n\
|
||
|
}\n\
|
||
|
FACEMOTION3D_window();";
|
||
|
|
||
|
global string $gShelfTopLevel;
|
||
|
string $path ;
|
||
|
string $ctab = `shelfTabLayout -q -st $gShelfTopLevel`;
|
||
|
string $ctabPath = $gShelfTopLevel + "|" + $ctab;
|
||
|
string $shelves[] = `layout -q -ca ($gShelfTopLevel + "|" + $ctab)`;
|
||
|
string $shelf;
|
||
|
for($shelf in $shelves)
|
||
|
{
|
||
|
$path = $gShelfTopLevel + "|" + $ctab + "|" + $shelf;
|
||
|
string $la = `shelfButton -q -l $path`;
|
||
|
if($la == "FM")
|
||
|
{
|
||
|
deleteUI $path;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
string $thisDirPath = `whatIs "FindMe"`;
|
||
|
if($thisDirPath != "Unknown" && $thisDirPath != "Mel procedure entered interactively.")
|
||
|
{
|
||
|
string $appDataPath = "";
|
||
|
string $os_platform = python("import platform;platform.system()");
|
||
|
|
||
|
if($os_platform=="Windows")
|
||
|
{
|
||
|
$appDataPath = python("import os;os.path.join(os.getenv('APPDATA'),'FACEMOTION3D','icons')");
|
||
|
$appDataPath = fromNativePath( $appDataPath );
|
||
|
}
|
||
|
else if($os_platform=="Darwin")
|
||
|
{
|
||
|
$appDataPath = python("import getpass;'/Users/'+getpass.getuser()+'/Library/Application Support/FACEMOTION3D/icons'");
|
||
|
}
|
||
|
|
||
|
catchQuiet(`sysFile -makeDir $appDataPath`);
|
||
|
|
||
|
$thisDirPath = python("r'"+$thisDirPath+"'.replace('/FACEMOTION3D_to_Maya.mel','')");
|
||
|
$thisDirPath = python("r'"+$thisDirPath+"'.replace('Mel procedure found in: ','')");
|
||
|
|
||
|
string $thisDirPath_icon = $thisDirPath+"/FM_mayashelficon.png";
|
||
|
string $appDataPath_icon = $appDataPath+"/FM_mayashelficon.png";
|
||
|
|
||
|
if(`filetest -f $thisDirPath_icon`)
|
||
|
{
|
||
|
if(catchQuiet(`sysFile -copy $appDataPath_icon $thisDirPath_icon`))
|
||
|
{
|
||
|
scriptToShelf ("FM", $FACEMOTION3D_allString, true);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
shelfButton -l "FM" -c $FACEMOTION3D_allString -image $appDataPath_icon -p $ctabPath;
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
scriptToShelf ("FM", $FACEMOTION3D_allString, true);
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
scriptToShelf ("FM", $FACEMOTION3D_allString, true);
|
||
|
}
|
||
|
eval $FACEMOTION3D_allString;
|
||
|
}
|
||
|
global proc FindMe() {}
|
||
|
|
||
|
FACEMOTION3D_addNewShelfTab();
|
||
|
FACEMOTION3D_addNewShelfButton();
|