stateMachineAsset.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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 STATE_MACHINE_ASSET_H
  24. #define STATE_MACHINE_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. #include "gui/editor/guiInspectorTypes.h"
  38. //-----------------------------------------------------------------------------
  39. class StateMachineAsset : public AssetBase
  40. {
  41. typedef AssetBase Parent;
  42. StringTableEntry mStateMachineFile;
  43. StringTableEntry mStateMachinePath;
  44. public:
  45. StateMachineAsset();
  46. virtual ~StateMachineAsset();
  47. /// Engine.
  48. static void initPersistFields();
  49. void copyTo(SimObject* object) override;
  50. /// Declare Console Object.
  51. DECLARE_CONOBJECT(StateMachineAsset);
  52. void setStateMachineFile(const char* pStateMachineFile);
  53. inline StringTableEntry getStateMachineFile(void) const { return mStateMachineFile; };
  54. inline StringTableEntry getStateMachinePath(void) const { return mStateMachinePath; };
  55. protected:
  56. void initializeAsset(void) override;
  57. void onAssetRefresh(void) override;
  58. static bool setStateMachineFile(void *obj, const char *index, const char *data) { static_cast<StateMachineAsset*>(obj)->setStateMachineFile(data); return false; }
  59. static const char* getStateMachineFile(void* obj, const char* data) { return static_cast<StateMachineAsset*>(obj)->getStateMachineFile(); }
  60. };
  61. DefineConsoleType(TypeStateMachineAssetPtr, StateMachineAsset)
  62. #ifdef TORQUE_TOOLS
  63. //-----------------------------------------------------------------------------
  64. // TypeAssetId GuiInspectorField Class
  65. //-----------------------------------------------------------------------------
  66. class GuiInspectorTypeStateMachineAssetPtr : public GuiInspectorTypeFileName
  67. {
  68. typedef GuiInspectorTypeFileName Parent;
  69. public:
  70. GuiBitmapButtonCtrl *mSMEdButton;
  71. DECLARE_CONOBJECT(GuiInspectorTypeStateMachineAssetPtr);
  72. static void consoleInit();
  73. GuiControl* constructEditControl() override;
  74. bool updateRects() override;
  75. };
  76. #endif
  77. #endif