mirror of
https://github.com/Winded/StopMotionHelper.git
synced 2025-03-04 03:13:33 -05:00
Changing ghost convars will now update ghost state, + formatting
This commit is contained in:
parent
7218a561e2
commit
b9d92041fb
@ -303,6 +303,10 @@ function CTRL.UpdateSettings(newSettings)
|
||||
SMH.Settings.Update(newSettings)
|
||||
end
|
||||
|
||||
function CTRL.UpdateUISetting(setting, value)
|
||||
SMH.UI.UpdateUISetting(setting, value)
|
||||
end
|
||||
|
||||
function CTRL.OpenHelp()
|
||||
gui.OpenURL("https://github.com/Winded/StopMotionHelper/blob/master/TUTORIAL.md")
|
||||
end
|
||||
|
@ -4,6 +4,14 @@ local ConVarType = {
|
||||
Float = 3,
|
||||
}
|
||||
|
||||
local GhostVars = {
|
||||
smh_ghostprevframe = "GhostPrevFrame",
|
||||
smh_ghostnextframe = "GhostNextFrame",
|
||||
smh_ghostallentities = "GhostAllEntities",
|
||||
smh_ghosttransparency = "GhostTransparency",
|
||||
smh_onionskin = "OnionSkin"
|
||||
}
|
||||
|
||||
local TYPED_CV = {}
|
||||
TYPED_CV.__index = TYPED_CV
|
||||
|
||||
@ -42,6 +50,15 @@ local function CreateTypedConVar(type, name, defaultValue, helptext)
|
||||
}
|
||||
setmetatable(cv, TYPED_CV)
|
||||
|
||||
if GhostVars[name] then
|
||||
cvars.AddChangeCallback(name, function(convar, oldvalue, newvalue)
|
||||
if oldvalue == newvalue then return end
|
||||
|
||||
SMH.Controller.UpdateUISetting(GhostVars[name], newvalue)
|
||||
SMH.Controller.UpdateGhostState()
|
||||
end)
|
||||
end
|
||||
|
||||
return cv
|
||||
end
|
||||
|
||||
@ -59,6 +76,7 @@ local ConVars = {
|
||||
EnableWorld = CreateTypedConVar(ConVarType.Bool, "smh_enableworldkeyframes", false),
|
||||
}
|
||||
|
||||
|
||||
local MGR = {}
|
||||
|
||||
function MGR.GetAll()
|
||||
|
@ -771,6 +771,12 @@ function MGR.RefreshTimelineSettings()
|
||||
PropertiesMenu:UpdateTimelineSettings()
|
||||
end
|
||||
|
||||
function MGR.UpdateUISetting(setting, value)
|
||||
local settings = {}
|
||||
settings[setting] = value
|
||||
WorldClicker.Settings:ApplySettings(settings)
|
||||
end
|
||||
|
||||
function MGR.SetTimeline(timeline)
|
||||
WorldClicker.MainMenu:UpdateTimelines(timeline)
|
||||
PropertiesMenu:UpdateTimelineInfo(timeline)
|
||||
|
@ -104,7 +104,7 @@ function MGR.StartPlayback(player, startFrame, endFrame, playbackRate, settings)
|
||||
EndFrame = endFrame,
|
||||
PlaybackRate = playbackRate,
|
||||
CurrentFrame = startFrame,
|
||||
PrevFrame = startFrame - 1,
|
||||
PrevFrame = startFrame - 1,
|
||||
Timer = 0,
|
||||
Settings = settings,
|
||||
}
|
||||
@ -131,10 +131,10 @@ hook.Add("Think", "SMHPlaybackManagerThink", function()
|
||||
playback.Timer = 0
|
||||
end
|
||||
|
||||
if playback.CurrentFrame ~= playback.PrevFrame then
|
||||
playback.PrevFrame = playback.CurrentFrame
|
||||
MGR.SetFrame(player, playback.CurrentFrame, playback.Settings)
|
||||
end
|
||||
if playback.CurrentFrame ~= playback.PrevFrame then
|
||||
playback.PrevFrame = playback.CurrentFrame
|
||||
MGR.SetFrame(player, playback.CurrentFrame, playback.Settings)
|
||||
end
|
||||
|
||||
end
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user