mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-21 03:40:49 +00:00
unitframes: option to use fallback 2d portrait
This commit is contained in:
@@ -44,6 +44,7 @@ function pfUI:LoadConfig()
|
|||||||
pfUI:UpdateConfig("unitframes", nil, "customcolor", ".2,.2,.2,1")
|
pfUI:UpdateConfig("unitframes", nil, "customcolor", ".2,.2,.2,1")
|
||||||
pfUI:UpdateConfig("unitframes", nil, "animation_speed", "5")
|
pfUI:UpdateConfig("unitframes", nil, "animation_speed", "5")
|
||||||
pfUI:UpdateConfig("unitframes", nil, "portraitalpha", "0.1")
|
pfUI:UpdateConfig("unitframes", nil, "portraitalpha", "0.1")
|
||||||
|
pfUI:UpdateConfig("unitframes", nil, "portraittexture", "1")
|
||||||
|
|
||||||
pfUI:UpdateConfig("unitframes", nil, "buff_size", "20")
|
pfUI:UpdateConfig("unitframes", nil, "buff_size", "20")
|
||||||
pfUI:UpdateConfig("unitframes", nil, "debuff_size", "20")
|
pfUI:UpdateConfig("unitframes", nil, "debuff_size", "20")
|
||||||
|
|||||||
@@ -863,6 +863,7 @@ pfUI:RegisterModule("gui", function ()
|
|||||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Custom healthbar color", pfUI_config.unitframes, "customcolor", "color")
|
pfUI.gui:CreateConfig(pfUI.gui.uf, "Custom healthbar color", pfUI_config.unitframes, "customcolor", "color")
|
||||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Animation speed", pfUI_config.unitframes, "animation_speed")
|
pfUI.gui:CreateConfig(pfUI.gui.uf, "Animation speed", pfUI_config.unitframes, "animation_speed")
|
||||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Portrait Alpha on Bars", pfUI_config.unitframes, "portraitalpha")
|
pfUI.gui:CreateConfig(pfUI.gui.uf, "Portrait Alpha on Bars", pfUI_config.unitframes, "portraitalpha")
|
||||||
|
pfUI.gui:CreateConfig(pfUI.gui.uf, "Use 2D Portraits as fallback", pfUI_config.unitframes, "portraittexture", "checkbox")
|
||||||
|
|
||||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Buff size", pfUI_config.unitframes, "buff_size")
|
pfUI.gui:CreateConfig(pfUI.gui.uf, "Buff size", pfUI_config.unitframes, "buff_size")
|
||||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Debuff size", pfUI_config.unitframes, "debuff_size")
|
pfUI.gui:CreateConfig(pfUI.gui.uf, "Debuff size", pfUI_config.unitframes, "debuff_size")
|
||||||
|
|||||||
+27
-8
@@ -314,13 +314,21 @@ function pfUI.uf:CreatePortrait(frame, pos, spacing)
|
|||||||
local id = frame.id or ""
|
local id = frame.id or ""
|
||||||
local unitstr = unit .. id
|
local unitstr = unit .. id
|
||||||
|
|
||||||
frame.portrait = CreateFrame("PlayerModel", "pfPortrait" .. unitstr, frame)
|
frame.portrait = CreateFrame("Frame", "pfPortrait" .. unitstr, frame)
|
||||||
frame.portrait:RegisterEvent("UNIT_PORTRAIT_UPDATE")
|
frame.portrait:RegisterEvent("UNIT_PORTRAIT_UPDATE")
|
||||||
frame.portrait:RegisterEvent("UNIT_MODEL_CHANGED")
|
frame.portrait:RegisterEvent("UNIT_MODEL_CHANGED")
|
||||||
frame.portrait:RegisterEvent("PLAYER_ENTERING_WORLD")
|
frame.portrait:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||||
frame.portrait:RegisterEvent("PLAYER_TARGET_CHANGED")
|
frame.portrait:RegisterEvent("PLAYER_TARGET_CHANGED")
|
||||||
|
|
||||||
frame.portrait.base = frame
|
frame.portrait.base = frame
|
||||||
|
frame.portrait.pos = pos
|
||||||
|
|
||||||
|
frame.portrait.tex = frame.portrait:CreateTexture("pfPortraitTexture" .. unitstr, "OVERLAY")
|
||||||
|
frame.portrait.tex:SetAllPoints(frame.portrait)
|
||||||
|
frame.portrait.tex:SetTexCoord(.1, .9, .1, .9)
|
||||||
|
|
||||||
|
frame.portrait.model = CreateFrame("PlayerModel", "pfPortraitModel" .. unitstr, frame.portrait)
|
||||||
|
frame.portrait.model:SetAllPoints(frame.portrait)
|
||||||
|
|
||||||
frame.portrait:SetScript("OnEvent", function()
|
frame.portrait:SetScript("OnEvent", function()
|
||||||
local unit = this.base.label
|
local unit = this.base.label
|
||||||
@@ -380,18 +388,29 @@ function pfUI.uf:UpdatePortrait()
|
|||||||
local unitstr = unit .. id
|
local unitstr = unit .. id
|
||||||
local name = UnitName(unitstr) or ""
|
local name = UnitName(unitstr) or ""
|
||||||
|
|
||||||
if this.name then this:SetCamera(0) end
|
|
||||||
|
|
||||||
if this.name == name then return end
|
if this.name == name then return end
|
||||||
|
|
||||||
if not UnitIsVisible(unitstr) or not UnitIsConnected(unitstr) then
|
if not UnitIsVisible(unitstr) or not UnitIsConnected(unitstr) then
|
||||||
this:SetModelScale(4.25)
|
if this.pos == "bar" then
|
||||||
this:SetPosition(0, 0, -1.0)
|
this.tex:Hide()
|
||||||
this:SetModel("Interface\\Buttons\\talktomequestionmark.mdx")
|
this.model:Hide()
|
||||||
|
elseif pfUI_config.unitframes.portraittexture == "1" then
|
||||||
|
this.tex:Show()
|
||||||
|
this.model:Hide()
|
||||||
|
SetPortraitTexture(this.tex, unitstr)
|
||||||
|
else
|
||||||
|
this.tex:Hide()
|
||||||
|
this.model:Show()
|
||||||
|
this.model:SetModelScale(4.25)
|
||||||
|
this.model:SetPosition(0, 0, -1)
|
||||||
|
this.model:SetModel("Interface\\Buttons\\talktomequestionmark.mdx")
|
||||||
|
end
|
||||||
this.name = nil
|
this.name = nil
|
||||||
else
|
else
|
||||||
this:SetUnit(unitstr)
|
this.tex:Hide()
|
||||||
this:SetCamera(0)
|
this.model:Show()
|
||||||
|
this.model:SetUnit(unitstr)
|
||||||
|
this.model:SetCamera(0)
|
||||||
this.name = name
|
this.name = name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user