fix(camera): restore Tab toggle and FaceCam mode from user config
This commit is contained in:
1 parent
a396f1227c
commit
1f04ea4440
2 files changed
+13
-42
No files matched your search
+12
-41
@@ -555,44 +555,16 @@ function _G.__FREECAM_TICK()
|
||||
_G.__FC_INPUT_FRAME = frame
|
||||
|
||||
-- Hotkey Handling:
|
||||
-- F7: Toggle FaceCam directly
|
||||
-- F8: Toggle FreeCam directly
|
||||
-- Insert: Toggle active / last camera mode
|
||||
local toggleFaceCam = Input.GetKeyDown(KeyCode.F7)
|
||||
local toggleFreeCam = Input.GetKeyDown(KeyCode.F8)
|
||||
local toggleInsert = Input.GetKeyDown(KeyCode.Insert)
|
||||
|
||||
if toggleFaceCam or toggleFreeCam or toggleInsert then
|
||||
local settings = _G.__GAC_CAMERA_SETTINGS or {mode="freecam", distance=2}
|
||||
local defaultMode = settings.mode or "freecam"
|
||||
|
||||
if toggleFaceCam then
|
||||
if _G.__FREECAM_ENABLED and _G.__FC_ACTIVE_MODE == "facecam" then
|
||||
_G.__FREECAM_ENABLED = false
|
||||
else
|
||||
_G.__FREECAM_ENABLED = true
|
||||
_G.__FC_ACTIVE_MODE = "facecam"
|
||||
end
|
||||
elseif toggleFreeCam then
|
||||
if _G.__FREECAM_ENABLED and _G.__FC_ACTIVE_MODE == "freecam" then
|
||||
_G.__FREECAM_ENABLED = false
|
||||
else
|
||||
_G.__FREECAM_ENABLED = true
|
||||
_G.__FC_ACTIVE_MODE = "freecam"
|
||||
end
|
||||
elseif toggleInsert then
|
||||
_G.__FREECAM_ENABLED = not _G.__FREECAM_ENABLED
|
||||
if _G.__FREECAM_ENABLED and not _G.__FC_ACTIVE_MODE then
|
||||
_G.__FC_ACTIVE_MODE = defaultMode
|
||||
end
|
||||
end
|
||||
|
||||
-- Tab: Main toggle (as set by user)
|
||||
-- F8 / Insert: Alternate toggles
|
||||
if Input.GetKeyDown(KeyCode.Tab) or Input.GetKeyDown(KeyCode.F8) or Input.GetKeyDown(KeyCode.Insert) then
|
||||
_G.__FREECAM_ENABLED = not _G.__FREECAM_ENABLED
|
||||
_G.__FC_LAST_TIME = nil
|
||||
local cam = get_active_cam()
|
||||
local activeMode = _G.__FC_ACTIVE_MODE or defaultMode
|
||||
local settings = _G.__GAC_CAMERA_SETTINGS or {mode="facecam", distance=2}
|
||||
|
||||
if _G.__FREECAM_ENABLED then
|
||||
if activeMode == "facecam" then
|
||||
if settings.mode == "facecam" then
|
||||
_G.__FC_FACE_DISTANCE = tonumber(settings.distance) or 2
|
||||
local head, root
|
||||
if cam then head, root = facecam_target(cam) end
|
||||
@@ -607,10 +579,10 @@ function _G.__FREECAM_TICK()
|
||||
_G.__FC_EULER = cam.transform.eulerAngles
|
||||
set_cinemachine_enabled(cam, false)
|
||||
end
|
||||
if activeMode == "facecam" then
|
||||
show_ui("<color=#00FF88><b>[FaceCam: ON]</b> | F7/Insert: Close | Scroll: Dist | F8: FreeCam</color>")
|
||||
if settings.mode == "facecam" then
|
||||
show_ui("<color=#00FF88><b>[FaceCam: ON]</b> | Tab: Close | Scroll: Distance</color>")
|
||||
else
|
||||
show_ui("<color=#00FF88><b>[FreeCam: ON]</b> Speed: " .. string.format("%.1f", _G.__FREECAM_SPEED) .. " | Arrows: Fly | PgUp/PgDn: Height | RMB: Look | F8/Insert: Close | F7: FaceCam</color>")
|
||||
show_ui("<color=#00FF88><b>[FreeCam: ON]</b> Speed: " .. string.format("%.1f", _G.__FREECAM_SPEED) .. " | Arrows: Fly | PgUp/PgDn: Height | RMB: Look | Tab: Close</color>")
|
||||
end
|
||||
else
|
||||
if cam then
|
||||
@@ -624,7 +596,7 @@ function _G.__FREECAM_TICK()
|
||||
_G.__FC_FACE_DISTANCE, _G.__FC_FACE_LOCAL_FORWARD = nil, nil
|
||||
_G.__FC_FACE_MISSING_SINCE = nil
|
||||
if _G.__FC_FACE_ANCHOR then CS.UnityEngine.Object.Destroy(_G.__FC_FACE_ANCHOR); _G.__FC_FACE_ANCHOR = nil end
|
||||
local label = (activeMode == 'facecam') and 'FaceCam' or 'FreeCam'
|
||||
local label = (settings.mode == 'facecam') and 'FaceCam' or 'FreeCam'
|
||||
show_ui('<color=#00FF88><b>[' .. label .. ': OFF]</b></color>')
|
||||
end
|
||||
end
|
||||
@@ -694,10 +666,9 @@ function _G.__FREECAM_TICK()
|
||||
if _G.__FREECAM_ENABLED then
|
||||
local cam = get_active_cam()
|
||||
if cam then
|
||||
local settings = _G.__GAC_CAMERA_SETTINGS or {mode="freecam", distance=2}
|
||||
local activeMode = _G.__FC_ACTIVE_MODE or settings.mode or "freecam"
|
||||
local settings = _G.__GAC_CAMERA_SETTINGS or {mode="facecam", distance=2}
|
||||
|
||||
if activeMode == "facecam" then
|
||||
if settings.mode == "facecam" then
|
||||
if not update_facecam(cam, settings) then
|
||||
set_cinemachine_enabled(cam, true)
|
||||
_G.__FREECAM_ENABLED = false
|
||||
|
||||
Reference in new issue
Block a user