概述
文章目录
- 1.图层排序功能
- 2.作者答疑
1.图层排序功能
AfterEffect(AE)插件是Adobe公司开发的特效制作软件,稳定快速的功能和特效,在视频制作领域使用非常广泛,本文向大家介绍如何在项目里进行图层排序功能。源代码如下所示:
{
// Sort Layers by In Point.jsx
//
// This script reorders layers in the active comp, sorted by inPoint.
//
function SortLayersByInPoint(thisObj)
{
var proj = app.project;
var scriptName = "Sort Layers by In Point";
function sortByInpoint(comp_layers, unlockedOnly) {
var total_number = comp_layers.length;
while (total_number >= 2) {
var layer_was_moved = false;
for (j = 1; j <= total_number; j++) {
// if you want to reverse the sort order, use "<" instead of ">".
if (comp_layers[j].inPoint > comp_layers[total_number].inPoint) {
if (comp_layers[j].locked) {
if (unlockedOnly==false) {
comp_layers[j].locked = false;
comp_layers[j].moveAfter(comp_layers[total_number]);
comp_layers[total_number].locked = true;
layer_was_moved = true;
}
} else {
comp_layers[j].moveAfter(comp_layers[total_number]);
layer_was_moved = true;
}
}
}
if (!layer_was_moved) {
total_number = total_number-1 ;
}
}
}
// change this to true if you want to leave locked layers untouched.
var unlockedOnly = false;
if (proj) {
var activeItem = app.project.activeItem;
if (activeItem != null && (activeItem instanceof CompItem)) {
app.beginUndoGroup(scriptName);
var activeCompLayers = activeItem.layers;
sortByInpoint(activeCompLayers, unlockedOnly);
app.endUndoGroup();
} else {
alert("Please select an active comp to use this script", scriptName);
}
} else {
alert("Please open a project first to use this script.", scriptName);
}
}
SortLayersByInPoint(this);
}
合理的脚本代码可以有效的提高工作效率,减少重复劳动。
2.作者答疑
如有疑问,请留言。
最后
以上就是甜美未来为你收集整理的AfterEffect插件-常规功能开发-图层排序-js脚本开发-AE插件的全部内容,希望文章能够帮你解决AfterEffect插件-常规功能开发-图层排序-js脚本开发-AE插件所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复