Group brush clip history edits
This commit is contained in:
1 parent
48b1448c57
commit
1b9fbebda1
3 files changed
+75
-9
No files matched your search
@@ -8,9 +8,7 @@ use shared::{
|
||||
};
|
||||
|
||||
use crate::camera::EditorCamera;
|
||||
use crate::history::{
|
||||
push_command, set_brush_with_history, set_transform_with_history, EditorCommand,
|
||||
};
|
||||
use crate::history::{push_command, set_brush_transform_with_history, EditorCommand};
|
||||
use crate::operators::{ActiveOperator, OperatorPhase, OperatorStatus};
|
||||
use crate::scene_io::SceneIo;
|
||||
use crate::selection::ViewportClick;
|
||||
@@ -381,12 +379,7 @@ fn brush_clip_commit(
|
||||
};
|
||||
scene_io.status = "Brush clip committed".into();
|
||||
commands.queue(move |world: &mut World| {
|
||||
let old_transform = world
|
||||
.get::<Transform>(brush_entity)
|
||||
.copied()
|
||||
.unwrap_or_default();
|
||||
set_transform_with_history(world, brush_entity, old_transform, result.transform);
|
||||
set_brush_with_history(world, brush_entity, result.brush);
|
||||
set_brush_transform_with_history(world, brush_entity, result.transform, result.brush);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1031,4 +1024,17 @@ mod tests {
|
||||
assert_eq!(result.transform.translation, Vec3::new(0.25, 0.0, 0.0));
|
||||
assert!(validate_brush(&result.brush).is_valid());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn clip_history_command_is_grouped() {
|
||||
let command = EditorCommand::SetBrushTransform {
|
||||
entity: Entity::PLACEHOLDER,
|
||||
old_transform: Transform::default(),
|
||||
new_transform: Transform::from_translation(Vec3::X),
|
||||
old_brush: Some(BrushDesc::default()),
|
||||
new_brush: BrushDesc::default(),
|
||||
};
|
||||
|
||||
assert_eq!(command.label(), "Clip Brush");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user