unitframes: option to always use 2d portraits

This commit is contained in:
shagu
2017-06-18 23:18:07 +02:00
parent 3909cb38d1
commit 3cd63cff53
3 changed files with 38 additions and 31 deletions
+1
View File
@@ -76,6 +76,7 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", nil, "custombgcolor", ".5,.2,.2,1") pfUI:UpdateConfig("unitframes", nil, "custombgcolor", ".5,.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, "always2dportrait", "0")
pfUI:UpdateConfig("unitframes", nil, "portraittexture", "1") pfUI:UpdateConfig("unitframes", nil, "portraittexture", "1")
pfUI:UpdateConfig("unitframes", nil, "layout", "default") pfUI:UpdateConfig("unitframes", nil, "layout", "default")
pfUI:UpdateConfig("unitframes", nil, "rangecheck", "0") pfUI:UpdateConfig("unitframes", nil, "rangecheck", "0")
+35 -30
View File
@@ -717,40 +717,45 @@ function pfUI.uf:RefreshUnit(unit, component)
-- portrait -- portrait
if unit.portrait and ( component == "all" or component == "portrait" ) then if unit.portrait and ( component == "all" or component == "portrait" ) then
if not UnitIsVisible(unit.label .. unit.id) or not UnitIsConnected(unit.label .. unit.id) then if pfUI_config.unitframes.always2dportrait == "1" then
if unit.config.portrait == "bar" then unit.portrait.tex:Show()
unit.portrait.tex:Hide() unit.portrait.model:Hide()
unit.portrait.model:Hide() SetPortraitTexture(unit.portrait.tex, unit.label .. unit.id)
elseif pfUI_config.unitframes.portraittexture == "1" then
unit.portrait.tex:Show()
unit.portrait.model:Hide()
SetPortraitTexture(unit.portrait.tex, unit.label .. unit.id)
else
unit.portrait.tex:Hide()
unit.portrait.model:Show()
unit.portrait.model:SetModelScale(4.25)
unit.portrait.model:SetPosition(0, 0, -1)
unit.portrait.model:SetModel("Interface\\Buttons\\talktomequestionmark.mdx")
end
else else
if unit.config.portrait == "bar" then if not UnitIsVisible(unit.label .. unit.id) or not UnitIsConnected(unit.label .. unit.id) then
unit.portrait:SetAlpha(pfUI_config.unitframes.portraitalpha) if unit.config.portrait == "bar" then
end unit.portrait.tex:Hide()
unit.portrait.tex:Hide() unit.portrait.model:Hide()
unit.portrait.model:Show() elseif pfUI_config.unitframes.portraittexture == "1" then
unit.portrait.tex:Show()
if unit.tick then unit.portrait.model:Hide()
unit.portrait.model.next:SetUnit(unit.label .. unit.id) SetPortraitTexture(unit.portrait.tex, unit.label .. unit.id)
if unit.portrait.model.lastUnit ~= UnitName(unit.label .. unit.id) or unit.portrait.model:GetModel() ~= unit.portrait.model.next:GetModel() then else
unit.portrait.model:SetUnit(unit.label .. unit.id) unit.portrait.tex:Hide()
unit.portrait.model.lastUnit = UnitName(unit.label .. unit.id) unit.portrait.model:Show()
unit.portrait.model:SetCamera(0) unit.portrait.model:SetModelScale(4.25)
unit.portrait.model:SetPosition(0, 0, -1)
unit.portrait.model:SetModel("Interface\\Buttons\\talktomequestionmark.mdx")
end end
else else
unit.portrait.model:SetUnit(unit.label .. unit.id) if unit.config.portrait == "bar" then
unit.portrait.model:SetCamera(0) unit.portrait:SetAlpha(pfUI_config.unitframes.portraitalpha)
end end
unit.portrait.tex:Hide()
unit.portrait.model:Show()
if unit.tick then
unit.portrait.model.next:SetUnit(unit.label .. unit.id)
if unit.portrait.model.lastUnit ~= UnitName(unit.label .. unit.id) or unit.portrait.model:GetModel() ~= unit.portrait.model.next:GetModel() then
unit.portrait.model:SetUnit(unit.label .. unit.id)
unit.portrait.model.lastUnit = UnitName(unit.label .. unit.id)
unit.portrait.model:SetCamera(0)
end
else
unit.portrait.model:SetUnit(unit.label .. unit.id)
unit.portrait.model:SetCamera(0)
end
end
end end
end end
+1
View File
@@ -765,6 +765,7 @@ pfUI:RegisterModule("gui", function ()
CreateConfig(this, "Custom Health Bar Background Color", C.unitframes, "custombgcolor", "color") CreateConfig(this, "Custom Health Bar Background Color", C.unitframes, "custombgcolor", "color")
CreateConfig(this, "Healthbar Animation Speed", C.unitframes, "animation_speed") CreateConfig(this, "Healthbar Animation Speed", C.unitframes, "animation_speed")
CreateConfig(this, "Portrait Alpha", C.unitframes, "portraitalpha") CreateConfig(this, "Portrait Alpha", C.unitframes, "portraitalpha")
CreateConfig(this, "Always Use 2D Portraits", C.unitframes, "always2dportrait", "checkbox")
CreateConfig(this, "Enable 2D Portraits As Fallback", C.unitframes, "portraittexture", "checkbox") CreateConfig(this, "Enable 2D Portraits As Fallback", C.unitframes, "portraittexture", "checkbox")
CreateConfig(this, "Unit Frame Layout", C.unitframes, "layout", "dropdown", { "default", "tukui" }) CreateConfig(this, "Unit Frame Layout", C.unitframes, "layout", "dropdown", { "default", "tukui" })
CreateConfig(this, "Aggressive 40y-Range Check (Will break stuff)", C.unitframes, "rangecheck", "checkbox") CreateConfig(this, "Aggressive 40y-Range Check (Will break stuff)", C.unitframes, "rangecheck", "checkbox")