mbrea-c / bevy_animation_graph

Animation graphs in Bevy!
Apache License 2.0
102 stars 5 forks source link

Help setting up #39

Closed franklinblanco closed 5 months ago

franklinblanco commented 8 months ago

Hey Manuel. Just saw your talk @ the bevy_meetup #2. Great talk!! Really amazed by your work.

I've been trying to set up the editor and everything. So I have a model in blender with an armature rig. (mixamo)

Screenshot 2024-03-12 at 8 22 30 PM

I have exported the model to assets/models/library/BasePlayerModel.glb

assets/animated_scenes/base_player_model.animscn.ron:

(
    source: "models/library/BasePlayerModel.glb#Scene0",
    path_to_player: ["Entity/BasePlayerModel"],
    animation_graph: "animation_graphs/base_player_model.animgraph.ron",
)

assets/animation_graphs/base_player_model.animgraph.ron:

(
)

This is the structure in the bevy_inspector Screenshot 2024-03-12 at 8 26 19 PM

I'm not sure what I need to do to get my model(scene) to show up in the editor.

Screenshot 2024-03-12 at 8 23 18 PM

Running the command: bevy_animation_graph_editor -a assets/

2024-03-12T19:27:35.931310Z  INFO bevy_render::renderer: AdapterInfo { name: "Apple M1 Pro", vendor: 0, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Metal }
2024-03-12T19:27:36.075518Z  INFO bevy_winit::system: Creating new window "App" (0v0)
2024-03-12T19:27:36.120602Z  INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "MacOS 14.2.1 ", kernel: "23.2.0", cpu: "Apple M1 Pro", core_count: "8", memory: "32.0 GiB" }
2024-03-12T19:27:36.442789Z  WARN bevy_gltf::loader: Failed to generate vertex tangents using the mikktspace algorithm: MissingVertexAttribute("Vertex_Uv")
2024-03-12T19:27:36.442822Z  WARN bevy_gltf::loader: Failed to generate vertex tangents using the mikktspace algorithm: MissingVertexAttribute("Vertex_Uv")
2024-03-12T19:27:36.442833Z  WARN bevy_gltf::loader: Failed to generate vertex tangents using the mikktspace algorithm: MissingVertexAttribute("Vertex_Uv")
2024-03-12T19:27:36.442840Z  WARN bevy_gltf::loader: Failed to generate vertex tangents using the mikktspace algorithm: MissingVertexAttribute("Vertex_Uv")
2024-03-12T19:27:36.442867Z  WARN bevy_gltf::loader: Failed to generate vertex tangents using the mikktspace algorithm: MissingVertexAttribute("Vertex_Uv")
2024-03-12T19:27:36.442884Z  WARN bevy_gltf::loader: Failed to generate vertex tangents using the mikktspace algorithm: MissingVertexAttribute("Vertex_Uv")
2024-03-12T19:27:36.442897Z  WARN bevy_gltf::loader: Failed to generate vertex tangents using the mikktspace algorithm: MissingVertexAttribute("Vertex_Uv")
2024-03-12T19:27:36.442902Z  WARN bevy_gltf::loader: Failed to generate vertex tangents using the mikktspace algorithm: MissingVertexAttribute("Vertex_Uv")
2024-03-12T19:27:36.442909Z  WARN bevy_gltf::loader: Failed to generate vertex tangents using the mikktspace algorithm: MissingVertexAttribute("Vertex_Uv")
2024-03-12T19:27:36.442919Z  WARN bevy_gltf::loader: Failed to generate vertex tangents using the mikktspace algorithm: MissingVertexAttribute("Vertex_Uv")
2024-03-12T19:27:36.442928Z  WARN bevy_gltf::loader: Failed to generate vertex tangents using the mikktspace algorithm: MissingVertexAttribute("Vertex_Uv")
2024-03-12T19:27:36.443031Z  WARN bevy_gltf::loader: Failed to generate vertex tangents using the mikktspace algorithm: MissingVertexAttribute("Vertex_Uv")
2024-03-12T19:27:36.443049Z  WARN bevy_gltf::loader: Failed to generate vertex tangents using the mikktspace algorithm: MissingVertexAttribute("Vertex_Uv")
2024-03-12T19:27:36.443057Z  WARN bevy_gltf::loader: Failed to generate vertex tangents using the mikktspace algorithm: MissingVertexAttribute("Vertex_Uv")
2024-03-12T19:27:36.443071Z  WARN bevy_gltf::loader: Failed to generate vertex tangents using the mikktspace algorithm: MissingVertexAttribute("Vertex_Uv")
thread 'IO Task Pool (0)' panicked at /Users/<REDACTED>/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_asset-0.12.1/src/io/mod.rs:260:10:
asset paths must have extensions
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
franklinblanco commented 8 months ago

I tried to switch around the path_to_player, in many ways. With / without Scene0.

No luck yet. Sorry for bothering you!

mbrea-c commented 8 months ago

First thing I noticed is that the path should be in list form, not string form. So it would be ["Entity", "BasePlayerModel"] rather than ["Entity/BasePlayerModel"]. However, the error seems to indicate something else. Can you run with backtrace enabled (RUST_BACKTRACE=1 bevy_animation_graph_editor -a assets)? I want to get an idea of which asset is causing the problem

No luck yet. Sorry for bothering you!

It's no bother, glad to help

franklinblanco commented 8 months ago

First thing I noticed is that the path should be in list form, not string form. So it would be ["Entity", "BasePlayerModel"] rather than ["Entity/BasePlayerModel"].

Thanks for the reply! That's great to know!

However, the error seems to indicate something else. Can you run with backtrace enabled (RUST_BACKTRACE=1 bevy_animation_graph_editor -a assets)? I want to get an idea of which asset is causing the problem

Yeah, sure. Although I just noticed. bevy_animation_graph is using bevy 12.1. And I'm on 13.0 Will it work for me if I'm using 0.13?

franklinblanco commented 8 months ago

Here is the backtrace.

thread 'IO Task Pool (1)' panicked at /Users/<REDACTED>/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_asset-0.12.1/src/io/mod.rs:260:10:
asset paths must have extensions
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::option::expect_failed
   3: bevy_asset::io::get_meta_path
   4: bevy_asset::io::AssetReader::read_meta_bytes::{{closure}}
   5: bevy_asset::server::AssetServer::load_internal::{{closure}}
   6: bevy_asset::server::AssetServer::load_folder_internal::load_folder::{{closure}}
   7: std::panicking::try
   8: async_task::raw::RawTask<F,T,S,M>::run
   9: <futures_lite::future::Or<F1,F2> as core::future::future::Future>::poll
  10: async_executor::Executor::run::{{closure}}
  11: futures_lite::future::block_on
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
mbrea-c commented 8 months ago

Yeah, sure. Although I just noticed. bevy_animation_graph is using bevy 12.1. And I'm on 13.0 Will it work for me if I'm using 0.13?

That explains it :) Currently only 12.1 is supported. I'm planning to push an update for 0.13 this weekend, it's a bit overdue but I've been pretty busy lately

franklinblanco commented 8 months ago

That explains it :) Currently only 12.1 is supported. I'm planning to push an update for 0.13 this weekend, it's a bit overdue but I've been pretty busy lately

Got it! Thank you for the time. No hurry. Great talk!!

mbrea-c commented 8 months ago

Alright, version 0.3 is live now with Bevy 0.13 support. This should fix the problem

franklinblanco commented 8 months ago

Hey! I downloaded the new version, I get no visible errors, but I still can't seem to get the scene to show up!

franklinblanco commented 8 months ago

Screenshot 2024-03-18 at 7 23 07 PM Screenshot 2024-03-18 at 7 23 15 PM Screenshot 2024-03-18 at 7 23 26 PM

Screenshot 2024-03-18 at 7 23 34 PM Screenshot 2024-03-18 at 7 23 41 PM

mbrea-c commented 8 months ago

It seems like you're running bevy_animation_graph_editor -a assets/model/library but your animated scene is at assets/animated_scenes/. Try just running bevy_animation_graph_editor -a assets and send me the output of that. What the editor does is recursively load all assets under the target directory you pass it, and it will list the detected animated scenes in the UI. If the scenes are not under the assets folder you point the editor to, they won't get detected and nothing will show.

Also, thank you testing this :). Being the one that wrote the software I have a biased view on how confusing parts of it are. I really should make getting started a bit more approachable, maybe add a step-by-step tutorial to the README or add some UI for creating animated scenes from within the editor.

franklinblanco commented 8 months ago

Thank you so much! So I've been testing a few things, tried the /assets approach first but it seems to not like other assets being inside.

2024-03-18T18:54:44.372776Z ERROR bevy_asset::server: Failed to load folder. Could not find an asset loader matching: Loader Name: None; Asset Type: None; Extension: None; Path: Some("splashscreen-01.txt");

Although now that I know that the assets path that you give the bevy_animation_graph_editor is for the animscn files, I just give it the correct path and all good.

➜ game_bevy git:(master) ✗ bevy_animation_graph_editor -a assets/animated_scenes This is what shows up, looks good at first, seems to load the glb file correctly but doesn't seem to be correct. image

The preview hierarchy is completely empty, and there's an error in the console. image

image

So just to understand, is the path_to_player supposed to point at the AnimationPlayer in the hierarchy?

franklinblanco commented 8 months ago

The recursive part seems to fail if there's any asset that doesn't have an asset loader available. I assume that's why it doesn't like the .txt files but it doesn't care about the .jpg files.

franklinblanco commented 8 months ago

Solved it! I had to remove the first entity in the path.

There is now this error though: Screenshot 2024-03-18 at 8 32 10 PM

Screenshot 2024-03-18 at 8 32 21 PM

Thanks for all your hard work.

mbrea-c commented 8 months ago

The recursive part seems to fail if there's any asset that doesn't have an asset loader available. I assume that's why it doesn't like the .txt files but it doesn't care about the .jpg files.

Yeah, I'm tracking this one in issue #43. I use AssetServer::load_folder to trigger the load of all assets in the given directory. In 0.12, this used to silently ignore files it did not know how to load, but in 0.13 it now just fails. I might need to add some code iterate through the directory and load files one by one, but for now like you found out a good workaround is to just use a directory that doesn't have any problematic files

mbrea-c commented 8 months ago

Solved it! I had to remove the first entity in the path.

There is now this error though: Screenshot 2024-03-18 at 8 32 10 PM

Screenshot 2024-03-18 at 8 32 21 PM

Thanks for all your hard work.

Interesting, does the animation actually work despite the error?

mbrea-c commented 8 months ago

EDIT: I accidentally edited the comment I'm replying to but was able to undo it from the desktop. Here's the reply I actually wanted to post :)

So just to understand, is the path_to_player supposed to point at the AnimationPlayer in the hierarchy?

Yeah, that's correct. It uses the path to replace bevy's animation player with an animation graph player.

Honestly though, looking back at it I'm not sure why I made it this way. I can probably just auto detect where the animation player is and save all of us some time in the future :)

mbrea-c commented 5 months ago

Closing for now since it's been inactive for a while, but feel free to reopen if you're still having issues