Nebula
Loading...
Searching...
No Matches
navmeshdocument.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
21//------------------------------------------------------------------------------
22#if WITH_NEBULA_EDITOR
23#include "editorassets/assetdocument.h"
26
27namespace NavigationFeature
28{
29
30class NavMeshDocument final : public Editor::AssetDocument
31{
33public:
35 virtual ~NavMeshDocument();
36
38 void Draw() override;
40 bool CanSave() const override;
41
43 static void OpenAsset(const IO::Path& asset);
45 static bool CreateAsset(const IO::Path& asset, const IO::URI& workFile, const Util::String& variant, Util::String& outError);
47 static Util::String OpenAgentKind();
49 Resources::ResourceId GetPreview() const;
50
52 void ApplyDescription(const Util::Blob& description);
55 void GatherEntities(const Util::Array<Game::Entity>& entities, bool replaceAll);
57 bool Bake();
58
59protected:
60 bool OnOpen() override;
61 void OnClose() override;
62 bool OnSave(Util::String& outError) override;
63 void OnRevert() override;
64
65private:
67 struct SkippedEntity
68 {
69 Util::String name;
70 Util::String reason;
71 };
72
74 bool LoadDescription(Util::String& outError);
76 void ResetDescription();
78 void Commit(const char* name);
80 void GatherAgain();
82 void GatherAreaVolumes();
84 Game::Entity FindNavMeshEntity() const;
86 void PlaceInScene();
88 void UpdatePreview();
89 void DiscardPreview();
90 void SetStatus(bool error, const Util::String& status);
91
92 void DrawSettings();
93 void DrawSources();
94 void DrawBake();
95
96 Navigation::NavMeshT description;
98 Util::Blob committed;
99
100 NavMeshGatherOptions options;
102 Util::String status;
103 bool statusIsError;
105 bool baking;
106 Resources::ResourceId preview;
107};
108
109} // namespace NavigationFeature
110#endif // WITH_NEBULA_EDITOR
111//------------------------------------------------------------------------------
A path is an abstraction around file paths.
Definition path.h:26
An URI object can split a Uniform Resource Identifier string into its components or build a string fr...
Definition uri.h:67
A navmesh open in the asset editor: the agent it is baked for, the build settings,...
Nebula's dynamic array class.
Definition array.h:61
The Util::Blob class encapsulates a chunk of raw memory into a C++ object which can be copied,...
Definition blob.h:22
Nebula's universal string class.
Definition string.h:50
Queries on a loaded navmesh.
Definition agentmanager.cc:30
What a scene gives a navmesh: the geometry of its entities, and its area volumes.
#define __DeclareClass(type)
An entity is essentially just an Id with some utility functions attached.
Definition entity.h:35