forked from 1b-agent/opencadstudio-upstream
refactor(plugin): drop built-in plugins, external-only
OpenCADStudio no longer bundles plugins — every add-on is an external cdylib loaded from the plugins folder or installed via the marketplace. - Remove the demo plugin and the in-tree ocs_example_plugin crate. - Remove the inventory-based built-in registration path (PluginRegistration, all_plugins, installed_manifests); registry now serves core ribbon tabs plus loaded external plugins, and try_dispatch routes only to externals. - Plugin Manager drops the 'compiled into this build' section; the enable/disable toggle moves onto loaded external cards. - Prune the now-dead HostSession/DocumentTab helpers and re-exports. Part of the #100 extensibility epic (phase 2). Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
020a3a4c84
commit
eb53e445ab
22 files changed
+65
-585
No files matched your search
+1
-32
@@ -9,7 +9,7 @@ use crate::ui::{LayerPanel, PropertiesPanel};
|
||||
use acadrust::tables::Ucs;
|
||||
use acadrust::{CadDocument, Handle};
|
||||
use iced;
|
||||
use std::any::{Any, TypeId};
|
||||
use std::any::Any;
|
||||
use std::collections::HashMap;
|
||||
use std::path::PathBuf;
|
||||
|
||||
@@ -216,37 +216,6 @@ impl DocumentTab {
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn plugin_state<T: Any + Send + Sync + 'static>(
|
||||
&self,
|
||||
plugin_id: &'static str,
|
||||
_type_id: TypeId,
|
||||
) -> Option<&T> {
|
||||
self.plugin_state.get(plugin_id)?.downcast_ref::<T>()
|
||||
}
|
||||
|
||||
pub(super) fn plugin_state_mut<T: Any + Send + Sync + 'static>(
|
||||
&mut self,
|
||||
plugin_id: &'static str,
|
||||
_type_id: TypeId,
|
||||
) -> Option<&mut T> {
|
||||
self.plugin_state.get_mut(plugin_id)?.downcast_mut::<T>()
|
||||
}
|
||||
|
||||
pub(super) fn ensure_plugin_state<T: Any + Send + Sync + 'static>(
|
||||
&mut self,
|
||||
plugin_id: &'static str,
|
||||
init: impl FnOnce() -> T,
|
||||
) -> &mut T {
|
||||
if !self.plugin_state.contains_key(plugin_id) {
|
||||
self.plugin_state.insert(plugin_id, Box::new(init()));
|
||||
}
|
||||
self.plugin_state
|
||||
.get_mut(plugin_id)
|
||||
.expect("just inserted")
|
||||
.downcast_mut::<T>()
|
||||
.expect("plugin_id type mismatch")
|
||||
}
|
||||
|
||||
/// Welcome / Start tab. Carries a dummy Scene so the rest of the app
|
||||
/// can read tab state uniformly; the viewport renderer detects
|
||||
/// `is_start` and shows a welcome page instead.
|
||||
|
||||
Reference in new issue
Block a user