0: cord-gui cleanup: strip cruft, drop unused dep, fix license
This commit is contained in:
parent
97653580e5
commit
72c0e3c259
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -323,7 +323,6 @@ impl App {
|
|||
added = true;
|
||||
}
|
||||
if !added {
|
||||
// Force a re-render even if nothing new
|
||||
self.reparse();
|
||||
}
|
||||
}
|
||||
|
|
@ -474,8 +473,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 {
|
||||
|
|
@ -489,7 +486,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);
|
||||
|
|
@ -497,7 +493,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);
|
||||
|
|
@ -505,7 +500,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..] {
|
||||
|
|
@ -1092,7 +1086,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",
|
||||
|
|
@ -1273,7 +1267,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)
|
||||
|
|
@ -1423,7 +1417,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();
|
||||
|
|
@ -1849,7 +1843,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)>,
|
||||
|
|
@ -1862,8 +1855,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 {
|
||||
|
|
@ -1906,7 +1897,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) => {
|
||||
|
|
@ -1934,8 +1924,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();
|
||||
|
||||
|
|
@ -1974,7 +1963,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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue