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:
Hakan SevenandClaude Opus 4.8 committed 2026-06-17 15:50:52 +03:00
1 parent 020a3a4c84
commit eb53e445ab
22 files changed
+65 -585

No files matched your search

+1 -32
View File
@@ -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.
+1 -35
View File
@@ -1,6 +1,6 @@
// HostSession — plugin-facing API implemented inside `app` (private field access).
use std::any::{Any, TypeId};
use std::any::Any;
use acadrust::tables::AppId;
use acadrust::xdata::ExtendedDataRecord;
@@ -8,7 +8,6 @@ use acadrust::{CadDocument, EntityType, Handle};
use ocs_plugin_api::host::HostApi;
use super::OpenCADStudio;
use crate::command::CadCommand;
/// Session adapter: one active document tab, command line, undo.
pub(crate) struct HostSession<'a> {
@@ -33,14 +32,6 @@ impl<'a> HostSession<'a> {
&mut self.app.tabs[self.tab].scene.document
}
pub fn entities(&self) -> impl Iterator<Item = &EntityType> {
self.document().entities()
}
pub fn entities_mut(&mut self) -> impl Iterator<Item = &mut EntityType> {
self.document_mut().entities_mut()
}
pub fn add_entity(&mut self, entity: EntityType) -> Handle {
self.app.tabs[self.tab].scene.add_entity(entity)
}
@@ -141,31 +132,6 @@ impl<'a> HostSession<'a> {
self.app.command_line.push_error(msg);
}
pub fn set_active_command(&mut self, cmd: Box<dyn CadCommand>) {
self.app.tabs[self.tab].active_cmd = Some(cmd);
}
pub fn plugin_state<T: Any + Send + Sync + 'static>(
&self,
plugin_id: &'static str,
) -> Option<&T> {
self.app.tabs[self.tab].plugin_state(plugin_id, TypeId::of::<T>())
}
pub fn plugin_state_mut<T: Any + Send + Sync + 'static>(
&mut self,
plugin_id: &'static str,
) -> Option<&mut T> {
self.app.tabs[self.tab].plugin_state_mut(plugin_id, TypeId::of::<T>())
}
pub fn ensure_plugin_state<T: Any + Send + Sync + 'static>(
&mut self,
plugin_id: &'static str,
init: impl FnOnce() -> T,
) -> &mut T {
self.app.tabs[self.tab].ensure_plugin_state(plugin_id, init)
}
}
/// The stable contract a plugin's `dispatch` sees. Each method forwards to the
-1
View File
@@ -1122,7 +1122,6 @@ impl OpenCADStudio {
}
super::ModalKind::PluginManager => sized(
crate::ui::plugin_manager::view_window(
&crate::plugin::installed_manifests(),
&self.disabled_plugins,
&self.external_plugins,
&self.loaded_plugin_ids,