【AE脚本开发】调用ae自带颜色拾取

Github link=https://github.com/Belonit/AEColorPicker 【AE脚本开发】调用ae自带颜色拾取

安装

Windows:

将 AEColorPicker.aex 复制到文件夹

Adobe After Effects 安装目录\Support Files\Plug-ins

Mac: 将 AEColorPicker.plugin 复制到文件夹

Applications/Adobe After Effects [version]/Plug-ins

调用

var externalLibrary = new ExternalObject('lib:C:\\AEColorPicker.aex'); 
var oldColor = 0x20F186;
var newColor = externalLibrary.colorPicker(oldColor, dialog_title);
if(newColor == -1){ //Returns -1 if user clicked on cancel
    newColor = oldColor;
}

或者你可以通过一些小技巧使用脚本完成

// https://community.adobe.com/t5/after-effects-discussions/calling-the-after-effects-color-picker-through-script/td-p/11954317
function ColorPicker(startValue) {
    // find the active comp
    var crntComp = app.project.activeItem;
    if (!crntComp || !(crntComp instanceof CompItem)) {
        alert('Please open a comp first');
        return [];
    }

    // add a temp null;
    var newNull = crntComp.layers.addNull();
    var newColorControl = newNull('ADBE Effect Parade').addProperty('ADBE Color Control');
    var theColorProp = newColorControl('ADBE Color Control-0001');

    // set the value given by the function arguments
    if (startValue && startValue.length == 3) {
        theColorProp.setValue(startValue);
    }

    // prepare to execute
    var editValueID = 2240; // or app.findMenuCommandId("Edit Value...");
    theColorProp.selected = true;
    app.executeCommand(editValueID);

    // harvest the result
    var result = theColorProp.value;

    // remove the null
    if (newNull) {
        newNull.remove();
    }

    return result;
}

alert(ColorPicker([1, 1, 1]));

给TA充电
共{{data.count}}人
人已充电
AEAE开发脚本开发

【AE脚本】翻译小助手 | 一键获取效果所有属性

2022-4-6 14:12:28

AE开发脚本开发

【AE脚本示例】ScriptUI通过radioButton切换面板组

2022-4-20 16:28:44

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
今日签到
搜索