forked from 1b-agent/opencadstudio-upstream
fix(solids): keep history-less solids without history on edge fillet/chamfer; undo the evaluation graph
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
558b5f6526
commit
eb90b68129
4 files changed
+30
-35
No files matched your search
Generated
+1
-1
@@ -4206,7 +4206,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "opencadcodec"
|
name = "opencadcodec"
|
||||||
version = "0.5.5"
|
version = "0.5.5"
|
||||||
source = "git+https://github.com/HakanSeven12/opencadcodec.git?rev=d28fd71#d28fd710268e7301798703d3ca9c5698a1af91ed"
|
source = "git+https://github.com/ramox81/cadcodec.git?rev=25227f5#25227f504006d62373c44d5064116607865b813a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ahash 0.8.12",
|
"ahash 0.8.12",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
|
|||||||
@@ -90,6 +90,10 @@ objc2-app-kit = { version = "0.2", features = ["NSApplication", "NSResponder", "
|
|||||||
block2 = "0.5"
|
block2 = "0.5"
|
||||||
objc2-foundation = { version = "0.2", features = ["NSArray", "NSURL", "NSString", "NSObject", "NSNotification", "NSThread", "NSEnumerator"] }
|
objc2-foundation = { version = "0.2", features = ["NSArray", "NSURL", "NSString", "NSObject", "NSNotification", "NSThread", "NSEnumerator"] }
|
||||||
|
|
||||||
|
# Solid history evaluation graphs and history node layouts (opencadcodec PR pending).
|
||||||
|
[patch."https://github.com/HakanSeven12/opencadcodec.git"]
|
||||||
|
opencadcodec = { git = "https://github.com/ramox81/cadcodec.git", rev = "25227f5" }
|
||||||
|
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
iced_core = { git = "https://github.com/iced-rs/iced.git", rev = "23604ff22ab0aad9e00b9327cb7b8546ed84db39" }
|
iced_core = { git = "https://github.com/iced-rs/iced.git", rev = "23604ff22ab0aad9e00b9327cb7b8546ed84db39" }
|
||||||
iced_widget = { git = "https://github.com/iced-rs/iced.git", rev = "23604ff22ab0aad9e00b9327cb7b8546ed84db39" }
|
iced_widget = { git = "https://github.com/iced-rs/iced.git", rev = "23604ff22ab0aad9e00b9327cb7b8546ed84db39" }
|
||||||
|
|||||||
+19
-30
@@ -655,16 +655,9 @@ impl super::OpenCADStudio {
|
|||||||
};
|
};
|
||||||
|
|
||||||
self.push_undo_snapshot(i, "FILLETEDGE");
|
self.push_undo_snapshot(i, "FILLETEDGE");
|
||||||
if self.tabs[i].scene.document.solid_history_graph(handle).is_none()
|
// A solid without history stays without one, as in the reference.
|
||||||
&& !self.tabs[i]
|
let has_history = self.tabs[i].scene.document.solid_history_graph(handle).is_some();
|
||||||
.scene
|
if has_history && !self.tabs[i].scene.append_solid_history(
|
||||||
.create_solid_history(handle, solid_history::brep_op(source))
|
|
||||||
{
|
|
||||||
self.command_line
|
|
||||||
.push_error(crate::t!("The edge body history could not be created.").as_ref());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if !self.tabs[i].scene.append_solid_history(
|
|
||||||
handle,
|
handle,
|
||||||
solid_history::fillet_op(history_edges, radius),
|
solid_history::fillet_op(history_edges, radius),
|
||||||
) {
|
) {
|
||||||
@@ -672,11 +665,13 @@ impl super::OpenCADStudio {
|
|||||||
.push_error(crate::t!("The fillet history could not be recorded.").as_ref());
|
.push_error(crate::t!("The fillet history could not be recorded.").as_ref());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
let _ = self.tabs[i].scene.apply_solid_history_choice(
|
if has_history {
|
||||||
handle,
|
let _ = self.tabs[i].scene.apply_solid_history_choice(
|
||||||
solid_history::PROP_HISTORY,
|
handle,
|
||||||
"Record",
|
solid_history::PROP_HISTORY,
|
||||||
);
|
"Record",
|
||||||
|
);
|
||||||
|
}
|
||||||
let Some(entity) = self.tabs[i].scene.document.get_entity(handle).cloned() else {
|
let Some(entity) = self.tabs[i].scene.document.get_entity(handle).cloned() else {
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
@@ -743,16 +738,8 @@ impl super::OpenCADStudio {
|
|||||||
};
|
};
|
||||||
|
|
||||||
self.push_undo_snapshot(i, "CHAMFEREDGE");
|
self.push_undo_snapshot(i, "CHAMFEREDGE");
|
||||||
if self.tabs[i].scene.document.solid_history_graph(handle).is_none()
|
let has_history = self.tabs[i].scene.document.solid_history_graph(handle).is_some();
|
||||||
&& !self.tabs[i]
|
if has_history && !self.tabs[i].scene.append_solid_history(
|
||||||
.scene
|
|
||||||
.create_solid_history(handle, solid_history::brep_op(source))
|
|
||||||
{
|
|
||||||
self.command_line
|
|
||||||
.push_error(crate::t!("The edge body history could not be created.").as_ref());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if !self.tabs[i].scene.append_solid_history(
|
|
||||||
handle,
|
handle,
|
||||||
solid_history::chamfer_op(
|
solid_history::chamfer_op(
|
||||||
history_edges,
|
history_edges,
|
||||||
@@ -765,11 +752,13 @@ impl super::OpenCADStudio {
|
|||||||
.push_error(crate::t!("The chamfer history could not be recorded.").as_ref());
|
.push_error(crate::t!("The chamfer history could not be recorded.").as_ref());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
let _ = self.tabs[i].scene.apply_solid_history_choice(
|
if has_history {
|
||||||
handle,
|
let _ = self.tabs[i].scene.apply_solid_history_choice(
|
||||||
solid_history::PROP_HISTORY,
|
handle,
|
||||||
"Record",
|
solid_history::PROP_HISTORY,
|
||||||
);
|
"Record",
|
||||||
|
);
|
||||||
|
}
|
||||||
let Some(entity) = self.tabs[i].scene.document.get_entity(handle).cloned() else {
|
let Some(entity) = self.tabs[i].scene.document.get_entity(handle).cloned() else {
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|||||||
+6
-4
@@ -841,6 +841,7 @@ impl Scene {
|
|||||||
};
|
};
|
||||||
std::iter::once(graph.root)
|
std::iter::once(graph.root)
|
||||||
.chain(graph.nodes)
|
.chain(graph.nodes)
|
||||||
|
.chain(graph.evaluation_graph)
|
||||||
.filter_map(|object_handle| {
|
.filter_map(|object_handle| {
|
||||||
self.document
|
self.document
|
||||||
.objects
|
.objects
|
||||||
@@ -869,7 +870,7 @@ impl Scene {
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
self.record_undo_object_before(graph.root, None);
|
self.record_undo_object_before(graph.root, None);
|
||||||
for node in graph.nodes {
|
for node in graph.nodes.into_iter().chain(graph.evaluation_graph) {
|
||||||
self.record_undo_object_before(node, None);
|
self.record_undo_object_before(node, None);
|
||||||
}
|
}
|
||||||
self.sync_solid_reference_point(handle);
|
self.sync_solid_reference_point(handle);
|
||||||
@@ -881,16 +882,17 @@ impl Scene {
|
|||||||
handle: Handle,
|
handle: Handle,
|
||||||
operation: codec::objects::SolidHistoryOperation,
|
operation: codec::objects::SolidHistoryOperation,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
let previous = self
|
let previous: Vec<Handle> = self
|
||||||
.document
|
.document
|
||||||
.solid_history_graph(handle)
|
.solid_history_graph(handle)
|
||||||
.map(|graph| graph.nodes)
|
.map(|graph| graph.nodes.into_iter().chain(graph.evaluation_graph).collect())
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
self.record_solid_history_before(handle);
|
self.record_solid_history_before(handle);
|
||||||
let Some(graph) = self.document.append_solid_history(handle, operation) else {
|
let Some(graph) = self.document.append_solid_history(handle, operation) else {
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
for node in graph.nodes {
|
// A history saved without an evaluation graph gets one on append.
|
||||||
|
for node in graph.nodes.into_iter().chain(graph.evaluation_graph) {
|
||||||
if !previous.contains(&node) {
|
if !previous.contains(&node) {
|
||||||
self.record_undo_object_before(node, None);
|
self.record_undo_object_before(node, None);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user