Merge branch 'model3dview' into update-gfx-pipeline

This commit is contained in:
MihailRis
2025-05-30 21:37:25 +03:00
29 changed files with 473 additions and 130 deletions
+2 -7
View File
@@ -1,12 +1,6 @@
<splitbox id="editorRoot" orientation="horizontal" split-pos="0.3">
<splitbox split-pos="0.75">
<panel interval="2" color="0" padding="2">
<textbox pos="2" padding="4,0,4,0" sub-consumer="filter_files" hint="@Filter"></textbox>
<panel id="filesList" color="#00000030" interval="6" padding="4"
size-func="-1,-45" pos="2,38">
<!-- content is generated in script -->
</panel>
</panel>
<iframe src="core:files_panel"></iframe>
<panel id="problemsLog"
color="#00000030"
padding="5,15,5,15">
@@ -53,6 +47,7 @@
text-wrap='false'
scroll-step='50'
></textbox>
<modelviewer size="480" model="stairs" center="0.5,0.5,0.5" cam-rotation="45,-45,0" gravity="top-right"/>
</container>
<splitbox orientation="horizontal" split-pos="0.4">
<panel id="traceback" padding="4" color="#000000A0">
+4 -43
View File
@@ -1,6 +1,5 @@
local writeables = {}
local registry
local filenames
local current_file = {
filename = "",
@@ -49,6 +48,10 @@ events.on("core:error", function (msg, traceback)
table.insert(errors_all, full)
end)
events.on("core:open_in_editor", function(filename, linenum)
open_file_in_editor(filename, linenum)
end)
local function find_mutable(filename)
local packid = file.prefix(filename)
if packid == "core" then
@@ -80,16 +83,6 @@ local function refresh_file_title()
..(edited and ' *' or '')
end
function filter_files(text)
local filtered = {}
for _, filename in ipairs(filenames) do
if filename:find(text) then
table.insert(filtered, filename)
end
end
build_files_list(filtered, text)
end
function on_control_combination(keycode)
if keycode == input.keycode("s") then
save_current_file()
@@ -229,43 +222,11 @@ function open_file_in_editor(filename, line, mutable)
document.saveIcon.enabled = current_file.modified
end
function build_files_list(filenames, selected)
local files_list = document.filesList
files_list.scroll = 0
files_list:clear()
for _, actual_filename in ipairs(filenames) do
local filename = actual_filename
if selected then
filename = filename:gsub(selected, "**"..selected.."**")
end
local parent = file.parent(filename)
local info = registry.get_info(actual_filename)
local icon = "file"
if info then
icon = info.type == "component" and "entity" or info.type
end
files_list:add(gui.template("script_file", {
path = parent .. (parent[#parent] == ':' and '' or '/'),
name = file.name(filename),
icon = icon,
unit = info and info.unit or '',
filename = actual_filename
}))
end
end
function on_open(mode)
registry = require "core:internal/scripts_registry"
local files_list = document.filesList
document.editorContainer:setInterval(200, refresh_file_title)
clear_traceback()
clear_output()
filenames = registry.filenames
table.sort(filenames)
build_files_list(filenames)
end
+7
View File
@@ -0,0 +1,7 @@
<panel interval="2" color="0" padding="2">
<textbox pos="2" padding="4,0,4,0" sub-consumer="filter_files" hint="@Filter"></textbox>
<panel id="filesList" color="#00000030" interval="6" padding="4"
size-func="-1,-45" pos="2,38">
<!-- content is generated in script -->
</panel>
</panel>
+54
View File
@@ -0,0 +1,54 @@
local registry
local filenames
function filter_files(text)
local pattern_safe = text:pattern_safe();
local filtered = {}
for _, filename in ipairs(filenames) do
if filename:find(pattern_safe) then
table.insert(filtered, filename)
end
end
build_files_list(filtered, pattern_safe)
end
function open_file_in_editor(filename, linenum)
events.emit("core:open_in_editor", filename, linenum)
end
function build_files_list(filenames, highlighted_part)
local files_list = document.filesList
files_list.scroll = 0
files_list:clear()
for _, actual_filename in ipairs(filenames) do
local filename = actual_filename
if highlighted_part then
filename = filename:gsub(highlighted_part, "**"..highlighted_part.."**")
end
local parent = file.parent(filename)
local info = registry.get_info(actual_filename)
local icon = "file"
if info then
icon = info.type == "component" and "entity" or info.type
end
files_list:add(gui.template("script_file", {
path = parent .. (parent[#parent] == ':' and '' or '/'),
name = file.name(filename),
icon = icon,
unit = info and info.unit or '',
filename = actual_filename,
open_func = "open_file_in_editor",
}))
end
end
function on_open(mode)
registry = require "core:internal/scripts_registry"
local files_list = document.filesList
filenames = registry.filenames
table.sort(filenames)
build_files_list(filenames)
end
+1 -1
View File
@@ -3,7 +3,7 @@
<label hover-color='#30A0FF'
pos="20,2"
interactive="true"
onclick='open_file_in_editor("%{filename}")'
onclick='%{open_func}("%{filename}")'
markup='md'
tooltip='%{unit}'
sizefunc="-1,-1">