Skip to content

Commit 82febea

Browse files
committed
fix rebase errors
1 parent e58b087 commit 82febea

File tree

5 files changed

+42
-42
lines changed

5 files changed

+42
-42
lines changed

crates/bevy_hierarchy/src/components/parent.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ use std::ops::Deref;
1313
#[reflect(Component, MapEntities, PartialEq)]
1414
pub struct Parent(pub(crate) Entity);
1515

16+
impl Parent {
17+
/// Gets the [`Entity`] ID of the parent.
18+
pub fn get(&self) -> Entity {
19+
self.0
20+
}
21+
}
22+
1623
// TODO: We need to impl either FromWorld or Default so Parent can be registered as Reflect.
1724
// This is because Reflect deserialize by creating an instance and apply a patch on top.
1825
// However Parent should only ever be set with a real user-defined entity. Its worth looking into

crates/bevy_hierarchy/src/hierarchy.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,7 @@ mod tests {
116116
};
117117

118118
use super::DespawnRecursiveExt;
119-
<<<<<<< HEAD:crates/bevy_hierarchy/src/hierarchy.rs
120-
use crate::{child_builder::BuildChildren, components::Children, ChildAdded, ChildMoved, ChildRemoved};
121-
=======
122-
use crate::{components::Children, hierarchy::BuildChildren};
123-
>>>>>>> e7ef4a51 (Scenes are Worlds too):crates/bevy_transform/src/hierarchy/hierarchy.rs
119+
use crate::{child_builder::BuildChildren, components::Children};
124120

125121
#[derive(Component, Clone, Copy, PartialEq, Eq, Ord, PartialOrd, Debug)]
126122
struct Idx(u32);

crates/bevy_hierarchy/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ pub mod prelude {
2323
}
2424

2525
use bevy_app::prelude::*;
26-
use bevy_ecs::prelude::*;
2726

2827
/// The base plugin for handling [`Parent`] and [`Children`] components
2928
#[derive(Default)]

crates/bevy_transform/src/systems.rs

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,10 @@ mod test {
8282
world::World,
8383
};
8484

85-
<<<<<<< HEAD:crates/bevy_transform/src/systems.rs
8685
use crate::components::{GlobalTransform, Transform};
8786
use crate::systems::transform_propagate_system;
8887
use crate::TransformBundle;
89-
use bevy_hierarchy::{BuildChildren, BuildWorldChildren, Children, Parent, ChildAdded, ChildMoved, ChildRemoved};
90-
=======
91-
use super::*;
92-
use crate::{
93-
hierarchy::{BuildChildren, BuildWorldChildren},
94-
TransformBundle,
95-
};
96-
>>>>>>> e7ef4a51 (Scenes are Worlds too):crates/bevy_transform/src/transform_propagate_system.rs
88+
use bevy_hierarchy::{BuildChildren, BuildWorldChildren, Children};
9789

9890
#[test]
9991
fn did_propagate() {
@@ -185,36 +177,38 @@ mod test {
185177
let mut world = World::default();
186178

187179
let mut update_stage = SystemStage::parallel();
188-
update_stage.add_system(parent_update_system);
189180
update_stage.add_system(transform_propagate_system);
190181

191182
let mut schedule = Schedule::default();
192183
schedule.add_stage("update", update_stage);
193184

194185
// Add parent entities
195-
let mut command_queue = CommandQueue::default();
196-
let mut commands = Commands::new(&mut command_queue, &world);
197186
let mut children = Vec::new();
198-
let parent = commands
199-
.spawn()
200-
.insert(Transform::from_xyz(1.0, 0.0, 0.0))
201-
.id();
202-
commands.entity(parent).with_children(|parent| {
203-
children.push(
204-
parent
205-
.spawn()
206-
.insert(Transform::from_xyz(0.0, 2.0, 0.0))
207-
.id(),
208-
);
209-
children.push(
210-
parent
211-
.spawn()
212-
.insert(Transform::from_xyz(0.0, 3.0, 0.0))
213-
.id(),
214-
);
215-
});
216-
command_queue.apply(&mut world);
217-
schedule.run(&mut world);
187+
let parent = {
188+
let mut command_queue = CommandQueue::default();
189+
let mut commands = Commands::new(&mut command_queue, &world);
190+
let parent = commands
191+
.spawn()
192+
.insert(Transform::from_xyz(1.0, 0.0, 0.0))
193+
.id();
194+
commands.entity(parent).with_children(|parent| {
195+
children.push(
196+
parent
197+
.spawn()
198+
.insert(Transform::from_xyz(0.0, 2.0, 0.0))
199+
.id(),
200+
);
201+
children.push(
202+
parent
203+
.spawn()
204+
.insert(Transform::from_xyz(0.0, 3.0, 0.0))
205+
.id(),
206+
);
207+
});
208+
command_queue.apply(&mut world);
209+
schedule.run(&mut world);
210+
parent
211+
};
218212

219213
assert_eq!(
220214
world
@@ -227,9 +221,13 @@ mod test {
227221
);
228222

229223
// Parent `e1` to `e2`.
230-
(*world.get_mut::<Parent>(children[0]).unwrap()).0 = children[1];
231-
232-
schedule.run(&mut world);
224+
{
225+
let mut command_queue = CommandQueue::default();
226+
let mut commands = Commands::new(&mut command_queue, &world);
227+
commands.entity(children[1]).add_child(children[0]);
228+
command_queue.apply(&mut world);
229+
schedule.run(&mut world);
230+
}
233231

234232
assert_eq!(
235233
world

crates/bevy_ui/src/update.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ mod tests {
139139
system::{CommandQueue, Commands},
140140
world::World,
141141
};
142-
use bevy_hierarchy::{BuildChildren, ChildAdded, ChildMoved, ChildRemoved};
142+
use bevy_hierarchy::BuildChildren;
143143
use bevy_transform::components::Transform;
144144

145145
use crate::Node;

0 commit comments

Comments
 (0)