Add CameraRenderGraph::set (#6470)

# Objective

Some render plugins, like [bevy-hikari](https://github.com/cryscan/bevy-hikari) require to set `CameraRenderGraph`. In order to switch between render graphs I need to insert a new `CameraRenderGraph` component. It's not very ergonomic.

## Solution

Add `CameraRenderGraph::set` like in [Name](https://docs.rs/bevy/latest/bevy/core/struct.Name.html).

---

## Changelog

### Added

- `CameraRenderGraph::set`.
This commit is contained in:
Hennadii Chernyshchyk 2022-11-06 17:14:10 +00:00
parent feebbc5ea9
commit efc111c7f2

View File

@ -289,10 +289,17 @@ impl Camera {
pub struct CameraRenderGraph(Cow<'static, str>);
impl CameraRenderGraph {
/// Creates a new [`CameraRenderGraph`] from any string-like type.
#[inline]
pub fn new<T: Into<Cow<'static, str>>>(name: T) -> Self {
Self(name.into())
}
#[inline]
/// Sets the graph name.
pub fn set<T: Into<Cow<'static, str>>>(&mut self, name: T) {
self.0 = name.into();
}
}
/// The "target" that a [`Camera`] will render to. For example, this could be a [`Window`](bevy_window::Window)