Originally Posted by Fizzlemizz
Something like:
Lua Code:
local units = {} units.player = CreateFrame("PlayerModel", nil, UIParent) units.player:SetSize(150, 200) units.player:SetPoint("CENTER", UIParent, "CENTER", 0, 0) units.player:SetUnit("player") units.player:SetCamera(2) units.player:SetFacing(30) units.player:RefreshCamera() units.player:Show() units.target = CreateFrame("PlayerModel", nil, UIParent) units.target:SetSize(150, 200) units.target:SetPoint("CENTER", UIParent, "CENTER", 0, 0) units.target:SetUnit("target") units.target:SetCamera(2) units.target:RefreshCamera() units.target:Show() units.target:SetScript("OnEvent", function(self, event, ...) if event == "PLAYER_TARGET_CHANGED" then if UnitExists("target") then self:SetUnit("target") self:Show() else self:Hide() end return end local unit = ... local unitframe = units[unit] if unitframe then unitframe:SetUnit(unit) end end) units.target:RegisterEvent("UNIT_MODEL_CHANGED") units.target:RegisterEvent("UNIT_PORTRAIT_UPDATE") units.target:RegisterEvent("PLAYER_TARGET_CHANGED")
The target frame traps the events for both models and checks against the unit parameter (for the UNIT_ events) for which one is being effected by the event then looks up the units table to find if and which frame to update.
You can use the model:SetPortraitZoom() and SetPosition() methods zoom/move the model within the frame.
|
Oh my god! Fizzlemizz, you are seriously my inspiration for addon dev to begin with!! I’ve been using DUF for a lot of my UI projects for such a long time. I honestly couldn’t have asked for a better response from a better person. To be honest, I thought about reaching out to you with my questions but I didn’t want to bother you. Thanks so much for taking the time to reply. I’ll hit the drawing board with this new info, thanks a ton!