Skip to content

Commit ccd038c

Browse files
authored
chore(Blenvy-Bevy): replace println with debug (#250)
1 parent e883f3a commit ccd038c

File tree

15 files changed

+68
-68
lines changed

15 files changed

+68
-68
lines changed

crates/blenvy/src/blueprints/animation.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,15 @@ pub fn trigger_blueprint_animation_markers_events(
130130
let frame_seconds = (animation_length_frames
131131
/ animation_length_seconds)
132132
* time_in_animation;
133-
// println!("frame seconds {}", frame_seconds);
133+
// debug!("frame seconds {}", frame_seconds);
134134
let frame = frame_seconds.ceil() as u32; // FIXME , bad hack
135135

136136
let matching_animation_marker = &animation_markers.0[animation_name];
137137

138138
if matching_animation_marker.contains_key(&frame) {
139139
let matching_markers_per_frame =
140140
matching_animation_marker.get(&frame).unwrap();
141-
println!(
141+
debug!(
142142
"FOUND A MARKER {:?} at frame {}",
143143
matching_markers_per_frame, frame
144144
);
@@ -191,7 +191,7 @@ pub fn trigger_instance_animation_markers_events(
191191
animations.named_animations.get(animation_name)
192192
{
193193
if let Some(__animation_clip) = animation_clips.get(animation_clip_handle) {
194-
println!("found the animation clip");
194+
debug!("found the animation clip");
195195
}
196196
}
197197
}
@@ -202,8 +202,8 @@ pub fn trigger_instance_animation_markers_events(
202202
// animation_player.play(animation)
203203
204204
if animation_clip.is_some() {
205-
// println!("Entity {:?} markers {:?}", entity, markers);
206-
// println!("Player {:?} {}", animation_player.elapsed(), animation_player.completions());
205+
// debug!("Entity {:?} markers {:?}", entity, markers);
206+
// debug!("Player {:?} {}", animation_player.elapsed(), animation_player.completions());
207207
// FIMXE: yikes ! very inneficient ! perhaps add boilerplate to the "start playing animation" code so we know what is playing
208208
let animation_name = animations.named_animations.iter().find_map(|(key, value)| {
209209
if value == animation_player.animation_clip() {
@@ -234,8 +234,8 @@ pub fn trigger_instance_animation_markers_events(
234234
let matching_markers_per_frame = matching_animation_marker.get(&frame).unwrap();
235235
236236
// let timediff = animation_length_seconds - time_in_animation;
237-
// println!("timediff {}", timediff);
238-
// println!("FOUND A MARKER {:?} at frame {}", matching_markers_per_frame, frame);
237+
// debug!("timediff {}", timediff);
238+
// debug!("FOUND A MARKER {:?} at frame {}", matching_markers_per_frame, frame);
239239
// emit an event AnimationMarkerReached(entity, animation_name, frame, marker_name)
240240
// FIXME: problem, this can fire multiple times in a row, depending on animation length , speed , etc
241241
for marker in matching_markers_per_frame {

crates/blenvy/src/blueprints/copy_components.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ impl CopyComponents {
9595
.get_entity_mut(self.destination)
9696
.expect("destination entity should exist");
9797

98-
// println!("contains typeid {:?} {}", type_id, destination.contains_type_id(type_id));
98+
// debug!("contains typeid {:?} {}", type_id, destination.contains_type_id(type_id));
9999
// we only want to copy components that are NOT already in the destination (ie no overwriting existing components)
100100
if !destination.contains_type_id(type_id) {
101101
component.insert(&mut destination, &*source, &type_registry);

crates/blenvy/src/blueprints/hot_reload.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ pub(crate) fn react_to_asset_changes(
3434

3535
if let AssetEvent::Modified { id } = event {
3636
// React to the gltf file being modified
37-
// println!("Modified gltf {:?}", asset_server.get_path(*id));
37+
// debug!("Modified gltf {:?}", asset_server.get_path(*id));
3838
if let Some(asset_path) = asset_server.get_path(*id) {
3939
// let untyped = asset_server.get_handle_untyped(asset_path.clone());
40-
// println!("matching untyped handle {:?}", untyped);
40+
// debug!("matching untyped handle {:?}", untyped);
4141
// let bla = untyped.unwrap().id();
4242
// asset_server.get
4343
// in order to avoid respawn both a parent & a child , which would crash Bevy, we do things in two steps
@@ -46,7 +46,7 @@ pub(crate) fn react_to_asset_changes(
4646
.get(&asset_path.to_string())
4747
{
4848
for entity in entities.iter() {
49-
// println!("matching blueprint instance {}", entity);
49+
// debug!("matching blueprint instance {}", entity);
5050
// disregard entities that are already (re) spawning
5151
if !respawn_candidates.contains(&entity)
5252
&& blueprint_assets.get(*entity).is_ok()
@@ -78,9 +78,9 @@ pub(crate) fn react_to_asset_changes(
7878
retained_candidates.push(**entity);
7979
}
8080
}
81-
// println!("respawn candidates {:?}", respawn_candidates);
81+
// debug!("respawn candidates {:?}", respawn_candidates);
8282
for retained in retained_candidates.iter() {
83-
// println!("retained {}", retained);
83+
// debug!("retained {}", retained);
8484

8585
if let Ok((entity, entity_name, _blueprint_info, children)) =
8686
blueprint_assets.get(*retained)
@@ -104,5 +104,5 @@ pub(crate) fn react_to_asset_changes(
104104
}
105105
}
106106

107-
// println!("done with asset updates");
107+
// debug!("done with asset updates");
108108
}

crates/blenvy/src/blueprints/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl Default for BluePrintBundle {
5353
pub struct BlueprintsPlugin {}
5454

5555
fn hot_reload(watching_for_changes: Res<WatchingForChanges>) -> bool {
56-
// println!("hot reload ? {}", watching_for_changes.0);
56+
// debug!("hot reload ? {}", watching_for_changes.0);
5757
watching_for_changes.0
5858
}
5959

crates/blenvy/src/blueprints/spawn_from_blueprints.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ pub(crate) fn blueprints_check_assets_metadata_files_loading(
244244
}
245245
let progress: f32 = loaded_amount as f32 / total as f32;
246246
assets_to_load.progress = progress;
247-
// println!("LOADING: in progress for ALL assets of {:?} (instance of {}): {} ",entity_name, blueprint_info.path, progress * 100.0);
247+
// debug!("LOADING: in progress for ALL assets of {:?} (instance of {}): {} ",entity_name, blueprint_info.path, progress * 100.0);
248248
}
249249
}
250250

@@ -323,7 +323,7 @@ pub(super) fn blueprints_prepare_spawn(
323323
if !assets_to_blueprint_instances.untyped_id_to_blueprint_entity_ids[&path_id]
324324
.contains(&entity)
325325
{
326-
// println!("adding mapping between {} and entity {:?}", path_id, all_names.get(entity));
326+
// debug!("adding mapping between {} and entity {:?}", path_id, all_names.get(entity));
327327
assets_to_blueprint_instances
328328
.untyped_id_to_blueprint_entity_ids
329329
.get_mut(&path_id)
@@ -353,7 +353,7 @@ pub(super) fn blueprints_prepare_spawn(
353353
[&blueprint_info.path]
354354
.contains(&entity)
355355
{
356-
// println!("adding mapping between {} and entity {:?}", path_id, all_names.get(entity));
356+
// debug!("adding mapping between {} and entity {:?}", path_id, all_names.get(entity));
357357
assets_to_blueprint_instances
358358
.untyped_id_to_blueprint_entity_ids
359359
.get_mut(&blueprint_info.path)
@@ -419,11 +419,11 @@ pub(crate) fn blueprints_check_assets_loading(
419419
}
420420
let progress: f32 = loaded_amount as f32 / total as f32;
421421
assets_to_load.progress = progress;
422-
//println!("LOADING: in progress for ALL assets of {:?} (instance of {}): {} ",entity_name, blueprint_info.path, progress * 100.0);
422+
//debug!("LOADING: in progress for ALL assets of {:?} (instance of {}): {} ",entity_name, blueprint_info.path, progress * 100.0);
423423

424424
if all_loaded {
425425
assets_to_load.all_loaded = true;
426-
// println!("LOADING: DONE for ALL assets of {:?} (instance of {}), preparing for spawn", entity_name, blueprint_info.path);
426+
// debug!("LOADING: DONE for ALL assets of {:?} (instance of {}), preparing for spawn", entity_name, blueprint_info.path);
427427
blueprint_events.send(BlueprintEvent::AssetsLoaded {
428428
entity,
429429
blueprint_name: blueprint_info.name.clone(),
@@ -515,8 +515,8 @@ pub(crate) fn blueprints_assets_loaded(
515515
}
516516
let graph = graphs.add(graph);
517517

518-
//println!("Named animations : {:?}", named_animations.keys());
519-
//println!("ANIMATION INFOS: {:?}", animation_infos);
518+
//debug!("Named animations : {:?}", named_animations.keys());
519+
//debug!("ANIMATION INFOS: {:?}", animation_infos);
520520

521521
commands.entity(entity).insert((
522522
SceneBundle {
@@ -587,7 +587,7 @@ pub(crate) fn blueprints_scenes_spawned(
587587
if track_root.is_none() {
588588
for parent in all_parents.iter_ancestors(entity) {
589589
if with_blueprint_infos.get(parent).is_ok() {
590-
println!(
590+
debug!(
591591
"found a parent with blueprint_info {:?} for {:?}",
592592
all_names.get(parent),
593593
all_names.get(entity)
@@ -603,12 +603,12 @@ pub(crate) fn blueprints_scenes_spawned(
603603
if children.is_some() {
604604
for child in all_children.iter_descendants(entity) {
605605
if with_blueprint_infos.get(child).is_ok() {
606-
// println!("Parent blueprint instance of {:?} is {:?}", all_names.get(child), all_names.get(entity));
606+
// debug!("Parent blueprint instance of {:?} is {:?}", all_names.get(child), all_names.get(entity));
607607
for parent in all_parents.iter_ancestors(child) {
608608
if with_blueprint_infos.get(parent).is_ok() {
609609
if parent == entity {
610-
//println!("yohoho");
611-
/*println!(
610+
//debug!("yohoho");
611+
/*debug!(
612612
"Parent blueprint instance of {:?} is {:?}",
613613
all_names.get(child),
614614
all_names.get(parent)
@@ -733,7 +733,7 @@ pub(crate) fn blueprints_cleanup_spawned_scene(
733733
if animations.named_animations.keys().len() > 0 {
734734
for (entity_with_player, parent) in animation_players.iter() {
735735
if parent.get() == blueprint_root_entity {
736-
println!(
736+
debug!(
737737
"FOUND ANIMATION PLAYER FOR {:?} {:?} ",
738738
all_names.get(original),
739739
all_names.get(entity_with_player)
@@ -757,7 +757,7 @@ pub(crate) fn blueprints_cleanup_spawned_scene(
757757
if with_animation_infos.get(child).is_ok() {
758758
// player is already on the same entity as the animation_infos
759759
if animation_players.get(child).is_ok() {
760-
println!(
760+
debug!(
761761
"found BLUEPRINT animation player for {:?} at {:?} Root: {:?}",
762762
all_names.get(child),
763763
all_names.get(child),
@@ -770,13 +770,13 @@ pub(crate) fn blueprints_cleanup_spawned_scene(
770770
} else {
771771
for parent in all_parents.iter_ancestors(child) {
772772
if animation_players.get(parent).is_ok() {
773-
/*println!(
773+
/*debug!(
774774
"found SCENE animation player for {:?} at {:?} Root: {:?}",
775775
all_names.get(child),
776776
all_names.get(parent),
777777
all_names.get(original)
778778
);
779-
println!("INSERTING SCENE ANIMATIONS INTO");*/
779+
debug!("INSERTING SCENE ANIMATIONS INTO");*/
780780
let original_animations = anims.get(original).unwrap();
781781
commands.entity(child).insert((
782782
InstanceAnimationPlayerLink(parent),
@@ -879,7 +879,7 @@ pub(crate) fn blueprints_finalize_instances(
879879
}
880880
if all_spawned {
881881
// let root_name = all_names.get(track_root.0);
882-
// println!("ALLLLL SPAAAAWNED for {} named {:?}", track_root.0, root_name);
882+
// debug!("ALLLLL SPAAAAWNED for {} named {:?}", track_root.0, root_name);
883883
commands.entity(track_root.0).insert(BlueprintChildrenReady);
884884
}
885885
}

crates/blenvy/src/components/blender_settings/lighting.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,15 @@ fn process_tonemapping(
130130
for (scene_id, tone_mapping) in tonemappings.iter() {
131131
match tone_mapping {
132132
BlenderToneMapping::None => {
133-
//println!("TONEMAPPING NONE");
133+
//debug!("TONEMAPPING NONE");
134134
commands.entity(entity).remove::<Tonemapping>();
135135
}
136136
BlenderToneMapping::AgX => {
137-
//println!("TONEMAPPING Agx");
137+
//debug!("TONEMAPPING Agx");
138138
commands.entity(entity).insert(Tonemapping::AgX);
139139
}
140140
BlenderToneMapping::Filmic => {
141-
//println!("TONEMAPPING Filmic");
141+
//debug!("TONEMAPPING Filmic");
142142
commands.entity(entity).insert(Tonemapping::BlenderFilmic);
143143
}
144144
}

crates/blenvy/src/components/ronstring_to_reflect_component.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub fn ronstring_to_reflect_component(
1313
) -> Vec<(Box<dyn Reflect>, TypeRegistration)> {
1414
let lookup: HashMap<String, Value> = ron::from_str(ron_string).unwrap();
1515
let mut components: Vec<(Box<dyn Reflect>, TypeRegistration)> = Vec::new();
16-
// println!("ron_string {:?}", ron_string);
16+
// debug!("ron_string {:?}", ron_string);
1717
for (name, value) in lookup.into_iter() {
1818
let parsed_value: String = match value.clone() {
1919
Value::String(str) => str,
@@ -63,7 +63,7 @@ fn components_string_to_components(
6363
let serializer = ReflectSerializer::new(&test_struct, &type_registry);
6464
let serialized =
6565
ron::ser::to_string_pretty(&serializer, ron::ser::PrettyConfig::default()).unwrap();
66-
println!("serialized Component {}", serialized);
66+
debug!("serialized Component {}", serialized);
6767
*/
6868
debug!("component data ron string {}", ron_string);
6969
let mut deserializer = ron::Deserializer::from_str(ron_string.as_str())

crates/blenvy/src/save_load/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub(crate) fn spawn_from_blueprintworld(
99
mut commands: Commands,
1010
) {
1111
for (__entity, blueprint_world) in added_blueprint_worlds.iter() {
12-
println!("added blueprintWorld {:?}", blueprint_world);
12+
debug!("added blueprintWorld {:?}", blueprint_world);
1313

1414
// here we spawn the static part our game world/level, which is also a blueprint !
1515
let __static_world = commands

crates/blenvy/src/save_load/saving.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pub(crate) fn prepare_save_game(
5656
}
5757

5858
for (entity, parent, children) in dynamic_entities.iter() {
59-
println!("prepare save game for entity");
59+
debug!("prepare save game for entity");
6060
let parent = parent.get();
6161
if root_entities.contains(parent) {
6262
commands.entity(entity).insert(RootEntity);

examples/animation/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ pub fn animation_control(
6464
) {
6565
// robots
6666
if keycode.just_pressed(KeyCode::KeyB) {
67-
println!("scan animation for robots");
67+
debug!("scan animation for robots");
6868
for (link, animations) in animated_robots.iter() {
6969
let (mut animation_player, mut animation_transitions) =
7070
animation_players.get_mut(link.0).unwrap();
71-
println!("got some animations");
71+
debug!("got some animations");
7272
let anim_name = "Scan";
7373
animation_transitions
7474
.play(

0 commit comments

Comments
 (0)