LevelAsset.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. #pragma once
  2. //-----------------------------------------------------------------------------
  3. // Copyright (c) 2013 GarageGames, LLC
  4. //
  5. // Permission is hereby granted, free of charge, to any person obtaining a copy
  6. // of this software and associated documentation files (the "Software"), to
  7. // deal in the Software without restriction, including without limitation the
  8. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  9. // sell copies of the Software, and to permit persons to whom the Software is
  10. // furnished to do so, subject to the following conditions:
  11. //
  12. // The above copyright notice and this permission notice shall be included in
  13. // all copies or substantial portions of the Software.
  14. //
  15. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  20. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  21. // IN THE SOFTWARE.
  22. //-----------------------------------------------------------------------------
  23. #ifndef LEVEL_ASSET_H
  24. #define LEVEL_ASSET_H
  25. #ifndef _ASSET_BASE_H_
  26. #include "assets/assetBase.h"
  27. #endif
  28. #ifndef _ASSET_DEFINITION_H_
  29. #include "assets/assetDefinition.h"
  30. #endif
  31. #ifndef _STRINGUNIT_H_
  32. #include "string/stringUnit.h"
  33. #endif
  34. #ifndef _ASSET_FIELD_TYPES_H_
  35. #include "assets/assetFieldTypes.h"
  36. #endif
  37. //-----------------------------------------------------------------------------
  38. class LevelAsset : public AssetBase
  39. {
  40. typedef AssetBase Parent;
  41. StringTableEntry mLevelName;
  42. StringTableEntry mLevelFile;
  43. StringTableEntry mPostFXPresetFile;
  44. StringTableEntry mDecalsFile;
  45. StringTableEntry mForestFile;
  46. StringTableEntry mNavmeshFile;
  47. StringTableEntry mPreviewImage;
  48. StringTableEntry mLevelPath;
  49. StringTableEntry mPostFXPresetPath;
  50. StringTableEntry mDecalsPath;
  51. StringTableEntry mForestPath;
  52. StringTableEntry mNavmeshPath;
  53. StringTableEntry mPreviewImagePath;
  54. StringTableEntry mEditorFile;
  55. StringTableEntry mBakedSceneFile;
  56. bool mIsSubLevel;
  57. StringTableEntry mMainLevelAsset;
  58. StringTableEntry mGamemodeName;
  59. Vector<AssetBase*> mAssetDependencies;
  60. public:
  61. LevelAsset();
  62. virtual ~LevelAsset();
  63. /// Engine.
  64. static void initPersistFields();
  65. virtual void copyTo(SimObject* object);
  66. /// Declare Console Object.
  67. DECLARE_CONOBJECT(LevelAsset);
  68. void loadDependencies();
  69. void unloadDependencies();
  70. void setLevelFile(const char* pImageFile);
  71. inline StringTableEntry getLevelFile(void) const { return mLevelFile; };
  72. void setPostFXPresetFile(const char* pPostFXPresetFile);
  73. inline StringTableEntry getPostFXPresetFile(void) const { return mPostFXPresetFile; };
  74. void setDecalsFile(const char* pDecalsFile);
  75. inline StringTableEntry getDecalsFile(void) const { return mDecalsFile; };
  76. void setForestFile(const char* pForestFile);
  77. inline StringTableEntry getForestFile(void) const { return mForestFile; };
  78. void setNavmeshFile(const char* pNavmeshFile);
  79. inline StringTableEntry getNavmeshFile(void) const { return mNavmeshFile; };
  80. void setImageFile(const char* pImageFile);
  81. inline StringTableEntry getImageFile(void) const { return mPreviewImage; };
  82. inline StringTableEntry getLevelPath(void) const { return mLevelPath; };
  83. inline StringTableEntry getPostFXPresetPath(void) const { return mPostFXPresetPath; };
  84. inline StringTableEntry getDecalsPath(void) const { return mDecalsPath; };
  85. inline StringTableEntry getForestPath(void) const { return mForestPath; };
  86. inline StringTableEntry getNavmeshPath(void) const { return mNavmeshPath; };
  87. inline StringTableEntry getImagePath(void) const { return mPreviewImagePath; };
  88. void setEditorFile(const char* pEditorFile);
  89. inline StringTableEntry getEditorFile(void) const { return mEditorFile; };
  90. void setBakedSceneFile(const char* pBakedSceneFile);
  91. inline StringTableEntry getBakedSceneFile(void) const { return mBakedSceneFile; };
  92. SimObjectId load();
  93. protected:
  94. static bool setLevelFile(void *obj, const char *index, const char *data) { static_cast<LevelAsset*>(obj)->setLevelFile(data); return false; }
  95. static const char* getLevelFile(void* obj, const char* data) { return static_cast<LevelAsset*>(obj)->getLevelFile(); }
  96. static bool setPreviewImageFile(void *obj, const char *index, const char *data) { static_cast<LevelAsset*>(obj)->setImageFile(data); return false; }
  97. static const char* getPreviewImageFile(void* obj, const char* data) { return static_cast<LevelAsset*>(obj)->getImageFile(); }
  98. static bool setEditorFile(void* obj, const char* index, const char* data) { static_cast<LevelAsset*>(obj)->setEditorFile(data); return false; }
  99. static const char* getEditorFile(void* obj, const char* data) { return static_cast<LevelAsset*>(obj)->getEditorFile(); }
  100. static bool setBakedSceneFile(void* obj, const char* index, const char* data) { static_cast<LevelAsset*>(obj)->setBakedSceneFile(data); return false; }
  101. static const char* getBakedSceneFile(void* obj, const char* data) { return static_cast<LevelAsset*>(obj)->getBakedSceneFile(); }
  102. static bool setPostFXPresetFile(void* obj, const char* index, const char* data) { static_cast<LevelAsset*>(obj)->setPostFXPresetFile(data); return false; }
  103. static const char* getPostFXPresetFile(void* obj, const char* data) { return static_cast<LevelAsset*>(obj)->getPostFXPresetFile(); }
  104. static bool setDecalsFile(void* obj, const char* index, const char* data) { static_cast<LevelAsset*>(obj)->setDecalsFile(data); return false; }
  105. static const char* getDecalsFile(void* obj, const char* data) { return static_cast<LevelAsset*>(obj)->getDecalsFile(); }
  106. static bool setForestFile(void* obj, const char* index, const char* data) { static_cast<LevelAsset*>(obj)->setForestFile(data); return false; }
  107. static const char* getForestFile(void* obj, const char* data) { return static_cast<LevelAsset*>(obj)->getForestFile(); }
  108. static bool setNavmeshFile(void* obj, const char* index, const char* data) { static_cast<LevelAsset*>(obj)->setNavmeshFile(data); return false; }
  109. static const char* getNavmeshFile(void* obj, const char* data) { return static_cast<LevelAsset*>(obj)->getNavmeshFile(); }
  110. virtual void initializeAsset(void);
  111. virtual void onAssetRefresh(void);
  112. };
  113. DefineConsoleType(TypeLevelAssetPtr, LevelAsset)
  114. #endif // _ASSET_BASE_H_