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
@@ -21,7 +21,7 @@ pub struct MeshModel {
|
||||
/// Optional AcDbMaterial handle per triangle. Empty means the whole mesh
|
||||
/// uses `MeshLodSet::material`; otherwise each entry aligns with one
|
||||
/// `indices` triplet and overrides the entity material for that face.
|
||||
pub triangle_material_handles: Vec<Option<acadrust::Handle>>,
|
||||
pub triangle_material_handles: Vec<Option<codec::Handle>>,
|
||||
/// Optional ACIS face colour per triangle, aligned with `indices` triplets.
|
||||
pub triangle_colors: Vec<Option<[f32; 4]>>,
|
||||
/// RGBA colour in [0, 1].
|
||||
@@ -45,7 +45,7 @@ pub struct MeshModel {
|
||||
/// Kernel-owned source for a view-dependent silhouette.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct CurvedGen {
|
||||
pub source: cadkernel::brep::mesh::SilhouetteSource,
|
||||
pub source: kernel::brep::mesh::SilhouetteSource,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default)]
|
||||
@@ -63,7 +63,7 @@ pub struct MeshMetrics {
|
||||
}
|
||||
|
||||
impl MeshMetrics {
|
||||
fn apply_mass_properties(&mut self, properties: cadkernel::brep::MassProperties) {
|
||||
fn apply_mass_properties(&mut self, properties: kernel::brep::MassProperties) {
|
||||
self.volume = properties.volume;
|
||||
self.centroid = properties.centroid;
|
||||
self.moment_of_inertia = properties.moment_of_inertia;
|
||||
@@ -76,7 +76,7 @@ impl MeshMetrics {
|
||||
pub fn translate(&mut self, delta: [f64; 3]) {
|
||||
if self.volume > 1e-18 {
|
||||
self.apply_mass_properties(
|
||||
cadkernel::brep::MassProperties {
|
||||
kernel::brep::MassProperties {
|
||||
volume: self.volume,
|
||||
centroid: self.centroid,
|
||||
moment_of_inertia: self.moment_of_inertia,
|
||||
@@ -106,7 +106,7 @@ pub struct MeshLodSet {
|
||||
/// `triangle_material_handles`. Only handles actually referenced by the
|
||||
/// tessellation are retained.
|
||||
pub face_materials:
|
||||
rustc_hash::FxHashMap<acadrust::Handle, super::material_model::MeshMaterial>,
|
||||
rustc_hash::FxHashMap<codec::Handle, super::material_model::MeshMaterial>,
|
||||
/// Effective AcDbVisualStyle override resolved from the entity's full,
|
||||
/// face and edge style handles.
|
||||
pub visual_style: Option<super::visual_style_model::MeshVisualStyle>,
|
||||
@@ -141,9 +141,9 @@ pub struct MeshLodSet {
|
||||
/// block entity. Top-level meshes leave this empty.
|
||||
pub instance_source: Option<std::sync::Arc<MeshInstanceSource>>,
|
||||
/// Accumulated block-local → world transform for this rendered instance.
|
||||
pub instance_transform: Option<acadrust::types::Transform>,
|
||||
pub instance_transform: Option<codec::types::Transform>,
|
||||
/// Parent INSERT selected for this rendered block instance.
|
||||
pub instance_handle: Option<acadrust::Handle>,
|
||||
pub instance_handle: Option<codec::Handle>,
|
||||
/// Effective colour after INSERT inheritance, without copying the mesh.
|
||||
pub instance_color: Option<[f32; 4]>,
|
||||
/// Precise world bounds used by the interaction index.
|
||||
@@ -152,7 +152,7 @@ pub struct MeshLodSet {
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct MeshInstanceSource {
|
||||
pub handle: acadrust::Handle,
|
||||
pub handle: codec::Handle,
|
||||
pub lods: Vec<MeshModel>,
|
||||
pub edge_verts: Vec<[f32; 3]>,
|
||||
pub edge_verts_low: Vec<[f32; 3]>,
|
||||
@@ -184,7 +184,7 @@ fn compute_mesh_metrics(lods: &[MeshModel]) -> MeshMetrics {
|
||||
let Some(mesh) = lods.iter().find(|mesh| !mesh.indices.is_empty()) else {
|
||||
return MeshMetrics::default();
|
||||
};
|
||||
let kernel_mesh = cadkernel::brep::Mesh {
|
||||
let kernel_mesh = kernel::brep::Mesh {
|
||||
positions: mesh
|
||||
.verts
|
||||
.iter()
|
||||
@@ -226,7 +226,7 @@ fn compute_mesh_metrics(lods: &[MeshModel]) -> MeshMetrics {
|
||||
}
|
||||
|
||||
impl MeshLodSet {
|
||||
pub fn apply_mass_properties(&mut self, properties: cadkernel::brep::MassProperties) {
|
||||
pub fn apply_mass_properties(&mut self, properties: kernel::brep::MassProperties) {
|
||||
self.metrics.apply_mass_properties(properties);
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ impl MeshLodSet {
|
||||
self.z_aabb = z;
|
||||
}
|
||||
|
||||
pub fn prepare_instance_source(&mut self, handle: acadrust::Handle) {
|
||||
pub fn prepare_instance_source(&mut self, handle: codec::Handle) {
|
||||
self.instance_source = Some(std::sync::Arc::new(MeshInstanceSource {
|
||||
handle,
|
||||
lods: self.lods.clone(),
|
||||
@@ -300,12 +300,12 @@ impl MeshLodSet {
|
||||
)
|
||||
}
|
||||
|
||||
pub fn entity_handle(&self) -> Option<acadrust::Handle> {
|
||||
pub fn entity_handle(&self) -> Option<codec::Handle> {
|
||||
self.instance_handle.or_else(|| {
|
||||
self.lods
|
||||
.first()
|
||||
.and_then(|mesh| mesh.name.parse::<u64>().ok())
|
||||
.map(acadrust::Handle::new)
|
||||
.map(codec::Handle::new)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user