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 <[email protected]>
This commit is contained in:
1 parent
56c04408d6
commit
f537aff75c
430 files changed
+9925
-8540
No files matched your search
+16
-16
@@ -119,7 +119,7 @@ impl OpenCADStudio {
|
||||
self.tabs[i].scene.document.header.paper_space_linetype_scaling,
|
||||
) | (i16::from(self.tabs[i].scene.document.header.paper_space_limit_check) << 1);
|
||||
for obj in self.tabs[i].scene.document.objects.values_mut() {
|
||||
if let acadrust::objects::ObjectType::Layout(layout) = obj {
|
||||
if let codec::objects::ObjectType::Layout(layout) = obj {
|
||||
if layout.name == name {
|
||||
layout.flags = layout_flags;
|
||||
crate::scene::apply_default_page_setup(layout, &plot_style);
|
||||
@@ -154,7 +154,7 @@ impl OpenCADStudio {
|
||||
.tabs[i]
|
||||
.scene
|
||||
.plot_settings_for(&layout)
|
||||
.unwrap_or_else(|| acadrust::objects::PlotSettings::new(String::new()));
|
||||
.unwrap_or_else(|| codec::objects::PlotSettings::new(String::new()));
|
||||
if let Some(paper) = req["paper"].as_str().filter(|p| !p.is_empty()) {
|
||||
let resolved = crate::io::paper_catalog::resolve(paper)
|
||||
.ok_or_else(|| failure("invalid_paper", format!("Unknown paper '{paper}'")))?;
|
||||
@@ -163,9 +163,9 @@ impl OpenCADStudio {
|
||||
ps.paper_width = width;
|
||||
ps.paper_height = height;
|
||||
ps.rotation = if req["orientation"].as_str().is_some_and(|o| o.eq_ignore_ascii_case("portrait")) {
|
||||
acadrust::objects::PlotRotation::None
|
||||
codec::objects::PlotRotation::None
|
||||
} else {
|
||||
acadrust::objects::PlotRotation::Degrees90
|
||||
codec::objects::PlotRotation::Degrees90
|
||||
};
|
||||
}
|
||||
if let Some(fit) = req["fit"].as_bool() {
|
||||
@@ -203,7 +203,7 @@ impl OpenCADStudio {
|
||||
if let Some(window) = req["window"].as_array().filter(|v| v.len() == 4) {
|
||||
let coord = |k: usize| window[k].as_f64().unwrap_or(0.0);
|
||||
ps.set_plot_window(coord(0), coord(1), coord(2), coord(3));
|
||||
ps.plot_type = acadrust::objects::PlotType::Window;
|
||||
ps.plot_type = codec::objects::PlotType::Window;
|
||||
}
|
||||
self.push_undo_snapshot(i, "PAGESETUP");
|
||||
if !self.tabs[i].scene.set_layout_plot_settings(&layout, &ps) {
|
||||
@@ -246,7 +246,7 @@ impl OpenCADStudio {
|
||||
)?;
|
||||
|
||||
// Clone out of the source first so the two tabs never borrow together.
|
||||
let cloned: Vec<acadrust::EntityType> = handles
|
||||
let cloned: Vec<codec::EntityType> = handles
|
||||
.iter()
|
||||
.filter_map(|handle| self.tabs[source_index].scene.document.get_entity(*handle))
|
||||
.map(|entity| entity.clone())
|
||||
@@ -254,7 +254,7 @@ impl OpenCADStudio {
|
||||
|
||||
// Copy the referenced layer definitions out of the source before the
|
||||
// target borrow starts (the two tabs never borrow together).
|
||||
let mut missing_layers: Vec<acadrust::tables::Layer> = Vec::new();
|
||||
let mut missing_layers: Vec<codec::tables::Layer> = Vec::new();
|
||||
{
|
||||
let source_document = &self.tabs[source_index].scene.document;
|
||||
for entity in &cloned {
|
||||
@@ -462,22 +462,22 @@ impl OpenCADStudio {
|
||||
&mut self.tabs[i].scene.document,
|
||||
handle,
|
||||
FILE_IDENTITY_APP,
|
||||
Some(vec![acadrust::xdata::XDataValue::String(identity.clone())]),
|
||||
Some(vec![codec::xdata::XDataValue::String(identity.clone())]),
|
||||
);
|
||||
}
|
||||
None => {
|
||||
let mut text = acadrust::entities::Text::with_value(
|
||||
let mut text = codec::entities::Text::with_value(
|
||||
FILE_IDENTITY_APP,
|
||||
acadrust::types::Vector3::ZERO,
|
||||
codec::types::Vector3::ZERO,
|
||||
)
|
||||
.with_height(0.0001);
|
||||
text.common.invisible = true;
|
||||
let handle = self.tabs[i].scene.add_entity(acadrust::EntityType::Text(text));
|
||||
let handle = self.tabs[i].scene.add_entity(codec::EntityType::Text(text));
|
||||
crate::scene::view::dispatch::set_entity_xdata(
|
||||
&mut self.tabs[i].scene.document,
|
||||
handle,
|
||||
FILE_IDENTITY_APP,
|
||||
Some(vec![acadrust::xdata::XDataValue::String(identity.clone())]),
|
||||
Some(vec![codec::xdata::XDataValue::String(identity.clone())]),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -492,7 +492,7 @@ impl OpenCADStudio {
|
||||
const FILE_IDENTITY_APP: &str = "SPMDOCUNIQUE";
|
||||
|
||||
/// The handle of the entity carrying the file identity, if present.
|
||||
fn find_file_identity_marker(document: &acadrust::CadDocument) -> Option<acadrust::Handle> {
|
||||
fn find_file_identity_marker(document: &codec::CadDocument) -> Option<codec::Handle> {
|
||||
document
|
||||
.entities()
|
||||
.find(|entity| {
|
||||
@@ -506,14 +506,14 @@ fn find_file_identity_marker(document: &acadrust::CadDocument) -> Option<acadrus
|
||||
}
|
||||
|
||||
/// The identity GUID from the marker entity's XData.
|
||||
fn marker_identity(document: &acadrust::CadDocument, handle: acadrust::Handle) -> Option<String> {
|
||||
fn marker_identity(document: &codec::CadDocument, handle: codec::Handle) -> Option<String> {
|
||||
let record = document
|
||||
.get_entity(handle)?
|
||||
.common()
|
||||
.extended_data
|
||||
.get_record(FILE_IDENTITY_APP)?;
|
||||
match record.values.first() {
|
||||
Some(acadrust::xdata::XDataValue::String(text)) => Some(text.clone()),
|
||||
Some(codec::xdata::XDataValue::String(text)) => Some(text.clone()),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
@@ -569,7 +569,7 @@ fn read_sysvar(scene: &crate::scene::Scene, name: &str) -> Option<Value> {
|
||||
Some(value)
|
||||
}
|
||||
|
||||
fn set_sysvar(document: &mut acadrust::CadDocument, name: &str, value: &Value) -> Result<(), Value> {
|
||||
fn set_sysvar(document: &mut codec::CadDocument, name: &str, value: &Value) -> Result<(), Value> {
|
||||
let failure = |message: &str| crate::app::control::failure("invalid_sysvar_value", message);
|
||||
let header = &mut document.header;
|
||||
match name.to_ascii_lowercase().as_str() {
|
||||
|
||||
Reference in new issue
Block a user