|
@@ -20,9 +20,9 @@ pub struct ExportObject {
|
|
|
impl ExportObject {
|
|
|
pub fn export(&self, layers: &ArrayOf<Layer>) {
|
|
|
debug!(
|
|
|
- "Exporting object {} in layer {} to '{}'",
|
|
|
- self.object,
|
|
|
+ "Exporting layer #{} object #{} to '{}'",
|
|
|
self.layer,
|
|
|
+ self.object,
|
|
|
self.path.to_string_lossy()
|
|
|
);
|
|
|
|
|
@@ -46,14 +46,19 @@ impl ExportObject {
|
|
|
#[serde(rename_all = "PascalCase")]
|
|
|
pub struct ImportObject {
|
|
|
layer: usize,
|
|
|
+ object: Option<usize>,
|
|
|
path: PathBuf,
|
|
|
}
|
|
|
|
|
|
impl ImportObject {
|
|
|
pub fn import(&self, layers: &mut ArrayOf<Layer>) {
|
|
|
debug!(
|
|
|
- "Importing object to layer {} from '{}'",
|
|
|
+ "Importing layer #{}{} from '{}'",
|
|
|
self.layer,
|
|
|
+ match &self.object {
|
|
|
+ Some(object) => format!(" object #{}", object),
|
|
|
+ None => String::new(),
|
|
|
+ },
|
|
|
self.path.to_string_lossy(),
|
|
|
);
|
|
|
|
|
@@ -69,6 +74,11 @@ impl ImportObject {
|
|
|
|
|
|
let layer: &mut Layer = layers.get_mut(self.layer).expect("Invalid layer index");
|
|
|
|
|
|
- (*layer.objects).push(object);
|
|
|
+ if let Some(index) = self.object {
|
|
|
+ let dst: &mut Object = layer.objects.get_mut(index).expect("Invalid object index");
|
|
|
+ *dst = object;
|
|
|
+ } else {
|
|
|
+ (*layer.objects).push(object);
|
|
|
+ }
|
|
|
}
|
|
|
}
|