Skip to content

Commit 8b6723b

Browse files
committed
Rename map_editor classes to visual_registry_editor
It doesn't seem specific to maps. Since it's expected a lot of the functionality will be reused for archetype and pose editors, its name should reflect this.
1 parent e0e62b0 commit 8b6723b

23 files changed

Lines changed: 304 additions & 301 deletions

lmeditor/CMakeLists.txt

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,25 +42,25 @@ add_library(
4242

4343
src/controller/viewport/viewport.cpp
4444

45-
src/controller/map_editor/map_editor_controller.cpp
46-
src/controller/map_editor/move_selection.cpp
47-
src/controller/map_editor/viewport_commands.cpp
48-
src/controller/map_editor/move_selection_commands.cpp
49-
50-
src/controller/map_editor/states/add_adjacent.cpp
51-
src/controller/map_editor/states/translate.cpp
52-
src/controller/map_editor/states/select.cpp
53-
src/controller/map_editor/states/copy_object.cpp
54-
src/controller/map_editor/states/scale.cpp
55-
src/controller/map_editor/states/rotate.cpp
56-
src/controller/map_editor/states/reparent.cpp
45+
src/controller/visual_registry_editor/visual_registry_controller.cpp
46+
src/controller/visual_registry_editor/move_selection.cpp
47+
src/controller/visual_registry_editor/viewport_commands.cpp
48+
src/controller/visual_registry_editor/move_selection_commands.cpp
49+
50+
src/controller/visual_registry_editor/states/add_adjacent.cpp
51+
src/controller/visual_registry_editor/states/translate.cpp
52+
src/controller/visual_registry_editor/states/select.cpp
53+
src/controller/visual_registry_editor/states/copy_object.cpp
54+
src/controller/visual_registry_editor/states/scale.cpp
55+
src/controller/visual_registry_editor/states/rotate.cpp
56+
src/controller/visual_registry_editor/states/reparent.cpp
5757

5858
src/controller/entity_list/entity_list_controller.cpp
5959

6060
src/controller/inspector/inspector_controller.cpp
6161

62-
src/component/map_editor/rendering.cpp
63-
src/component/map_editor/map_editor_component.cpp
62+
src/component/visuial_registry_editor/rendering.cpp
63+
src/component/visuial_registry_editor/visual_registry_editor.cpp
6464

6565
src/component/inspector/inspector_component.cpp
6666

@@ -157,8 +157,8 @@ add_executable(
157157

158158
test/test_lmeditor.cpp
159159
test/test_trimesh.cpp
160-
test/map_editor/test.cpp
161-
test/map_editor/test_move_selection.cpp
160+
test/visual_registry_editor/test.cpp
161+
test/visual_registry_editor/test_move_selection.cpp
162162
test/test_entity_list.cpp
163163
)
164164

lmeditor/include/lmeditor/component/map_editor.h renamed to lmeditor/include/lmeditor/component/visual_registry_editor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace lmeditor
99
{
10-
struct map_editor_init
10+
struct visual_registry_editor_init
1111
{
1212
entt::registry &registry;
1313
orbital_camera_init camera_init;

lmeditor/src/app/app.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
#include <lmeditor/component/asset_list.h>
44
#include <lmeditor/component/command_help.h>
55
#include <lmeditor/component/entity_list.h>
6-
#include <lmeditor/component/map_editor.h>
76
#include <lmeditor/component/player.h>
87
#include <lmeditor/component/saver.h>
8+
#include <lmeditor/component/visual_registry_editor.h>
99
#include <lmeditor/model/orbital_camera.h>
1010
#include <lmlib/variant_visitor.h>
1111
#include <lmng/animation.h>
@@ -75,7 +75,7 @@ editor_app::editor_app(const std::filesystem::path &project_dir)
7575
window_size.height,
7676
};
7777

78-
auto map_editor = map_editor_init{
78+
auto map_editor = visual_registry_editor_init{
7979
.registry = map,
8080
.camera_init =
8181
orbital_camera_init{

lmeditor/src/app/app.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include <boost/dll/shared_library.hpp>
44
#include <filesystem>
55
#include <lmeditor/component/inspector.h>
6-
#include <lmeditor/component/map_editor.h>
6+
#include <lmeditor/component/visual_registry_editor.h>
77
#include <lmeditor/model/trimesh.h>
88
#include <lmeditor/project_plugin.h>
99
#include <lmeditor/simulation_plugin.h>

lmeditor/src/component/map_editor/rendering.cpp renamed to lmeditor/src/component/visuial_registry_editor/rendering.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "../../model/trimesh/util.h"
2-
#include "map_editor_component.h"
2+
#include "visual_registry_editor.h"
33

44
#include <Resource.h>
55
#include <lmeditor/model/selection.h>
@@ -18,15 +18,15 @@ struct selection_ubuffer_data
1818
namespace lmeditor
1919
{
2020
lmgl::buffer
21-
map_editor_component::create_selection_ubuffer(lmgl::irenderer *renderer)
21+
visual_registry_editor::create_selection_ubuffer(lmgl::irenderer *renderer)
2222
{
2323
return renderer->create_buffer(lmgl::buffer_init{
2424
.usage = lmgl::render_buffer_usage::uniform,
2525
.data = {nullptr, sizeof(selection_ubuffer_data)},
2626
});
2727
}
2828

29-
lmgl::material map_editor_component::create_selection_stencil_material(
29+
lmgl::material visual_registry_editor::create_selection_stencil_material(
3030
lmgl::irenderer *renderer)
3131
{
3232
return renderer->create_material(lmgl::material_init{
@@ -43,7 +43,7 @@ lmgl::material map_editor_component::create_selection_stencil_material(
4343
}
4444

4545
lmgl::material
46-
map_editor_component::create_outline_material(lmgl::irenderer *renderer)
46+
visual_registry_editor::create_outline_material(lmgl::irenderer *renderer)
4747
{
4848
return renderer->create_material(lmgl::material_init{
4949
.vshader_spirv = lm::raw_array_proxy(stencil_vshader_data),
@@ -61,7 +61,7 @@ lmgl::material
6161
});
6262
}
6363

64-
void map_editor_component::render_selection_outline(
64+
void visual_registry_editor::render_selection_outline(
6565
lmgl::iframe *frame,
6666
entt::registry const &map) const
6767
{
@@ -99,7 +99,7 @@ void map_editor_component::render_selection_outline(
9999
frame->add({selection_outline_geometry.get()}, viewport);
100100
}
101101

102-
void map_editor_component::render_state_text(lmgl::iframe *frame)
102+
void visual_registry_editor::render_state_text(lmgl::iframe *frame)
103103
{
104104
state_text_layout.render(frame, position, size);
105105
}

lmeditor/src/component/map_editor/map_editor_component.cpp renamed to lmeditor/src/component/visuial_registry_editor/visual_registry_editor.cpp

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "map_editor_component.h"
1+
#include "visual_registry_editor.h"
22
#include <fmt/format.h>
33
#include <lmhuv/box.h>
44
#include <lmlib/enumerate.h>
@@ -8,12 +8,13 @@
88

99
namespace lmeditor
1010
{
11-
component map_editor_init::operator()()
11+
component visual_registry_editor_init::operator()()
1212
{
13-
return std::make_unique<map_editor_component>(*this);
13+
return std::make_unique<visual_registry_editor>(*this);
1414
}
1515

16-
map_editor_component::map_editor_component(map_editor_init const &init)
16+
visual_registry_editor::visual_registry_editor(
17+
visual_registry_editor_init const &init)
1718
: controller{init.registry, init.camera_init},
1819
visual_view{
1920
lmhuv::create_visual_view(lmhuv::visual_view_init{
@@ -32,7 +33,7 @@ map_editor_component::map_editor_component(map_editor_init const &init)
3233
.resource_cache = init.resource_cache,
3334
.colour = state_text_colour,
3435
.position = init.position + state_text_position,
35-
.text = map_editor_controller::select_state::label,
36+
.text = visual_registry_controller::select_state::label,
3637
}},
3738
selection_outline_colour{init.selection_outline_colour},
3839
position{init.position},
@@ -56,7 +57,7 @@ map_editor_component::map_editor_component(map_editor_init const &init)
5657
selection_outline_geometry->set_line_width(6.f);
5758
}
5859

59-
lmgl::geometry map_editor_component::create_box_geometry(
60+
lmgl::geometry visual_registry_editor::create_box_geometry(
6061
lmgl::irenderer *renderer,
6162
lmgl::material box_material,
6263
lmgl::ibuffer *ubuffer)
@@ -74,7 +75,7 @@ lmgl::geometry map_editor_component::create_box_geometry(
7475
return geometry;
7576
}
7677

77-
void map_editor_component::set_state_text(
78+
void visual_registry_editor::set_state_text(
7879
lmgl::irenderer *renderer,
7980
std::string new_text,
8081
lmgl::resource_sink &resource_sink,
@@ -84,7 +85,7 @@ void map_editor_component::set_state_text(
8485
*renderer, resource_cache.body_font.get(), new_text, resource_sink);
8586
}
8687

87-
component_interface &map_editor_component::update(
88+
component_interface &visual_registry_editor::update(
8889
lmgl::irenderer *renderer,
8990
lmgl::resource_sink &resource_sink,
9091
lmtk::resource_cache const &resource_cache,
@@ -97,7 +98,7 @@ component_interface &map_editor_component::update(
9798
return *this;
9899
}
99100

100-
bool map_editor_component::add_to_frame(lmgl::iframe *frame)
101+
bool visual_registry_editor::add_to_frame(lmgl::iframe *frame)
101102
{
102103
visual_view->add_to_frame(
103104
*controller.map, frame, lmgl::viewport{position, size});
@@ -107,7 +108,7 @@ bool map_editor_component::add_to_frame(lmgl::iframe *frame)
107108
}
108109

109110
lmtk::widget_interface &
110-
map_editor_component::move_resources(lmgl::resource_sink &resource_sink)
111+
visual_registry_editor::move_resources(lmgl::resource_sink &resource_sink)
111112
{
112113
resource_sink.add(
113114
selection_stencil_material,
@@ -123,8 +124,8 @@ lmtk::widget_interface &
123124
return *this;
124125
}
125126

126-
map_editor_component &
127-
map_editor_component::set_rect(lm::point2i pos, lm::size2i size)
127+
visual_registry_editor &
128+
visual_registry_editor::set_rect(lm::point2i pos, lm::size2i size)
128129
{
129130
position = pos;
130131
this->size = size;
@@ -133,16 +134,16 @@ map_editor_component &
133134
return *this;
134135
}
135136

136-
lm::size2i map_editor_component::get_size() { return size; }
137+
lm::size2i visual_registry_editor::get_size() { return size; }
137138

138-
lm::point2i map_editor_component::get_position() { return position; }
139+
lm::point2i visual_registry_editor::get_position() { return position; }
139140

140-
bool map_editor_component::handle(const lmtk::input_event &input_event)
141+
bool visual_registry_editor::handle(const lmtk::input_event &input_event)
141142
{
142143
return controller.handle(input_event);
143144
}
144145
std::vector<command_description>
145-
map_editor_component::get_command_descriptions()
146+
visual_registry_editor::get_command_descriptions()
146147
{
147148
return controller.get_command_descriptions();
148149
}

lmeditor/src/component/map_editor/map_editor_component.h renamed to lmeditor/src/component/visuial_registry_editor/visual_registry_editor.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#pragma once
22

3-
#include "../../controller/map_editor/map_editor_controller.h"
3+
#include "../../controller/visual_registry_editor/visual_registry_controller.h"
44
#include <chrono>
55
#include <entt/entt.hpp>
66
#include <filesystem>
77
#include <lmeditor/component/command_help.h>
8-
#include <lmeditor/component/map_editor.h>
8+
#include <lmeditor/component/visual_registry_editor.h>
99
#include <lmgl/lmgl.h>
1010
#include <lmhuv.h>
1111
#include <lmlib/variant_visitor.h>
@@ -20,12 +20,12 @@
2020

2121
namespace lmeditor
2222
{
23-
class map_editor_component : public component_interface
23+
class visual_registry_editor : public component_interface
2424
{
2525
public:
26-
explicit map_editor_component(map_editor_init const &init);
27-
map_editor_component(map_editor_component const &) = delete;
28-
map_editor_component(map_editor_component &&) = delete;
26+
explicit visual_registry_editor(visual_registry_editor_init const &init);
27+
visual_registry_editor(visual_registry_editor const &) = delete;
28+
visual_registry_editor(visual_registry_editor &&) = delete;
2929

3030
component_interface &update(
3131
lmgl::irenderer *renderer,
@@ -38,7 +38,7 @@ class map_editor_component : public component_interface
3838
widget_interface &
3939
move_resources(lmgl::resource_sink &resource_sink) override;
4040

41-
map_editor_component &set_rect(lm::point2i pos, lm::size2i size) override;
41+
visual_registry_editor &set_rect(lm::point2i pos, lm::size2i size) override;
4242
lm::size2i get_size() override;
4343
lm::point2i get_position() override;
4444
std::vector<command_description> get_command_descriptions() override;
@@ -68,7 +68,7 @@ class map_editor_component : public component_interface
6868
lmgl::buffer create_selection_ubuffer(lmgl::irenderer *renderer);
6969
lmgl::material create_outline_material(lmgl::irenderer *renderer);
7070

71-
map_editor_controller controller;
71+
visual_registry_controller controller;
7272
lmhuv::pvisual_view visual_view;
7373
lmgl::material selection_stencil_material, selection_outline_material;
7474
lmgl::buffer box_vpositions, box_vnormals, box_indices;

lmeditor/src/controller/map_editor/states/reparent.cpp

Lines changed: 0 additions & 46 deletions
This file was deleted.

lmeditor/src/controller/map_editor/move_selection.cpp renamed to lmeditor/src/controller/visual_registry_editor/move_selection.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "map_editor_controller.h"
1+
#include "visual_registry_controller.h"
22

33
#include <range/v3/algorithm/min_element.hpp>
44

@@ -7,7 +7,7 @@
77

88
namespace lmeditor
99
{
10-
entt::entity map_editor_controller::nearest_entity(
10+
entt::entity visual_registry_controller::nearest_entity(
1111
entt::registry const &map,
1212
entt::entity entity,
1313
const Eigen::Vector3f &direction)
@@ -44,7 +44,7 @@ entt::entity map_editor_controller::nearest_entity(
4444
return nearest_entity;
4545
}
4646

47-
entt::entity map_editor_controller::farthest_entity(
47+
entt::entity visual_registry_controller::farthest_entity(
4848
entt::registry const &map,
4949
const Eigen::Vector3f &direction)
5050
{
@@ -72,7 +72,7 @@ entt::entity map_editor_controller::farthest_entity(
7272
return farthest;
7373
}
7474

75-
bool map_editor_controller::move_selection(
75+
bool visual_registry_controller::move_selection(
7676
entt::registry const &map,
7777
Eigen::Vector3f const &direction)
7878
{
@@ -95,14 +95,14 @@ bool map_editor_controller::move_selection(
9595
return true;
9696
}
9797

98-
bool map_editor_controller::move_selection_view(
98+
bool visual_registry_controller::move_selection_view(
9999
entt::registry const &map,
100100
const Eigen::Vector3f &view_axis)
101101
{
102102
return move_selection(map, lm::snap_to_axis(camera.rotation * view_axis));
103103
}
104104

105-
void map_editor_controller::set_map(const entt::registry &registry)
105+
void visual_registry_controller::set_map(const entt::registry &registry)
106106
{
107107
state.emplace<select_state>(*this);
108108
clear_selection();

0 commit comments

Comments
 (0)