forked from 1b-agent/opencadstudio-upstream
Merge remote-tracking branch 'origin/main' into plugin/host-model-api
# Conflicts: # crates/ocs_plugin_api/src/process/v4.rs # src/app/update/mod.rs
This commit is contained in:
commit
8648225ac5
309 files changed
+81166
-4157
No files matched your search
+31
-10
@@ -134,7 +134,7 @@ impl Scene {
|
||||
let _ = self.document.layers.add(layer);
|
||||
}
|
||||
|
||||
fn ensure_app_id(&mut self, name: &str) {
|
||||
pub(super) fn ensure_app_id(&mut self, name: &str) {
|
||||
if name.trim().is_empty() || self.document.app_ids.contains(name) {
|
||||
return;
|
||||
}
|
||||
@@ -2156,19 +2156,19 @@ impl Scene {
|
||||
|
||||
fn populate_images_from_document_unbumped(&mut self) {
|
||||
self.images.clear();
|
||||
let entries: Vec<(Handle, acadrust::entities::RasterImage)> = self
|
||||
let entries: Vec<(Handle, acadrust::entities::EntityType)> = self
|
||||
.document
|
||||
.entities()
|
||||
.filter_map(|e| {
|
||||
if let EntityType::RasterImage(img) = e {
|
||||
Some((img.common.handle, img.clone()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
.filter(|e| {
|
||||
matches!(
|
||||
e,
|
||||
EntityType::RasterImage(_) | EntityType::Ole2Frame(_) | EntityType::Underlay(_)
|
||||
)
|
||||
})
|
||||
.map(|e| (e.common().handle, e.clone()))
|
||||
.collect();
|
||||
for (handle, img) in entries {
|
||||
if let Some(model) = ImageModel::from_raster_image(&img) {
|
||||
for (handle, entity) in entries {
|
||||
if let Some(model) = self.image_seed_for(&entity) {
|
||||
self.images.insert(handle, model);
|
||||
}
|
||||
}
|
||||
@@ -2712,4 +2712,25 @@ impl Scene {
|
||||
self.named_parameters = crate::scene::named_parameters::ParameterTable::new();
|
||||
self.bump_geometry();
|
||||
}
|
||||
|
||||
/// Reset to the drawing File → New produces. Every path that starts a
|
||||
/// fresh drawing (the New tab, CLEAR, the automation `new` op) goes
|
||||
/// through here so they all agree on what a blank drawing contains.
|
||||
pub fn reset_to_new_drawing(&mut self) {
|
||||
self.clear();
|
||||
self.populate_new_drawing_defaults();
|
||||
}
|
||||
|
||||
/// What a blank document gets on top of the codec's defaults: the
|
||||
/// standard linetypes and a compatible page setup on every paper layout.
|
||||
pub fn populate_new_drawing_defaults(&mut self) {
|
||||
crate::io::linetypes::populate_document(&mut self.document);
|
||||
for obj in self.document.objects.values_mut() {
|
||||
if let acadrust::objects::ObjectType::Layout(l) = obj {
|
||||
if l.name != "Model" {
|
||||
crate::scene::apply_default_page_setup(l, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user