LevelAsset.h

Engine/source/T3D/assets/LevelAsset.h

More...

Classes:

Public Defines

define

Public Functions

DefineConsoleType(TypeLevelAssetPtr , LevelAsset )

Detailed Description

Public Defines

LEVEL_ASSET_H() 

Public Functions

DefineConsoleType(TypeLevelAssetPtr , LevelAsset )

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