API reference
API reference
Select your platform
No SDKs available
No versions available

GLXFManager

GLXFManager

class GLXFManager(val context: <Error class: unknown class>)
GLXFManager is a class that manages the inflation of glXF files into Spatial SDK entities. It manages the full lifecycle of glXFs that are inflated, including deletion.
Example of inflating a glXF file:
// ImmersiveActivity.kt(your Spatial SDK activity)
private fun loadGLXF() {
  activityScope.launch {
    glXFManager.inflateGLXF(Uri.parse("apk:///demoproject1.glxf"))
  }
}

Constructors

NameSummary
GLXFManager
constructor(context: <Error class: unknown class>)

Types

NameSummary
Companion
object Companion

Properties

NameSummary
context
val context: <Error class: unknown class>

: the context of the GLXFManager, a.k.a. the Spatial activity object.

Functions

NameSummary
addReloadedGLXFUris
fun addReloadedGLXFUris(toReloadUris: Set<<Error class: unknown class>>, basePath: File)

Adds URIs that should be loaded using the local file system instead of the APK file system. This is used when hot reloading to reload GLXFs so that future GLXFs use the reloaded files. It is recommended not to use this unless you know what you’re doing.
deleteGLXF
fun deleteGLXF(entity: Entity)

Deletes the com.meta.spatial.toolkit.GLXFInfo the entity belongs to along with all other entities in that GLXFInfo.



fun deleteGLXF(glxfInfo: GLXFInfo)

Deletes root entity and all children. Removes references to the deleted GLXFInfo from the maps.
deleteGLXFEntityAndGetDeletedChildren
fun deleteGLXFEntityAndGetDeletedChildren(entity: Entity): Set<Entity>

Deletes a GLXF entity and get the deleted children. This is used for handling the deletion of children entities when deleting a GLXF entity. It is recommended not to use this unless you know what you’re doing.
getGLXFInfo
fun getGLXFInfo(keyName: String): GLXFInfo

Returns the GLXFInfo object for the given keyName.
getNestedGLXFInfo
fun getNestedGLXFInfo(parentInfo: GLXFInfo, childName: String): GLXFInfo?

Gets the nested GLXFInfo for a given child name.



fun getNestedGLXFInfo(parentInfo: GLXFInfo, childNamePathList: List<String>): GLXFInfo?

Gets the nested GLXFInfo for a given list of child names. The first name should be the highest level child name, with each subsequent name being a child of that nested GLXFInfo
hasGLXFInfoForUri
fun hasGLXFInfoForUri(uri: <Error class: unknown class>): Boolean

Checks if there is a GLXFInfo object for a given URI. This is useful for checking if a glXF file is in use. It is used mostly for hot reloading glXFs.
inflateComposition
suspend fun inflateComposition(compositionName: String, assetFolderPath: String = "scenes", rootEntity: Entity = Entity.createGlobal(), keyName: String? = null, onLoaded: (GLXFInfo) -> Unit = {}): GLXFInfo?

Parses the Composition glxf file and calls inflateGLXF, inflates a GLXF file into a GLXFInfo object, adds it to the map of GLXFInfo objects, and sets the GLXF component on the root entity of the GLXF file.
inflateGLXF
suspend fun inflateGLXF(uri: <Error class: unknown class>, rootEntity: Entity = defaultCreateEntity(null), keyName: String? = null, onLoaded: (GLXFInfo) -> Unit = {}): GLXFInfo?

suspend fun inflateGLXF(uri: <Error class: unknown class>, overrideCreateEntity: (<Error class: unknown class>?) -> Entity = defaultCreateEntity, rootEntity: Entity = overrideCreateEntity(null), keyName: String? = null, onLoaded: (GLXFInfo) -> Unit = {}): GLXFInfo?

Inflates a GLXF file into a GLXFInfo object, adds it to the map of GLXFInfo objects, and sets the GLXF component on the root entity of the GLXF file.
reloadGLXFsFromFile
suspend fun reloadGLXFsFromFile(oldFileName: <Error class: unknown class>, newFileName: <Error class: unknown class>, meshManager: MeshManager): <Error class: unknown class>

Reloads GLXFs from a file. This is used for hot reloading glXFs. We recommend not using this unless you know what you’re doing.
setDefaultCreateEntity
fun setDefaultCreateEntity(overrideCreateEntity: (<Error class: unknown class>?) -> Entity)

Developer can override the default entity creation function
setReloadType
fun setReloadType(reloadType: GLXFReloadType)

Developer can pick how GLXFs reload. The default reload type of GLXFManager is DELETE_AND_RECREATE_ENTITIES.
tryGetGLXFInfo
fun tryGetGLXFInfo(keyName: String): GLXFInfo?

Returns the GLXFInfo object for the given keyName, or null if it doesn’t exist.

Companion

object Companion

Functions

NameSummary
isSupportedGLXFExtension
fun isSupportedGLXFExtension(fileName: String): Boolean

Determine whether a file type can be loaded by GLXFManager into an inflated GLXFInfo
Did you find this page helpful?