LumixEngine/src/sample_app/asset_browser.h

69 lines
1.4 KiB
C
Raw Normal View History

2015-09-14 18:03:45 +02:00
#pragma once
#include "core/array.h"
#include "core/path.h"
2015-09-20 20:50:32 +02:00
#include <bgfx.h>
2015-09-14 18:03:45 +02:00
namespace Lumix
{
class Material;
class Resource;
class WorldEditor;
}
2015-09-20 17:30:37 +02:00
class FileSystemWatcher;
2015-09-14 18:03:45 +02:00
class AssetBrowser
{
public:
enum Type
{
MATERIAL,
MODEL,
SHADER,
TEXTURE,
UNIVERSE,
2015-09-20 17:30:37 +02:00
LUA_SCRIPT,
2015-09-14 18:03:45 +02:00
Count
};
public:
AssetBrowser(Lumix::WorldEditor& editor);
2015-09-20 17:30:37 +02:00
~AssetBrowser();
2015-09-14 18:03:45 +02:00
void onGui();
void update();
2015-09-14 18:03:45 +02:00
const Lumix::Array<Lumix::Path>& getResources(Type type) const;
2015-09-21 11:43:31 +02:00
Type getTypeFromResourceManagerType(uint32_t type) const;
2015-09-14 18:03:45 +02:00
2015-09-19 01:18:52 +02:00
public:
bool m_is_opened;
2015-09-14 18:03:45 +02:00
private:
2015-09-20 17:30:37 +02:00
void onFileChanged(const char* path);
2015-09-14 18:03:45 +02:00
void findResources();
void processDir(const char* path);
void addResource(const char* path, const char* filename);
void onGuiResource();
void onGuiMaterial();
void onGuiModel();
void onGuiTexture();
2015-09-20 17:30:37 +02:00
void onGuiLuaScript();
2015-09-14 18:03:45 +02:00
void saveMaterial(Lumix::Material* material);
bool resourceInput(const char* label, char* buf, int max_size, Type type);
void unloadResource();
void selectResource(const Lumix::Path& resource);
void selectResource(Lumix::Resource* resource);
2015-09-14 18:03:45 +02:00
private:
Lumix::Array<Lumix::Path> m_changed_files;
2015-09-14 18:03:45 +02:00
Lumix::Array<Lumix::Array<Lumix::Path> > m_resources;
Lumix::Resource* m_selected_resource;
2015-09-14 18:03:45 +02:00
Lumix::WorldEditor& m_editor;
2015-09-20 17:30:37 +02:00
FileSystemWatcher* m_watcher;
char m_text_buffer[8192];
bool m_autoreload_changed_resource;
2015-09-20 20:50:32 +02:00
bgfx::TextureHandle m_texture_handle;
2015-09-14 18:03:45 +02:00
};