diff options
author | rtk0c <[email protected]> | 2022-06-03 22:58:28 -0700 |
---|---|---|
committer | rtk0c <[email protected]> | 2022-06-03 22:58:28 -0700 |
commit | 8510a85f79f706b93982b4e398b187b5f77081dd (patch) | |
tree | 996c27f54f748d940f58454f7ef1e1570d1a31d5 /source/30-game/Ires.hpp | |
parent | bd07ae3f4e1bcdedc3e373460671ca9713a03de5 (diff) |
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.
Diffstat (limited to 'source/30-game/Ires.hpp')
-rw-r--r-- | source/30-game/Ires.hpp | 34 |
1 files changed, 21 insertions, 13 deletions
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 <MacrosCodegen.hpp> +#include <RcPtr.hpp> +#include <Uid.hpp> +#include <Utils.hpp> #include <rapidjson/fwd.h> #include <robin_hood.h> @@ -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<IresObject> 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 <generated/Ires.gh.inl> |