project_68
project_68

Reputation: 3

Maya MEL trouble with popupMenu

Maya2023 MEL: ive used popupMenu command many times before without a problem, but this time I keep getting an error message that the popupMenu's parent menuItem cannot be found (although the first one is in fact present and accounted for after the script errors out of evaluation, although sans popupMenu or the associated scriptJob)

global proc csb_pT_addEnvToMenu(string $envName, string $parent)
{
    //install to environments menuItems if exists
    string $parentMenuItem[]={"csb_pT_Env_mi","csb_pT_Env_DT_mi"};
    for($pm in $parentMenuItem)
    {
        if(`menuItem -q -ex $pm`)
        {
            string $mi=`menuItem
            -p $pm
            -l ($envName)
            -c ("csb_pT_setEnvironment(\""+$parent+"\");")`;

            if($envName!="WORLD")
            {
                string $pop=`popupMenu
                    -p $mi // this line triggers error:"Error:file:path/script.mel //line 160: popupMenu: Object 'MayaWindow|menu16|menuItem185|csb_pT_Env_mi|menuItem1667' not found."
                    -b 3`;
                    menuItem
                        -p $pop
                        -l "Rename"
                        -c("csb_pT_renameEnv(\""+$parent+"\");");
            }
            //attach script Job to remove menuItem when envParent is deleted
            scriptJob -nd $parent ("deleteUI \""+$mi+"\";");

        }

    }

}

this one is stumping me for some reason. I've verifide the names of the parent menuItems, Ive tried removing the if() between the menuItem creation and the popupMenu, but that has no effect. ive also tried a refresh; between the menuItem and popupMenu, also without effect. any suggestions would be greatly appreciated! many Thx.

Upvotes: 0

Views: 58

Answers (1)

project_68
project_68

Reputation: 3

OK, apparently popupMenus only work with non menuItem objects, dissapointing, but this is Maya afterall.

Upvotes: 0

Related Questions