This commit is contained in:
MegaMech
2025-03-19 21:12:56 -06:00
parent a422822506
commit 80c232a26f
3 changed files with 11 additions and 9 deletions
+9 -3
View File
@@ -15,6 +15,7 @@
#include <defines.h>
#include "CoreMath.h"
#include "World.h"
#include "Crab.h"
namespace Editor {
@@ -39,18 +40,18 @@ namespace Editor {
// Query content in o2r and add them to Content
if (refresh) {
refresh = false;
Content.clear();
FindContent();
return;
}
AddStockContent();
// Display entries in Content
for (const auto& file : Content) {
if (ImGui::Button(file.c_str())) {
int coll;
//printf("ContentBrowser.cpp: name: %s\n", test.c_str());
printf("TEST %s\n", file.c_str());
std::string name = file.substr(file.find_last_of('/') + 1);
printf("NAME %s\n", name.c_str());
auto actor = gWorldInstance.AddStaticMeshActor(name, FVector(50, 100, 0), IRotator(0, 90, 0), FVector(1, 1, 1), "__OTR__" + file, &coll);
// This is required because ptr gets cleaned up.
actor->Model = "__OTR__" + file;
@@ -59,11 +60,16 @@ namespace Editor {
}
}
void ContentBrowserWindow::AddStockContent() {
if (ImGui::Button("Crab")) {
gWorldInstance.AddObject(new OCrab(FVector2D(0, 0), FVector2D(0, 100)));
}
}
void ContentBrowserWindow::FindContent() {
std::list<std::string> myList = {"tracks/*", "actors/*", "objects/*"};
std::list<std::string> myList2 = {""};
Content.clear();
auto ptr = GameEngine::Instance->context->GetResourceManager()->GetArchiveManager()->ListFiles(myList, myList2);
if (ptr) {