View Single Post
09-25-10, 05:31 AM   #18
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Post me the script you used to generate the result aswell please.

I added the GetModel now aswell. It is indeed useful.
Code:
  --bring the model to life and set the displayID
  local function rIMV_setModel(self,id)
  
    self:ClearModel()
    local defaultmodel = "interface\\buttons\\talktomequestionmark.m2"
    self:SetModel(defaultmodel) --in case setdisplayinfo fails 
    self:SetDisplayInfo(id)
    local model = self:GetModel()
    if model == defaultmodel then
      self.model = ""
      self:EnableMouse(false)
    else
      self.model = model
      self:EnableMouse(true)
    end
    self.id = id
    self.p:SetText(id)

  end
Using self:Hide() is a bad. Because it diabled them and on the next couple of pages you will have zero models left. Because all become hidden.

That is my idea:


Not sure if it will work out though. Plus is that you can copy stuff out of TinyPad.

Code:
  
  -- rIngameModelExtractor
  -- zork 2010



  -----------------------------
  -- FUNCTIONS
  -----------------------------
  
  local tags = {}
  
  local function rIME_createModelOutput()
    
    local m = CreateFrame("PlayerModel", "rIME_Icon", UIParent)
    local defaultmodel = "interface\\buttons\\talktomequestionmark.m2"
    --m:Hide()
    
    local txt = ""
    for i=1, 40 do
      m:ClearModel()
      m:SetModel(defaultmodel) --in case setdisplayinfo fails 
      m:SetDisplayInfo(i)
      local model = m:GetModel()
      if model ~= defaultmodel then
        txt = txt.."displayid: "..i.." model: "..model.."\n"
      end
    end
    
    TinyPadEditBox:SetText(txt)
  end

  --tooltip for icon func
  local function rIME_showIconTooltip(self)
    GameTooltip:SetOwner(self, "ANCHOR_CURSOR")
    --GameTooltip:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", -90, 90)
    GameTooltip:AddLine("rIngameModelExtractor", 0, 1, 0.5, 1, 1, 1)
    if TinyPadFrame then
      GameTooltip:AddLine("Click start extracting!", 1, 1, 1, 1, 1, 1)
    else
      GameTooltip:AddLine("TinyPad is not loaded!", 1, 0.3, 0.3, 1, 1, 1)
    end
    GameTooltip:AddLine("Hold down ALT to drag the icon!", 1, 1, 1, 1, 1, 1)
    GameTooltip:Show()
  end

  --create icon func
  local function rIME_createIcon()
    local i = CreateFrame("PlayerModel", "rIME_Icon", UIParent)
    i:SetSize(64,64)
    i:SetPoint("CENTER",0,0)
    i:SetDisplayInfo(29190)
    i:SetCamDistanceScale(0.5)
  
    i:SetMovable(true)
    i:SetUserPlaced(true)
    i:EnableMouse(true)
    i:RegisterForDrag("LeftButton","RightButton")
    i:SetScript("OnDragStart", function(s) if IsAltKeyDown() then s:StartMoving() end end)
    i:SetScript("OnDragStop", function(s) s:StopMovingOrSizing() end)
    i:SetScript("OnMouseDown", function()
      if not IsAltKeyDown() then
        TinyPadFrame:Show()
        if TinyPadEditBox and TinyPadEditBox:IsVisible() and TinyPadEditBox:IsShown() then
          rIME_createModelOutput()
        end
      end
    end)
  
    i:SetScript("OnEnter", function(s) rIME_showIconTooltip(s) end)
    i:SetScript("OnLeave", function(s) GameTooltip:Hide() end)
  
  end
  
  -----------------------------
  -- LOADUP
  -----------------------------

  --rIME_init func
  local function rIME_init()
  
    rIME_createIcon()

  end
  
  --PLAYER_LOGIN EVENT HOOK  
  local a = CreateFrame("Frame")
  
  a:SetScript("OnEvent", function (s,e,...)
    if(e=="PLAYER_LOGIN") then
      rIME_init()
    end 
  end)
  
  a:RegisterEvent("PLAYER_LOGIN")
TinyPad is a dependency.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 09-25-10 at 06:24 AM.
  Reply With Quote