diff --git a/src/Classes/PassiveSpec.lua b/src/Classes/PassiveSpec.lua index 3b2d0ce207..86310d575a 100644 --- a/src/Classes/PassiveSpec.lua +++ b/src/Classes/PassiveSpec.lua @@ -913,6 +913,7 @@ function PassiveSpecClass:GetEffectiveAllocationPath(node, altPath) end function PassiveSpecClass:AllocNode(node, altPath) + self.build.treeTab.viewer.searchStrCached = "" if not node.path then -- Node cannot be connected to the tree as there is no possible path return @@ -972,6 +973,7 @@ end -- Deallocate the given node, and all nodes which depend on it (i.e. which are only connected to the tree through this node) function PassiveSpecClass:DeallocNode(node) + self.build.treeTab.viewer.searchStrCached = "" for _, depNode in ipairs(node.depends) do -- reset any switched attribute nodes if depNode.isAttribute then diff --git a/src/Classes/PassiveTreeView.lua b/src/Classes/PassiveTreeView.lua index 2149899ce6..5c9e91301b 100644 --- a/src/Classes/PassiveTreeView.lua +++ b/src/Classes/PassiveTreeView.lua @@ -763,7 +763,7 @@ function PassiveTreeViewClass:Draw(build, viewPort, inputEvents) local node2 = spec.nodes[connector.nodeId2] if not node1.unlockConstraint and not node2.unlockConstraint then renderConnector(connector) - elseif checkUnlockConstraints(build, node1) and checkUnlockConstraints(build, node2) then + elseif self:checkUnlockConstraints(build, node1) and self:checkUnlockConstraints(build, node2) then renderConnector(connector) end end @@ -809,9 +809,8 @@ function PassiveTreeViewClass:Draw(build, viewPort, inputEvents) end -- Update cached node data - if self.searchStrCached ~= self.searchStr or self.searchNeedsForceUpdate == true then + if self.searchStrCached ~= self.searchStr then self.searchStrCached = self.searchStr - self.searchNeedsForceUpdate = false local function prepSearch(search) search = search:lower() @@ -831,7 +830,7 @@ function PassiveTreeViewClass:Draw(build, viewPort, inputEvents) self.searchParams = prepSearch(self.searchStr) for nodeId, node in pairs(spec.nodes) do - self.searchStrResults[nodeId] = #self.searchParams > 0 and self:DoesNodeMatchSearchParams(node) + self.searchStrResults[nodeId] = #self.searchParams > 0 and self:DoesNodeMatchSearchParams(build, node) end end @@ -923,7 +922,7 @@ function PassiveTreeViewClass:Draw(build, viewPort, inputEvents) -- This is the icon that appears in the center of many groups if not node.unlockConstraint then base = tree:GetAssetByName(node.activeEffectImage) - elseif checkUnlockConstraints(build, node) then + elseif self:checkUnlockConstraints(build, node) then base = tree:GetAssetByName(node.activeEffectImage) end SetDrawLayer(nil, 15) @@ -933,7 +932,7 @@ function PassiveTreeViewClass:Draw(build, viewPort, inputEvents) if node.activeEffectImage then if not node.unlockConstraint then effect = tree:GetAssetByName(node.activeEffectImage) - elseif checkUnlockConstraints(build, node) then + elseif self:checkUnlockConstraints(build, node) then effect = tree:GetAssetByName(node.activeEffectImage) end end @@ -941,7 +940,7 @@ function PassiveTreeViewClass:Draw(build, viewPort, inputEvents) if not node.unlockConstraint then base = tree:GetAssetByName(node.icon) overlay = node.overlay[state] - elseif checkUnlockConstraints(build, node) then + elseif self:checkUnlockConstraints(build, node) then base = tree:GetAssetByName(node.icon) overlay = node.overlay[state] end @@ -1157,7 +1156,7 @@ function PassiveTreeViewClass:Draw(build, viewPort, inputEvents) end end - if node == hoverNode and (not node.unlockConstraint or checkUnlockConstraints(build, node)) and (node.type ~= "Socket" or not IsKeyDown("SHIFT")) and not IsKeyDown("CTRL") and not main.popups[1] then + if node == hoverNode and (not node.unlockConstraint or self:checkUnlockConstraints(build, node)) and (node.type ~= "Socket" or not IsKeyDown("SHIFT")) and not IsKeyDown("CTRL") and not main.popups[1] then -- Draw tooltip SetDrawLayer(nil, 100) local size = m_floor(node.size * scale) @@ -1442,11 +1441,15 @@ function PassiveTreeViewClass:Focus(x, y, viewPort, build) self.zoomY = -y * scale end -function PassiveTreeViewClass:DoesNodeMatchSearchParams(node) +function PassiveTreeViewClass:DoesNodeMatchSearchParams(build, node) if node.type == "ClassStart" or node.type == "OnlyImage" then return end + if node.unlockConstraint and not self:checkUnlockConstraints(build, node) then + return + end + local needMatches = copyTable(self.searchParams) local err @@ -2092,7 +2095,7 @@ function PassiveTreeViewClass:LessLuminance() end -- Checks if a node has unlockConstraint and if that node is allocated -function checkUnlockConstraints(build, node) +function PassiveTreeViewClass:checkUnlockConstraints(build, node) if unseenPathHover and node.unlockConstraint and node.unlockConstraint.nodes[1] == 5571 then return true end diff --git a/src/Modules/Build.lua b/src/Modules/Build.lua index d2925e4312..18d1aab3a7 100644 --- a/src/Modules/Build.lua +++ b/src/Modules/Build.lua @@ -246,21 +246,21 @@ function buildMode:Init(dbFileName, buildName, buildXML, convertBuild, importLin self.spec:AddUndoState() self.spec:SetWindowTitleWithBuildClass() self.buildFlag = true - self.treeTab.viewer.searchNeedsForceUpdate = true + self.treeTab.viewer.searchStrCached = "" else main:OpenConfirmPopup("Class Change", "Changing class to "..value.label.." will reset your passive tree.\nThis can be avoided by connecting one of the "..value.label.." starting nodes to your tree.", "Continue", function() self.spec:SelectClass(value.classId) self.spec:AddUndoState() self.spec:SetWindowTitleWithBuildClass() self.buildFlag = true - self.treeTab.viewer.searchNeedsForceUpdate = true + self.treeTab.viewer.searchStrCached = "" end, "Connect Path", function() if self.spec:ConnectToClass(value.classId) then self.spec:SelectClass(value.classId) self.spec:AddUndoState() self.spec:SetWindowTitleWithBuildClass() self.buildFlag = true - self.treeTab.viewer.searchNeedsForceUpdate = true + self.treeTab.viewer.searchStrCached = "" end end) end