[aftereffects] コンポ内レイヤープロパティ情報をテキストに書き出すスクリプト
※記事に関しましてご注意下さい
他記事作成時など実験時に使用したスクリプトのメモです。
間違い・勘違いが含まれている可能性もありますので予めご了承ください。
内容
コンポ内レイヤープロパティ情報をテキストに書き出すスクリプト
主にプロパティの階層構造と matchName、properyIndex の確認用です。
スクリプト本体は 最後尾のソースコード です。
以前に投降した以下記事
effect("スライダー制御")("スライダー") で起こる多言語トラブルの原因
を含め度々調べることになるためスクリプト化したものです。
部分的に書き換えれば他にも流用可能かと思います。
実行前の注意点
設定で以下が有効である必要があります。
メニュー > 編集 > 環境設定 > 一般設定 >
スクリプトによるファイルへの書き込みとネットワークへのアクセスを許可
※または
メニュー > 編集 > 環境設定 > スクリプトとエクスプレッション >
スクリプトによるファイルへの書き込みとネットワークへのアクセスを許可
Please select "Allow Scripts To Write Files" option.
Menu > Edit > Preferences > General >
Allow Scripts to Write Files and Access Network
* or
Menu > Edit > Preferences > Scripting & Expressions >
Allow Scripts to Write Files and Access Network
実行例
適当なコンポジションと用意し、プロパティを選択して実行します。
終了するとメモ帳なり関連付けされたアプリで結果が表示されます。
aftereffects_property_report.txt
(propertyDepth) propertyIndex: name [matchName]
+ 1 : 異なるマット [ADBE Difference Matte2]
++ 1 : 表示 [ADBE Difference Matte2-0001]
++ 2 : 異なるレイヤー [ADBE Difference Matte2-0002]
++ 3 : レイヤーサイズが異なる場合 [ADBE Difference Matte2-0003]
++ 4 : マッチングの許容度 [ADBE Difference Matte2-0004]
++ 5 : マッチングの柔軟度 [ADBE Difference Matte2-0005]
++ 6 : 異なる前にブラー [ADBE Difference Matte2-0006]
++ 7 : コンポジットオプション [ADBE Effect Built In Params]
+++ 1 : マスク [ADBE Effect Mask Parade]
+++ 2 : エフェクトの不透明度 [ADBE Effect Mask Opacity]
同じプロパティを english モードの aftereffects で実行した結果
aftereffects_property_report.txt
(propertyDepth) propertyIndex: name [matchName]
+ 1 : Difference Matte [ADBE Difference Matte2]
++ 1 : View [ADBE Difference Matte2-0001]
++ 2 : Difference Layer [ADBE Difference Matte2-0002]
++ 3 : If Layer Sizes Differ [ADBE Difference Matte2-0003]
++ 4 : Matching Tolerance [ADBE Difference Matte2-0004]
++ 5 : Matching Softness [ADBE Difference Matte2-0005]
++ 6 : Blur Before Difference [ADBE Difference Matte2-0006]
++ 7 : Compositing Options [ADBE Effect Built In Params]
+++ 1 : Masks [ADBE Effect Mask Parade]
+++ 2 : Effect Opacity [ADBE Effect Mask Opacity]
ソースコード
RDJ_reportPropertyInfo.jsx
//-----------------------------------
// report property infos from selected properties
//
// author: https://qiita.com/rdj_masato
//-----------------------------------
(function (me)
{
// ----------------
var _propInfo = function(prop) {
var ret = [ {
'depth': prop.propertyDepth,
'index': prop.propertyIndex,
'name': prop.name,
'matchName': prop.matchName,
} ];
if (! prop.hasOwnProperty('numProperties')) return ret;
for (var i = 0; i < prop.numProperties; i ++) ret.push.apply(ret, _propInfo(prop.property(i + 1)));
return ret;
};
// ---------------- collection & validation
var comp = app.project.activeItem;
if (! (comp instanceof CompItem)) {
Window.alert('Please open composition first.', 'Warning');
return;
}
var props = [];
for (var i = 0; i < comp.selectedProperties.length; i ++) {
var prop = comp.selectedProperties[i];
// removing duplicates
for (var j = 0; j < props.length; j ++) {
if (props[j] != prop.parentProperty) continue;
props.splice(j, 1);
}
props.push(prop);
}
if (props.length < 1) {
Window.alert('Please select the properties you need.', 'Warning');
return;
}
// ---------------- extraction
var infos = [];
for (var i = 0; i < props.length; i ++) infos.push.apply(infos, _propInfo(props[i]));
// ---------------- integration
var path = [Folder.temp.fullName, 'aftereffects_property_report.txt'].join('/');
var lines = [];
// header
lines.push( ['(propertyDepth) propertyIndex: name [matchName]'].join('\t') );
lines.push( '' );
// body
for (var i = 0; i < infos.length; i ++) {
var item = infos[i];
lines.push( (new Array(item.depth)).join('+') + ' ' + item.index + ' : ' + item.name + ' [' + item.matchName + ']' );
}
var fd = new File(path);
if (! fd.open('w')) {
Window.alert('Failed to write file to disk.', 'Warning');
return;
}
for (var i = 0; i < lines.length; i ++) fd.writeln(lines[i]);
fd.close();
fd.execute();
}
)(this);
//-----------------------------------
Author And Source
この問題について([aftereffects] コンポ内レイヤープロパティ情報をテキストに書き出すスクリプト), 我々は、より多くの情報をここで見つけました https://qiita.com/rdj_masato/items/a0643a0d54c604170a84著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .