threlte logo
@threlte/studio

useStudioObjectsRegistry

Examples

import { useStudioObjectsRegistry } from '@threlte/studio/extensions'

const registry = useStudioObjectsRegistry()

// get all currently registered studio objects
console.log(registry.objects)

// add a studio object to the registry
registry.addObject(object)

// remove a studio object from the registry
registry.removeObject(object)

// check if an object is or is a child of a studio object
console.log(registry.isOrIsChildOfStudioObject(object)) // true | false

Creating a studio object reference

<script lang="ts">
  import { useStudioObjectsRegistry } from '@threlte/studio/extensions'

  const registry = useStudioObjectsRegistry()
  const studioObject = registry.studioObjectRef()
</script>

<T.Mesh bind:ref={studioObject.ref} />