Is it possible to make a dialog return a table? i tried making it a hook inside the component:
local quick_config, set_quick_config = editor.ui.use_state(function() return {} end)
return editor.ui.dialog({
...
editor.ui.button({
text = "Quick Configuration Setup",
icon = editor.ui.ICON.OPEN_RESOURCE,
alignment = editor.ui.ALIGNMENT.RIGHT,
column_span = 2,
on_pressed = function()
local result = editor.ui.show_dialog(quick_config_dialog({
ids = unfold.GetDistinctID(props.scene_path)
})) -- uses a regular table initializied inside the component and can return it as expected
if type(result) == "table" then
set_quick_config(toggle, result)
set_config_path(toggle, "Quick Configuration")
end
end
}),
buttons = {
editor.ui.dialog_button({
text = "Cancel",
default = false
}),
editor.ui.dialog_button({
text = "Create Collection",
-- quick_config gets another table id as if it was reset
result = { quick_config = quick_config, output_name = output_name, config_path = config_path },
default = true,
enabled = config_path ~= ""
}),
}
})
this doesnt work, its as if the table changes id when the dialog is closed, since the return
value doesnt carry over. The result is still a table, but a different one with none of the expected fields.