Choose 3D, 2D or round/square class icon portraits

This commit is contained in:
Brues
2026-10-31 14:43:43 -05:00
parent 78d4e0a56e
commit f81ea09d1c
11 changed files with 113 additions and 44 deletions
+10 -1
View File
@@ -224,7 +224,7 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", nil, "animatebars", "1")
pfUI:UpdateConfig("unitframes", nil, "portraitalpha", "0.1")
pfUI:UpdateConfig("unitframes", nil, "always2dportrait", "0")
pfUI:UpdateConfig("unitframes", nil, "portraitstyle", "3d")
pfUI:UpdateConfig("unitframes", nil, "portraittexture", "1")
pfUI:UpdateConfig("unitframes", nil, "layout", "default")
pfUI:UpdateConfig("unitframes", nil, "rangecheck", "0")
@@ -1409,6 +1409,15 @@ function pfUI:MigrateConfig()
end
end
-- migrate "Always Use 2D Portraits" to the portrait style; keyed on the old
-- setting rather than the version, which dev installs stamp as 999.999.999
if pfUI_config.unitframes.always2dportrait then
if pfUI_config.unitframes.always2dportrait == "1" then
pfUI_config.unitframes.portraitstyle = "2d"
end
pfUI_config.unitframes.always2dportrait = nil
end
-- Remove "Show only own debuffs" from unitframes and nameplates
-- (feature was removed; only Target Debuff Bar in buffwatch keeps it)
if pfUI_config.nameplates then
+56 -34
View File
@@ -684,7 +684,6 @@ function pfUI.uf:UpdateConfig()
end
f.portrait.tex:SetAllPoints(f.portrait)
f.portrait.tex:SetTexCoord(.1, .9, .1, .9)
f.portrait.model:SetAllPoints(f.portrait)
if f.config.portrait == "bar" then
@@ -1870,6 +1869,35 @@ function pfUI.uf:UpdateDruidMana(unit)
bar:Show()
end
-- the class icon sheets of the class portrait styles, both laid out by
-- CLASS_ICON_TCOORDS: pfUI's round icons and the stock character creation ones
local classicons = {
["classround"] = "img:classicons",
["classsquare"] = "Interface\\Glues\\CharacterCreate\\UI-CharacterCreate-Classes",
}
-- shows the portrait as a texture: a player's class icon with a class style,
-- the 2D portrait otherwise
local function ShowPortraitTexture(portrait, unitstr)
local _, class = UnitClass(unitstr)
local sheet = classicons[C.unitframes.portraitstyle]
local coords = sheet and UnitIsPlayer(unitstr) and CLASS_ICON_TCOORDS[class]
if coords then
-- crop the icon's rim the way the 2D portrait is cropped
local left, right, top, bottom = unpack(coords)
local x, y = (right - left) * .1, (bottom - top) * .1
portrait.tex:SetTexture(pfUI.media[sheet])
portrait.tex:SetTexCoord(left + x, right - x, top + y, bottom - y)
else
portrait.tex:SetTexCoord(.1, .9, .1, .9)
SetPortraitTexture(portrait.tex, unitstr)
end
portrait.tex:Show()
portrait.model:Hide()
end
function pfUI.uf:RefreshUnit(unit, component)
-- break early on misconfigured UF's
if not unit.label then return end
@@ -2185,44 +2213,38 @@ function pfUI.uf:RefreshUnit(unit, component)
-- portrait
if unit.portrait and ( component == "all" or component == "portrait" ) then
if C.unitframes.always2dportrait == "1" then
unit.portrait.tex:Show()
unit.portrait.model:Hide()
SetPortraitTexture(unit.portrait.tex, unitstr)
else
if not UnitIsVisible(unitstr) or not UnitIsConnected(unitstr) then
if unit.config.portrait == "bar" then
unit.portrait.tex:Hide()
unit.portrait.model:Hide()
elseif C.unitframes.portraittexture == "1" then
unit.portrait.tex:Show()
unit.portrait.model:Hide()
SetPortraitTexture(unit.portrait.tex, unitstr)
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
if C.unitframes.portraitstyle ~= "3d" then
ShowPortraitTexture(unit.portrait, unitstr)
elseif not UnitIsVisible(unitstr) or not UnitIsConnected(unitstr) then
if unit.config.portrait == "bar" then
unit.portrait.tex:Hide()
unit.portrait.model:Hide()
elseif C.unitframes.portraittexture == "1" then
ShowPortraitTexture(unit.portrait, unitstr)
else
if unit.config.portrait == "bar" then
unit.portrait:SetAlpha(C.unitframes.portraitalpha)
else
unit.portrait:SetAlpha(1)
end
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
if unit.config.portrait == "bar" then
unit.portrait:SetAlpha(C.unitframes.portraitalpha)
else
unit.portrait:SetAlpha(1)
end
unit.portrait.tex:Hide()
unit.portrait.model:Show()
if component == "portrait" then
-- regular portrait update after event
if component == "portrait" then
-- regular portrait update after event
unit.portrait.model.update = unitstr
else
-- detect portrait change without events
unit.portrait.model.next:SetUnit(unitstr)
if unit.portrait.model.lastUnit ~= UnitName(unitstr) or unit.portrait.model:GetModel() ~= unit.portrait.model.next:GetModel() then
unit.portrait.model.update = unitstr
else
-- detect portrait change without events
unit.portrait.model.next:SetUnit(unitstr)
if unit.portrait.model.lastUnit ~= UnitName(unitstr) or unit.portrait.model:GetModel() ~= unit.portrait.model.next:GetModel() then
unit.portrait.model.update = unitstr
end
end
end
end
+5 -1
View File
@@ -1,4 +1,6 @@
pfUI_translation["deDE"] = {
["2D"] = nil,
["3D"] = nil,
["3D World Unit Font"] = nil,
["Abbreviate Numbers (4200 -> 4.2k)"] = nil,
["Abbreviate Unit Names"] = nil,
@@ -27,7 +29,6 @@ pfUI_translation["deDE"] = {
["Always Show Item Comparison"] = nil,
["Always Show On Target Units"] = nil,
["Always Show On Units With Missing HP"] = nil,
["Always Use 2D Portraits"] = nil,
["Ammo Counter"] = nil,
["Anchor Bags Above Chat"] = nil,
["A new installation of |cff33ffccpf|rUI ships with 4 prebuilt design profiles. Click below if you wish to load one of these profiles."] = nil,
@@ -121,6 +122,8 @@ pfUI_translation["deDE"] = {
["Chat Bubble Transparency"] = nil,
["Chat Default Brackets"] = nil,
["Class"] = nil,
["Class Icon (Round)"] = nil,
["Class Icon (Square)"] = nil,
["Clear Rolls"] = nil,
["Click Action"] = nil,
["Click Casting"] = nil,
@@ -592,6 +595,7 @@ pfUI_translation["deDE"] = {
["Portrait Alpha"] = nil,
["Portrait Height"] = nil,
["Portrait Position"] = nil,
["Portrait Style"] = nil,
["Portrait Width"] = nil,
["Powerbar"] = nil,
["Power Bar Anchor"] = nil,
+5 -1
View File
@@ -1,4 +1,6 @@
pfUI_translation["enUS"] = {
["2D"] = nil,
["3D"] = nil,
["3D World Unit Font"] = nil,
["Abbreviate Numbers (4200 -> 4.2k)"] = nil,
["Abbreviate Unit Names"] = nil,
@@ -28,7 +30,6 @@ pfUI_translation["enUS"] = {
["Always Show Item Comparison"] = nil,
["Always Show On Target Units"] = nil,
["Always Show On Units With Missing HP"] = nil,
["Always Use 2D Portraits"] = nil,
["Ammo Counter"] = nil,
["Anchor Bags Above Chat"] = nil,
["A new installation of |cff33ffccpf|rUI ships with 4 prebuilt design profiles. Click below if you wish to load one of these profiles."] = nil,
@@ -126,6 +127,8 @@ pfUI_translation["enUS"] = {
["Chat Bubble Transparency"] = nil,
["Chat Default Brackets"] = nil,
["Class"] = nil,
["Class Icon (Round)"] = nil,
["Class Icon (Square)"] = nil,
["Clear"] = nil,
["Clear Rolls"] = nil,
["Click Action"] = nil,
@@ -610,6 +613,7 @@ pfUI_translation["enUS"] = {
["Portrait Alpha"] = nil,
["Portrait Height"] = nil,
["Portrait Position"] = nil,
["Portrait Style"] = nil,
["Portrait Width"] = nil,
["Powerbar"] = nil,
["Power Bar Anchor"] = nil,
+5 -1
View File
@@ -1,4 +1,6 @@
pfUI_translation["esES"] = {
["2D"] = nil,
["3D"] = nil,
["3D World Unit Font"] = nil,
["Abbreviate Numbers (4200 -> 4.2k)"] = "Abreviar números (4200 -> 4.2k)",
["Abbreviate Unit Names"] = nil,
@@ -27,7 +29,6 @@ pfUI_translation["esES"] = {
["Always Show Item Comparison"] = "Mostrar siempre la comparativa entre objetos",
["Always Show On Target Units"] = "Mostrar siempre en el objectivo",
["Always Show On Units With Missing HP"] = "Mostrar siempre en unidades con falta de salud",
["Always Use 2D Portraits"] = "Usar siempre retratos 2D",
["Ammo Counter"] = "Contador de munición",
["Anchor Bags Above Chat"] = nil,
["A new installation of |cff33ffccpf|rUI ships with 4 prebuilt design profiles. Click below if you wish to load one of these profiles."] = "Una nueva instalación de |cff33ffccpf|rUI viene con 4 perfiles de diseño preconfigurados. Haga clic debajo si deseas cargar uno de estos perfiles.",
@@ -121,6 +122,8 @@ pfUI_translation["esES"] = {
["Chat Bubble Transparency"] = "Transparencia de los bocadillos de chat",
["Chat Default Brackets"] = "Corchetes de chat predeterminados",
["Class"] = "Clase",
["Class Icon (Round)"] = nil,
["Class Icon (Square)"] = nil,
["Clear Rolls"] = "Borrar los dados",
["Click Action"] = "Acción al hacer clic",
["Click Casting"] = "Lanzamiento al hacer click",
@@ -592,6 +595,7 @@ pfUI_translation["esES"] = {
["Portrait Alpha"] = "Transparencia del retrato",
["Portrait Height"] = "Altura Retrato",
["Portrait Position"] = "Posición del retrato",
["Portrait Style"] = nil,
["Portrait Width"] = "Ancho Retrato",
["Powerbar"] = "Barra de poder",
["Power Bar Anchor"] = "Ancla de la barra de poder",
+5 -1
View File
@@ -1,4 +1,6 @@
pfUI_translation["frFR"] = {
["2D"] = nil,
["3D"] = nil,
["3D World Unit Font"] = nil,
["Abbreviate Numbers (4200 -> 4.2k)"] = "Nombre abrégés (4200 -> 4.2k)",
["Abbreviate Unit Names"] = nil,
@@ -27,7 +29,6 @@ pfUI_translation["frFR"] = {
["Always Show Item Comparison"] = "Toujours afficher la comparaison d'objet",
["Always Show On Target Units"] = "Toujours montrer sur la cible",
["Always Show On Units With Missing HP"] = "Toujours montrer sur les cibles avec de la vie manquante",
["Always Use 2D Portraits"] = "Toujours utiliser les portraits 2D",
["Ammo Counter"] = "Compteur de munitions",
["Anchor Bags Above Chat"] = nil,
["A new installation of |cff33ffccpf|rUI ships with 4 prebuilt design profiles. Click below if you wish to load one of these profiles."] = "Une nouvelle installation de |cff33ffccpf|rUI est livrée avec 4 profils de conception prédéfinis, Cliquez ci-dessous si vous souhaitez charger l'un de ces profils",
@@ -121,6 +122,8 @@ pfUI_translation["frFR"] = {
["Chat Bubble Transparency"] = "Transparence de la bulle de chat",
["Chat Default Brackets"] = "Supports par défaut du chat",
["Class"] = "Classe",
["Class Icon (Round)"] = nil,
["Class Icon (Square)"] = nil,
["Clear Rolls"] = "Clear les roulements",
["Click Action"] = "Action au clic",
["Click Casting"] = "Clique sur le lancement de sort",
@@ -592,6 +595,7 @@ pfUI_translation["frFR"] = {
["Portrait Alpha"] = "Transparence du portrait",
["Portrait Height"] = "Hauteur du portrait",
["Portrait Position"] = "Position du portrait",
["Portrait Style"] = nil,
["Portrait Width"] = "Largeur du portrait",
["Powerbar"] = "Barre des ressources",
["Power Bar Anchor"] = "Ancrage de la Barre des ressources",
+5 -1
View File
@@ -1,4 +1,6 @@
pfUI_translation["koKR"] = {
["2D"] = nil,
["3D"] = nil,
["3D World Unit Font"] = nil,
["Abbreviate Numbers (4200 -> 4.2k)"] = "체력수치 약어 (4200 -> 4.2k)",
["Abbreviate Unit Names"] = nil,
@@ -27,7 +29,6 @@ pfUI_translation["koKR"] = {
["Always Show Item Comparison"] = "항상 착용 장비와 비교 표시",
["Always Show On Target Units"] = nil,
["Always Show On Units With Missing HP"] = nil,
["Always Use 2D Portraits"] = "항상 2D초상화 사용",
["Ammo Counter"] = "탄약 갯수",
["Anchor Bags Above Chat"] = nil,
["A new installation of |cff33ffccpf|rUI ships with 4 prebuilt design profiles. Click below if you wish to load one of these profiles."] = nil,
@@ -121,6 +122,8 @@ pfUI_translation["koKR"] = {
["Chat Bubble Transparency"] = nil,
["Chat Default Brackets"] = nil,
["Class"] = "클래스(직업)",
["Class Icon (Round)"] = nil,
["Class Icon (Square)"] = nil,
["Clear Rolls"] = nil,
["Click Action"] = "클릭 액션",
["Click Casting"] = nil,
@@ -592,6 +595,7 @@ pfUI_translation["koKR"] = {
["Portrait Alpha"] = "초상화 투명도",
["Portrait Height"] = "세로 높이",
["Portrait Position"] = "초상화 위치",
["Portrait Style"] = nil,
["Portrait Width"] = "세로 너비",
["Powerbar"] = nil,
["Power Bar Anchor"] = nil,
+5 -1
View File
@@ -1,4 +1,6 @@
pfUI_translation["ruRU"] = {
["2D"] = nil,
["3D"] = nil,
["3D World Unit Font"] = nil,
["Abbreviate Numbers (4200 -> 4.2k)"] = "Сокращать числа (4200 -> 4.2k)",
["Abbreviate Unit Names"] = "Сокращать имена юнитов",
@@ -27,7 +29,6 @@ pfUI_translation["ruRU"] = {
["Always Show Item Comparison"] = "Всегда показывать сравнение предметов",
["Always Show On Target Units"] = "Всегда показывать над выбранной целью",
["Always Show On Units With Missing HP"] = "Всегда показывать над целями с неполным здоровьем",
["Always Use 2D Portraits"] = "Всегда использовать 2D-портреты",
["Ammo Counter"] = "Счетчик боеприпасов",
["Anchor Bags Above Chat"] = nil,
["A new installation of |cff33ffccpf|rUI ships with 4 prebuilt design profiles. Click below if you wish to load one of these profiles."] = "Новая установка |cff33ffccpf|rUI предлагает 4 предварительно созданных профиля дизайна. Нажмите ниже, если вы хотите загрузить один из этих профилей.",
@@ -121,6 +122,8 @@ pfUI_translation["ruRU"] = {
["Chat Bubble Transparency"] = "Прозрачность пузыря чата",
["Chat Default Brackets"] = "Скобки чата",
["Class"] = "Класс",
["Class Icon (Round)"] = nil,
["Class Icon (Square)"] = nil,
["Clear Rolls"] = "Очистить броски",
["Click Action"] = "Действие при нажатии",
["Click Casting"] = "Каст по нажатию",
@@ -592,6 +595,7 @@ pfUI_translation["ruRU"] = {
["Portrait Alpha"] = "Прозрачность портрета",
["Portrait Height"] = "Рост портрета",
["Portrait Position"] = "Расположение портрета",
["Portrait Style"] = nil,
["Portrait Width"] = "Ширина портрета",
["Powerbar"] = "Панель силы (мана, ярость, энергия, фокус)",
["Power Bar Anchor"] = "Привязка панели силы",
+5 -1
View File
@@ -1,4 +1,6 @@
pfUI_translation["zhCN"] = {
["2D"] = nil,
["3D"] = nil,
["3D World Unit Font"] = "3D世界单位字体",
["Abbreviate Numbers (4200 -> 4.2k)"] = "缩写数字格式[4200为4.2K]",
["Abbreviate Unit Names"] = "缩写单位名称",
@@ -27,7 +29,6 @@ pfUI_translation["zhCN"] = {
["Always Show Item Comparison"] = "始终显示装备比较(或按SHIFT键)",
["Always Show On Target Units"] = "始终在目标单位上显示",
["Always Show On Units With Missing HP"] = "始终在未满血单位上显示",
["Always Use 2D Portraits"] = "始终使用2D头像",
["Ammo Counter"] = "弹药数量",
["Anchor Bags Above Chat"] = "将背包锚定在聊天框上方",
["A new installation of |cff33ffccpf|rUI ships with 4 prebuilt design profiles. Click below if you wish to load one of these profiles."] = "pfUI的新安装自带4以下四种预设风格.点击下方可选择其一",
@@ -121,6 +122,8 @@ pfUI_translation["zhCN"] = {
["Chat Bubble Transparency"] = "聊天框气泡效果透明度",
["Chat Default Brackets"] = "聊天框默认括号",
["Class"] = "职业",
["Class Icon (Round)"] = nil,
["Class Icon (Square)"] = nil,
["Clear Rolls"] = "清除Roll点",
["Click Action"] = "点击操作",
["Click Casting"] = "点击施法",
@@ -592,6 +595,7 @@ pfUI_translation["zhCN"] = {
["Portrait Alpha"] = "人偶透明度",
["Portrait Height"] = "纵向高度",
["Portrait Position"] = "人偶头像位置",
["Portrait Style"] = nil,
["Portrait Width"] = "纵向宽度",
["Powerbar"] = "能量(蓝)条",
["Power Bar Anchor"] = "能量条对齐方式(以血条为锚点)",
+5 -1
View File
@@ -1,4 +1,6 @@
pfUI_translation["zhTW"] = {
["2D"] = nil,
["3D"] = nil,
["3D World Unit Font"] = nil,
["Abbreviate Numbers (4200 -> 4.2k)"] = "縮寫數位格式[4200為4.2K]",
["Abbreviate Unit Names"] = nil,
@@ -27,7 +29,6 @@ pfUI_translation["zhTW"] = {
["Always Show Item Comparison"] = "始終顯示裝備比較",
["Always Show On Target Units"] = nil,
["Always Show On Units With Missing HP"] = nil,
["Always Use 2D Portraits"] = "始終使用2D頭像",
["Ammo Counter"] = "彈藥數量",
["Anchor Bags Above Chat"] = nil,
["A new installation of |cff33ffccpf|rUI ships with 4 prebuilt design profiles. Click below if you wish to load one of these profiles."] = "pfUI的安裝內建有四種風格.點選以下讀取其一",
@@ -121,6 +122,8 @@ pfUI_translation["zhTW"] = {
["Chat Bubble Transparency"] = "聊天框氣泡效果透明度",
["Chat Default Brackets"] = "聊天框默認括弧",
["Class"] = "職業",
["Class Icon (Round)"] = nil,
["Class Icon (Square)"] = nil,
["Clear Rolls"] = "清除Roll點",
["Click Action"] = "點擊操作",
["Click Casting"] = nil,
@@ -592,6 +595,7 @@ pfUI_translation["zhTW"] = {
["Portrait Alpha"] = "人偶透明度",
["Portrait Height"] = "纵向高度",
["Portrait Position"] = "人偶頭像位置",
["Portrait Style"] = nil,
["Portrait Width"] = "纵向宽度",
["Powerbar"] = "能量(藍)條",
["Power Bar Anchor"] = "能量條對齊方式(以血條為錨點)",
+7 -1
View File
@@ -957,6 +957,12 @@ pfUI:RegisterModule("gui", function ()
"TOP:" .. T["Center"],
"TOPRIGHT:" .. T["Right"]
},
["uf_portrait_style"] = {
"3d:" .. T["3D"],
"2d:" .. T["2D"],
"classround:" .. T["Class Icon (Round)"],
"classsquare:" .. T["Class Icon (Square)"]
},
["uf_portrait_position"] = {
"bar:" .. T["Healthbar Embedded"],
"left:" .. T["Left"],
@@ -2044,7 +2050,7 @@ pfUI:RegisterModule("gui", function ()
CreateConfig(nil, T["Disable pfUI Unit Frames"], C.unitframes, "disable", "checkbox")
CreateConfig(nil, T["Animate Health And Power Bars"], C.unitframes, "animatebars", "checkbox")
CreateConfig(nil, T["Portrait Alpha"], C.unitframes, "portraitalpha")
CreateConfig(nil, T["Always Use 2D Portraits"], C.unitframes, "always2dportrait", "checkbox")
CreateConfig(nil, T["Portrait Style"], C.unitframes, "portraitstyle", "dropdown", pfUI.gui.dropdowns.uf_portrait_style)
CreateConfig(nil, T["Enable 2D Portraits As Fallback"], C.unitframes, "portraittexture", "checkbox")
CreateConfig(nil, T["Unit Frame Layout"], C.unitframes, "layout", "dropdown", pfUI.gui.dropdowns.uf_layout)
CreateConfig(nil, T["Combopoint Width"], C.unitframes, "combowidth")