Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ if(NOT DEFINED RX_MODULES)
importers
scene
terrain
edit
world
render
ui/imgui
Expand All @@ -304,6 +303,7 @@ if(NOT DEFINED RX_MODULES)
locomotion
ui/ugui
app
editor
)
endif()

Expand Down
28 changes: 8 additions & 20 deletions apps/editor/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
# rx editor: an app::Application on app::Host with its entire UI in rx::ui
# (libultragui in draw-data mode). The ugui backend, platform shim and pipeline
# shaders live in rxe/ui/ugui now, because the engine splash needs them too.

add_executable(rx_editor
main.cc
editor_app.cc
editor_terrain.cc
editor_ui.cc
editor_input.cc)
# The default rx editor: rx::editor (rxe/editor) on app::Host. A game builds its
# own editor the same way, linking its modules next to rx::editor.
add_executable(rx_editor_app main.cc)
# rx_editor is the rx::editor module; the binary keeps the name users run.
set_target_properties(rx_editor_app PROPERTIES OUTPUT_NAME rx_editor)
target_link_libraries(rx_editor_app PRIVATE rx::editor rx::app rx::foundation)
# An engine build: the tiers ship loose beside it, to be edited.
rx_stage_content(rx_editor LOOSE_ENGINE_CONFIG)

target_link_libraries(rx_editor PRIVATE
rx::app rx::ui rx::edit rx::terrain rx::render rx::anim rx::gltf rx::usd rx::blend rx::asset rx::scene rx::ecs rx::window rx::events rx::foundation
# Bake World: the same cook rxworld runs, so an archive from either is the same bytes.
rx::world)

target_compile_definitions(rx_editor PRIVATE
RX_EDITOR_UI_DIR="${CMAKE_CURRENT_SOURCE_DIR}/ui"
RX_BLEND_CONVERTER_SCRIPT="${PROJECT_SOURCE_DIR}/tools/blend_to_glb.py")
rx_stage_content(rx_editor_app LOOSE_ENGINE_CONFIG)
rx_set_warnings(rx_editor_app)
5 changes: 1 addition & 4 deletions apps/editor/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#include <base/option.h>

#include "base/strings/xstring.h"
#include "editor_app.h"
#include "rxe/app/host.h"
#include "rxe/editor/editor_app.h"

int main(int argc, char** argv) {
base::String open_path;
Expand All @@ -15,9 +15,6 @@ int main(int argc, char** argv) {
if (!a.empty() && a[0] != '-') open_path = a;
}

#if defined(RX_SHARED_BUILD)
rx::base::InitOptionsFromEnv();
#endif

rx::app::AppConfig config;
config.id = "xn5ec6v99hcwg9d8xzbqshr0";
Expand Down
2 changes: 1 addition & 1 deletion apps/rxworld/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
add_executable(rxworld main.cc)
target_link_libraries(rxworld PRIVATE rx::world rx::edit rx::asset rx::ecs rx::foundation)
target_link_libraries(rxworld PRIVATE rx::world rx::asset rx::ecs rx::foundation)
rx_set_warnings(rxworld)
4 changes: 2 additions & 2 deletions apps/shell/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ set(RX_RUNTIME_MODULES
rx::blend
rx::scene
# .rxscene text scenes: component reflection + the text loader.
rx::edit

# --world: baked worlds streamed around the camera.
rx::world
# --authoring-endpoint / --dump-commands: the live script command surface.
Expand Down Expand Up @@ -125,7 +125,7 @@ endif()
add_library(viewer_scene_authoring STATIC scene_authoring.cc)
target_include_directories(viewer_scene_authoring PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(viewer_scene_authoring PUBLIC
rx::gltf rx::materialx rx::edit rx::scene rx::ecs rx::asset rx::render rx::foundation)
rx::gltf rx::materialx rx::scene rx::ecs rx::asset rx::render rx::foundation)
rx_set_warnings(viewer_scene_authoring)

add_executable(rx main.cc ${RX_RUNTIME_SOURCES})
Expand Down
2 changes: 1 addition & 1 deletion cmake/install.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ set(RX_DEPS_INCDIR ${CMAKE_INSTALL_INCLUDEDIR}/rx-deps)

# rx module targets + export set
set(RX_MODULE_NAMES foundation events window gpu ecs script asset gltf usd materialx blend scene terrain render imgui_renderer render2d physics vehicles locomotion anim audio
weather rpc devtools character inventory inventory_world ui app)
weather rpc devtools character inventory inventory_world ui app world editor)
set(RX_INSTALL_TARGETS)
foreach(_m ${RX_MODULE_NAMES})
# Some modules are conditional (inventory_world only when rx_physics exists);
Expand Down
2 changes: 1 addition & 1 deletion docs/CONFIG.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ reproduces the layout beside build-tree executables, re-copied every build:

```cmake
rx_stage_content(mygame mytool) # Data/ beside both (same directory)
rx_stage_content(rx_editor LOOSE_ENGINE_CONFIG) # engine builds: + rxe/config/
rx_stage_content(rx_editor_app LOOSE_ENGINE_CONFIG) # engine builds: + rxe/config/
add_custom_target(mygame_config ALL COMMAND ${CMAKE_COMMAND} -E
copy_directory_if_different ${CMAKE_CURRENT_SOURCE_DIR}/config $<TARGET_FILE_DIR:mygame>/config)
add_dependencies(mygame mygame_config)
Expand Down
16 changes: 12 additions & 4 deletions docs/STRUCTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,12 @@ rxe/ the engine (Chromium: content/)
world_bake/ offline world baking (tools and the editor link it, games do not)
devtools/ the command bridge and endpoint (rxcall, agents)
app/ Host, Application, AppConfig, platform config, world clock
terrain/ heightfield terrain (the editor edits it, so it is engine)
editor/ the editor itself: selection, undo, panels, editor ui
resources/ everything in rxe://: fonts/, config/

plugins/ optional, enabled per app (Chromium: components/)
character/ combat/ inventory/ locomotion/ placement/ terrain/
character/ combat/ inventory/ locomotion/ placement/
nav/ nav/ + nav_debug/ (the only half that knows the renderer)
replication/ replication/ + replication_debug/
vehicles/ cars, boats, aircraft, kites: physics, profiles, engine audio
Expand Down Expand Up @@ -124,8 +125,10 @@ of that:
`ecs`, `scene`, `script`, `world` or `app`. They work on their own handles, so
they can be tested without an entity world, and `scene`/`app` are the only
places that bind them to entities. This already holds today; the rule keeps it.
- **Nothing depends on `app`.** It is the engine's composition root: the only
module that knows every subsystem, with no feature logic of its own.
- **Nothing depends on `app` except apps and `editor`.** It is the engine's
composition root: the only module that knows every subsystem, with no feature
logic of its own. The editor is the one engine module that is itself an
application (games extend it), so it sits on the host the way an app does.
- **Nothing a shipping game must link depends on `editor`, `world_bake` or
`importers/usd`.** An app gets them only by asking.

Expand Down Expand Up @@ -424,7 +427,12 @@ and after.
local `export.h` workarounds are gone) and ships in the install package.
`RX_PLUGIN`, `PluginRegistry` and `rx_add_app` wait for a plugin that
needs startup registration; none does today.
- 6c: `rxe/editor` and a thin `apps/editor`, per-game editors.
- 6c (done): `rxe/editor` (`rx::editor`: the editor app code plus
selection and undo from `edit`) and `apps/editor`, now a `main.cc`. A
game's editor is its own `main.cc` over `rx::editor`. `terrain` moves
from `plugins/` into `rxe/`: terrain editing is built into the editor, and
an engine module cannot depend on a plugin. It can return to `plugins/`
with its editor mode once the editor has an extension point.
- 6d: `EngineContext` goes away; the demos move to `apps/shell/demos` in
`rx::shell`.
7. **Renderer features.** A separate design note for `RenderFeature`, then split
Expand Down
2 changes: 1 addition & 1 deletion plugins/inventory/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ after any bulk removal so equipped slots referencing vanished items clear.

Inventories and world items serialize to compact, explicit-little-endian blobs
(`byte_io.h`): a 4-byte magic + `u32` version + records. This was chosen over
`rxe/edit/` reflection + `.rxscene` deliberately:
`rxe/scene/` reflection + `.rxscene` deliberately:

- Inventories are **frequently-mutated gameplay state** written to a *game save
file*, not editor scene documents. They want a tiny, stable, self-describing
Expand Down
2 changes: 1 addition & 1 deletion plugins/inventory/serialize.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "foundation/build_config/export.h"

// Compact, versioned, explicit-little-endian persistence for inventories and
// equipment. A self-contained binary blob is used rather than edit::/.rxscene
// equipment. A self-contained binary blob is used rather than editor::/.rxscene
// reflection: inventories are frequently-mutated gameplay state saved to a game
// save file, not editor scene documents, and the blob wants to be stable,
// tiny and independent of the editor module's schema. See the module README for
Expand Down
18 changes: 0 additions & 18 deletions rxe/edit/CMakeLists.txt

This file was deleted.

32 changes: 32 additions & 0 deletions rxe/editor/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# rx::editor: the editor itself, as a library a game links into its own editor
# app (apps/editor is the default one: a main.cc over this module). Editing
# state (undo/redo, selection), the ugui interface, terrain and surface
# placement tools, import and world baking. Reflection, the transform hierarchy
# and .rxscene io live in rx::scene, because a game needs them without the
# editor.
rx_add_module(editor
editor_app.cc
editor_terrain.cc
editor_ui.cc
editor_input.cc
selection.cc
undo.cc
)

target_link_libraries(rx_editor PUBLIC
rx::app rx::ui rx::terrain rx::render rx::anim rx::gltf rx::usd rx::blend rx::asset
rx::scene rx::ecs rx::window rx::events rx::foundation
# Bake World: the same cook rxworld runs, so an archive from either is the same bytes.
rx::world)

target_compile_definitions(rx_editor PRIVATE
RX_EDITOR_UI_DIR="${CMAKE_CURRENT_SOURCE_DIR}/ui"
RX_BLEND_CONVERTER_SCRIPT="${PROJECT_SOURCE_DIR}/tools/blend_to_glb.py")

if(RX_BUILD_TESTS)
# Editing model test: reflection, scene round-trip, undo/redo and hierarchy
# composition. Fully headless (no GPU), so it always runs under plain ctest.
add_executable(edit_test edit_test.cc)
target_link_libraries(edit_test PRIVATE rx::editor rx::scene rx::ecs rx::asset rx::foundation)
add_test(NAME edit_test COMMAND edit_test)
endif()
6 changes: 3 additions & 3 deletions rxe/edit/edit_test.cc → rxe/editor/edit_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
#include "rxe/asset/asset_id.h"
#include "rxe/asset/vfs.h"
#include "rxe/ecs/world.h"
#include "rxe/edit/selection.h"
#include "rxe/edit/undo.h"
#include "rxe/editor/selection.h"
#include "rxe/editor/undo.h"
#include "rxe/scene/components.h"
#include "rxe/scene/hierarchy.h"
#include "rxe/scene/reflect.h"
#include "rxe/scene/scene_io.h"

using namespace rx;
using namespace rx::edit;
using namespace rx::editor;

namespace {

Expand Down
8 changes: 4 additions & 4 deletions apps/editor/editor_app.cc → rxe/editor/editor_app.cc
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ void Editor::OnUpdate(f32 dt) {
if (!ctrl && editor_mode_ == EditorMode::kSelect && over_vp &&
edge(ui::Key::kDelete)) {
if (ecs::Entity e = selection_.primary()) {
undo_.Push(*world_, edit::MakeDestroyEntity(*world_, e));
undo_.Push(*world_, editor::MakeDestroyEntity(*world_, e));
selection_.Clear();
MarkDirty();
doc_dirty_ = true;
Expand Down Expand Up @@ -1099,7 +1099,7 @@ void Editor::UpdateGizmo(f32 mx, f32 my, bool lmb_down, bool lmb_edge) {
const scene::ComponentDesc *comp = scene::FindComponentByName("Transform");
if (comp) {
undo_.Push(*world_,
edit::MakeSetProp(*world_, e, *comp, comp->props[0],
editor::MakeSetProp(*world_, e, *comp, comp->props[0],
scene::PropValue::Vec3(np.x, np.y, np.z)));
doc_dirty_ = true;
}
Expand Down Expand Up @@ -1577,10 +1577,10 @@ void Editor::RunAutopilot() {
selection_.Set(e);
undo_.BeginGroup("Move");
undo_.Push(*world_,
edit::MakeSetProp(*world_, e, *xf, xf->props[0],
editor::MakeSetProp(*world_, e, *xf, xf->props[0],
scene::PropValue::Vec3(-1.2f, 0.55f, 1.0f)));
undo_.Push(*world_,
edit::MakeSetProp(*world_, e, *xf, xf->props[0],
editor::MakeSetProp(*world_, e, *xf, xf->props[0],
scene::PropValue::Vec3(-1.2f, 0.55f, 2.0f)));
undo_.EndGroup();
doc_dirty_ = true;
Expand Down
10 changes: 5 additions & 5 deletions apps/editor/editor_app.h → rxe/editor/editor_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
#include "base/memory/move.h"
#include "base/optional.h"
#include "base/strings/xstring.h"
#include "plugins/terrain/terrain.h"
#include "rxe/edit/selection.h"
#include "rxe/edit/undo.h"
#include "rxe/editor/selection.h"
#include "rxe/editor/undo.h"
#include "rxe/scene/fly_camera.h"
#include "rxe/scene/hierarchy.h"
#include "rxe/scene/reflect.h"
#include "rxe/scene/scene_io.h"
#include "rxe/terrain/terrain.h"
#include "rxe/ui/ugui/ugui_backend.h"
#include "rxe/ui/ugui/ugui_platform.h"
#include "rxe/world/world_bake.h"
Expand Down Expand Up @@ -262,8 +262,8 @@ class Editor final : public app::Application {

// editor state
scene::FlyCamera camera_;
edit::Selection selection_;
edit::UndoStack undo_;
editor::Selection selection_;
editor::UndoStack undo_;
base::Optional<asset::AssetDatabase> assets_; // constructed once vfs is known
GizmoMode gizmo_mode_ = GizmoMode::kTranslate;
EditorMode editor_mode_ = EditorMode::kSelect;
Expand Down
4 changes: 2 additions & 2 deletions apps/editor/editor_input.cc → rxe/editor/editor_input.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "rxe/ui/events/input.h"
#include "rxe/ui/events/input_bindings.h"

namespace rx {
namespace rx::editor {

void RegisterEditorInput(ui::InputMap& map) {
map.RegisterAction(Action::kMoveForward, "move_forward");
Expand Down Expand Up @@ -57,4 +57,4 @@ void RegisterEditorInput(ui::InputMap& map) {
});
}

} // namespace rx
} // namespace rx::editor
4 changes: 2 additions & 2 deletions apps/editor/editor_input.h → rxe/editor/editor_input.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace rx::ui {
class InputMap;
} // namespace rx::ui

namespace rx {
namespace rx::editor {


// The editor's action/axis set. The engine owns no verbs, so the app defines
Expand All @@ -31,6 +31,6 @@ enum class Axis : ui::AxisId { kMoveX, kMoveY, kLookX, kLookY, kCount };

void RegisterEditorInput(ui::InputMap& map);

} // namespace rx
} // namespace rx::editor

#endif // RX_EDITOR_INPUT_H_
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ u32 PackRgba(const base::Array<u8, 4>& color) {
(static_cast<u32>(color[2]) << 8) | color[3];
}

class TerrainCommand final : public edit::Command {
class TerrainCommand final : public editor::Command {
public:
using Refresh = base::Function<void(base::Span<const terrain::TerrainTileKey>)>;

Expand Down Expand Up @@ -452,7 +452,7 @@ void Editor::UpdateModeInteraction(bool lmb_down, bool lmb_edge) {
initial.push_back(
{renderable, {{&renderable->props[0], scene::PropValue::AssetIdV(placement_.mesh.hash)}}});
initial.push_back({name, {{&name->props[0], scene::PropValue::String(placement_.name)}}});
undo_.Push(*world_, edit::MakeCreateEntity(base::move(initial), nullptr));
undo_.Push(*world_, editor::MakeCreateEntity(base::move(initial), nullptr));
doc_dirty_ = true;
MarkDirty();
};
Expand Down
Loading