Plan UI observer frame clipping
This commit is contained in:
@@ -265,6 +265,10 @@ struct PlanAppFrameArgs {
|
||||
float resize_width = 1280.0F;
|
||||
float resize_height = 720.0F;
|
||||
bool bad_resize = false;
|
||||
bool observer_display = true;
|
||||
bool observer_on_screen = false;
|
||||
bool observer_clipped_out = false;
|
||||
bool observer_bad_geometry = false;
|
||||
};
|
||||
|
||||
struct PlanAppThreadArgs {
|
||||
@@ -2096,7 +2100,7 @@ void print_help()
|
||||
<< " plan-app-preferences [--ui-scale N] [--display-density N] [--current-scale N] [--scale-option N] [--viewport-scale N] [--rtl] [--timelapse-disabled] [--recording-running] [--vr-controllers-disabled] [--cursor-mode N]\n"
|
||||
<< " plan-app-startup [--run-counter N] [--auto-timelapse-disabled] [--vr-controllers-disabled] [--license-invalid]\n"
|
||||
<< " plan-app-startup-resources [--width N] [--height N] [--bad-size]\n"
|
||||
<< " plan-app-frame [--redraw] [--animate] [--no-designer-layout] [--no-main-layout] [--no-canvas] [--no-canvas-document] [--vr-active] [--ui-hidden] [--vr-only] [--resize-width N] [--resize-height N] [--bad-resize]\n"
|
||||
<< " plan-app-frame [--redraw] [--animate] [--no-designer-layout] [--no-main-layout] [--no-canvas] [--no-canvas-document] [--vr-active] [--ui-hidden] [--vr-only] [--resize-width N] [--resize-height N] [--bad-resize] [--observer-hidden] [--observer-on-screen] [--observer-clipped-out] [--observer-bad-geometry]\n"
|
||||
<< " plan-app-thread --kind dispatch|render-drain|ui-drain|ui-tick|ui-loop|redraw|start|stop [--on-target-thread] [--unique] [--worker-stopped] [--wait] [--request-redraw] [--redraw] [--live-reload] [--not-joinable] [--queued-tasks N] [--rendered-frames N] [--dt N] [--frame-accumulator N] [--fps-accumulator N] [--reload-accumulator N] [--bad-timer]\n"
|
||||
<< " plan-app-input --kind pointer|gesture|cancel|main|key|ui-toggle|stylus [--x N] [--y N] [--x1 N] [--y1 N] [--prev-x N] [--prev-y N] [--prev-x1 N] [--prev-y1 N] [--zoom N] [--no-designer-layout] [--no-main-layout] [--spacebar] [--vr-active] [--key-up] [--ui-hidden] [--no-canvas] [--main-child-count N] [--panel-child-count N] [--bad-float]\n"
|
||||
<< " plan-app-shutdown\n"
|
||||
@@ -3866,6 +3870,14 @@ pp::foundation::Status parse_plan_app_frame_args(
|
||||
args.resize_height = value.value();
|
||||
} else if (key == "--bad-resize") {
|
||||
args.bad_resize = true;
|
||||
} else if (key == "--observer-hidden") {
|
||||
args.observer_display = false;
|
||||
} else if (key == "--observer-on-screen") {
|
||||
args.observer_on_screen = true;
|
||||
} else if (key == "--observer-clipped-out") {
|
||||
args.observer_clipped_out = true;
|
||||
} else if (key == "--observer-bad-geometry") {
|
||||
args.observer_bad_geometry = true;
|
||||
} else {
|
||||
return pp::foundation::Status::invalid_argument("unknown option");
|
||||
}
|
||||
@@ -3899,6 +3911,39 @@ int plan_app_frame(int argc, char** argv)
|
||||
print_error("plan-app-frame", resize.status().message);
|
||||
return 2;
|
||||
}
|
||||
const pp::app::AppUiObserverParentClip parent_clips[] {
|
||||
{
|
||||
.clip = {
|
||||
.x = 0.0F,
|
||||
.y = 0.0F,
|
||||
.width = args.observer_clipped_out ? 10.0F : 80.0F,
|
||||
.height = args.observer_clipped_out ? 10.0F : 60.0F,
|
||||
},
|
||||
.padding_top = args.observer_clipped_out ? 0.0F : 5.0F,
|
||||
.padding_right = args.observer_clipped_out ? 0.0F : 5.0F,
|
||||
.padding_bottom = args.observer_clipped_out ? 0.0F : 5.0F,
|
||||
.padding_left = args.observer_clipped_out ? 0.0F : 5.0F,
|
||||
},
|
||||
};
|
||||
const auto observer = pp::app::plan_app_ui_observer(
|
||||
true,
|
||||
args.observer_display,
|
||||
args.observer_on_screen,
|
||||
{
|
||||
.x = args.observer_bad_geometry ? std::nanf("") : (args.observer_clipped_out ? 100.0F : 10.0F),
|
||||
.y = args.observer_clipped_out ? 100.0F : 20.0F,
|
||||
.width = args.observer_clipped_out ? 10.0F : 100.0F,
|
||||
.height = args.observer_clipped_out ? 10.0F : 50.0F,
|
||||
},
|
||||
parent_clips,
|
||||
540.0F,
|
||||
args.observer_bad_geometry ? 0.0F : 2.0F,
|
||||
10.0F,
|
||||
5.0F);
|
||||
if (!observer) {
|
||||
print_error("plan-app-frame", observer.status().message);
|
||||
return 2;
|
||||
}
|
||||
|
||||
std::cout << "{\"ok\":true,\"command\":\"plan-app-frame\""
|
||||
<< ",\"surface\":{\"width\":" << surface.width
|
||||
@@ -3918,6 +3963,16 @@ int plan_app_frame(int argc, char** argv)
|
||||
<< ",\"renderTargetHeight\":" << resize.value().render_target_height
|
||||
<< ",\"recreateUiRenderTarget\":" << json_bool(resize.value().recreate_ui_render_target)
|
||||
<< ",\"requestRedraw\":" << json_bool(resize.value().request_redraw)
|
||||
<< "},\"observer\":{\"drawNode\":" << json_bool(observer.value().draw_node)
|
||||
<< ",\"notifyEnterScreen\":" << json_bool(observer.value().notify_enter_screen)
|
||||
<< ",\"notifyLeaveScreen\":" << json_bool(observer.value().notify_leave_screen)
|
||||
<< ",\"nextOnScreen\":" << json_bool(observer.value().next_on_screen)
|
||||
<< ",\"visibleWidth\":" << observer.value().visible_clip.width
|
||||
<< ",\"visibleHeight\":" << observer.value().visible_clip.height
|
||||
<< ",\"scissorX\":" << observer.value().scissor_x
|
||||
<< ",\"scissorY\":" << observer.value().scissor_y
|
||||
<< ",\"scissorWidth\":" << observer.value().scissor_width
|
||||
<< ",\"scissorHeight\":" << observer.value().scissor_height
|
||||
<< "}}\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user