If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

GoZ Maya script cosmetic cleanup (Z4.0 - Windows)

Pixologic's GoZ mel scripts are functional but could use some cosmetic touch-ups.

I made the adjustments listed below soon after ZBrush4 was released, but I have not posted them until now because:
- If GoZ is not working for you, these scripts will not help.
- The core functionality and interoperability with ZBrush and Maya remain unchanged.
- Most likely 99.9% of the Maya users will not notice any change.
- The fixes will only impact Maya users who write a lot of code. My guess is that type of user would have made similar fixes or have written an outright replacement themselves.
- I am in no way affiliated with Pixologic, so I don't want to break something for someone else.

The scripts are direct replacements to the Pixologic scripts, so back up the current ones before you replace them. Do not overwrite the original scripts. If anything breaks, remove my scripts and restore the Pixologic versions.

Refer to the GoZ manual installation post if you do not know where to place the scripts. Better yet, if you don't know where these scripts were before this post, you might want to leave everything as is.

List of changes:
- Placed all variables inside global procs. Maya treats any variable created outside a proc as a global variable. This can cause type casting errors later which are very hard to track.

- If the variable noted above was called elsewhere in the code, and it did not make sense to place everything in a single proc, then the variable was graduated to an explicitly called global variable. The new global variable was pre-pended with "GoZ". All calls to the old variable were updated to the new name.

- Pre-pended or post-pended "GoZ" to any proc names that did not have "GoZ" in the name. Generically named procs can override other generically named procs. The simplest solution is to glom "GoZ" to the beginning or end of all the procs.

Example:
old-
[CODE]global proc displayAttrs( string $text ) [/CODE]

new-
[CODE]global proc displayAttrsGoZ( string $text )[/CODE]

- Any immediately executed code, my term for code not inside a proc, has been placed inside a proc and has a callback. Similar to the first line item above, this is a safer method. This may look like code bloat, but the intent was cosmetic tweaks, so I tried to leave the code block as intact as possible by wrapping it in a proc.

- Removed the helper window. Not sure what the window was supposed to do, the labeling says event receiver, but everything seems to work without it so far. Anyone know?

- One caveat is that if Maya is not up when you hit "GoZ" in ZBrush, then the model will not load. Technically it did, but Maya does a "file -f -new;" after it sources all the startup scripts, so you lose the imported geo. Its been a while, so I don't remember if it was that way before I made the fixes. Maybe this is what the window above was supposed to do? The workaround is to launch Maya before you hit "GoZ", or hit the button in ZBrush again.

- I do not have a Mac, so I cannot test the scripts on a Mac. That's why I am calling them Windows only. Mel is very portable, but there are hard-coded Windows paths in the scripts. If you have a Mac, then update the paths for a Mac and it should work.

- I think that's about it, but I made the changes a while ago and am just getting around to posting them. Remember to backup the original Pixologic mel scripts before you try mine.