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 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 5.5 committed 2026-09-25 07:34:23 +03:00
1 parent 56c04408d6
commit f537aff75c
430 files changed
+9925 -8540

No files matched your search

+30 -30
View File
@@ -1,6 +1,6 @@
use super::*;
fn selected_edge_body(app: &OpenCADStudio, tab: usize) -> Option<acadrust::Handle> {
fn selected_edge_body(app: &OpenCADStudio, tab: usize) -> Option<codec::Handle> {
let scene = &app.tabs.get(tab)?.scene;
let selected = scene.selected_handles_in_order();
let [handle] = selected.as_slice() else {
@@ -9,7 +9,7 @@ fn selected_edge_body(app: &OpenCADStudio, tab: usize) -> Option<acadrust::Handl
if matches!(
scene.document.get_entity(*handle),
Some(acadrust::EntityType::Solid3D(_) | acadrust::EntityType::Surface(_))
Some(codec::EntityType::Solid3D(_) | codec::EntityType::Surface(_))
) {
Some(*handle)
} else {
@@ -20,7 +20,7 @@ fn selected_edge_body(app: &OpenCADStudio, tab: usize) -> Option<acadrust::Handl
fn solid_edge_sources(
app: &mut OpenCADStudio,
tab: usize,
) -> Vec<(acadrust::Handle, cadkernel::brep::Body)> {
) -> Vec<(codec::Handle, kernel::brep::Body)> {
let handles = app.tabs[tab]
.scene
.document
@@ -28,7 +28,7 @@ fn solid_edge_sources(
.filter_map(|entity| {
matches!(
entity,
acadrust::EntityType::Solid3D(_) | acadrust::EntityType::Surface(_)
codec::EntityType::Solid3D(_) | codec::EntityType::Surface(_)
)
.then_some(entity.common().handle)
})
@@ -146,7 +146,7 @@ impl OpenCADStudio {
}
cmd if cmd.starts_with("JUSTIFYTEXT ") => {
let opt = cmd.split_whitespace().nth(1).unwrap_or("").to_uppercase();
let handles: Vec<acadrust::Handle> = self.tabs[i]
let handles: Vec<codec::Handle> = self.tabs[i]
.scene
.selected_entities()
.iter()
@@ -164,7 +164,7 @@ impl OpenCADStudio {
);
return Some(Task::none());
}
use acadrust::entities::{
use codec::entities::{
AttachmentPoint as AP, TextHorizontalAlignment as TH,
TextVerticalAlignment as TV,
};
@@ -213,7 +213,7 @@ impl OpenCADStudio {
.find(|e| e.common().handle == *h)
{
match e {
acadrust::EntityType::Text(t) => {
codec::EntityType::Text(t) => {
let mut changed = false;
if let Some(a) = text_align {
t.horizontal_alignment = a;
@@ -228,7 +228,7 @@ impl OpenCADStudio {
n += 1;
}
}
acadrust::EntityType::MText(m) => {
codec::EntityType::MText(m) => {
if let Some(a) = mtext_ap {
m.attachment_point = a;
n += 1;
@@ -269,7 +269,7 @@ impl OpenCADStudio {
}
cmd if cmd.starts_with("TCASE ") => {
let opt = cmd.split_whitespace().nth(1).unwrap_or("").to_uppercase();
let handles: Vec<acadrust::Handle> = self.tabs[i]
let handles: Vec<codec::Handle> = self.tabs[i]
.scene
.selected_entities()
.iter()
@@ -315,11 +315,11 @@ impl OpenCADStudio {
.find(|e| e.common().handle == *h)
{
match e {
acadrust::EntityType::Text(t) => {
codec::EntityType::Text(t) => {
t.value = conv(&t.value);
n += 1;
}
acadrust::EntityType::MText(m) => {
codec::EntityType::MText(m) => {
m.value = conv(&m.value);
n += 1;
}
@@ -353,14 +353,14 @@ impl OpenCADStudio {
self.tabs[i].active_cmd = Some(Box::new(c));
}
cmd if cmd.starts_with("TEXTMASK ") => {
let handles: Vec<acadrust::Handle> = self.tabs[i]
let handles: Vec<codec::Handle> = self.tabs[i]
.scene
.selected_entities()
.iter()
.filter(|(_, e)| {
matches!(
e,
acadrust::EntityType::Text(_) | acadrust::EntityType::MText(_)
codec::EntityType::Text(_) | codec::EntityType::MText(_)
)
})
.map(|(h, _)| *h)
@@ -388,20 +388,20 @@ impl OpenCADStudio {
continue; // no geometry for this object
}
let pad = ((max[1] - min[1]) * 0.15).max(0.0);
let c1 = acadrust::types::Vector3::new(
let c1 = codec::types::Vector3::new(
(min[0] - pad) as f64,
(min[1] - pad) as f64,
min[2] as f64,
);
let c2 = acadrust::types::Vector3::new(
let c2 = codec::types::Vector3::new(
(max[0] + pad) as f64,
(max[1] + pad) as f64,
min[2] as f64,
);
self.tabs[i]
.scene
.add_entity_clone(acadrust::EntityType::Wipeout(
acadrust::entities::Wipeout::from_corners(c1, c2),
.add_entity_clone(codec::EntityType::Wipeout(
codec::entities::Wipeout::from_corners(c1, c2),
));
n += 1;
}
@@ -436,11 +436,11 @@ impl OpenCADStudio {
return Some(Task::none());
}
};
let handles: Vec<acadrust::Handle> = self.tabs[i]
let handles: Vec<codec::Handle> = self.tabs[i]
.scene
.selected_entities()
.iter()
.filter(|(_, e)| matches!(e, acadrust::EntityType::Text(_)))
.filter(|(_, e)| matches!(e, codec::EntityType::Text(_)))
.map(|(h, _)| *h)
.filter(|handle| !self.tabs[i].scene.is_layer_locked(*handle))
.collect();
@@ -464,7 +464,7 @@ impl OpenCADStudio {
if cur_w <= 1e-9 {
continue;
}
if let Some(acadrust::EntityType::Text(t)) = self.tabs[i]
if let Some(codec::EntityType::Text(t)) = self.tabs[i]
.scene
.document
.entities_mut()
@@ -533,12 +533,12 @@ impl OpenCADStudio {
}
};
let mut texts: Vec<(acadrust::Handle, f64, f64)> = self.tabs[i]
let mut texts: Vec<(codec::Handle, f64, f64)> = self.tabs[i]
.scene
.selected_entities()
.iter()
.filter_map(|(h, e)| match e {
acadrust::EntityType::Text(t)
codec::EntityType::Text(t)
if !self.tabs[i].scene.is_layer_locked(*h) =>
{
Some((*h, t.insertion_point.x, t.insertion_point.y))
@@ -569,7 +569,7 @@ impl OpenCADStudio {
let mut num = start;
for (h, _, _) in &texts {
if let Some(acadrust::EntityType::Text(t)) = self.tabs[i]
if let Some(codec::EntityType::Text(t)) = self.tabs[i]
.scene
.document
.entities_mut()
@@ -624,7 +624,7 @@ impl OpenCADStudio {
.objects
.iter()
.find_map(|(handle, object)| match object {
acadrust::objects::ObjectType::MultiLeaderStyle(style)
codec::objects::ObjectType::MultiLeaderStyle(style)
if style.name.eq_ignore_ascii_case(&name) =>
{
let mut style = style.clone();
@@ -1215,7 +1215,7 @@ impl OpenCADStudio {
self.command_line.push_info(&cmd.prompt());
self.tabs[i].active_cmd = Some(Box::new(cmd));
} else {
let replacements: Vec<(acadrust::Handle, Vec<acadrust::EntityType>)> = entities
let replacements: Vec<(codec::Handle, Vec<codec::EntityType>)> = entities
.iter()
.filter_map(|(h, e)| {
let pieces = explode_entity(e, &self.tabs[i].scene.document);
@@ -1293,7 +1293,7 @@ impl OpenCADStudio {
.map(|e| (h, e))
})
.collect();
let initial_edges: Vec<acadrust::Handle> = self.tabs[i]
let initial_edges: Vec<codec::Handle> = self.tabs[i]
.scene
.selected_entities()
.into_iter()
@@ -1361,8 +1361,8 @@ impl OpenCADStudio {
self.tabs[i].active_cmd = Some(Box::new(c));
}
cmd if cmd.starts_with("ARCTEXT ") => {
use acadrust::entities::Text;
use acadrust::types::Vector3;
use codec::entities::Text;
use codec::types::Vector3;
let text = cmd.strip_prefix("ARCTEXT").unwrap_or("").trim().to_string();
if text.is_empty() {
self.command_line.push_info(
@@ -1376,7 +1376,7 @@ impl OpenCADStudio {
.selected_entities()
.iter()
.find_map(|(_, e)| match e {
acadrust::EntityType::Arc(a) => Some(a.clone()),
codec::EntityType::Arc(a) => Some(a.clone()),
_ => None,
});
let Some(arc) = arc else {
@@ -1406,7 +1406,7 @@ impl OpenCADStudio {
let t = Text::with_value(ch.to_string(), pos)
.with_height(height)
.with_rotation(ang + std::f64::consts::FRAC_PI_2);
self.tabs[i].scene.add_entity(acadrust::EntityType::Text(t));
self.tabs[i].scene.add_entity(codec::EntityType::Text(t));
}
self.tabs[i].dirty = true;
self.command_line