This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proc testProc(){ | |
string $userYN = `confirmDialog -b "OK"`; | |
if ($userYN == "OK"){ | |
system("load C:\Autodesk"); | |
} | |
} |
systemからエクスプローラーでダイアログを開こうとすると、なぜか処理がconfirmDialogのところへ戻って、以下無限ループ。
キャンセルなどして、systemの処理をスキップしようとすると、Mayaが固まって落ちました。
処理をpythonに逃がして対応できないかと模索したところ、
os.startfileの処理では、同様の結果となり、Mayaが落ちました。
しかし、subprocess.popenから処理を行ったところ、無事にクラッシュを回避できました。(以下ソース)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proc testProc(){ | |
string $userYN = `confirmDialog -b "YES"`; | |
if ($userYN == "YES"){ | |
string $path = "C:\Autodesk"; | |
python("import subprocess"); | |
python("subprocess.Popen('explorer \""+$path+"\"')"); | |
//system("load C:\Autodesk"); | |
} | |
} | |
testProc(); |
subprocessとos、melのsystemの大きな違いは、既定値でshellへ処理を飛ばすかどうか。
subprocessは既定ではshellで処理をしなかったはずなので、そのあたりに原因があるかも。
なお、最新のMaya2017 update5で発生するかどうかは未検証。 後日もう少し探ってみることにする。
0 件のコメント:
コメントを投稿