|
@@ -1,3 +1,5 @@
|
|
|
+use std::fmt::Debug;
|
|
|
+
|
|
|
use binrw::{BinRead, BinWrite};
|
|
|
use modular_bitfield::{
|
|
|
bitfield,
|
|
@@ -36,7 +38,7 @@ pub struct HatchLine {
|
|
|
lines: ArrayOf<Lines>,
|
|
|
}
|
|
|
|
|
|
-#[derive(BinRead, BinWrite, Debug)]
|
|
|
+#[derive(BinRead, BinWrite)]
|
|
|
#[brw(magic(46u32))] // Number of fields in this struct
|
|
|
pub struct HatchSettings1 {
|
|
|
pub mark_contour: U32,
|
|
@@ -62,7 +64,29 @@ pub struct HatchSettings1 {
|
|
|
_unknown_7: [Field; 3],
|
|
|
}
|
|
|
|
|
|
-#[derive(BinRead, BinWrite, Debug)]
|
|
|
+// Custom Debug implementation to only print known fields
|
|
|
+impl Debug for HatchSettings1 {
|
|
|
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
|
+ f.debug_struct("HatchSettings1")
|
|
|
+ .field("mark_contour", &self.mark_contour)
|
|
|
+ .field("pen", &self.pen)
|
|
|
+ .field("flags", &self.flags)
|
|
|
+ .field("edge_offset", &self.edge_offset)
|
|
|
+ .field("line_spacing", &self.line_spacing)
|
|
|
+ .field("start_offset", &self.start_offset)
|
|
|
+ .field("end_offset", &self.end_offset)
|
|
|
+ .field("angle", &self.angle)
|
|
|
+ .field("auto_rotate_angle", &self.auto_rotate_angle)
|
|
|
+ .field("line_reduction", &self.line_reduction)
|
|
|
+ .field("loop_count", &self.loop_count)
|
|
|
+ .field("loop_distance", &self.loop_distance)
|
|
|
+ .field("contour_first", &self.contour_first)
|
|
|
+ .field("count", &self.count)
|
|
|
+ .finish()
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+#[derive(BinRead, BinWrite)]
|
|
|
#[brw(magic(15u32))] // Number of fields in this struct
|
|
|
pub struct HatchSettings2 {
|
|
|
pub count: U32,
|
|
@@ -81,7 +105,27 @@ pub struct HatchSettings2 {
|
|
|
_unknown_2: [Field; 2],
|
|
|
}
|
|
|
|
|
|
-#[derive(BinRead, BinWrite, Debug)]
|
|
|
+// Custom Debug implementation to only print known fields
|
|
|
+impl Debug for HatchSettings2 {
|
|
|
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
|
+ f.debug_struct("HatchSettings2")
|
|
|
+ .field("count", &self.count)
|
|
|
+ .field("pen", &self.pen)
|
|
|
+ .field("flags", &self.flags)
|
|
|
+ .field("edge_offset", &self.edge_offset)
|
|
|
+ .field("line_spacing", &self.line_spacing)
|
|
|
+ .field("start_offset", &self.start_offset)
|
|
|
+ .field("end_offset", &self.end_offset)
|
|
|
+ .field("angle", &self.angle)
|
|
|
+ .field("auto_rotate_angle", &self.auto_rotate_angle)
|
|
|
+ .field("line_reduction", &self.line_reduction)
|
|
|
+ .field("loop_distance", &self.loop_distance)
|
|
|
+ .field("loop_count", &self.loop_count)
|
|
|
+ .finish()
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+#[derive(BinRead, BinWrite)]
|
|
|
pub struct Hatch {
|
|
|
pub core: ObjectCore,
|
|
|
pub outline: ArrayOf<Object>,
|
|
@@ -97,3 +141,18 @@ pub struct Hatch {
|
|
|
_unknown_6: [Field; 13],
|
|
|
pub lines: ArrayOf<HatchLine>,
|
|
|
}
|
|
|
+
|
|
|
+// Custom Debug implementation to only print known fields
|
|
|
+impl Debug for Hatch {
|
|
|
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
|
+ f.debug_struct("Hatch")
|
|
|
+ .field("core", &self.core)
|
|
|
+ .field("outline", &self.outline)
|
|
|
+ .field("settings_1", &self.settings_1)
|
|
|
+ .field("settings_2", &self.settings_2)
|
|
|
+ .field("pen", &self.pen)
|
|
|
+ .field("name", &self.name)
|
|
|
+ .field("lines", &self.lines)
|
|
|
+ .finish()
|
|
|
+ }
|
|
|
+}
|