ux
This commit is contained in:
parent
3fa7dad14d
commit
6965b1d983
4 changed files with 38 additions and 19 deletions
|
@ -82,15 +82,24 @@ struct AssetBrowserImpl : AssetBrowser {
|
|||
m_back_action.init("Back", "Back in asset history", "back", ICON_FA_ARROW_LEFT, false);
|
||||
m_forward_action.init("Forward", "Forward in asset history", "forward", ICON_FA_ARROW_RIGHT, false);
|
||||
|
||||
m_focus_search.init(" Focus asset search", "Focus asset search", "focus_asset_search", ICON_FA_SEARCH, (os::Keycode)'O', Action::CTRL, true);
|
||||
m_focus_search.func.bind<&AssetBrowserImpl::focusSearch>(this);
|
||||
|
||||
m_toggle_ui.init("Asset browser", "Toggle Asset Browser UI", "asset_browser", "", false);
|
||||
m_toggle_ui.func.bind<&AssetBrowserImpl::toggleUI>(this);
|
||||
m_toggle_ui.is_selected.bind<&AssetBrowserImpl::isOpen>(this);
|
||||
|
||||
m_app.addAction(&m_focus_search);
|
||||
m_app.addAction(&m_back_action);
|
||||
m_app.addAction(&m_forward_action);
|
||||
m_app.addWindowAction(&m_toggle_ui);
|
||||
}
|
||||
|
||||
void focusSearch() {
|
||||
m_request_focus_search = true;
|
||||
m_is_open = true;
|
||||
}
|
||||
|
||||
void onBasePathChanged() {
|
||||
const char* base_path = m_app.getEngine().getFileSystem().getBasePath();
|
||||
Path path(base_path, ".lumix");
|
||||
|
@ -118,6 +127,7 @@ struct AssetBrowserImpl : AssetBrowser {
|
|||
}
|
||||
|
||||
~AssetBrowserImpl() override {
|
||||
m_app.removeAction(&m_focus_search);
|
||||
m_app.removeAction(&m_toggle_ui);
|
||||
m_app.removeAction(&m_back_action);
|
||||
m_app.removeAction(&m_forward_action);
|
||||
|
@ -789,12 +799,17 @@ struct AssetBrowserImpl : AssetBrowser {
|
|||
if (m_dir.isEmpty()) changeDir(".", true);
|
||||
|
||||
if(m_is_open) {
|
||||
if (m_request_focus_search) ImGui::SetNextWindowFocus();
|
||||
if (!ImGui::Begin("Assets", &m_is_open)) {
|
||||
ImGui::End();
|
||||
return;
|
||||
}
|
||||
m_has_focus = ImGui::IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows) || m_has_focus;
|
||||
|
||||
if (m_request_focus_search) {
|
||||
ImGui::SetKeyboardFocusHere();
|
||||
m_request_focus_search = false;
|
||||
}
|
||||
if (m_filter.gui(ICON_FA_SEARCH " Search", 150)) {
|
||||
m_create_tile_cooldown = 0.2f;
|
||||
changeDir(m_dir, false);
|
||||
|
@ -1208,7 +1223,9 @@ struct AssetBrowserImpl : AssetBrowser {
|
|||
bool m_show_subresources;
|
||||
bool m_has_focus = false;
|
||||
bool m_request_delete = false;
|
||||
bool m_request_focus_search = false;
|
||||
float m_thumbnail_size = 1.f;
|
||||
Action m_focus_search;
|
||||
Action m_toggle_ui;
|
||||
Action m_back_action;
|
||||
Action m_forward_action;
|
||||
|
|
|
@ -148,29 +148,30 @@ void LogUI::onGUI()
|
|||
showNotifications();
|
||||
|
||||
if (!m_is_open) return;
|
||||
if (ImGui::Begin(ICON_FA_COMMENT_ALT "Log##log", &m_is_open))
|
||||
{
|
||||
const char* labels[] = {"Info", "Warning", "Error"};
|
||||
for (u32 i = 0; i < lengthOf(labels); ++i)
|
||||
{
|
||||
char label[40];
|
||||
fillLabel(Span(label), labels[i], m_new_message_count[i]);
|
||||
if (i > 0) ImGui::SameLine();
|
||||
bool b = m_level_filter & (1 << i);
|
||||
if (ImGui::Checkbox(label, &b))
|
||||
if (ImGui::Begin(ICON_FA_COMMENT_ALT "Log##log", &m_is_open)) {
|
||||
if (ImGuiEx::IconButton(ICON_FA_COG, "Settings")) ImGui::OpenPopup("Settings");
|
||||
if (ImGui::BeginPopup("Settings")) {
|
||||
const char* labels[] = {"Info", "Warning", "Error"};
|
||||
for (u32 i = 0; i < lengthOf(labels); ++i)
|
||||
{
|
||||
if (b)
|
||||
m_level_filter |= 1 << i;
|
||||
else
|
||||
m_level_filter &= ~(1 << i);
|
||||
m_new_message_count[i] = 0;
|
||||
char label[40];
|
||||
fillLabel(Span(label), labels[i], m_new_message_count[i]);
|
||||
bool b = m_level_filter & (1 << i);
|
||||
if (ImGui::Checkbox(label, &b))
|
||||
{
|
||||
if (b)
|
||||
m_level_filter |= 1 << i;
|
||||
else
|
||||
m_level_filter &= ~(1 << i);
|
||||
m_new_message_count[i] = 0;
|
||||
}
|
||||
}
|
||||
ImGui::Checkbox("Autoscroll", &m_autoscroll);
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox("Autoscroll", &m_autoscroll);
|
||||
|
||||
m_filter.gui("Filter");
|
||||
m_filter.gui(ICON_FA_SEARCH " Filter");
|
||||
int len = 0;
|
||||
|
||||
if (ImGui::BeginChild("log_messages", ImVec2(0, 0), true))
|
||||
|
|
|
@ -1461,6 +1461,7 @@ struct StudioAppImpl final : StudioApp
|
|||
|
||||
bool is_any_entity_selected = !m_editor->getSelectedEntities().empty();
|
||||
menuItem("search", true);
|
||||
menuItem("focus_asset_search", true);
|
||||
menuItem("lookAtSelected", is_any_entity_selected);
|
||||
menuItem("copyViewTransform", is_any_entity_selected);
|
||||
menuItem("snapDown", is_any_entity_selected);
|
||||
|
|
|
@ -618,7 +618,7 @@ SceneView::SceneView(StudioApp& app)
|
|||
m_toggle_gizmo_step_action.init("Enable/disable gizmo step", "Enable/disable gizmo step", "toggleGizmoStep", "", false);
|
||||
m_set_pivot_action.init("Set custom pivot", "Set custom pivot", "set_custom_pivot", "", os::Keycode::K, Action::Modifiers::NONE, false);
|
||||
m_reset_pivot_action.init("Reset pivot", "Reset pivot", "reset_pivot", "", os::Keycode::K, Action::Modifiers::SHIFT, false);
|
||||
m_search_action.init(NO_ICON "Search", "Search models or actions", "search", ICON_FA_SEARCH, (os::Keycode)'Q', Action::Modifiers::CTRL, true);
|
||||
m_search_action.init(ICON_FA_SEARCH "Search", "Search models or actions", "search", ICON_FA_SEARCH, (os::Keycode)'Q', Action::Modifiers::CTRL, true);
|
||||
m_search_action.func.bind<&SceneView::toggleSearch>(this);
|
||||
|
||||
m_top_view_action.init(NO_ICON "Top", "Set top camera view", "viewTop", "", true);
|
||||
|
|
Loading…
Reference in a new issue