From 40b4c00ff5d6316fe78586d06e4d8470b1bba068 Mon Sep 17 00:00:00 2001 From: luboslenco Date: Sun, 3 Nov 2019 12:42:10 +0100 Subject: [PATCH] Add Cache Draws option --- Sources/arm/App.hx | 2 +- Sources/arm/ui/BoxPreferences.hx | 4 ++++ Sources/arm/ui/UITrait.hx | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Sources/arm/App.hx b/Sources/arm/App.hx index 9bfb9dc4..e6ddb07f 100644 --- a/Sources/arm/App.hx +++ b/Sources/arm/App.hx @@ -365,7 +365,7 @@ class App { var decal = Context.tool == ToolDecal || Context.tool == ToolText; var isPicker = Context.tool == ToolPicker; #if krom_windows - Zui.alwaysRedrawWindow = + Zui.alwaysRedrawWindow = !UITrait.inst.cacheDraws || UIMenu.show || UIBox.show || isDragging || diff --git a/Sources/arm/ui/BoxPreferences.hx b/Sources/arm/ui/BoxPreferences.hx index bc65318f..4724a5d0 100644 --- a/Sources/arm/ui/BoxPreferences.hx +++ b/Sources/arm/ui/BoxPreferences.hx @@ -51,6 +51,10 @@ class BoxPreferences { UITrait.inst.hwnd1.redraws = 2; UITrait.inst.hwnd2.redraws = 2; } + + UITrait.inst.cacheDraws = ui.check(Id.handle({selected: UITrait.inst.cacheDraws}), "Cache Draws"); + if (ui.isHovered) ui.tooltip("Enabling may reduce GPU usage"); + // ui.text("Node Editor"); // var gridSnap = ui.check(Id.handle({selected: false}), "Grid Snap"); diff --git a/Sources/arm/ui/UITrait.hx b/Sources/arm/ui/UITrait.hx index 97a5663d..a839514d 100644 --- a/Sources/arm/ui/UITrait.hx +++ b/Sources/arm/ui/UITrait.hx @@ -132,6 +132,7 @@ class UITrait { public var viewportMode = 0; public var hscaleWasChanged = false; public var exportMeshFormat = 0; + public var cacheDraws = false; public var textToolImage:Image = null; public var textToolText = "Text";