@@ -46,29 +46,14 @@ namespace Tetragrama::Components
4646
4747 const auto & editor_config = *context->ConfigurationPtr ;
4848
49- auto o_model_fpath = fmt::format (" {0}/{1}" , editor_config.WorkingSpacePath , editor_config.SceneDataPath );
50- auto o_mesh_fpath = fmt::format (" {0}/{1}" , editor_config.WorkingSpacePath , editor_config.SceneDataPath );
51- auto o_texture_fpath = fmt::format (" {0}/{1}" , editor_config.WorkingSpacePath , editor_config.DefaultImportTexturePath );
52- auto o_material_fpath = fmt::format (" {0}/{1}" , editor_config.WorkingSpacePath , editor_config.SceneDataPath );
53-
5449 m_default_import_configuration = {};
55- m_default_import_configuration.OutputModelFilePath .init (&(parent->LayerArena ), o_model_fpath.c_str ());
56- m_default_import_configuration.OutputMeshFilePath .init (&(parent->LayerArena ), o_mesh_fpath.c_str ());
57- m_default_import_configuration.OutputTextureFilesPath .init (&(parent->LayerArena ), o_texture_fpath.c_str ());
58- m_default_import_configuration.OutputMaterialsPath .init (&(parent->LayerArena ), o_material_fpath.c_str ());
59-
60- #ifdef _WIN32
61- std::replace (m_default_import_configuration.OutputModelFilePath .begin (), m_default_import_configuration.OutputModelFilePath .end (), ' /' , ' \\ ' );
62- std::replace (m_default_import_configuration.OutputMeshFilePath .begin (), m_default_import_configuration.OutputMeshFilePath .end (), ' /' , ' \\ ' );
63- std::replace (m_default_import_configuration.OutputTextureFilesPath .begin (), m_default_import_configuration.OutputTextureFilesPath .end (), ' /' , ' \\ ' );
64- std::replace (m_default_import_configuration.OutputMaterialsPath .begin (), m_default_import_configuration.OutputMaterialsPath .end (), ' /' , ' \\ ' );
65- #endif // _WIN32
66-
67- auto editor_serializer_default_output = fmt::format (" {0}/{1}" , editor_config.WorkingSpacePath , editor_config.ScenePath );
50+ m_default_import_configuration.OutputWorkingSpacePath .init (&(parent->LayerArena ), editor_config.WorkingSpacePath .c_str ());
51+ m_default_import_configuration.OutputModelFilePath .init (&(parent->LayerArena ), editor_config.SceneDataPath .c_str ());
52+ m_default_import_configuration.OutputMeshFilePath .init (&(parent->LayerArena ), editor_config.SceneDataPath .c_str ());
53+ m_default_import_configuration.OutputMaterialsPath .init (&(parent->LayerArena ), editor_config.SceneDataPath .c_str ());
54+ m_default_import_configuration.OutputTextureFilesPath .init (&(parent->LayerArena ), editor_config.DefaultImportTexturePath .c_str ());
6855
69- #ifdef _WIN32
70- std::replace (editor_serializer_default_output.begin (), editor_serializer_default_output.end (), ' /' , ' \\ ' );
71- #endif // _WIN32
56+ auto editor_serializer_default_output = fmt::format (" {0}{1}{2}" , editor_config.WorkingSpacePath .c_str (), PLATFORM_OS_BACKSLASH, editor_config.ScenePath .c_str ());
7257
7358 m_editor_serializer->SetDefaultOutput (editor_serializer_default_output);
7459 m_editor_serializer->SetOnProgressCallback (OnEditorSceneSerializerProgress);
@@ -424,23 +409,7 @@ namespace Tetragrama::Components
424409 /*
425410 * Removing the WorkingSpace Path
426411 */
427- // auto ws = context_ptr->ConfigurationPtr->WorkingSpacePath + "\\";
428- // if (data.SerializedMeshesPath.find(ws) != std::string::npos)
429- // {
430- // data.SerializedMeshesPath.replace(data.SerializedMeshesPath.find(ws), ws.size(), "");
431- // }
432-
433- // if (data.SerializedMaterialsPath.find(ws) != std::string::npos)
434- // {
435- // data.SerializedMaterialsPath.replace(data.SerializedMaterialsPath.find(ws), ws.size(), "");
436- // }
437-
438- // if (data.SerializedModelPath.find(ws) != std::string::npos)
439- // {
440- // data.SerializedModelPath.replace(data.SerializedModelPath.find(ws), ws.size(), "");
441- // }
442- //
443- // context_ptr->CurrentScenePtr->Push(data.SerializedMeshesPath, data.SerializedModelPath, data.SerializedMaterialsPath);
412+ context_ptr->CurrentScenePtr ->Push (&(context_ptr->Arena ), data.SerializedMeshesPath .c_str (), data.SerializedModelPath .c_str (), data.SerializedMaterialsPath .c_str ());
444413 }
445414
446415 void DockspaceUIComponent::OnAssetImporterProgress (void * const context, float value)
@@ -530,9 +499,11 @@ namespace Tetragrama::Components
530499 auto ctx = reinterpret_cast <EditorContext*>(context);
531500
532501 // Todo : Ensure no data race on CurrentScenePtr
533- ZEngine::Helpers::secure_strcpy (ctx->ConfigurationPtr ->ActiveSceneName , ZEngine::Helpers::secure_strlen (scene.Name ), scene.Name );
502+ ctx->ConfigurationPtr ->ActiveSceneName .reserve (ZEngine::Helpers::secure_strlen (scene.Name ));
503+ ctx->ConfigurationPtr ->ActiveSceneName .clear ();
504+ ctx->ConfigurationPtr ->ActiveSceneName .append (scene.Name );
534505
535- ctx->CurrentScenePtr ->Name = ctx->ConfigurationPtr ->ActiveSceneName ;
506+ ctx->CurrentScenePtr ->Name = ctx->ConfigurationPtr ->ActiveSceneName . c_str () ;
536507 ctx->CurrentScenePtr ->Data = scene.Data ;
537508 ctx->CurrentScenePtr ->MeshFiles = scene.MeshFiles ;
538509 ctx->CurrentScenePtr ->ModelFiles = scene.ModelFiles ;
@@ -557,9 +528,6 @@ namespace Tetragrama::Components
557528
558529 if (!scene_filename.empty ())
559530 {
560- #ifdef _WIN32
561- std::replace (scene_filename.begin (), scene_filename.end (), ' /' , ' \\ ' ); // Todo : Move this replace into an helper function....
562- #endif
563531 m_editor_serializer->Deserialize (scene_filename);
564532 }
565533 }
0 commit comments