forked from 1b-agent/opencadstudio-upstream
feat: node graph overlay; move to opencadcodec/opencadkernel/opencadgraph
The codec and kernel repositories and crates are renamed opencadcodec and opencadkernel. Inside OCS they are depended on under short keys, so code reads `codec::`, `kernel::` and the new `graph::` (opencadgraph, the node graph engine). File-format and protocol spellings stay as they were: the ACIS product id `acadrust`, the ACADRUST_* switches and the plugin version keys `acadrust_version` / `acadrust_source`. A button left of MCP on the command line opens a translucent node graph over the viewport, with a palette of object, input, math, logic, list, text and geometry nodes added by click or drag. An object node owns drawing entities and its rows are the Properties panel's own rows for them: the single-object page is extracted from refresh_properties as entity_property_sections, values use the control protocol's property_json, and writes go through set_property_value with a property target override, so the panel, MCP and the graph share one read/write path. A list reaching an object row makes one entity per element. Each graph action is one undo step; the canvas pans and zooms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
56c04408d6
commit
f537aff75c
430 files changed
+9925
-8540
No files matched your search
+21
-18
@@ -7,7 +7,7 @@ use super::{
|
||||
OpenCADStudio,
|
||||
};
|
||||
use crate::scene::ObjectIsolationState;
|
||||
use acadrust::{EntityType, Handle};
|
||||
use codec::{EntityType, Handle};
|
||||
use rustc_hash::{FxHashMap, FxHashSet as HashSet};
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -73,7 +73,7 @@ pub(super) struct PendingDelta {
|
||||
current_layout: String,
|
||||
selected_before: Vec<Handle>,
|
||||
dirty_before: bool,
|
||||
structure_before: Option<acadrust::CadDocument>,
|
||||
structure_before: Option<codec::CadDocument>,
|
||||
}
|
||||
|
||||
pub(super) struct PendingLayerDelta {
|
||||
@@ -81,7 +81,7 @@ pub(super) struct PendingLayerDelta {
|
||||
current_layout: String,
|
||||
selected_before: Vec<Handle>,
|
||||
dirty_before: bool,
|
||||
before: Vec<(String, Option<acadrust::tables::Layer>)>,
|
||||
before: Vec<(String, Option<codec::tables::Layer>)>,
|
||||
}
|
||||
|
||||
pub(super) struct PendingTextStyleDelta {
|
||||
@@ -89,7 +89,7 @@ pub(super) struct PendingTextStyleDelta {
|
||||
current_layout: String,
|
||||
selected_before: Vec<Handle>,
|
||||
dirty_before: bool,
|
||||
before: Vec<(String, Option<acadrust::tables::TextStyle>)>,
|
||||
before: Vec<(String, Option<codec::tables::TextStyle>)>,
|
||||
}
|
||||
|
||||
pub(super) struct PendingDimStyleDelta {
|
||||
@@ -97,7 +97,7 @@ pub(super) struct PendingDimStyleDelta {
|
||||
current_layout: String,
|
||||
selected_before: Vec<Handle>,
|
||||
dirty_before: bool,
|
||||
before: Vec<(String, Option<acadrust::tables::DimStyle>)>,
|
||||
before: Vec<(String, Option<codec::tables::DimStyle>)>,
|
||||
}
|
||||
|
||||
pub(super) struct PendingObjectDelta {
|
||||
@@ -105,7 +105,7 @@ pub(super) struct PendingObjectDelta {
|
||||
current_layout: String,
|
||||
selected_before: Vec<Handle>,
|
||||
dirty_before: bool,
|
||||
before: FxHashMap<Handle, acadrust::objects::ObjectType>,
|
||||
before: FxHashMap<Handle, codec::objects::ObjectType>,
|
||||
}
|
||||
|
||||
impl OpenCADStudio {
|
||||
@@ -189,7 +189,7 @@ impl OpenCADStudio {
|
||||
i: usize,
|
||||
label: impl Into<String>,
|
||||
before: Vec<(Handle, Arc<EntityType>)>,
|
||||
object_before: Vec<(Handle, acadrust::objects::ObjectType)>,
|
||||
object_before: Vec<(Handle, codec::objects::ObjectType)>,
|
||||
dirty_before: bool,
|
||||
) {
|
||||
self.finish_pending_history(i);
|
||||
@@ -292,7 +292,7 @@ impl OpenCADStudio {
|
||||
.then_some(*handle)
|
||||
})
|
||||
.collect();
|
||||
acadrust::CadDocument::align_added_entity_structure(
|
||||
codec::CadDocument::align_added_entity_structure(
|
||||
&mut pending.structure_before,
|
||||
&structure_after,
|
||||
&added_handles,
|
||||
@@ -347,6 +347,9 @@ impl OpenCADStudio {
|
||||
}
|
||||
|
||||
pub(super) fn push_undo_snapshot(&mut self, i: usize, label: impl Into<String>) {
|
||||
if self.graph_undo_open {
|
||||
return;
|
||||
}
|
||||
self.finish_pending_history(i);
|
||||
let label = label.into();
|
||||
let current_layout = self.tabs[i].scene.current_layout.clone();
|
||||
@@ -563,8 +566,8 @@ impl OpenCADStudio {
|
||||
self.push_undo_entry(i, HistorySnapshot::Delta(Box::new(delta)));
|
||||
}
|
||||
|
||||
fn group_object_state(&self, i: usize) -> FxHashMap<Handle, acadrust::objects::ObjectType> {
|
||||
use acadrust::objects::ObjectType;
|
||||
fn group_object_state(&self, i: usize) -> FxHashMap<Handle, codec::objects::ObjectType> {
|
||||
use codec::objects::ObjectType;
|
||||
let document = &self.tabs[i].scene.document;
|
||||
let dictionary = document.header.acad_group_dict_handle;
|
||||
document
|
||||
@@ -686,8 +689,8 @@ impl OpenCADStudio {
|
||||
entity,
|
||||
EntityType::Block(_)
|
||||
| EntityType::BlockEnd(_)
|
||||
| EntityType::Extended(acadrust::entities::ExtendedEntity {
|
||||
data: acadrust::entities::ExtendedEntityData::SectionObject(_),
|
||||
| EntityType::Extended(codec::entities::ExtendedEntity {
|
||||
data: codec::entities::ExtendedEntityData::SectionObject(_),
|
||||
..
|
||||
})
|
||||
) {
|
||||
@@ -797,7 +800,7 @@ impl OpenCADStudio {
|
||||
(before.is_none() && after.is_some()).then_some(*handle)
|
||||
})
|
||||
.collect();
|
||||
acadrust::CadDocument::align_added_entity_structure(
|
||||
codec::CadDocument::align_added_entity_structure(
|
||||
before_structure,
|
||||
&after_structure,
|
||||
&added_handles,
|
||||
@@ -847,7 +850,7 @@ impl OpenCADStudio {
|
||||
let inverse = self.tabs[i]
|
||||
.scene
|
||||
.document
|
||||
.swap_structure(std::mem::replace(stored, acadrust::CadDocument::new()));
|
||||
.swap_structure(std::mem::replace(stored, codec::CadDocument::new()));
|
||||
*stored = inverse;
|
||||
self.tabs[i].scene.invalidate_dependency_index();
|
||||
self.tabs[i].scene.bump_layout_epoch();
|
||||
@@ -926,17 +929,17 @@ impl OpenCADStudio {
|
||||
// re-inserts it — so both sides must be inspected.
|
||||
layout_touched |= matches!(
|
||||
entry.before,
|
||||
Some(acadrust::objects::ObjectType::Layout(_))
|
||||
Some(codec::objects::ObjectType::Layout(_))
|
||||
) || matches!(
|
||||
entry.after,
|
||||
Some(acadrust::objects::ObjectType::Layout(_))
|
||||
Some(codec::objects::ObjectType::Layout(_))
|
||||
);
|
||||
scale_touched |= matches!(
|
||||
entry.before,
|
||||
Some(acadrust::objects::ObjectType::Scale(_))
|
||||
Some(codec::objects::ObjectType::Scale(_))
|
||||
) || matches!(
|
||||
entry.after,
|
||||
Some(acadrust::objects::ObjectType::Scale(_))
|
||||
Some(codec::objects::ObjectType::Scale(_))
|
||||
);
|
||||
if let Some(object) = value {
|
||||
self.tabs[i]
|
||||
|
||||
Reference in new issue
Block a user