Hi,
is there a way to pass a string from the menu item to the callback handler function. For dynamically created menu items I'd like to attach some information (directory path) that is passed from the menu item to the callback function. I've tried to abose the help string for this but for some reason I can't set .Help for submenu or callback items.
The only thing I've managed so far is to have a dictionary mapping based on the menu item lablel and having the callback function lookup from that based on in_ctxt.Source.Name in the callback function.
Thank you,
Fabian
AddCallbackItem menu item, how to pass a variable
Re: AddCallbackItem menu item, how to pass a variable
Hi
would be the only idea I have too, some dictionary or JS object that you could put in in_ctxt.UserData.
-rr
would be the only idea I have too, some dictionary or JS object that you could put in in_ctxt.UserData.
-rr
softimage resources section updated Jan 5th 2024
Re: AddCallbackItem menu item, how to pass a variable
I don't remember how to do this, but another method is to generate the code of the callback on the fly.
It's something like you use "exec()" to generate the new function.
You would generate it a unique name, like "def my_callback_01():" and what it does is calls a common method you have with the parameter you need for it.
It's something like you use "exec()" to generate the new function.
You would generate it a unique name, like "def my_callback_01():" and what it does is calls a common method you have with the parameter you need for it.
Who is online
Users browsing this forum: No registered users and 51 guests