pub struct TileMapBrush {
pub tile_set: Option<TileSetResource>,
pub pages: TileGridMap<TileMapBrushPage>,
pub change_count: 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.
change_count: ChangeFlagA count of changes since last save. New changes add +1. Reverting to previous states add -1. Reverting to a state before the last save can result in negative values. Saving is unnecessary whenever this value is 0.
Implementations§
Source§impl TileMapBrush
impl TileMapBrush
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 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 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 TileMapBrush
impl Reflect for TileMapBrush
fn source_path() -> &'static str
fn type_name(&self) -> &'static str
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_info(&self, func: &mut dyn FnMut(&[FieldInfo<'_, '_>]))
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))
fn fields(&self, func: &mut dyn FnMut(&[&dyn Reflect]))
fn fields_mut(&mut self, func: &mut dyn FnMut(&mut [&mut dyn Reflect]))
fn field(&self, name: &str, func: &mut dyn FnMut(Option<&dyn Reflect>))
fn field_mut( &mut self, name: &str, func: &mut dyn FnMut(Option<&mut dyn Reflect>), )
Source§fn set_field(
&mut self,
field: &str,
value: Box<dyn Reflect>,
func: &mut dyn FnMut(Result<Box<dyn Reflect>, Box<dyn Reflect>>),
)
fn set_field( &mut self, field: &str, value: Box<dyn Reflect>, func: &mut dyn FnMut(Result<Box<dyn Reflect>, Box<dyn Reflect>>), )
#[reflect(setter = ..)] or falls back to
Reflect::field_mutfn 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)>), )
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§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 !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 as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Any. Could be used to downcast a trait object
to a particular type.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Any. Could be used to downcast a trait object
to a particular type.fn into_any(self: Box<T>) -> Box<dyn Any>
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> FieldValue for Twhere
T: 'static,
impl<T> FieldValue for Twhere
T: 'static,
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<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<T> ScriptMessagePayload for T
impl<T> ScriptMessagePayload for T
Source§fn as_any_ref(&self) -> &(dyn Any + 'static)
fn as_any_ref(&self) -> &(dyn Any + 'static)
self as &dyn AnySource§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
self as &dyn AnySource§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.