|
@@ -57,7 +57,8 @@ struct QueryCmd {
|
|
|
|
|
|
/// Print info for objects
|
|
/// Print info for objects
|
|
#[arg(short, long)]
|
|
#[arg(short, long)]
|
|
- object: Option<usize>,
|
|
|
|
|
|
+ #[arg(value_parser = parse_range)]
|
|
|
|
+ object: Option<RangeInclusive<usize>>,
|
|
|
|
|
|
/// Object layer to query object on
|
|
/// Object layer to query object on
|
|
#[arg(short = 'b', long)]
|
|
#[arg(short = 'b', long)]
|
|
@@ -220,26 +221,34 @@ fn main() {
|
|
});
|
|
});
|
|
|
|
|
|
// Process object query
|
|
// Process object query
|
|
- args.object.map(|obj_index| {
|
|
|
|
|
|
+ args.object.map(|obj_range| {
|
|
|
|
+ warn!("Object origin/width/height values may be incorrect if skewed or rotated");
|
|
|
|
+
|
|
let layer_index: usize = args.object_layer.unwrap_or(0);
|
|
let layer_index: usize = args.object_layer.unwrap_or(0);
|
|
let layer: &Layer = file
|
|
let layer: &Layer = file
|
|
.layers_offset
|
|
.layers_offset
|
|
.get(layer_index)
|
|
.get(layer_index)
|
|
.expect("Invalid layer index");
|
|
.expect("Invalid layer index");
|
|
- let object: &Object = layer.objects.get(obj_index).expect("Invalid object index");
|
|
|
|
- let pen_index: u32 = *object.core().pen;
|
|
|
|
- info!(
|
|
|
|
- "Layer {}, Object {}:\n{}\nPen: #{}: {}",
|
|
|
|
- layer_index,
|
|
|
|
- obj_index,
|
|
|
|
- object,
|
|
|
|
- pen_index,
|
|
|
|
- file.pens_offset
|
|
|
|
- .data
|
|
|
|
- .pens
|
|
|
|
- .get(pen_index as usize)
|
|
|
|
- .expect("Invalid pen index in object")
|
|
|
|
- );
|
|
|
|
|
|
+
|
|
|
|
+ for object_index in obj_range {
|
|
|
|
+ let object: &Object = layer
|
|
|
|
+ .objects
|
|
|
|
+ .get(object_index)
|
|
|
|
+ .expect("Invalid object index");
|
|
|
|
+ let pen_index: u32 = *object.core().pen;
|
|
|
|
+ info!(
|
|
|
|
+ "Layer #{}, Object #{}:\n{}\nPen: #{}: {}",
|
|
|
|
+ layer_index,
|
|
|
|
+ object_index,
|
|
|
|
+ object,
|
|
|
|
+ pen_index,
|
|
|
|
+ file.pens_offset
|
|
|
|
+ .data
|
|
|
|
+ .pens
|
|
|
|
+ .get(pen_index as usize)
|
|
|
|
+ .expect("Invalid pen index in object")
|
|
|
|
+ );
|
|
|
|
+ }
|
|
});
|
|
});
|
|
}
|
|
}
|
|
SubCommands::Apply(args) => {
|
|
SubCommands::Apply(args) => {
|