BsScriptInspectorUtility.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsScriptEditorPrerequisites.h"
  5. #include "BsScriptObject.h"
  6. namespace BansheeEngine
  7. {
  8. /**
  9. * @brief Interop class between C++ & CLR that deals with custom inspectors. Custom inspectors
  10. * allow the developer to control exactly how certain types are displayed in the inspector
  11. * window in the editor.
  12. */
  13. class BS_SCR_BED_EXPORT ScriptInspectorUtility : public ScriptObject<ScriptInspectorUtility>
  14. {
  15. public:
  16. SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "InspectorUtility");
  17. /**
  18. * @brief Hooks up domain reload callback. Must be called on library load.
  19. */
  20. static void startUp();
  21. /**
  22. * @brief Destroys domain reload callback. Must be called before library is unloaded.
  23. */
  24. static void shutDown();
  25. private:
  26. ScriptInspectorUtility(MonoObject* instance);
  27. /**
  28. * @brief Reloads all assembly types and attempts to find uses of CustomInspector attribute. Old
  29. * data cleared and replaced with new.
  30. */
  31. static void reloadAssemblyData();
  32. static MonoClass* mCustomInspectorAtribute;
  33. static MonoField* mTypeField;
  34. static UnorderedMap<MonoClass*, MonoClass*> mInspectorTypes;
  35. static UnorderedMap<MonoClass*, MonoClass*> mInspectableFieldTypes;
  36. static HEvent mDomainLoadedConn;
  37. /************************************************************************/
  38. /* CLR HOOKS */
  39. /************************************************************************/
  40. static MonoObject* internal_GetCustomInspector(MonoReflectionType* reflType);
  41. static MonoReflectionType* internal_GetCustomInspectable(MonoReflectionType* reflType);
  42. };
  43. }