Moved note column splines into tween state. Renamed size/dimension spline lua functions to get/set convention. Added make_camel_aliases to 01 alias.lua to make the CamelCase aliases required by shakesoda for consistency.
This commit is contained in:
@@ -43,6 +43,30 @@ function math.round(n)
|
||||
end
|
||||
end
|
||||
|
||||
function split(delimiter, text)
|
||||
local list = {}
|
||||
local pos = 1
|
||||
while 1 do
|
||||
local first,last = string.find(text, delimiter, pos)
|
||||
if first then
|
||||
table.insert(list, string.sub(text, pos, first-1))
|
||||
pos = last+1
|
||||
else
|
||||
table.insert(list, string.sub(text, pos))
|
||||
break
|
||||
end
|
||||
end
|
||||
return list
|
||||
end
|
||||
|
||||
function join(delimiter, list)
|
||||
local ret = list[1]
|
||||
for i = 2,table.getn(list) do
|
||||
ret = ret .. delimiter .. list[i]
|
||||
end
|
||||
return ret or ""
|
||||
end
|
||||
|
||||
-- (c) 2006 Glenn Maynard
|
||||
-- All rights reserved.
|
||||
--
|
||||
|
||||
@@ -24,6 +24,62 @@ _safe = {
|
||||
|
||||
--[[ compatibility aliases ]]
|
||||
|
||||
function alias_one(class, main_name, alt_name)
|
||||
if type(main_name) ~= "string" then
|
||||
lua.ReportScriptError("Name of function to make an alias for must be a string.")
|
||||
return
|
||||
end
|
||||
if type(alt_name) ~= "string" then
|
||||
lua.ReportScriptError("Alias name of function must be a string.")
|
||||
return
|
||||
end
|
||||
class[alt_name]= class[main_name]
|
||||
end
|
||||
|
||||
function alias_set(class, set)
|
||||
assert(type(class) == "table" and type(set) == "table",
|
||||
"alias_set must be passed a class and a set of names to make alieases.")
|
||||
for i, fun in ipairs(set) do
|
||||
if type(fun) == "table" then
|
||||
local main_name= fun[1]
|
||||
if type(set[2]) == "table" then
|
||||
for n, alt_name in ipairs(set[2]) do
|
||||
alias_one(class, main_name, alt_name)
|
||||
end
|
||||
elseif type(set[2]) == "string" then
|
||||
alias_one(class, main_name, set[2])
|
||||
end
|
||||
else
|
||||
lua.ReportScriptError("alias entry " .. i .. " in set passed to " ..
|
||||
"alias_set is not a table.")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function make_camel_aliases(class)
|
||||
local name_list= {}
|
||||
for name, fun in pairs(class) do
|
||||
if type(fun) == "function" and type(name) == "string" then
|
||||
name_list[#name_list+1]= name
|
||||
end
|
||||
end
|
||||
for i, name in ipairs(name_list) do
|
||||
local words= split("_", name)
|
||||
for o, w in ipairs(words) do
|
||||
words[o]= w:sub(1,1):upper() .. w:sub(2)
|
||||
end
|
||||
local camel_name= join("", words)
|
||||
if name ~= camel_name then
|
||||
alias_one(class, name, camel_name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
make_camel_aliases(CubicSplineN)
|
||||
make_camel_aliases(NCSplineHandler)
|
||||
make_camel_aliases(NoteColumnRenderer)
|
||||
make_camel_aliases(NoteField)
|
||||
|
||||
--[[ ActorScroller: all of these got renamed, so alias the lowercase ones if
|
||||
themes are going to look for them. ]]
|
||||
ActorScroller.getsecondtodestination = ActorScroller.GetSecondsToDestination
|
||||
|
||||
@@ -29,30 +29,6 @@ function TableStringLookup(t, group)
|
||||
return ret
|
||||
end
|
||||
|
||||
function split(delimiter, text)
|
||||
local list = {}
|
||||
local pos = 1
|
||||
while 1 do
|
||||
local first,last = string.find(text, delimiter, pos)
|
||||
if first then
|
||||
table.insert(list, string.sub(text, pos, first-1))
|
||||
pos = last+1
|
||||
else
|
||||
table.insert(list, string.sub(text, pos))
|
||||
break
|
||||
end
|
||||
end
|
||||
return list
|
||||
end
|
||||
|
||||
function join(delimiter, list)
|
||||
local ret = list[1]
|
||||
for i = 2,table.getn(list) do
|
||||
ret = ret .. delimiter .. list[i]
|
||||
end
|
||||
return ret or ""
|
||||
end
|
||||
|
||||
function wrap(val,n)
|
||||
local x = val
|
||||
Trace( "wrap "..x.." "..n )
|
||||
|
||||
Reference in New Issue
Block a user