Last active
May 8, 2016 07:27
-
-
Save unycone/2c8a90db9cdb66ed230a3a240430d12e to your computer and use it in GitHub Desktop.
This file contains 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
/* | |
* Tested in Adobe After Effects CC 2015.0.1 Release (Version 13.5.1.48) | |
*/ | |
function getSelectedLayers() | |
{ | |
var currentComp = app.project.activeItem; | |
if(currentComp instanceof CompItem) return(currentComp.selectedLayers); //Return the current selected layers | |
return false; //User didn't have a Comp open | |
} | |
function numSelectedLayers() | |
{ | |
var layers = getSelectedLayers(); | |
return (layers ? layers.length : -1); | |
} | |
function selectItem( idx ) | |
{ | |
app.executeCommand(2004); // Deselect All | |
app.project.activeItem.layer(idx).selected = true; | |
} | |
// Force "Effect Controls" panel to be visible | |
function showEffectControl() | |
{ | |
app.executeCommand(2163); // Effect > Effect Controls | |
app.executeCommand(2163); | |
app.executeCommand(-524314); // Window > Effect Controls: (Layer Name) | |
app.executeCommand(2163); // ← ここで、既に表示されていても消えない(理由は不明)、消えてたら表示する、ので結果的に表示状態になる | |
} | |
// レイヤーが選択されていなかったら、アクティブなコンポの一番上のレイヤーを選択状態にする(選択されていたらそのまま) | |
// Effectを適用できないレイヤー(ライトとか)を選択状態にしないこと | |
if ( numSelectedLayers() != 1 ) { | |
selectItem(1); | |
} | |
// エフェクトコントロールパネルを表示する | |
showEffectControl(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment