View Single Post
04/11/14, 07:29 AM   #8
Xrystal
caritas omnia vincit
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 369
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:
  1. function CustomMapPins:AddFilter(...)
  2.  
  3.     local pinType,pinID,enable = ...
  4.  
  5.     WORLD_MAP_FILTERS.pvePanel:AddPinFilterCheckBox(5, function() self:RefreshCustomPins(pinType) end)     
  6.     WORLD_MAP_FILTERS.pvePanel.lastControl.label:SetText(GetString("SI_MAPFILTER",5).." ("..TradeSkills[pinID].Name..")")
  7.     WORLD_MAP_FILTERS.pvePanel.lastControl:SetState(1)
  8.     self:SetCustomPinEnabled( pinType, enable )
  9.     self:RefreshCustomPins(pinType)
  10.  
  11. end
  12.  
  13. local function InitPinTypes()
  14.     for i,v in ipairs(TradeSkills) do
  15.         local pinType = addonPrefix.."_"..v.Name
  16.         local pinID = i
  17.         local drawCallback = function(pinManager)
  18.             --SetMapToPlayerLocation()
  19.             local pinZone = GetUnitZone("player") --GetMapName()
  20.             local harvestData = self.Data[pinType][pinZone]
  21.             for i,v in pairs(harvestData) do
  22.                 pinManager:CreatePin(_G[pinType], v.key, v.x, v.y, v.radius)
  23.             end
  24.         end
  25.         local resizeCallback = nil --function(width,height) XMPins:RefreshCustomPins(pinType) end      
  26.         local pinLayoutData = {}
  27.         for i,v in pairs(XMPins.Layout) do
  28.             pinLayoutData[i] = v
  29.         end
  30.         pinLayoutData.texture = TradeSkills[pinID].Icon
  31.         local pinTooltipCreator = { creator = function(pin) InformationTooltip:AddLine(pin.m_PinTag.tooltip) end, tooltip = InformationTooltip }
  32.  
  33.         XMPins:AddFilter(pinType,pinID,true)
  34.         XMPins:AddCustomPin(pinType,drawCallback,resizeCallback,pinLayoutData,pinTooltipCreator,pinID)
  35.     end
  36. end

Last edited by Xrystal : 04/11/14 at 08:54 AM.
  Reply With Quote