Closed fredrikaverpil closed 11 years ago
There is a problem with this change. I am not exactly sure if it's really a "problem" but rather that it changes the previous behavior of the plugin...
Before this change, when you make changes to variables, they are being made in the main of Maya. That is, if you send foo = 'bar'
, then Maya's main retains that variable and value.
With this change applied, because you are making a copy of the __dict__
and passing that to exec, while it works fine for you to send your custom __file__
value, it is now using a temporary environment. I would be hesitant to introduce a patch that suddenly changes this behavior on those users that may be expecting their code to be able to modify the Maya python environment.
It might be a feature that would have to be introduced with a configuration option to enable it, or providing alternative command mappings?
I think an option to enable it would be good. Or any other way that you see fit to make __file__
callable from the script.
I cherry picked some of the code and used a modified version of yours for passing the file It seems like a good balance by not modifying the main namespace of Maya, while still providing a persistant namespace for each successful sending of code from Sublime to Maya.
That's great news. I no longer need to fork this project :) Update: I just tested the feature out and it works perfectly!
It would be awesome if you wanted to pull these amendments to your code.
Cheers!