merge integration

This commit is contained in:
jess 2026-03-31 13:04:32 -07:00
commit 1ef80d9197
3 changed files with 5 additions and 19 deletions

View File

@ -3,7 +3,7 @@ name = "cord-gui"
version = "0.1.0"
edition = "2021"
description = "Interactive GUI editor for Cord geometry"
license = "MIT"
license = "Unlicense"
repository = "https://github.com/pszsh/cord"
publish = false
@ -23,7 +23,6 @@ cord-expr = { path = "../cord-expr" }
iced = { version = "0.14", features = ["wgpu", "advanced", "markdown", "tokio", "canvas"] }
rfd = "0.15"
bytemuck = { version = "1", features = ["derive"] }
anyhow = "1"
serde_json = "1"
dirs = "6"
arboard = "3"

View File

@ -323,7 +323,6 @@ impl App {
added = true;
}
if !added {
// Force a re-render even if nothing new
self.reparse();
}
}
@ -476,8 +475,6 @@ impl App {
match parse_expr_scene(src) {
Ok(scene) => {
let mut graph = scene.graph;
// Collect all SDF roots: cast objects + plot expressions
let mut sdf_roots: Vec<cord_trig::ir::NodeId> = Vec::new();
let render_objects: Vec<(String, cord_trig::ir::NodeId)> = if scene.cast_all {
@ -491,7 +488,6 @@ impl App {
sdf_roots.push(id);
}
// Convert plot expressions to SDF geometry
let mut plot_nodes: Vec<cord_trig::ir::NodeId> = if scene.plot_all {
let mut nodes: Vec<_> = scene.all_vars.iter().map(|(_, id)| *id).collect();
nodes.extend(&scene.bare_exprs);
@ -499,7 +495,6 @@ impl App {
} else {
Vec::new()
};
// Always include explicit plot() targets and auto-instantiated functions
plot_nodes.extend(&scene.plots);
for &node_id in &plot_nodes {
let info = classify_from(&graph, node_id);
@ -507,7 +502,6 @@ impl App {
sdf_roots.push(sdf);
}
// Union all geometry
if sdf_roots.len() >= 2 {
let mut root = sdf_roots[0];
for &node in &sdf_roots[1..] {
@ -1112,7 +1106,7 @@ impl App {
InputMode::Expr => "expr",
InputMode::Scad => "scad",
};
let mut status_parts = format!("{mode_label}");
let mut status_parts = mode_label.to_string();
if let Some(ref info) = self.info {
status_parts += &format!(
" | {} | {}n | {}C",
@ -1293,7 +1287,7 @@ impl App {
];
let mut layers: Vec<Element<Message>> = vec![base_layout.into()];
if let Some(_) = self.context_menu_pos {
if self.context_menu_pos.is_some() {
layers.push(
mouse_area(container(Space::new()).width(Fill).height(Fill))
.on_press(Message::DismissOverlay)
@ -1443,7 +1437,7 @@ fn ttip<'a>(content: impl Into<Element<'a, Message>>, tip: &str) -> Element<'a,
.into()
}
// === Free functions (unchanged from original) ===
// === Free functions ===
fn build_notebook_md(src: &str) -> String {
let mut md = String::new();
@ -1802,7 +1796,6 @@ const TRANSFORM_FUNCS: &[&str] = &[
"rx", "ry", "rz", "mx", "my", "mz", "mov", "move",
];
/// Accumulated transform state — at most one of each kind.
#[derive(Default)]
struct TransformStack {
translate: Option<(f32, f32, f32)>,
@ -1815,8 +1808,6 @@ struct TransformStack {
mirror_z: bool,
}
/// Peel all outermost transform wrappers off an expression,
/// accumulating them into a TransformStack.
fn peel_transforms<'a>(expr: &'a str, stack: &mut TransformStack) -> &'a str {
let mut current = expr.trim();
loop {
@ -1859,7 +1850,6 @@ fn peel_transforms<'a>(expr: &'a str, stack: &mut TransformStack) -> &'a str {
current
}
/// Apply the new action to a TransformStack.
fn apply_action(stack: &mut TransformStack, action: &TransformAction) {
match action {
TransformAction::Translate(dx, dy, dz) => {
@ -1887,8 +1877,7 @@ fn apply_action(stack: &mut TransformStack, action: &TransformAction) {
}
}
/// Re-wrap an inner expression with the collapsed transform stack.
/// Order: mirror → scale → rotate → translate (inside-out).
// Order: mirror -> scale -> rotate -> translate (inside-out)
fn recompose_transforms(inner: &str, stack: &TransformStack) -> String {
let mut result = inner.to_string();
@ -1927,7 +1916,6 @@ fn recompose_transforms(inner: &str, stack: &TransformStack) -> String {
result
}
/// Peel all transforms, merge the new action, recompose as at-most-one-of-each.
fn apply_transform_collapsed(expr: &str, action: &TransformAction) -> String {
let mut stack = TransformStack::default();
let inner = peel_transforms(expr, &mut stack);

View File

@ -180,7 +180,6 @@ impl<Message: 'static> shader::Program<Message> for SdfViewport {
}
}
/// Mutable camera updates called from App::update
impl SdfViewport {
pub fn on_drag(&mut self, dx: f32, dy: f32) {
let sensitivity = 0.005;