Python Helps Disney Write a New Scriptby Ed Stephenson
Use of a Different Scripting Language Leads to a Groundbreaking Application
While digital motion pictures such as Dinosaur may have captured the public's imagination, much of the work from Walt Disney Feature Animation (known as "WDFA") continues a tradition that began with Snow White in 1937. Hundreds of artists still spend up to five years creating hundreds of thousands of hand-drawn images for full-length features. What has changed--and continues to evolve--is the computerized production process, and in that realm WDFA is breaking ground with Python in a bold new application.
WDFA is a heavy Perl shop, but some shortcomings with Perl led the software group to investigate other scripting alternatives for the company's new software project. Brent Burley, one of WDFA's senior development software engineers, not only found Python simple and consistent by comparison, but Python's object-oriented nature held a distinct advantage over Perl. "In the months since I first evaluated Python," he remarks, "I've had no stability problems and the language and API always seem to do what I expect."
Computers have been a part of Disney animation since Tron in 1982 and The Black Cauldron in 1985. Today, it's an extremely busy operation stocked with workstations running SGI IRIX, Sun Solaris, Linux, Windows NT, and Mac OS. "And we're constantly evaluating additional platforms," notes Burley. He and a staff of more than 80 engineers in WDFA's software group create 2-D and 3-D animation tools for use on multiple productions, as well as production-specific software for features such as Tarzan and the latest Disney offering, The Emperor's New Groove. A new feature, Atlantis, is scheduled for release in June 2001.
This past year, Burley and his team set out to build the next generation of WDFA's animation production system--an immense application to scan hand-drawn artwork, digitally ink the pencil lines, color the characters, animate the camera moves, add effects, and composite the final result. What they expect to accomplish, once the intricate project is finally completed, is an application with a suite of modules that they can tailor to WDFA's various production departments.
One of the central (and unusual) features Burley's team wanted from the outset for the new application was "scriptability." Scripting allows for rapid prototyping and, in some cases, rapid deployment of parts of the application, Burley says, as well as enabling the application to be dynamically configured and extended. Burley is a big Perl fan, but he wasn't sure Perl was right for this particular job.
"We've had stability problems with embedded Perl, and I haven't been able to integrate Perl and C++ GUIs as well as I wanted," he explains. "We build a lot of stuff with Xt/Motif and I wanted the ability to mix Perl/Tk and Motif in the same application. Python seemed to embed much more cleanly and it could also provide the GUI integration I wanted. The extending and embedding C API is very well documented and easy to use."
After spending some time with Python tutorials, Burley experimented with Python's embedding API and found the scripting language so compelling that he decided to seek permission to use it. Because Disney works with a fair amount of open source software, the company had recently streamlined the process for reviewing software licensing. So, Burley was able to start using Python and a handful of related packages immediately. (As it happened, other teams at WDFA had already been using Python due to the company's recent merger with Dream Quest Images.)
The Power of Scripting
Python turned out to be perfect for Burley's new production application. "We exposed a Python console window as one of the application components, and this was a big help for debugging. It will be very useful to our more technical users," he explains. "We also used the scripting feature to generate and run regression tests. The power of the scripting system also allows for application extensions and patches to be fielded to users easily and quickly, without having to make a new release of the software. In the heat of production, responsiveness to our users is critical."
Burley was also successful integrating C++ and Python code almost seamlessly. In addition to creating mock-ups and prototypes for various application modules with Python, his team experimented with hybrid modules that are part Python and part C++. Burley developed a messaging library that allows users first to define interfaces in a language-neutral way and then generate C++ base classes from the interfaces. The interface files, he adds, are read at run-time so the objects can be accessed from Python. "Unlike with SWIG (a popular tool for generating Python bindings from C++ headers), our library allows you to access Python objects from C++ just as easily as you can access C++ objects from Python," Burley says. "In fact, you can't tell from an object handle whether it's implemented in C++ or Python."
He's also optimistic that his crew can implement many service modules completely in Python, as long as they aren't performance critical. "I would hope that when we're done, our application will be groundbreaking in a number of respects," Burley comments. "It will certainly give our traditional animation departments a lot more capability than they currently have. And it will be a more open system, allowing the more technical people on each production to tailor the tools to their production's needs."
Part of the Toolbox
Altogether, Burley is happy with Python for many reasons, noting that it was so easy to pick up that the development team wasn't hindered by having to learn something new. Among the "wealth of additional modules" provided in the standard distribution of Python, Burley's team, so far, has used only Tkinter and PMW in their new production system. Outside of that project, Burley has begun to explore other uses for the language, including a mailwatcher program he wrote to monitor his mailbox--using the imaplib, rfc822, and Tkinter Python modules--that is only 75 lines in length.
If you have a Python success story you'd like us to know about, please contact Betsy Waliszewski, at O'Reilly & Associates.
As for Walt Disney Feature Animation's benchmark production system, this new application is beginning to garner attention because it's the first project done at WDFA where scripting is fundamental to the core of the application. Burley describes the architecture in a paper he will present (with a colleague) at the Ninth International Python Conference in Long Beach, California, March 5-8.
In the time since Burley began using Python, other teams at WDFA have started using the scripting language with favorable results. "Python will remain a key part of our toolbox," Burley remarks. "We will continue to use C++, Java, Perl, and a number of other languages, but Python certainly will have its place."
O'Reilly & Associates publishes a number Python books, including:
Python Standard Library (due out in April)
Visit python.oreilly.com for a complete list of O'Reilly's current Python books, as well as Python articles and news. And don't miss the O'Reilly Network's Python DevCenter Web site for more Python resources, articles, and development news.