diff --git a/.idea/.idea.KhaoticEngineReborn/.idea/projectSettingsUpdater.xml b/.idea/.idea.KhaoticEngineReborn/.idea/projectSettingsUpdater.xml
index 64af657..4bb9f4d 100644
--- a/.idea/.idea.KhaoticEngineReborn/.idea/projectSettingsUpdater.xml
+++ b/.idea/.idea.KhaoticEngineReborn/.idea/projectSettingsUpdater.xml
@@ -1,7 +1,6 @@
-
-
+
\ No newline at end of file
diff --git a/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml b/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml
index 472357b..c623bab 100644
--- a/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml
+++ b/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml
@@ -5,13 +5,13 @@
+
+
-
-
@@ -44,30 +44,38 @@
- {
- "keyToString": {
- "ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
- "C++ Project.enginecustom.executor": "Run",
- "C/C++ Project.enginecustom.executor": "Run",
- "RunOnceActivity.ShowReadmeOnStart": "true",
- "RunOnceActivity.git.unshallow": "true",
- "SHARE_PROJECT_CONFIGURATION_FILES": "true",
- "git-widget-placeholder": "main",
- "ignore.virus.scanning.warn.message": "true",
- "node.js.detected.package.eslint": "true",
- "node.js.detected.package.tslint": "true",
- "node.js.selected.package.eslint": "(autodetect)",
- "node.js.selected.package.tslint": "(autodetect)",
- "nodejs_package_manager_path": "npm",
- "settings.editor.selected.configurable": "preferences.pluginManager",
- "vue.rearranger.settings.migration": "true"
+
-
+}]]>
+
-
+
+
@@ -75,19 +83,18 @@
-
-
-
+
+
@@ -95,10 +102,20 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
-
@@ -140,6 +157,7 @@
+
diff --git a/enginecustom/assets/scene.ker b/enginecustom/assets/scene.ker
index c083e14..e69de29 100644
--- a/enginecustom/assets/scene.ker
+++ b/enginecustom/assets/scene.ker
@@ -1 +0,0 @@
-1 isosphere 0 14.4537 0 1 1 1 F:\Github_Repo\khaotic-engine-Reborn\enginecustom\assets\Model\OBJ\isosphere.obj
diff --git a/enginecustom/src/inc/system/applicationclass.h b/enginecustom/src/inc/system/applicationclass.h
index 7f2b5fa..373ecd3 100644
--- a/enginecustom/src/inc/system/applicationclass.h
+++ b/enginecustom/src/inc/system/applicationclass.h
@@ -170,7 +170,6 @@ private:
void ConstructSkybox(); // Construct the skybox
void UpdateSkyboxPosition(); // Update the skybox position
bool RenderSkybox(XMMATRIX view, XMMATRIX projection); // Render the skybox
-
public :
std::vector textures;
diff --git a/enginecustom/src/src/system/Systemclass.cpp b/enginecustom/src/src/system/Systemclass.cpp
index 8fda0f2..b53fa28 100644
--- a/enginecustom/src/src/system/Systemclass.cpp
+++ b/enginecustom/src/src/system/Systemclass.cpp
@@ -153,12 +153,7 @@ void SystemClass::Run()
int result_scene = MessageBox(NULL, L"Do you want to load a saved scene?", L"Load Scene", MB_YESNO | MB_ICONQUESTION);
if (result_scene == IDYES)
{
- std::wstring scenePath = m_Application->GetScenePath();
- if (!scenePath.empty())
- {
- m_Application->SetScenePath(m_Application->ConvertWStringToString(scenePath));
- m_Application->LoadScene();
- }
+ m_Application->LoadScene();
}
else
{
@@ -537,31 +532,4 @@ void SystemClass::SendPath(wchar_t* path, std::filesystem::path WFolder)
{
m_Application->SetPath(path);
m_Application->SetWFolder(WFolder);
-}
-
-void SystemClass::GetScenePath()
-{
- OPENFILENAME ofn;
- wchar_t szFile[260];
-
- ZeroMemory(&ofn, sizeof(ofn));
- ofn.lStructSize = sizeof(ofn);
- ofn.hwndOwner = m_hwnd;
- ofn.lpstrFile = szFile;
- ofn.lpstrFile[0] = '\0';
- ofn.nMaxFile = sizeof(szFile);
- ofn.lpstrFilter = L"Ker Scene\0*.ker\0";
- ofn.nFilterIndex = 1;
- ofn.lpstrFileTitle = NULL;
- ofn.nMaxFileTitle = 0;
- ofn.lpstrInitialDir = NULL;
- ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
-
- if (GetOpenFileName(&ofn) == TRUE)
- {
- std::filesystem::path filepath = ofn.lpstrFile;
- // convert to string
- std::string path = filepath.string();
- m_Application->SetScenePath(path);
- }
-}
+}
\ No newline at end of file
diff --git a/enginecustom/src/src/system/applicationclass.cpp b/enginecustom/src/src/system/applicationclass.cpp
index 01ce2ea..cce8a7c 100644
--- a/enginecustom/src/src/system/applicationclass.cpp
+++ b/enginecustom/src/src/system/applicationclass.cpp
@@ -2275,7 +2275,6 @@ void ApplicationClass::LoadScene()
{
SetScenePath(ConvertWStringToString(scenePath));
}
-
if (m_scenePath.empty())
{
diff --git a/enginecustom/src/src/system/imguiManager.cpp b/enginecustom/src/src/system/imguiManager.cpp
index 5436f19..4333515 100644
--- a/enginecustom/src/src/system/imguiManager.cpp
+++ b/enginecustom/src/src/system/imguiManager.cpp
@@ -171,8 +171,66 @@ void imguiManager::WidgetAddObject(ApplicationClass* app)
if (GetOpenFileName(&ofn))
{
- std::wstring wstr(ofn.lpstrFile);
- app->AddKobject(wstr);
+ std::wstring filepath = ofn.lpstrFile;
+
+ WCHAR exePath[MAX_PATH];
+ GetModuleFileName(NULL,exePath,MAX_PATH);
+ std::wstring exeDir = exePath;
+ size_t pos = exeDir.find_last_of(L"\\/");
+ if(pos != std::wstring::npos)
+ {
+ exeDir = exeDir.substr(0, pos);
+ }
+
+ std::wstring targetDir = exeDir + L"\\Content\\Assets\\Kobject";
+
+
+ DWORD ftyp = GetFileAttributesW(targetDir.c_str());
+ if( ftyp == INVALID_FILE_ATTRIBUTES)
+ {
+ std::wstring contentDir = exeDir + L"\\Content";
+ if (GetFileAttributes(contentDir.c_str()) == INVALID_FILE_ATTRIBUTES)
+ {
+ CreateDirectory(contentDir.c_str(), NULL);
+ }
+ std::wstring assetsDir = contentDir + L"\\Assets";
+ if (GetFileAttributes(assetsDir.c_str()) == INVALID_FILE_ATTRIBUTES)
+ {
+ CreateDirectory(assetsDir.c_str(), NULL);
+ }
+ std::wstring kobjectDir = assetsDir + L"\\Kobject";
+ if (GetFileAttributes(kobjectDir.c_str()) == INVALID_FILE_ATTRIBUTES)
+ {
+ CreateDirectory(kobjectDir.c_str(), NULL);
+ }
+ }
+
+ size_t posFile = filepath.find_last_of(L"\\/");
+ std::wstring filename = (posFile != std::wstring::npos) ? filepath.substr(posFile + 1) : filepath;
+
+ std::wstring targetPath = targetDir + L"\\" + filename;
+
+ if (!CopyFile(filepath.c_str(), targetPath.c_str(), FALSE))
+ {
+ // En cas d'erreur, vous pouvez gérer ici l'erreur (par exemple afficher un message)
+ MessageBox(NULL, L"Erreur lors de la copie du fichier.", L"Erreur", MB_OK);
+ }
+ else
+ {
+ // On récupère le chemin relatif par rapport à exeDir
+ std::wstring relativePath = targetPath.substr(exeDir.size());
+
+ // Suppression du premier caractère s'il s'agit d'un antislash
+ if (!relativePath.empty() && (relativePath[0] == L'\\' || relativePath[0] == L'/'))
+ {
+ relativePath.erase(0, 1);
+ }
+
+ // Remplacer les antislashs par des slashs
+ std::replace(relativePath.begin(), relativePath.end(), L'\\', L'/');
+ app->AddKobject(relativePath);
+ }
+
}
}