Heyo good people!
So here’s a hypothetical.
Maybe, a studio has hundreds of tools, none of which has telemetry.
Maybe, those tools live as menu items, but might have been copied by artists to custom shelves, etc.
And maybe, the studio is moving to a new environment, and is deciding on priority of porting the tools, and could use telemetry at least for which tools are opened the most, so that they can prioritize with at least some information, without relying on asking hundreds of artists directly.
So maybe, I’m looking for a way to force telemetry on any tool that’s opened, without touching that tool’s script.
I have a simple function that i would run to gather the telemetry, but am struggling with finding the most effective and efficient way.
I can scrub all the menu items and the scripts they run, store in a dict.
Then, i would like to check what command has been run, and if it fits one of the ones in the scrubbed dict, then run my own function to register telemetry. The part I’m struggling with, is finding out when a command has been run (or potentially when a UI has been created).
I have come up with a couple of potential solutions, none of which make me particularly happy (in no particular order. also, including things that i consider dumb, but for the sake of completion…):
#1 - callback on idle event (ew?)
Never done this one, for obvious reasons, so not sure what the overhead would be, but me scared. This would work though, but… ewwww?
#2 - OpenMaya.MCommandMessage - doesn’t seem to work.
This doesn’t seem to run if a command doesn’t print anything into the Script Editor. When creating a tool from a menuItem, the command is not printed out, so the callback i register won’t run. Am i doing something wrong here? Or - is there a way to force a command being thrown into the Script Editor, for thie callback to work, when run from a menu item?
#3 - event listener for the whole maya, checking for clicks and what they produce.
Similarly to #1, i consider this to be a ‘not worth implementing’ because of so many things potentially wrong with this…
Bit more information:
Systems: Windows 10
Maya: Maya 2019 to 2022.5
Tools framework: mostly Qt, but cannot guarantee there isn’t any cmds. tools…
Is there anything that anyone could potentially recommend? I would be grateful for any advice on this.
Let me know if there’s not enough information.
Thank you!