Katana Plug-in APIs 0.1

FileAsset.h

00001 // Copyright (c) 2012 The Foundry Visionmongers Ltd. All Rights Reserved.
00002 
00003 #ifndef FILEASSET__H
00004 #define FILEASSET__H
00005 #include <string>
00006 
00007 #include <FnAsset/plugin/FnAsset.h>
00008 #include <FnLogging/FnLogging.h>
00009 
00010 class FileAsset : public FnKat::Asset
00011 {
00012 public:
00013     FileAsset();
00014     virtual ~FileAsset();
00015 
00016     static FnKat::Asset* create();
00017 
00018     void reset();
00019 
00020     bool isAssetId(const std::string& name);
00021     bool containsAssetId(const std::string& name);
00022 
00023     bool checkPermissions(const std::string& assetId, const StringMap& context);
00024     bool runAssetPluginCommand(const std::string& assetId,
00025                                const std::string& command,
00026                                const StringMap& commandArgs);
00027 
00028     void resolveAsset(const std::string& assetId, std::string& ret);
00029     void resolveAllAssets(const std::string& str, std::string& ret);
00030     void resolvePath(const std::string& str, const int frame, std::string& ret);
00031 
00032     void resolveAssetVersion(const std::string& assetId,
00033                              std::string& ret,
00034                              const std::string& versionStr = std::string());
00035 
00036     void getUniqueScenegraphLocationFromAssetId(const std::string& assetId,
00037                                                 bool includeVersion,
00038                                                 std::string& ret);
00039     void getAssetDisplayName(const std::string& assetId, std::string& ret);
00040     void getAssetVersions(const std::string& assetId, StringVector& ret);
00041     void getRelatedAssetId(const std::string& assetId,
00042                            const std::string& relation,
00043                            std::string& ret);
00044 
00045     void getAssetFields(const std::string& assetId,
00046                         bool includeDefaults,
00047                         StringMap& returnFields);
00048     void buildAssetId(const StringMap& fields, std::string& ret);
00049 
00050     void getAssetAttributes(const std::string& assetId,
00051                             const std::string& scope,
00052                             StringMap& returnAttrs);
00053     void setAssetAttributes(const std::string& assetId,
00054                             const std::string& scope,
00055                             const StringMap& attrs);
00056     void getAssetIdForScope(const std::string& assetId,
00057                             const std::string& scope,
00058                             std::string& ret);
00059 
00060     void createAssetAndPath(FnKat::AssetTransaction* txn,
00061                             const std::string& assetType,
00062                             const StringMap& assetFields,
00063                             const StringMap& args,
00064                             bool createDirectory,
00065                             std::string& assetId);
00066 
00067     void postCreateAsset(FnKat::AssetTransaction* txn,
00068                          const std::string& assetType,
00069                          const StringMap& assetFields,
00070                          const StringMap& args,
00071                          std::string& assetId);
00072 
00073     static void flush() {}
00074 
00075 private:
00076     static const char* _typeAttributeKey;
00077     static std::string _getSafeIdentifier(const std::string& id);
00078     static std::string _expandUser(const std::string& fileString);
00079     static std::string _expandVars(const std::string& fileString);
00080 };
00081 
00082 #endif  // #ifndef FILEASSET__H
 All Classes Functions Variables Typedefs Enumerations Enumerator