17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-26 19:24:54 +01:00
Files
maszyna/application/editortool.h
maj00r 3c9c90b468 refactor(editor): the structure gauge is a tool of its own
The first step of taking the tools out of editor_mode: a tool keeps its
own state and reaches the editor through editor_services, the few things
it needs from it, instead of through every member of the editor. The
editor holds its tools in a list for the hooks they share: a deleted
node is forgotten by all of them in one place, and a self-test command
the editor doesn't know goes to each of them.

The gauge moves with its state, its window and its self-test command;
the ImGui ids and the texts stay the same, and the self-test gives the
same hits on the test scenery as before.
2026-10-21 09:00:59 +02:00

53 lines
1.1 KiB
C++

/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
distributed with this file, You can
obtain one at
http://mozilla.org/MPL/2.0/.
*/
#pragma once
#include <cstddef>
#include <sstream>
#include <string>
#include <glm/glm.hpp>
class TTrack;
namespace scene
{
class basic_node;
}
enum class editor_selftest_result
{
unhandled,
handled,
pause
};
class editor_services
{
public:
virtual TTrack *selected_track() const = 0;
virtual bool track_editing() const = 0;
virtual std::size_t history_size() const = 0;
virtual glm::dvec3 camera_position() const = 0;
virtual void fly_to(glm::dvec3 const &Target, glm::dvec3 const &Look, double const Distance, double const Duration = 0.6) = 0;
protected:
~editor_services() = default;
};
class editor_tool
{
public:
virtual ~editor_tool() = default;
virtual void update() {}
virtual void render_windows() {}
virtual void forget(scene::basic_node const *Node) {}
virtual editor_selftest_result selftest(std::string const &Command, std::istringstream &Words) { return editor_selftest_result::unhandled; }
};