mirror of
https://github.com/Dadido3/noita-mapcap.git
synced 2024-11-18 17:17:31 +00:00
Query live capture settings while capturing
- Change default capture interval to 30 frames - Add todo comments
This commit is contained in:
parent
c4e59156c8
commit
321208ba8a
@ -263,14 +263,19 @@ end
|
|||||||
|
|
||||||
---Starts the live capturing process.
|
---Starts the live capturing process.
|
||||||
---Use `Capture.MapCapturingCtx` to stop, control or view the process.
|
---Use `Capture.MapCapturingCtx` to stop, control or view the process.
|
||||||
---@param interval integer|nil -- The interval length in frames. Defaults to 60.
|
|
||||||
---@param minDistance number|nil -- The minimum distance between screenshots. This will prevent screenshots if the player doesn't move much.
|
|
||||||
---@param maxDistance number|nil -- The maximum distance between screenshots. This will allow more screenshots per interval if the player moves fast.
|
|
||||||
---@param outputPixelScale number|nil -- The resulting image pixel to world pixel ratio.
|
---@param outputPixelScale number|nil -- The resulting image pixel to world pixel ratio.
|
||||||
function Capture:StartCapturingLive(interval, minDistance, maxDistance, outputPixelScale)
|
function Capture:StartCapturingLive(outputPixelScale)
|
||||||
interval = interval or 60
|
|
||||||
minDistance = minDistance or 10
|
---Queries the mod settings for the live capture parameters.
|
||||||
maxDistance = maxDistance or 50
|
---@return integer interval -- The interval length in frames. Defaults to 30.
|
||||||
|
---@return number minDistanceSqr -- The minimum (squared) distance between screenshots. This will prevent screenshots if the player doesn't move much.
|
||||||
|
---@return number maxDistanceSqr -- The maximum (squared) distance between screenshots. This will allow more screenshots per interval if the player moves fast.
|
||||||
|
local function querySettings()
|
||||||
|
local interval = tonumber(ModSettingGet("noita-mapcap.live-interval")) or 30
|
||||||
|
local minDistance = tonumber(ModSettingGet("noita-mapcap.live-min-distance")) or 10
|
||||||
|
local maxDistance = tonumber(ModSettingGet("noita-mapcap.live-max-distance")) or 50
|
||||||
|
return interval, minDistance ^ 2, maxDistance ^ 2
|
||||||
|
end
|
||||||
|
|
||||||
-- Create file that signals that there are files in the output directory.
|
-- Create file that signals that there are files in the output directory.
|
||||||
local file = io.open("mods/noita-mapcap/output/nonempty", "a")
|
local file = io.open("mods/noita-mapcap/output/nonempty", "a")
|
||||||
@ -282,9 +287,10 @@ function Capture:StartCapturingLive(interval, minDistance, maxDistance, outputPi
|
|||||||
Modification.SetCameraFree(false)
|
Modification.SetCameraFree(false)
|
||||||
|
|
||||||
local oldPos
|
local oldPos
|
||||||
local minDistanceSqr, maxDistanceSqr = minDistance ^ 2, maxDistance ^ 2
|
|
||||||
|
|
||||||
repeat
|
repeat
|
||||||
|
local interval, minDistanceSqr, maxDistanceSqr = querySettings()
|
||||||
|
|
||||||
-- Wait until we are allowed to take a new screenshot.
|
-- Wait until we are allowed to take a new screenshot.
|
||||||
local delayFrames = 0
|
local delayFrames = 0
|
||||||
repeat
|
repeat
|
||||||
@ -489,11 +495,7 @@ function Capture:StartCapturing()
|
|||||||
local captureGridSize = tonumber(ModSettingGet("noita-mapcap.grid-size"))
|
local captureGridSize = tonumber(ModSettingGet("noita-mapcap.grid-size"))
|
||||||
|
|
||||||
if mode == "live" then
|
if mode == "live" then
|
||||||
local interval = ModSettingGet("noita-mapcap.live-interval")
|
self:StartCapturingLive(outputPixelScale)
|
||||||
local minDistance = ModSettingGet("noita-mapcap.live-min-distance")
|
|
||||||
local maxDistance = ModSettingGet("noita-mapcap.live-max-distance")
|
|
||||||
|
|
||||||
self:StartCapturingLive(interval, minDistance, maxDistance, outputPixelScale)
|
|
||||||
elseif mode == "area" then
|
elseif mode == "area" then
|
||||||
local area = ModSettingGet("noita-mapcap.area")
|
local area = ModSettingGet("noita-mapcap.area")
|
||||||
if area == "custom" then
|
if area == "custom" then
|
||||||
|
@ -83,5 +83,6 @@ function Check:Resolutions(interval)
|
|||||||
Message:ShowSetNoitaSettings(Modification.AutoSet, string.format("Expected virtual resolution is %s. But got %s.", expected, Coords.VirtualResolution))
|
Message:ShowSetNoitaSettings(Modification.AutoSet, string.format("Expected virtual resolution is %s. But got %s.", expected, Coords.VirtualResolution))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
-- TODO: Check virtual resolution offset
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -128,6 +128,7 @@ function UI:Draw()
|
|||||||
local gui = self.gui
|
local gui = self.gui
|
||||||
|
|
||||||
-- Skip drawing if we are asked to do so.
|
-- Skip drawing if we are asked to do so.
|
||||||
|
-- TODO: Find a way to susped UI drawing, but still being able to receive events
|
||||||
if self.suspendFrames and self.suspendFrames > 0 then self.suspendFrames = self.suspendFrames - 1 return end
|
if self.suspendFrames and self.suspendFrames > 0 then self.suspendFrames = self.suspendFrames - 1 return end
|
||||||
self.suspendFrames = nil
|
self.suspendFrames = nil
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ modSettings = {
|
|||||||
id = "live-interval",
|
id = "live-interval",
|
||||||
ui_name = "Capture interval",
|
ui_name = "Capture interval",
|
||||||
ui_description = "Capturing interval in frames.",
|
ui_description = "Capturing interval in frames.",
|
||||||
value_default = 60,
|
value_default = 30,
|
||||||
value_min = 5,
|
value_min = 5,
|
||||||
value_max = 240,
|
value_max = 240,
|
||||||
value_display_multiplier = 1,
|
value_display_multiplier = 1,
|
||||||
|
Loading…
Reference in New Issue
Block a user