pub struct YoleckDirective(/* private fields */);
Expand description
Event that can be sent to control Yoleck’s editor.
Implementations§
Source§impl YoleckDirective
impl YoleckDirective
Sourcepub fn pass_to_entity<T: 'static + Send + Sync>(entity: Entity, data: T) -> Self
pub fn pass_to_entity<T: 'static + Send + Sync>(entity: Entity, data: T) -> Self
Pass data from an external system (usually a ViewPort Editing OverLay) to an entity.
This data can be received using the YoleckPassedData
resource. If the data is
passed to a knob, it can also be received using the knob handle’s
get_passed_data
method.
Sourcepub fn set_selected(entity: Option<Entity>) -> Self
pub fn set_selected(entity: Option<Entity>) -> Self
Set the entity selected in the Yoleck editor.
Sourcepub fn toggle_selected(entity: Entity) -> Self
pub fn toggle_selected(entity: Entity) -> Self
Set the entity selected in the Yoleck editor.
Sourcepub fn spawn_entity(
level: Entity,
type_name: impl ToString,
select_created_entity: bool,
) -> SpawnEntityBuilder
pub fn spawn_entity( level: Entity, type_name: impl ToString, select_created_entity: bool, ) -> SpawnEntityBuilder
Spawn a new entity with pre-populated data.
fn duplicate_example(
mut ui: ResMut<YoleckUi>,
mut edit: YoleckEdit<(&YoleckBelongsToLevel, &Vpeol2dPosition), With<Example>>,
mut writer: EventWriter<YoleckDirective>,
) {
let Ok((belongs_to_level, position)) = edit.single() else { return };
if ui.button("Duplicate").clicked() {
writer.write(
YoleckDirective::spawn_entity(
belongs_to_level.level,
"Example",
// Automatically select the newly created entity:
true,
)
// Create the new example entity 100 units below the current one:
.with(Vpeol2dPosition(position.0 - 100.0 * Vec2::Y))
.into(),
);
}
}
Trait Implementations§
Source§impl Event for YoleckDirective
impl Event for YoleckDirective
Source§const AUTO_PROPAGATE: bool = false
const AUTO_PROPAGATE: bool = false
When true, this event will always attempt to propagate when triggered, without requiring a call
to
Trigger::propagate
.Source§type Traversal = ()
type Traversal = ()
The component that describes which Entity to propagate this event to next, when propagation is enabled.
§fn register_component_id(world: &mut World) -> ComponentId
fn register_component_id(world: &mut World) -> ComponentId
Generates the [
ComponentId
] for this event type. Read more§fn component_id(world: &World) -> Option<ComponentId>
fn component_id(world: &World) -> Option<ComponentId>
Fetches the [
ComponentId
] for this event type,
if it has already been generated. Read moreAuto Trait Implementations§
impl Freeze for YoleckDirective
impl !RefUnwindSafe for YoleckDirective
impl Send for YoleckDirective
impl Sync for YoleckDirective
impl Unpin for YoleckDirective
impl !UnwindSafe for YoleckDirective
Blanket Implementations§
§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
Return the
T
[ShaderType
] for self
. When used in [AsBindGroup
]
derives, it is safe to assume that all images in self
exist.Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
, which can then be
downcast
into Box<dyn ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
, which can then be further
downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more