From 8aa2d424279ead539867f0ae11592de8da2f1e46 Mon Sep 17 00:00:00 2001 From: Kyzentun Date: Tue, 7 Apr 2015 00:04:34 -0600 Subject: [PATCH] Added rec_print_children and rec_print_table to _fallback. Updated changelog. --- Docs/Changelog_sm5.txt | 31 ++++++++++++ Docs/Luadoc/Lua.xml | 2 + Docs/Luadoc/LuaDocumentation.xml | 8 +++ Themes/_fallback/Scripts/02 Utilities.lua | 59 +++++++++++++++++++++++ 4 files changed, 100 insertions(+) diff --git a/Docs/Changelog_sm5.txt b/Docs/Changelog_sm5.txt index 0ec0d5ad7a..0b788553b0 100644 --- a/Docs/Changelog_sm5.txt +++ b/Docs/Changelog_sm5.txt @@ -4,6 +4,37 @@ The StepMania 5 Changelog covers all post-sm-ssc changes. For a list of changes from StepMania 4 alpha 5 to sm-ssc v1.2.5, see Changelog_sm-ssc.txt. ________________________________________________________________________________ +2015/04/06 +---------- +* [global] rec_print_children and rec_print_table lua functions added to + _fallback. [kyzentun] +* [Language] Dutch translation updated. [Thumbsy] +* [RadarValues] Stream, Voltage, Air, Freeze, and Chaos are no longer capped + at 1. Stream and Voltage no longer count hold heads twice. + RadarCategory_Notes added, which counts all notes. + Scoring bug fixes related to radar calculation. [kyzentun] +* [ScreenSelectGame] Exit option returns to ScreenOptionsService unless the + game type actually changed. [Wallacoloo] + +2015/04/04 +---------- +* [EditMode] Added submenus to the timing edit menu to allow shifting, + copying, and pasting any or all timing segments in the selected region or + after the current cursor position. [kyzentun] + Shifting menus in edit mode now have choices for 1, 2, or 4 measures or 2 + beats. [kyzentun] +* [global] Fixed crash on OS X for certain dance pads when in Japanese + locale. [Wallacoloo] + +2015/04/03 +---------- +* [ScreenGameplay] The NoteField board is now underneath everything except + the backgound. This means underneath any custom actors on the underlay or + overlay or decoration layers, and also underneath the combo/judgment even + when the ComboUnderField metric is true. [kyzentun] + Fixed bug in screen filter in default theme that made it not appear under + the field when a solo file was played without Center1Player. [kyzentun] + 2015/04/02 ---------- * [global] commify function exposed to lua. [kyzentun] diff --git a/Docs/Luadoc/Lua.xml b/Docs/Luadoc/Lua.xml index 35f2706c47..1cfc5416da 100644 --- a/Docs/Luadoc/Lua.xml +++ b/Docs/Luadoc/Lua.xml @@ -239,6 +239,8 @@ + + diff --git a/Docs/Luadoc/LuaDocumentation.xml b/Docs/Luadoc/LuaDocumentation.xml index 2546f90afe..dcb99289c2 100644 --- a/Docs/Luadoc/LuaDocumentation.xml +++ b/Docs/Luadoc/LuaDocumentation.xml @@ -468,6 +468,14 @@ save yourself some time, copy this for undocumented things: [03 UserPreferences2.lua] (internal) Reads the specified user preference from its config file. + + Recursively prints all the children of the actor frame to the log file. This can be useful for finding out what actors are on a screen or just seeing what the structure of the actor tree looks like.
+ indent is an optional argument that will be prepended to every line. +
+ + Recursively prints all values in the table to the log file in the form "(key_type) key: (value_type) value" so that you know the type of the key and the value. Useful if you're not sure exactly what is in a table passed as a parameter.
+ indent is an optional argument that will be prepended to every line. +
Sends the current style to the server. diff --git a/Themes/_fallback/Scripts/02 Utilities.lua b/Themes/_fallback/Scripts/02 Utilities.lua index 602a33f508..8d48fd49f6 100644 --- a/Themes/_fallback/Scripts/02 Utilities.lua +++ b/Themes/_fallback/Scripts/02 Utilities.lua @@ -356,6 +356,65 @@ function IsUsingWideScreen() end; end; +-- Usage: Pass in an ActorFrame and a string to put in front of every line. +-- indent will be appended to at each level of the recursion, to indent each +-- generation further. + +function rec_print_children(parent, indent) + if not indent then indent= "" end + if #parent > 0 and type(parent) == "table" then + for i, c in ipairs(parent) do + rec_print_children(c, indent .. i .. "->") + end + elseif parent.GetChildren then + local pname= (parent.GetName and parent:GetName()) or "" + local children= parent:GetChildren() + Trace(indent .. pname .. " children:") + for k, v in pairs(children) do + if #v > 0 then + Trace(indent .. pname .. "->" .. k .. " shared name:") + rec_print_children(v, indent .. pname .. "->") + Trace(indent .. pname .. "->" .. k .. " shared name over.") + else + rec_print_children(v, indent .. pname .. "->") + end + end + Trace(indent .. pname .. " children over.") + else + local pname= (parent.GetName and parent:GetName()) or "" + Trace(indent .. pname .. "(" .. tostring(parent) .. ")") + end +end + +-- Usage: Pass in a table and a string to indent each line with. +-- indent will be appended to at each level of the recursion, to indent each +-- generation further. +-- DO NOT pass in a table that contains a reference loop. +-- A reference loop is a case where a table contains a member that is a +-- reference to itself, or contains a table that contains a reference to +-- itself. +-- Short reference loop example: a= {} a[1]= a +-- Longer reference loop example: a= {b= {c= {}}} a.b.c[1]= a +function rec_print_table(t, indent, depth_remaining) + if not indent then indent= "" end + if type(t) ~= "table" then + Trace(indent .. "rec_print_table passed a " .. type(t)) + return + end + depth_remaining= depth_remaining or -1 + if depth_remaining == 0 then return end + for k, v in pairs(t) do + if type(v) == "table" then + Trace(indent .. k .. ": table") + rec_print_table(v, indent .. " ", depth_remaining - 1) + else + Trace(indent .. "(" .. type(k) .. ")" .. k .. ": " .. + "(" .. type(v) .. ")" .. tostring(v)) + end + end + Trace(indent .. "end") +end + -- Minor text formatting functions from Kyzentun. -- TODO: Figure out why BitmapText:maxwidth doesn't do what I want. -- Intentionally undocumented because they should be moved to BitmapText ASAP