Skip to content

Commit a8c8a03

Browse files
committed
faceposer properties ordering
Make collapsers based on some categories of flexes (mouth, eyes, look, brows) Then sort alphabetically add options to prettify the names or not. One may prefer to see the actual flex names. faceposer: pac_faceposer_prettify_names properties: pac_property_reformating faceposer "prettify name" was supposed to give capitals but properties lowercases everything to split into words, so I added an override for this case
1 parent 1a394bb commit a8c8a03

File tree

2 files changed

+175
-1
lines changed

2 files changed

+175
-1
lines changed

lua/pac3/core/client/parts/faceposer.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,13 @@ BUILDER:StartStorableVars()
5353
:EndStorableVars()
5454

5555

56+
local prettify_name = CreateClientConVar("pac_faceposer_prettify_names", "1", true, false, "whether to prettify flex names in the faceposer part\nEyeDown -> Eye Down\neye_down -> Eye Down\neye-down -> Eye Down")
57+
5658
-- Make the internal flex names be more presentable, TODO: handle numbers
5759
local function PrettifyName( name )
60+
if not prettify_name:GetBool() then return name end
5861
name = name:Replace( "_", " " )
62+
name = name:Replace( "-", " " )
5963

6064
-- Try to split text into words, where words would start with single uppercase character
6165
local newParts = {}
@@ -113,6 +117,7 @@ function PART:GetDynamicProperties()
113117
udata = {
114118
editor_friendly = PrettifyName(name),
115119
group = "flexes",
120+
override_case = true,
116121
editor_sensitivity = 0.1,
117122
editor_onchange = function(self, num)
118123
local min, max = ent:GetFlexBounds(i)

lua/pac3/editor/client/panels/properties.lua

Lines changed: 170 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ local languageID = CreateClientConVar("pac_editor_languageid", 1, true, false, "
44
local favorites_menu_expansion = CreateClientConVar("pac_favorites_try_to_build_asset_series", "0", true, false)
55
local extra_dynamic = CreateClientConVar("pac_special_property_update_dynamically", "1", true, false, "Whether proxies should refresh the properties, and some booleans may show more information.")
66
local special_property_text_color = CreateClientConVar("pac_special_property_text_color", "160 0 80", true, false, "R G B color of special property text\npac_special_property_text_color \"\" will make it not change the color\nSpecial contexts like proxies and hidden parts can show a different color to show that changes are happening in real time.")
7+
local prettify_names = CreateClientConVar("pac_property_reformating", "2", true, false, "How much to reformat the names of properties.\n2 will run the full editor friendly conversion.\n1 will run the editor friendly conversion on most cases except faceposer where an option exists to show the raw flex names\n0 will show the raw keys for everything")
78

89
local pins = CreateClientConVar("pac_editor_pins", 0, true)
910
cvars.AddChangeCallback("pac_editor_pins", function(cvar, old, new)
@@ -1017,7 +1018,19 @@ do -- list
10171018
key = key:sub(1, -4)
10181019
end
10191020

1020-
btn:SetValue(L((udata and udata.editor_friendly or key):gsub("%u", " %1"):lower()):Trim())
1021+
local nicenames = prettify_names:GetInt()
1022+
if nicenames == 2 then
1023+
if udata and udata.override_case then
1024+
btn:SetValue(L((udata and udata.editor_friendly or key)):Trim())
1025+
else
1026+
btn:SetValue(L((udata and udata.editor_friendly or key):gsub("%u", " %1"):lower()):Trim())
1027+
end
1028+
elseif nicenames == 1 then
1029+
btn:SetValue(L((udata and udata.editor_friendly or key)):Trim())
1030+
else
1031+
btn:SetValue(key:Trim())
1032+
end
1033+
10211034
pace.current_part["pac_property_label_"..key] = btn
10221035
if udata then
10231036
if udata.group == "bodygroups" then
@@ -1366,6 +1379,162 @@ do -- list
13661379
end
13671380
end
13681381
pace.properties.line_heights = 0
1382+
if class == "faceposer" then
1383+
local facepose_categories = {}
1384+
local mouth = {}
1385+
local eyes = {}
1386+
local look = {}
1387+
local brow = {}
1388+
local other = {}
1389+
1390+
local known_outliers_mouth = {
1391+
["A"] = true,
1392+
["Ah"] = true,
1393+
["Oh"] = true,
1394+
["O"] = true,
1395+
["E"] = true,
1396+
["Ch"] = true,
1397+
["U"] = true,
1398+
}
1399+
local known_outliers_brows = {
1400+
["Anger"] = true,
1401+
["Sadness"] = true,
1402+
["Cheer"] = true,
1403+
["Cheerful"] = true,
1404+
["Upper"] = true,
1405+
["Lower"] = true,
1406+
}
1407+
local known_outliers_look = {
1408+
["Eyes Down"] = true,
1409+
["Eyes Up"] = true,
1410+
["Eyes Left"] = true,
1411+
["Eyes Right"] = true,
1412+
["Eye Down"] = true,
1413+
["Eye Up"] = true,
1414+
["Eye Left"] = true,
1415+
["Eye Right"] = true,
1416+
}
1417+
1418+
local valve_m = {
1419+
["right_upper_raiser"] = true,
1420+
["left_upper_raiser"] = true,
1421+
["right_corner_puller"] = true,
1422+
["left_corner_puller"] = true,
1423+
["right_corner_depressor"] = true,
1424+
["left_corner_depressor"] = true,
1425+
["chin_raiser"] = true,
1426+
["smile"] = true,
1427+
["lower_lip"] = true,
1428+
1429+
["right_part"] = true,
1430+
["left_part"] = true,
1431+
["right_puckerer"] = true,
1432+
["left_puckerer"] = true,
1433+
["right_funneler"] = true,
1434+
["left_funneler"] = true,
1435+
["right_stretcher"] = true,
1436+
["left_stretcher"] = true,
1437+
["bite"] = true,
1438+
["presser"] = true,
1439+
["tightener"] = true,
1440+
["jaw_clencher"] = true,
1441+
["jaw_drop"] = true,
1442+
["right_mouth_drop"] = true,
1443+
["left_mouth_drop"] = true,
1444+
}
1445+
1446+
local valve_e = {
1447+
["right_lid_raiser"] = true,
1448+
["left_lid_raiser"] = true,
1449+
["left_lid_tightener"] = true,
1450+
["right_lid_tightener"] = true,
1451+
["left_lid_droop"] = true,
1452+
["right_lid_droop"] = true,
1453+
["left_lid_closer"] = true,
1454+
["right_lid_closer"] = true,
1455+
["half_closed"] = true,
1456+
["blink"] = true,
1457+
}
1458+
1459+
local valve_b = {
1460+
["right_inner_raiser"] = true,
1461+
["left_inner_raiser"] = true,
1462+
["right_outer_raiser"] = true,
1463+
["left_outer_raiser"] = true,
1464+
["right_lowerer"] = true,
1465+
["left_lowerer"] = true,
1466+
}
1467+
1468+
for i, data in ipairs(flat_list) do
1469+
local name = data.key
1470+
local sub_name = string.lower(name)
1471+
if data.udata.group == "flexes" then
1472+
--mouth
1473+
if valve_m[sub_name] or known_outliers_mouth[name] or string.find(sub_name, "mouth") or string.find(name, "Mouth") then
1474+
table.insert(mouth, data)
1475+
--brows
1476+
elseif valve_b[sub_name] or known_outliers_brows[name] or string.find(sub_name, "brow") or string.find(name, "Brow") then
1477+
table.insert(brow, data)
1478+
--eye look
1479+
elseif known_outliers_look[sub_name] or string.find(sub_name, "look") or string.find(name, "Look") then
1480+
table.insert(look, data)
1481+
--eyes
1482+
elseif valve_e[sub_name] or string.find(sub_name, "eye") or string.find(name, "Eye") or string.find(sub_name, "blink") or string.find(sub_name, "lid") then
1483+
table.insert(eyes, data)
1484+
--other
1485+
else
1486+
table.insert(other, data)
1487+
end
1488+
end
1489+
end
1490+
if not table.IsEmpty(mouth) then
1491+
facepose_categories.mouth = mouth
1492+
end
1493+
if not table.IsEmpty(eyes) then
1494+
facepose_categories.eyes = eyes
1495+
end
1496+
if not table.IsEmpty(look) then
1497+
facepose_categories.look = look
1498+
end
1499+
if not table.IsEmpty(brow) then
1500+
facepose_categories.brow = brow
1501+
end
1502+
if not table.IsEmpty(other) then
1503+
facepose_categories.other = other
1504+
end
1505+
1506+
for _, data in ipairs(SortGroups(FlatListToGroups(flat_list))) do
1507+
if data.group == "flexes" then continue end
1508+
self:AddCollapser("generic")
1509+
for pos, prop in ipairs(data.props) do
1510+
1511+
if pins:GetBool() and pace.pinned_properties_keyed[prop.key] and not pace.CollapsedProperties["pinned"] then continue end
1512+
1513+
if prop.udata and prop.udata.hide_in_editor then
1514+
continue
1515+
end
1516+
populate(prop)
1517+
1518+
end
1519+
end
1520+
for name, props in SortedPairs(facepose_categories) do
1521+
local temp = {}
1522+
for i, prop in ipairs(props) do
1523+
temp[prop.key] = prop
1524+
end
1525+
self:AddCollapser(name)
1526+
for key, prop in SortedPairs(temp) do
1527+
prop.udata.group = name
1528+
if pins:GetBool() and pace.pinned_properties_keyed[prop.key] and not pace.CollapsedProperties["pinned"] then continue end
1529+
1530+
if prop.udata and prop.udata.hide_in_editor then
1531+
continue
1532+
end
1533+
populate(prop)
1534+
end
1535+
end
1536+
return
1537+
end
13691538
for _, data in ipairs(SortGroups(FlatListToGroups(flat_list))) do
13701539
self:AddCollapser(data.group or "generic")
13711540
for pos, prop in ipairs(data.props) do

0 commit comments

Comments
 (0)