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
+17
-17
@@ -1,5 +1,5 @@
|
||||
use acadrust::entities::{HooklineDirection, Leader, LeaderCreationType, LeaderPathType};
|
||||
use acadrust::Entity;
|
||||
use codec::entities::{HooklineDirection, Leader, LeaderCreationType, LeaderPathType};
|
||||
use codec::Entity;
|
||||
use glam::Vec3;
|
||||
|
||||
use crate::command::EntityTransform;
|
||||
@@ -47,8 +47,8 @@ fn draws_hookline(leader: &Leader) -> bool {
|
||||
fn to_render(leader: &Leader) -> RenderEntity {
|
||||
let verts = &leader.vertices;
|
||||
let nan = [f64::NAN; 3];
|
||||
let p3 = |v: &acadrust::types::Vector3| -> [f64; 3] { [v.x, v.y, v.z] };
|
||||
let p3f = |v: &acadrust::types::Vector3| -> [f32; 3] { [v.x as f32, v.y as f32, v.z as f32] };
|
||||
let p3 = |v: &codec::types::Vector3| -> [f64; 3] { [v.x, v.y, v.z] };
|
||||
let p3f = |v: &codec::types::Vector3| -> [f32; 3] { [v.x as f32, v.y as f32, v.z as f32] };
|
||||
|
||||
let mut points: Vec<[f64; 3]> = Vec::new();
|
||||
let mut tangents: Vec<TangentGeom> = Vec::new();
|
||||
@@ -169,12 +169,12 @@ fn apply_grip(leader: &mut Leader, grip_id: usize, apply: GripApply) {
|
||||
let old_end = leader.vertices[n - 1];
|
||||
|
||||
let delta = match apply {
|
||||
GripApply::Absolute(p) => acadrust::types::Vector3::new(
|
||||
GripApply::Absolute(p) => codec::types::Vector3::new(
|
||||
p.x as f64 - old_elbow.x,
|
||||
p.y as f64 - old_elbow.y,
|
||||
p.z as f64 - old_elbow.z,
|
||||
),
|
||||
GripApply::Translate(d) => acadrust::types::Vector3::new(
|
||||
GripApply::Translate(d) => codec::types::Vector3::new(
|
||||
d.x as f64,
|
||||
d.y as f64,
|
||||
d.z as f64,
|
||||
@@ -227,7 +227,7 @@ fn apply_grip(leader: &mut Leader, grip_id: usize, apply: GripApply) {
|
||||
}
|
||||
}
|
||||
} else if let GripApply::Translate(d) = apply {
|
||||
leader.translate(acadrust::types::Vector3::new(
|
||||
leader.translate(codec::types::Vector3::new(
|
||||
d.x as f64,
|
||||
d.y as f64,
|
||||
d.z as f64,
|
||||
@@ -512,7 +512,7 @@ fn apply_transform(leader: &mut Leader, t: &EntityTransform) {
|
||||
// ── Trait impls ────────────────────────────────────────────────────────────
|
||||
|
||||
impl RenderConvertible for Leader {
|
||||
fn to_render(&self, _document: &acadrust::CadDocument) -> Option<RenderEntity> {
|
||||
fn to_render(&self, _document: &codec::CadDocument) -> Option<RenderEntity> {
|
||||
if self.vertices.is_empty() {
|
||||
return None;
|
||||
}
|
||||
@@ -570,7 +570,7 @@ impl crate::entities::traits::Grippable for Leader {
|
||||
}
|
||||
let v0 = &self.vertices[grip_id];
|
||||
let v1 = &self.vertices[i1];
|
||||
let mid = acadrust::types::Vector3::new(
|
||||
let mid = codec::types::Vector3::new(
|
||||
(v0.x + v1.x) * 0.5,
|
||||
(v0.y + v1.y) * 0.5,
|
||||
(v0.z + v1.z) * 0.5,
|
||||
@@ -608,8 +608,8 @@ impl crate::entities::traits::Transformable for Leader {
|
||||
pub trait LeaderTess {
|
||||
fn tessellate(
|
||||
&self,
|
||||
document: &acadrust::CadDocument,
|
||||
handle: acadrust::Handle,
|
||||
document: &codec::CadDocument,
|
||||
handle: codec::Handle,
|
||||
selected: bool,
|
||||
entity_color: [f32; 4],
|
||||
line_weight_px: f32,
|
||||
@@ -620,8 +620,8 @@ pub trait LeaderTess {
|
||||
impl LeaderTess for Leader {
|
||||
fn tessellate(
|
||||
&self,
|
||||
document: &acadrust::CadDocument,
|
||||
handle: acadrust::Handle,
|
||||
document: &codec::CadDocument,
|
||||
handle: codec::Handle,
|
||||
selected: bool,
|
||||
entity_color: [f32; 4],
|
||||
line_weight_px: f32,
|
||||
@@ -650,7 +650,7 @@ impl LeaderTess for Leader {
|
||||
});
|
||||
match dim_clr {
|
||||
Some(idx) if idx != 0 && idx != 256 => crate::scene::convert::tess_util::aci_to_rgba(
|
||||
&acadrust::types::Color::from_index(idx),
|
||||
&codec::types::Color::from_index(idx),
|
||||
),
|
||||
_ => entity_color,
|
||||
}
|
||||
@@ -659,12 +659,12 @@ impl LeaderTess for Leader {
|
||||
// ByBlock / Default and no override keep the resolved weight passed in.
|
||||
let line_weight_px = match dov::int(xd, dov::DIMLWD) {
|
||||
Some(lwd) if lwd >= 0 => crate::scene::view::render::lineweight_to_px(
|
||||
&acadrust::types::LineWeight::from_value(lwd),
|
||||
&codec::types::LineWeight::from_value(lwd),
|
||||
),
|
||||
_ => line_weight_px,
|
||||
};
|
||||
let name = handle.value().to_string();
|
||||
let p3 = |v: &acadrust::types::Vector3| -> [f32; 3] {
|
||||
let p3 = |v: &codec::types::Vector3| -> [f32; 3] {
|
||||
[(v.x) as f32, (v.y) as f32, (v.z) as f32]
|
||||
};
|
||||
|
||||
@@ -822,7 +822,7 @@ impl LeaderTess for Leader {
|
||||
.unwrap_or(0);
|
||||
if dimtad != 0 {
|
||||
let mt = match document.get_entity(self.annotation_handle) {
|
||||
Some(acadrust::entities::EntityType::MText(mt)) => {
|
||||
Some(codec::entities::EntityType::MText(mt)) => {
|
||||
Some((mt.extents_width, mt.insertion_point.x))
|
||||
}
|
||||
_ => None,
|
||||
|
||||
Reference in new issue
Block a user