GameObjectAsset.h
Engine/source/T3D/assets/GameObjectAsset.h
Classes:
Public Defines
define
Public Functions
DefineConsoleType(TypeGameObjectAssetPtr , GameObjectAsset )
Detailed Description
Public Defines
GAME_OBJECT_ASSET_H()
Public Functions
DefineConsoleType(TypeGameObjectAssetPtr , GameObjectAsset )
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 GAME_OBJECT_ASSET_H 25#define GAME_OBJECT_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#ifndef _GUI_INSPECTOR_TYPES_H_ 43#include "gui/editor/guiInspectorTypes.h" 44#endif 45 46//----------------------------------------------------------------------------- 47class GameObjectAsset : public AssetBase 48{ 49 typedef AssetBase Parent; 50 51 StringTableEntry mGameObjectName; 52 StringTableEntry mScriptFile; 53 StringTableEntry mTAMLFile; 54 StringTableEntry mScriptPath; 55 StringTableEntry mTAMLPath; 56 57public: 58 GameObjectAsset(); 59 virtual ~GameObjectAsset(); 60 61 /// Engine. 62 static void initPersistFields(); 63 virtual void copyTo(SimObject* object); 64 65 const char* create(); 66 67 /// Declare Console Object. 68 DECLARE_CONOBJECT(GameObjectAsset); 69 70 void setScriptFile(const char* pScriptFile); 71 inline StringTableEntry getScriptFile(void) const { return mScriptFile; }; 72 void setTAMLFile(const char* pScriptFile); 73 inline StringTableEntry getTAMLFile(void) const { return mTAMLFile; }; 74 75protected: 76 virtual void initializeAsset(void); 77 virtual void onAssetRefresh(void); 78 79 static bool setScriptFile(void *obj, const char *index, const char *data) { static_cast<GameObjectAsset*>(obj)->setScriptFile(data); return false; } 80 static const char* getScriptFile(void* obj, const char* data) { return static_cast<GameObjectAsset*>(obj)->getScriptFile(); } 81 static bool setTAMLFile(void *obj, const char *index, const char *data) { static_cast<GameObjectAsset*>(obj)->setTAMLFile(data); return false; } 82 static const char* getTAMLFile(void* obj, const char* data) { return static_cast<GameObjectAsset*>(obj)->getTAMLFile(); } 83 84 inline StringTableEntry getScriptFilePath(void) const { return mScriptPath; }; 85 inline StringTableEntry getTAMLFilePath(void) const { return mTAMLPath; }; 86}; 87 88DefineConsoleType(TypeGameObjectAssetPtr, GameObjectAsset) 89 90 91//----------------------------------------------------------------------------- 92// TypeAssetId GuiInspectorField Class 93//----------------------------------------------------------------------------- 94class GuiInspectorTypeGameObjectAssetPtr : public GuiInspectorField 95{ 96 typedef GuiInspectorField Parent; 97public: 98 99 GuiButtonCtrl *mGameObjectEditButton; 100 101 DECLARE_CONOBJECT(GuiInspectorTypeGameObjectAssetPtr); 102 static void consoleInit(); 103 104 virtual GuiControl* constructEditControl(); 105 virtual bool updateRects(); 106}; 107 108#endif // _ASSET_BASE_H_ 109 110