Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Materials exported but not loaded in Bevy for standalone blueprints #254

Open
mertkasar opened this issue Oct 22, 2024 · 1 comment
Open

Comments

@mertkasar
Copy link

mertkasar commented Oct 22, 2024

Tested on: 0.1.0-alpha.1 in Blender 4.2.3 LTS with default plugin settings.

Setup: I have a World scene and Library scene as suggested in the documentation. Prepared 2 blueprints for my player and obstacle objects in Library section and I marked them as Assets in Blender side.

Issue: It works as expected when I instance blueprints in the World scene in Blender side and load the World scene in Bevy side. All materials are loaded when spawning World.glb and blueprints look as they should have in game.

But if I remove my blueprint instances from the World scene in Blender and try to load them on demand in Bevy side with this suggested snippet, materials which used by the blueprint are not loaded in Bevy even though they are exported successfully from Blender project.

I noticed the assets array in .meta.ron files are empty for the exported blueprints. Manually adding the relevant materials to this array fixes the issue. Is there a specific reason that Blender plugin does not populate this array when exporting? Or is there a relevant setting I'm missing on?

Player and Obstacles are instanced in World scene in Blender:
instanced_blender

fn setup(mut commands: Commands) {
    commands.spawn((
        BlueprintInfo::from_path("levels/World.glb"),
        SpawnBlueprint,
        HideUntilReady,
        GameWorldTag,
    ));
}

Player is not in World scene but spawned separately in bevy side:
instanced_blender

fn setup(mut commands: Commands) {
    commands.spawn((
        BlueprintInfo::from_path("levels/World.glb"),
        SpawnBlueprint,
        HideUntilReady,
        GameWorldTag,
    ));

    commands.spawn((
        BlueprintInfo::from_path("blueprints/player.glb"),
        SpawnBlueprint,
        TransformBundle::from_transform(Transform::from_xyz(0.0, 0.0, 0.0)),
    ));
}

player.meta.ron

(
  assets:
   [ 
   ]
)
@slothman3878
Copy link

Fairly certain this is an issue on the blender plugin side. Maybe a component information that is not included in the library blueprints. You can kinda bypass this issue by loading the asset inside the scene (hide it somewhere so that the camera doesn't pick it up), load the blueprint holding in the individual model afterwards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants