Allow minimising in 2d (#4527)
# Objective - We can't minimise if there's a 2d camera because ??? there legally must be a 2d target. - Fixes https://github.com/bevyengine/bevy/issues/4526 - Fixes https://github.com/bevyengine/bevy/issues/4856 ## Solution - Make it not crash in those cases, just do nothing - Seems to work ¯\\_(ツ)_/¯ - See also the companion commit in https://github.com/bevyengine/bevy/pull/3597 - 503c24717321bb2bb2681b358020ad1bcbef510e Co-authored-by: Asteria <asteria131@outlook.com>
This commit is contained in:
parent
60584139de
commit
09a3d8abe0
@ -39,10 +39,11 @@ impl Node for MainPass2dNode {
|
||||
world: &World,
|
||||
) -> Result<(), NodeRunError> {
|
||||
let view_entity = graph.get_input_entity(Self::IN_VIEW)?;
|
||||
let (transparent_phase, target) = self
|
||||
.query
|
||||
.get_manual(world, view_entity)
|
||||
.expect("view entity should exist");
|
||||
// If there is no view entity, do not try to process the render phase for the view
|
||||
let (transparent_phase, target) = match self.query.get_manual(world, view_entity) {
|
||||
Ok(it) => it,
|
||||
_ => return Ok(()),
|
||||
};
|
||||
|
||||
if transparent_phase.items.is_empty() {
|
||||
return Ok(());
|
||||
|
||||
@ -66,15 +66,16 @@ impl Node for UiPassNode {
|
||||
world: &World,
|
||||
) -> Result<(), NodeRunError> {
|
||||
let view_entity = graph.get_input_entity(Self::IN_VIEW)?;
|
||||
let (transparent_phase, target) = self
|
||||
.query
|
||||
.get_manual(world, view_entity)
|
||||
.expect("view entity should exist");
|
||||
|
||||
// If there is no view entity, do not try to process the render phase for the view
|
||||
let (transparent_phase, target) = match self.query.get_manual(world, view_entity) {
|
||||
Ok(it) => it,
|
||||
_ => return Ok(()),
|
||||
};
|
||||
|
||||
if transparent_phase.items.is_empty() {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let pass_descriptor = RenderPassDescriptor {
|
||||
label: Some("ui_pass"),
|
||||
color_attachments: &[RenderPassColorAttachment {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user