Beruflich Dokumente
Kultur Dokumente
Purpose
I/O facilities currently provided in Max are proprietary and limiting. Max' file format is a hierarchical chunk based binary format, each plugin saving and loading its data from a designated chunk, with parameter blocks and global data saved automatically. This system works well if the entire file is saved and loaded from Max, but fails when The file has to be externally modifiable If only a part of the file has to be saved Saving and loading a single max object Saving and loading animation
The above were crucial when developing the new Merge Animation tool (see mergeAnim.ms) where Animators and TDs can export animation from one object, modify it and merge it onto a different object.
to
The struct constructor takes a string argument, which is the path to controllers.xml, supplied with xmlio.ms, and has property information for various keyframe controllers in max. You can also add new ones to it.
creates a max node give an xml element nodeElem, hide:true will hide the object in the viewport. Example: The following xml data can be used to create a Sphere with the given parameters. <object name="Sphere01" classOf="Sphere" isAnimated="true" id="1> <baseObject classOf="Sphere"> <radius classOf="Float">27.4143</radius> <segments classOf="Integer">32</segments> <smooth classOf="BooleanClass">true</smooth> <hemisphere classOf="Float">0.0</hemisphere> <Slice_From classOf="Float">0.0</Slice_From> <Slice_To classOf="Float">0.0</Slice_To> </baseObject> <modifiers /> </object> xml2subAnims animElem anim reads the data from animElem xml element into sub-anims of a given animatable anim. If the sub-anims have controller than the controller node is passed to the following function xml2ctrl animElem ctrl persists the animation data including key frame data from given xml element animElem to the supplied controller ctrl. The given xml element should have a controller sub-node with the animation data.
Example: The above 2 functions can be used to create a transformation controller with the following xml data <transform classOf="prs"> <position classOf="Point3"> <controller classOf="bezier_position"> <keys> <key time="0f" selected="false" value="[6,39,0]" inTangent="[0,0,0]" outTangent="[0,0,0]" x_locked="true" y_locked="true" z_locked="true" constantVelocity="false" /> <key time="100f" selected="false" value="[56.4851,234.783,0]" inTangent="[0,0,0]" outTangent="[0,0,0]" x_locked="true" y_locked="true" z_locked="true" constantVelocity="false" /> </keys> </controller> </position> <rotation classOf="Quat"> <controller classOf="tcb_rotation" /> </rotation> <scale classOf="Point3"> <controller classOf="bezier_scale" /> </scale> </transform>
utility functions
Any miscellaneous functions
create xmlElem [hide:true] [tempObjs:(#())] creates a max side object from the given xmlElem, this functions sometime creates temporary objects which are put into the array passed as tempObjs:, which have be deleted by the caller of this function. string2value str converts a string into a maxscript value isAnimated subAnim given an animatable this function returns if any of the sub-anims under it are animatable getAttribute xmlNode attr returns the attribute value of a given xml node
Conclusion
The script module was helpful in loading and saving xml animation data from the merge animation tool. It is also planned to us this in the upcoming character nodes feature in saving and loading characters. This script was taking a post processing which worked well on small scenes with key framed controllers but was sluggish and unpredictable on large scenes. Sluggish - because it is a Maxscript and was interpreted and also because of the poor string handling in Maxscript. Unpredictable Since some of the procedural controllers dont expose their handling of animation data like IK Controllers, Expression Controller. These obstacles can be overcome if the XML I/O is integrated into Maxs I/O mechanism as described in the following Having plugins implement Animatable::Load and Animatable::Save methods passing ILoad/ISave. We have two classes that implement ILoad interface O---ILoad /\ / \ / \ XMLReader MaxReader XMLReader loads from an XML stream whereas MaxReader writes to binary.