-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* VV Upgrades (#78948) * Makes special byond lists display properly * Makes images get a preview in the header * Makes filters display properly * Make variable value display a bit more robust to errors * Kills single char vars :cl: admin: VV can now display the contents of special byond lists like filters, or client.images admin: VV on images now displays the image in the header admin: VV can now display filters and includes their type /:cl: * Always contracts lists when VVing GLOB (#76091) This takes render times from like 20 seconds to maybe 2 Most of the time appears to be clientside rn, so the best we could do further would be reducing the amount of shit that actually needs to render So like, removing the E C M buttons (or at least adding a toggle to render them), that sort of thing A glob vv you can actually use ![image](https://github.com/tgstation/tgstation/assets/58055496/d7c29c9a-aa45-4cad-9f38-7131140cab5b) :cl: admin: VV for global vars will now load MUCH faster, in exchange lists are now perma contracted in that particular pane /:cl: * fix neon carpet --------- Co-authored-by: Emmett Gaines <[email protected]> Co-authored-by: LemonInTheDark <[email protected]>
- Loading branch information
1 parent
e2fd017
commit c0d2b55
Showing
10 changed files
with
152 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -116,6 +116,7 @@ | |
_layer, | ||
_dir | ||
) | ||
pic.plane = _plane | ||
pic.color = _color | ||
pic.alpha = _alpha | ||
return TRUE | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,102 +1,120 @@ | ||
#define VV_HTML_ENCODE(thing) ( sanitize ? html_encode(thing) : thing ) | ||
/// Get displayed variable in VV variable list | ||
/proc/debug_variable(name, value, level, datum/D, sanitize = TRUE) //if D is a list, name will be index, and value will be assoc value. | ||
var/header | ||
if(D) | ||
if(islist(D)) | ||
/proc/debug_variable(name, value, level, datum/owner, sanitize = TRUE, display_flags = NONE) //if D is a list, name will be index, and value will be assoc value. | ||
if(owner) | ||
if(islist(owner)) | ||
var/index = name | ||
if (value) | ||
name = D[name] //name is really the index until this line | ||
name = owner[name] //name is really the index until this line | ||
else | ||
value = D[name] | ||
header = "<li style='backgroundColor:white'>([VV_HREF_TARGET_1V(D, VV_HK_LIST_EDIT, "E", index)]) ([VV_HREF_TARGET_1V(D, VV_HK_LIST_CHANGE, "C", index)]) ([VV_HREF_TARGET_1V(D, VV_HK_LIST_REMOVE, "-", index)]) " | ||
value = owner[name] | ||
. = "<li style='backgroundColor:white'>([VV_HREF_TARGET_1V(owner, VV_HK_LIST_EDIT, "E", index)]) ([VV_HREF_TARGET_1V(owner, VV_HK_LIST_CHANGE, "C", index)]) ([VV_HREF_TARGET_1V(owner, VV_HK_LIST_REMOVE, "-", index)]) " | ||
else | ||
header = "<li style='backgroundColor:white'>([VV_HREF_TARGET_1V(D, VV_HK_BASIC_EDIT, "E", name)]) ([VV_HREF_TARGET_1V(D, VV_HK_BASIC_CHANGE, "C", name)]) ([VV_HREF_TARGET_1V(D, VV_HK_BASIC_MASSEDIT, "M", name)]) " | ||
. = "<li style='backgroundColor:white'>([VV_HREF_TARGET_1V(owner, VV_HK_BASIC_EDIT, "E", name)]) ([VV_HREF_TARGET_1V(owner, VV_HK_BASIC_CHANGE, "C", name)]) ([VV_HREF_TARGET_1V(owner, VV_HK_BASIC_MASSEDIT, "M", name)]) " | ||
else | ||
header = "<li>" | ||
. = "<li>" | ||
|
||
var/item | ||
var/name_part = VV_HTML_ENCODE(name) | ||
if(level > 0 || islist(D)) //handling keys in assoc lists | ||
if(level > 0 || islist(owner)) //handling keys in assoc lists | ||
if(istype(name,/datum)) | ||
name_part = "<a href='?_src_=vars;[HrefToken()];Vars=[REF(name)]'>[VV_HTML_ENCODE(name)] [REF(name)]</a>" | ||
else if(islist(name)) | ||
var/list/L = name | ||
name_part = "<a href='?_src_=vars;[HrefToken()];Vars=[REF(name)]'> /list ([length(L)]) [REF(name)]</a>" | ||
var/list/list_value = name | ||
name_part = "<a href='?_src_=vars;[HrefToken()];Vars=[REF(name)]'> /list ([length(list_value)]) [REF(name)]</a>" | ||
|
||
if (isnull(value)) | ||
item = "[name_part] = <span class='value'>null</span>" | ||
. = "[.][name_part] = " | ||
|
||
else if (istext(value)) | ||
item = "[name_part] = <span class='value'>\"[VV_HTML_ENCODE(value)]\"</span>" | ||
var/item = _debug_variable_value(name, value, level, owner, sanitize, display_flags) | ||
|
||
else if (isicon(value)) | ||
return "[.][item]</li>" | ||
|
||
// This is split into a seperate proc mostly to make errors that happen not break things too much | ||
/proc/_debug_variable_value(name, value, level, datum/owner, sanitize, display_flags) | ||
. = "<font color='red'>DISPLAY_ERROR</font>" | ||
|
||
if(isnull(value)) | ||
return "<span class='value'>null</span>" | ||
|
||
if(istext(value)) | ||
return "<span class='value'>\"[VV_HTML_ENCODE(value)]\"</span>" | ||
|
||
if(isicon(value)) | ||
#ifdef VARSICON | ||
var/icon/I = icon(value) | ||
var/icon/icon_value = icon(value) | ||
var/rnd = rand(1,10000) | ||
var/rname = "tmp[REF(I)][rnd].png" | ||
usr << browse_rsc(I, rname) | ||
item = "[name_part] = (<span class='value'>[value]</span>) <img class=icon src=\"[rname]\">" | ||
var/rname = "tmp[REF(icon_value)][rnd].png" | ||
usr << browse_rsc(icon_value, rname) | ||
return "(<span class='value'>[value]</span>) <img class=icon src=\"[rname]\">" | ||
#else | ||
item = "[name_part] = /icon (<span class='value'>[value]</span>)" | ||
return "/icon (<span class='value'>[value]</span>)" | ||
#endif | ||
|
||
else if (isfile(value)) | ||
item = "[name_part] = <span class='value'>'[value]'</span>" | ||
if(isappearance(value)) | ||
var/image/actually_an_appearance = value | ||
return "/appearance (<br><span class='value'>icon: [actually_an_appearance.icon]<br>state: [actually_an_appearance.icon_state]<br>plane: [actually_an_appearance.plane]<br>layer: [actually_an_appearance.layer]</span>)" | ||
|
||
else if(istype(value,/matrix)) // Needs to be before datum | ||
var/matrix/M = value | ||
item = {"[name_part] = <span class='value'> | ||
<table class='matrixbrak'><tbody><tr><td class='lbrak'> </td><td> | ||
<table class='matrix'> | ||
<tbody> | ||
<tr><td>[M.a]</td><td>[M.d]</td><td>0</td></tr> | ||
<tr><td>[M.b]</td><td>[M.e]</td><td>0</td></tr> | ||
<tr><td>[M.c]</td><td>[M.f]</td><td>1</td></tr> | ||
</tbody> | ||
</table></td><td class='rbrak'> </td></tr></tbody></table></span>"} //TODO link to modify_transform wrapper for all matrices | ||
else if (istype(value, /datum)) | ||
var/datum/DV = value | ||
if ("[DV]" != "[DV.type]") //if the thing as a name var, lets use it. | ||
item = "[name_part] = <a href='?_src_=vars;[HrefToken()];Vars=[REF(value)]'>[DV] [DV.type] [REF(value)]</a>" | ||
else | ||
item = "[name_part] = <a href='?_src_=vars;[HrefToken()];Vars=[REF(value)]'>[DV.type] [REF(value)]</a>" | ||
if(istype(value,/datum/weakref)) | ||
var/datum/weakref/weakref = value | ||
item += " <a href='?_src_=vars;[HrefToken()];Vars=[REF(weakref.reference)]'>(Resolve)</a>" | ||
if(isfilter(value)) | ||
var/datum/filter_value = value | ||
return "/filter (<span class='value'>[filter_value.type] [REF(filter_value)]</span>)" | ||
|
||
else if (islist(value)) | ||
var/list/L = value | ||
if(isfile(value)) | ||
return "<span class='value'>'[value]'</span>" | ||
|
||
if(isdatum(value)) | ||
var/datum/datum_value = value | ||
return datum_value.debug_variable_value(name, level, owner, sanitize, display_flags) | ||
|
||
if(islist(value) || hascall(value, "Cut")) // Some special lists arent detectable as a list through istype, so we check if it has a list proc instead | ||
var/list/list_value = value | ||
var/list/items = list() | ||
|
||
if (L.len > 0 && !(name == "underlays" || name == "overlays" || L.len > (IS_NORMAL_LIST(L) ? VV_NORMAL_LIST_NO_EXPAND_THRESHOLD : VV_SPECIAL_LIST_NO_EXPAND_THRESHOLD))) | ||
for (var/i in 1 to L.len) | ||
var/key = L[i] | ||
if (!(display_flags & VV_ALWAYS_CONTRACT_LIST) && list_value.len > 0 && list_value.len <= (IS_NORMAL_LIST(list_value) ? VV_NORMAL_LIST_NO_EXPAND_THRESHOLD : VV_SPECIAL_LIST_NO_EXPAND_THRESHOLD)) | ||
for (var/i in 1 to list_value.len) | ||
var/key = list_value[i] | ||
var/val | ||
if (IS_NORMAL_LIST(L) && !isnum(key)) | ||
val = L[key] | ||
if (IS_NORMAL_LIST(list_value) && !isnum(key)) | ||
val = list_value[key] | ||
if (isnull(val)) // we still want to display non-null false values, such as 0 or "" | ||
val = key | ||
key = i | ||
|
||
items += debug_variable(key, val, level + 1, sanitize = sanitize) | ||
|
||
item = "[name_part] = <a href='?_src_=vars;[HrefToken()];Vars=[REF(value)]'>/list ([L.len])</a><ul>[items.Join()]</ul>" | ||
return "<a href='?_src_=vars;[HrefToken()];Vars=[REF(owner)];special_varname=[name]'>/list ([list_value.len])</a><ul>[items.Join()]</ul>" | ||
else | ||
item = "[name_part] = <a href='?_src_=vars;[HrefToken()];Vars=[REF(value)]'>/list ([L.len])</a>" | ||
return "<a href='?_src_=vars;[HrefToken()];Vars=[REF(owner)];special_varname=[name]'>/list ([list_value.len])</a>" | ||
|
||
else if (name in GLOB.bitfields) | ||
if(name in GLOB.bitfields) | ||
var/list/flags = list() | ||
for (var/i in GLOB.bitfields[name]) | ||
if (value & GLOB.bitfields[name][i]) | ||
flags += i | ||
if(length(flags)) | ||
item = "[name_part] = [VV_HTML_ENCODE(jointext(flags, ", "))]" | ||
return "[VV_HTML_ENCODE(jointext(flags, ", "))]" | ||
else | ||
item = "[name_part] = NONE" | ||
return "NONE" | ||
else | ||
item = "[name_part] = <span class='value'>[VV_HTML_ENCODE(value)]</span>" | ||
return "<span class='value'>[VV_HTML_ENCODE(value)]</span>" | ||
|
||
/datum/proc/debug_variable_value(name, level, datum/owner, sanitize, display_flags) | ||
if("[src]" != "[type]") // If we have a name var, let's use it. | ||
return "<a href='?_src_=vars;[HrefToken()];Vars=[REF(src)]'>[src] [type] [REF(src)]</a>" | ||
else | ||
return "<a href='?_src_=vars;[HrefToken()];Vars=[REF(src)]'>[type] [REF(src)]</a>" | ||
|
||
/datum/weakref/debug_variable_value(name, level, datum/owner, sanitize, display_flags) | ||
. = ..() | ||
return "[.] <a href='?_src_=vars;[HrefToken()];Vars=[reference]'>(Resolve)</a>" | ||
|
||
return "[header][item]</li>" | ||
/matrix/debug_variable_value(name, level, datum/owner, sanitize, display_flags) | ||
return {"<span class='value'> | ||
<table class='matrixbrak'><tbody><tr><td class='lbrak'> </td><td> | ||
<table class='matrix'> | ||
<tbody> | ||
<tr><td>[a]</td><td>[d]</td><td>0</td></tr> | ||
<tr><td>[b]</td><td>[e]</td><td>0</td></tr> | ||
<tr><td>[c]</td><td>[f]</td><td>1</td></tr> | ||
</tbody> | ||
</table></td><td class='rbrak'> </td></tr></tbody></table></span>"} //TODO link to modify_transform wrapper for all matrices | ||
|
||
#undef VV_HTML_ENCODE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.