Skip to content

Commit

Permalink
Implemented setLogFolder support for the renderer.
Browse files Browse the repository at this point in the history
  • Loading branch information
Frodo45127 committed Feb 15, 2024
1 parent 7f6468c commit b0be20f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
5 changes: 2 additions & 3 deletions rpfm_ui/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ fn main() {

// Model renderer, only on windows.
#[cfg(feature = "support_model_renderer")] {
//let assets_path = "./../assets/"; // Disabled until SetAssetFolder works.
let assets_path = &target_path;
let assets_path = "./../assets/";
DirBuilder::new().recursive(true).create(assets_path).unwrap();

// TODO: unhardcode this path once the folder is moved to a 3rdparty subrepo.
Expand Down Expand Up @@ -86,7 +85,7 @@ fn main() {
copy(renderer_path.to_owned() + "Rldx/Rldx/RenderResources/Textures/CubeMaps/SkyCubemapIBLDiffuse.dds", assets_path.to_owned() + "SkyCubemapIBLDiffuse.dds").unwrap();
copy(renderer_path.to_owned() + "Rldx/Rldx/RenderResources/Textures/CubeMaps/SkyCubemapIBLSpecular.dds", assets_path.to_owned() + "SkyCubemapIBLSpecular.dds").unwrap();

copy(renderer_path.to_owned() + "QtRenderingWidget/myfile.spritefont", target_path.to_owned() + "myfile.spritefont").unwrap();
copy(renderer_path.to_owned() + "QtRenderingWidget/myfile.spritefont", assets_path.to_owned() + "myfile.spritefont").unwrap();
}
Err(error) => {
stdout().write_all(error.to_string().as_bytes()).unwrap();
Expand Down
8 changes: 8 additions & 0 deletions rpfm_ui/src/ffi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,14 @@ pub unsafe fn set_asset_folder(folder: &str) {
SetAssetFolder(folder.as_mut_raw_ptr())
}

#[cfg(feature = "support_model_renderer")]
extern "C" { fn SetLogFolder(folder: *mut QString); }
#[cfg(feature = "support_model_renderer")]
pub unsafe fn set_log_folder(folder: &str) {
let folder = QString::from_std_str(folder);
SetLogFolder(folder.as_mut_raw_ptr())
}

#[cfg(feature = "support_model_renderer")]
extern "C" { fn PauseRendering(pQRendeeWiget: *mut QWidget); }
#[cfg(feature = "support_model_renderer")]
Expand Down
8 changes: 6 additions & 2 deletions rpfm_ui/src/settings_ui/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ pub unsafe fn init_settings(main_window: &QPtr<QMainWindow>) {
#[must_use = "Many things depend on this folder existing. So better check this worked."]
pub fn init_config_path() -> Result<()> {

DirBuilder::new().recursive(true).create(config_path()?)?;
let config_path = config_path()?;
DirBuilder::new().recursive(true).create(&config_path)?;
DirBuilder::new().recursive(true).create(backup_autosave_path()?)?;
DirBuilder::new().recursive(true).create(error_path()?)?;
DirBuilder::new().recursive(true).create(schemas_path()?)?;
Expand All @@ -209,7 +210,10 @@ pub fn init_config_path() -> Result<()> {
DirBuilder::new().recursive(true).create(&assets_path)?;
}

//unsafe {crate::ffi::set_asset_folder(&assets_path); }
unsafe {crate::ffi::set_asset_folder(&assets_path); }

let log_path = config_path.to_string_lossy();
unsafe {crate::ffi::set_log_folder(&log_path); }
}

Ok(())
Expand Down

0 comments on commit b0be20f

Please sign in to comment.