Skip to content

Conversation

@mockersf
Copy link
Member

@mockersf mockersf commented Dec 13, 2020

make InstanceId of a spawned scene available
check that a scene instance has been spawned (it takes 1 frame for the scene to spawn + x frames while the asset (gltf) is loaded)
run a function on entities from a spawned scene

also added an example for this PR and #1026

@Moxinilian Moxinilian added A-ECS Entities, components, systems, and events C-Feature A new feature, making something new possible C-Examples An addition or correction to our examples labels Dec 15, 2020
@mockersf mockersf force-pushed the scene-tagged branch 2 times, most recently from fc925c0 to cb84651 Compare December 28, 2020 03:39
self.spawned_instances.contains_key(&instance_id)
}

pub fn for_entity_in_scene_instance(&self, instance_id: InstanceId, mut f: impl FnMut(Entity)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoughts on removing for_entity_in_scene_instance in favor of:

fn iter_instance_entities(&self, instance_id: InstanceId) -> 
  Option<impl Iterator<Item=Entity>>  {
  self.spawned_instances
    .get(&instance_id)
    .map(|instance| instance.entity_map.values.cloned())
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would make it a bit more flexible

Copy link
Member Author

@mockersf mockersf Dec 31, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea! I tried using the same idea as for_current_entity but this seems better

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah i'm not a huge fan of for_current_entity, but the builder pattern sort of forced my hand / i consider it to be an exception rather than a rule. SceneSpawner isn't a builder so I don't feel constrained in the same way.

@mockersf
Copy link
Member Author

mockersf commented Jan 1, 2021

changed to provide iter_instance_entities, and also a funnier example to look at

@cart cart merged commit c25b41a into bevyengine:master Jan 1, 2021
@CleanCut
Copy link
Member

CleanCut commented Jan 3, 2021

@mockersf On my Intel Mac I see only a blank gray window without any console errors when I run cargo run --example update_gltf_scene -- same thing if I add --release or try it on the current master.

@mockersf
Copy link
Member Author

mockersf commented Jan 3, 2021

@CleanCut oh drat, it's because of a PR mix between this one and #1020, fixed in #1204...

Tezza48 pushed a commit to Tezza48/bevy that referenced this pull request Jan 18, 2021
add scene instance entity iteration

(cherry picked from commit c25b41a)
@mockersf mockersf deleted the scene-tagged branch April 27, 2021 23:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ECS Entities, components, systems, and events C-Examples An addition or correction to our examples C-Feature A new feature, making something new possible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants