選択しているシンボルの座標原点を、現在の階層の座標原点に合わせるJSFLです。
Illustratorからコピー&ペーストしてきたシンボルの原点を、一括でそろえる時に活躍します。
JSFL
/***
* 選択されたオブジェクトの原点を、親MCの原点とあわせます。
* @version 2009.09.25 タイムラインにまたがったシンボルの移動に対応
* @@@BUILDINFO@@@ 原点を親MCにあわせる.jsfl !Version! Tue Feb 03 2009 11:45:38 GMT+0900
* */
main();
function main() {
fl.trace("");
fl.trace("Move Origin .....");
var doc = fl.getDocumentDOM();
var lib = doc.library;
var selectedClip = doc.selection;
if (selectedClip.length) {
var n = selectedClip.length;
for (var i = 0; i < n; i++) {
var currentClip = selectedClip[i];
//現在の座標を記憶
var tmpMatrix = currentClip.matrix;
var tmpX = tmpMatrix.tx;
var tmpY = tmpMatrix.ty;
doc.selectNone();
doc.selection = [currentClip];
//クリップの中身を移動
doc.enterEditMode("inPlace");
var timeLine = doc.getTimeline();
for (var j = 0; j < timeLine.frameCount; j++) {
timeLine.currentFrame = j;
doc.selectAll();
if (doc.selection.length == 0) {
continue;
}
var rect = doc.getSelectionRect();
fl.getDocumentDOM().moveSelectionBy({ x: tmpX, y: tmpY });
doc.selectNone();
}
doc.exitEditMode();
//自分自身を変更
doc.selectNone();
doc.selection = [currentClip];
doc.moveSelectionBy({ x: -tmpX, y: -tmpY });
doc.setTransformationPoint({ x: 0, y: 0 });
}
}
fl.trace("Command Complete.");
}