Created
October 22, 2014 05:13
-
-
Save peace098beat/ced5865230a706a744da to your computer and use it in GitHub Desktop.
[AE] UI関連スクリプト その1
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
/*-------------------------------------------------------------------------------------------------------*/ | |
/* | |
■Name tr_AtFI | |
■ver0.1 | |
■20090211 | |
■Author Matsuda(Expresson) &Terraon(Script&Icon) | |
□選択レイヤとその”一つ下”のレイヤの重複部分frフェードインを行います。 | |
レイヤーコメントも追加します。また、既に透明度にエクスプレッションが適用されている場合は効果を”リセット”します。 | |
■All Rights @ Free | |
拙いコードですが引用も転用もご自由に。 | |
その代わり何か作ったら教えて貰えると嬉しいです。 | |
teraomeister@gmail.com | |
*/ | |
/*-------------------------------------------------------------------------------------------------------*/ | |
app.beginUndoGroup("tr_AtFI"); | |
var activeComp = app.project.activeItem ; | |
var activeLayer = activeComp.selectedLayers ; | |
var AtFItag = "-- Auto Fade IN ----" ; | |
var tr_AtFI_Exppression="Lid = thisLayer.index;fps = 24; \n Ts = thisLayer.inPoint*fps;\n Te = thisComp.layer(Lid+1).outPoint*fps;\n T = time*fps;\n if(T<Ts ){op = 0};\n else if(T>=Ts && T<=Te){op = (T-Ts)*100/(Te-Ts)}; \n else if ( T>Te){op = 100}; \n op;" | |
if (activeComp == null) { | |
alert("コンポジションを選択してください。") | |
}; | |
if(activeLayer.length == 0 ){ | |
alert("レイヤーを選択してください。") | |
}; | |
else{ | |
//選択レイヤの抜き出し | |
var dissolveLayer = new Array() ; //引数用の配列 | |
//配列をプッシュ | |
for (idx=activeLayer.length-1; idx>=0; idx--){ | |
dissolveLayer.push(activeLayer[idx].index) | |
}; | |
//各インデックスのレイヤにエクスプレッションを適用 | |
for (var i=0 ; i<=dissolveLayer.length-1 ; i++){ | |
var fiLayer=activeComp.layer(dissolveLayer[i]) //フェードインレイヤ | |
fiLayer.opacity.expression=tr_AtFI_Exppression ; //エクスプレッション適用 | |
// マーカー適用 | |
var myMarker = new MarkerValue(AtFItag); | |
fiLayer.property("Marker").setValueAtTime(activeComp.layer(dissolveLayer[i]).inPoint,myMarker) ; | |
}; | |
}; | |
app.endUndoGroup(); | |
/*-------------------------------------------------------------------------------------------------------*/ |
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
function blindPnlUI(thisObj) | |
{ | |
function UIObj() | |
{ | |
//イメージ読み込み | |
this.mapS = new File( "../ScriptUI Panels"+"/(UI_png)"+"/color_S.png"); | |
this.mapB = new File( "../ScriptUI Panels"+"/(UI_png)"+"/color_B.png"); | |
this.mapP = new File( "../ScriptUI Panels"+"/(UI_png)"+"/mappoint.png"); | |
this.clickTrOn = new File( "../ScriptUI Panels"+"/(UI_png)"+"/trDown.png"); | |
this.clickTrOff = new File( "../ScriptUI Panels"+"/(UI_png)"+"/trRight.png"); | |
this.sepLine = new File( "../ScriptUI Panels"+"/(UI_png)"+"/sepLine01.png"); | |
this.slBack = new File( "../ScriptUI Panels"+"/(UI_png)"+"/slBack.png"); | |
this.slBar = new File( "../ScriptUI Panels"+"/(UI_png)"+"/slBar.png"); | |
this.slUp = new File( "../ScriptUI Panels"+"/(UI_png)"+"/slUp.png"); | |
this.slDown = new File( "../ScriptUI Panels"+"/(UI_png)"+"/slDown.png"); | |
//パネル | |
this.pal = null; | |
//パネル全体のデフォルト縦サイズ | |
this.boundsH = 240; | |
//パネル全体のローカルY座標 | |
this.uiLocY = 2; | |
//スクロールバー | |
this.valS = false; | |
this.clickY = 0; | |
this.clickLY = 0; | |
this.moveY = 0; | |
this.curBar = 14; | |
this.uiM = 0; | |
} | |
UIObj.prototype = | |
{ | |
//スクロールバー ジャンプ値&ステップ値 | |
scl_JumpDelta: 50, | |
scl_StepDelta: 10, | |
//アプリバージョン確認・エラーコメント | |
strErr: "Could not launch script '%s' because it no longer exists on disk.", | |
//OSが、Win か Mac か | |
osCHK: function() | |
{ | |
if($.os.indexOf("Windows")==0){ | |
this.os = "Win"; | |
//パスのバックスラッシュ(Win) | |
this.cN = "\\"; | |
}else if($.os.indexOf("Mac")==0){ | |
this.os = "Mac"; | |
//パスのバックスラッシュ(Mac) | |
this.cN = "\n"; | |
} | |
}, | |
//外部スクリプトファイル情報 | |
scriptArray: function() | |
{ | |
//外部スクリプト ファイル名 | |
this.scArray = new Array(); | |
this.scArray = ["A","B","C","D","E","F","G"]; //テスト | |
//三角ON/OFFバリュー | |
this.valC = new Array(); | |
}, | |
blindPnl_BuildUI: function(thisObj) | |
{ | |
this.osCHK(); | |
this.scriptArray(); | |
pal = (thisObj instanceof Panel) ? thisObj : new Window("palette", "blind pnl UI", [200, 200, 410, 200 + (this.scArray.length * 26) + this.boundsH], {resizeable: true}); | |
if(pal != null){ | |
//全体のパネル (これ自体をスクロール) | |
pal.uiGrp = pal.add("group", [2, 2, 224 - 17, (this.scArray.length * 26) + this.boundsH - 2]); | |
//スクロールバー | |
this.sclBuild(pal); | |
//各項目(スクリプトとか) | |
pal.scGrp = new Array(); | |
pal.scIndex = new Array(); | |
pal.iconTr = new Array(); | |
pal.uiIndex = new Array(); | |
pal.sep = new Array(); | |
pal.scriptPnl = new Array(); | |
pal.info = new Array(); | |
pal.info2 = new Array(); | |
for(var i=0;i<this.scArray.length;i++){ | |
this.scBuildUI(pal, i); | |
} | |
//リサイズ時の処理は、今後追記予定 | |
bSelf = this; | |
pal.onResize = function() | |
{ | |
posX = pal.size.width; | |
posY = pal.size.height; | |
//alert(posX); | |
uiPos = pal.uiGrp.bounds; | |
pal.uiGrp.bounds = [2, uiPos[1], posX - 17, uiPos[3]]; | |
pal.scriptPnl.bounds = [2, 26, posX - 17, 240]; | |
pal.sclGrp.bounds = [posX - 15, 2, posX - 1, 240]; | |
}; | |
} | |
return pal; | |
}, | |
//各外部スクリプト | |
scBuildUI: function(pnlObj, num) | |
{ | |
var scNum = num; | |
this.valC[scNum] = "OFF"; | |
//スクリプトファイル名を取得 | |
//aN = String(unescape(new File($.fileName).fsName)).lastIndexOf(this.cN); | |
//bN =String(unescape(new File($.fileName).fsName)).length; | |
//var tabName = String(unescape(new File($.fileName).fsName)).substring(aN+1, bN).replace(/.jsx(bin)?$/, ""); | |
pSelf = this; | |
uiW = pnlObj.uiGrp.size.width; | |
//スクリプトごとのグループ | |
pnlObj.scGrp[scNum] = pnlObj.uiGrp.add("group", [2, 2 + (scNum * 24), uiW, 24 + (scNum * 24)]); | |
pnlObj.scIndex[scNum] = pnlObj.scGrp[scNum].location[1]; | |
pnlObj.scGrp[scNum].id = scNum; | |
scGrpW = pnlObj.scGrp[scNum].size.width; | |
scGrpH = pnlObj.scGrp[scNum].size.height; | |
//項目の表示 | |
pnlObj.iconTr[scNum] = pnlObj.scGrp[scNum].add("iconbutton", [0, 2, 10, 12], this.clickTrOff, {style:"toolbutton"}); | |
pnlObj.iconTr[scNum].id = scNum; | |
pnlObj.iconTr[scNum].onClick = function() | |
{ | |
if(pSelf.valC[this.id] == "ON"){ | |
pnlObj.iconTr[this.id].image = pSelf.clickTrOff; | |
pSelf.valC[this.id] = "OFF"; | |
pSelf.doBlindPnl(pnlObj, this.id); | |
}else{ | |
pnlObj.iconTr[this.id].image = pSelf.clickTrOn; | |
pSelf.valC[this.id] = "ON"; | |
pSelf.doBlindPnl(pnlObj, this.id); | |
} | |
}; | |
pnlObj.uiIndex[scNum] = pnlObj.scGrp[scNum].add("statictext", [13, 0, scGrpW, 18], this.scArray[scNum]); | |
pnlObj.sep[scNum] = pnlObj.scGrp[scNum].add("image", [0, 19, scGrpW, 21], this.sepLine); | |
//ここから項目の内容 (スクリプトとか) | |
pnlObj.scriptPnl[scNum] = pnlObj.scGrp[scNum].add("panel", [0, 24, scGrpW, 240]); | |
pnlObj.scriptPnl[scNum].visible = false; | |
//座標チェック用テキスト | |
pnlObj.info[scNum] = pnlObj.scriptPnl[scNum].add("statictext", [2,2,100,22],"barY: "); | |
pnlObj.info2[scNum] = pnlObj.scriptPnl[scNum].add("statictext", [2,24,100,44],"uiY: "); | |
}, | |
//スクロールバー | |
sclBuild: function(pnlObj) | |
{ | |
sSelf = this; | |
posX = pnlObj.uiGrp.size.width; | |
//alert(posX); | |
pnlObj.sclGrp = pnlObj.add("group", [posX +4, 2, posX + 18, 240]); | |
pnlObj.sclGrp.addEventListener('mousedown',this.sclFunc1); | |
pnlObj.sclGrp.addEventListener('mouseup',this.sclFunc2); | |
pnlObj.sclGrp.addEventListener('mousemove',this.sclFunc3); | |
pnlObj.sclGrp.addEventListener('click',this.sclFunc4); | |
pnlObj.sclGrp.addEventListener('mouseout',this.sclFunc5); | |
//スクロールバー・バー (Win と Mac で順番を入れ替え) | |
if(this.os == "Win"){ | |
pnlObj.scl_Bar = pnlObj.sclGrp.add("image", [0, 14, 14, 84], this.slBar); | |
pnlObj.scl_Back = pnlObj.sclGrp.add("image", [0, 14, 14, 224], this.slBack); | |
}else if(this.os == "Mac"){ | |
pnlObj.scl_Back = pnlObj.sclGrp.add("image", [0, 14, 14, 224], this.slBack); | |
pnlObj.scl_Bar = pnlObj.sclGrp.add("image", [0, 14, 14, 84], this.slBar); | |
} | |
//スクロールバーの△ | |
pnlObj.scl_Up = pnlObj.sclGrp.add("iconbutton", [0, 0, 14, 14], this.slUp, {style:"toolbutton"}); | |
pnlObj.scl_Up.onClick = function() | |
{ | |
//alert(pnlObj.uiGrp.location[1]); | |
sSelf.uiLocY = pnlObj.uiGrp.location[1]; | |
sSelf.curBar = pnlObj.scl_Bar.location[1]; | |
sSelf.uiM = pnlObj.uiGrp.size[1] / (224 - 70); | |
if(sSelf.curBar - sSelf.scl_StepDelta < 14){ | |
pnlObj.scl_Bar.location = [0, 14]; | |
pnlObj.uiGrp.location = [2, 2]; | |
}else{ | |
pnlObj.scl_Bar.location = [0, sSelf.curBar - sSelf.scl_StepDelta]; | |
pnlObj.uiGrp.location = [2, 2 - (sSelf.uiM * (pnlObj.scl_Bar.location[1] - 14))]; | |
} | |
}; | |
//スクロールバーの▽ | |
pnlObj.scl_Down = pnlObj.sclGrp.add("iconbutton", [0, 224, 14, 238], this.slDown, {style:"toolbutton"}); | |
pnlObj.scl_Down.onClick = function() | |
{ | |
//alert(pnlObj.uiGrp.location[1]); | |
sSelf.uiLocY = pnlObj.uiGrp.location[1]; | |
sSelf.curBar = pnlObj.scl_Bar.location[1]; | |
sSelf.uiM = pnlObj.uiGrp.size[1] / (224 - 70); | |
if(sSelf.curBar + sSelf.scl_StepDelta > (224 - 70)){ | |
pnlObj.scl_Bar.location = [0, (224 - 70)]; | |
pnlObj.uiGrp.location = [2, 2 - sSelf.boundsH]; | |
}else{ | |
pnlObj.scl_Bar.location = [0, sSelf.curBar + sSelf.scl_StepDelta]; | |
pnlObj.uiGrp.location = [2, 2 - (sSelf.uiM * (pnlObj.scl_Bar.location[1] - 14))]; | |
} | |
}; | |
}, | |
//*****ここからファンクション***** | |
// | |
//各パネルの開閉 | |
doBlindPnl: function(pnlObj, scNum) | |
{ | |
if(this.valC[scNum] == "ON"){ | |
valOFF = false; | |
//他が開いてたら、閉じる | |
for(var ii=0;ii<this.valC.length;ii++){ | |
if(!valOFF){ | |
if(ii != scNum){ | |
if(this.valC[ii] == "ON"){ | |
pnlObj.iconTr[ii].image = this.clickTrOff; | |
this.valC[ii] = "OFF"; | |
pnlObj.scriptPnl[ii].visible = false; | |
curB = new Array(); | |
curB = pnlObj.scGrp[ii].bounds; | |
pnlObj.scGrp[ii].bounds = [curB[0], curB[1], curB[2], curB[3] - 218]; | |
valOFF = true; | |
} | |
} | |
//以降のものをずらす | |
}else{ | |
curL = new Array(); | |
curL = pnlObj.scGrp[ii].location; | |
pnlObj.scGrp[ii].location = [curL[0], curL[1] - 218]; | |
} | |
} | |
} | |
valOFF = false; | |
valON = false; | |
//クリックされたものの処理 | |
for(var ii=0;ii<this.valC.length;ii++){ | |
if(!valOFF && !valON){ | |
if(ii == scNum){ | |
if(this.valC[ii] == "ON"){ | |
curB = new Array(); | |
curB = pnlObj.scGrp[ii].bounds; | |
pnlObj.scGrp[ii].bounds = [curB[0], curB[1], curB[2], curB[3] + 218]; | |
pnlObj.scriptPnl[ii].visible = true; | |
valON = true; | |
}else{ | |
pnlObj.scriptPnl[ii].visible = false; | |
curB = new Array(); | |
curB = pnlObj.scGrp[ii].bounds; | |
pnlObj.scGrp[ii].bounds = [curB[0], curB[1], curB[2], curB[3] - 218]; | |
valOFF = true; | |
} | |
} | |
//以降のものをずらす | |
}else{ | |
if(valON){ | |
curB = new Array(); | |
curB = pnlObj.scGrp[ii].location; | |
pnlObj.scGrp[ii].location = [curB[0], curB[1] + 218]; | |
}else if(valOFF){ | |
curL = new Array(); | |
curL = pnlObj.scGrp[ii].location; | |
pnlObj.scGrp[ii].location = [curL[0], curL[1] - 218]; | |
} | |
} | |
} | |
//バーとパネルの移動量の変数 | |
this.uiM = pnlObj.uiGrp.size[1] / (224 - 70); | |
//開いた時は、その項目を最上位で表示 | |
if(valON){ | |
pnlObj.uiGrp.location = [2, 4 - pnlObj.scIndex[scNum]]; | |
pal.scl_Bar.location = [0, 14 + Math.abs(pnlObj.uiGrp.location[1]) / this.uiM]; | |
//閉じた時(全てがOFF)は、パネルを最上位で表示 | |
}else if(valOFF){ | |
pnlObj.uiGrp.location = [2, 2]; | |
pal.scl_Bar.location = [0, 14]; | |
} | |
}, | |
//スクロールバー マウスイベント(down) | |
sclFunc1: function(bd) | |
{ | |
this.valS = true; | |
//クリック時のスクリーン座標 | |
this.clickY = bd.screenY; | |
//クリック時のローカル座標 | |
this.clickLY = bd.clientY; | |
//クリック時のバーのY座標 | |
this.curBar = pal.scl_Bar.location[1]; | |
//クリック時のパネルのローカル座標 | |
this.uiLocY = pal.uiGrp.location[1]; | |
}, | |
//スクロールバー マウスイベント(up) | |
sclFunc2: function(bu) | |
{ | |
//初期化 | |
this.valS = false; | |
this.moveY = 0; | |
}, | |
//スクロールバー マウスイベント(move) | |
sclFunc3: function(m) | |
{ | |
this.boundsH = 240.; | |
//スクリーン座標Y上の移動距離 | |
this.moveY = m.screenY - this.clickY; | |
//移動後のバーのY座標 | |
lBar = this.curBar + this.moveY; | |
//バーとパネルの移動量の変数 | |
this.uiM = (pal.scIndex[pal.scIndex.length - 1] - 4) / (224 - 70); | |
//ドラッグ中の処理 | |
if(this.valS){ | |
if(lBar < 14){ | |
pal.scl_Bar.location = [0, 14]; | |
pal.uiGrp.location = [2, 2]; | |
}else if(lBar + 70 > 224){ | |
pal.scl_Bar.location = [0, 224 - 70]; | |
//pal.uiGrp.location = [2, 4 - pal.scIndex[pal.scIndex.length-1]] | |
}else{ | |
pal.scl_Bar.location = [0, lBar]; | |
uiMoveY = this.uiLocY - (this.moveY * this.uiM); | |
pal.uiGrp.location = [2, uiMoveY]; | |
} | |
} | |
//座標チェック用テキスト | |
for(var iii=0;iii<pal.info.length;iii++){ | |
pal.info[iii].text = "barY: " + pal.scl_Bar.location[1]; | |
pal.info2[iii].text = "uiY: " + pal.uiGrp.location[1]; | |
} | |
}, | |
//スクロールバー マウスイベント(click) | |
sclFunc4: function(c) | |
{ | |
//リリース時のバーのY座標 | |
curBar2 = pal.scl_Bar.location[1]; | |
//ドラッグじゃなかった場合 | |
if(this.curBar == curBar2){ | |
//左クリック (バー以外をクリックしたらジャンプ) | |
if(c.button == 0){ | |
this.boundsH = 240.; | |
this.scl_JumpDelta = 50; | |
//バーとパネルの移動量の変数 | |
this.uiM = (pal.scIndex[pal.scIndex.length - 1] - 4) / (224 - 70); | |
if(this.clickLY < this.curBar && this.clickLY > 14){ | |
if(this.curBar - this.scl_JumpDelta < 14){ | |
pal.scl_Bar.location = [0, 14]; | |
pal.uiGrp.location = [2, 2]; | |
}else{ | |
pal.scl_Bar.location = [0, this.curBar - this.scl_JumpDelta]; | |
pal.uiGrp.location = [2, 2 - (this.uiM * (pal.scl_Bar.location[1] - 14))]; | |
} | |
}else if(this.clickLY > this.curBar + 70 && this.clickLY < 224){ | |
if(this.curBar + this.scl_JumpDelta > 224 - 70){ | |
pal.scl_Bar.location = [0, 224 - 70]; | |
pal.uiGrp.location = [2, 2 - this.boundsH] | |
}else{ | |
pal.scl_Bar.location = [0, this.curBar + this.scl_JumpDelta]; | |
pal.uiGrp.location = [2, 2 - (this.uiM * (pal.scl_Bar.location[1] - 14))]; | |
} | |
} | |
//座標チェック用テキスト | |
for(var iii=0;iii<pal.info.length;iii++){ | |
pal.info[iii].text = "barY: " + pal.scl_Bar.location[1]; | |
pal.info2[iii].text = "uiY: " + pal.uiGrp.location[1]; | |
} | |
} | |
} | |
//初期化 | |
this.valS = false; | |
this.moveY = 0; | |
}, | |
//スクロールバー マウスイベント(out) | |
sclFunc5: function(o) | |
{ | |
//初期化 | |
this.valS = false; | |
this.moveY = 0; | |
} | |
} | |
var pUI = new UIObj(thisObj); | |
//アプリのバージョン確認 | |
if (parseFloat(app.version) < 9) | |
{ | |
alert(pUI.strErr, "blind pnl UI"); | |
return; | |
}else{ | |
pUI.blindPnl_BuildUI(thisObj); | |
} | |
} | |
blindPnlUI(this); | |
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
//Gradient+ を P_Gradient に置き換えるスクリプト | |
app.beginUndoGroup("gradPlusToPGrad"); | |
motobox = ["PSOFT GRADIENT+"]; //置き換えたいエフェクト | |
//var moto="KOJI_SMOOTH"; | |
// var ato="PSOFT GRADIENT+"; //代替するエフェクト | |
var ato="PSOFT GRADIENT"; //代替するエフェクト | |
//--------------各スムースソフトのmatchNameとカラーキーのプロパティの位置の忘備録------------------- | |
kosm = ["KOJI_SMOOTH",1,"white option",]; | |
olmsm = ["OLM smoother",1,"use Color Key",2,"color key",[1,1,1,1]]; | |
gnsm = ["GONZO Smoothing",17,"Enable",18,"Color",[1,1,1,1]]; | |
p_sm = ["PSOFT ANTI-ALIASIHG",5,"color key enable",6,"key color",[1,1,1,1]]; | |
//--------------まぁ、本文で使ってないので使い方はご随意に。----------------------- | |
function irekae(){ | |
keyinfo = "キーフレームがあるから確認してください \n"; | |
for (var i=1; i<=app.project.items.length ; i++){ | |
if (app.project.item(i).typeName=="コンポジション"){ | |
for (var j=1; j<=app.project.item(i).numLayers; j++){ | |
if(app.project.item(i).layer(j)("Effects")!=null){ | |
for (var k=1; k<=app.project.item(i).layer(j)("Effects").numProperties; k++){ | |
for(mbid = 0;mbid <= motobox.length-1; mbid++){ | |
if(app.project.item(i).layer(j)("Effects")(k).matchName==motobox[mbid]){ | |
app.project.item(i).layer(j)("Effects").addProperty(ato); //P_Gradientをあてる | |
EFID=app.project.item(i).layer(j)("Effects").numProperties; | |
app.project.item(i).layer(j)("Effects")(EFID).moveTo(k+1); //Gradient+ の下にP_Gradient移動 | |
//---------------------プロパティのコピペ--------------------------------------------------------------------------------------- | |
motoe = app.project.item(i).layer(j)("Effects")(k); | |
atoe = app.project.item(i).layer(j)("Effects")(k+1); | |
motokflag = 0; //----このGradient+のflag | |
kfbox = new Array(); | |
motidbox = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,16,17,18,19,20,21,22,23,24,25,26,27,29,30]; | |
// atoidbox = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,16,17,18,19,20,21,22,23,24,25,26,27,29,30]; | |
atoidbox = [1,3,4,5,6,7,8,9,10,11,12,13,15,16,41,42,43,44,45,46,47,48,49,50,51,52,55,54]; | |
cmpname = app.project.item(i).name; | |
layid = app.project.item(i).layer(j).index; | |
layname = app.project.item(i).layer(j).name; | |
for(pn = 0;pn <= motidbox.length-1 ; pn++){ //-----一つ一つのpropertyの処理 | |
mib = motidbox[pn]; | |
aib = atoidbox[pn]; | |
kfflag = 0; //----このpropertyのflag | |
mp = motoe.property(mib); | |
mpn = motoe.property(mib).name; | |
mpnk = motoe.property(mib).numKeys; | |
mpex = motoe.property(mib).expression; | |
ap = atoe.property(aib); | |
//alert(mpn + " のkeyの数は " + mpnk); | |
if (mpnk == 0 && mpex == false){ | |
prop = motoe.property(mib).value; | |
atoe.property(aib).setValue(prop); | |
} | |
else{ | |
//--逃げの文を書いておく。きっとリベンジを。 | |
kfflag = 1; | |
motokflag = 1; | |
keyinfo = keyinfo + "\n" + cmpname + " " + layid + " " + layname; | |
pktbox = new Array(); | |
pkvbox = new Array(); | |
kiitbox = new Array(); | |
kistbox = new Array(); | |
kitebox = new Array(); | |
koitbox = new Array(); | |
kostbox = new Array(); | |
kotebox = new Array(); | |
for(pk = 1;pk <= mpnk ;pk++){ | |
mpkt = mp.keyTime(pk); | |
mpkv = mp.keyValue(pk); | |
kiit = mp.keyInInterpolationType(pk); | |
kite = mp.keyInTemporalEase(pk); | |
koit = mp.keyOutInterpolationType(pk); | |
kote = mp.keyOutTemporalEase(pk); | |
pktbox.push(mpkt); | |
pkvbox.push(mpkv); | |
kiitbox.push(kiit); | |
kitebox.push(kite); | |
koitbox.push(koit); | |
kotebox.push(kote); | |
if(pn ==1||pn ==2){ | |
kist = mp.keyInSpatialTangent(pk); | |
kost = mp.keyOutSpatialTangent(pk); | |
kistbox.push(kist); | |
kostbox.push(kost); | |
}; | |
ap.addKey(mpkt); | |
ap.setValueAtTime(mpkt,mpkv); | |
//alert("kiitboxは " + kiitbox.toString()); | |
}; | |
/* | |
for(ak = 1;ak <= mpnk;ak++){ | |
bxindx = ak-1; | |
ap.keyInInterpolationType(ak).setValue(kiitbox[bxindx]); | |
ap.keyInTemporalEase(ak).setValue(kitebox[bxindx]); | |
ap.keyOutInterpolationType(ak).setValue(koitbox[bxindx]); | |
ap.keyOutTemporalEase(ak).setValue(kotebox[bxindx]); | |
if(pn ==1||pn ==2){ | |
ap.keyInSpatialTangent(ak).setValue( kistbox[bxindx]); | |
ap.keyOutSpatialTangent(ak).setValue( kostbox[bxindx]); | |
}; | |
}; | |
*/ | |
}; | |
}; | |
//---------------------プロパティのコピペ------おしまい--------------------------------------------------------------------------------- | |
//-------------------------------エフェクトの目玉が消えてたら新規の目玉も消す----------------------------------------- | |
if ( app.project.item(i).layer(j)("Effects")(k).enabled == false){ | |
app.project.item(i).layer(j)("Effects")(k+1).enabled =false; | |
if(omflag == 1){ | |
ome.enabled = false | |
}; | |
}; | |
//-------------------------------エフェクトの目玉が消えてたら--おしまい------------------------------------------------- | |
if (motokflag == 0){ | |
app.project.item(i).layer(j)("Effects")(k).remove(); | |
} | |
else{ | |
k = k+1; | |
}; | |
} | |
}; | |
} | |
} | |
} | |
} | |
} | |
if(motokflag !=0){ | |
alert(keyinfo); | |
}; | |
}; //functionおしまい | |
irekae(); | |
// irekae(); | |
alert("おしまい= (゚∀゚)ノ ") | |
app.endUndoGroup(); | |
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
//v1.0 今までのものをv1.0とします。階調描画にGradientを使用していました。 | |
//v1.1 CellFXのGradient→P_Gradient へ使用エフェクトを変更しました。 | |
//ライセンス:Free for All | |
//http://terraon.jp/2011/03/26/scriptcellfxbeta_to_cellfx/ | |
//インターフェース全部/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ | |
var myPalette = this; | |
//下処理その1。UIの配置の間隔とかの記載______________________________________________ | |
var spacer=0; | |
var btnSize=20; | |
var centerline=75; | |
var alpha=95 | |
////////////////////////////////////////////////////////////////////////////////////////////////////// ↓ ここ配列使えそう | |
btn1x_1=centerline+spacer; | |
btn1x_2=btn1x_1+btnSize; | |
btn2x_1=btn1x_2+spacer; | |
btn2x_2=btn2x_1+btnSize; | |
btn3x_1=btn2x_2+spacer; | |
btn3x_2=btn3x_1+btnSize; | |
btn4x_1=btn3x_2+spacer; | |
btn4x_2=btn4x_1+btnSize; | |
btn5x_1=btn4x_2+spacer; | |
btn5x_2=btn5x_1+btnSize; | |
btn6x_1=btn5x_2+spacer; | |
btn6x_2=btn6x_1+btnSize; | |
btn7x_1=btn6x_2+spacer; | |
btn7x_2=btn7x_1+btnSize; | |
btn8x_1=btn7x_2+spacer; | |
btn8x_2=btn8x_1+btnSize; | |
btn9x_1=btn8x_2+spacer; | |
btn9x_2=btn9x_1+btnSize; | |
/////////////////////////////////////////////////////////////////////////////////////////////////// ↑ここ配列使えそう | |
//アイコンボタンの呼び出し。__________________________________ | |
btn1Icon = File( "../"+"(png)"+"/FP_ launcher/1.png"); | |
btn2Icon = File( "../"+"(png)"+"/FP_ launcher/2.png"); | |
btn3Icon = File( "../"+"(png)"+"/FP_ launcher/3.png"); | |
btn4Icon = File( "../"+"(png)"+"/FP_ launcher/4.png"); | |
btn5Icon = File( "../"+"(png)"+"/FP_ launcher/5.png"); | |
btn6Icon = File( "../"+"(png)"+"/FP_ launcher/6.png"); | |
btn7Icon = File( "../"+"(png)"+"/FP_ launcher/7.png"); | |
btn8Icon = File( "../"+"(png)"+"/FP_ launcher/8.png"); | |
btn9Icon = File( "../"+"(png)"+"/FP_ launcher/9.png"); | |
//ここ↑あんまきれいじゃないから後で配列使ったファイルの呼び出し方法考える。 | |
//配列を使うダブルクオーテーションで細かく区切って割り振るとか。 | |
if(btn1Icon.exists) | |
{btn1=myPalette.add("iconbutton",[btn1x_1 , alpha , btn1x_2 ,alpha+btnSize],btn1Icon, {style:"toolbutton"}); | |
}; | |
if(btn2Icon.exists) | |
{btn2=myPalette.add("iconbutton",[btn2x_1 ,alpha, btn2x_2 , alpha+btnSize],btn2Icon,{style:"toolbutton"}); | |
}; | |
if(btn3Icon.exists) | |
{btn3=myPalette.add("iconbutton",[btn3x_1 , alpha ,btn3x_2 , alpha+btnSize ],btn3Icon,{style:"toolbutton"}); | |
}; | |
if(btn4Icon.exists) | |
{btn4=myPalette.add("iconbutton",[btn1x_1, alpha+btnSize ,btn1x_2 , alpha+btnSize*2],btn4Icon,{style:"toolbutton"}); | |
}; | |
if(btn5Icon.exists) | |
{btn5=myPalette.add("iconbutton",[btn2x_1, alpha+btnSize ,btn2x_2 , alpha+btnSize*2],btn5Icon, {style:"toolbutton"}); | |
}; | |
if(btn6Icon.exists) | |
{btn6=myPalette.add("iconbutton",[btn3x_1, alpha+btnSize ,btn3x_2 , alpha+btnSize*2],btn6Icon,{style:"toolbutton"}); | |
}; | |
if(btn7Icon.exists) | |
{btn7=myPalette.add("iconbutton",[btn1x_1, alpha+btnSize*2 ,btn1x_2,alpha+btnSize*3],btn7Icon,{style:"toolbutton"}); | |
}; | |
if(btn8Icon.exists) | |
{btn8=myPalette.add("iconbutton",[btn2x_1 ,alpha+btnSize*2 ,btn2x_2 ,alpha+btnSize*3],btn8Icon,{style:"toolbutton"}); | |
}; | |
if(btn9Icon.exists) | |
{btn9=myPalette.add("iconbutton",[btn3x_1 ,alpha+btnSize*2,btn3x_2 ,alpha+btnSize*3],btn9Icon,{style:"toolbutton"}); | |
}; | |
//HSVカラーの帯とスライダ、そしてスライダの値をその都度アクティブに出すテキスト____________________________________________ | |
var beta=23; | |
clrSldr=myPalette.add("slider",[beta,21,beta*8,beta+10],0,0,360); | |
ClrBr1=File( "../"+"(png)"+"/FP_ launcher/UI_color.png"); | |
if(ClrBr1.exists){ | |
ClrBr=myPalette.add("image",[beta,beta,beta*8,beta*2.0],ClrBr1); | |
}; | |
clrSldrTxt =myPalette.add("statictext",[100,45,120,60], "0"); | |
clrSldr.onChanging = function () | |
{ | |
clrSldrTxt.text =Math.round(clrSldr.value); | |
HSVtoRGB() | |
} | |
//光の性質、直線か放射状か。ラジオボタンで指示_________________________________________ | |
paraBtn=myPalette.add("radiobutton",[45 , 55, 95 , 70],"パラ"); | |
flareBtn=myPalette.add("radiobutton",[120 ,55 , 260, 70],"フレア"); | |
groupup = myPalette.add('group',[44,54,261,71], "ue"); | |
paraBtn.onClick=true; | |
paraBtn.value=true; | |
StBtn=myPalette.add("radiobutton",[45 , 70, 115 , 85],"直線カーブ"); | |
RdoBtn=myPalette.add("radiobutton",[120 ,70 , 260, 85],"放射カーブ"); //具体的な配置の場所は跡で決める。今はとりあえずの値 | |
groupdown = myPalette.add('group',[44,69,261,86], "shita"); | |
StBtn.onClick=true; | |
StBtn.value=true; | |
//インターフェースここまで/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ | |
//アイコンボタンが押された際の処理_______________________________________ | |
function mohimohi(){ | |
activeComp = app.project.activeItem ; | |
i = 0; | |
CompOnly = true; | |
w =activeComp.width; | |
h =activeComp.height; | |
ParaOrFlare() | |
if ( POF ==12) | |
{ fuga = [0,0,0.8]; | |
}; | |
if ( POF ==13) | |
{ fuga = [1,0.5,0]; | |
}; | |
layerObj = app.project.activeItem.layers.addSolid( fuga, "effect", w, h, 1.0, 500); | |
HSVtoRGB() | |
StOrRdo() | |
Gradient = layerObj("Effects").addProperty("P_Gradient"); | |
//alert(clrSldrTxt.text); | |
Gradient.property(6).setValue([R,G,B]); | |
Gradient.property(10).setValue([16]); | |
Gradient.property(11).setValue([30]); | |
Gradient.property(13).setValue([Grprop]); | |
ParaOrFlare() | |
if ( POF ==12){ | |
layerObj.blendingMode= BlendingMode.MULTIPLY; | |
Gradient.property(7).setValue([255,255,255]); | |
layerObj.comment = "*パラ"; | |
MC = "*---パラ---" ; | |
myMarker = new MarkerValue(MC); | |
activeComp.layer(1).property("Marker").setValueAtTime(activeComp.layer(1).inPoint,myMarker) ; | |
}; | |
if ( POF ==13){ | |
layerObj.blendingMode= BlendingMode.SCREEN; | |
Gradient.property(7).setValue([0,0,0]); | |
layerObj.comment = "*フレア"; | |
MC = "*---フレア---" ; | |
myMarker = new MarkerValue(MC); | |
activeComp.layer(1).property("Marker").setValueAtTime(activeComp.layer(1).inPoint,myMarker) ; | |
}; | |
}; | |
//ストレートなんだかラジアルなんだか。------------------------------------------------------------------------------ | |
function StOrRdo(){ | |
if (StBtn.value==true ){ | |
btnflag=10; | |
Grprop=1; | |
}; | |
if (StBtn.value==false ){ | |
btnflag=11; | |
Grprop=3; | |
}; | |
}; | |
//パラなんだかフレアなんだか。-------------------------------------------------------------------------------------------- | |
function ParaOrFlare(){ | |
if (paraBtn.value==true ){ | |
btnflag=12; | |
POF=12; | |
}; | |
if (paraBtn.value==false){ | |
btnflag=13; | |
POF=13; | |
}; | |
}; | |
//HSVカラーからRGBカラーへの変換について書いてはる-------------------------------------------------------------- | |
function HSVtoRGB() //ここでHSVからRGBの値に変換する。 | |
{ | |
H = eval(clrSldrTxt.text); | |
s =1; | |
v =1; | |
HG=Math.floor(H/60); | |
Hi=HG%6; | |
f=H/60-Hi; | |
p=v*(1-s); | |
q=v*(1-f*s); | |
t= v * (1 - s*(1 - f)); | |
//alert(Hi); | |
if (Hi==0){R=v; G=t; B=p;}; | |
if (Hi==1){R=q; G=v; B=p;}; | |
if (Hi==2){R=p; G=v; B=t;}; | |
if (Hi==3){R=p; G=q; B=v;}; | |
if (Hi==4){R=t; G=p; B=v;}; | |
if (Hi==5){R=v; G=p; B=q;}; | |
if (G==6){G=0;}; | |
}; | |
//ボタンそれぞれの特徴とか。グラディエントの光の始点・終点とか------------------------------------------------------------------ | |
btn1.onClick=function (){ | |
btnflag=1; //alert(R+"\n"+G+"\n"+B+"\n"); | |
mohimohi() //alert(w+"\n"+h); | |
Gradient.property(3).setValue([0,0]); | |
Gradient.property(4).setValue([w/2,h]); | |
}; | |
btn2.onClick=function (){ | |
btnflag=2; | |
mohimohi() | |
Gradient.property(3).setValue([w/2,0]); | |
Gradient.property(4).setValue([w/2,h/2]); | |
}; | |
btn3.onClick=function (){ | |
btnflag=3; | |
mohimohi() | |
Gradient.property(3).setValue([w,0]); | |
Gradient.property(4).setValue([w/2,h]); | |
}; | |
btn4.onClick=function (){ | |
btnflag=4; | |
mohimohi() | |
Gradient.property(3).setValue([0,h/2]); | |
Gradient.property(4).setValue([w/2,h/2]); | |
}; | |
btn5.onClick=function (){ | |
btnflag=5; | |
mohimohi() | |
if(Gradient.property(12).setValue([2])){ | |
Gradient.property(12).setValue([1]) | |
}; | |
Gradient.property(3).setValue([w/2,h/2]); | |
Gradient.property(4).setValue([w/2,0]); | |
}; | |
btn6.onClick=function (){ | |
btnflag=6; | |
mohimohi() | |
Gradient.property(3).setValue([w,h/2]); | |
Gradient.property(4).setValue([w/2,h/2]); | |
}; | |
btn7.onClick=function (){ | |
btnflag=7; | |
mohimohi() | |
Gradient.property(3).setValue([0,h]); | |
Gradient.property(4).setValue([w/2,0]); | |
}; | |
btn8.onClick=function (){ | |
btnflag=8; | |
mohimohi() | |
Gradient.property(3).setValue([w/2,h]); | |
Gradient.property(4).setValue([w/2,h/2]); | |
}; | |
btn9.onClick=function (){ | |
btnflag=9; | |
mohimohi() | |
Gradient.property(3).setValue([w,h]); | |
Gradient.property(4).setValue([w/2,h/2]); | |
}; |
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
/* | |
【tr_renderbird】 version : 0.21 | |
高速にファイルを収集します。 | |
AEP を保存した後、監視状態のAEがレンダリングに入るためのRCF(Render Control File)ファイルを生成します。 | |
Auther : Terraon | |
Blog : http://terraon.jp/ | |
Mail : teraomeister@gmail.com | |
*/ | |
var RBpalette = this ; | |
RBpalette.Txt1= RBpalette.add('statictext', [6, 25, 125, 40], "マシンの最大数 (規定値:5)"); | |
RBpalette.Pnl1= RBpalette.add('edittext', [130, 20, 160, 40],'',{multiline:false}); | |
RBpalette.Btn1= RBpalette.add('button', [170, 20, 235, 40],'ファイルを収集', {name:'ok'}); | |
function RB(){ | |
var shsh_LocationPath="//192.168.1.12/cmpshare/cmp03/_network_render1";//収集先のパス | |
// var maxmachine="5";//マシンの最大数 | |
if(app.project.renderQueue.items.length==0) | |
{ | |
alert("キューが空なのでスクリプトは起動しません。終了します。")//なければここでストップ | |
}; | |
else{ | |
//未保存のプロジェクトファイルへのエラー回避 | |
app.project.save(); | |
//収集時に使用するファイル名の情報、ここではプロジェクト名+日時 | |
//プロジェクトファイル名 | |
var projectName=app.project.file.name.substr(0,app.project.file.name.length-4); | |
//現在のプロジェクトファイルのパス | |
var moto_fileObj = new File(app.project.file); | |
//収集フォルダ・AEP、RCF.txtの名前 | |
var shsh_Base = projectName + "_RQ" ; | |
//収集時に使用するファイル名の情報>ここまで。ワークフローにあわせて編集するとよいです。 | |
//カット名と同名のフォルダが存在するかどうか調べる | |
var shsh_folder = shsh_LocationPath +"/"+ shsh_Base; | |
folderObj = new Folder(shsh_folder); | |
flag = folderObj.exists; | |
if (flag == true) | |
{ | |
alert("指定の収集フォルダはすでに存在しています!収集を開始できません!");//重複ならここでストップ | |
}; | |
else{ | |
maxmachine=String(RBpalette.Pnl1.text) ; | |
//RCFファイルの内容 | |
var RCFTXT="After Effects 8.0v1 Render Control File"+"\n"+"max_machines=" + maxmachine+"\n"+"num_machines=0"+"\n"+"init=0"+"\n"+"html_init=0"+"\n"+"html_name="; | |
//収集先にフォルダを作成します。 | |
foldername =shsh_LocationPath +"/" + shsh_Base ; | |
folderObj = new Folder(foldername); | |
flag = folderObj.create(); | |
if(flag == true) //フォルダを作成できたなら~ | |
{ | |
//フォルダにAEPを保存します | |
var shsh_aepSave = foldername + "/" + shsh_Base + ".aep"; | |
fileObj1 = new File(shsh_aepSave); | |
app.project.save(fileObj1) ; //収集フォルダへ保存する | |
//フォルダに_RCF.txtファイルを作成します。 | |
filename = foldername + "/" +shsh_Base + "_RCF.txt"; | |
fileObj2 = new File(filename); | |
flag = fileObj2.open("w"); | |
if (flag == true) | |
{ | |
fileObj2.write(RCFTXT);//RCF.TXTへの書き込み | |
fileObj2.close(); | |
app.project.save(moto_fileObj);//収集前のAEPへ上書き保存 | |
//次のプロジェクトを開く(工事中) | |
}else{ | |
alert("ファイルが開けませんでした"); | |
}; | |
}; | |
}; | |
}; | |
}; | |
RBpalette.Btn1.onClick = RB ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment