hi, i want an attribute of my obj to be incremented in real time (even when timeslider is not running). is there a way?
with time nodes it only works when play is pressed
is there a way to create a realtime node that will always increment in real time no matter what.
You can do that by hooking a scriptJob to an idleEvent. But that’s not pure realtime, it will only increment when Maya is not otherwise running a script or being driven by a user.
The main Maya scene is not multithreaded so there’s no easy way to scene changes on a predictable time schedule. Idle events are pretty quick when nothing else is going on, but they won’t fire during a long operation or when the user is doing something like moving the view around.
I don’t think idle events fire during playback either.
i really want to create a separate node. instead of scriptJob. because i want to change a value of obj based on real time (just when doing nothing that value will increase).
If i use script to run to attribute. then i can not undo for other obj. that is my problem
You could try to run a separate thread to update your node but it willl likely be a nightmare of hard yo fix bugs — cross thread problems in maya typically corrupt error reporting.
You can try to adapt this old sample but tbh don’t recommend getting your hopes up… this is pushing maya in a direction it really does not not want to go. It’s designed around a linear understanding of time
it seems too much for my current level, i will consider it. thank you very much