jakobhellermann / bevy-inspector-egui

Inspector plugin for the bevy game engine
Apache License 2.0
1.19k stars 173 forks source link

Change default for ColorAttributes.alpha to true #67

Closed paul-hansen closed 2 years ago

paul-hansen commented 2 years ago

Implementation for seeing/editing the alpha channel was already there but by default the alpha option in ColorAttributes is false. Since UiColor didn't have a manual implementation for Inspectable this meant the alpha channel wasn't exposed.

This PR just manually implements the Inspectable trait for UiColor with its ColorAttributes.alpha set to true.

Alternative

Alternatively we could set the default for ColorAttributes alpha to true. E.g. Change this https://github.com/jakobhellermann/bevy-inspector-egui/blob/97c2f3350a8105ff257067b6314678b1dc33db07/src/impls/bevy_render.rs#L164-L167 To:

#[derive(Debug, Clone)]
pub struct ColorAttributes {
    pub alpha: bool,
}

impl Default for ColorAttributes {
    fn default() -> Self {
        Self{ alpha: true }
    }
}

Then we wouldn't need the manual implementation for UiColor. I think that would likely be even better, but I went with the option that seemed to be the least breaking change for now. Lmk if you want to go this route instead.

jakobhellermann commented 2 years ago

Thanks for the PRs. I agree that enabling alpha by default is probably the better solution here since it is a more universally applicable default.

If you do that change I'll be happy to merge.

paul-hansen commented 2 years ago

Updated, thanks!