// Get the SceneObject associated with the entity (returns a CompletableFuture)
systemManager.findSystem<SceneObjectSystem>().getSceneObject(entity)?.thenAccept { sceneObject ->
if (sceneObject is PanelSceneObject) {
// Now you can work with the panel
}
}
class PanelSceneObject : SceneObject
PanelSceneObject
(
scene
, ctx
, intent
, ent
, config
, displayCreator
)
|
Signature
constructor(scene: Scene?, ctx: SpatialContext, intent: Intent, ent: Entity?, config: PanelConfigOptions = PanelConfigOptions(), displayCreator: (ctx: SpatialContext, panelSurface: PanelSurface, <Error class: unknown class>, config: PanelConfigOptions) -> PanelDisplay = { ctx_, panelSurface_, intent_, config_ ->
PanelDisplay(ctx_, panelSurface_, config_.calcDPI(), intent = intent_)
})Parameters
scene:
Scene?
ctx:
SpatialContext
intent:
Intent
ent:
Entity?
config:
PanelConfigOptions
displayCreator:
Function4
Returns |
PanelSceneObject
(
scene
, ctx
, id
, ent
, config
, displayCreator
)
|
Signature
constructor(scene: Scene?, ctx: SpatialContext, id: Class<*>?, ent: Entity?, config: PanelConfigOptions = PanelConfigOptions(), displayCreator: (ctx: SpatialContext, panelSurface: PanelSurface, <Error class: unknown class>, config: PanelConfigOptions) -> PanelDisplay = { ctx_, panelSurface_, intent_, config_ ->
PanelDisplay(ctx_, panelSurface_, config_.calcDPI(), intent = intent_)
})Parameters
scene:
Scene?
ctx:
SpatialContext
id:
Class?
ent:
Entity?
config:
PanelConfigOptions
displayCreator:
Function4
Returns |
PanelSceneObject
(
scene
, ctx
, ent
, config
, getView
, displayCreator
)
|
Signature
constructor(scene: Scene?, ctx: SpatialContext, ent: Entity?, config: PanelConfigOptions = PanelConfigOptions(), getView: (<Error class: unknown class>) -> <Error class: unknown class>, displayCreator: (ctx: SpatialContext, panelSurface: PanelSurface, getView: (<Error class: unknown class>) -> <Error class: unknown class>, config: PanelConfigOptions) -> PanelDisplay = { ctx_, panelSurface_, getView_, config_ ->
PanelDisplay(
ctx_,
panelSurface_,
config_.calcDPI(),
getView = getView_,
themeResourceId = config_.themeResourceId,
)
})Parameters
scene:
Scene?
ctx:
SpatialContext
ent:
Entity?
config:
PanelConfigOptions
getView:
Function1
displayCreator:
Function4
Returns |
PanelSceneObject
(
scene
, ctx
, id
, ent
, config
, displayCreator
)
|
Signature
constructor(scene: Scene?, ctx: SpatialContext, id: Int, ent: Entity?, config: PanelConfigOptions = PanelConfigOptions(), displayCreator: (ctx: SpatialContext, panelSurface: PanelSurface, getView: (<Error class: unknown class>) -> <Error class: unknown class>, config: PanelConfigOptions) -> PanelDisplay = { ctx_, panelSurface_, getView_, config_ ->
PanelDisplay(
ctx_,
panelSurface_,
config_.calcDPI(),
getView = getView_,
themeResourceId = config_.themeResourceId,
)
})Parameters
scene:
Scene?
ctx:
SpatialContext
id:
Int
ent:
Entity?
config:
PanelConfigOptions
displayCreator:
Function4
Returns |
PanelSceneObject
(
scene
, ent
, config
)
|
Signature
constructor(scene: Scene?, ent: Entity?, config: PanelConfigOptions = PanelConfigOptions()) Parameters Returns |
PanelSceneObject
(
scene
, ent
, opts
)
|
Signature
constructor(scene: Scene?, ent: Entity?, opts: PanelConfigOptions2) Parameters Returns |
PanelSceneObject
(
scene
, ctx
, ent
, opts
, displayCreator
)
|
Signature
constructor(scene: Scene?, ctx: SpatialContext, ent: Entity?, opts: PanelConfigOptions2, displayCreator: (ctx: SpatialContext, panelSurface: PanelSurface, options: PanelConfigOptions2) -> PanelDisplay = { ctx_, panelSurface_, options_ ->
val style = options_.style() ?: StyleConfigOptions2()
val resolution = options_.resolution() ?: ResolutionConfigOptions2()
val layout = options_.get(LayoutOptions::class.java)!!
when (layout) {
is ContentViewConfigOptions2 ->
PanelDisplay(
ctx_,
panelSurface_,
resolution.dpi,
getView = (layout as ContentViewConfigOptions2).getView(),
themeResourceId = style.themeResourceId,
)
is ActivityConfigOptions2 ->
PanelDisplay(
ctx_,
panelSurface_,
resolution.dpi,
intent = ((layout as ActivityConfigOptions2).getIntent())(ctx_),
)
else ->
throw IllegalArgumentException(
"Missing panel layout config options, use activity or contentView API to setup the panel layout."
)
}
})Parameters Returns |
entity
:
Entity?
[Get] |
Signature
val entity: Entity? |
handle
:
Long
[Get] |
Signature
var handle: Long |
materials
:
Array?
[Get] |
Array of SceneMaterials created from this SceneObject's mesh property. Changes to the materials in this array will be unique to this SceneObject, but these materials will inhererit any changes made in the SceneMesh they come from.
Signature
var materials: Array<SceneMaterial>? |
mesh
:
SceneMesh?
[Get][Set] |
Reference to the SceneMesh used by this SceneObject. This property is a reference to the underlying mesh resource. Changes to the SceneMesh or its SceneMaterials will be reflected across all SceneObjects that reference it.
Signature
var mesh: SceneMesh? |
options
:
PanelConfigOptions2
[Get][Set] |
Signature
var options: PanelConfigOptions2 |
rootView
:
View?
[Get] |
Gets the root View of the panel's display.
Signature
val rootView: View? |
shapeType
:
PanelShapeType
[Get] |
Signature
val PanelSceneObject.shapeType: PanelShapeType |
addInputListener
(
listener
)
|
Add an input listener to this SceneObject.
Signature
fun addInputListener(listener: InputListener): Long Parameters
listener:
InputListener Returns
Long
|
attachDisplay
(
ctxt
, clickButtons
, displayCreator
)
|
Signature
fun attachDisplay(ctxt: SpatialContext, clickButtons: Int, displayCreator: (PanelSurface) -> PanelDisplay) Parameters |
createIsdkComponents
(
entity
)
|
Creates the IsdkPanelDimensions and IsdkCurvedPanel components for the given entity, if they do not already exist. This method also updates the properties of these components from the PanelSceneObject properties.
This method is normally invoked by the IsdkComponentCreationSystem - you will only need to call this method directly if IsdkSystem is disabled.
Signature
fun PanelSceneObject.createIsdkComponents(entity: Entity) Parameters
entity:
Entity |
destroy
()
|
Destory this SceneObject.
Signature
fun destroy() |
destroyInternal
()
|
Destroy this SceneObject's native components.
Signature
open override fun destroyInternal() |
detachDisplay
()
|
Signature
fun detachDisplay() |
getDisplay
()
|
Gets the PanelDisplay associated with this panel.
Signature
fun getDisplay(): PanelDisplay |
getLayer
()
|
Gets the layer used by this panel.
Signature
fun getLayer(): SceneLayer? |
getPanelConfigOptions2
()
|
Signature
fun getPanelConfigOptions2(): PanelConfigOptions2 Returns |
getPanelShapeConfig
()
|
Gets the config used used to create this panel.
Signature
fun getPanelShapeConfig(): PanelShapeConfig? |
getSurface
()
|
Gets the PanelSurface associated with this panel.
Signature
fun getSurface(): Surface Returns
Surface
|
getSwapchain
()
|
Gets the SceneSwapchain associated with this panel.
Signature
fun getSwapchain(): SceneSwapchain? |
getTexture
()
|
Gets the texture used by this panel.
Signature
fun getTexture(): SceneTexture? |
onClick
(
hitInfo
, sourceOfInput
)
| |
onClickDown
(
hitInfo
, sourceOfInput
)
|
Handler for click downs on this SceneObject. Use onClick() to ensure user releases the click on the SceneObject.
Signature
fun onClickDown(hitInfo: HitInfo, sourceOfInput: Entity) |
onHoverStart
(
sourceOfInput
)
|
Handler for the start of hovers on this SceneObject.
Signature
open fun onHoverStart(sourceOfInput: Entity) Parameters
sourceOfInput:
Entity |
onHoverStop
(
sourceOfInput
)
|
Handler for the termination of hovers on this SceneObject.
Signature
open fun onHoverStop(sourceOfInput: Entity) Parameters
sourceOfInput:
Entity |
onInput
(
hitInfo
, sourceOfInput
, changed
, buttonState
, downTime
)
|
Handler to handle generic input.
Signature
open fun onInput(hitInfo: HitInfo, sourceOfInput: Entity, changed: Int, buttonState: Int, downTime: Long): Boolean Parameters
hitInfo:
HitInfo
sourceOfInput:
Entity
changed:
Int
buttonState:
Int
downTime:
Long
Returns
Boolean
|
onPointerEvent
(
hitInfo
, type
, sourceOfInput
, scrollInfo
, semanticType
)
|
Handler to handle pointer events on this SceneObject.
Signature
open fun onPointerEvent(hitInfo: HitInfo, type: Int, sourceOfInput: Entity, scrollInfo: Vector2, semanticType: Int = SemanticType.Unknown.id) Parameters
hitInfo:
HitInfo
type:
Int
sourceOfInput:
Entity
scrollInfo:
Vector2
semanticType:
Int
|
removeInputListener
(
id
)
|
Remove an input listener by id.
Signature
fun removeInputListener(id: Long) Parameters
id:
Long
|
reshape
(
shapeConfig
)
|
Destroy and recreate the PanelShape with the given config.
Signature
fun reshape(shapeConfig: PanelShapeConfig) Parameters
shapeConfig:
PanelShapeConfig |
reshape
(
options
)
|
Signature
fun reshape(options: PanelConfigOptions2) Parameters
options:
PanelConfigOptions2 |
setIsVisible
(
isVisible
)
|
Set whether this SceneObject is visible.
Signature
fun setIsVisible(isVisible: Boolean) Parameters
isVisible:
Boolean
|
setLocalNodePose
(
node
, pose
)
|
Sets the local transform of the node (relative to it's parent) to the input pose
Signature
fun setLocalNodePose(node: Int, pose: Pose) Parameters
node:
Int
pose:
Pose |
setPosition
(
position
)
|
Set the 3D position of this SceneObject.
Signature
fun setPosition(position: Vector3) Parameters
position:
Vector3 |
setPosition
(
x
, y
, z
)
|
Set the 3D position of this SceneObject.
Signature
fun setPosition(x: Float, y: Float, z: Float) Parameters
x:
Float
y:
Float
z:
Float
|
setRotation
(
pitch
, yaw
, roll
)
|
Set the rotation of this SceneObject.
Signature
fun setRotation(pitch: Float, yaw: Float, roll: Float) Parameters
pitch:
Float
yaw:
Float
roll:
Float
|
setRotationQuat
(
quat
)
|
Set the rotation of this SceneObject.
Signature
fun setRotationQuat(quat: Quaternion) Parameters
quat:
Quaternion |
setRotationQuat
(
x
, y
, z
, w
)
|
Set the rotation of this SceneObject.
Signature
fun setRotationQuat(x: Float, y: Float, z: Float, w: Float) Parameters
x:
Float
y:
Float
z:
Float
w:
Float
|
setScale
(
scale
)
|
Set the scale of the model. The default value is 1.0f.
Signature
open override fun setScale(scale: Vector3) Parameters
scale:
Vector3 |
setSceneMesh
(
mesh
, name
)
| |
shouldFrustumCull
(
cull
)
|
Whether this SceneObject can be frustum culled (default is true)
Signature
fun shouldFrustumCull(cull: Boolean) Parameters
cull:
Boolean
|
stopInput
(
sourceOfInput
, downTime
)
|
This function calls the stopInput function on all InputListener for this SceneObject. This is called automatically by Scene when handling inputs.
Signature
open fun stopInput(sourceOfInput: Entity, downTime: Long) Parameters
sourceOfInput:
Entity
downTime:
Long
|
updateAnimationTrackToTime
(
track
, timeInSeconds
)
|
Update the local transforms of the model to match the given animation track at the specified time (matching keyframe time in the glTF).
Track can be found from SceneMesh.getAnimationTracks
Signature
fun updateAnimationTrackToTime(track: Int, timeInSeconds: Float) Parameters
track:
Int
timeInSeconds:
Float
|
updateIsdkComponentProperties
(
entity
)
|
Updates the properties of the IsdkPanelDimensions and IsdkCurvedPanel components of the given entity to keep them in sync with the SpatialSDK Toolkit PanelSceneObject.
This method is normally invoked by the IsdkSystem - you will only need to call this method directly if IsdkSystem is disabled.
This method updates the dimensions and local offset of the IsdkPanelDimensions component based on the panel's shape configuration. If the entity does not have an IsdkPanelDimensions component, this method will do nothing.
For QUAD-shaped panels, the width and height are updated based on the panel's shape configuration or the quad configuration options. The local offset is recalculated if necessary, and the field of view (FOV) is set to 0.0f.
For CYLINDER-shaped panels, the width, height, and radius are updated based on the panel's shape configuration or the cylinder configuration options. The FOV is calculated from the radius and width to ensure the correct curvature.
If the panel's shape type is neither of these, a warning is logged, and the method returns without making any changes.
Signature
fun PanelSceneObject.updateIsdkComponentProperties(entity: Entity) Parameters
entity:
Entity |
updateNodeLocalPoseToObjectPose
(
node
, pose
)
|
Sets the local transform of a node (relative to it's parent) such that the resulting object transform (relative to the model) is placed at the input pose
WARNING: This may be an expensive operation as it recalculates object positions
Signature
fun updateNodeLocalPoseToObjectPose(node: Int, pose: Pose) Parameters
node:
Int
pose:
Pose |
updateSceneMesh
(
meshModifier
)
|
Modify and update this SceneObject's mesh.
Signature
fun updateSceneMesh(meshModifier: SceneMesh.() -> Unit) Parameters
meshModifier:
Function1
|