Thanks, Joojaa,
I definitely don't need it a lot, and kind of don't want to be using it right now, but I don't know of any other way to make certain things trigger. I would like to write custom nodes, but am not a full programmer, and don't know how to do that. I should probably bite the bullet and learn that, but there is another aspect to this, and that is that by keeping it 100% within the constructs provided by MEL, the file becomes a contained unit that cannot break because of missing MEL scripts or plugins. I can send this file to anyone with this version of Maya all by itself, and it just works. With employee turnaround, too, it becomes a pain to manage what goes with what, as the people who know that a particular set of scripts helps a particular set of files leave, and no one else knows how things work anymore.
I definitely tried to find a direct-connection way to go about the couple of things I've wanted done in recent months, but couldn't solve one. For most things, the functionality doesn't need to be contained, and so I write separate tools and utilities that exist outside and work for all, but once in awhile I just want something to go with a particular file to solve one small issue where I can find no other solid alternative that doesn't require extra things in addition to the file.
All that said, I came to the same conclusion you did. I wrote a scriptNode that finds scriptNodes with a UID and modifies their scripts to know their own namespace. I realized last night that expressions don't need this, and actually, telling an expression what it's namespace was, and having it prepend it to object names caused it to fail. I would get an error message that some namespace:object did not exist, and could actually copy that name from the error message, paste it in the command line with "select" before it, and it would select the object, so clearly it did exist. I guess under the hood the expression knows what namespace it's in and secretly prepends any object names called out in the expression with that namespace, because a simple test with an expression that told locator1 to move to x=2 worked when referenced in with a namespace. ScriptNodes don't appear to understand this, though.
My usual use of scriptNodes that create scriptJobs is to occasionally add a dropdown channel for an object that allows choosing from a string list, which then fires off the scriptJob watcher (on attribute change, -ac) to do something and reset the value to the first item ('select', 'choose', etc). I've been using this here and there in game production environments for about 6 years now and it's never failed, so I'm pretty confident about it now. Most of the time I would not seek a scriptNode->scriptJob solution, however. It's just nice to have it in the bag of tricks.
I have put:
string $ns = "";
as the first line of any scriptNodes I want to have know their own namespace internally. A separate scriptNode loops through scriptNodes looking for that as a first line and changes any to read:
string $ns = "namespace:";
where "namespace" is the actual namespace name of that scriptNode. Then from inside the scriptNode, I can prepend $ns to anything. It worked well in my tests. Again, not an all-the-time solution, but a solid little trick for that occasional need. Oh, and I surround the scripts in those scriptNodes with { and } to keep the $ns variable contained to them. I'm not sure if scriptNodes are self-contained anyway, but it didn't hurt to stick those in there.
I'll add that you said there's never really any sane need - I agree! Well, I could kind of argue one thing I did was sort of sane, but you could just as easily argue against it. For me it's a cute little extra, like being able to select a character's main position node, having a "character" channel with the text "select" in the box, and being able to drop down a list of characters, choosing one, and having it flip back to "select" as well as swapping out the reference for the selected character. It's not needed - they could be kept separate, anims could be transferred, a separate tool could do this work - but the animators all loved it (not that exactly, but I've done a few similar tricks with it), and 9 months of daily use and abuse of 60+ characters with the ability never broke it, so in the end, it does seem pretty robust.
You also said the direct connection thing would be nice - also agree. I'd rather have scriptNodes work like expressions, where they know the namespace they're in and presume any objects called out in their scripts are for objects in that namespace. That would be much preferrable to what I did to solve this.
Thanks again![url]../../../users/joojaa/forums[/url]