add file watcher using widows api for windows platform, using handles to import and manager assets, some little tweaks
This commit is contained in:
@ -5,6 +5,10 @@ set(CMAKE_BINARY_DIR ${CMAKE_BINARY_DIR}/bin)
|
||||
file(GLOB ASSETS assets)
|
||||
file(COPY ${ASSETS} DESTINATION ${CMAKE_BINARY_DIR})
|
||||
|
||||
# imgui.ini file
|
||||
file(GLOB IMGUI_INI imgui.ini)
|
||||
file(COPY ${IMGUI_INI} DESTINATION ${CMAKE_BINARY_DIR})
|
||||
|
||||
file(GLOB DOTNET_LIBRARY library)
|
||||
file(COPY ${DOTNET_LIBRARY} DESTINATION ${CMAKE_BINARY_DIR})
|
||||
|
||||
|
||||
@ -177,10 +177,13 @@ namespace Prism
|
||||
|
||||
// OpenScene("assets/scenes/FPSDemo.scene");
|
||||
NewScene();
|
||||
|
||||
FileSystemWatcher::StartWatching();
|
||||
}
|
||||
|
||||
void EditorLayer::OnDetach()
|
||||
{
|
||||
FileSystemWatcher::StopWatching();
|
||||
m_EditorScene->OnShutdown();
|
||||
}
|
||||
|
||||
@ -863,18 +866,18 @@ namespace Prism
|
||||
auto payload = ImGui::AcceptDragDropPayload("scene_entity_assetsP");
|
||||
if (payload)
|
||||
{
|
||||
auto data = (DragDropData*)payload->Data;
|
||||
UUID assetId = *(UUID*)payload->Data;
|
||||
Asset& asset = AssetsManager::GetAssetFromId(assetId);
|
||||
|
||||
if (std::string_view(data->Type) == "PrismScene")
|
||||
if (asset.Type == AssetType::Scene)
|
||||
{
|
||||
auto sceneName = data->SourcePath;
|
||||
OpenScene(sceneName);
|
||||
OpenScene(asset.FilePath);
|
||||
}
|
||||
|
||||
if (std::string_view(data->Type) == "Mesh")
|
||||
if (asset.Type == AssetType::Mesh)
|
||||
{
|
||||
auto entity = m_EditorScene->CreateEntity(data->Name);
|
||||
entity.AddComponent<MeshComponent>(Ref<Mesh>::Create(data->SourcePath));
|
||||
Entity entity = m_EditorScene->CreateEntity(asset.FileName);
|
||||
entity.AddComponent<MeshComponent>(AssetsManager::InstantiateAsset<Mesh>(assetId));
|
||||
}
|
||||
}
|
||||
ImGui::EndDragDropTarget();
|
||||
|
||||
Reference in New Issue
Block a user