From 8510a85f79f706b93982b4e398b187b5f77081dd Mon Sep 17 00:00:00 2001 From: rtk0c Date: Fri, 3 Jun 2022 22:58:28 -0700 Subject: Changeset: 61 [BUGGED] Move object kind enums to use generated ToString and FromStrong The old mechanism rely on a specific prefix to Ires and GameObject string representations, but the generator currently leaves the enum value. Therefore all editor (e.g. drag & drop) and IO (e.g. ires loading) mechanisms are broken. --- source/30-game/Ires.hpp | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) (limited to 'source/30-game/Ires.hpp') diff --git a/source/30-game/Ires.hpp b/source/30-game/Ires.hpp index 83ca175..b6420f3 100644 --- a/source/30-game/Ires.hpp +++ b/source/30-game/Ires.hpp @@ -2,9 +2,11 @@ #include "EditorAttachment.hpp" #include "EditorCore.hpp" -#include "RcPtr.hpp" -#include "Uid.hpp" -#include "Utils.hpp" + +#include +#include +#include +#include #include #include @@ -17,18 +19,24 @@ class IresManager; class IresWritingContext; class IresLoadingContext; +namespace Tags { +enum class IresObjectKind { + KD_Texture, + KD_Shader, + KD_Material, + KD_SpriteFiles, + KD_Spritesheet, + KD_COUNT, +}; +BRUSSEL_ENUM(IresObjectKind, ToString FromString ExcludeHeuristics); +} // namespace Tags + class IresObject : public RefCounted { friend class IresManager; public: - enum Kind { - KD_Texture, - KD_Shader, - KD_Material, - KD_SpriteFiles, - KD_Spritesheet, - KD_COUNT, - }; + using Kind = Tags::IresObjectKind; + using enum Tags::IresObjectKind; private: std::string mName; // Serialized as filename @@ -41,8 +49,6 @@ public: IresObject(Kind kind); virtual ~IresObject() = default; - static std::string_view ToString(Kind kind); - static Kind FromString(std::string_view name); static std::unique_ptr Create(Kind kind); Kind GetKind() const { return mKind; } @@ -115,3 +121,5 @@ public: const auto& GetObjects() const { return mObjByUid; } virtual IresObject* FindIres(const Uid& uid) const override; }; + +#include -- cgit v1.2.3-70-g09d2