Better separated 3D view and graph editor navigation.
parent
dc958dcabd
commit
8388fbfe3e
21
src/main.cc
21
src/main.cc
|
@ -669,6 +669,7 @@ int main() {
|
||||||
|
|
||||||
// Graph Editor
|
// Graph Editor
|
||||||
gApplicationConfig.graph_editor.config.SettingsFile = "graph_editor.json";
|
gApplicationConfig.graph_editor.config.SettingsFile = "graph_editor.json";
|
||||||
|
gApplicationConfig.graph_editor.config.NavigateButtonIndex = 2;
|
||||||
gApplicationConfig.graph_editor.context = ax::NodeEditor::CreateEditor(&gApplicationConfig.graph_editor.config);
|
gApplicationConfig.graph_editor.context = ax::NodeEditor::CreateEditor(&gApplicationConfig.graph_editor.config);
|
||||||
|
|
||||||
// draw loop
|
// draw loop
|
||||||
|
@ -711,13 +712,7 @@ int main() {
|
||||||
// handle input
|
// handle input
|
||||||
handle_mouse(w, &gGuiInputState);
|
handle_mouse(w, &gGuiInputState);
|
||||||
|
|
||||||
if (glfwGetMouseButton(w, GLFW_MOUSE_BUTTON_RIGHT)) {
|
if (!glfwGetMouseButton(w, GLFW_MOUSE_BUTTON_RIGHT)) {
|
||||||
if (gControlMode == ControlMode::ControlModeNone) {
|
|
||||||
gControlMode = ControlMode::ControlModeFPS;
|
|
||||||
Camera_CalcFromMatrix(&state.camera, &state.camera.mtxView[0]);
|
|
||||||
glfwSetInputMode(w, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
gControlMode = ControlMode::ControlModeNone;
|
gControlMode = ControlMode::ControlModeNone;
|
||||||
glfwSetInputMode(w, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
|
glfwSetInputMode(w, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
|
||||||
Camera_Update(
|
Camera_Update(
|
||||||
|
@ -761,8 +756,8 @@ int main() {
|
||||||
|
|
||||||
Camera_Update(
|
Camera_Update(
|
||||||
&state.camera,
|
&state.camera,
|
||||||
cur_width,
|
offscreen_viewport.size[0],
|
||||||
cur_height,
|
offscreen_viewport.size[1],
|
||||||
static_cast<float>(state.time.frame),
|
static_cast<float>(state.time.frame),
|
||||||
static_cast<float>(gGuiInputState.mousedX),
|
static_cast<float>(gGuiInputState.mousedX),
|
||||||
static_cast<float>(gGuiInputState.mousedY),
|
static_cast<float>(gGuiInputState.mousedY),
|
||||||
|
@ -847,6 +842,14 @@ int main() {
|
||||||
|
|
||||||
ImGui::Begin("Viewport", &gApplicationConfig.viewport_widget.visible);
|
ImGui::Begin("Viewport", &gApplicationConfig.viewport_widget.visible);
|
||||||
|
|
||||||
|
if (ImGui::IsWindowHovered() && ImGui::IsMouseDown(ImGuiMouseButton_Right)) {
|
||||||
|
if (gControlMode == ControlMode::ControlModeNone) {
|
||||||
|
gControlMode = ControlMode::ControlModeFPS;
|
||||||
|
Camera_CalcFromMatrix(&state.camera, &state.camera.mtxView[0]);
|
||||||
|
glfwSetInputMode(w, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ImVec2 viewport_widget_size = ImGui::GetWindowSize();
|
ImVec2 viewport_widget_size = ImGui::GetWindowSize();
|
||||||
gApplicationConfig.viewport_widget.size[0] = static_cast<int>(viewport_widget_size.x);
|
gApplicationConfig.viewport_widget.size[0] = static_cast<int>(viewport_widget_size.x);
|
||||||
gApplicationConfig.viewport_widget.size[1] = static_cast<int>(viewport_widget_size.y);
|
gApplicationConfig.viewport_widget.size[1] = static_cast<int>(viewport_widget_size.y);
|
||||||
|
|
Loading…
Reference in New Issue