oglop
July 6, 2016, 2:15pm
1
I want to sync some data between several concurrently running maya 2015 sessions.
maya session A:
optionVar -iv xxx 23;
savePrefs;
maya session B:
optionVar -q xxx;
// Result: 0 //
optionVar -ex xxx;
// Result: 0 //
maya session B doesn’t see optionvar “xxx” unless I restart maya session B after “xxx” is created in maya session A, after that if I run
optionVar -iv xxx 24
in maya session A, maya session B still thinks xxx=23, is it expected behaviour? Or I did something wrong.
That is indeed the correct behavior. Optionvars weren’t meant for interprocess communication. You can think of them in the same way as Windows environment variables. If one application or script changes environment variables, they aren’t changed for all the other running processes, just for the scope of the single process.
probably want to use a file to track the data or open the command ports on each maya on a different port and communicate that way
If you want to add Python.NET to your Maya setup, you can use a FileSystemWatcher to make file based information exchange a bit easier.
http://www.ironpython.info/index.php?title=Watching_the_FileSystem
EDIT: This assumes you are on Windows. On Linux, consider GitHub - seb-m/pyinotify: Monitoring filesystems events with inotify on Linux.