#include "common_components.lua" #include "ui/ui_extensions.lua" PhotomodeOptions = {} PhotomodeOptions.listItems = {} PhotomodeOptions.showOptions = true PhotomodeOptions.showGrid = false PhotomodeOptions.showPositionInfo = false PhotomodeOptions.showTool = false PhotomodeOptions.DOFValue = 0.5 PhotomodeOptions.ExposureValue = 1 PhotomodeOptions.BloomValue = 1 PhotomodeOptions.heightValue = 0.7 PhotomodeOptions.scaleValue = 0.7 PhotomodeOptions.pitchValue = 0.7 PhotomodeOptions.yawValue = 0.7 PhotomodeOptions.rollValue = 0.7 function drawPhotomodeStepper(p0, p1, p2) local itemW = 800 local itemH = 50 local navId = UiNavGroupBegin() UiNavGroupSize(itemW, itemH) local isFocused = UiReceivesInput() and (UiIsMouseInRect(itemW, itemH) or UiIsComponentInFocus(navId)) if isFocused then if p2 ~= nil then UiPush() UiTranslate(p2.x, p2.y) drawTooltip(p2) UiPop() end -- draw frame F519_1008_item UiPush() UiColorFilter(1.0, 1.0, 1.0, 1) UiPush() UiColor(1, 1, 1, 1) UiImageBox("common/rect_c#d9d9d9_o1.00_cr8.png", itemW, itemH, 9, 9) UiPop() UiPush() UiTranslate(11.947006225585938, 15.12399215698241) UiColor(1.0, 1.0, 1.0, 0.800000011920929) UiFont("regular.ttf", 27) UiText(p0) UiPop() UiTranslate(440.0, 12.0) drawFocusedStepper(p1) UiPop() else -- draw frame F519_1008_item UiPush() UiColorFilter(1.0, 1.0, 1.0, 1) UiPush() UiTranslate(11.947006225585938, 15.12399215698241) UiColor(1.0, 1.0, 1.0, 0.800000011920929) UiFont("regular.ttf", 27) UiText(p0) UiPop() UiTranslate(440.0, 12.0) drawStepper(p1) UiPop() end UiNavGroupEnd() end --- Draw slider with tooltip --- ---@param p0 string Text to display ---@param p1 table Slider params ---@param p2 table Tooltip params function drawPhotomodeSlider(p0, p1, p2) local itemW = 800 local itemH = 50 local navId = UiNavGroupBegin() UiNavGroupSize(itemW, itemH) local isFocused = UiReceivesInput() and (UiIsMouseInRect(itemW, itemH) or UiIsComponentInFocus(navId) or getActiveSlider() == p1) if isFocused and InputPressed("lmb") then setActiveSlider(p1) end if isFocused then -- drawTooltip if p2 ~= nil then UiPush() UiTranslate(p2.x, p2.y) drawTooltip(p2) UiPop() end -- draw frame F458_6537_item UiPush() UiColorFilter(1.0, 1.0, 1.0, 1) UiPush() UiColor(1, 1, 1, 1) UiImageBox("common/rect_c#d9d9d9_o1.00_cr8.png", itemW, itemH, 9, 9) UiPop() UiPush() UiTranslate(11.947006225585938, 15.12399215698241) UiColor(1.0, 1.0, 1.0, 0.800000011920929) UiFont("regular.ttf", 27) UiText(p0) UiPop() UiTranslate(425, 12.0) drawFocusedSlider(p1) UiPop() else -- draw frame F458_6537_item UiPush() UiColorFilter(1.0, 1.0, 1.0, 1) UiPush() UiTranslate(11.947006225585938, 15.12399215698241) UiColor(1.0, 1.0, 1.0, 0.800000011920929) UiFont("regular.ttf", 27) UiText(p0) UiPop() UiTranslate(425, 12.0) drawSlider(p1) UiPop() end UiNavGroupEnd() end PhotomodeOptions.init = function() local showGridText = "loc@SHOW_GRID" local showGridParams = { currentIdx = 1, allValues = { "loc@UI_BUTTON_DISABLED", "loc@UI_BUTTON_ENABLED" }, isCyclic = false, getCurrentValue = function(self) return self.allValues[self.currentIdx] end, onNext = function(self) self.currentIdx = self.currentIdx + 1 if self.currentIdx > #self.allValues then self.currentIdx = 1 end if self.currentIdx == 2 then PhotomodeOptions.showGrid = true else PhotomodeOptions.showGrid = false end end, onPrev = function(self) self.currentIdx = self.currentIdx - 1 if self.currentIdx < 1 then self.currentIdx = #self.allValues end if self.currentIdx == 2 then PhotomodeOptions.showGrid = true else PhotomodeOptions.showGrid = false end end } table.insert(PhotomodeOptions.listItems, { w = 988.0, h = 50.0, draw = function(self) drawPhotomodeStepper(showGridText, showGridParams) end } ) local showPositionInfoText = "loc@SHOW_POSITION_INFO" local showPositionInfoParams = { currentIdx = 1, allValues = { "loc@UI_BUTTON_DISABLED", "loc@UI_BUTTON_ENABLED" }, isCyclic = false, getCurrentValue = function(self) return self.allValues[self.currentIdx] end, onNext = function(self) self.currentIdx = self.currentIdx + 1 if self.currentIdx > #self.allValues then self.currentIdx = 1 end if self.currentIdx == 2 then PhotomodeOptions.showPositionInfo = true else PhotomodeOptions.showPositionInfo = false end end, onPrev = function(self) self.currentIdx = self.currentIdx - 1 if self.currentIdx < 1 then self.currentIdx = #self.allValues end if self.currentIdx == 2 then PhotomodeOptions.showPositionInfo = true else PhotomodeOptions.showPositionInfo = false end end } table.insert(PhotomodeOptions.listItems, { w = 988.0, h = 50.0, draw = function(self) drawPhotomodeStepper(showPositionInfoText, showPositionInfoParams) end } ) local showToolText = "loc@SHOW_TOOL" local showToolParams = { currentIdx = 1, allValues = { "loc@UI_BUTTON_DISABLED", "loc@UI_BUTTON_ENABLED" }, isCyclic = false, getCurrentValue = function(self) return self.allValues[self.currentIdx] end, onNext = function(self) self.currentIdx = self.currentIdx + 1 if self.currentIdx > #self.allValues then self.currentIdx = 1 end if self.currentIdx == 2 then PhotomodeOptions.showTool = true else PhotomodeOptions.showTool = false end end, onPrev = function(self) self.currentIdx = self.currentIdx - 1 if self.currentIdx < 1 then self.currentIdx = #self.allValues end if self.currentIdx == 2 then PhotomodeOptions.showTool = true else PhotomodeOptions.showTool = false end end } table.insert(PhotomodeOptions.listItems, { w = 988.0, h = 50.0, draw = function(self) drawPhotomodeStepper(showToolText, showToolParams) end } ) local DOFText = "loc@UI_TEXT_DEPTH_OF" local sliderDOFParams = { currentVal = 0.5, minVal = 0, maxVal = 1, step = 0.05, rawVal = 0, span = 0, onValueChanged = function(self) PhotomodeOptions.DOFValue = self.currentVal end, indicatorGetter = function(self) return tostring(self.currentVal) end, } sliderDOFParams.span = sliderDOFParams.maxVal - sliderDOFParams.minVal sliderDOFParams.rawVal = (sliderDOFParams.currentVal - sliderDOFParams.minVal) / sliderDOFParams.span table.insert(PhotomodeOptions.listItems, { w = 988.0, h = 50.0, draw = function(self) drawPhotomodeSlider(DOFText, sliderDOFParams) end } ) local ExposureText = "loc@UI_TEXT_EXPOSURE" local sliderExposureParams = { currentVal = 1, minVal = 0.5, maxVal = 1.5, step = 0.05, rawVal = 0, span = 0, onValueChanged = function(self) PhotomodeOptions.ExposureValue = self.currentVal end, indicatorGetter = function(self) return tostring(self.currentVal) end, } sliderExposureParams.span = sliderExposureParams.maxVal - sliderExposureParams.minVal sliderExposureParams.rawVal = (sliderExposureParams.currentVal - sliderExposureParams.minVal) / sliderExposureParams.span table.insert(PhotomodeOptions.listItems, { w = 988.0, h = 50.0, draw = function(self) drawPhotomodeSlider(ExposureText, sliderExposureParams) end } ) local BloomText = "loc@UI_TEXT_BLOOM" local sliderBloomParams = { currentVal = 1, minVal = 0.5, maxVal = 1.5, step = 0.05, rawVal = 0, span = 0, onValueChanged = function(self) PhotomodeOptions.BloomValue = self.currentVal end, indicatorGetter = function(self) return tostring(self.currentVal) end, } sliderBloomParams.span = sliderBloomParams.maxVal - sliderBloomParams.minVal sliderBloomParams.rawVal = (sliderBloomParams.currentVal - sliderBloomParams.minVal) / sliderBloomParams.span table.insert(PhotomodeOptions.listItems, { w = 988.0, h = 50.0, draw = function(self) drawPhotomodeSlider(BloomText, sliderBloomParams) end } ) end PhotomodeOptions.init()