Fixed editor bugs - Copy/Paste values caused entities to get pasted, filtered asset browser could not expand compilable assets, EditorConfig workingscene does not get saved sometimes #375

Merged
srishamharan merged 4 commits from SP3-4-Editor into main 2023-02-28 16:22:17 +08:00
1 changed files with 33 additions and 0 deletions
Showing only changes of commit ef268bc9e5 - Show all commits

View File

@ -29,6 +29,8 @@
#include "Serialization/Prefab/SHPrefabManager.h"
#include "../SHEditorWindowManager.h"
#include "../AssetBrowser/SHAssetBrowser.h"
#include "Assets/SHAssetManager.h"
#include "Assets/Asset Types/SHPrefabAsset.h"
namespace SHADE
@ -136,6 +138,23 @@ namespace SHADE
draggingEntities.clear();
ImGui::ClearDragDrop();
}
//else if(SHDragDrop::currentDragDropTag == SHDragDrop::DRAG_RESOURCE)
//{
// if (const AssetID* assetPayload = SHDragDrop::AcceptPayload<AssetID>(SHDragDrop::DRAG_RESOURCE)) //If payload is valid
// {
// auto assetId = *assetPayload;
// auto createdEntitiesList = SHSerialization::DeserializeEntitiesFromString(SHAssetManager::GetData<SHPrefabAsset>(assetId)->data);
// if (!createdEntitiesList.empty())
// {
// std::vector<EntityID> eidList;
// std::ranges::transform(createdEntitiesList, std::back_inserter(eidList), [](std::pair<EntityID, EntityID> pair) {return pair.second; });
// ParentSelectedEntities(eid, eidList);
// SetScrollTo(createdEntitiesList.begin()->second);
// SHPrefabManager::AddEntity(assetId, createdEntitiesList.begin()->second);
// skipFrame = true;
// }
// }
//}
}
}
ImGui::End();
@ -359,6 +378,20 @@ namespace SHADE
draggingEntities.clear();
//ImGui::ClearDragDrop();
}
if (const AssetID* assetPayload = SHDragDrop::AcceptPayload<AssetID>(SHDragDrop::DRAG_RESOURCE)) //If payload is valid
{
auto assetId = *assetPayload;
auto createdEntitiesList = SHSerialization::DeserializeEntitiesFromString(SHAssetManager::GetData<SHPrefabAsset>(assetId)->data);
if(!createdEntitiesList.empty())
{
std::vector<EntityID> eidList;
std::ranges::transform(createdEntitiesList, std::back_inserter(eidList), [](std::pair<EntityID, EntityID> pair){return pair.second;} );
ParentSelectedEntities(eid, eidList);
SetScrollTo(createdEntitiesList.begin()->second);
SHPrefabManager::AddEntity(assetId, createdEntitiesList.begin()->second);
skipFrame = true;
}
}
SHDragDrop::EndTarget();
}