Route canvas camera reset through app core
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "app_core/brush_ui.h"
|
||||
#include "app_core/canvas_hotkey.h"
|
||||
#include "app_core/canvas_tool_ui.h"
|
||||
#include "app_core/canvas_view.h"
|
||||
#include "app_core/document_animation.h"
|
||||
#include "app_core/document_canvas.h"
|
||||
#include "app_core/document_export.h"
|
||||
@@ -2031,6 +2032,7 @@ void print_help()
|
||||
<< " plan-canvas-hotkey --event key-down|key-up|touch-tap --key e|z|s|tab|alt|android-back|bracket-left|bracket-right [--ctrl] [--shift] [--mouse-focus] [--undo-count N] [--redo-count N] [--touch-fingers N]\n"
|
||||
<< " plan-canvas-tool --kind draw|erase|line|camera|grid|copy|cut|fill|mask-free|mask-line|bucket|pick|touch-lock [--current-mode-draw]\n"
|
||||
<< " plan-canvas-tool-state [--mode draw|erase|line|camera|grid|copy|cut|fill|mask-free|mask-line|bucket] [--picking] [--touch-lock]\n"
|
||||
<< " plan-canvas-camera-reset\n"
|
||||
<< " plan-canvas-cursor [--mode draw|erase|line|camera|grid|copy|cut|fill|mask-free|mask-line|bucket] [--visibility never|small-brush|not-painting|always] [--brush-size N] [--no-brush] [--drawing] [--alt] [--resizing] [--picking] [--bad-size]\n"
|
||||
<< " plan-grid-operation --kind pick|load|reload|clear|render|commit [--path FILE] [--no-heightmap] [--no-canvas] [--float32] [--float16] [--texture-resolution N] [--samples N]\n"
|
||||
<< " plan-history-operation --kind undo|redo|clear [--undo-count N] [--redo-count N] [--memory-bytes N]\n"
|
||||
@@ -6746,6 +6748,28 @@ int plan_canvas_tool_state(int argc, char** argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int plan_canvas_camera_reset(int argc, char** argv)
|
||||
{
|
||||
if (argc > 2) {
|
||||
print_error("plan-canvas-camera-reset", "unknown option");
|
||||
return 2;
|
||||
}
|
||||
|
||||
const auto state = pp::app::plan_canvas_camera_reset();
|
||||
std::cout << "{\"ok\":true,\"command\":\"plan-canvas-camera-reset\""
|
||||
<< ",\"rotation\":[";
|
||||
for (std::size_t index = 0; index < state.rotation.size(); ++index) {
|
||||
if (index != 0U) {
|
||||
std::cout << ",";
|
||||
}
|
||||
std::cout << state.rotation[index];
|
||||
}
|
||||
std::cout << "],\"position\":[" << state.position[0] << "," << state.position[1] << "," << state.position[2]
|
||||
<< "],\"fieldOfViewDegrees\":" << state.field_of_view_degrees
|
||||
<< ",\"pan\":[" << state.pan[0] << "," << state.pan[1] << "]}\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
pp::foundation::Status parse_plan_canvas_cursor_args(
|
||||
int argc,
|
||||
char** argv,
|
||||
@@ -9905,6 +9929,10 @@ int main(int argc, char** argv)
|
||||
return plan_canvas_tool_state(argc, argv);
|
||||
}
|
||||
|
||||
if (command == "plan-canvas-camera-reset") {
|
||||
return plan_canvas_camera_reset(argc, argv);
|
||||
}
|
||||
|
||||
if (command == "plan-canvas-cursor") {
|
||||
return plan_canvas_cursor(argc, argv);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user