project load first
This commit is contained in:
@@ -9,12 +9,12 @@
|
||||
mod types;
|
||||
|
||||
use types::InteractableResource;
|
||||
use unity_parser::UnityFile;
|
||||
use unity_parser::UnityProject;
|
||||
use std::fs::File;
|
||||
use std::io::Write;
|
||||
use std::path::Path;
|
||||
use unity_parser::log::DedupLogger;
|
||||
use log::{info, warn, error, LevelFilter};
|
||||
use log::{info, warn, error, LevelFilter};
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
@@ -22,23 +22,23 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
log::set_boxed_logger(Box::new(logger))
|
||||
.map(|()| log::set_max_level(LevelFilter::Trace))
|
||||
.unwrap();
|
||||
log::set_max_level(LevelFilter::Warn);
|
||||
// log::set_max_level(LevelFilter::Warn);
|
||||
|
||||
info!("🎮 Cursebreaker - Resource Parser");
|
||||
|
||||
let scene_path = Path::new("/home/connor/repos/CBAssets/_GameAssets/Scenes/Tiles/10_3.unity");
|
||||
// Initialize Unity project once - scans entire project for GUID mappings
|
||||
let project_root = Path::new("/home/connor/repos/CBAssets");
|
||||
info!("📦 Initializing Unity project from: {}", project_root.display());
|
||||
|
||||
// Check if scene exists
|
||||
if !scene_path.exists() {
|
||||
error!("Scene not found at {}", scene_path.display());
|
||||
return Err("Scene file not found".into());
|
||||
}
|
||||
let project = UnityProject::from_path(project_root)?;
|
||||
|
||||
info!("📁 Parsing scene: {}", scene_path.display());
|
||||
// Now parse the scene using the pre-built GUID resolvers
|
||||
let scene_path = "_GameAssets/Scenes/Tiles/10_3.unity";
|
||||
info!("📁 Parsing scene: {}", scene_path);
|
||||
|
||||
// Parse the scene
|
||||
match UnityFile::from_path(&scene_path) {
|
||||
Ok(UnityFile::Scene(scene)) => {
|
||||
// Parse the scene using the project
|
||||
match project.parse_scene(scene_path) {
|
||||
Ok(scene) => {
|
||||
info!("✅ Scene parsed successfully!");
|
||||
info!(" Total entities: {}", scene.entity_map.len());
|
||||
|
||||
@@ -114,10 +114,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
info!("✅ Parsing complete!");
|
||||
}
|
||||
Ok(_) => {
|
||||
error!("File is not a scene");
|
||||
return Err("Not a Unity scene file".into());
|
||||
}
|
||||
Err(e) => {
|
||||
error!("Parse error: {}", e);
|
||||
return Err(Box::new(e));
|
||||
|
||||
Reference in New Issue
Block a user