Skip to content

Instantly share code, notes, and snippets.

@yamahigashi
Last active April 7, 2025 11:46
Show Gist options
  • Save yamahigashi/468ec1c4e8222e2191741900903766c8 to your computer and use it in GitHub Desktop.
Save yamahigashi/468ec1c4e8222e2191741900903766c8 to your computer and use it in GitHub Desktop.
toggle anim curve isolation state for Autodesk #maya Graph Editor
// mel
proc doToggleAnimCurveIsolation(string $outliner, string $ed)
// C:/Program Files/Autodesk/Maya2016.5/scripts/others/isolateAnimCurve.mel 参照
{
global int $gUnisolateJobNum;
if ($gUnisolateJobNum > 0) {
// 選択状態を復元するための一次記憶
string $shown[] = `animCurveEditor -q -curvesShown $ed`;
// isolate から 全部表示に戻す
isolateAnimCurve false $outliner $ed;
// ↑で選択はずれてむかつくので戻す
selectKey -add -k $shown;
} else {
// 全部表示 から 選択中のもののみへと表示を 絞り込む
isolateAnimCurve true $outliner $ed;
// ↑で選択はずれて同上
string $version = `about -version`;
if( `match "2016" $version` != "2016" ){
string $shown[] = `animCurveEditor -q -curvesShown $ed`;
selectKey -k $shown;
}
}
}
proc string[] gatherGraphEditor()
// graphEditor を含むウィンドを集める
{
string $results[];
string $wins[] = `getPanel -type "scriptedPanel"`;
for( $win in $wins ) {
if( `match "graphEditor*" $win` != "" ){
$results[size($results)] = $win;
}
}
return $results;
}
global
proc toggleAnimCurveIsolation()
// Graph Editor のイゾレート状態
// (menu > Curves > Isolate Curves)のトグル
{
string $editors[] = gatherGraphEditor();
for( $editor in $editors ){
string $ed = $editor + "GraphEd";
string $outline = $editor + "FromOutliner";
doToggleAnimCurveIsolation($outline, $ed);
}
}
toggleAnimCurveIsolation;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment