Good spot, still crossing fingers.
edit:
Removed SetMapToPlayerLocation() call in drawCallback
Revised CreatePin and TooltipCreator as per your comments
*sigh* Still no pins. Are you sure I didn't miss anything vital out ?
edit2:
Moved the Filter creation into a separate function and called it before AddCustomPin just in case. I also changed it to
WORLD_MAP_FILTERS.pvePanel:AddPinFilterCheckBox(_G[pinType], function() self:RefreshCustomPins(pinType) end)
so that it would use my pin type rather than the '5' resource reference, just in case that was causing the problem. But nada. Still no pins being displayed.
edit3:
Had to remove above change as it reported an error saying a table didn't exist when you click on the buttons. So now the question arises as to whether it is the filters that are messing things up if changing to my pinType instead of 5.
New filter code as follows, I am assuming the callback function is called when refreshing the filter option so I refreshed the pins there.:
Lua Code:
function CustomMapPins:AddFilter(...)
local pinType,pinID,enable = ...
WORLD_MAP_FILTERS.pvePanel:AddPinFilterCheckBox(5, function() self:RefreshCustomPins(pinType) end)
WORLD_MAP_FILTERS.pvePanel.lastControl.label:SetText(GetString("SI_MAPFILTER",5).." ("..TradeSkills[pinID].Name..")")
WORLD_MAP_FILTERS.pvePanel.lastControl:SetState(1)
self:SetCustomPinEnabled( pinType, enable )
self:RefreshCustomPins(pinType)
end
local function InitPinTypes()
for i,v in ipairs(TradeSkills) do
local pinType = addonPrefix.."_"..v.Name
local pinID = i
local drawCallback = function(pinManager)
--SetMapToPlayerLocation()
local pinZone = GetUnitZone("player") --GetMapName()
local harvestData = self.Data[pinType][pinZone]
for i,v in pairs(harvestData) do
pinManager:CreatePin(_G[pinType], v.key, v.x, v.y, v.radius)
end
end
local resizeCallback = nil --function(width,height) XMPins:RefreshCustomPins(pinType) end
local pinLayoutData = {}
for i,v in pairs(XMPins.Layout) do
pinLayoutData[i] = v
end
pinLayoutData.texture = TradeSkills[pinID].Icon
local pinTooltipCreator = { creator = function(pin) InformationTooltip:AddLine(pin.m_PinTag.tooltip) end, tooltip = InformationTooltip }
XMPins:AddFilter(pinType,pinID,true)
XMPins:AddCustomPin(pinType,drawCallback,resizeCallback,pinLayoutData,pinTooltipCreator,pinID)
end
end