-
-
Notifications
You must be signed in to change notification settings - Fork 106
Moved debug panel UI to xml #700
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
res/layouts/debug_panel.xml.lua
Outdated
| @@ -0,0 +1,216 @@ | |||
| -- Debug panel logic ported from C++ create_debug_panel to Lua XML script. | |||
| -- Shows performance, world, player and selection info; provides simple time control. | |||
| -- All comments in this file are intentionally in English only. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Комментарий про историю панели излишний. Последняя же строка вообще к коду теме не относится. В целом, из комментарием имеют смысл только:
- объяснения неочевидных моментов, которые нельзя решить именованием
- документация публичного API
res/layouts/debug_panel.xml.lua
Outdated
| local function safe_caption(blockid) | ||
| -- Expect that the API exists and returns a valid string id | ||
| return block.name(blockid) | ||
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Отдельная функция не требуется, так как результат block.name и нужно выводить на панели + бессмысленный комментарий
res/layouts/debug_panel.xml.lua
Outdated
| n = tonumber(n) or 0 | ||
| if n < 10 then return "0"..tostring(n) end | ||
| return tostring(n) | ||
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
В extensions.md уже описана встроенная функция
res/layouts/debug_panel.xml.lua
Outdated
| document.dbg_flags.text = "flags: -" | ||
| else | ||
| document.dbg_flags.text = "flags: "..table.concat(flags, ", ") | ||
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Перенос не подразумевает добавление новых элементов
res/layouts/debug_panel.xml.lua
Outdated
| end | ||
| document.dbg_tp_x.consumer = try_teleport | ||
| document.dbg_tp_y.consumer = try_teleport | ||
| document.dbg_tp_z.consumer = try_teleport |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
За llm стоит проверять
Это просто не будет работать
| extern const luaL_Reg vec4lib[]; // vecn.cpp | ||
| extern const luaL_Reg weatherlib[]; // gfx.weather | ||
| extern const luaL_Reg worldlib[]; | ||
| extern const luaL_Reg renderlib[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
библиотеки графического api реализуются в пакете gfx
| {"get_emitters_alive", lua::wrap<l_get_emitters_alive>}, | ||
| {"get_visible_chunks", lua::wrap<l_get_visible_chunks>}, | ||
| {"get_entities_next_id", lua::wrap<l_get_entities_next_id>}, | ||
| {nullptr, nullptr} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
В одну кучу свален и рендер и частицы, для которых уже есть библиотека и hud и вообще серверная часть, к рендеру отношения не имеющая
| require_world_info().fog = static_cast<float>(value); | ||
| return 0; | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Этот старый костыль должен быть удалён, вместе с соответствующим полем в WorldInfo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Я тогда просто пока уберу фог из этой либы и в дебаг менюшке заменю на clouds, а удаление его совсем лучше сделать другим коммитом кмк
| <checkbox id="dbg_cb_minimap" size="400,24" | ||
| supplier="render.get_show_generator_minimap" | ||
| consumer="render.set_show_generator_minimap">Show Generator Minimap</checkbox> | ||
| </panel> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Бред LLM, начиная с несуществующих свойств text, font , заканчивая некорректным использованием checkbox
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Про чекбокс не понял. Вроде работает как ожидается
I created xml file and input for the debug panel. There is some inconsistency between this panel and the rest debug visualization (gizmo and fps graph), because they being triggered from different locations, but I don't know how to make it better for now
(если что, можно со мной на русском общаться)