setters for reflection for Decal
//!
//! For more info see [`Decal`]
-use crate::scene::graph::map::NodeHandleMap;
use crate::{
- core::variable::{InheritError, TemplateVariable},
core::{
color::Color,
inspect::{Inspect, PropertyInfo},
@@ -12,6 +10,7 @@ use crate::{
pool::Handle,
reflect::Reflect,
uuid::{uuid, Uuid},
+ variable::{InheritError, InheritableVariable, TemplateVariable},
visitor::prelude::*,
},
engine::resource_manager::ResourceManager,
@@ -19,7 +18,7 @@ use crate::{
resource::texture::Texture,
scene::{
base::{Base, BaseBuilder},
- graph::Graph,
+ graph::{map::NodeHandleMap, Graph},
node::{Node, NodeTrait, TypeUuidProvider},
DirectlyInheritableEntity,
},
@@ -90,20 +89,20 @@ use std::ops::{Deref, DerefMut};
pub struct Decal {
base: Base,
- #[inspect(deref)]
- #[reflect(deref)]
+ #[inspect(deref, is_modified = "is_modified()")]
+ #[reflect(deref, setter = "set_diffuse_texture")]
diffuse_texture: TemplateVariable<Option<Texture>>,
- #[inspect(deref)]
- #[reflect(deref)]
+ #[inspect(deref, is_modified = "is_modified()")]
+ #[reflect(deref, setter = "set_normal_texture")]
normal_texture: TemplateVariable<Option<Texture>>,
- #[inspect(deref)]
- #[reflect(deref)]
+ #[inspect(deref, is_modified = "is_modified()")]
+ #[reflect(deref, setter = "set_color")]
color: TemplateVariable<Color>,
- #[inspect(min_value = 0.0, deref)]
- #[reflect(deref)]
+ #[inspect(min_value = 0.0, deref, is_modified = "is_modified()")]
+ #[reflect(deref, setter = "set_layer")]
layer: TemplateVariable<u8>,
}
@@ -166,8 +165,8 @@ impl Decal {
}
/// Sets new color for the decal.
- pub fn set_color(&mut self, color: Color) {
- self.color.set(color);
+ pub fn set_color(&mut self, color: Color) -> Color {
+ self.color.set(color)
}
/// Returns current color of the decal.
@@ -180,8 +179,8 @@ impl Decal {
/// To "filter" decals all you need to do is to set appropriate layer index to decal, for
/// example blood splatter decal will have `index == 0` in this case. In case of dynamic
/// objects (like bots, etc.) index will be 1.
- pub fn set_layer(&mut self, layer: u8) {
- self.layer.set(layer);
+ pub fn set_layer(&mut self, layer: u8) -> u8 {
+ self.layer.set(layer)
}
/// Returns current layer index.
