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

+1 -1
View File
@@ -1,6 +1,6 @@
//! OpenCADStudio-style grip editing.
use acadrust::Handle;
use codec::Handle;
use glam::{DVec3, Mat4, Vec2};
use iced::{Point, Rectangle};
+8 -8
View File
@@ -6,7 +6,7 @@
use rustc_hash::{FxHashMap as HashMap, FxHashSet as HashSet};
use acadrust::Handle;
use codec::Handle;
use glam::Mat4;
use iced::{Point, Rectangle};
@@ -727,7 +727,7 @@ pub fn click_hits_all<'a, W: WireSource + ?Sized>(
type MeshPickItem<'a> = (
Handle,
&'a MeshModel,
Option<acadrust::types::Transform>,
Option<codec::types::Transform>,
[f64; 6],
);
@@ -735,7 +735,7 @@ type MeshEdgePickItem<'a> = (
Handle,
&'a [[f32; 3]],
&'a [[f32; 3]],
Option<acadrust::types::Transform>,
Option<codec::types::Transform>,
);
/// Return the closest solid whose actual B-rep feature edge passes through the
@@ -936,7 +936,7 @@ fn mesh_click_result<'a>(
best
}
fn codec_transform_matrix(transform: acadrust::types::Transform) -> glam::DMat4 {
fn codec_transform_matrix(transform: codec::types::Transform) -> glam::DMat4 {
let matrix = transform.matrix.m;
glam::DMat4::from_cols_array(&[
matrix[0][0], matrix[1][0], matrix[2][0], matrix[3][0],
@@ -1018,7 +1018,7 @@ fn mesh_vert(
/// Project a mesh's vertices to screen space.
fn project_mesh_verts(
mesh: &MeshModel,
transform: Option<acadrust::types::Transform>,
transform: Option<codec::types::Transform>,
view_rot: Mat4,
eye: glam::DVec3,
bounds: Rectangle,
@@ -1029,7 +1029,7 @@ fn project_mesh_verts(
.map(|(i, &w)| {
let point = mesh_vert(w, &mesh.verts_low, i);
let point = transform.map_or(point, |transform| {
let point = transform.apply(acadrust::types::Vector3::new(point.x, point.y, point.z));
let point = transform.apply(codec::types::Vector3::new(point.x, point.y, point.z));
glam::DVec3::new(point.x, point.y, point.z)
});
let ndc = view_rot.project_point3((point - eye).as_vec3());
@@ -1070,7 +1070,7 @@ pub fn mesh_box_hit<'a>(
Item = (
Handle,
&'a MeshModel,
Option<acadrust::types::Transform>,
Option<codec::types::Transform>,
),
>,
view_rot: Mat4,
@@ -1114,7 +1114,7 @@ pub fn mesh_poly_hit<'a>(
Item = (
Handle,
&'a MeshModel,
Option<acadrust::types::Transform>,
Option<codec::types::Transform>,
),
>,
view_rot: Mat4,
+2 -2
View File
@@ -1,7 +1,7 @@
// Spatial index for 2D entities. Each leaf holds up to `LEAF_CAPACITY`
// items; on overflow the node splits into 4 children and re-distributes.
//
// Items are keyed by `acadrust::Handle`. AABBs are stored in WCS f64
// Items are keyed by `codec::Handle`. AABBs are stored in WCS f64
// (NOT world_offset-subtracted) so changing `world_offset` doesn't
// invalidate the index.
//
@@ -20,7 +20,7 @@
// (rare in CAD workflows where most edits are local and few entities
// move long distances).
use acadrust::Handle;
use codec::Handle;
pub type Aabb = [f64; 4]; // [xmin, ymin, xmax, ymax]
+16 -16
View File
@@ -10,11 +10,11 @@
//! case. The clip is performed in 2D (XY) after the INSERT transform has been
//! applied, matching the space the block wires are already emitted in.
use acadrust::entities::Insert;
use acadrust::objects::{ObjectType, SpatialFilter};
use acadrust::types::{Handle, Transform, Vector3};
use acadrust::CadDocument;
use cadkernel::geom2d::{contains, Curve, Line, Tolerance};
use codec::entities::Insert;
use codec::objects::{ObjectType, SpatialFilter};
use codec::types::{Handle, Transform, Vector3};
use codec::CadDocument;
use kernel::geom2d::{contains, Curve, Line, Tolerance};
use crate::scene::model::wire_model::{
decode_pattern_station_map, encode_pattern_stations, pattern_station_values, WireModel,
@@ -49,7 +49,7 @@ pub fn insert_spatial_filter<'a>(
/// The filter's handle, when the insert has one (enabled or not).
pub fn filter_handle(doc: &CadDocument, insert: Handle) -> Option<Handle> {
let Some(acadrust::EntityType::Insert(ins)) = doc.get_entity(insert) else {
let Some(codec::EntityType::Insert(ins)) = doc.get_entity(insert) else {
return None;
};
let acad_filter = dict_entry(doc, ins.common.xdictionary_handle?, "ACAD_FILTER")?;
@@ -69,10 +69,10 @@ pub fn inverted_boundary(doc: &CadDocument, filter: &SpatialFilter) -> Option<Ve
let mut inside = false;
for entry in &x.entries {
match &entry.value {
acadrust::objects::XRecordValue::String(s) if entry.code == 102 => {
codec::objects::XRecordValue::String(s) if entry.code == 102 => {
inside = s == INVERTED;
}
acadrust::objects::XRecordValue::Point3D(px, py, _) if inside && entry.code == 10 => {
codec::objects::XRecordValue::Point3D(px, py, _) if inside && entry.code == 10 => {
points.push([*px, *py]);
}
_ => {}
@@ -90,7 +90,7 @@ pub fn clip_outline_world(doc: &CadDocument, filter: &SpatialFilter, xform: &Tra
let mut outline = filter.clone();
outline.boundary_points = points
.iter()
.map(|p| acadrust::types::Vector2::new(p[0], p[1]))
.map(|p| codec::types::Vector2::new(p[0], p[1]))
.collect();
world_clip_polygon_for_transform(&outline, xform)
}
@@ -190,9 +190,9 @@ pub fn set_insert_clip(
inverted: bool,
extents: ([f64; 2], [f64; 2]),
) -> bool {
use acadrust::objects::{Dictionary, XRecord, XRecordEntry, XRecordValue};
use acadrust::types::{Matrix4, Vector2};
let Some(acadrust::EntityType::Insert(ins)) = doc.get_entity(insert) else {
use codec::objects::{Dictionary, XRecord, XRecordEntry, XRecordValue};
use codec::types::{Matrix4, Vector2};
let Some(codec::EntityType::Insert(ins)) = doc.get_entity(insert) else {
return false;
};
let t = ins.get_transform().matrix.m;
@@ -270,7 +270,7 @@ pub fn set_insert_clip(
}
let mut x = XRecord::new();
(x.handle, x.owner) = (record, fdict);
x.cloning_flags = acadrust::objects::DictionaryCloningFlags::KeepExisting;
x.cloning_flags = codec::objects::DictionaryCloningFlags::KeepExisting;
let point = |p: &[f64; 2]| XRecordEntry::new(10, XRecordValue::Point3D(p[0], p[1], 0.0));
x.entries.push(XRecordEntry::string(102, INVERTED));
x.entries.extend(boundary.iter().map(point));
@@ -999,8 +999,8 @@ mod tests {
#[test]
fn resolves_filter_and_clips_block_geometry() {
use acadrust::objects::Dictionary;
use acadrust::types::Vector2;
use codec::objects::Dictionary;
use codec::types::Vector2;
// Handles: insert, xdict, acad_filter dict, spatial filter.
let (h_ins, h_xdict, h_filter, h_spatial) = (
@@ -1088,7 +1088,7 @@ mod tests {
#[test]
fn world_polygon_applies_inverse_block_then_insert() {
use acadrust::types::{Matrix4, Vector2};
use codec::types::{Matrix4, Vector2};
// Clip stored against a normalized space: inverse_block_transform scales
// the small boundary points up by 1000 into block space, then the insert
// (scale 0.1 + translation) maps them to world.