pub struct TileMapBrush {
pub tile_set: Option<TileSetResource>,
pub pages: TileGridMap<TileMapBrushPage>,
pub macros: BrushMacroInstanceList,
pub change_flag: ChangeFlag,
}Expand description
Tile map brush is a set of tiles arranged in arbitrary shape, that can be used to draw on a tile map.
Fields§
§tile_set: Option<TileSetResource>The tile set used by this brush. This must match the tile set of any tile map that this brush is used to edit.
pages: TileGridMap<TileMapBrushPage>The set of pages contained in the brush Each page is associated with 2D coordinates within a palette of brush pages. This allows pages to be selected much like tiles are selected, and it allows users to customize the organization of pages.
macros: BrushMacroInstanceListUntyped data stored in this brush for use by some macro.
change_flag: ChangeFlagA record of whether the brush has changed since last time it was saved.
Implementations§
Source§impl TileMapBrush
impl TileMapBrush
Source§impl TileMapBrush
impl TileMapBrush
Sourcepub fn block_until_tile_set_is_loaded(&self) -> bool
pub fn block_until_tile_set_is_loaded(&self) -> bool
Return true after blocking to wait for the brush’s tile set to load, if the tile set loads successfully, or if the tile set has no brush. Return false if any error occurs while trying to load the tile set.
Sourcepub fn tile_set(&self) -> Option<TileSetResource>
pub fn tile_set(&self) -> Option<TileSetResource>
Return the tile set for this brush, blocking if the tile set is not yet loaded. None is returned if this brush has no tile set or the tile set fails to load.
Sourcepub fn has_tile_at(&self, page: Vector2<i32>, tile: Vector2<i32>) -> bool
pub fn has_tile_at(&self, page: Vector2<i32>, tile: Vector2<i32>) -> bool
True if there is a tile at the given position.
Sourcepub fn has_page_at(&self, page: Vector2<i32>) -> bool
pub fn has_page_at(&self, page: Vector2<i32>) -> bool
True if there is a page at the given position.
Sourcepub fn tile_redirect(
&self,
handle: TileDefinitionHandle,
) -> Option<TileDefinitionHandle>
pub fn tile_redirect( &self, handle: TileDefinitionHandle, ) -> Option<TileDefinitionHandle>
The handle stored at the given position.
Sourcepub fn pages_bounds(&self) -> OptionTileRect
pub fn pages_bounds(&self) -> OptionTileRect
Returns bounding rectangle of pages in grid coordinates.
Sourcepub fn page_icon(&self, page: Vector2<i32>) -> Option<TileDefinitionHandle>
pub fn page_icon(&self, page: Vector2<i32>) -> Option<TileDefinitionHandle>
The handle of the tile that represents the page at the given position.
Sourcepub fn tiles_bounds(
&self,
stage: TilePaletteStage,
page: Vector2<i32>,
) -> OptionTileRect
pub fn tiles_bounds( &self, stage: TilePaletteStage, page: Vector2<i32>, ) -> OptionTileRect
The bounds of the tiles on the given page.
Sourcepub fn find_tile_at_position(
&self,
stage: TilePaletteStage,
page: Vector2<i32>,
position: Vector2<i32>,
) -> Option<TileDefinitionHandle>
pub fn find_tile_at_position( &self, stage: TilePaletteStage, page: Vector2<i32>, position: Vector2<i32>, ) -> Option<TileDefinitionHandle>
The handle of the tile at the given position, either the icon of a page or the tile stored at that position in the brush.
Sourcepub fn get_tiles<I: Iterator<Item = Vector2<i32>>>(
&self,
stage: TilePaletteStage,
page: Vector2<i32>,
iter: I,
tiles: &mut Tiles,
)
pub fn get_tiles<I: Iterator<Item = Vector2<i32>>>( &self, stage: TilePaletteStage, page: Vector2<i32>, iter: I, tiles: &mut Tiles, )
The tile definition handles of the tiles at the given positions on the given page.
Sourcepub fn is_missing_tile_set(&self) -> bool
pub fn is_missing_tile_set(&self) -> bool
Return true if this brush has no tile set.
Sourcepub fn palette_render_loop<F>(
&self,
stage: TilePaletteStage,
page: Vector2<i32>,
func: F,
)
pub fn palette_render_loop<F>( &self, stage: TilePaletteStage, page: Vector2<i32>, func: F, )
Loops through the tiles of the given page and finds the render data for each tile in the tile set, then passes it to the given function.
Sourcepub fn get_tile_render_data(
&self,
position: ResourceTilePosition,
) -> Option<TileRenderData>
pub fn get_tile_render_data( &self, position: ResourceTilePosition, ) -> Option<TileRenderData>
Return the TileRenderData needed to render the tile at the given position on the given page.
If there is no tile at that position or the tile set is missing or not loaded, then None is returned.
If there is a tile and a tile set, but the handle of the tile does not exist in the tile set,
then the rendering data for an error tile is returned using TileRenderData::missing_tile().
Sourcepub fn redirect_handle(
&self,
position: ResourceTilePosition,
) -> Option<TileDefinitionHandle>
pub fn redirect_handle( &self, position: ResourceTilePosition, ) -> Option<TileDefinitionHandle>
The tiles of a brush are references to tiles in the tile set. This method converts positions within the brush into the handle that points to the corresponding tile definition within the tile set. If this brush does not contain a reference at the given position, then None is returned.
Sourcepub fn stamp_element(
&self,
position: ResourceTilePosition,
) -> Option<StampElement>
pub fn stamp_element( &self, position: ResourceTilePosition, ) -> Option<StampElement>
The stamp element for the given position, if the tile in that cell is used
to create a stamp. The StampElement::handle refers to the location of the tile within the
tile set, while the StampElement::source refers to the location of the tile within
the brush.
Sourcepub fn get_tile_bounds(
&self,
position: ResourceTilePosition,
) -> Option<TileMaterialBounds>
pub fn get_tile_bounds( &self, position: ResourceTilePosition, ) -> Option<TileMaterialBounds>
The TileMaterialBounds taken from the tile set for the tile in the brush at the given position.
Sourcepub fn is_free_at(&self, position: ResourceTilePosition) -> bool
pub fn is_free_at(&self, position: ResourceTilePosition) -> bool
Returns true if the brush is unoccupied at the given position.
Sourcepub async fn from_file(
path: &Path,
resource_manager: ResourceManager,
io: &dyn ResourceIo,
) -> Result<Self, TileMapBrushResourceError>
pub async fn from_file( path: &Path, resource_manager: ResourceManager, io: &dyn ResourceIo, ) -> Result<Self, TileMapBrushResourceError>
Load a tile map brush resource from the specific file path.
Trait Implementations§
Source§impl Clone for TileMapBrush
impl Clone for TileMapBrush
Source§fn clone(&self) -> TileMapBrush
fn clone(&self) -> TileMapBrush
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TileMapBrush
impl Debug for TileMapBrush
Source§impl Default for TileMapBrush
impl Default for TileMapBrush
Source§fn default() -> TileMapBrush
fn default() -> TileMapBrush
Source§impl Reflect for TileMapBrushwhere
Self: 'static,
impl Reflect for TileMapBrushwhere
Self: 'static,
fn source_path() -> &'static str
fn try_clone_box(&self) -> Option<Box<dyn Reflect>>
fn type_name(&self) -> &'static str
fn derived_types() -> &'static [TypeId]
fn query_derived_types(&self) -> &'static [TypeId]
fn doc(&self) -> &'static str
Source§fn assembly_name(&self) -> &'static str
fn assembly_name(&self) -> &'static str
#[derive(Reflect)]) to ensure that this method will return correct assembly
name. In other words - there’s no guarantee, that any implementation other than proc-macro
will return a correct name of the assembly. Alternatively, you can use env!("CARGO_PKG_NAME")
as an implementation.Source§fn type_assembly_name() -> &'static str
fn type_assembly_name() -> &'static str
#[derive(Reflect)]) to ensure that this method will return correct assembly
name. In other words - there’s no guarantee, that any implementation other than proc-macro
will return a correct name of the assembly. Alternatively, you can use env!("CARGO_PKG_NAME")
as an implementation.fn fields_ref(&self, func: &mut dyn FnMut(&[FieldRef<'_, '_>]))
fn fields_mut(&mut self, func: &mut dyn FnMut(&mut [FieldMut<'_, '_>]))
fn into_any(self: Box<Self>) -> Box<dyn Any>
fn set( &mut self, value: Box<dyn Reflect>, ) -> Result<Box<dyn Reflect>, Box<dyn Reflect>>
fn as_any(&self, func: &mut dyn FnMut(&dyn Any))
fn as_any_mut(&mut self, func: &mut dyn FnMut(&mut dyn Any))
fn as_reflect(&self, func: &mut dyn FnMut(&dyn Reflect))
fn as_reflect_mut(&mut self, func: &mut dyn FnMut(&mut dyn Reflect))
Source§fn set_field(
&mut self,
field_name: &str,
value: Box<dyn Reflect>,
func: &mut dyn FnMut(Result<Box<dyn Reflect>, SetFieldError>),
)
fn set_field( &mut self, field_name: &str, value: Box<dyn Reflect>, func: &mut dyn FnMut(Result<Box<dyn Reflect>, SetFieldError>), )
#[reflect(setter = ..)] or falls back to
Reflect::field_mutfn field( &self, name: &str, func: &mut dyn FnMut(Option<&(dyn Reflect + 'static)>), )
fn field_mut( &mut self, name: &str, func: &mut dyn FnMut(Option<&mut (dyn Reflect + 'static)>), )
fn as_array(&self, func: &mut dyn FnMut(Option<&(dyn ReflectArray + 'static)>))
fn as_array_mut( &mut self, func: &mut dyn FnMut(Option<&mut (dyn ReflectArray + 'static)>), )
fn as_list(&self, func: &mut dyn FnMut(Option<&(dyn ReflectList + 'static)>))
fn as_list_mut( &mut self, func: &mut dyn FnMut(Option<&mut (dyn ReflectList + 'static)>), )
fn as_inheritable_variable( &self, func: &mut dyn FnMut(Option<&(dyn ReflectInheritableVariable + 'static)>), )
fn as_inheritable_variable_mut( &mut self, func: &mut dyn FnMut(Option<&mut (dyn ReflectInheritableVariable + 'static)>), )
fn as_hash_map( &self, func: &mut dyn FnMut(Option<&(dyn ReflectHashMap + 'static)>), )
fn as_hash_map_mut( &mut self, func: &mut dyn FnMut(Option<&mut (dyn ReflectHashMap + 'static)>), )
fn as_handle( &self, func: &mut dyn FnMut(Option<&(dyn ReflectHandle + 'static)>), )
fn as_handle_mut( &mut self, func: &mut dyn FnMut(Option<&mut (dyn ReflectHandle + 'static)>), )
Source§impl ResourceData for TileMapBrush
impl ResourceData for TileMapBrush
Source§fn save(&mut self, path: &Path) -> Result<(), Box<dyn Error>>
fn save(&mut self, path: &Path) -> Result<(), Box<dyn Error>>
Source§fn can_be_saved(&self) -> bool
fn can_be_saved(&self) -> bool
true if the resource data can be saved to a file, false - otherwise. Not every
resource type supports saving, for example there might be temporary resource type that is
used only at runtime which does not need saving at all.Source§fn try_clone_box(&self) -> Option<Box<dyn ResourceData>>
fn try_clone_box(&self) -> Option<Box<dyn ResourceData>>
None if the underlying type is
non-cloneable.Source§impl TypeUuidProvider for TileMapBrush
impl TypeUuidProvider for TileMapBrush
Source§impl Visit for TileMapBrush
impl Visit for TileMapBrush
Source§fn visit(&mut self, name: &str, visitor: &mut Visitor) -> VisitResult
fn visit(&mut self, name: &str, visitor: &mut Visitor) -> VisitResult
Auto Trait Implementations§
impl Freeze for TileMapBrush
impl !RefUnwindSafe for TileMapBrush
impl Send for TileMapBrush
impl Sync for TileMapBrush
impl Unpin for TileMapBrush
impl UnsafeUnpin for TileMapBrush
impl !UnwindSafe for TileMapBrush
Blanket Implementations§
Source§impl<T> AsyncTaskResult for T
impl<T> AsyncTaskResult for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> FieldValue for Twhere
T: Reflect,
impl<T> FieldValue for Twhere
T: Reflect,
Source§fn field_value_as_any_ref(&self) -> &(dyn Any + 'static)
fn field_value_as_any_ref(&self) -> &(dyn Any + 'static)
self to a &dyn AnySource§fn field_value_as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn field_value_as_any_mut(&mut self) -> &mut (dyn Any + 'static)
self to a &mut dyn Anyfn field_value_as_reflect(&self) -> &(dyn Reflect + 'static)
fn field_value_as_reflect_mut(&mut self) -> &mut (dyn Reflect + 'static)
fn type_name(&self) -> &'static str
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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> ⓘ
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> ⓘ
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 moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T, U> ObjectOrVariant<T> for Uwhere
PhantomData<U>: ObjectOrVariantHelper<T, U>,
impl<T, U> ObjectOrVariant<T> for Uwhere
PhantomData<U>: ObjectOrVariantHelper<T, U>,
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().Source§impl<T> ReflectBase for Twhere
T: Reflect,
impl<T> ReflectBase for Twhere
T: Reflect,
fn as_any_raw(&self) -> &(dyn Any + 'static)
fn as_any_raw_mut(&mut self) -> &mut (dyn Any + 'static)
Source§impl<T> ResolvePath for Twhere
T: Reflect,
impl<T> ResolvePath for Twhere
T: Reflect,
fn resolve_path<'p>( &self, path: &'p str, func: &mut dyn FnMut(Result<&(dyn Reflect + 'static), ReflectPathError<'p>>), )
fn resolve_path_mut<'p>( &mut self, path: &'p str, func: &mut dyn FnMut(Result<&mut (dyn Reflect + 'static), ReflectPathError<'p>>), )
fn get_resolve_path<'p, T>(
&self,
path: &'p str,
func: &mut dyn FnMut(Result<&T, ReflectPathError<'p>>),
)where
T: Reflect,
fn get_resolve_path_mut<'p, T>(
&mut self,
path: &'p str,
func: &mut dyn FnMut(Result<&mut T, ReflectPathError<'p>>),
)where
T: Reflect,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.