从 After Effects 中的 CEP 扩展打开 CEP 对话框

发布于 2025-01-11 03:07:58 字数 170 浏览 0 评论 0原文

我在 After Effects 中有一个 CEP 扩展,我希望它能够在用户单击按钮时在新的浮动对话框中打开一个设置对话框。看起来这将是这样的基本功能,但不知怎的,我在(诚然稀疏的)文档中没有看到如何打开对话框的任何地方。我看到其他人说你可以创建一个隐藏的扩展来打开对话框,但我没有看到这样的例子,也不清楚这对我来说如何工作。

I have a CEP extension in After Effects and I want it so that when a user clicks a button, a settings dialog opens up in a new floating dialog box. Seems like it would be such basic functionality but somehow I'm not seeing anywhere in the (admittedly sparse) documentation how to open up a dialog box. I've seen some other people say that you can make a hidden extension which opens the dialog, but I've seen no example of that and it is unclear how that would work to me.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

冷了相思 2025-01-18 03:07:58

您可以查找 ScriptUI 的文档。这是pdf的链接:https://adobeindd.com/view/publications/a0207571-ff5b-4bbf-a540-07079bd21d75/92ra/publication-web-resources/pdf/scriptui-2-16-j.pdf

您可以在 jsx 的函数中创建一个对话框,或者为其提供自己的 jsx 页面并 //@include 它 onclick。

我知道这是一个通用的答案,但如果其他人遇到麻烦,这将为您提供一个很好的起点。

You can look up documentation for ScriptUI. Heres a link to the pdf: https://adobeindd.com/view/publications/a0207571-ff5b-4bbf-a540-07079bd21d75/92ra/publication-web-resources/pdf/scriptui-2-16-j.pdf

You can create a dialog either in a function in the jsx, or give it its own jsx page and //@include it onclick.

I know this is kind of a generic answer, but incase anyone else is having trouble this will give you a good jumping off point.

深海少女心 2025-01-18 03:07:58

因此,为了提供您需要的功能,您必须首先初始化一个对话框,然后添加一个按钮,然后强制它打开一个特定的设置对话框。我建议这样:

var dialog = new Window("dialog");
               dialog.text = "After Effects Dialog Script";

//Contents
        var newMsg = dialog.add("group", undefined, {name: "newMsg"});
               newMsg.orientation = "column";
        var newMsgText = newMsg.add("statictext", [0, 0, 400, 40], "", {name: "newMsgText", multiline: true});
               newMsgText.text = "Would you like to open a settings dialog?";
        
//Button UI        
        var buttonPanel = dialog.add("group", undefined, {name: "buttonPanel"});
                  buttonPanel.orientation = "row";
                  buttonPanel.alignChildren = ["center", "bottom"];
        var enter = buttonPanel.add("button", undefined, undefined, {name: "ok"}); 
                  enter.text = "Continue";
                  enter.value = true; 
        var cancel = buttonPanel.add("button", undefined, undefined, {name: "cancel"}); 
                  cancel.text = "Cancel";
                  cancel.value = false; 

//Runs the dialog code
dialog.show();

//Grabs answer to yes or no question
var dialogInput = dialog.show();        
        if(dialogInput == true){
            app.openDlg (prompt, filter, multiSelect);  //Essentially 
            }
            else {
                alert("The action was canceled.");
                            }

必须找到您想要打开的CEP对话框的直接路径。我不熟悉它们以及它们与 After Effects 的集成,因此除了设置脚本之外我无法为您提供太多帮助。不过,我对资源有一些评论,这些评论可能也有帮助。

Peter Kahrel 的 ScriptUI 资源非常棒。过去几周我一直在使用它。我想通过添加几个更好的 Extendscript 支持示例来补充 Jake L 所说的内容,因为您有点必须挖掘文档,但它确实存在。

https://extendscript.docsforadobe.dev/

我最近偶然发现了 Extendscript 库,但它详细介绍了许多函数,深入研究事件和事件处理程序,甚至解释了如何通过 vscode 设置扩展脚本的环境。

我还喜欢在 YouTube 上查看 NTProductions 寻求帮助。我在 Indesign 工作,但许多 ExtendScript 功能可以在各种 Adob​​e 程序之间工作,您甚至可以对 Adob​​e ExtendScript Toolkit 中的基本功能进行故障排除。

如果您已经拥有 Adob​​e CC 帐户,请不要忘记从 adobe API 和服务下载脚本 SDK。您必须登录才能到达那里,但这是一个非常有用的本地文档。

https://developer.adobe.com/console/servicesandapis/id#

编辑(再次):我在发布后也发现了这些,并将承诺在找到它们后添加更多内容。 Extendscript 文档必须变得更加可用! :-)

https://docsforadobe.dev/

http://yearbook.github.io/esdocs/#/

So in order to provide the functionality you need, you'll have to initialize a dialog box first, then add a button, then force it to open a specific settings dialog. I recommend something like this:

var dialog = new Window("dialog");
               dialog.text = "After Effects Dialog Script";

//Contents
        var newMsg = dialog.add("group", undefined, {name: "newMsg"});
               newMsg.orientation = "column";
        var newMsgText = newMsg.add("statictext", [0, 0, 400, 40], "", {name: "newMsgText", multiline: true});
               newMsgText.text = "Would you like to open a settings dialog?";
        
//Button UI        
        var buttonPanel = dialog.add("group", undefined, {name: "buttonPanel"});
                  buttonPanel.orientation = "row";
                  buttonPanel.alignChildren = ["center", "bottom"];
        var enter = buttonPanel.add("button", undefined, undefined, {name: "ok"}); 
                  enter.text = "Continue";
                  enter.value = true; 
        var cancel = buttonPanel.add("button", undefined, undefined, {name: "cancel"}); 
                  cancel.text = "Cancel";
                  cancel.value = false; 

//Runs the dialog code
dialog.show();

//Grabs answer to yes or no question
var dialogInput = dialog.show();        
        if(dialogInput == true){
            app.openDlg (prompt, filter, multiSelect);  //Essentially 
            }
            else {
                alert("The action was canceled.");
                            }

You will have to find the direct path to the CEP dialog you wish to open. I'm unfamiliar with them and their integrations to After Effects, so I can't help you much beyond getting the script set up. However I have a few comments on resources that may be of assistance here too.

That ScriptUI resource by Peter Kahrel is fantastic. I've been working with it for the last few weeks. I wanted to add on to what Jake L said by dropping in a few more great examples of Extendscript Support because you kinda have to dig for the documentation, but it's definitely there.

https://extendscript.docsforadobe.dev/

I just stumbled upon the Extendscript Library recently, but it details a lot of functions, dives deep into events and event handlers, and even explains how you can set up an environment for extendscript via vscode.

I also like to check out NTProductions on youtube for assistance. I'm working in Indesign, but a lot of the extendscript functions work between the various adobe programs and you can even troubleshoot basic functions in the Adobe ExtendScript Toolkit.

And if you already have an Adobe CC account, don't forget to download the Scripting SDK from adobe APIs and Services. You'll have to sign in to get there, but it's a pretty useful local documentation.

https://developer.adobe.com/console/servicesandapis/id#

EDIT (again): I also found these after posting and will commit to adding more as I find them. Extendscript documentation must become more available! :-)

https://docsforadobe.dev/

http://yearbook.github.io/esdocs/#/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文