Skip to main content
Known Participant
June 11, 2024

Dropdown Menu Control's name resets to the default state when updating via setPropertyParameters

  • June 11, 2024
  • 3 replies
  • 583 views

 

Steps to Reproduce the Bug:

 

  1. Create a composition and add a single layer.
  2. Add a Dropdown Menu Control effect to the layer and then rename it.
  3. With the 'Menu' sub property of the Dropdown Menu Control effect selected, run a script to update the menu item names using setPropertyParameters.

var dropdownMenuProperty = app.project.activeItem.selectedProperties[1];
var updateNames = ["New Item 1", "New Item 2"];
dropdownMenuProperty.setPropertyParameters(updateNames);


What should have happened?

The script should update the menu items without altering the parent effect's name.  The variable dropdownMenuProperty should still reference the menu property.

 

What actually happens?

Although the menu item names are updated successfully, the Dropdown Menu Control's name is reset to 'Dropdown Menu Control' and the variable referencing the menu sub property is now undefined. A varient of the following error is also thrown:

Exception has occurred: 1
After Effects error: internal verification failure, sorry! {stream at index matchName="Pseudo/@@WcEwVpTvQECXy+gYJaDFAQ" (mismatch with resultP, expected "Pseudo/@@XtRSXGOWT06/y1ORDv7nJw")}

 

Additional Information:

Apple M1 Max
After Effects version: 24.4.1
Operating System: Ventura 13.3.1 (a)

3 replies

Ilya217794162hc3
Participating Frequently
August 13, 2024

I would like to know the opinion of experts or developers. I also can't create a drop-down list with a normal matchName. all I get is a pseudo effect. there are also problems with resetting the effect name.
my diagnostic code:

(function() {
    // Begin an undo group for the operation
    app.beginUndoGroup("Add Dropdown Menu Control");
    
    // Get the currently active item in the project
    var activeItem = app.project.activeItem;
    
    // Check if the active item is a composition
    if (activeItem && activeItem instanceof CompItem) {
        // Get the first selected layer in the composition
        var layer = activeItem.selectedLayers[0];
        
        if (layer) {
            // Attempt to execute the command to add a Dropdown Menu Control
            app.executeCommand(app.findMenuCommandId("Dropdown Menu Control"));
            
            // Check if any effects were added to the layer
            var effects = layer.property("ADBE Effect Parade");
            if (effects.numProperties > 0) {
                // Get the last added effect
                var lastEffect = effects.property(effects.numProperties);
                $.writeln("Created effect: " + lastEffect.name + " (matchName: " + lastEffect.matchName + ")");
            } else {
                $.writeln("No effect was added");
            }
        } else {
            alert("Please select a layer");
        }
    } else {
        alert("Open a composition and select a layer");
    }
    
    // End the undo group
    app.endUndoGroup();
})();
AM-SAuthor
Known Participant
August 8, 2024

Hi Gustavo, thanks for your suggestion. I couldn't get it working for me though. Unless I put the

setPropertyParameters call in a try catch block I get the same internal verification failure. With the try catch block I get a little bit further down the line but then hit: 

 

TypeError: undefined is not an object

 

which I am guessing is because myMenuItems is undefined even though it's supposedly been assigned by the output of the setPropertyParameters call. Perhaps there is something in your implementation I am missing?

My solution, which was far more convoluted, was for the script to make a note of the hierachy of indexes from the comp to the dropdown property, then run setPropertyParameters inside a try catch block, then assign the dropdown property to a new variable by navigating up from the comp level using the previously logged indexes...!  Slightly ridiculous, but it worked - the menu items were updated and the name could be changed.

Participant
July 31, 2024

Hi AM-S! it happened to me too, I don't why it does that
I solved putting the setPropertyParameters into a variable and then go up one level with propertyGroup and set the new name
so in your case will be something like this 

var myMenuItems = dropdownMenuProperty.setPropertyParameters(updateNames);
myMenuItems.propertyGroup(1).name = "New dropdown menu name"

 Hope it works for you