17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 05:09:20 +02:00

Editor terrain: texture browser, undo, conversion from terrain files

- Terrain work mode shows a browser of the textures folder in place of the
  node bank; textures/materials can be dragged onto the palette entries
  (replacing the material), the material field and the water material field
- Ctrl+Z/Ctrl+Y for heightmap terrain changes: a brush stroke or an
  operation is one step of the editor history
- Ground conversion reads only the files of the terrain directives
  (.txtf with origin/rotate, or .btf without text), paints the chunks with
  the materials of the triangles, drops only the shapes of those files
- Fix: ground grids converted out-of-range floats to int, so whole-scene
  queries returned the triangles of a single cell (shifted chunks)
- Fix: terrain layers copied from textures already uploaded without their
  data stayed grey
- Fix: ImGui ID conflict between terrain tool radios and section headers
- Fix: layers of terrain .txtf files named with the scenery/ prefix and
  could not be saved
- Editor selftest commands for the terrain
This commit is contained in:
2026-10-09 23:39:26 +02:00
parent 5716bc1669
commit 8cd0bab27b
21 changed files with 1211 additions and 145 deletions

View File

@@ -128,6 +128,13 @@ class editor_ui : public ui_layer
void set_workspace(workspace const Workspace)
{
m_workspace = Workspace;
auto const &bank{m_workspacebank[static_cast<std::size_t>(Workspace)]};
m_nodebankpanel.stand_in(bank.first, bank.second);
}
// content of the window of the node bank while the field of work is chosen, in place of the node bank
void set_workspace_bank(workspace const Workspace, std::function<void()> Content, std::string Title)
{
m_workspacebank[static_cast<std::size_t>(Workspace)] = {std::move(Content), std::move(Title)};
}
void set_workspace_options(workspace const Workspace, std::function<void()> Tools, std::function<void()> Selection = {})
{
@@ -205,6 +212,7 @@ class editor_ui : public ui_layer
workspace m_workspace{workspace::none};
std::array<std::function<void()>, static_cast<std::size_t>(workspace::count_)> m_workspacetools;
std::array<std::function<void()>, static_cast<std::size_t>(workspace::count_)> m_workspaceselection;
std::array<std::pair<std::function<void()>, std::string>, static_cast<std::size_t>(workspace::count_)> m_workspacebank;
// scene window: the models of the scenery by layer and group, rebuilt when their number changes
struct scene_entry
{