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 <noreply@anthropic.com>
This commit is contained in:
1 parent
020a3a4c84
commit
eb53e445ab
22 files changed
+65
-585
No files matched your search
+1
-35
@@ -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
|
||||
|
||||
Reference in new issue
Block a user