Give solid.move the copy half of its Move/Copy label (#498)
solid.move takes copy: true to keep the source bodies and transform a new copy of each, with a Create Copy box in the Move dialog. Designs without it save and load exactly as before.
This commit is contained in:
1 parent
69e54f85d2
commit
7d00df0a3f
15 files changed
+395
-11
No files matched your search
@@ -226,6 +226,9 @@ pub fn params(app: &SolveApp, d: &Dialog) -> Result<Value, String> {
|
||||
p["translate"] = num(at - from);
|
||||
}
|
||||
}
|
||||
if d.extra.get("copy").and_then(Value::as_bool).unwrap_or(false) {
|
||||
p["copy"] = json!(true);
|
||||
}
|
||||
Ok(p)
|
||||
}
|
||||
|
||||
@@ -285,7 +288,7 @@ pub fn drag(app: &SolveApp, d: &mut Dialog, g: Drag) {
|
||||
|
||||
/// The dialog for editing a move: Free Move with its translation and, about a world axis
|
||||
/// through the origin, its angle (another axis is kept as it is).
|
||||
pub fn for_feature(d: &mut Dialog, bodies: &[String], translate: &[String; 3], axis: Option<Vec3>, angle: Option<&String>) {
|
||||
pub fn for_feature(d: &mut Dialog, bodies: &[String], translate: &[String; 3], axis: Option<Vec3>, angle: Option<&String>, copy: bool) {
|
||||
let [x, y, z] = translate.clone();
|
||||
let mut k = kind(FREE);
|
||||
if let Kind::Move { x: kx, y: ky, z: kz, rx, ry, rz, .. } = &mut k {
|
||||
@@ -311,4 +314,7 @@ pub fn for_feature(d: &mut Dialog, bodies: &[String], translate: &[String; 3], a
|
||||
if let Some(inp) = d.inputs.first_mut() {
|
||||
inp.items = bodies.iter().map(|n| Sel::Body { name: n.clone() }).collect();
|
||||
}
|
||||
if copy {
|
||||
d.extra.insert("copy".into(), json!(true));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user