[QUOTE=sl4ppy;3313]Is Maya really the driving force behind Python’s emergence?[/QUOTE]
I think Python’s been around the film industry for a while, thanks to things like unix and irix. I haven’t really found Forms or WPF to be any more or less taxing to learn or use than wx or QT as far as just getting up and running, so i’d say it just goes to what your environment supports. In Maya you do at least need python or c++ to act as your caller for .NET since MEL isn’t…anything external friendly, hehe:curses:
[QUOTE=sl4ppy;3313]I’m curious why people use Python over C# especially in the case of tools that require any sort of UI. Technically they are both managed languages, but in my experience, C# has generally fit the job at hand a little easier and quicker than Python has.[/QUOTE]
I spend my time split between C#, Python, and MXS. The latter I avoid whenever I can. As far as C# and Python, I like coding in Python better because it is much more interactive. I can iterate and test code faster. I can also easier debug on other people’s machines, and make quick changes without a compile (inconvenient because another app or tool is commonly using the dll). On the other hand, I use C# and .NET for components that will need to be called from a variety of sources.
So for example, the core of our pipeline is all built in C#. A common pipeline is to use MXS to get things out of Max and pipe it into a Python script (via sys.argv/commandline). That script then uses the .NET classes (via Python.NET) to interact with the pipeline. So individual tools tend to be written in scripting languages, while the core is written in C#. I’ve been very happy with this workflow.
For example, material generator workflow goes like- MAXScript to collect material info, pass it all to a Python script, the Python script makes the AssetManager.AssetData, which tells it where to put the material file, and also other data specific for that asset that has been entered into the AssetManager Asset Database.
After reading this thread and several aborted attempts to learn python I’m going to bite the bullet and start to makea concerted effort to use it where possible.
As for getting my team to use it without complaining or getting confused, thats another matter. Probably some python magic I am about to learn will be able to ensure they have all required gubbins installed before anything has a chance to go wrong!
More and more the key reason why I am porting all old MEL code to Python and always writing everything new in Python is one invaluable point: realtime debug.
It is such a pain to try to debug large mel code, especially somebody elses. I usually just convert it to Python and then I can do real-time debugging via WingIDE and get to the bottom of the problems in a tenth of the time.
This fact alone makes MEL virtually obsolete for anything but <100 lines of code.
Here’s a few things we’ve done with Python in the past couple years.
[ul]
[li]Measure start/stop times of various processes, logging data to SQL database. For instance, how long it takes 3ds Max to start up, so we can spot bad trends when new tools are published.[/li][li]System for logging errors and tools usage data to central database, with optional emailing of errors/callstack. Works for Python tools as well as MaxScript (via COM).[/li][li]A non-linear GUI editor for an otherwise complex/table-driven cutscene pipeline[/li][li]Build graphical user interfaces (generally with wxPython) that integrate with in-house and off-the-shelf C applications. For example, floating Python dialogs that link to app windows as children, or as docking task panes.[/li][li]Tool that communicates with game C code (via socket) running on consoles to do in-game realtime lighting.[/li][li]Embed Python interpreter into editor framework for next-gen development tools. This is the one I spend lots of time on these days… works like MaxScript in Max, but for our custom editors.[/li][li]One Exporter that writes out various data files from 3ds Max, Photoshop, and imports/categorizes them in our asset system.[/li][li]Logs me into Outlook’s webmail without manually entering my creds every time. I guess that was a home project. :)[/li][li]At Max startup, scan folders for MaxScripts, building a MacroScript .mcr file for all of them[/li][li]At Max startup, builds list of texture map folders for a given project, sorts them by user’s discipline and adds them to Max’s bitmap paths list[/li][li]Profile rendering performance of art assets recently submitted to Perforce, recording data to SQL database[/li][li]Searches web-based bug tracker database for entries assigned to you and displays data in a Vista Sidebar gadget[/li][li]Creates makefiles with dependency info, for distributed build processes in Incredibuild/XGE[/li][li]Wavelet transform calculations for content-based image comparison tools. For finding textures that are too similar, or comparing rendered output of one shader vs. another.[/li][li]Takes zipcode or lat/long as input, gathers geo-survey data from various online sources and creates the road/terrain network inside our world editor[/li][li]Tons of data mining uses. Like searching various exported XML files for instances of X material, mesh, etc. in game world[/li][li]Tool for bridging various apps with COM interfaces in other tools. Like firing MaxScripts in Max from Ultraedit, or taking current Python script in WIng and running it in our editor’s embedded interpreter.[/li][li]Custom scripts for integrating our tools/processes into Wing (the Python IDE we use).[/li][/ul]Why Python? I find that Python is just a great fit for my TA brain. It fits my natural workflow and development process at various stages. I can quickly crank something out as a test or one-off, or spend more time to dig into its deeper functionality.
It’s easy to read. I really value that. Usually reads a lot like pseudocode, I think.
Apologies for the self-reply but I have a few questions about your list, Adam…
“Profile rendering performance of art assets recently submitted to Perforce, recording data to SQL database”
Are you measuring the rendering performance in MAX or in game (on a dev kit or whatever).
“Wavelet transform calculations for content-based image comparison tools. For finding textures that are too similar, or comparing rendered output of one shader vs. another.”
How is the returned data from a tool like this used? Do users actually get feedback saying “Your texture is too much like this other texture created a month ago”, etc ??
In-game, using controlled test environments. At least I think so, this was done on a different project.
It’s still being hooked into production tools, but that was one idea, yeah. Although I pictured it being more of a friendly heads-up than a method fo stopping the user from submitting the new one.
Another use would be to show a list of similar texture thumbnails whenever a texture is selected in our browser, in case one of those better suit your need.
There is no doubt about growing use of python in vfx/animation/games industry,
Now, what do I do with Python?
I would give example of a Pipeline I wrote using Python/MEL,
In very basic flow it goes like this,
Read masterconfig.xml to populate python dictionary
Read Excel file to get fileids to be processed(this is excel which comes from producers/artists)
Sync to Perforce(using P4Python) to get/update appropriate assets
Create temporary working directories
Invoke Maya as separate thread, with a MEL script as command
This MEL script does nothing but open Maya’s commandPort
Interface with Maya using sockets and send MEL commands
Quit Maya and start image processing(we use in-house libraries for image processing)
Add/Update result files to Perforce
Cleanup temp files and paths
Send mail to stakeholders regarding success/failure report
GUI in wxPython
Perforce interaction using p4python
Excel interaction using win32com
Finally this pipeline was put in system scheduler so no need for Artists/Producers to fill in Excel. Pipeline will get the latest assets files based on changelists submitted by artists and starts processing
Python / C#
For game tools programming, C# also a great choice, can’t comment on how/why, because haven’t used it as much as python.