MeshLibrary
Library of meshes.
MeshLibrary.swift:11class MeshLibrary
A library of meshes. Contains a list of Mesh
resources, each with a name and ID. Each item can also include collision and navigation shapes. This resource is used in GridMap
.
Superclasses
class Resource
Base class for serializable objects.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Type members
Instance members
func clear(
) Clears the library.
func createItem(id: Int32
) Creates a new item in the library with the given ID.
func findItemByName(String
) -> Int32 Returns the first item with the given name.
func getItemList(
) -> PackedInt32Array Returns the list of item IDs in use.
func getItemMesh(id: Int32
) -> Mesh? Returns the item’s mesh.
func getItemMeshTransform(id: Int32
) -> Transform3D Returns the transform applied to the item’s mesh.
func getItemName(id: Int32
) -> String Returns the item’s name.
func getItemPreview(id: Int32
) -> Texture2D? When running in the editor, returns a generated item preview (a 3D rendering in isometric perspective). When used in a running project, returns the manually-defined item preview which can be set using
setItemPreview(id:texture:)
. Returns an emptyTexture2D
if no preview was manually set in a running project.func getItemShapes(id: Int32
) -> GArray Returns an item’s collision shapes.
func getLastUnusedItemId(
) -> Int32 Gets an unused ID for a new item.
func removeItem(id: Int32
) Removes the item.
func setItemMesh(id: Int32, mesh: Mesh?
) Sets the item’s mesh.
func setItemMeshTransform(id: Int32, meshTransform: Transform3D
) Sets the transform to apply to the item’s mesh.
func setItemName(id: Int32, name: String
) Sets the item’s name.
func setItemPreview(id: Int32, texture: Texture2D?
) Sets a texture to use as the item’s preview icon in the editor.
func setItemShapes(id: Int32, shapes: GArray
) Sets an item’s collision shapes.