I'd like to write a MEL script that runs whenever any Maya file is opened and warns the user if that file is read-only.
I know how to do most of this, but I'm uncertain of the correct way to run the script when any file is opened. I found documentation of a scriptNode that you can attach to a file to run a script on file opening, but I'm not sure that's the right thing.
I'd much rather have it so that the users don't need to attach a separate scriptNode to every new file they create--is there a way to automate this process? Or, barring that, is there something I can add to my config files somewhere that will have the same effect.
Our art team has their assets in source control and I want to make this whole thing transparent for them.
I don't want to make every artist run a script that creates a scriptnode every time they make a file, if I can help it--that seems sort of ugly and puts the responsibility of making their files version-safe on them.
see what I mean?
Is there any way to automatically attach a scriptNode?
If this is Maya 6 you could make a template that has the scriptnode and add it to the new file menu command. There is probably another way to do this as well.
We are using Perforce as of today. We just made the switch which is why it comes up now ^_-.
I'd love any advice anyone could give (especially as to how to integrate Maya and Perforce specifically)!
At the moment you get an error when you try to check a write-protected file in; but that leaves open the possibility that an artist can check out a file, edit it for x hours, and then not be able to save it.
I had a similar problem at one point in time. Since the sciptnode I needed was associated with some of our shader setup tools, I made those tools add the node to the sceene if it didn't exist. That way in normal workflow, it ends of in the scene before it ends up in source controls.
If this isn't an option, one of two things. 1) If your team shares a userSetup.mel, you could set up something there. 2) Dig up the bit of MEL that creates a new scene, and add the node create there. 3) Actually, that last thing made me think of a third thing. Dig up the MEL code associated with a file open and add a check there.
We actually do share a userSetup.mel--But I'm not sure what you can do there. Every time anyone starts Maya, it runs a bunch of custom scripts automatically, but unfortunately it's just on startup, so I'm not sure how to make it trigger something every time a file opens. I betcha there is a clever thing you can do with userSetup.mel but I can't quite think of it.
Your idea about tacking a scriptNode creation onto one of the often-used scripts is clever and tempting , but a little dangerous because there is a slight posibility that they could check in a file without ever running a custom script.
I really liike the thought that I could alter a maya MEL script somewhere to assure that a new scriptNode would be created on file opening-but I'm not sure which file this would be. I've been staring at the script editor with "Echo all Commands" on to see if I can find something that runs consistantly and haven't found any good options so far .
I know that you can alter the base AEtemplates for things...but which one of those is the one I'm looking for? I'm off to work in 5 minutes for more digging into this.