• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
2

Cannot add controls in another function if window is pallete type

Community Beginner ,
Apr 19, 2024 Apr 19, 2024

Copy link to clipboard

Copied

Good day. I have found a problem where you cannot add controls in another function if you are using a pallete window type. Have a look at this example.

myButton.onClick = function () {
    var myWindow = new Window("dialog", "My Window");
    var myPanel = myWindow.add("panel", undefined, "Panel Title");
    myPanel.alignment = "fill";
    addButton(myPanel);
    myWindow.show();
}

function addButton(panel) {
    panel.add("button", undefined, "OK");
}

 This code will only work if the window is a `dialog` type. If it is a `palette` type, it won't work. With `palette` the window flickers for a milisecond and then goes away. This is a small example, but in practise this is quite a large hinderance to a project. It means you cannot reuse any UI building logic in multiple places. Is there any temporary solution to this issue?

Bug Investigating
TOPICS
Scripting

Views

153

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Pinned Reply

Adobe Employee , May 07, 2024 May 07, 2024

Thank you for the follow-up, @Francois36853938zmve, and for the workaround, @Airweb_AE. We are able to reproduce the issue as well, even in the legacy ExtendScript ToolKit on Windows separate from After Effects, and have now opened a ticket to investigate the root cause.

 

Thanks again,

- John, After Effects Engineering Team 

Status Investigating

Votes

Translate

Translate
5 Comments
Adobe Employee ,
Apr 22, 2024 Apr 22, 2024

Copy link to clipboard

Copied

Hi @Francois36853938zmve,

Thank you for reporting this issue. The code you've posted doesn't appear to run as written—would you be able to post an expanded snippet that reproduces the issue? 

 

It would also help us to know what the overall desired behavior is for your script panel. E.g. a button that opens another panel or dialog.

 

Have you been able to do what you've described in a previous version of After Effects? It would be helpful for us to know if this is a recent breakage.

 

Thanks again for reporting and for any additional information you can provide,

- John, After Effects Engineering Team 

Status Needs More Info

Votes

Translate

Translate

Report

Report
Engaged ,
Apr 22, 2024 Apr 22, 2024

Copy link to clipboard

Copied

I also noticed this bug.

It occurs when there isn't a click event in your code.

If you save and run this code in test.jsx, it works as expected.

However, if you generate the palette dynamically using a button, it doesn't work, you need to add a click event somewhere to fix it.

 

var palette = new Window("palette", "test", undefined, { resizeable: true })
var button = palette.add("button", undefined, "OK", { name: "button1" });
palette.show();

//palette.onClick = function(){}

 

 [ VIDEO ] 

Votes

Translate

Translate

Report

Report
Community Beginner ,
Apr 23, 2024 Apr 23, 2024

Copy link to clipboard

Copied

@Airweb_AE what console do you have open there in your video? How can I open it myself?

 

Votes

Translate

Translate

Report

Report
Community Beginner ,
Apr 23, 2024 Apr 23, 2024

Copy link to clipboard

Copied

I tested what @Airweb_AE  said and their trick works perfectly well. See the code below.

 

var parentWindow = new Window("palette", "Parent");
var parentPanel = parentWindow.add("panel", undefined, "Panel Title");
parentPanel.alignment = "fill";
var myButton = parentPanel.add("button", undefined, "Open UI");
myButton.onClick = function () {
    var childWindow = new Window("palette", "Child");
    var childPanel = childWindow.add("panel", undefined, "Panel Title");
    childPanel.alignment = "fill";
    addButton(childPanel);
    childWindow.show();
    // childWindow.onClick = function(){};
}
parentWindow.show();

function addButton(panel) {
    panel.add("button", undefined, "OK");
}

Votes

Translate

Translate

Report

Report
Adobe Employee ,
May 07, 2024 May 07, 2024

Copy link to clipboard

Copied

LATEST

Thank you for the follow-up, @Francois36853938zmve, and for the workaround, @Airweb_AE. We are able to reproduce the issue as well, even in the legacy ExtendScript ToolKit on Windows separate from After Effects, and have now opened a ticket to investigate the root cause.

 

Thanks again,

- John, After Effects Engineering Team 

Status Investigating

Votes

Translate

Translate

Report

Report