Skip to content

Commit 29f2d48

Browse files
committed
check
1 parent 27440bb commit 29f2d48

File tree

13 files changed

+114
-51
lines changed

13 files changed

+114
-51
lines changed

.github/workflows/build_example.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- name: install binstall
2626
uses: cargo-bins/cargo-binstall@main
2727
- name: install build dependencies
28-
run: cargo binstall --no-confirm wasm-bindgen-cli wasm-opt nickel-lang-cli trunk
28+
run: cargo binstall --no-confirm --continue-on-failure wasm-bindgen-cli wasm-opt nickel-lang-cli trunk
2929
- if: ${{ inputs.api == 'webgl2' }}
3030
name: build example
3131
run: just build_wasm_example ${{ inputs.example }}

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
- name: install binstall
5555
uses: cargo-bins/cargo-binstall@main
5656
- name: install cargo all features
57-
run: cargo binstall --no-confirm cargo-all-features
57+
run: cargo binstall --no-confirm --continue-on-failure cargo-all-features
5858
- name: check all features
5959
run: just check_all_features
6060
clippy:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/target
22
.cargo
33
rust-toolchain.toml
4+
*.code-workspace

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
{
77
"match": ".*.ncl$",
88
// need to suppress stderr output, because otherwise file watcher extension complains
9-
"cmd": "cd haalka && just sync_nickels 2> /dev/null",
9+
"cmd": "cd aalo && just sync_nickels 2> /dev/null",
1010
"event": "onFileChange"
1111
}
1212
]

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ bevy_color = "0.15"
1717
bevy_core = "0.15"
1818
bevy_core_pipeline = "0.15"
1919
bevy_derive = "0.15"
20+
bevy_dev_tools = "0.15"
2021
bevy_ecs = "0.15"
2122
bevy_hierarchy = "0.15"
2223
bevy_image = "0.15"

README.md

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,74 @@ in bengali, aalo means "light" (i.e. photons), not to be confused with haalka !
66

77
[aalo](https://github.com/databasedav/aalo) is a [haalka](https://github.com/databasedav/haalka) port (in progress) of [bevy-inspector-egui](https://github.com/jakobhellermann/bevy-inspector-egui).
88

9+
## setup
10+
11+
12+
```toml
13+
[dependencies]
14+
aalo = { version = "0.0", optional = true }
15+
16+
[features]
17+
development = ["aalo"]
18+
```
19+
20+
```rust
21+
#[cfg(feature = "development")]
22+
use aalo::prelude::*;
23+
24+
#[cfg(feature = "development")]
25+
app.add_plugins(AaloPlugin::new().world());
26+
```
27+
28+
***HIGHLY RECOMMENDED***, while not required, aalo is much snappier when compiled in release mode, you'll only need to do so once
29+
30+
```toml
31+
[profile.dev.package.aalo]
32+
opt-level = 3
33+
```
34+
935
## registering custom frontends
1036

11-
use `register_frontend`, passing in a fully qualified type path and a function that returns an `impl Bundle` e.g. `Node`
37+
use `register_frontend`, passing in a fully qualified type path and a function that returns an `impl Bundle`, e.g. `Node`, whose `Entity` also has a `FieldListener` `Component`; `FieldListener` is just a wrapper around a `SystemId<In<Box<dyn PartialReflect>>>`, which will be forwarded the corresponding field's value every frame it is visible in the inspector
1238

1339
```rust
40+
fn init_custom_bool_frontend(mut world: DeferredWorld, entity: Entity, _: ComponentId) {
41+
let mut commands = world.commands();
42+
let text = commands.spawn_empty().id();
43+
let system = commands.register_system(
44+
move |In(reflect): In<Box<dyn PartialReflect>>, mut commands: Commands| {
45+
let cur_option = reflect.try_downcast_ref::<bool>().copied().or_else(|| {
46+
CustomBoolComponent::from_reflect(reflect.as_ref())
47+
.map(|CustomBoolComponent(cur)| cur)
48+
});
49+
if let Some(cur) = cur_option {
50+
commands
51+
.entity(text)
52+
.insert(Text::new(if cur { "true" } else { "false" }));
53+
}
54+
},
55+
);
56+
commands
57+
.entity(entity)
58+
.add_child(text)
59+
.insert(FieldListener::new(system))
60+
.observe(
61+
move |click: Trigger<Pointer<Click>>, texts: Query<&Text>, mut field: TargetField| {
62+
if let Ok(Text(text)) = texts.get(text) {
63+
let cur = match text.as_str() {
64+
"true" => true,
65+
"false" => false,
66+
_ => return,
67+
};
68+
// one of these will silently error depending on if it's the field or component
69+
// target, we just do both here for the convenience of using the same frontend
70+
field.update(click.entity(), (!cur).clone_value());
71+
field.update(click.entity(), CustomBoolComponent(!cur).clone_value());
72+
}
73+
},
74+
);
75+
}
76+
1477
#[derive(Component)]
1578
#[require(Node)]
1679
#[component(on_add = init_custom_bool_frontend)]

aalo.code-workspace

Lines changed: 0 additions & 12 deletions
This file was deleted.

examples/custom.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ fn init_custom_bool_frontend(mut world: DeferredWorld, entity: Entity, _: Compon
3535
if let Some(cur) = cur_option {
3636
commands
3737
.entity(text)
38-
.insert(Text::new(if cur { "true" } else { "false" }));
38+
.insert(Text(cur.to_string()));
3939
}
4040
},
4141
);
@@ -51,7 +51,7 @@ fn init_custom_bool_frontend(mut world: DeferredWorld, entity: Entity, _: Compon
5151
"false" => false,
5252
_ => return,
5353
};
54-
// one of these will silently error depending on if its the field or component
54+
// one of these will silently error depending on if it's the field or component
5555
// target, we just do both here for the convenience of using the same frontend
5656
field.update(click.entity(), (!cur).clone_value());
5757
field.update(click.entity(), CustomBoolComponent(!cur).clone_value());

examples/world.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ fn main() {
66
App::new()
77
.add_plugins(DefaultPlugins)
88
.add_plugins(AaloPlugin::new().world().with_inspector(|inspector| {
9-
inspector.jump_to(("entity", "my cube", "globaltransform", ".0.translation"))
9+
inspector.jump_to(("entity", "my cube", "transform", ".translation"))
1010
}))
1111
.add_systems(Startup, setup)
1212
.run();

0 commit comments

Comments
 (0)