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
+19
-19
@@ -1,4 +1,4 @@
|
||||
use acadrust::entities::Tolerance;
|
||||
use codec::entities::Tolerance;
|
||||
|
||||
use crate::command::EntityTransform;
|
||||
use crate::entities::common::{edit_prop as edit, ro_prop as ro, square_grip};
|
||||
@@ -155,8 +155,8 @@ pub(crate) fn symbol_font_switch(inner: &str) -> Option<char> {
|
||||
/// every DWG-read tolerance to "Standard" and pick the wrong metrics.
|
||||
pub(crate) fn resolve_dim_style<'a>(
|
||||
tol: &Tolerance,
|
||||
doc: &'a acadrust::CadDocument,
|
||||
) -> Option<&'a acadrust::tables::DimStyle> {
|
||||
doc: &'a codec::CadDocument,
|
||||
) -> Option<&'a codec::tables::DimStyle> {
|
||||
if let Some(h) = tol.dimension_style_handle {
|
||||
if !h.is_null() {
|
||||
if let Some(s) = doc.dim_styles.iter().find(|s| s.handle == h) {
|
||||
@@ -269,7 +269,7 @@ struct TolCell {
|
||||
/// `GlyphRun` so the cell renders as SDF text (frame stays geometry).
|
||||
fn tessellate_tolerance(
|
||||
tol: &Tolerance,
|
||||
doc: &acadrust::CadDocument,
|
||||
doc: &codec::CadDocument,
|
||||
) -> (Vec<Vec<[f32; 2]>>, Vec<TolCell>) {
|
||||
if tol.text.is_empty() {
|
||||
return (vec![], vec![]);
|
||||
@@ -444,7 +444,7 @@ fn tessellate_tolerance(
|
||||
|
||||
pub(crate) fn preview_strokes(
|
||||
tol: &Tolerance,
|
||||
doc: &acadrust::CadDocument,
|
||||
doc: &codec::CadDocument,
|
||||
) -> Vec<Vec<[f32; 2]>> {
|
||||
tessellate_tolerance(tol, doc).0
|
||||
}
|
||||
@@ -463,7 +463,7 @@ fn frame_basis(tol: &Tolerance) -> (glam::DVec3, glam::DVec3) {
|
||||
// ── RenderConvertible ──────────────────────────────────────────────────────────
|
||||
|
||||
impl RenderConvertible for Tolerance {
|
||||
fn to_render(&self, document: &acadrust::CadDocument) -> Option<RenderEntity> {
|
||||
fn to_render(&self, document: &codec::CadDocument) -> Option<RenderEntity> {
|
||||
if self.text.is_empty() {
|
||||
return None;
|
||||
}
|
||||
@@ -493,12 +493,12 @@ impl RenderConvertible for Tolerance {
|
||||
let explicit_color = |index: Option<i16>| {
|
||||
index.filter(|value| !matches!(value, 0 | 256)).map(|value| {
|
||||
let [red, green, blue, _] = crate::scene::convert::tess_util::aci_to_rgba(
|
||||
&acadrust::types::Color::from_index(value),
|
||||
&codec::types::Color::from_index(value),
|
||||
);
|
||||
[red, green, blue]
|
||||
})
|
||||
};
|
||||
let color_value = |color: &acadrust::types::Color| {
|
||||
let color_value = |color: &codec::types::Color| {
|
||||
let [red, green, blue, _] =
|
||||
crate::scene::convert::tess_util::aci_to_rgba(color);
|
||||
[red, green, blue]
|
||||
@@ -784,9 +784,9 @@ mod tests {
|
||||
/// non-zero default, so trusting that field drew the frame ~10x too small.
|
||||
#[test]
|
||||
fn the_frame_is_sized_from_the_dimension_style_not_the_entity_default() {
|
||||
use acadrust::tables::DimStyle;
|
||||
let mut doc = acadrust::CadDocument::new();
|
||||
let handle = acadrust::Handle::from(0x27_u64);
|
||||
use codec::tables::DimStyle;
|
||||
let mut doc = codec::CadDocument::new();
|
||||
let handle = codec::Handle::from(0x27_u64);
|
||||
let mut style = DimStyle::new("ISO-25");
|
||||
style.handle = handle;
|
||||
style.dimtxt = 2.5;
|
||||
@@ -817,11 +817,11 @@ mod tests {
|
||||
/// 0.42; reading the style alone drew the frame several times too large.
|
||||
#[test]
|
||||
fn an_entity_override_beats_its_dimension_style() {
|
||||
use acadrust::tables::DimStyle;
|
||||
use acadrust::xdata::XDataValue;
|
||||
use codec::tables::DimStyle;
|
||||
use codec::xdata::XDataValue;
|
||||
|
||||
let mut doc = acadrust::CadDocument::new();
|
||||
let handle = acadrust::Handle::from(0x27_u64);
|
||||
let mut doc = codec::CadDocument::new();
|
||||
let handle = codec::Handle::from(0x27_u64);
|
||||
let mut style = DimStyle::new("ISO-25");
|
||||
style.handle = handle;
|
||||
style.dimtxt = 2.5;
|
||||
@@ -844,7 +844,7 @@ mod tests {
|
||||
// The entity's own overrides, shaped exactly as the file carries them:
|
||||
// application "ACAD", naming itself "DSTYLE" in its first string value,
|
||||
// then (variable code, value) pairs. Variable 140 = text height.
|
||||
let mut rec = acadrust::xdata::ExtendedDataRecord::new("ACAD");
|
||||
let mut rec = codec::xdata::ExtendedDataRecord::new("ACAD");
|
||||
rec.add_value(XDataValue::String("DSTYLE".into()));
|
||||
rec.add_value(XDataValue::ControlString("{".into()));
|
||||
rec.add_value(XDataValue::Integer16(140));
|
||||
@@ -869,7 +869,7 @@ mod tests {
|
||||
/// Rows read downward and start at the left edge.
|
||||
#[test]
|
||||
fn rows_stack_downward_and_left_align() {
|
||||
let doc = acadrust::CadDocument::new();
|
||||
let doc = codec::CadDocument::new();
|
||||
let mut tol = Tolerance::new();
|
||||
tol.text = BENCH.to_string();
|
||||
let (boxes, _) = tessellate_tolerance(&tol, &doc);
|
||||
@@ -925,7 +925,7 @@ mod tests {
|
||||
/// together inside correctly-sized boxes.
|
||||
#[test]
|
||||
fn cells_are_drawn_with_the_spacing_they_were_measured_with() {
|
||||
let doc = acadrust::CadDocument::new();
|
||||
let doc = codec::CadDocument::new();
|
||||
let mut tol = Tolerance::new();
|
||||
tol.text = "ABC".into();
|
||||
|
||||
@@ -1008,7 +1008,7 @@ mod tests {
|
||||
fn compartments_are_measured_by_their_ink_not_the_trailing_pen_gap() {
|
||||
// Cap height, so glyph units and world units line up.
|
||||
let h = 9.0_f32;
|
||||
let document = acadrust::CadDocument::new();
|
||||
let document = codec::CadDocument::new();
|
||||
let text_style = crate::entities::text_support::resolve_text_style("Standard", &document);
|
||||
for src in ["{\\Fgdt;r}", "{\\Fgdt;n}tol{\\Fgdt;m}", "1{\\Fgdt;m}", "A"] {
|
||||
let cell = parse_cell(src);
|
||||
|
||||
Reference in new issue
Block a user