Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 56 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ members = [
"crates/bevy_map_runtime",
"crates/bevy_map_schema",
"crates/bevy_map_codegen",
"crates/bevy_map_integration",
"crates/bevy_map_editor",
"examples",
]
Expand All @@ -34,11 +35,13 @@ bevy_map_derive = { version = "0.5.0", path = "crates/bevy_map_derive" }
bevy_map_runtime = { version = "0.5.0", path = "crates/bevy_map_runtime" }
bevy_map_schema = { version = "0.5.0", path = "crates/bevy_map_schema" }
bevy_map_codegen = { version = "0.5.0", path = "crates/bevy_map_codegen" }
bevy_map_integration = { version = "0.5.0", path = "crates/bevy_map_integration" }
bevy_map_editor = { version = "0.5.0", path = "crates/bevy_map_editor" }

# Serialization
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
toml = "0.8"

# Core utilities
uuid = { version = "1.0", features = ["v4", "serde"] }
Expand Down
4 changes: 4 additions & 0 deletions crates/bevy_map/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,17 @@ bevy_map_schema = { workspace = true }
# Optional runtime (enabled by default)
bevy_map_runtime = { workspace = true, optional = true }

# Optional integration system
bevy_map_integration = { workspace = true, optional = true }

bevy = { workspace = true }

[features]
default = ["runtime", "hot-reload"]
runtime = ["dep:bevy_map_runtime"]
physics = ["runtime", "bevy_map_runtime/physics"]
hot-reload = ["runtime", "bevy_map_runtime/hot-reload"]
integration = ["dep:bevy_map_integration"]

[lints]
workspace = true
23 changes: 23 additions & 0 deletions crates/bevy_map/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,25 @@ pub use bevy_map_runtime::{
TilesetTextures,
};

// =============================================================================
// Integration module - plugin system (optional)
// =============================================================================

/// Plugin integration system for TOML-based and Rust companion plugins.
///
/// Requires the `integration` feature.
#[cfg(feature = "integration")]
pub mod integration {
pub use bevy_map_integration::*;
}

#[cfg(feature = "integration")]
pub use bevy_map_integration::{
manager::PluginManager,
plugin_meta::{PluginMeta, PropertyDef, PropertyType},
registry::IntegrationRegistry,
};

// =============================================================================
// Prelude - import everything commonly needed
// =============================================================================
Expand Down Expand Up @@ -208,4 +227,8 @@ pub mod prelude {
spawn_map_project, EntityRegistry, MapEntityExt, MapHandle, MapRoot, MapRuntimePlugin,
SpawnMapEvent, SpawnMapProjectEvent, TilesetTextures,
};

// Integration (if enabled)
#[cfg(feature = "integration")]
pub use crate::{IntegrationRegistry, PluginManager, PluginMeta};
}
5 changes: 4 additions & 1 deletion crates/bevy_map_editor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ bevy_map_animation = { workspace = true }
bevy_map_dialogue = { workspace = true }
bevy_map_codegen = { workspace = true }
bevy_map_runtime = { workspace = true, optional = true }
bevy_map_integration = { workspace = true, features = ["editor"] }
toml = { workspace = true }
bevy = { workspace = true }
bevy_ecs_tilemap = { workspace = true }
bevy_egui = { workspace = true }
Expand All @@ -37,9 +39,10 @@ egui-async = "0.3"
rfd = { workspace = true, optional = true }

[features]
default = ["native"]
default = ["native", "integrations"]
native = ["rfd"]
runtime = ["bevy_map_runtime"]
integrations = []
wasm = []

[lints]
Expand Down
20 changes: 20 additions & 0 deletions crates/bevy_map_editor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,26 @@ impl Plugin for EditorPlugin {
.add_systems(Startup, setup_editor_camera)
.add_systems(Update, handle_keyboard_shortcuts)
.add_systems(Update, handle_recent_projects);

// Plugin integration system
#[cfg(feature = "integrations")]
{
use bevy_map_integration::prelude::*;

let mut manager = PluginManager::from_default_config().unwrap_or_default();
if let Err(e) = manager.sync_plugins() {
bevy::log::warn!("Plugin sync failed: {e}");
}
if let Err(e) = manager.load_metadata() {
bevy::log::warn!("Plugin metadata load failed: {e}");
}

let mut registry = IntegrationRegistry::default();
for (_name, meta) in manager.plugins() {
registry.register_plugin(meta.clone());
}
app.insert_resource(registry);
}
}
}

Expand Down
33 changes: 26 additions & 7 deletions crates/bevy_map_editor/src/ui/asset_browser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ pub struct FileFilter {
pub show_folders: bool,
pub search_text: String,
pub custom_extensions: String,
/// File extensions contributed by integration plugins (populated from IntegrationRegistry)
pub integration_extensions: Vec<String>,
/// Whether to show files matching integration plugin extensions
pub show_integration: bool,
}

impl Default for FileFilter {
Expand All @@ -23,6 +27,8 @@ impl Default for FileFilter {
show_folders: true,
search_text: String::new(),
custom_extensions: String::new(),
integration_extensions: Vec::new(),
show_integration: true,
}
}
}
Expand Down Expand Up @@ -264,16 +270,26 @@ impl AssetBrowserState {
false
};

// Check integration plugin extensions
let integration_match = self.filter.show_integration
&& !self.filter.integration_extensions.is_empty()
&& entry.extension.as_ref().map_or(false, |ext| {
self.filter
.integration_extensions
.iter()
.any(|ie| ie.eq_ignore_ascii_case(ext))
});

// Check search text (use cached lowercase name)
let search_match = search_lower.is_empty() || entry.name_lower.contains(&search_lower);

(type_match
|| custom_match
|| custom_exts.is_empty()
&& !self.filter.show_images
&& !self.filter.show_audio
&& !self.filter.show_json)
&& search_match
let has_any_filter = self.filter.show_images
|| self.filter.show_audio
|| self.filter.show_json
|| !custom_exts.is_empty()
|| (self.filter.show_integration && !self.filter.integration_extensions.is_empty());

(type_match || custom_match || integration_match || !has_any_filter) && search_match
});

// Sort - directories first, then by sort order
Expand Down Expand Up @@ -372,6 +388,9 @@ pub fn render_asset_browser(
ui.checkbox(&mut state.filter.show_json, "JSON");
ui.checkbox(&mut state.filter.show_audio, "Audio");
ui.checkbox(&mut state.filter.show_folders, "Folders");
if !state.filter.integration_extensions.is_empty() {
ui.checkbox(&mut state.filter.show_integration, "Plugins");
}

ui.separator();

Expand Down
Loading