Skip to content

Commit dd4b284

Browse files
authored
Create a new panel for camera options + add new Camera Collision setting (#96)
* Create a new panel for camera options + add new Camera Collision setting In 11.0 Blizzard added new camera collision options, and to this commit adds these new settings as well as moved other camera options into a dedicated panel. * Hide the new camera collision options if not WoW Retail * fix small typo. Whoops
1 parent 9234b29 commit dd4b284

File tree

4 files changed

+139
-49
lines changed

4 files changed

+139
-49
lines changed

AdvancedInterfaceOptions.toc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ utils.lua
2222
cvars.lua
2323

2424
gui\GeneralConfigPanel.lua
25+
gui\CameraConfigPanel.lua
2526
gui\ChatConfigPanel.lua
2627
gui\CombatConfigPanel.lua
2728
gui\FloatingCombatTextConfigPanel.lua

basicOptions.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ function E:Init() -- Runs after our saved variables are loaded and cvars have be
9999

100100
--Register our options with the Blizzard Addon Options panel
101101
AceConfigRegistry:RegisterOptionsTable("AdvancedInterfaceOptions", addon:CreateGeneralOptions())
102+
AceConfigRegistry:RegisterOptionsTable("AdvancedInterfaceOptions_Camera", addon:CreateCameraOptions())
102103
AceConfigRegistry:RegisterOptionsTable("AdvancedInterfaceOptions_Chat", addon:CreateChatOptions())
103104
AceConfigRegistry:RegisterOptionsTable("AdvancedInterfaceOptions_Combat", addon:CreateCombatOptions())
104105
AceConfigRegistry:RegisterOptionsTable("AdvancedInterfaceOptions_FloatingCombatText", addon:CreateFloatingCombatTextOptions())
@@ -107,6 +108,7 @@ function E:Init() -- Runs after our saved variables are loaded and cvars have be
107108
AceConfigRegistry:RegisterOptionsTable("AdvancedInterfaceOptions_cVar", addon:CreateCVarOptions())
108109

109110
local categoryFrame, mainCategoryID = AceConfigDialog:AddToBlizOptions("AdvancedInterfaceOptions", "AdvancedInterfaceOptions")
111+
AceConfigDialog:AddToBlizOptions("AdvancedInterfaceOptions_Camera", "Camera", "AdvancedInterfaceOptions")
110112
AceConfigDialog:AddToBlizOptions("AdvancedInterfaceOptions_Chat", "Chat", "AdvancedInterfaceOptions")
111113
AceConfigDialog:AddToBlizOptions("AdvancedInterfaceOptions_Combat", "Combat", "AdvancedInterfaceOptions")
112114
AceConfigDialog:AddToBlizOptions("AdvancedInterfaceOptions_FloatingCombatText", "Floating Combat Text", "AdvancedInterfaceOptions")

gui/CameraConfigPanel.lua

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
local _, addon = ...
2+
3+
-- Constants
4+
local THIRD_WIDTH = 1.25
5+
6+
local maxCameraZoomFactor
7+
if not addon.IsRetail() then
8+
maxCameraZoomFactor = 3.4
9+
else
10+
maxCameraZoomFactor = 2.6
11+
end
12+
13+
-------------------------------------------------------------------------
14+
-------------------------------------------------------------------------
15+
16+
function addon:CreateCameraOptions()
17+
local cameraOptions = {
18+
type = "group",
19+
childGroups = "tree",
20+
name = "Camera",
21+
args = {
22+
instructions = {
23+
type = "description",
24+
name = "These options allow you to modify Camera Options.",
25+
fontSize = "medium",
26+
order = 1,
27+
},
28+
-------------------------------------------------
29+
header = {
30+
type = "header",
31+
name = "",
32+
order = 10,
33+
},
34+
-- TODO: This might need more work for classic
35+
cameraDistanceMaxZoomFactor = {
36+
type = "range",
37+
name = MAX_FOLLOW_DIST,
38+
desc = OPTION_TOOLTIP_MAX_FOLLOW_DIST,
39+
min = 1,
40+
max = maxCameraZoomFactor,
41+
step = 0.1,
42+
get = function()
43+
return tonumber(C_CVar.GetCVar("cameraDistanceMaxZoomFactor"))
44+
end,
45+
set = function(_, value)
46+
self:SetCVar("cameraDistanceMaxZoomFactor", value)
47+
end,
48+
width = THIRD_WIDTH,
49+
order = 11,
50+
},
51+
-------------------------------------------------
52+
cameraCollisionHeader = {
53+
type = "header",
54+
name = "Camera Collision",
55+
order = 20,
56+
--this feature is only supported in 11.0 at the moment
57+
hidden = function()
58+
return not addon.IsRetail()
59+
end,
60+
},
61+
cameraIndirectVisibility = {
62+
type = "toggle",
63+
name = "Camera Indirect Visibility",
64+
desc = "Allow for the player character to be more obstructed by the environment before colliding and pushing the camera forward.",
65+
get = function()
66+
return C_CVar.GetCVarBool("cameraIndirectVisibility")
67+
end,
68+
set = function(_, value)
69+
self:SetCVar("cameraIndirectVisibility", value)
70+
end,
71+
--this feature is only supported in 11.0 at the moment
72+
hidden = function()
73+
return not addon.IsRetail()
74+
end,
75+
width = THIRD_WIDTH,
76+
order = 21,
77+
},
78+
cameraIndirectOffset = {
79+
type = "range",
80+
name = "Camera Indirect Offset",
81+
desc = "Control the sensitivity threshold for camera collisions when 'Camera Indirect Visibility' is enabled. [0] is the most sensitive, [10] is the least sensitive.",
82+
min = 1,
83+
max = 10,
84+
step = 0.1,
85+
get = function()
86+
return tonumber(C_CVar.GetCVar("cameraIndirectOffset"))
87+
end,
88+
set = function(_, value)
89+
self:SetCVar("cameraIndirectOffset", value)
90+
end,
91+
disabled = function()
92+
return not C_CVar.GetCVarBool("cameraIndirectVisibility")
93+
end,
94+
--this feature is only supported in 11.0 at the moment
95+
hidden = function()
96+
return not addon.IsRetail()
97+
end,
98+
width = THIRD_WIDTH,
99+
order = 22,
100+
},
101+
-------------------------------------------------
102+
actionCameraHeader = {
103+
type = "header",
104+
name = "Action Camera",
105+
order = 30,
106+
},
107+
actionCam = {
108+
type = "select",
109+
name = "Select Action Cam mode:",
110+
desc = "Select the mode for the Action Cam.",
111+
values = {
112+
["default"] = "Default",
113+
["on"] = "On",
114+
["basic"] = "Basic",
115+
["full"] = "Full",
116+
},
117+
sorting = {
118+
"default",
119+
"on",
120+
"basic",
121+
"full",
122+
},
123+
get = function()
124+
return self.getActionCamMode()
125+
end,
126+
set = function(_, value)
127+
ConsoleExec("actioncam" .. " " .. value)
128+
end,
129+
width = THIRD_WIDTH,
130+
order = 31,
131+
},
132+
}
133+
}
134+
135+
return cameraOptions
136+
end

gui/GeneralConfigPanel.lua

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,6 @@ local _, addon = ...
33
-- Constants
44
local THIRD_WIDTH = 1.25
55

6-
local maxCameraZoomFactor
7-
if not addon.IsRetail() then
8-
maxCameraZoomFactor = 3.4
9-
else
10-
maxCameraZoomFactor = 2.6
11-
end
12-
136
-------------------------------------------------------------------------
147
-------------------------------------------------------------------------
158

@@ -246,48 +239,6 @@ function addon:CreateGeneralOptions()
246239
width = THIRD_WIDTH,
247240
order = 31,
248241
},
249-
actionCam = {
250-
type = "select",
251-
name = "Select Action Cam mode:",
252-
desc = "Select the mode for the Action Cam.",
253-
values = {
254-
["default"] = "Default",
255-
["on"] = "On",
256-
["basic"] = "Basic",
257-
["full"] = "Full",
258-
},
259-
sorting = {
260-
"default",
261-
"on",
262-
"basic",
263-
"full",
264-
},
265-
get = function()
266-
return self.getActionCamMode()
267-
end,
268-
set = function(_, value)
269-
ConsoleExec("actioncam" .. " " .. value)
270-
end,
271-
width = THIRD_WIDTH,
272-
order = 32,
273-
},
274-
-- TODO: This might need more work for classic
275-
cameraDistanceMaxZoomFactor = {
276-
type = "range",
277-
name = MAX_FOLLOW_DIST,
278-
desc = OPTION_TOOLTIP_MAX_FOLLOW_DIST,
279-
min = 1,
280-
max = maxCameraZoomFactor,
281-
step = 0.1,
282-
get = function()
283-
return tonumber(C_CVar.GetCVar("cameraDistanceMaxZoomFactor"))
284-
end,
285-
set = function(_, value)
286-
self:SetCVar("cameraDistanceMaxZoomFactor", value)
287-
end,
288-
width = THIRD_WIDTH,
289-
order = 33,
290-
},
291242
-------------------------------------------------
292243
dataHeader = {
293244
type = "header",

0 commit comments

Comments
 (0)