Media Manager Xtra
An Xtra for synchronizing cast members and external files
There will be no more updates of this Xtra, as I have switched from Director to C#.
Director media assemblies – castLib files, and the castLib part of movie files – can be a good way to deliver media to end users. But while developing, the concept is not very good.
· Castlibs and movies are very inefficient when used with source control software (CVS, SourceSafe etc). You miss most of the benefits of such systems, and it makes Director very hard to use in multi-programmer teams
· Castlibs are often stored with great unnecessary overhead. Save and compact a file, and it’s 1000 kB. Make one little change in one member – and suddenly the file is 2000 kB.
· It can be hard to keep track of if your media is up to date. Since Director’s modifiedDate functionality is broken, it’s hard to tell if a certain member is imported from the latest source version. E.g. has the artist’s latest background bitmap been imported or not?
· If internal editors are used to edit media that comes from external files, it can be hard to tell which is the original. If the artist needs to rework a bitmap, can he edit the original file? Or will you have to paste the member’s bitmap into Photoshop, save it, tell him to go ahead, and finally be notified by him to reimport the file?
· An extensive undo system is probably hard to create when having only media assemblies for storage. With individual files, however, a simple backup copy of the file can automatically be made for each detected change. The user can decide keeping any number of backups for each file.
· Director can corrupt its own media. Cast members can crash Director, symbol tables can become incorrect, and castLibs impossible to open. A wrecked castLib or movie can steal many many hours of precious development time.
· Your “common” castlibs, that you use in all of your projects, cannot easily reside in another folder than your movies, as it creates problems both in authoring time (> 1 persons developing simultaneously) and in runtime (the Projector can spend lots of time trying to find the castlib on the network, even though it lies right beside it). Often, you’ll have to copy the file back and forth between the “common” folder and your project folder instead, which is horrible for version control.
· Working over low-bandwidth networks is difficult, e.g. when using VPN over the internet. You only want to send/receive changes, not whole castlibs – and as a programmer often only the code. Handling this manually takes time and is error-prone.
· Batching / searching the media and scripts for a whole project where members are organized in several casts and movies is difficult. You have to do the work in several passes, one for each movie. E.g. when I’ve decided to change a handler or script name in Endogine, I have to open each movie that I think uses it, and search/replace it. This will create bugs.
All of the above is made easier if you always use external files as the originals during development. Director has very limited support for this: “Link to External File”. Some of the flaws are:
· it won’t allow you to use the Paint window for bitmaps
· text members cannot be linked at all
· external scripts (and other member types) can be overwritten even when they haven’t changed. Problematic with source control software, and when working with other developers.
· when the final CD-ROM or Shockwave is built, you’ll probably want the media to reside in castLibs. You have to write code to import the linked media, and also go on another testing round the ensure that the new, internal media work the same as the linked media did before.
To resolve these problems, I’ve developed the Media Manager Xtra. It is a MIAW-based Xtra that synchronizes your castLib media with external files.
When you modify, delete or add an external file, the Xtra will ask you if you want the corresponding member updated.
When you modify, delete, add or move a member, it will make the corresponding changes to the external file. Backups are stored automatically.
For delivery of the final product to end users, on CD-ROM or Shockwave, you just take your castlibs and go. There are no references to the external files in the project (unless you specifically added them for some reason) so everything will work just the same as in authoring.
(Super-cool feature to come later: The loathed Ctrl-D command – member duplicate – can also be detected and eliminated quite easily)
This is also another step to facilitate my (and others’) transition from Director to other IDEs. Together with my .NET-like classes, my coding and workflow becomes more and more like what I’ve learned to appreciate in Visual Studio. After porting the Endogine sprite system and tools to C#, I’ll have a very powerful, robust, yet simple environment for multimedia and game development.
For each member, the Xtra uses two corresponding data files, one with the media (.bmp, .wav etc) and one with the "resource fork": member settings (regpoint, member name/number etc).
The Xtra loops through the currently selected member(s) several times per second, comparing all their simple (ie not #image or #media etc) properties with cached data. If any change is detected, the cached data is updated and saved to the resource fork file (with optional backup of the old file).
A bit less often (because it’s slower), the “rich data” properties are compared with the files on disk. This is done by saving the media to a temporary file, and doing a file compare with the members current external file. If the temporary file isn’t the same as the current file, the current file is moved to a backup folder, and the temporary file is renamed to be the new current file.
Scanning the external file system for changes is slower than I hoped, so for now it has to be started manually. Later, I could implement a low-priority asynchronous scanning system, which doesn’t interfere with the user.
External file names will be the same as the member names. I’ve chosen this because it makes the connection between member and file very obvious, and you don’t have to check lookup tables to find out what a certain file contains.
On the other hand, it imposes new restrictions on Director cast member naming. They MUST have unique, file-system-valid names.
The Xtra automatically renames unnamed or duplicates by adding a “_RN_” prefix, so you can easily identify them.
Moment of save
Whenever a change is made in a member, MMX will write the new data to disk. Director doesn’t save to disk until told explicitly. So, if you leave a movie without saving, the external files and the members will be out of sync.
I will fix this later by using a Temp folder for external media, which is copied to the actual folder only when the Director movie/casts are saved.
There could well be situations where my cast member changes detection misses something. It could be that I miss checking certain member properties, or that my code misinterprets what has happened when cast members are moved/copied/duplicated. Please report these incidents!
Backup after editing external files
Currently, the backup will be a copy of the edited file, not a backup of the member as it should be. Backups after editing the member works like it should.
From the 2005-02-06 Alpha version, the Xtra is theoretically good for real-world use. I’ll start using it in a project together with SourceSafe the next week and see what needs to be done in order to make the workflow as smooth as possible.
Note that the Xtra currently doesn’t affect the casts and members, except for renaming members with unacceptable filesystem names (empty strings, duplicate names, chars like */?\ etc) so it should be safe to try it out.
2005-02-07 Fixed bug: Member types that I haven’t specified, like #Vector and #Shockwave3D, didn’t write their generic .dat file to disk (vList save of member.media). This messed up media checking and file management.
2005-02-07 Fixed bug: When opening an already exported movie with >2 castLibs, some members weren’t found
2005-02-07 Fixed bug: MIAW bg color uses the stage’s bg color instead of white
2005-02-07 Fixed bug: Members with dots in their names (eg “IO.FileInfo”) get truncated filenames
2005-02-06 Alpha version. Checking if a member has been modified seems to work OK now. Automatic backups of the external media file and resource file is made each time a change is detected. Scanning of external folders for new/deleted/modified files added.
2005-02-05 Project settings file added. Default external folders moved to subfolder “Media”.
2005-02-04 First test version
2005-02-01 Began coding
2005-01-31 System design
Walkthrough for testing
· Unpack the zip into a subfolder in your Director Xtras folder. Drop gscmp.exe there too.
· Start Director and open a movie
· NOTE!!! When the Xtra starts, it will rename members with names that can’t be used as file names (see Quirks / Member names above)
· Start the Xtra (on the Xtras menu)
· Click the “Add to proj” button. This sets up a project file, “_Project.txt”, and exports all member info to the subfolder “Media”.
· Move a member and verify that the system has noted it (look at the MediaManager window)
· Change a member name, and verify that the external file is renamed as well (by looking in the folder)
· Make a change in a member (e.g. edit a bitmap) and verify that a backup folder has been created, containing the old .png, and that the updated file has the correct image.
· Edit an external media file (e.g. a .RTF file), click the “Imp. Files” button and verify that the member has been updated
· Moving a member between castLibs isn’t handled correctly (.inf file is not updated, files are not moved)
· Movies with >1 internal castLibs will not be handled correctly.
· Cannot forget() the MIAW – even if closed, it’s still running in the background. Problematic when trying to open it again without restarting Director.
Report other bugs to
FileXtra4 Xtra (free) for creating folders, renaming files etc
Download at http://kblab.net/xtras/FileXtra4/
SharpExport Xtra (free) for exporting bitmaps
AudioXtra Xtra (commercial, demo version works) for exporting sounds
Download at http://xtras.tabuleiro.com/download/audio.htm
gscmp.exe (free) command line tool for comparing files
Download at http://www.goldsealstudios.com/downloads.html
Put it in the same Xtras folder as you put the Media Manager files.