BsScriptInspectorUtility.h 1.6 KB

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