asset thumbnails WIP #1154
This commit is contained in:
parent
54b21c24c6
commit
8015409a6b
21 changed files with 228 additions and 216 deletions
1
external/imgui/imgui_user.h
vendored
1
external/imgui/imgui_user.h
vendored
|
@ -70,6 +70,7 @@ IMGUI_API void IntervalGraph(const unsigned long long* value_pairs,
|
|||
unsigned long long scele_max);
|
||||
IMGUI_API bool FilterInput(const char* label, char* buf, size_t buf_size, float width = -1);
|
||||
IMGUI_API void HSplitter(const char* str_id, ImVec2* size);
|
||||
IMGUI_API void VSplitter(const char* str_id, ImVec2* size);
|
||||
IMGUI_API void Rect(float w, float h, ImU32 color);
|
||||
|
||||
} // namespace ImGui
|
||||
|
|
16
external/imgui/imgui_user.inl
vendored
16
external/imgui/imgui_user.inl
vendored
|
@ -730,6 +730,22 @@ namespace ImGui
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void VSplitter(const char* str_id, ImVec2* size)
|
||||
{
|
||||
ImVec2 screen_pos = GetCursorScreenPos();
|
||||
InvisibleButton(str_id, ImVec2(3, -1));
|
||||
ImVec2 end_pos = screen_pos + GetItemRectSize();
|
||||
ImGuiWindow* win = GetCurrentWindow();
|
||||
ImVec4* colors = GetStyle().Colors;
|
||||
ImU32 color = GetColorU32(IsItemActive() || IsItemHovered() ? colors[ImGuiCol_ButtonActive] : colors[ImGuiCol_Button]);
|
||||
win->DrawList->AddRectFilled(screen_pos, end_pos, color);
|
||||
if (ImGui::IsItemActive())
|
||||
{
|
||||
size->x = ImMax(1.0f, ImGui::GetIO().MouseDelta.x + size->x);
|
||||
}
|
||||
}
|
||||
|
||||
static float s_max_timeline_value;
|
||||
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ struct StudioAppPlugin LUMIX_FINAL : public StudioApp::IPlugin
|
|||
: m_app(app)
|
||||
{
|
||||
m_filter[0] = 0;
|
||||
m_is_opened = false;
|
||||
m_is_open = false;
|
||||
Action* action = LUMIX_NEW(app.getWorldEditor()->getAllocator(), Action)("Clip manager", "clip_manager");
|
||||
action->func.bind<StudioAppPlugin, &StudioAppPlugin::onAction>(this);
|
||||
action->is_selected.bind<StudioAppPlugin, &StudioAppPlugin::isOpened>(this);
|
||||
|
@ -161,13 +161,13 @@ struct StudioAppPlugin LUMIX_FINAL : public StudioApp::IPlugin
|
|||
const char* getName() const override { return "audio"; }
|
||||
|
||||
|
||||
bool isOpened() const { return m_is_opened; }
|
||||
void onAction() { m_is_opened = !m_is_opened; }
|
||||
bool isOpened() const { return m_is_open; }
|
||||
void onAction() { m_is_open = !m_is_open; }
|
||||
|
||||
|
||||
void onWindowGUI() override
|
||||
{
|
||||
if (ImGui::BeginDock("Clip Manager", &m_is_opened))
|
||||
if (ImGui::BeginDock("Clip Manager", &m_is_open))
|
||||
{
|
||||
ImGui::InputText("Filter", m_filter, lengthOf(m_filter));
|
||||
|
||||
|
@ -225,7 +225,7 @@ struct StudioAppPlugin LUMIX_FINAL : public StudioApp::IPlugin
|
|||
|
||||
StudioApp& m_app;
|
||||
char m_filter[256];
|
||||
bool m_is_opened;
|
||||
bool m_is_open;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ AssetBrowser::AssetBrowser(StudioApp& app)
|
|||
, m_app(app)
|
||||
, m_is_update_enabled(true)
|
||||
, m_current_type(0)
|
||||
, m_is_opened(false)
|
||||
, m_is_open(false)
|
||||
, m_activate(false)
|
||||
, m_is_init_finished(false)
|
||||
, m_history_index(-1)
|
||||
|
@ -239,20 +239,6 @@ void AssetBrowser::update()
|
|||
}
|
||||
|
||||
|
||||
void AssetBrowser::onToolbar()
|
||||
{
|
||||
auto pos = ImGui::GetCursorScreenPos();
|
||||
if (ImGui::BeginToolbar("asset_browser_toolbar", pos, ImVec2(0, 24)))
|
||||
{
|
||||
if (m_history_index > 0) m_back_action->toolbarButton();
|
||||
if (m_history_index < m_history.size() - 1) m_forward_action->toolbarButton();
|
||||
m_auto_reload_action->toolbarButton();
|
||||
m_refresh_action->toolbarButton();
|
||||
}
|
||||
ImGui::EndToolbar();
|
||||
}
|
||||
|
||||
|
||||
static void clampText(char* text, int width)
|
||||
{
|
||||
char* end = text + stringLength(text);
|
||||
|
@ -305,21 +291,24 @@ void AssetBrowser::changeDir(const char* path)
|
|||
StaticString<MAX_PATH_LENGTH> file_path_str(m_dir, "/", info.filename);
|
||||
Path filepath(file_path_str);
|
||||
ResourceType type = getResourceType(filepath.c_str());
|
||||
|
||||
if (type == INVALID_RESOURCE_TYPE) continue;
|
||||
|
||||
for (IPlugin* plugin : m_plugins)
|
||||
{
|
||||
if (plugin->createTile(filepath.c_str(), type))
|
||||
{
|
||||
FileInfo tile;
|
||||
tile.file_path_hash = filepath.getHash();
|
||||
char filename[MAX_PATH_LENGTH];
|
||||
PathUtils::getBasename(filename, lengthOf(filename), filepath.c_str());
|
||||
tile.filepath = filepath.c_str();
|
||||
clampText(filename, TILE_SIZE);
|
||||
tile.clamped_filename = filename;
|
||||
m_file_infos.push(tile);
|
||||
break;
|
||||
}
|
||||
if (plugin->createTile(filepath.c_str(), type)) break;
|
||||
}
|
||||
|
||||
FileInfo tile;
|
||||
char filename[MAX_PATH_LENGTH];
|
||||
PathUtils::getBasename(filename, lengthOf(filename), filepath.c_str());
|
||||
clampText(filename, TILE_SIZE);
|
||||
|
||||
tile.file_path_hash = filepath.getHash();
|
||||
tile.filepath = filepath.c_str();
|
||||
tile.clamped_filename = filename;
|
||||
|
||||
m_file_infos.push(tile);
|
||||
}
|
||||
|
||||
PlatformInterface::destroyFileIterator(iter);
|
||||
|
@ -355,23 +344,10 @@ void AssetBrowser::breadcrumbs()
|
|||
}
|
||||
|
||||
|
||||
void AssetBrowser::onTilesGUI()
|
||||
void AssetBrowser::leftColumn()
|
||||
{
|
||||
if (m_dir.data[0] == '\0') changeDir(".");
|
||||
|
||||
if (!ImGui::BeginDock("Assets"))
|
||||
{
|
||||
ImGui::EndDock();
|
||||
return;
|
||||
}
|
||||
|
||||
ImGui::FilterInput("filter", m_filter, sizeof(m_filter), 100);
|
||||
|
||||
ImGui::SameLine(130);
|
||||
breadcrumbs();
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::BeginChild("left_col", ImVec2(120, 0));
|
||||
ImVec2 size(m_left_column_width, 0);
|
||||
ImGui::BeginChild("left_col", size);
|
||||
ImGui::PushItemWidth(120);
|
||||
bool b = false;
|
||||
if (ImGui::Selectable("..", &b))
|
||||
|
@ -392,10 +368,13 @@ void AssetBrowser::onTilesGUI()
|
|||
|
||||
ImGui::PopItemWidth();
|
||||
ImGui::EndChild();
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::BeginChild("right_col");
|
||||
void AssetBrowser::middleColumn()
|
||||
{
|
||||
ImVec2 size(m_middle_column_width, 0);
|
||||
ImGui::BeginChild("main_col", size);
|
||||
|
||||
IAllocator& allocator = m_app.getWorldEditor()->getAllocator();
|
||||
|
||||
|
@ -419,7 +398,7 @@ void AssetBrowser::onTilesGUI()
|
|||
}
|
||||
else
|
||||
{
|
||||
ImGui::Dummy(img_size);
|
||||
ImGui::Rect(img_size.x, img_size.y, 0xffffFFFF);
|
||||
StaticString<MAX_PATH_LENGTH> path(".lumix/asset_tiles/", tile.file_path_hash, ".dds");
|
||||
if (PlatformInterface::fileExists(path)) tile.tex = ri->loadTexture(Path(path));
|
||||
}
|
||||
|
@ -440,79 +419,112 @@ void AssetBrowser::onTilesGUI()
|
|||
}
|
||||
ImGui::NewLine();
|
||||
ImGui::EndChild();
|
||||
}
|
||||
|
||||
ImGui::EndDock();
|
||||
|
||||
void AssetBrowser::rightColumn()
|
||||
{
|
||||
if (ImGui::BeginChild("right_col"))
|
||||
{
|
||||
ImVec2 pos = ImGui::GetCursorScreenPos();
|
||||
if (ImGui::BeginToolbar("asset_browser_toolbar", pos, ImVec2(0, 24)))
|
||||
{
|
||||
if (m_history_index > 0) m_back_action->toolbarButton();
|
||||
if (m_history_index < m_history.size() - 1) m_forward_action->toolbarButton();
|
||||
m_auto_reload_action->toolbarButton();
|
||||
m_refresh_action->toolbarButton();
|
||||
}
|
||||
ImGui::EndToolbar();
|
||||
|
||||
if (!m_selected_resource) goto end;
|
||||
|
||||
const char* path = m_selected_resource->getPath().c_str();
|
||||
ImGui::Separator();
|
||||
ImGui::LabelText("Selected resource", "%s", path);
|
||||
ImGui::Separator();
|
||||
|
||||
if (!m_selected_resource->isReady() && !m_selected_resource->isFailure())
|
||||
{
|
||||
ImGui::Text("Not ready");
|
||||
goto end;
|
||||
}
|
||||
|
||||
char source[MAX_PATH_LENGTH];
|
||||
if (m_metadata.getString(m_selected_resource->getPath().getHash(), SOURCE_HASH, source, lengthOf(source)))
|
||||
{
|
||||
ImGui::LabelText("Source", "%s", source);
|
||||
}
|
||||
|
||||
auto resource_type = getResourceType(path);
|
||||
for (auto* plugin : m_plugins)
|
||||
{
|
||||
if (plugin->onGUI(m_selected_resource, resource_type)) goto end;
|
||||
}
|
||||
ASSERT(false); // unimplemented resource
|
||||
}
|
||||
|
||||
end:
|
||||
ImGui::EndChild();
|
||||
}
|
||||
|
||||
|
||||
void AssetBrowser::onGUI()
|
||||
{
|
||||
onTilesGUI();
|
||||
|
||||
if (m_dir.data[0] == '\0') changeDir(".");
|
||||
|
||||
if (m_wanted_resource.isValid())
|
||||
{
|
||||
selectResource(m_wanted_resource, true);
|
||||
m_wanted_resource = "";
|
||||
}
|
||||
|
||||
if (!ImGui::BeginDock("Asset Browser", &m_is_opened))
|
||||
m_is_open = m_is_open || m_activate;
|
||||
|
||||
if (!ImGui::BeginDock("Assets", &m_is_open))
|
||||
{
|
||||
if (m_activate) ImGui::SetDockActive();
|
||||
m_activate = false;
|
||||
ImGui::EndDock();
|
||||
return;
|
||||
}
|
||||
|
||||
onToolbar();
|
||||
|
||||
if (ImGui::BeginChild("content"))
|
||||
if (m_is_focus_requested)
|
||||
{
|
||||
if (m_activate) ImGui::SetDockActive();
|
||||
m_activate = false;
|
||||
|
||||
if (m_is_focus_requested)
|
||||
{
|
||||
m_is_focus_requested = false;
|
||||
ImGui::SetWindowFocus();
|
||||
}
|
||||
|
||||
auto getter = [](void* data, int idx, const char** out) -> bool
|
||||
{
|
||||
auto& browser = *static_cast<AssetBrowser*>(data);
|
||||
*out = browser.m_plugins[idx]->getName();
|
||||
return true;
|
||||
};
|
||||
|
||||
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x);
|
||||
ImGui::Combo("Type", &m_current_type, getter, this, m_plugins.size());
|
||||
ImGui::FilterInput("Filter", m_filter, sizeof(m_filter));
|
||||
|
||||
static ImVec2 size(0, 200);
|
||||
ImGui::ListBoxHeader("Resources", size);
|
||||
auto& resources = m_resources[m_current_type + 1];
|
||||
|
||||
for (auto& resource : resources)
|
||||
{
|
||||
if (m_filter[0] != '\0' && strstr(resource.c_str(), m_filter) == nullptr) continue;
|
||||
|
||||
bool is_selected = m_selected_resource ? m_selected_resource->getPath() == resource : false;
|
||||
if (ImGui::Selectable(resource.c_str(), is_selected))
|
||||
{
|
||||
selectResource(resource, true);
|
||||
}
|
||||
if (ImGui::IsMouseDragging() && ImGui::IsItemActive())
|
||||
{
|
||||
m_app.startDrag(StudioApp::DragData::PATH, resource.c_str(), stringLength(resource.c_str()) + 1);
|
||||
}
|
||||
}
|
||||
ImGui::ListBoxFooter();
|
||||
ImGui::HSplitter("splitter", &size);
|
||||
|
||||
ImGui::PopItemWidth();
|
||||
onGUIResource();
|
||||
m_is_focus_requested = false;
|
||||
ImGui::SetWindowFocus();
|
||||
}
|
||||
ImGui::EndChild();
|
||||
if (m_activate) ImGui::SetDockActive();
|
||||
|
||||
ImGui::FilterInput("filter", m_filter, sizeof(m_filter), 100);
|
||||
ImGui::SameLine(130);
|
||||
breadcrumbs();
|
||||
ImGui::Separator();
|
||||
|
||||
float content_w = ImGui::GetContentRegionAvailWidth();
|
||||
if (m_middle_column_width < 0) m_middle_column_width = content_w - m_left_column_width - 120;
|
||||
ImVec2 main_size(m_middle_column_width, 0);
|
||||
ImVec2 left_size(m_left_column_width, 0);
|
||||
if (left_size.x < 10) left_size.x = 10;
|
||||
if (left_size.x > content_w - 70) left_size.x = content_w - 70;
|
||||
if (main_size.x < 10) main_size.x = 10;
|
||||
if (content_w - left_size.x - main_size.x < 60) main_size.x = content_w - 60 - left_size.x;
|
||||
|
||||
leftColumn();
|
||||
|
||||
ImGui::SameLine();
|
||||
ImGui::VSplitter("vsplit1", &left_size);
|
||||
m_left_column_width = left_size.x;
|
||||
ImGui::SameLine();
|
||||
|
||||
middleColumn();
|
||||
|
||||
ImGui::SameLine();
|
||||
ImGui::VSplitter("vsplit2", &main_size);
|
||||
m_middle_column_width = main_size.x;
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
rightColumn();
|
||||
|
||||
ImGui::EndDock();
|
||||
}
|
||||
|
||||
|
@ -624,7 +636,7 @@ bool AssetBrowser::resourceInput(const char* label, const char* str_id, char* bu
|
|||
if (ImGui::Button(StaticString<30>("View###go", str_id)))
|
||||
{
|
||||
m_is_focus_requested = true;
|
||||
m_is_opened = true;
|
||||
m_is_open = true;
|
||||
m_wanted_resource = buf;
|
||||
}
|
||||
ImGui::SameLine();
|
||||
|
@ -711,36 +723,6 @@ void AssetBrowser::goForward()
|
|||
}
|
||||
|
||||
|
||||
void AssetBrowser::onGUIResource()
|
||||
{
|
||||
if (!m_selected_resource) return;
|
||||
|
||||
const char* path = m_selected_resource->getPath().c_str();
|
||||
ImGui::Separator();
|
||||
ImGui::LabelText("Selected resource", "%s", path);
|
||||
ImGui::Separator();
|
||||
|
||||
if (!m_selected_resource->isReady() && !m_selected_resource->isFailure())
|
||||
{
|
||||
ImGui::Text("Not ready");
|
||||
return;
|
||||
}
|
||||
|
||||
char source[MAX_PATH_LENGTH];
|
||||
if (m_metadata.getString(m_selected_resource->getPath().getHash(), SOURCE_HASH, source, lengthOf(source)))
|
||||
{
|
||||
ImGui::LabelText("Source", "%s", source);
|
||||
}
|
||||
|
||||
auto resource_type = getResourceType(path);
|
||||
for (auto* plugin : m_plugins)
|
||||
{
|
||||
if (plugin->onGUI(m_selected_resource, resource_type)) return;
|
||||
}
|
||||
ASSERT(false); // unimplemented resource
|
||||
}
|
||||
|
||||
|
||||
const Array<Path>& AssetBrowser::getResources(int type) const
|
||||
{
|
||||
return m_resources[type];
|
||||
|
|
|
@ -58,7 +58,9 @@ public:
|
|||
bool resourceList(char* buf, int max_size, ResourceType type, float height);
|
||||
|
||||
public:
|
||||
bool m_is_opened;
|
||||
bool m_is_open;
|
||||
float m_left_column_width = 120;
|
||||
float m_middle_column_width = 300;
|
||||
static const int TILE_SIZE = 128;
|
||||
|
||||
private:
|
||||
|
@ -71,6 +73,10 @@ private:
|
|||
};
|
||||
|
||||
private:
|
||||
void leftColumn();
|
||||
void middleColumn();
|
||||
void rightColumn();
|
||||
|
||||
void breadcrumbs();
|
||||
void onTilesGUI();
|
||||
void changeDir(const char* path);
|
||||
|
@ -78,12 +84,10 @@ private:
|
|||
void findResources();
|
||||
void processDir(const char* path, int base_length);
|
||||
void addResource(const char* path, const char* filename);
|
||||
void onGUIResource();
|
||||
void unloadResource();
|
||||
void selectResource(Resource* resource, bool record_history);
|
||||
int getResourceTypeIndex(const char* ext);
|
||||
bool acceptExtension(const char* ext, ResourceType type);
|
||||
void onToolbar();
|
||||
void goBack();
|
||||
void goForward();
|
||||
void toggleAutoreload();
|
||||
|
|
|
@ -15,7 +15,7 @@ LogUI::LogUI(IAllocator& allocator)
|
|||
, m_notifications(allocator)
|
||||
, m_last_uid(1)
|
||||
, m_guard(false)
|
||||
, m_is_opened(false)
|
||||
, m_is_open(false)
|
||||
, m_are_notifications_hovered(false)
|
||||
, m_move_notifications_to_front(false)
|
||||
{
|
||||
|
@ -168,7 +168,7 @@ void LogUI::onGUI()
|
|||
MT::SpinLock lock(m_guard);
|
||||
showNotifications();
|
||||
|
||||
if (ImGui::BeginDock("Log", &m_is_opened))
|
||||
if (ImGui::BeginDock("Log", &m_is_open))
|
||||
{
|
||||
const char* labels[] = { "Info", "Warning", "Error" };
|
||||
for (int i = 0; i < lengthOf(labels); ++i)
|
||||
|
|
|
@ -23,7 +23,7 @@ class LUMIX_EDITOR_API LogUI
|
|||
int getUnreadErrorCount() const;
|
||||
|
||||
public:
|
||||
bool m_is_opened;
|
||||
bool m_is_open;
|
||||
|
||||
private:
|
||||
enum Type
|
||||
|
|
|
@ -56,7 +56,7 @@ struct ProfilerUIImpl LUMIX_FINAL : public ProfilerUI
|
|||
m_allocation_size_from = 0;
|
||||
m_allocation_size_to = 1024 * 1024;
|
||||
m_current_frame = -1;
|
||||
m_is_opened = false;
|
||||
m_is_open = false;
|
||||
m_is_paused = true;
|
||||
m_current_block = nullptr;
|
||||
m_frame_start = m_frame_end = 0;
|
||||
|
@ -320,7 +320,7 @@ struct ProfilerUIImpl LUMIX_FINAL : public ProfilerUI
|
|||
m_bytes_read = 0;
|
||||
}
|
||||
|
||||
if (ImGui::BeginDock("Profiler", &m_is_opened))
|
||||
if (ImGui::BeginDock("Profiler", &m_is_open))
|
||||
{
|
||||
onGUICPUProfiler();
|
||||
onGUIMemoryProfiler();
|
||||
|
@ -367,7 +367,7 @@ struct ProfilerUIImpl LUMIX_FINAL : public ProfilerUI
|
|||
Block* m_parent;
|
||||
Block* m_first_child;
|
||||
Block* m_next;
|
||||
bool m_is_opened;
|
||||
bool m_is_open;
|
||||
Profiler::BlockType m_type;
|
||||
Array<float> m_frames;
|
||||
struct Hit
|
||||
|
@ -555,7 +555,7 @@ void ProfilerUIImpl::cloneBlock(Block* my_block, Profiler::Block* remote_block)
|
|||
|
||||
void ProfilerUIImpl::onFrame()
|
||||
{
|
||||
if (!m_is_opened) return;
|
||||
if (!m_is_open) return;
|
||||
if (m_is_paused) return;
|
||||
|
||||
m_frame_start = m_frame_end;
|
||||
|
@ -612,13 +612,13 @@ void ProfilerUIImpl::showProfileBlock(Block* block, int column)
|
|||
{
|
||||
if (ImGui::TreeNode(block->m_name))
|
||||
{
|
||||
block->m_is_opened = true;
|
||||
block->m_is_open = true;
|
||||
showProfileBlock(block->m_first_child, column);
|
||||
ImGui::TreePop();
|
||||
}
|
||||
else
|
||||
{
|
||||
block->m_is_opened = false;
|
||||
block->m_is_open = false;
|
||||
}
|
||||
|
||||
block = block->m_next;
|
||||
|
@ -637,7 +637,7 @@ void ProfilerUIImpl::showProfileBlock(Block* block, int column)
|
|||
{
|
||||
m_current_block = block;
|
||||
}
|
||||
if (block->m_is_opened)
|
||||
if (block->m_is_open)
|
||||
{
|
||||
showProfileBlock(block->m_first_child, column);
|
||||
}
|
||||
|
@ -685,7 +685,7 @@ void ProfilerUIImpl::showProfileBlock(Block* block, int column)
|
|||
{
|
||||
m_current_block = block;
|
||||
}
|
||||
if (block->m_is_opened)
|
||||
if (block->m_is_open)
|
||||
{
|
||||
showProfileBlock(block->m_first_child, column);
|
||||
}
|
||||
|
@ -707,7 +707,7 @@ void ProfilerUIImpl::showProfileBlock(Block* block, int column)
|
|||
m_current_frame < 0 ? block->m_int_values.back() : block->m_int_values[m_current_frame];
|
||||
|
||||
ImGui::Text("%d", hit_count);
|
||||
if (block->m_is_opened)
|
||||
if (block->m_is_open)
|
||||
{
|
||||
showProfileBlock(block->m_first_child, column);
|
||||
}
|
||||
|
@ -727,7 +727,7 @@ void ProfilerUIImpl::showProfileBlock(Block* block, int column)
|
|||
{
|
||||
ImGui::IntervalGraph(&block->m_hits[0].start, block->m_hits.size(), m_frame_start, m_frame_end);
|
||||
}
|
||||
if(block->m_is_opened)
|
||||
if(block->m_is_open)
|
||||
{
|
||||
showProfileBlock(block->m_first_child, column);
|
||||
}
|
||||
|
@ -1119,7 +1119,7 @@ ProfilerUIImpl::Block::Block(IAllocator& allocator)
|
|||
: m_frames(allocator)
|
||||
, m_hits(allocator)
|
||||
, m_int_values(allocator)
|
||||
, m_is_opened(false)
|
||||
, m_is_open(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ public:
|
|||
static ProfilerUI* create(Engine& engine);
|
||||
static void destroy(ProfilerUI& ui);
|
||||
|
||||
bool m_is_opened;
|
||||
bool m_is_open;
|
||||
u64 m_frame_start;
|
||||
u64 m_frame_end;
|
||||
};
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace Lumix
|
|||
|
||||
PropertyGrid::PropertyGrid(StudioApp& app)
|
||||
: m_app(app)
|
||||
, m_is_opened(true)
|
||||
, m_is_open(true)
|
||||
, m_editor(*app.getWorldEditor())
|
||||
, m_plugins(app.getWorldEditor()->getAllocator())
|
||||
{
|
||||
|
@ -736,7 +736,7 @@ static void showAddComponentNode(const StudioApp::AddCmpTreeNode* node, const ch
|
|||
void PropertyGrid::onGUI()
|
||||
{
|
||||
auto& ents = m_editor.getSelectedEntities();
|
||||
if (ImGui::BeginDock("Properties", &m_is_opened) && !ents.empty())
|
||||
if (ImGui::BeginDock("Properties", &m_is_open) && !ents.empty())
|
||||
{
|
||||
if (ImGui::Button("Add component"))
|
||||
{
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
bool entityInput(const char* label, const char* str_id, Entity& entity) const;
|
||||
|
||||
public:
|
||||
bool m_is_opened;
|
||||
bool m_is_open;
|
||||
|
||||
private:
|
||||
void showProperty(PropertyDescriptorBase& desc,
|
||||
|
|
|
@ -222,7 +222,7 @@ static int getInteger(lua_State* L, const char* name, int default_value)
|
|||
|
||||
Settings::Settings(StudioApp& app)
|
||||
: m_app(app)
|
||||
, m_is_opened(false)
|
||||
, m_is_open(false)
|
||||
, m_editor(nullptr)
|
||||
, m_is_maximized(true)
|
||||
, m_is_entity_list_opened(false)
|
||||
|
@ -280,8 +280,10 @@ bool Settings::load()
|
|||
|
||||
m_is_maximized = getBoolean(L, "maximized", true);
|
||||
|
||||
m_is_opened = getBoolean(L, "settings_opened", false);
|
||||
m_is_open = getBoolean(L, "settings_opened", false);
|
||||
m_is_asset_browser_opened = getBoolean(L, "asset_browser_opened", false);
|
||||
m_asset_browser_left_column_width = getFloat(L, "asset_browser_left_column_width", false);
|
||||
m_asset_browser_middle_column_width = getFloat(L, "asset_browser_middle_column_width", false);
|
||||
m_is_entity_list_opened = getBoolean(L, "entity_list_opened", false);
|
||||
m_is_entity_template_list_opened = getBoolean(L, "entity_template_list_opened", false);
|
||||
m_is_log_opened = getBoolean(L, "log_opened", false);
|
||||
|
@ -400,7 +402,7 @@ bool Settings::save()
|
|||
file << name << " = " << (value ? "true\n" : "false\n");
|
||||
};
|
||||
|
||||
writeBool("settings_opened", m_is_opened);
|
||||
writeBool("settings_opened", m_is_open);
|
||||
writeBool("asset_browser_opened", m_is_asset_browser_opened);
|
||||
writeBool("entity_list_opened", m_is_entity_list_opened);
|
||||
writeBool("entity_template_list_opened", m_is_entity_template_list_opened);
|
||||
|
@ -410,6 +412,8 @@ bool Settings::save()
|
|||
writeBool("error_reporting_enabled", m_is_crash_reporting_enabled);
|
||||
file << "mouse_sensitivity_x = " << m_mouse_sensitivity_x << "\n";
|
||||
file << "mouse_sensitivity_y = " << m_mouse_sensitivity_y << "\n";
|
||||
file << "asset_browser_middle_column_width = " << m_asset_browser_middle_column_width << "\n";
|
||||
file << "asset_browser_left_column_width = " << m_asset_browser_left_column_width << "\n";
|
||||
|
||||
saveStyle(file);
|
||||
|
||||
|
@ -566,7 +570,7 @@ void Settings::showShortcutSettings()
|
|||
|
||||
void Settings::onGUI()
|
||||
{
|
||||
if (ImGui::BeginDock("Settings", &m_is_opened))
|
||||
if (ImGui::BeginDock("Settings", &m_is_open))
|
||||
{
|
||||
if (ImGui::Button("Save")) save();
|
||||
ImGui::SameLine();
|
||||
|
|
|
@ -18,7 +18,7 @@ class StudioApp;
|
|||
struct LUMIX_EDITOR_API Settings
|
||||
{
|
||||
// gui - not saved
|
||||
bool m_is_opened;
|
||||
bool m_is_open;
|
||||
char m_filter[100];
|
||||
|
||||
// actual settings
|
||||
|
@ -39,6 +39,8 @@ struct LUMIX_EDITOR_API Settings
|
|||
bool m_is_properties_opened;
|
||||
bool m_is_crash_reporting_enabled;
|
||||
bool m_force_no_crash_report;
|
||||
float m_asset_browser_left_column_width;
|
||||
float m_asset_browser_middle_column_width;
|
||||
float m_mouse_sensitivity_x;
|
||||
float m_mouse_sensitivity_y;
|
||||
char m_data_dir[MAX_PATH_LENGTH];
|
||||
|
|
|
@ -69,7 +69,7 @@ struct LuaPlugin : public StudioApp::IPlugin
|
|||
Action* action = LUMIX_NEW(editor.getAllocator(), Action)(name, name);
|
||||
action->func.bind<LuaPlugin, &LuaPlugin::onAction>(this);
|
||||
app.addWindowAction(action);
|
||||
m_is_opened = false;
|
||||
m_is_open = false;
|
||||
|
||||
lua_pop(L, 1); // plugin_name
|
||||
}
|
||||
|
@ -86,13 +86,13 @@ struct LuaPlugin : public StudioApp::IPlugin
|
|||
|
||||
void onAction()
|
||||
{
|
||||
m_is_opened = !m_is_opened;
|
||||
m_is_open = !m_is_open;
|
||||
}
|
||||
|
||||
|
||||
void onWindowGUI() override
|
||||
{
|
||||
if (!m_is_opened) return;
|
||||
if (!m_is_open) return;
|
||||
if (lua_getglobal(L, "onGUI") == LUA_TFUNCTION)
|
||||
{
|
||||
if (lua_pcall(L, 0, 0, 0) != LUA_OK)
|
||||
|
@ -110,7 +110,7 @@ struct LuaPlugin : public StudioApp::IPlugin
|
|||
WorldEditor& editor;
|
||||
lua_State* L;
|
||||
int thread_ref;
|
||||
bool m_is_opened;
|
||||
bool m_is_open;
|
||||
};
|
||||
|
||||
|
||||
|
@ -758,12 +758,12 @@ public:
|
|||
void toggleMeasure() { m_editor->toggleMeasure(); }
|
||||
void snapDown() { m_editor->snapDown(); }
|
||||
void lookAtSelected() { m_editor->lookAtSelected(); }
|
||||
void toggleSettings() { m_settings.m_is_opened = !m_settings.m_is_opened; }
|
||||
bool areSettingsOpened() const { return m_settings.m_is_opened; }
|
||||
void toggleSettings() { m_settings.m_is_open = !m_settings.m_is_open; }
|
||||
bool areSettingsOpened() const { return m_settings.m_is_open; }
|
||||
void toggleEntityList() { m_is_entity_list_opened = !m_is_entity_list_opened; }
|
||||
bool isEntityListOpened() const { return m_is_entity_list_opened; }
|
||||
void toggleAssetBrowser() { m_asset_browser->m_is_opened = !m_asset_browser->m_is_opened; }
|
||||
bool isAssetBrowserOpened() const { return m_asset_browser->m_is_opened; }
|
||||
void toggleAssetBrowser() { m_asset_browser->m_is_open = !m_asset_browser->m_is_open; }
|
||||
bool isAssetBrowserOpened() const { return m_asset_browser->m_is_open; }
|
||||
int getExitCode() const override { return m_exit_code; }
|
||||
AssetBrowser* getAssetBrowser() override { return m_asset_browser; }
|
||||
PropertyGrid* getPropertyGrid() override { return m_property_grid; }
|
||||
|
@ -1057,11 +1057,11 @@ public:
|
|||
{
|
||||
if (!ImGui::BeginMenu("View")) return;
|
||||
|
||||
ImGui::MenuItem("Asset browser", nullptr, &m_asset_browser->m_is_opened);
|
||||
ImGui::MenuItem("Asset browser", nullptr, &m_asset_browser->m_is_open);
|
||||
doMenuItem(*getAction("entityList"), true);
|
||||
ImGui::MenuItem("Log", nullptr, &m_log_ui->m_is_opened);
|
||||
ImGui::MenuItem("Profiler", nullptr, &m_profiler_ui->m_is_opened);
|
||||
ImGui::MenuItem("Properties", nullptr, &m_property_grid->m_is_opened);
|
||||
ImGui::MenuItem("Log", nullptr, &m_log_ui->m_is_open);
|
||||
ImGui::MenuItem("Profiler", nullptr, &m_profiler_ui->m_is_open);
|
||||
ImGui::MenuItem("Properties", nullptr, &m_property_grid->m_is_open);
|
||||
doMenuItem(*getAction("settings"), true);
|
||||
ImGui::Separator();
|
||||
for (Action* action : m_window_actions)
|
||||
|
@ -1283,11 +1283,13 @@ public:
|
|||
|
||||
void saveSettings()
|
||||
{
|
||||
m_settings.m_is_asset_browser_opened = m_asset_browser->m_is_opened;
|
||||
m_settings.m_is_asset_browser_opened = m_asset_browser->m_is_open;
|
||||
m_settings.m_asset_browser_left_column_width = m_asset_browser->m_left_column_width;
|
||||
m_settings.m_asset_browser_middle_column_width = m_asset_browser->m_middle_column_width;
|
||||
m_settings.m_is_entity_list_opened = m_is_entity_list_opened;
|
||||
m_settings.m_is_log_opened = m_log_ui->m_is_opened;
|
||||
m_settings.m_is_profiler_opened = m_profiler_ui->m_is_opened;
|
||||
m_settings.m_is_properties_opened = m_property_grid->m_is_opened;
|
||||
m_settings.m_is_log_opened = m_log_ui->m_is_open;
|
||||
m_settings.m_is_profiler_opened = m_profiler_ui->m_is_open;
|
||||
m_settings.m_is_properties_opened = m_property_grid->m_is_open;
|
||||
m_settings.m_mouse_sensitivity_x = m_editor->getMouseSensitivity().x;
|
||||
m_settings.m_mouse_sensitivity_y = m_editor->getMouseSensitivity().y;
|
||||
|
||||
|
@ -1343,11 +1345,13 @@ public:
|
|||
|
||||
m_settings.load();
|
||||
|
||||
m_asset_browser->m_is_opened = m_settings.m_is_asset_browser_opened;
|
||||
m_asset_browser->m_is_open = m_settings.m_is_asset_browser_opened;
|
||||
m_asset_browser->m_left_column_width = m_settings.m_asset_browser_left_column_width;
|
||||
m_asset_browser->m_middle_column_width = m_settings.m_asset_browser_middle_column_width;
|
||||
m_is_entity_list_opened = m_settings.m_is_entity_list_opened;
|
||||
m_log_ui->m_is_opened = m_settings.m_is_log_opened;
|
||||
m_profiler_ui->m_is_opened = m_settings.m_is_profiler_opened;
|
||||
m_property_grid->m_is_opened = m_settings.m_is_properties_opened;
|
||||
m_log_ui->m_is_open = m_settings.m_is_log_opened;
|
||||
m_profiler_ui->m_is_open = m_settings.m_is_profiler_opened;
|
||||
m_property_grid->m_is_open = m_settings.m_is_properties_opened;
|
||||
|
||||
if (m_settings.m_is_maximized)
|
||||
{
|
||||
|
|
|
@ -2356,7 +2356,7 @@ ImportAssetDialog::ImportAssetDialog(StudioApp& app)
|
|||
|
||||
m_image.data = nullptr;
|
||||
|
||||
m_is_opened = false;
|
||||
m_is_open = false;
|
||||
m_message[0] = '\0';
|
||||
m_import_message[0] = '\0';
|
||||
m_task = nullptr;
|
||||
|
@ -2422,7 +2422,7 @@ ImportAssetDialog::ImportAssetDialog(StudioApp& app)
|
|||
|
||||
bool ImportAssetDialog::isOpened() const
|
||||
{
|
||||
return m_is_opened;
|
||||
return m_is_open;
|
||||
}
|
||||
|
||||
|
||||
|
@ -3256,7 +3256,7 @@ void ImportAssetDialog::checkTask(bool wait)
|
|||
|
||||
void ImportAssetDialog::onAction()
|
||||
{
|
||||
m_is_opened = !m_is_opened;
|
||||
m_is_open = !m_is_open;
|
||||
}
|
||||
|
||||
|
||||
|
@ -3280,7 +3280,7 @@ void ImportAssetDialog::addSource(const char* src)
|
|||
|
||||
void ImportAssetDialog::onWindowGUI()
|
||||
{
|
||||
if (!ImGui::BeginDock("Import Asset", &m_is_opened))
|
||||
if (!ImGui::BeginDock("Import Asset", &m_is_open))
|
||||
{
|
||||
ImGui::EndDock();
|
||||
return;
|
||||
|
|
|
@ -50,7 +50,7 @@ class ImportAssetDialog LUMIX_FINAL : public StudioApp::IPlugin
|
|||
const char* getName() const override { return "import_asset"; }
|
||||
|
||||
public:
|
||||
bool m_is_opened;
|
||||
bool m_is_open;
|
||||
|
||||
private:
|
||||
bool checkSource();
|
||||
|
|
|
@ -506,26 +506,6 @@ struct ModelPlugin LUMIX_FINAL : public AssetBrowser::IPlugin
|
|||
if (type != MODEL_TYPE) return false;
|
||||
|
||||
auto* model = static_cast<Model*>(resource);
|
||||
|
||||
showPreview(*model);
|
||||
|
||||
ImGui::LabelText("Bone count", "%d", model->getBoneCount());
|
||||
if (model->getBoneCount() > 0 && ImGui::CollapsingHeader("Bones"))
|
||||
{
|
||||
ImGui::Columns(3);
|
||||
for (int i = 0; i < model->getBoneCount(); ++i)
|
||||
{
|
||||
ImGui::Text("%s", model->getBone(i).name.c_str());
|
||||
ImGui::NextColumn();
|
||||
auto pos = model->getBone(i).transform.pos;
|
||||
ImGui::Text("%f; %f; %f", pos.x, pos.y, pos.z);
|
||||
ImGui::NextColumn();
|
||||
auto rot = model->getBone(i).transform.rot;
|
||||
ImGui::Text("%f; %f; %f; %f", rot.x, rot.y, rot.z, rot.w);
|
||||
ImGui::NextColumn();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::LabelText("Bounding radius", "%f", model->getBoundingRadius());
|
||||
|
||||
auto* lods = model->getLODs();
|
||||
|
@ -589,6 +569,25 @@ struct ModelPlugin LUMIX_FINAL : public AssetBrowser::IPlugin
|
|||
}
|
||||
}
|
||||
|
||||
ImGui::LabelText("Bone count", "%d", model->getBoneCount());
|
||||
if (model->getBoneCount() > 0 && ImGui::CollapsingHeader("Bones"))
|
||||
{
|
||||
ImGui::Columns(3);
|
||||
for (int i = 0; i < model->getBoneCount(); ++i)
|
||||
{
|
||||
ImGui::Text("%s", model->getBone(i).name.c_str());
|
||||
ImGui::NextColumn();
|
||||
Vec3 pos = model->getBone(i).transform.pos;
|
||||
ImGui::Text("%f; %f; %f", pos.x, pos.y, pos.z);
|
||||
ImGui::NextColumn();
|
||||
Quat rot = model->getBone(i).transform.rot;
|
||||
ImGui::Text("%f; %f; %f; %f", rot.x, rot.y, rot.z, rot.w);
|
||||
ImGui::NextColumn();
|
||||
}
|
||||
}
|
||||
|
||||
showPreview(*model);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2324,7 +2323,7 @@ struct ShaderEditorPlugin LUMIX_FINAL : public StudioApp::IPlugin
|
|||
action->func.bind<ShaderEditorPlugin, &ShaderEditorPlugin::onAction>(this);
|
||||
action->is_selected.bind<ShaderEditorPlugin, &ShaderEditorPlugin::isOpened>(this);
|
||||
app.addWindowAction(action);
|
||||
m_shader_editor.m_is_opened = false;
|
||||
m_shader_editor.m_is_open = false;
|
||||
|
||||
m_compiler = LUMIX_NEW(app.getWorldEditor()->getAllocator(), ShaderCompiler)(app, *app.getLogUI());
|
||||
|
||||
|
@ -2340,10 +2339,10 @@ struct ShaderEditorPlugin LUMIX_FINAL : public StudioApp::IPlugin
|
|||
|
||||
const char* getName() const override { return "shader_editor"; }
|
||||
void update(float) override { m_compiler->update(); }
|
||||
void onAction() { m_shader_editor.m_is_opened = !m_shader_editor.m_is_opened; }
|
||||
void onAction() { m_shader_editor.m_is_open = !m_shader_editor.m_is_open; }
|
||||
void onWindowGUI() override { m_shader_editor.onGUI(*m_compiler); }
|
||||
bool hasFocus() override { return m_shader_editor.isFocused(); }
|
||||
bool isOpened() const { return m_shader_editor.m_is_opened; }
|
||||
bool isOpened() const { return m_shader_editor.m_is_open; }
|
||||
|
||||
StudioApp& m_app;
|
||||
ShaderCompiler* m_compiler;
|
||||
|
|
|
@ -150,7 +150,7 @@ void SceneView::update(float)
|
|||
PROFILE_FUNCTION();
|
||||
|
||||
if (ImGui::IsAnyItemActive()) return;
|
||||
if (!m_is_opened) return;
|
||||
if (!m_is_open) return;
|
||||
if (ImGui::GetIO().KeyCtrl) return;
|
||||
|
||||
int screen_x = int(ImGui::GetIO().MousePos.x);
|
||||
|
@ -356,7 +356,7 @@ void SceneView::onToolbar()
|
|||
void SceneView::onWindowGUI()
|
||||
{
|
||||
PROFILE_FUNCTION();
|
||||
m_is_opened = false;
|
||||
m_is_open = false;
|
||||
ImVec2 view_pos;
|
||||
const char* title = "Scene View###Scene View";
|
||||
if (m_log_ui && m_log_ui->getUnreadErrorCount() > 0)
|
||||
|
@ -368,7 +368,7 @@ void SceneView::onWindowGUI()
|
|||
|
||||
if (ImGui::BeginDock(title, nullptr, ImGuiWindowFlags_NoScrollWithMouse))
|
||||
{
|
||||
m_is_opened = true;
|
||||
m_is_open = true;
|
||||
onToolbar();
|
||||
auto size = ImGui::GetContentRegionAvail();
|
||||
auto* fb = m_pipeline->getFramebuffer("default");
|
||||
|
@ -445,7 +445,7 @@ void SceneView::onWindowGUI()
|
|||
|
||||
ImGui::EndDock();
|
||||
|
||||
if(m_show_stats && m_is_opened)
|
||||
if(m_show_stats && m_is_open)
|
||||
{
|
||||
float toolbar_height = 24 + ImGui::GetStyle().FramePadding.y * 2;
|
||||
view_pos.x += ImGui::GetStyle().FramePadding.x;
|
||||
|
|
|
@ -59,7 +59,7 @@ class SceneView : public StudioApp::IPlugin
|
|||
Action* m_move_down_action;
|
||||
Action* m_camera_speed_action;
|
||||
bool m_is_mouse_hovering_window;
|
||||
bool m_is_opened;
|
||||
bool m_is_open;
|
||||
int m_screen_x;
|
||||
int m_screen_y;
|
||||
int m_width;
|
||||
|
|
|
@ -1443,7 +1443,7 @@ ShaderEditor::ShaderEditor(IAllocator& allocator)
|
|||
, m_undo_stack_idx(-1)
|
||||
, m_current_node_id(-1)
|
||||
, m_is_focused(false)
|
||||
, m_is_opened(false)
|
||||
, m_is_open(false)
|
||||
, m_current_shader_type(ShaderType::VERTEX)
|
||||
{
|
||||
newGraph();
|
||||
|
@ -2219,7 +2219,7 @@ void ShaderEditor::onGUI(ShaderCompiler& compiler)
|
|||
StaticString<MAX_PATH_LENGTH + 25> title("Shader Editor");
|
||||
if (m_path.isValid()) title << " - " << m_path.c_str();
|
||||
title << "###Shader Editor";
|
||||
if (ImGui::BeginDock(title, &m_is_opened, ImGuiWindowFlags_MenuBar))
|
||||
if (ImGui::BeginDock(title, &m_is_open, ImGuiWindowFlags_MenuBar))
|
||||
{
|
||||
m_is_focused = ImGui::IsWindowOrChildWindowFocused();
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ public:
|
|||
public:
|
||||
static const int MAX_TEXTURES_COUNT = 16;
|
||||
|
||||
bool m_is_opened;
|
||||
bool m_is_open;
|
||||
|
||||
private:
|
||||
void generateMain(const char* path);
|
||||
|
|
Loading…
Reference in a new issue