Cogs.Core
LoadRvmCommand.h
1#pragma once
2#include "Commands/EditorCommand.h"
3#include "Services/Variables.h"
4#include "Services//PropertiesManager.h"
5
6namespace Cogs::Core {
7
8 struct ModelLoadInfo;
9
11 {
12 LoadRvmCommand(EditorState* state, const StringView& path, bool openInRoot, bool synchronous);
13
14 void apply() override {}
15 void undo() override {}
16 void beginModal() override;
17 void showGui() override;
18 bool continueModal() override;
19
20 // Load the file from path with the current options, can be called non-modal as well
21 void loadFile();
22
23 private:
24 bool modal = false;
25 std::string pathStr;
26 std::string fileName;
27 bool openInRoot = false;
28 bool synchronous = false;
29
30 // Rvmparser options
31
33 {
34 virtual void addPropertyTo(PropertyStore* store) = 0;
35 };
36
37 template<typename T>
39 {
40 RvmparserOption() = default;
41 RvmparserOption(StringView aKey, T aValue) : key(aKey), value(aValue) { }
42 void addPropertyTo(PropertyStore* store) override { store->addProperty(key, value); }
43 StringView key;
44 T value;
45 };
46
47 std::vector<RvmparserOptionBase*> allOptions;
48
49 template<typename T>
50 void createOption(RvmparserOption<T>& out, StringView name, T value) {
51 // Get the initial value from Cogs Variables, if set previously
52 out = RvmparserOption<T>(name, context->variables->get(name, value));
53 allOptions.push_back(&out);
54 }
55
56 RvmparserOption<bool> rvmMdb2;
57 RvmparserOption<bool> rvmMdb2GuessHierarchy;
58 RvmparserOption<bool> rvmInheritAttributes;
59
60 RvmparserOption<float> rvmTessellateTolerance;
61 RvmparserOption<float> rvmTessellateFeatureAngle;
62 RvmparserOption<float> rvmTessellateCullDiameter;
63
64 RvmparserOption<bool> rvmParseColorize;
65 RvmparserOption<bool> rvmParseIgnoreAttributeIndentation;
66 RvmparserOption<bool> rvmParseIgnoreAttributeHierarchy;
67 RvmparserOption<bool> rvmParseAllowReparent;
68
69 RvmparserOption<bool> rvmVueExperimental;
70 };
71}
std::unique_ptr< class Variables > variables
Variables service instance.
Definition: Context.h:180
Provides a weakly referenced view over the contents of a string.
Definition: StringView.h:24
Contains the Engine, Renderer, resource managers and other systems needed to run Cogs....
void showGui() override
Display custom ImGUI.
bool continueModal() override
Shall return true while the GUI should still be shown. False when.
void beginModal() override
Called when the command is initiated.
void apply() override
Run the command.
Abstract base class for all editor commands showing GUI in interactive mode.
Definition: EditorCommand.h:40