mirror of
https://github.com/CapsAdmin/pac3.git
synced 2025-03-04 03:03:01 -05:00
fixed sequence name
added animation list (right click sequence name) git-svn-id: http://gmodcapsadmin.googlecode.com/svn/trunk/addons/pac3@26 047d434e-d786-fb00-e516-99c5e643cd71
This commit is contained in:
parent
a16d651b32
commit
dc381f6337
@ -5,7 +5,7 @@ PART.ClassName = "animation"
|
||||
pac.StartStorableVars()
|
||||
pac.GetSet(PART, "Loop", true)
|
||||
pac.GetSet(PART, "PingPongLoop", false)
|
||||
pac.GetSet(PART, "Name", "invalid name")
|
||||
pac.GetSet(PART, "SequenceName", "invalid name")
|
||||
pac.GetSet(PART, "Sequence", -1)
|
||||
pac.GetSet(PART, "Rate", 1)
|
||||
pac.GetSet(PART, "Offset", 0)
|
||||
@ -17,11 +17,31 @@ function PART:GetEntity()
|
||||
return self.Parent:IsValid() and self.Parent.ClassName == "model" and self.Parent:GetEntity() or self:GetOwner()
|
||||
end
|
||||
|
||||
function PART:GetSequenceList()
|
||||
local ent = self:GetEntity()
|
||||
|
||||
if ent:IsValid() then
|
||||
if net then
|
||||
return ent:GetSequenceList()
|
||||
else
|
||||
local tbl = {}
|
||||
for i = 1, math.huge do
|
||||
local name = ent:GetSequenceName()
|
||||
if name ~= "Unknown" then
|
||||
tbl[i] = name
|
||||
else
|
||||
return tbl
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PART:OnDraw()
|
||||
local ent = self:GetEntity()
|
||||
|
||||
if ent:IsValid() then
|
||||
local seq = ent:LookupSequence(self.Name)
|
||||
local seq = ent:LookupSequence(self.SequenceName)
|
||||
|
||||
if seq ~= -1 then
|
||||
ent:ResetSequence(seq)
|
||||
|
@ -40,10 +40,6 @@ pace.PropertyLimits =
|
||||
|
||||
function pace.TranslatePropertiesKey(key)
|
||||
key = key:lower()
|
||||
|
||||
if key:find("color") then
|
||||
return "color"
|
||||
end
|
||||
|
||||
if key == "bone" then
|
||||
return key
|
||||
@ -53,8 +49,16 @@ function pace.TranslatePropertiesKey(key)
|
||||
return key
|
||||
end
|
||||
|
||||
if key == "sequence" or key == "sequencename" then
|
||||
return "sequence"
|
||||
end
|
||||
|
||||
if key == "material" or key == "spritepath" or key == "trailpath" then
|
||||
return "material"
|
||||
end
|
||||
|
||||
if key:find("color") then
|
||||
return "color"
|
||||
end
|
||||
end
|
||||
|
||||
@ -239,7 +243,7 @@ do -- base editable
|
||||
function PANEL:SetValue(var, skip_encode)
|
||||
if self.editing then return end
|
||||
|
||||
local str = skip_encode and var or self:Encode(var)
|
||||
local str = tostring(skip_encode and var or self:Encode(var))
|
||||
|
||||
self:SetTextColor(derma.Color(net and "text_dark" or "text_bright", self, color_black))
|
||||
self:SetFont("DefaultSmall")
|
||||
@ -597,7 +601,7 @@ do -- number
|
||||
num = math.Round(num)
|
||||
end
|
||||
|
||||
return tostring(num)
|
||||
return num
|
||||
end
|
||||
|
||||
function PANEL:Decode(str)
|
||||
@ -708,5 +712,45 @@ do -- material
|
||||
pac.MatBrowser = pnl
|
||||
end
|
||||
|
||||
pace.RegisterPanel(PANEL)
|
||||
end
|
||||
|
||||
do -- sequence list
|
||||
local PANEL = {}
|
||||
|
||||
PANEL.ClassName = "properties_sequence"
|
||||
PANEL.Base = "pace_properties_base_type"
|
||||
|
||||
function PANEL:SpecialCallback()
|
||||
local frame = vgui.Create("DFrame")
|
||||
frame:SetTitle(L"animations")
|
||||
frame:SetSize(300, 300)
|
||||
frame:Center()
|
||||
frame:SetSizable(true)
|
||||
|
||||
local list = vgui.Create("DListView", frame)
|
||||
list:Dock(FILL)
|
||||
list:SetMultiSelect(false)
|
||||
list:AddColumn("id"):SetFixedWidth(25)
|
||||
list:AddColumn("name")
|
||||
|
||||
list.OnRowSelected = function(_, id, line)
|
||||
self:SetValue(line.seq_name)
|
||||
self.OnValueChanged(line.seq_name)
|
||||
end
|
||||
|
||||
local cur = pace.current_part:GetSequenceName()
|
||||
|
||||
for id, name in pairs(pace.current_part:GetSequenceList()) do
|
||||
local pnl = list:AddLine(id, name)
|
||||
pnl.seq_name = name
|
||||
pnl.seq_id = id
|
||||
|
||||
if cur == name then
|
||||
list:SelectItem(pnl)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
pace.RegisterPanel(PANEL)
|
||||
end
|
Loading…
Reference in New Issue
Block a user