Skip to content

Commit 37f93e8

Browse files
author
LocalIdentity
committed
Remove config and cache path
Removed the config as I don't see a reason for it to exists The function was previously called on every frame in PassiveTreeView but is now cached after each tree change and that cache is used instead
1 parent 9e3e541 commit 37f93e8

3 files changed

Lines changed: 22 additions & 27 deletions

File tree

src/Classes/PassiveSpec.lua

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ function PassiveSpecClass:Init(treeVersion, convert)
8181

8282
-- Keys are node IDs, values are the replacement node
8383
self.hashOverrides = { }
84+
85+
-- Cached highlight path for Split Personality jewels
86+
self.splitPersonalityPath = { }
8487
end
8588

8689
function PassiveSpecClass:Load(xml, dbFileName)
@@ -995,6 +998,22 @@ function PassiveSpecClass:GetShortestPathToClassStart(rootId)
995998
return nil
996999
end
9971000

1001+
function PassiveSpecClass:BuildSplitPersonalityPath()
1002+
local splitPersonalityPath = { }
1003+
for nodeId, itemId in pairs(self.jewels) do
1004+
local item = self.build.itemsTab.items[itemId]
1005+
if item and item.jewelData and item.jewelData.jewelIncEffectFromClassStart then
1006+
local path = self:GetShortestPathToClassStart(nodeId)
1007+
if path then
1008+
for id in pairs(path) do
1009+
splitPersonalityPath[id] = true
1010+
end
1011+
end
1012+
end
1013+
end
1014+
self.splitPersonalityPath = splitPersonalityPath
1015+
end
1016+
9981017
function PassiveSpecClass:AddMasteryEffectOptionsToNode(node)
9991018
node.sd = {}
10001019
if node.masteryEffects ~= nil and #node.masteryEffects > 0 then
@@ -1515,6 +1534,8 @@ function PassiveSpecClass:BuildAllDependsAndPaths()
15151534
end
15161535
end
15171536
end
1537+
1538+
self:BuildSplitPersonalityPath()
15181539
end
15191540

15201541
function PassiveSpecClass:ReplaceNode(old, newNode)

src/Classes/PassiveTreeView.lua

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -274,20 +274,7 @@ function PassiveTreeViewClass:Draw(build, viewPort, inputEvents)
274274
end
275275

276276
-- Split Personality highlight
277-
local splitPersonalityPath = { }
278-
if main.showSplitPersonalityPath then
279-
for nodeId, itemId in pairs(spec.jewels) do
280-
local item = build.itemsTab.items[itemId]
281-
if item and item.jewelData and item.jewelData.jewelIncEffectFromClassStart then
282-
local path = spec:GetShortestPathToClassStart(nodeId)
283-
if path then
284-
for id in pairs(path) do
285-
splitPersonalityPath[id] = true
286-
end
287-
end
288-
end
289-
end
290-
end
277+
local splitPersonalityPath = spec.splitPersonalityPath or { }
291278

292279
if treeClick == "LEFT" then
293280
if hoverNode then

src/Modules/Main.lua

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ function main:Init()
119119
self.showAnimations = true
120120
self.showAllItemAffixes = true
121121
self.errorReadingSettings = false
122-
self.showSplitPersonalityPath = true
123122

124123
if not SetDPIScaleOverridePercent then SetDPIScaleOverridePercent = function(scale) end end
125124

@@ -630,9 +629,6 @@ function main:LoadSettings(ignoreBuild)
630629
self.dpiScaleOverridePercent = tonumber(node.attrib.dpiScaleOverridePercent) or 0
631630
SetDPIScaleOverridePercent(self.dpiScaleOverridePercent)
632631
end
633-
if node.attrib.showSplitPersonalityPath then
634-
self.showSplitPersonalityPath = node.attrib.showSplitPersonalityPath == "true"
635-
end
636632
end
637633
end
638634
end
@@ -765,7 +761,6 @@ function main:SaveSettings()
765761
showAnimations = tostring(self.showAnimations),
766762
showAllItemAffixes = tostring(self.showAllItemAffixes),
767763
dpiScaleOverridePercent = tostring(self.dpiScaleOverridePercent),
768-
showSplitPersonalityPath = tostring(self.showSplitPersonalityPath),
769764
} })
770765
local res, errMsg = common.xml.SaveXMLFile(setXML, self.userPath.."Settings.xml")
771766
if not res then
@@ -1061,12 +1056,6 @@ function main:OpenOptionsPopup()
10611056
controls.invertSliderScrollDirection.tooltipText = "Default scroll direction is:\nScroll Up = Move right\nScroll Down = Move left"
10621057
controls.invertSliderScrollDirection.state = self.invertSliderScrollDirection
10631058

1064-
nextRow()
1065-
controls.showSplitPersonalityPath = new("CheckBoxControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 20 }, "^7Show Split Personality paths:", function(state)
1066-
self.showSplitPersonalityPath = state
1067-
end)
1068-
controls.showSplitPersonalityPath.state = self.showSplitPersonalityPath
1069-
10701059
if launch.devMode then
10711060
nextRow()
10721061
controls.disableDevAutoSave = new("CheckBoxControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 20 }, "^7Disable Dev AutoSave:", function(state)
@@ -1107,7 +1096,6 @@ function main:OpenOptionsPopup()
11071096
local initialShowAnimations = self.showAnimations
11081097
local initialShowAllItemAffixes = self.showAllItemAffixes
11091098
local initialDpiScaleOverridePercent = self.dpiScaleOverridePercent
1110-
local initialShowSplitPersonalityPath = self.showSplitPersonalityPath
11111099

11121100
-- last line with buttons has more spacing
11131101
nextRow(1.5)
@@ -1166,7 +1154,6 @@ function main:OpenOptionsPopup()
11661154
self.showAllItemAffixes = initialShowAllItemAffixes
11671155
self.dpiScaleOverridePercent = initialDpiScaleOverridePercent
11681156
SetDPIScaleOverridePercent(self.dpiScaleOverridePercent)
1169-
self.showSplitPersonalityPath = initialShowSplitPersonalityPath
11701157
main:ClosePopup()
11711158
end)
11721159
nextRow(1.5)

0 commit comments

Comments
 (0)