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

+3 -3
View File
@@ -23,13 +23,13 @@ fn viewport_tooltip<'a>(
}
pub(super) fn viewport_controls<'a>(
render_mode: acadrust::entities::ViewportRenderMode,
render_mode: codec::entities::ViewportRenderMode,
show_grid: bool,
snap_on: bool,
include_split: bool,
tile_count: usize,
render_mode_menu_open: bool,
render_mode_preview: Option<acadrust::entities::ViewportRenderMode>,
render_mode_preview: Option<codec::entities::ViewportRenderMode>,
) -> Element<'a, Message> {
let render_modes: Vec<RenderModeChoice> = crate::modules::view::visual_style::VISUAL_STYLES
.iter()
@@ -374,7 +374,7 @@ pub(super) fn dyn_component_value(
#[cfg(test)]
mod tests {
use super::*;
use acadrust::entities::ViewportRenderMode as M;
use codec::entities::ViewportRenderMode as M;
#[test]
fn test_viewport_controls_construction() {
+16 -10
View File
@@ -163,7 +163,7 @@ fn shortcut_key_name(key: &keyboard::Key, modifiers: keyboard::Modifiers) -> Opt
/// `ViewportRenderMode` enum carries the raw DXF integers, not a label,
/// so wrap it locally with a friendly name renderer.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub(super) struct RenderModeChoice(pub acadrust::entities::ViewportRenderMode);
pub(super) struct RenderModeChoice(pub codec::entities::ViewportRenderMode);
impl std::fmt::Display for RenderModeChoice {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
@@ -537,12 +537,12 @@ bg={bg_ms:.1}ms n={view_count}"
.flatten()
.and_then(|h| {
let indexed = match tab.scene.document.get_entity(h) {
Some(acadrust::EntityType::LwPolyline(_))
| Some(acadrust::EntityType::Polyline2D(_))
| Some(acadrust::EntityType::Polyline3D(_))
| Some(acadrust::EntityType::Spline(_))
| Some(acadrust::EntityType::Face3D(_))
| Some(acadrust::EntityType::PolygonMesh(_)) => true,
Some(codec::EntityType::LwPolyline(_))
| Some(codec::EntityType::Polyline2D(_))
| Some(codec::EntityType::Polyline3D(_))
| Some(codec::EntityType::Spline(_))
| Some(codec::EntityType::Face3D(_))
| Some(codec::EntityType::PolygonMesh(_)) => true,
_ => false,
};
indexed.then_some(tab.properties.prop_vertex)
@@ -612,7 +612,7 @@ bg={bg_ms:.1}ms n={view_count}"
};
let control_polygon = tab.selected_handle.and_then(|handle| {
let spline = match tab.scene.document.get_entity(handle) {
Some(acadrust::EntityType::Spline(spline))
Some(codec::EntityType::Spline(spline))
if crate::entities::spline::shows_control_vertices(spline) => spline,
_ => return None,
};
@@ -1307,7 +1307,7 @@ bg={bg_ms:.1}ms n={view_count}"
// clicks (the shader viewport sits below it). Positioned with
// leading Spaces sized to the viewport's screen rectangle.
mark("active_vp_rect");
let active_vp_rect: Option<(acadrust::Handle, iced::Rectangle)> =
let active_vp_rect: Option<(codec::Handle, iced::Rectangle)> =
if is_paper && !tab.is_start {
tab.scene.active_viewport.and_then(|h| {
let (cw, ch) = tab.scene.selection.borrow().vp_size;
@@ -1356,7 +1356,7 @@ bg={bg_ms:.1}ms n={view_count}"
let vp_mode = tab
.scene
.active_viewport_render_mode()
.unwrap_or(acadrust::entities::ViewportRenderMode::Wireframe2D);
.unwrap_or(codec::entities::ViewportRenderMode::Wireframe2D);
// Adaptive (same as model): the picker measures its real width into
// `render_bar_w` and swaps to an empty spacer only when the viewport
// can't hold it; the ViewCube reads that width to decide overlap.
@@ -1828,6 +1828,11 @@ bg={bg_ms:.1}ms n={view_count}"
}
}
if self.show_node_graph && !tab.is_start {
let sections = self.graph_all_sections(self.active_tab);
viewport_stack = viewport_stack.push(tab.graph.view(sections));
}
// Docked side panels (Properties, block palette, future palettes) live
// in an ordered vertical stack on the left/right edge of the drawing
// view. Auto-collapsing (pinned) panels that aren't being hovered
@@ -2063,6 +2068,7 @@ bg={bg_ms:.1}ms n={view_count}"
self.control.enabled,
self.control_busy(),
self.pending_pick_label().is_some(),
self.show_node_graph,
);
let center_stack: Element<'_, Message> = if thumbnail_capture_clean {
workspace
+14 -14
View File
@@ -688,7 +688,7 @@ impl OpenCADStudio {
let tab = &self.tabs[self.active_tab];
let entity = self.anno_object_scale_target;
// Which scales the object currently has a representation for.
let members: Vec<acadrust::types::Handle> = entity
let members: Vec<codec::types::Handle> = entity
.map(|h| {
crate::scene::annotative::object_scale_memberships(
&tab.scene.document,
@@ -702,10 +702,10 @@ impl OpenCADStudio {
let label = entity
.and_then(|h| tab.scene.document.get_entity(h))
.map(|e| match e {
acadrust::EntityType::Text(_) => "TEXT",
acadrust::EntityType::MText(_) => "MTEXT",
acadrust::EntityType::Insert(_) => "BLOCK",
acadrust::EntityType::MultiLeader(_) => "MULTILEADER",
codec::EntityType::Text(_) => "TEXT",
codec::EntityType::MText(_) => "MTEXT",
codec::EntityType::Insert(_) => "BLOCK",
codec::EntityType::MultiLeader(_) => "MULTILEADER",
_ => "OBJECT",
})
.unwrap_or("—");
@@ -871,7 +871,7 @@ impl OpenCADStudio {
)
}
super::super::ModalKind::MlStyle => {
use acadrust::objects::ObjectType;
use codec::objects::ObjectType;
let tab = &self.tabs[self.active_tab];
let styles: Vec<String> = tab
.scene
@@ -947,7 +947,7 @@ impl OpenCADStudio {
)
}
super::super::ModalKind::TableStyle => {
use acadrust::objects::ObjectType;
use codec::objects::ObjectType;
let tab = &self.tabs[self.active_tab];
let styles: Vec<String> = tab
.scene
@@ -1052,7 +1052,7 @@ impl OpenCADStudio {
)
}
super::super::ModalKind::MLeaderStyle => {
use acadrust::objects::ObjectType;
use codec::objects::ObjectType;
let tab = &self.tabs[self.active_tab];
let styles: Vec<String> = tab
.scene
@@ -1079,7 +1079,7 @@ impl OpenCADStudio {
lt_opts.extend(doc.line_types.iter().map(|lt| lt.name.clone()));
let mut textstyle_opts: Vec<String> = vec!["None".to_string()];
textstyle_opts.extend(doc.text_styles.iter().map(|t| t.name.clone()));
let opt_block = |h: Option<acadrust::types::Handle>| -> String {
let opt_block = |h: Option<codec::types::Handle>| -> String {
match h {
Some(h) => doc
.block_records
@@ -1090,7 +1090,7 @@ impl OpenCADStudio {
None => "None".to_string(),
}
};
let opt_lt = |h: Option<acadrust::types::Handle>| -> String {
let opt_lt = |h: Option<codec::types::Handle>| -> String {
match h {
Some(h) => doc
.line_types
@@ -1101,7 +1101,7 @@ impl OpenCADStudio {
None => "ByBlock".to_string(),
}
};
let opt_ts = |h: Option<acadrust::types::Handle>| -> String {
let opt_ts = |h: Option<codec::types::Handle>| -> String {
match h {
Some(h) => doc
.text_styles
@@ -1348,7 +1348,7 @@ impl OpenCADStudio {
.get(&self.ds_dimtxsty)
.map(|style| style.height)
.filter(|height| *height > 0.0);
let blk_name = |h: acadrust::types::Handle| -> String {
let blk_name = |h: codec::types::Handle| -> String {
if h.is_null() {
"Default".to_string()
} else {
@@ -1359,7 +1359,7 @@ impl OpenCADStudio {
.unwrap_or_else(|| "Default".to_string())
}
};
let lt_name = |h: acadrust::types::Handle| -> String {
let lt_name = |h: codec::types::Handle| -> String {
if h.is_null() {
"ByBlock".to_string()
} else {
@@ -1373,7 +1373,7 @@ impl OpenCADStudio {
let ds_sel = doc.dim_styles.get(&self.dimstyle_selected);
let read_only = false;
let in_use = doc.entities().any(|entity| {
matches!(entity, acadrust::EntityType::Dimension(dimension)
matches!(entity, codec::EntityType::Dimension(dimension)
if dimension.base().style_name.eq_ignore_ascii_case(&self.dimstyle_selected))
});
let compare_opts: Vec<String> = styles
+2 -2
View File
@@ -489,7 +489,7 @@ fn mtext_editor_content<'a>(
// Same colour picker as the Properties panel (named swatches + "More…" full
// palette), applied to the selection or the whole text.
let color_pl = iced::widget::container(crate::ui::color_select::color_selector(
acadrust::types::Color::from_index(ed.color_aci as i16),
codec::types::Color::from_index(ed.color_aci as i16),
ed.color_picker_open,
crate::ui::color_select::ColorExtras {
by_layer: true,
@@ -500,7 +500,7 @@ fn mtext_editor_content<'a>(
Message::MTextColorPickerToggle,
Message::OpenColorWindow(
crate::app::ColorPickTarget::MText,
acadrust::types::Color::from_index(ed.color_aci as i16),
codec::types::Color::from_index(ed.color_aci as i16),
),
))
.width(iced::Length::Fixed(150.0));
+1 -1
View File
@@ -53,7 +53,7 @@ fn vc_btn<'a>(content: Element<'a, Message>, size: f32, msg: Message) -> Element
/// Overlay of home / roll / nudge controls sized to the whole nav region, so
/// the caller can position it exactly like the cube hit area.
pub(super) fn viewcube_nav_controls<'a>(
viewport: Option<acadrust::Handle>,
viewport: Option<codec::Handle>,
) -> Element<'a, Message> {
use crate::scene::NudgeDir;
use crate::ui::icons;