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
@@ -547,7 +547,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_donut_polyline_tessellates_to_analytical_arcs() {
|
||||
use acadrust::CadDocument;
|
||||
use codec::CadDocument;
|
||||
let mut doc = CadDocument::new();
|
||||
let donut = crate::modules::draw::draw::donut::make_donut(10.0, 20.0, 0.0, 10.0, 30.0);
|
||||
let h = doc.add_entity(donut).unwrap();
|
||||
|
||||
@@ -107,7 +107,7 @@ fn color_at(bytes: &[u8], ndc_x: f32) -> [u32; 3] {
|
||||
#[test]
|
||||
#[ignore = "requires a GPU adapter"]
|
||||
fn wipeout_respects_close_block_draw_order() {
|
||||
use acadrust::{entities::Wipeout, types::Vector2, EntityType};
|
||||
use codec::{entities::Wipeout, types::Vector2, EntityType};
|
||||
use crate::scene::{model::wire_model::TangentGeom, Scene};
|
||||
|
||||
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor::new_without_display_handle());
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use super::*;
|
||||
use crate::scene::model::{mesh_model::MeshLodSet, mesh_model::MeshModel, wire_model::WireModel};
|
||||
use acadrust::{types::Transform, Handle};
|
||||
use codec::{types::Transform, Handle};
|
||||
use iced::futures::executor::block_on;
|
||||
|
||||
#[test]
|
||||
@@ -469,7 +469,7 @@ fn test_selected_circle_arc_ellipse_highlight_overlay() {
|
||||
radius: 10.0,
|
||||
});
|
||||
|
||||
let handle = acadrust::Handle::new(100);
|
||||
let handle = codec::Handle::new(100);
|
||||
let mut selected_handles = rustc_hash::FxHashSet::default();
|
||||
selected_handles.insert(handle);
|
||||
let hover_handles = rustc_hash::FxHashSet::default();
|
||||
@@ -779,7 +779,7 @@ fn test_selected_ellipse_overlay() {
|
||||
end_param: std::f64::consts::TAU,
|
||||
});
|
||||
|
||||
let handle = acadrust::Handle::new(200);
|
||||
let handle = codec::Handle::new(200);
|
||||
let mut selected_handles = rustc_hash::FxHashSet::default();
|
||||
selected_handles.insert(handle);
|
||||
let hover_handles = rustc_hash::FxHashSet::default();
|
||||
@@ -888,7 +888,7 @@ fn test_pline_arc_switch_preview_and_render() {
|
||||
let mut cmd = crate::modules::draw::draw::polyline::PlineCommand::new();
|
||||
cmd.on_point(glam::DVec3::new(0.0, 0.0, 0.0));
|
||||
let _res = cmd.on_point(glam::DVec3::new(10.0, 0.0, 0.0));
|
||||
cmd.set_live_handle(acadrust::Handle::new(1));
|
||||
cmd.set_live_handle(codec::Handle::new(1));
|
||||
cmd.on_text_input("A");
|
||||
|
||||
let test_points = [
|
||||
|
||||
@@ -225,7 +225,7 @@ impl MeshInstanceGpu {
|
||||
}
|
||||
}
|
||||
|
||||
fn from_transform(transform: acadrust::types::Transform) -> Self {
|
||||
fn from_transform(transform: codec::types::Transform) -> Self {
|
||||
let m = transform.matrix.m;
|
||||
let translation = [m[0][3], m[1][3], m[2][3]];
|
||||
let translation_high = [
|
||||
@@ -355,7 +355,7 @@ pub struct MeshBatchChunk {
|
||||
pub instance_buffer: wgpu::Buffer,
|
||||
pub instance_count: u32,
|
||||
pub highlight_ranges: Vec<MeshBatchRange>,
|
||||
pub handles: rustc_hash::FxHashSet<acadrust::Handle>,
|
||||
pub handles: rustc_hash::FxHashSet<codec::Handle>,
|
||||
pub material: Option<crate::scene::model::material_model::MeshMaterial>,
|
||||
pub face_color: [f32; 4],
|
||||
pub material_bind_group: Option<wgpu::BindGroup>,
|
||||
@@ -363,7 +363,7 @@ pub struct MeshBatchChunk {
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct MeshBatchRange {
|
||||
pub handle: acadrust::Handle,
|
||||
pub handle: codec::Handle,
|
||||
pub index_start: u32,
|
||||
pub index_count: u32,
|
||||
pub transparent: bool,
|
||||
@@ -407,7 +407,7 @@ fn make_chunk(
|
||||
edge_verts: &[MeshEdgeVertex],
|
||||
highlight_ranges: &[MeshBatchRange],
|
||||
instances: &[MeshInstanceGpu],
|
||||
handles: &rustc_hash::FxHashSet<acadrust::Handle>,
|
||||
handles: &rustc_hash::FxHashSet<codec::Handle>,
|
||||
_bounds_override: Option<[f32; 6]>,
|
||||
material: Option<&crate::scene::model::material_model::MeshMaterial>,
|
||||
face_color: [f32; 4],
|
||||
@@ -1092,7 +1092,7 @@ struct MeshBatchPart<'a> {
|
||||
set: &'a MeshLodSet,
|
||||
mesh: &'a MeshModel,
|
||||
uv_mesh: &'a MeshModel,
|
||||
entity_handle: Option<acadrust::Handle>,
|
||||
entity_handle: Option<codec::Handle>,
|
||||
display_color: [f32; 4],
|
||||
material: Option<&'a crate::scene::model::material_model::MeshMaterial>,
|
||||
color: [f32; 4],
|
||||
@@ -1882,7 +1882,7 @@ pub fn build_mesh_batch_filtered(
|
||||
device: &wgpu::Device,
|
||||
queue: &wgpu::Queue,
|
||||
sets: &[MeshLodSet],
|
||||
handles: Option<&rustc_hash::FxHashSet<acadrust::Handle>>,
|
||||
handles: Option<&rustc_hash::FxHashSet<codec::Handle>>,
|
||||
) -> (Vec<MeshBatchChunk>, u64) {
|
||||
let perf_started = crate::perf::enabled().then(iced::time::Instant::now);
|
||||
// Derive the caps from the real device limit and vertex size. The previous
|
||||
@@ -1903,7 +1903,7 @@ pub fn build_mesh_batch_filtered(
|
||||
let mut wire_indices: Vec<u32> = Vec::new();
|
||||
let mut edge_verts: Vec<MeshEdgeVertex> = Vec::new();
|
||||
let mut highlight_ranges: Vec<MeshBatchRange> = Vec::new();
|
||||
let mut chunk_handles: rustc_hash::FxHashSet<acadrust::Handle> =
|
||||
let mut chunk_handles: rustc_hash::FxHashSet<codec::Handle> =
|
||||
rustc_hash::FxHashSet::default();
|
||||
let mut total_tris = 0u64;
|
||||
let mut ordered: Vec<MeshBatchPart<'_>> = Vec::new();
|
||||
|
||||
+20
-20
@@ -69,7 +69,7 @@ struct SilhouetteChunk {
|
||||
|
||||
struct SilhouetteSourceGroup {
|
||||
color: [f32; 4],
|
||||
sources: Vec<cadkernel::brep::mesh::SilhouetteSource>,
|
||||
sources: Vec<kernel::brep::mesh::SilhouetteSource>,
|
||||
instance_buffers: Vec<(wgpu::Buffer, u32)>,
|
||||
}
|
||||
use device_capabilities::DeviceCapabilities;
|
||||
@@ -273,11 +273,11 @@ pub struct Pipeline {
|
||||
/// GPU buffer. `Some(false)` = regular wires, `Some(true)` = mesh edges.
|
||||
pub(crate) wire_arena_fallback: std::sync::Arc<Vec<WireGpu>>,
|
||||
pub(crate) wire_arena_fallback_kind: Option<bool>,
|
||||
pub(crate) wire_arena_fallback_handles: rustc_hash::FxHashSet<acadrust::Handle>,
|
||||
pub(crate) wire_arena_fallback_handles: rustc_hash::FxHashSet<codec::Handle>,
|
||||
/// The Model content id both arenas currently mirror (`u64::MAX` = none).
|
||||
pub(crate) wire_arena_id: u64,
|
||||
/// Handles that contributed to this slot's retained analytical uploads.
|
||||
pub(crate) partition_contributors: rustc_hash::FxHashSet<acadrust::Handle>,
|
||||
pub(crate) partition_contributors: rustc_hash::FxHashSet<codec::Handle>,
|
||||
/// The draw-depth generation those uploads baked. A full depth rebuild
|
||||
/// reassigns every label, so they stop being reusable when it moves.
|
||||
pub(crate) partition_depth_generation: u64,
|
||||
@@ -322,14 +322,14 @@ pub struct Pipeline {
|
||||
/// repacked here, keeping the rest of a multi-million-triangle scene resident.
|
||||
gpu_mesh_dynamic: Vec<mesh_gpu::MeshBatchChunk>,
|
||||
mesh_disabled_chunks: rustc_hash::FxHashSet<usize>,
|
||||
mesh_dynamic_handles: rustc_hash::FxHashSet<acadrust::Handle>,
|
||||
mesh_dynamic_handles: rustc_hash::FxHashSet<codec::Handle>,
|
||||
/// Wire content generation whose geometry the static+dynamic mesh state
|
||||
/// mirrors. It gates replay of the same per-entity journal handoff.
|
||||
pub cached_mesh_content_id: u64,
|
||||
/// Draw ranges for each entity inside the resident mesh chunks. Highlight
|
||||
/// overlays reuse these buffers instead of uploading duplicate geometry.
|
||||
mesh_ranges_by_handle:
|
||||
rustc_hash::FxHashMap<acadrust::Handle, Vec<MeshResidentRange>>,
|
||||
rustc_hash::FxHashMap<codec::Handle, Vec<MeshResidentRange>>,
|
||||
mesh_highlight_draws: Vec<MeshHighlightDraw>,
|
||||
/// `(geometry_epoch, selection_generation)` the highlight overlay was built for.
|
||||
pub cached_highlight_key: (u64, u64),
|
||||
@@ -2724,8 +2724,8 @@ impl Pipeline {
|
||||
device: &wgpu::Device,
|
||||
queue: &wgpu::Queue,
|
||||
wires: &[WireModel],
|
||||
selected: &rustc_hash::FxHashSet<acadrust::Handle>,
|
||||
hovered: &rustc_hash::FxHashSet<acadrust::Handle>,
|
||||
selected: &rustc_hash::FxHashSet<codec::Handle>,
|
||||
hovered: &rustc_hash::FxHashSet<codec::Handle>,
|
||||
annotation_context_wires: &[WireModel],
|
||||
depth_map: &rustc_hash::FxHashMap<u64, [f32; 2]>,
|
||||
selected_tint: Option<[f32; 4]>,
|
||||
@@ -2907,8 +2907,8 @@ analytic={:.1} regular={:.1} blocks={:.1}",
|
||||
device: &wgpu::Device,
|
||||
queue: &wgpu::Queue,
|
||||
wires: &[WireModel],
|
||||
selected: &rustc_hash::FxHashSet<acadrust::Handle>,
|
||||
hovered: &rustc_hash::FxHashSet<acadrust::Handle>,
|
||||
selected: &rustc_hash::FxHashSet<codec::Handle>,
|
||||
hovered: &rustc_hash::FxHashSet<codec::Handle>,
|
||||
annotation_context_wires: &[WireModel],
|
||||
depth_map: &rustc_hash::FxHashMap<u64, [f32; 2]>,
|
||||
selected_tint: Option<[f32; 4]>,
|
||||
@@ -3210,20 +3210,20 @@ analytic={:.1} regular={:.1} blocks={:.1}",
|
||||
for generator in generators {
|
||||
if let Some(transform) = source.instance_transform {
|
||||
let origin =
|
||||
transform.apply(acadrust::types::Vector3::ZERO);
|
||||
transform.apply(codec::types::Vector3::ZERO);
|
||||
let vectors = [
|
||||
transform.apply_rotation(
|
||||
acadrust::types::Vector3::UNIT_X,
|
||||
codec::types::Vector3::UNIT_X,
|
||||
),
|
||||
transform.apply_rotation(
|
||||
acadrust::types::Vector3::UNIT_Y,
|
||||
codec::types::Vector3::UNIT_Y,
|
||||
),
|
||||
transform.apply_rotation(
|
||||
acadrust::types::Vector3::UNIT_Z,
|
||||
codec::types::Vector3::UNIT_Z,
|
||||
),
|
||||
];
|
||||
if let Some(transformed) =
|
||||
cadkernel::brep::mesh::transform_silhouette_affine(
|
||||
kernel::brep::mesh::transform_silhouette_affine(
|
||||
&generator.source,
|
||||
vectors.map(|vector| [vector.x, vector.y, vector.z]),
|
||||
[origin.x, origin.y, origin.z],
|
||||
@@ -3252,7 +3252,7 @@ analytic={:.1} regular={:.1} blocks={:.1}",
|
||||
let compute_group = |group: &SilhouetteSourceGroup| {
|
||||
let mut points = Vec::new();
|
||||
for source in &group.sources {
|
||||
points.extend(cadkernel::brep::mesh::silhouette(
|
||||
points.extend(kernel::brep::mesh::silhouette(
|
||||
source,
|
||||
[view.x, view.y, view.z],
|
||||
));
|
||||
@@ -3599,7 +3599,7 @@ analytic={:.1} regular={:.1} blocks={:.1}",
|
||||
device: &wgpu::Device,
|
||||
queue: &wgpu::Queue,
|
||||
meshes: &[MeshLodSet],
|
||||
changes: &[(acadrust::Handle, crate::scene::ChangeKind)],
|
||||
changes: &[(codec::Handle, crate::scene::ChangeKind)],
|
||||
) -> bool {
|
||||
let started = iced::time::Instant::now();
|
||||
if self.gpu_mesh_batch.is_empty() || changes.is_empty() {
|
||||
@@ -3669,15 +3669,15 @@ analytic={:.1} regular={:.1} blocks={:.1}",
|
||||
/// chunk buffers; changing hover never allocates or uploads mesh geometry.
|
||||
pub fn update_mesh_highlight(
|
||||
&mut self,
|
||||
selected: &rustc_hash::FxHashSet<acadrust::Handle>,
|
||||
hovered: &rustc_hash::FxHashSet<acadrust::Handle>,
|
||||
selected: &rustc_hash::FxHashSet<codec::Handle>,
|
||||
hovered: &rustc_hash::FxHashSet<codec::Handle>,
|
||||
edge_wires: &[WireModel],
|
||||
) {
|
||||
let edge_handles: rustc_hash::FxHashSet<acadrust::Handle> = edge_wires
|
||||
let edge_handles: rustc_hash::FxHashSet<codec::Handle> = edge_wires
|
||||
.iter()
|
||||
.filter_map(|wire| wire.name.strip_prefix("mesh-edge:"))
|
||||
.filter_map(|value| value.parse::<u64>().ok())
|
||||
.map(acadrust::Handle::new)
|
||||
.map(codec::Handle::new)
|
||||
.collect();
|
||||
let mut out = Vec::new();
|
||||
for handle in selected
|
||||
|
||||
@@ -40,7 +40,7 @@ use super::wire_gpu::{
|
||||
};
|
||||
use crate::scene::model::wire_model::WireModel;
|
||||
use crate::scene::ChangeKind;
|
||||
use acadrust::Handle;
|
||||
use codec::Handle;
|
||||
use iced::wgpu;
|
||||
use rustc_hash::FxHashMap;
|
||||
|
||||
|
||||
Reference in new issue
Block a user