修复编辑器相机与 game 形态黑屏;中文字体与 Q 选择热键
FPS 式视角合成(yaw 世界轴/pitch 本地轴,永不 roll); RMB 自由视角后环绕 pivot 失效待重建(修 Focus 后 MMB/滚轮 瞬移锁回);SceneRenderer 默认 kDisplayDirect(game 形态 Blit 空转+清屏黑屏根因);swapchain 优先 Opaque 合成; ImGui 加载思源黑体(CJK 常用集);Q=纯选择不出杆; 新增 InputMap 动作映射
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#define HELLOVULKAN_EDITORCONTEXT_H
|
||||
|
||||
#include <Engine/Core/Application.h>
|
||||
#include <Engine/Core/GameFlow.h>
|
||||
#include <Engine/ECS/Scene.h>
|
||||
#include <Engine/Assets/AssetManager.h>
|
||||
#include <Engine/Renderer/Renderer.h>
|
||||
@@ -28,6 +29,8 @@ struct EditorContext {
|
||||
Engine::ECS::Scene *scene = nullptr;
|
||||
Engine::Assets::AssetManager *assets = nullptr;
|
||||
Engine::Application *app = nullptr;
|
||||
// 游戏流状态机(PIE 状态权威;Editor::Init 注册快照/恢复监听)
|
||||
Engine::GameFlow *flow = nullptr;
|
||||
// 编辑器相机(Scene view 专用,归 Renderer 持有——与场景相机实体
|
||||
// 无关;面板经此做 F 焦点/Gizmo 视图/对齐跳转)
|
||||
Engine::EditorCamera *editorCamera = nullptr;
|
||||
|
||||
@@ -220,12 +220,12 @@ std::optional<entt::entity> ViewportPanel::Draw(const EditorContext &ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// ---- 工具热键(UE 语义):W/E/R 切 Gizmo 模式、T 切
|
||||
// local/world、F 焦点选中实体。仅 Viewport 持焦时生效——
|
||||
// 输入框打字(WantTextInput)由 BlockingKeyboard 拦游戏侧,
|
||||
// 但 ImGui 自身仍收键,故必须限定持焦面板。RMB 按住 = 相机
|
||||
// 飞行模式(键盘归相机),工具热键全部抑制——W 前进与
|
||||
// W 平移 Gizmo 的键位冲突就此解耦 ----
|
||||
// ---- 工具热键(UE 语义):Q 纯选择(不出杆)、W/E/R 切
|
||||
// Gizmo 模式、T 切 local/world、F 焦点选中实体。仅 Viewport
|
||||
// 持焦时生效——输入框打字(WantTextInput)由 BlockingKeyboard
|
||||
// 拦游戏侧,但 ImGui 自身仍收键,故必须限定持焦面板。RMB 按
|
||||
// 住 = 相机飞行模式(键盘归相机),工具热键全部抑制——W 前
|
||||
// 进与 W 平移 Gizmo 的键位冲突就此解耦 ----
|
||||
auto ® = ctx.scene->GetRegistry();
|
||||
ECS::TransformComponent *tr =
|
||||
selected != entt::null
|
||||
@@ -236,6 +236,9 @@ std::optional<entt::entity> ViewportPanel::Draw(const EditorContext &ctx,
|
||||
const bool playing = ctx.playState && *ctx.playState;
|
||||
if (!playing && out.focused && !ImGui::GetIO().WantTextInput &&
|
||||
!ImGui::IsMouseDown(ImGuiMouseButton_Right)) {
|
||||
// Q = 纯选择模式(UE Q 工具语义):op=0 无任何轴位,
|
||||
// ImGuizmo 不绘制不响应——选中实体只高亮不出杆
|
||||
if (ImGui::IsKeyPressed(ImGuiKey_Q)) gizmo.op = 0;
|
||||
if (ImGui::IsKeyPressed(ImGuiKey_W)) gizmo.op = ImGuizmo::TRANSLATE;
|
||||
if (ImGui::IsKeyPressed(ImGuiKey_E)) gizmo.op = ImGuizmo::ROTATE;
|
||||
if (ImGui::IsKeyPressed(ImGuiKey_R)) gizmo.op = ImGuizmo::SCALE;
|
||||
@@ -370,8 +373,8 @@ std::optional<entt::entity> ViewportPanel::Draw(const EditorContext &ctx,
|
||||
: "PLAYING - Ctrl+P to stop");
|
||||
} else {
|
||||
std::snprintf(tip, sizeof(tip),
|
||||
"Space: %s [T] Snap: Ctrl F: Focus "
|
||||
"Ctrl+Shift+F: To Selection",
|
||||
"Q/W/E/R: Sel/Move/Rot/Scale T: %s "
|
||||
"Snap: Ctrl F: Focus",
|
||||
gizmo.localSpace ? "Local" : "World");
|
||||
}
|
||||
const ImVec2 imgMin = ImGui::GetItemRectMin();
|
||||
|
||||
@@ -29,8 +29,8 @@ struct ViewportInputState {
|
||||
// op 取 ImGuizmo::OPERATION 位掩码(TRANSLATE=7=三轴位或运算,非 0
|
||||
// 起始枚举;0 = 无任何轴位 → Gizmo 完全不绘制),int 存储避免本
|
||||
// 头文件 include ImGuizmo.h(拖入 imgui 宏依赖顺序)
|
||||
// W/E/R 切换 op、T 切换 local/world 空间(UE 语义);dragging 拉起
|
||||
// Editor::BlockingMouse 门控
|
||||
// Q 纯选择(op=0 不出杆)、W/E/R 切换 op、T 切换 local/world 空间
|
||||
// (UE 语义);dragging 拉起 Editor::BlockingMouse 门控
|
||||
struct GizmoState {
|
||||
int op = 7; // ImGuizmo::TRANSLATE(TRANSLATE_X|Y|Z)
|
||||
bool localSpace = true; // 操纵空间:true=模型轴(旋转/缩放语义),
|
||||
|
||||
Reference in New Issue
Block a user