WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Help with models (https://www.wowinterface.com/forums/showthread.php?t=54808)

Sweetsour 11-07-16 08:30 PM

Help with models
 
Hey everyone!

I seem to having some strange issues with some models in my addon. The following picture shows the models being used. I should add that I don't have too much knowledge with models, seeing as there's little documentation online; at least that I've found.



The top three circular models appear when I use the Stormkeeper ability (Shaman spell with 3 charges). Also, when Maelstrom (Shaman resource type) reaches a certain threshold, the bar gets a lightning model applied it. Sometimes during combat, the models stop appearing until I reload the UI.

This is my code for the frames.

Maelstrom Bar
Lua Code:
  1. SSA.MaelstromBarEnh = CreateFrame("StatusBar","MaelstromBarEnh",AuraGroup);
  2. local MaelstromBar = SSA.MaelstromBarEnh;
  3.  
  4. MaelstromBar:SetStatusBarTexture("Interface\\addons\\ShamanAuras\\media\\statusbar\\fifths");
  5. MaelstromBar:GetStatusBarTexture():SetHorizTile(false);
  6. MaelstromBar:GetStatusBarTexture():SetVertTile(false);
  7. MaelstromBar:SetPoint("CENTER",AuraGroup,"CENTER",0,-139);
  8. MaelstromBar:SetWidth(260);
  9. MaelstromBar:SetHeight(21);
  10. MaelstromBar:SetFrameStrata("LOW");
  11. MaelstromBar:SetStatusBarColor(0,0.5,1);
  12. MaelstromBar:SetAlpha(0);
  13.  
  14. MaelstromBar.bg = MaelstromBar:CreateTexture(nil,"BACKGROUND");
  15. MaelstromBar.bg:SetTexture("Interface\\TargetingFrame\\UI-StatusBar");
  16. MaelstromBar.bg:SetAllPoints(true);
  17. MaelstromBar.bg:SetVertexColor(0,0,0);
  18. MaelstromBar.bg:SetAlpha(0.5);
  19.  
  20. MaelstromBar.text = MaelstromBar:CreateFontString(nil, "HIGH", "GameFontHighlightLarge");
  21. MaelstromBar.text:SetPoint("CENTER",MaelstromBar,"CENTER",0,0);
  22. MaelstromBar.text:SetFont("Fonts\\FRIZQT__.TTF", 12);
  23. MaelstromBar.text:SetTextColor(1,1,1,1);
  24.  
  25. MaelstromBar.Lightning = CreateFrame("PlayerModel","MaelstromBarEnhLightning",MaelstromBar);
  26. MaelstromBar.Lightning:SetModel("SPELLS/LIGHTNING_AREA_DISC_STATE.m2");
  27. MaelstromBar.Lightning:SetFrameStrata("MEDIUM");
  28. MaelstromBar.Lightning:SetPosition(0,0,-2);
  29. MaelstromBar.Lightning:SetAllPoints(MaelstromBar);
  30. MaelstromBar.Lightning:SetAlpha(0);


Stormkeeper Lightning Charges
Lua Code:
  1. local StormkeeperCharges = CreateFrame("Frame","StormkeeperChargeGrp",AuraGroup);
  2. StormkeeperCharges:SetFrameStrata(bg);
  3. StormkeeperCharges:SetWidth(260);
  4. StormkeeperCharges:SetHeight(50);
  5. StormkeeperCharges:SetPoint("CENTER",AuraGroup,"CENTER",0,-110);
  6. StormkeeperCharges:Show();
  7.  
  8. for i=1,3 do
  9.     StormkeeperCharges["Charge"..i] = CreateFrame("Frame","StormkeeperCharge"..i,StormkeeperCharges);
  10.     StormkeeperCharges["Charge"..i]:SetWidth(100);
  11.     StormkeeperCharges["Charge"..i]:SetHeight(100);
  12.     StormkeeperCharges["Charge"..i]:SetPoint("CENTER",StormkeeperCharges,"LEFT",30,-3);
  13.     StormkeeperCharges["Charge"..i]:SetAlpha(0);
  14.     StormkeeperCharges["Charge"..i]:Show();
  15.  
  16.     StormkeeperCharges["Charge"..i].Lightning = CreateFrame("PlayerModel","StormkeeperCharge"..i.."_Lightning",StormkeeperCharges["Charge"..i]);
  17.     StormkeeperCharges["Charge"..i].Lightning:SetModel("spells/Monk_chiblast_precast.m2");
  18.     StormkeeperCharges["Charge"..i].Lightning:SetPosition(0,0,0);
  19.     StormkeeperCharges["Charge"..i].Lightning:SetAllPoints(StormkeeperCharges["Charge"..i]);
  20.     StormkeeperCharges["Charge"..i].Lightning:SetAlpha(1);
  21.     StormkeeperCharges["Charge"..i].Lightning:SetSequence(37);
  22. end

Sweetsour 11-13-16 05:20 PM

So I discovered that hiding then showing my UI (by pressing Alt+Z), will cause my World Scale values to nil. Then when I try to reload UI, the game crashes. Anyone have any idea why this could be happening?

Resike 11-13-16 07:31 PM

Spell icons gets perma hidden with alt+z sadly, this bug is in the game since ages the weird part any other model works just fine. I reported the issue years ago, yet we still waiting on a fix.

Sweetsour 11-13-16 08:49 PM

Wow, well that's next level unfortunate, lol. Thanks for the info!

d87 11-14-16 12:09 PM

Code:

local Redraw = function(self)
    if not self.model_path then return end

    if type(self.model_path) == "number" then
        self:SetDisplayInfo(self.model_path)
    else
        self:SetModel(self.model_path)
    end
    self:SetModelScale(self.model_scale)
    self:SetPosition(self.ox, self.oy, self.oz)
end

local ResetTransformations = function(self)
    self:SetModelScale(1)
    self:SetPosition(0,0,0)
end

f.playermodel:SetScript("OnHide", ResetTransformations)
f.playermodel:SetScript("OnShow", Redraw)
f.playermodel.Redraw = Redraw
f.playermodel.ResetTransformations = ResetTransformations

Here's a workaround for this bug

Sweetsour 11-14-16 02:49 PM

Thanks! I'm going to try and implement this as soon as I can. This will help immensely if I can get it to work! :)

Sweetsour 11-14-16 04:21 PM

It worked! Thanks again! :D


All times are GMT -6. The time now is 09:06 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI