From 1ac21d4a67ddd211fda841aa6e368bc2cf52a3d6 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Mon, 18 Aug 2025 12:56:13 -0400 Subject: Validate that nodes in game files are used You can now also list out nodes that you are explicitly not mapping out. The current state of the repo does produce some warnings when the validator is run and they're either endings, paintings that I'm not sure what to do with yet, and weird proxy stuff I'm not sure how to handle yet. --- tools/util/godot_scene.h | 67 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 tools/util/godot_scene.h (limited to 'tools/util/godot_scene.h') diff --git a/tools/util/godot_scene.h b/tools/util/godot_scene.h new file mode 100644 index 0000000..529e38e --- /dev/null +++ b/tools/util/godot_scene.h @@ -0,0 +1,67 @@ +#ifndef TOOLS_UTIL_TSCN_H_ +#define TOOLS_UTIL_TSCN_H_ + +#include + +#include +#include +#include +#include +#include + +namespace com::fourisland::lingo2_archipelago { + +struct GodotExtResource { + std::string type; + std::string path; +}; + +struct GodotExtResourceRef { + std::string id; +}; + +using GodotInstanceType = std::variant; + +class GodotNode { + public: + GodotNode(std::string name, GodotInstanceType instance_type) + : name_(std::move(name)), instance_type_(std::move(instance_type)) {} + + const std::string& GetName() const { return name_; } + + const GodotInstanceType& GetInstanceType() const { return instance_type_; } + + const GodotNode* GetParent() const { return parent_; } + GodotNode* GetParent() { return parent_; } + + std::string GetPath() const; + + void AddChild(GodotNode& child); + + const GodotNode* GetNode(absl::string_view path) const; + GodotNode* GetNode(absl::string_view path); + + const std::map GetChildren() const { + return children_; + } + + private: + std::string name_; + GodotInstanceType instance_type_; + + GodotNode* parent_ = nullptr; + std::map children_; +}; + +class GodotScene { + public: + virtual const GodotExtResource* GetExtResource( + const std::string& id) const = 0; + virtual const GodotNode& GetRoot() const = 0; +}; + +std::unique_ptr ReadGodotSceneFromFile(const std::string& path); + +} // namespace com::fourisland::lingo2_archipelago + +#endif /* TOOLS_UTIL_TSCN_H_ */ -- cgit 1.4.1