bevyengine / bevyengine/bevy

RenderAssetUsages Reflection Incomplete

Open
#16,806 0 comments 0 reactions 0 assignees View on GitHub
A-Reflection C-Bug S-Needs-Design
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## Bevy version

0.15.0

## What you did

I'm implementing a scripting language using bevy\_reflect.

## What went wrong

bevy_asset::render_asset::RenderAssetUsages is defined as `#[derive(Reflect)]`, but it's not possible to actually set it using reflection.

This is due to the use of the `bitflags` crate's macro to create a bitflag mask with `MAIN_WORLD` and `RENDER_WORLD`, which bevy\_reflect doesn't support.

So, there should be another way to allow the scripting language to define those flags.

As far as I can tell, that's the only instance of a bitflags-using type being included in reflection.

## Workaround

For now I'm special-casing this type instead of using reflection.

Contributor guide

Open the contributing guide

Research direction

Start by inspecting bevy_asset::render_asset::RenderAssetUsages and its #[derive(Reflect)] usage, then compare how the bitflags-defined MAIN_WORLD and RENDER_WORLD values interact with bevy_reflect. The issue is done when a scripting language can set those flags through reflection without special-casing the type.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
game-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.