Minor Update - V9.1.0

[FEAT] :

+ Import Assets in project copy file in project
This commit is contained in:
CatChow0 2025-03-19 10:55:10 +01:00
parent eea7b4c067
commit 3930c5eff7
7 changed files with 108 additions and 68 deletions

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RiderProjectSettingsUpdater">
<option name="singleClickDiffPreview" value="1" />
<option name="vcsConfiguration" value="3" />
<option name="vcsConfiguration" value="2" />
</component>
</project>

View File

@ -5,13 +5,13 @@
</component>
<component name="ChangeListManager">
<list default="true" id="e81d6e08-efc7-40a0-909d-ec4943d948e9" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/.idea/.idea.KhaoticEngineReborn/.idea/projectSettingsUpdater.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.KhaoticEngineReborn/.idea/projectSettingsUpdater.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/assets/scene.ker" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/assets/scene.ker" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/applicationclass.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/applicationclass.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/object.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/object.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/Systemclass.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/Systemclass.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/applicationclass.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/applicationclass.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/imguiManager.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/imguiManager.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/object.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/object.cpp" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -44,30 +44,38 @@
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;ASKED_SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
&quot;C++ Project.enginecustom.executor&quot;: &quot;Run&quot;,
&quot;C/C++ Project.enginecustom.executor&quot;: &quot;Run&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.git.unshallow&quot;: &quot;true&quot;,
&quot;SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
&quot;git-widget-placeholder&quot;: &quot;main&quot;,
&quot;ignore.virus.scanning.warn.message&quot;: &quot;true&quot;,
&quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
&quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
&quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;preferences.pluginManager&quot;,
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
<component name="PropertiesComponent"><![CDATA[{
"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"
},
"keyToStringList": {
"rider.external.source.directories": [
"C:\\Users\\arivas\\AppData\\Roaming\\JetBrains\\Rider2024.1\\resharper-host\\DecompilerCache",
"C:\\Users\\arivas\\AppData\\Roaming\\JetBrains\\Rider2024.1\\resharper-host\\SourcesCache",
"C:\\Users\\arivas\\AppData\\Local\\Symbols\\src"
]
}
}</component>
<component name="RunManager" selected="C/C++ Project.enginecustom">
}]]></component>
<component name="RunManager" selected="C++ Project.enginecustom">
<configuration name="KhaoticDemo" type="CppProject" factoryName="C++ Project">
<configuration_1 setup="1">
<configuration_1>
<option name="CONFIGURATION" value="Debug" />
<option name="PLATFORM" value="x64" />
<option name="PROJECT_FILE_PATH" value="$PROJECT_DIR$/KhaoticDemo/KhaoticDemo.vcxproj" />
<option name="CURRENT_LAUNCH_PROFILE" value="Local" />
<option name="EXE_PATH" value="$(LocalDebuggerCommand)" />
<option name="PROGRAM_PARAMETERS" value="$(LocalDebuggerCommandArguments)" />
@ -75,19 +83,18 @@
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="TERMINAL_INTERACTION_BEHAVIOR" value="AUTO_DETECT" />
<option name="PROJECT_FILE_PATH" value="$PROJECT_DIR$/KhaoticDemo/KhaoticDemo.vcxproj" />
</configuration_1>
<option name="DEFAULT_PROJECT_PATH" value="$PROJECT_DIR$/KhaoticDemo/KhaoticDemo.vcxproj" />
<option name="PROJECT_FILE_PATH" value="$PROJECT_DIR$/KhaoticDemo/KhaoticDemo.vcxproj" />
<option name="AUTO_SELECT_PRIORITY" value="0" />
<method v="2">
<option name="Build" />
</method>
</configuration>
<configuration name="enginecustom" type="CppProject" factoryName="C++ Project">
<configuration_1 setup="1">
<configuration_1>
<option name="CONFIGURATION" value="Debug" />
<option name="PLATFORM" value="x64" />
<option name="PROJECT_FILE_PATH" value="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj" />
<option name="CURRENT_LAUNCH_PROFILE" value="Local" />
<option name="EXE_PATH" value="$(LocalDebuggerCommand)" />
<option name="PROGRAM_PARAMETERS" value="$(LocalDebuggerCommandArguments)" />
@ -95,10 +102,20 @@
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="TERMINAL_INTERACTION_BEHAVIOR" value="AUTO_DETECT" />
<option name="PROJECT_FILE_PATH" value="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj" />
</configuration_1>
<configuration_2>
<option name="CONFIGURATION" value="Release" />
<option name="PLATFORM" value="x64" />
<option name="PROJECT_FILE_PATH" value="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj" />
<option name="CURRENT_LAUNCH_PROFILE" value="Local" />
<option name="EXE_PATH" value="$(TargetPath)" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="$(ProjectDir)" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="TERMINAL_INTERACTION_BEHAVIOR" value="AUTO_DETECT" />
</configuration_2>
<option name="DEFAULT_PROJECT_PATH" value="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj" />
<option name="PROJECT_FILE_PATH" value="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj" />
<option name="AUTO_SELECT_PRIORITY" value="0" />
<method v="2">
<option name="Build" />
@ -140,6 +157,7 @@
<workItem from="1742314944369" duration="79000" />
<workItem from="1742318452773" duration="2258000" />
<workItem from="1742331065936" duration="3030000" />
<workItem from="1742371397157" duration="5389000" />
</task>
<task id="LOCAL-00001" summary="Minor update - viewport window tweak">
<option name="closed" value="true" />

View File

@ -1 +0,0 @@
1 isosphere 0 14.4537 0 1 1 1 F:\Github_Repo\khaotic-engine-Reborn\enginecustom\assets\Model\OBJ\isosphere.obj

View File

@ -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<ID3D11ShaderResourceView*> textures;

View File

@ -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);
}
}
}

View File

@ -2275,7 +2275,6 @@ void ApplicationClass::LoadScene()
{
SetScenePath(ConvertWStringToString(scenePath));
}
if (m_scenePath.empty())
{

View File

@ -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);
}
}
}