I'm currently attempting to get an external Python Object (which was
developed for Maya and Nuke) to play nice with Softimage without being
forced to hack it to death. That Object builds an array of menus and
commands to run from its own template system. For each item in the array,
it adds a menu element in Maya or Nuke.

The conflict I'm finding is, for both Maya and Nuke their methods for
adding a Menu command allow you to input a label and pointer to a function.
In this case, the Python Object instance sets its callback property to the
current function it's reading from the template:

#Maya Example -----------------------------------------------
params = {
            "label": "myMenuLabel",
            "command": Callback(self.callback),
            "parent": menu,
            "enable": enabled
}

pymel.menuItem(**params)


In Softimage, the two methods I have for linking a Menu item to a function
are: Menu.AddCommandItem()  and  Menu.AddCallbackItem().

AddCommandItem() doesn't really apply here, since I don't intend to
dynamically add each function from the template as a custom Command.

Meanwhile, AddCallbackItem wants me to input the name of my function as a
string. I've worked up a hacky solution for the time being, since I can
pull label strings from the Menu item selected, and then use those label
strings to link them back to their callback functions. However, I can't be
assured the label strings will always be unique as the library of commands
builds up in the external template.

If I could override the string input for the second argument
of Menu.AddCallbackItem(), and simply give it the pointer to its intended
callback function, all would be well.

Has anyone else worked around this issue with success?


-Bradley

Reply via email to