source: NonGTP/FCollada/FCDocument/FCDocument.h @ 964

Revision 964, 27.0 KB checked in by igarcia, 18 years ago (diff)
RevLine 
[964]1/*
2        Copyright (C) 2005-2006 Feeling Software Inc.
3        MIT License: http://www.opensource.org/licenses/mit-license.php
4*/
5/*
6        Based on the FS Import classes:
7        Copyright (C) 2005-2006 Feeling Software Inc
8        Copyright (C) 2005-2006 Autodesk Media Entertainment
9        MIT License: http://www.opensource.org/licenses/mit-license.php
10*/
11
12/**
13        @file FCDocument.h
14        This file declares the COLLADA document object model top class: FCDocument.
15*/
16
17#ifndef _FC_DOCUMENT_H_
18#define _FC_DOCUMENT_H_
19
20#include "FUtils/FUObject.h"
21
22template <class T> class FCDLibrary;
23template <class T> class FUUniqueStringMapT;
24
25class FCDAnimation;
26class FCDAnimationChannel;
27class FCDAnimationClip;
28class FCDAnimated;
29class FCDAsset;
30class FCDCamera;
31class FCDController;
32class FCDEffect;
33class FCDGeometry;
34class FCDImage;
35class FCDLight;
36class FCDMaterial;
37class FCDMaterialLibrary;
38class FCDObject;
39class FCDPhysicsMaterial;
40class FCDPhysicsModel;
41class FCDPhysicsSceneNode;
42class FCDTexture;
43class FCDSceneNode;
44class FUFileManager;
45
46/**
47        A layer declaration.
48        Contains a name for the layer and the ids of all the entities within the layer.
49*/
50class FCOLLADA_EXPORT FCDLayer
51{
52public:
53        string name; /**< The layer name. There is no guarantee of uniqueness. */
54        StringList objects; /**< The list of COLLADA entity ids which are contained by this layer. */
55};
56
57typedef vector<FCDMaterial*> FCDMaterialList; /**< A dynamically-sized array of visual material entities. */
58typedef vector<FCDAnimated*> FCDAnimatedList; /**< A dynamically-sized array of animated values. */
59typedef vector<FCDAnimationChannel*> FCDAnimationChannelList;  /**< A dynamically-sized array of animation channels. */
60typedef map<const float*, FCDAnimated*> FCDAnimatedValueMap;  /**< A map of animatable values to animated values. */
61typedef vector<FCDLayer*> FCDLayerList; /**< A dynamically-sized array of layer declarations. */
62typedef vector<FCDObject*> FCDObjectList; /**< A dynamically-sized array of material entities. */
63
64typedef FCDLibrary<FCDAnimation> FCDAnimationLibrary; /**< A COLLADA library of animation entities. */
65typedef FCDLibrary<FCDAnimationClip> FCDAnimationClipLibrary; /**< A COLLADA library of animation clip entities. */
66typedef FCDLibrary<FCDCamera> FCDCameraLibrary; /**< A COLLADA library of camera entities. */
67typedef FCDLibrary<FCDController> FCDControllerLibrary; /**< A COLLADA library of controller entities. */
68typedef FCDLibrary<FCDGeometry> FCDGeometryLibrary; /**< A COLLADA library of geometric entities. */
69typedef FCDLibrary<FCDImage> FCDImageLibrary; /**< A COLLADA library of images. */
70typedef FCDLibrary<FCDLight> FCDLightLibrary; /**< A COLLADA library of light entities. */
71typedef FCDLibrary<FCDSceneNode> FCDVisualSceneNodeLibrary; /**< A COLLADA library of visual scene nodes. */
72typedef FCDLibrary<FCDPhysicsModel> FCDPhysicsModelLibrary; /**< A COLLADA library of physics model entities. */
73typedef FCDLibrary<FCDPhysicsMaterial> FCDPhysicsMaterialLibrary; /**< A COLLADA library of physics material entities. */
74typedef FCDLibrary<FCDPhysicsSceneNode> FCDPhysicsSceneLibrary; /**< A COLLADA library of physics scene nodes. */
75typedef FUUniqueStringMapT<FUSStringBuilder> FUSUniqueStringMap; /**< A set of unique strings. */
76
77/** @defgroup FCDocument COLLADA Document Object Model. */
78
79/** The top class for the COLLADA object model.
80
81        This class holds all the COLLADA libraries, the scene graphs and the
82        document's asset tag.
83
84        It also holds some global information, such as the animation start and end
85        time and the layers. This global information is only exported by ColladaMaya
86        right now.
87
88        @ingroup FCDocument COLLADA Document Object Model
89*/
90class FCOLLADA_EXPORT FCDocument : public FUObjectContainer
91{
92private:
93        FUFileManager* fileManager;
94        FCDSceneNode* visualSceneRoot;
95        FCDPhysicsSceneNode* physicsSceneRoot;
96        FUSUniqueStringMap* uniqueNameMap;
97
98        // Document parameters
99        FCDAsset* asset;
100        float lengthUnitWanted, lengthUnitConversion;
101        bool hasStartTime, hasEndTime;
102        float startTime, endTime; // Maya-only
103        FCDLayerList layers; // Maya-only
104
105        // Parsed and merged libraries
106        FCDAnimationLibrary* animationLibrary;
107        FCDAnimationClipLibrary* animationClipLibrary;
108        FCDCameraLibrary* cameraLibrary;
109        FCDControllerLibrary* controllerLibrary;
110        FCDGeometryLibrary* geometryLibrary;
111        FCDImageLibrary* imageLibrary;
112        FCDLightLibrary* lightLibrary;
113        FCDMaterialLibrary* materialLibrary;
114        FCDPhysicsModelLibrary* physicsModelLibrary;
115        FCDPhysicsMaterialLibrary* physicsMaterialLibrary;
116        FCDPhysicsSceneLibrary* physicsSceneLibrary;
117        FCDVisualSceneNodeLibrary* visualSceneLibrary;
118
119        // Animated values
120        FCDAnimatedList animatedValues;
121        FCDAnimatedValueMap animatedValueMap;
122
123        StringList postCmds;
124
125public:
126        /** Construct a new COLLADA document. */
127        FCDocument();
128
129        /** COLLADA document destructor. This clears out all the memory related to the document. */
130        virtual ~FCDocument();
131
132        /** Retrieves the asset information for this COLLADA document. The asset information should always be present.
133                @return A pointer to the asset information structure. This pointer should never be NULL. */
134        FCDAsset* GetAsset() { return asset; }
135        const FCDAsset* GetAsset() const { return asset; }      /**< See above. */
136
137        /** [INTERNAL] Retrieves the local file manager for the COLLADA document. Used to resolve URIs and transform file
138                paths into their relative or absolute equivalent. May be deprecated in future versions.
139                @return The file manager for this COLLADA document. This pointer should never be NULL. */
140        FUFileManager* GetFileManager() { return fileManager; }
141        const FUFileManager* GetFileManager() const { return fileManager; }     /**< See above. */
142
143        /** Retrieves the currently selected visual scene.
144                @return The currently selected visual scene structure. */
145        FCDSceneNode* GetVisualSceneRoot() { return visualSceneRoot; }
146        const FCDSceneNode* GetVisualSceneRoot() const { return visualSceneRoot; } /**< See above. */
147
148        /** Retrieves the currently selected physics scene.
149                @return The currently selected physics scene structure. */
150        FCDPhysicsSceneNode* GetPhysicsSceneRoot() { return physicsSceneRoot; }
151        const FCDPhysicsSceneNode* GetPhysicsSceneRoot() const { return physicsSceneRoot; } /**< See above. */
152
153        /** @deprecated Retrieves a list of all the visual materials contained by the document.
154                @return The materials contained by this document. */
155        const FCDMaterialList& GetMaterialList();
156
157        /** [INTERNAL] Retrieves the map of unique ids for this document.
158                @return The map of unique ids for this document. */
159        FUSUniqueStringMap* GetUniqueNameMap() { return uniqueNameMap; }
160        const FUSUniqueStringMap* GetUniqueNameMap() const { return uniqueNameMap; } /**< See above. */
161
162        /** @deprecated Retrieves the vector pre-determined by the document as the up-axis.
163                This information is now contained within the asset structure. Please use GetAsset()->GetUpAxis().
164                @return A 3D vector for the up axis direction. */
165        const FMVector3& GetUpAxis() const;
166
167        /** @deprecated Retrieves the length of 1 distance unit for this document, in meters. The default is 1.0,
168                which means that the 1 unit in the document is equal to 1 meter. This information is
169                now contained within the asset structure. Please use GetAsset()->GetLengthUnit().
170                @return The length of 1 distance unit for this document. */
171        float GetLengthUnit() const;
172
173        /** [INTERNAL] Retrieves the conversion factor between the requested distance unit
174                and the document's distance unit.
175                @return The distance unit conversion factor. */
176        float GetLengthUnitConversion() const { return lengthUnitConversion; }
177
178        /** Sets the wanted distance unit factor, in meters, for this document.
179                For example, Maya uses centimeters internally and sets the wanted distance unit factor to 0.01.
180                @param wantedLengthUnit The wanted distance unit, in meters. */
181        inline void SetLengthUnitWanted(float wantedLengthUnit) { lengthUnitWanted = wantedLengthUnit; }
182
183        /** Returns whether a start time is being enforced for the document.
184                @return Whether the document has a start time. */
185        bool HasStartTime() const { return hasStartTime; }
186        /** Retrieves the start time set for the document.
187                @return The document start time. */
188        float GetStartTime() const { return startTime; }
189        /** Enforces a certain time as the start time for the document.
190                @param time The document start time. */
191        void SetStartTime(float time) { startTime = time; hasStartTime = true; }
192
193        /** Returns whether a end time is being enforced for the document.
194                @return Whether the document has a end time. */
195        bool HasEndTime() const { return hasEndTime; }
196        /** Retrieves the end time set for the document.
197                @return The document end time. */
198        float GetEndTime() const { return endTime; }
199        /** Enforces a certain time as the end time for the document.
200                @param time The document end time. */
201        void SetEndTime(float time) { endTime = time; hasEndTime = true; }
202
203        /** Retrieves the list of entity layers.
204                @return The list of entity layers. */
205        FCDLayerList& GetLayers() { return layers; }
206        const FCDLayerList& GetLayers() const { return layers; } /**< See above. */
207
208        /** Retrieves the number of entity layers contained within the document.
209                @return The number of layers. */
210        size_t GetLayerCount() const { return layers.size(); }
211
212        /** Retrieves a specific entity layer contained within the document.
213                @param index The index of the layer.
214                @return The entity layer. This pointer will be NULL if the index
215                        is out-of-bounds. */
216        FCDLayer* GetLayer(size_t index) { FUAssert(index < GetLayerCount(), return NULL); return layers.at(index); }
217        const FCDLayer* GetLayer(size_t index) const { FUAssert(index < GetLayerCount(), return NULL); return layers.at(index); }
218
219        /** Adds an entity layer to the document.
220                @return The new layer. */
221        FCDLayer* AddLayer();
222
223        /** Releases an entity layer from the document
224                @param layer The layer to release. */
225        void ReleaseLayer(FCDLayer* layer);
226
227        /** Retrieves the animation library. The animation library contains the animation curves
228                within a tree structure. To create and find animation curves, do not use the animation
229                library directly: use the FCDAnimated class, the FindAnimatedValue() function and the
230                RegisterAnimatedValue() function.
231                @return The animation library. */
232        FCDAnimationLibrary* GetAnimationLibrary() { return animationLibrary; }
233        const FCDAnimationLibrary* GetAnimationLibrary() const { return animationLibrary; } /**< See above. */
234
235        /** Retrieves the animation clip library. The animation clip library contains a list of animation clips.
236                Each animation clip instantiates nodes from the animation library. Sections of the animation curves
237                belonging to the instantiated animation nodes are thereby packaged together as animation clips.
238                @return The animation clip library. */
239        FCDAnimationClipLibrary* GetAnimationClipLibrary() { return animationClipLibrary; }
240        const FCDAnimationClipLibrary* GetAnimationClipLibrary() const { return animationClipLibrary; } /**< See above. */
241
242        /** Retrieves the camera library. The camera library contains a list of cameras, which may be
243                instantiated within the scene graph. COLLADA supports two camera types: perspective and orthographic.
244                @return The camera library. */
245        FCDCameraLibrary* GetCameraLibrary() { return cameraLibrary; }
246        const FCDCameraLibrary* GetCameraLibrary() const { return cameraLibrary; } /**< See above. */
247
248        /** Retrieves the controller library. The controller library contains a list of controllers, which may
249                be instantiated within the scene graph. COLLADA supports two controller types: skin and morph.
250                @return The controller library. */
251        FCDControllerLibrary* GetControllerLibrary() { return controllerLibrary; }
252        const FCDControllerLibrary* GetControllerLibrary() const { return controllerLibrary; } /**< See above. */
253
254        /** Retrieves the geometry library. The geometry library contains a list of basic geometries, which may
255                be instantiated within the scene graph and may be used by controllers.
256                COLLADA supports two geometry types: mesh and spline.
257                @return The geometry library. */
258        FCDGeometryLibrary* GetGeometryLibrary() { return geometryLibrary; }
259        const FCDGeometryLibrary* GetGeometryLibrary() const { return geometryLibrary; } /**< See above. */
260
261        /** Retrieves the image library. The image library contains a list of images. Images are used
262                by effects for textures.
263                @return The image library. */
264        FCDImageLibrary* GetImageLibrary() { return imageLibrary; }
265        const FCDImageLibrary* GetImageLibrary() const { return imageLibrary; } /**< See above. */
266
267        /** Retrieves the light library. The light library contains a list of light, which may be
268                instantiated within the scene graph. COLLADA supports four light types: ambient, directional,
269                point and spot lights.
270                @return The light library. */
271        FCDLightLibrary* GetLightLibrary() { return lightLibrary; }
272        const FCDLightLibrary* GetLightLibrary() const { return lightLibrary; } /**< See above. */
273
274        /** Retrieves the visual material library. The visual material library contains a list of visual materials,
275                which are bound to mesh polygons within the scene graph. A visual material instantiates an effect and
276                presets the effect parameters for a given visual result.
277                @return The visual material library. */
278        FCDMaterialLibrary* GetMaterialLibrary() { return materialLibrary; }
279        const FCDMaterialLibrary* GetMaterialLibrary() const { return materialLibrary; } /**< See above. */
280
281        /** Retrieves the effect library. The effect library contains a list of effects, which may be instantiated
282                by materials. An effect defines an interface for a rendering shader. A ColladaFX effect may contain multiple
283                passes and techniques for different platforms or level of details.
284                @return The effect library. */
285        FCDMaterialLibrary* GetEffectLibrary() { return materialLibrary; }
286        const FCDMaterialLibrary* GetEffectLibrary() const { return materialLibrary; } /**< See above. */
287
288        /** Retrieves the visual scene library. The visual scene library contains an acyclic directed graph of
289                visual scene nodes: a visual scene node contains one or more parent nodes and zero or more child nodes.
290                A visual scene node also contains 3D transformations: translation, rotation, scale, skew, as well as
291                the compound transformations: lookAt and matrix. A visual scene node also contains instances of
292                geometries, controllers, cameras and/or lights. Only one visual scene should be used at one time
293                by the global scene.
294                @return The visual scene library. */
295        FCDVisualSceneNodeLibrary* GetVisualSceneLibrary() { return visualSceneLibrary; }
296        const FCDVisualSceneNodeLibrary* GetVisualSceneLibrary() const { return visualSceneLibrary; } /**< See above. */
297
298        /** Retrieves the physics model library. The physics model library contains a list of physics models.
299                @return The physics model library. */
300        FCDPhysicsModelLibrary* GetPhysicsModelLibrary() { return physicsModelLibrary; }
301        const FCDPhysicsModelLibrary* GetPhysicsModelLibrary() const { return physicsModelLibrary; } /**< See above. */
302
303        /** Retrieves the physics material library. The physics material library contains a list of physics material.
304                @return The physics material library. */
305        FCDPhysicsMaterialLibrary* GetPhysicsMaterialLibrary() { return physicsMaterialLibrary; }
306        const FCDPhysicsMaterialLibrary* GetPhysicsMaterialLibrary() const { return physicsMaterialLibrary; } /**< See above. */
307
308        /** Retrieves the physics scene library. The physics scene library contains an acyclic directed graph of
309                physics scene nodes.
310                @return The physics scene library. */
311        FCDPhysicsSceneLibrary* GetPhysicsSceneLibrary() { return physicsSceneLibrary;}
312        const FCDPhysicsSceneLibrary* GetPhysicsSceneLibrary() const { return physicsSceneLibrary;} /**< See above. */
313
314        /** Insert a new visual scene within the visual scene library.
315                The new visual scene will be used as the root visual scene.
316                @return The newly created visual scene. */
317        FCDSceneNode* AddVisualScene();
318
319        /** Insert a new physics scene within the physics material library.
320                The new physics scene will be used as the root physics scene.
321                @return The newly created physics scene. */
322        FCDPhysicsSceneNode* AddPhysicsScene();
323       
324        /** [INTERNAL] Retrieves all the animation channels which include a given target pointer.
325                @param pointer A valid COLLADA target pointer. Example: "node01/translate.X".
326                @param channels A list to be filled with the animation channels which target the given pointer.
327                        This list is not emptied by the function. If no animation channels are found, this list will be empty. */
328        void FindAnimationChannels(const string& pointer, FCDAnimationChannelList& channels);
329
330        /** [INTERNAL] Retrieves the array indices of animation channels which target the given XML node.
331                @param targetArray A XML node that contains an array of animatable values.
332                @param animatedIndices A list to be filled with the array indices of the animation channels
333                        which target the given XML node. If no animation channel indices are found, this list will be empty. */
334        void FindAnimationChannelsArrayIndices(xmlNode* targetArray, Int32List& animatedIndices);
335
336        /** Retrieves the animation tree node that matches the given COLLADA id.
337                @param daeId A valid COLLADA id.
338                @return The animation tree node. This pointer will be NULL if
339                        no matching animation tree node was found. */
340        FCDAnimation* FindAnimation(const string& daeId);
341
342        /** Retrieves the animation clip that matches the given COLLADA id.
343                @param daeId A valid COLLADA id.
344                @return The animation clip. This pointer will be NULL if
345                        no matching animation clip was found. */
346        FCDAnimationClip* FindAnimationClip(const string& daeId);
347
348        /** Retrieves the camera that matches the given COLLADA id.
349                @param daeId A valid COLLADA id.
350                @return The camera. This pointer will be NULL if no matching camera was found. */
351        FCDCamera* FindCamera(const string& daeId);
352
353        /** Retrieves the controller that matches the given COLLADA id.
354                @param daeId A valid COLLADA id.
355                @return The controller. This pointer will be NULL if no matching controller was found. */
356        FCDController* FindController(const string& daeId);
357
358        /** Retrieves the effect that matches the given COLLADA id.
359                @param daeId A valid COLLADA id.
360                @return The effect. This pointer will be NULL if no matching effect was found. */
361        FCDEffect* FindEffect(const string& daeId);
362
363        /** Retrieves the geometry that matches the given COLLADA id.
364                @param daeId A valid COLLADA id.
365                @return The geometry. This pointer will be NULL if no matching geometry was found. */
366        FCDGeometry* FindGeometry(const string& daeId);
367
368        /** Retrieves the image that matches the given COLLADA id.
369                @param daeId A valid COLLADA id.
370                @return The image. This pointer will be NULL if no matching image was found. */
371        FCDImage* FindImage(const string& daeId);
372
373        /** Retrieves the light that matches the given COLLADA id.
374                @param daeId A valid COLLADA id.
375                @return The light. This pointer will be NULL if no matching light was found. */
376        FCDLight* FindLight(const string& daeId);
377
378        /** Retrieves the visual material that matches the given COLLADA id.
379                @param daeId A valid COLLADA id.
380                @return The visual material. This pointer will be NULL if no matching visual material was found. */
381        FCDMaterial* FindMaterial(const string& daeId);
382
383        /** @deprecated Retrieves the texture that matches the given COLLADA id.
384                @param daeId A valid COLLADA id.
385                @return The texture. This pointer will be NULL if no matching texture was found. */
386        FCDTexture* FindTexture(const string& daeId);
387
388        /** Retrieves the visual scene that matches the given COLLADA id.
389                @param daeId A valid COLLADA id.
390                @return The visual scene. This pointer will be NULL if no matching visual scene was found. */
391        FCDSceneNode* FindVisualScene(const string& daeId);
392
393        /** Retrieves the physics scene that matches the given COLLADA id.
394                @param daeId A valid COLLADA id.
395                @return The physics scene. This pointer will be NULL if no matching physics scene was found. */
396        FCDPhysicsSceneNode* FindPhysicsScene(const string& daeId);
397
398        /** Retrieves the physics material that matches the given COLLADA id.
399                @param daeId A valid COLLADA id.
400                @return The physics material. This pointer will be NULL if no matching physics material was found. */
401        FCDPhysicsMaterial* FindPhysicsMaterial(const string& daeId);
402
403        /** Retrieves the physics model that matches the given COLLADA id.
404                @param daeId A valid COLLADA id.
405                @return The physics model. This pointer will be NULL if no matching physics model was found. */
406        FCDPhysicsModel* FindPhysicsModel(const string& daeId);
407
408        /** Retrieves the visual scene node that matches the given COLLADA id.
409                This method searches through all the visual scenes within the visual scene library and
410                their child visual scene nodes to find the correct visual scene node.
411                @param daeId A valid COLLADA id.
412                @return The visual scene node. This pointer will be NULL if no matching visual scene node was found. */
413        FCDSceneNode* FindSceneNode(const string& daeId);
414
415        /** [INTERNAL] Registers an animated value with the document. All animated values are
416                listed within the document.
417                @param animated The new animated value to list within the document. */
418        void RegisterAnimatedValue(FCDAnimated* animated);
419
420        /** [INTERNAL] Unregisters an animated value of the document. All animated values are
421                listed within the document. This function must be called before deleting an animated value.
422                @param animated The animated value to un-list from the document. */
423        void UnregisterAnimatedValue(FCDAnimated* animated);
424
425        /** [INTERNAL] Links the given animated value as a possible driver to other animated value(s). This step is
426                done during the import, after new animated values are imported. The whole list of animated values is checked
427                for potential driven values.
428                @param animated The animated value to verify.
429                @return Whether a driver was found. */
430        bool LinkDriver(FCDAnimated* animated);
431
432        /** Retrieves an animated value given an animatable value.
433                @param ptr A pointer to an animatable value contained within the document.
434                @return The animated value. This pointer will NULL if no matching animated value was found. */
435        FCDAnimated* FindAnimatedValue(float* ptr);
436        const FCDAnimated* FindAnimatedValue(const float* ptr) const; /**< See above. */
437
438        /** [INTERNAL] Retrieves an animated value given a COLLADA target pointer. Used during the resolving of drivers/driven
439                animated values.
440                @param fullyQualifiedTarget A valid COLLADA target pointer.
441                @return A pointer to the animatable value. */
442        const float* FindAnimatedTarget(const string& fullyQualifiedTarget);
443
444        /** @deprecated Retrieves an animated value associated with a shader attribute, given the id of the material.
445                Do not use this function. Instead, find the material/effect within its library,
446                find the parameter and use the FindAnimatedValue function on its animatable value(s).
447                @param shader A valid material id.
448                @param attribute A valid attribute sub-id.
449                @return The animated value. This pointer will be NULL if no matching animated value was found. */
450        const FCDAnimated* FindNamedAnimated(const string& shader, const string& attribute) const;
451
452        /** Retrieves whether a given animatable value is animated.
453                @param ptr The animatable value.
454                @return Whether the animatable value is animated. */
455        bool IsValueAnimated(const float* ptr) const;
456
457        /** Loads a COLLADA file into this document object. This function appends into the document object all
458                the COLLADA assets found within the file identified by the given filename.
459                @param filename An OS-dependant filename.
460                @return The status of the import. If the status is not successful, it may be dangerous to
461                        extract information from the document. */
462        FUStatus LoadFromFile(const fstring& filename);
463
464        /** Loads a COLLADA string into this document object. This function appends into the document object all
465                the COLLADA assets found within the given string. The string should be in XML format.
466                @param basePath The base file path for this import. Used when transforming the relative filenames
467                        found within the COLLADA string into absolute and OS-dependent filenames.
468                @param text The COLLADA string.
469                @return The status of the import. If the status is not successful, it may be dangerous to
470                        extract information from the document. */
471        FUStatus LoadFromText(const fstring& basePath, const fchar* text);
472
473        /** [INTERNAL] Reads the full document information from the given XML node tree. This step is done after
474                a successfull import, by LibXML2, of the COLLADA string/file into a full XML node tree.
475                @param colladaNode The base XML node tree to parse.
476                @return The status of the import. If the status is not successful, it may be dangerous to
477                        extract information from the document. */
478        FUStatus LoadDocumentFromXML(xmlNode* colladaNode);
479
480        /** Writes the document out to a file identified by its OS-dependent filename. This function is done
481                in two steps. First, the document is fully translated into a XML node tree. Then, the XML node tree
482                is written to a file by LibXML2.
483                @param filename The OS-dependent filename.
484                @return The status of the import. If the status is not successful, it may be dangerous to
485                        extract information from the document. */
486        FUStatus WriteToFile(const fstring& filename) const;
487
488        /** [INTERNAL] Writes out the document to a XML node tree. This is the first step of the document
489                export. This function traverses the full COLLADA document, writing all the entities into
490                the given XML node tree.
491                @param colladaNode The base XML node tree to write to.
492                @return The status of the import. If the status is not successful, it may be dangerous to
493                        extract information from the document. */
494        FUStatus WriteDocumentToXML(xmlNode* colladaNode) const;
495
496        /** [INTERNAL] Writes out the animation curves contained within an animated value to the given XML node tree.
497                @param value An animatable value.
498                @param valueNode The XML node associated with the animatable value. This XML node is used to generate a
499                        valid COLLADA target pointer.
500                @param wantedSid The sub-id for the animatable value. If the animatable value is animated, this sub-id
501                        will be added as an attribute to the XML node. If another node, within the sid range already uses this sub-id,
502                        a unique sub-id will be generated using the wanted sub-id as a base.
503                @param arrayElement The array index for this animatable value. Defaults to -1, which implies that the
504                        animatable value does not belong to an array. */
505        void WriteAnimatedValueToXML(const float* value, xmlNode* valueNode, const char* wantedSid, int32 arrayElement = -1) const;
506
507        /** @deprecated Retrieves a list of post-processing commands.
508                @return The list of post-processing commands. */
509        const StringList& GetPostProcessCmds() const { return postCmds; }
510       
511        /** @deprecated Retrieves the list of the animated values defined within the document.
512                Do not use this function: use FindAnimatedValue() instead.
513                @return The list of animated values defined within the document. */
514        const FCDAnimatedList& getAnimatedValues() { return animatedValues; }
515};
516
517#endif //_FC_DOCUMENT_H_
Note: See TracBrowser for help on using the repository browser.