- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# FColladaPlugin.h

Go to the documentation of this file.

    00001 /*
    00002     Copyright (C) 2005-2007 Feeling Software Inc.
    00003     Portions of the code are:
    00004     Copyright (C) 2005-2007 Sony Computer Entertainment America
    00005
    00006     MIT License: http://www.opensource.org/licenses/mit-license.php
    00007 */
    00008
    00015 #ifndef _FCOLLADA_PLUGIN_H_
    00016 #define _FCOLLADA_PLUGIN_H_
    00017
    00018 #ifndef _FU_PLUGIN_H_
    00019 #include "FUtils/FUPlugin.h"
    00020 #endif // _FU_PLUGIN_H_
    00021
    00022 class FUPluginManager;
    00023 class FCDObject;
    00024 class FCDENode;
    00025 class FCDETechnique;
    00026
    00036 class FCOLLADA_EXPORT FCPExtraTechnique : public FUPlugin
    00037 {
    00038 private:
    00039     DeclareObjectType(FUPlugin);
    00040
    00041 public:
    00044     virtual const char* GetProfileName() = 0;
    00045
    00056     virtual FUTrackable* ReadFromArchive(FCDETechnique* techniqueNode, FUObject* parent) = 0;
    00057
    00063     virtual void WriteToArchive(FCDETechnique* techniqueNode, const FUTrackable* handle) const = 0;
    00064
    00065 protected:
    00068     virtual ~FCPExtraTechnique() {}
    00069 };
    00070
    00080 class FCOLLADA_EXPORT FCPArchive: public FUPlugin
    00081 {
    00082 private:
    00083     DeclareObjectType(FUPlugin);
    00084
    00085 public:
    00088     virtual bool IsImportSupported() = 0;
    00089
    00092     virtual bool IsExportSupported() = 0;
    00093
    00096     virtual bool IsPartialExportSupported() = 0;
    00097
    00101     virtual bool IsExtensionSupported(const char* ext) = 0;
    00102
    00105     virtual int GetSupportedExtensionsCount() = 0;
    00106
    00112     virtual const char* GetSupportedExtensionAt(int index) = 0;
    00113
    00117     virtual bool AddExtraExtension(const char* /*ext*/){ return false; }
    00118
    00123     virtual bool RemoveExtraExtension(const char* /*ext*/){ return false; }
    00124
    00129     virtual bool ImportFile(const fchar* filePath, FCDocument* document) = 0;
    00130
    00139     virtual bool ImportFileFromMemory(const fchar* filePath, FCDocument* document, const void* contents, size_t length) = 0;
    00140
    00145     virtual bool ExportFile(FCDocument* document, const fchar* filePath) = 0;
    00146
    00153     virtual bool StartExport(const fchar* absoluteFilePath) = 0;
    00154
    00160     virtual bool ExportObject(FCDObject* object) = 0;
    00161
    00167     virtual bool EndExport(fm::vector<uint8>& outData) = 0;
    00168
    00175     virtual bool EndExport(const fchar* filePath) = 0;
    00176
    00181     virtual bool ImportObject(FCDObject* object, const fm::vector<uint8>& data) = 0;
    00182
    00183 protected:
    00186     virtual ~FCPArchive() {}
    00187 };
    00188
    00192 class FCOLLADA_EXPORT FColladaPluginManager : public FUObject
    00193 {
    00194 private:
    00195     DeclareObjectType(FColladaPluginManager);
    00196
    00197     typedef FUObjectContainer<FCPExtraTechnique> FCPExtraList;
    00198     typedef FUObjectContainer<FCPArchive> FCPArchiveList;
    00199
    00200     FCPExtraList extraTechniquePlugins;
    00201     FCPArchiveList archivePlugins;
    00202
    00203     FUPluginManager* loader;
    00204
    00205 public:
    00207     FColladaPluginManager();
    00208
    00211     size_t GetArchivePluginsCount() { return archivePlugins.size(); }
    00212
    00216     FCPArchive* GetArchivePlugin(size_t index){ FUAssert(index < archivePlugins.size(), return NULL); return archivePlugins[index]; }
    00217
    00222     bool RegisterPlugin(FUPlugin* plugin);
    00223     DEPRECATED(3.05A, RegisterPlugin) inline bool AddPlugin(FCPExtraTechnique* plugin) { return RegisterPlugin(plugin); }
    00224     DEPRECATED(3.05A, RegisterPlugin) inline bool AddArchivePlugin(FCPArchive* plugin) { return RegisterPlugin(plugin); }
    00230     bool LoadDocumentFromFile(FCDocument* document, const fchar* filename);
    00231     DEPRECATED(3.05A, LoadDocumentFromFile) inline bool LoadDocument(FCDocument* document, const fchar* filename) { return LoadDocumentFromFile(document, filename); }
    00238     bool LoadDocumentFromMemory(const fchar* filename, FCDocument* document, void* data, size_t length);
    00239
    00244     bool SaveDocumentToFile(FCDocument* document, const fchar* filename);
    00245     DEPRECATED(3.05A, SaveDocumentToFile) inline bool SaveDocument(FCDocument* document, const fchar* filename) { return SaveDocumentToFile(document, filename); }
    00247 private:
    00250     virtual ~FColladaPluginManager();
    00251
    00253     FCPArchive* FindArchivePlugin(const fchar* filename);
    00254
    00255     // Extra Technique plug-ins support
    00256     typedef fm::pvector<FCDETechnique> FCDETechniqueList;
    00257     void PostImportDocument(FCDocument* document);
    00258     void PreExportDocument(FCDocument* document, FCDETechniqueList& techniques);
    00259     void PostExportDocument(FCDocument* document, FCDETechniqueList& techniques);
    00260
    00262     typedef fm::map<uint32, FCPExtraTechnique*> FCPExtraMap;
    00263     void CreateExtraTechniquePluginMap(FCPExtraMap& map);
    00264 };
    00265
    00266 #endif // _FCOLLADA_PLUGIN_H_