selective parsing of scenes
This commit is contained in:
@@ -2,12 +2,12 @@
|
||||
//!
|
||||
//! This binary handles:
|
||||
//! - Initializing the Unity project
|
||||
//! - Parsing Unity scenes
|
||||
//! - Extracting Interactable_Resource components
|
||||
//! - Parsing Unity scenes with type filtering
|
||||
//! - Extracting Interactable_Resource components only
|
||||
//! - Computing world transforms
|
||||
|
||||
use cursebreaker_parser::InteractableResource;
|
||||
use unity_parser::UnityProject;
|
||||
use unity_parser::{UnityProject, TypeFilter};
|
||||
use std::path::Path;
|
||||
use unity_parser::log::DedupLogger;
|
||||
use log::{info, error, LevelFilter};
|
||||
@@ -29,14 +29,23 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
let project = UnityProject::from_path(project_root)?;
|
||||
|
||||
// Now parse the scene using the pre-built GUID resolvers
|
||||
// Create type filter to only parse GameObject, Transform, and InteractableResource MonoBehaviour
|
||||
info!("🔍 Setting up type filter:");
|
||||
info!(" • Unity types: GameObject, Transform");
|
||||
info!(" • Custom MonoBehaviours: InteractableResource");
|
||||
let type_filter = TypeFilter::new(
|
||||
vec!["GameObject", "Transform", "PrefabInstance"],
|
||||
vec!["InteractableResource"]
|
||||
);
|
||||
|
||||
// Now parse the scene using the pre-built GUID resolvers with filtering
|
||||
let scene_path = "_GameAssets/Scenes/Tiles/10_3.unity";
|
||||
info!("📁 Parsing scene: {}", scene_path);
|
||||
|
||||
log::logger().flush();
|
||||
|
||||
// Parse the scene using the project
|
||||
match project.parse_scene(scene_path) {
|
||||
// Parse the scene using the project with type filtering
|
||||
match project.parse_scene_filtered(scene_path, Some(&type_filter)) {
|
||||
Ok(mut scene) => {
|
||||
info!("✅ Scene parsed successfully!");
|
||||
info!(" Total entities: {}", scene.entity_map.len());
|
||||
|
||||
Reference in New Issue
Block a user