SceneViewDescription
Package: Libraries.Interface.Controls.Scenes · Inherits from: Libraries.Language.Object
SceneViewDescription puts what the scene editor's 3D camera sees into words for a screen reader. Describe gives the item nearest the middle of the view and its distance, which way the camera faces, then the next items and how many are in view: "Car, 12 meters. North-east, down 20. Tree, Rock, 5 in view." Distances are in meters, to one decimal place. The heading takes +Z as north and +X as east, as EditorCamera3D's yaw does.
Example Code
use Libraries.Interface.Controls.Scenes.SceneViewDescription
use Libraries.Interface.Controls.Scenes.SceneEditor
use Libraries.Interface.Controls.Scenes.Layers.EditorLayer3D
SceneEditor editor
SceneViewDescription description
if editor:GetSelectedLayer() is EditorLayer3D
EditorLayer3D layer = cast(EditorLayer3D, editor:GetSelectedLayer())
text words = description:Describe(layer, editor:GetEditorTag())
end
Actions
Describe(Libraries.Interface.Controls.Scenes.Layers.EditorLayer3D layer, text editorTag)
Describes what the layer's editor camera sees.
Parameters
layerLibraries.Interface.Controls.Scenes.Layers.EditorLayer3D: The 3D layer whose editor camera is describededitorTagtext: The scene editor's tag, which marks its own items
Returns
text: The sentence to say
DescribeItem(Libraries.Interface.Controls.Scenes.Items.EditorCamera3D camera, Libraries.Interface.Item3D item, integer place, integer count)
Returns one step's sentence: name, distance, the compass direction from the camera, then its place in the list, such as "Tree, 8 meters, north-west, 2 of 7."
Parameters
cameraLibraries.Interface.Controls.Scenes.Items.EditorCamera3D: The editor cameraitemLibraries.Interface.Item3D: The itemplaceinteger: Its place in the list, from 1countinteger: How many items the list has
Returns
text: The sentence
GetDirectionText(Libraries.Interface.Controls.Scenes.Items.EditorCamera3D camera)
Returns the camera's heading, then its tilt only when that is more than 5 degrees: "North-east", "North-east, down 20", "South, straight down".
Parameters
cameraLibraries.Interface.Controls.Scenes.Items.EditorCamera3D: The editor camera
Returns
text: The heading and tilt
GetDistanceText(number distance)
Returns a distance in meters, to one decimal place, with no ".0": "0.4 meters", "1 meter", "1.2 meters", "12 meters".
Parameters
distancenumber: The distance, in world units
Returns
text: The distance in words
GetHeadingName(number yaw)
Returns the compass word for a yaw in degrees: 0 is north (+Z) and 90 is east (+X).
Parameters
yawnumber: The yaw, in degrees
Returns
text: The compass word, such as "North-east"
GetItemsInView(Libraries.Interface.Controls.Scenes.Layers.EditorLayer3D layer, text editorTag)
Returns the items at least partly in the camera's view: showing, and not the scene editor's own items. They are found the way the renderer finds what to draw: the layer's render tree is searched with the camera's view (RenderTree3D:CollectVisible), which skips whole parts of the scene outside it, so the cost follows what is in view, not the size of the scene, and each item is tested with its real bounds.
Parameters
layerLibraries.Interface.Controls.Scenes.Layers.EditorLayer3D: The 3D layereditorTagtext: The scene editor's tag, which marks its own items
Returns
Libraries.Containers.Array<Libraries.Interface.Item3D>: The items in view
GetItemsLeftToRight(Libraries.Interface.Controls.Scenes.Layers.EditorLayer3D layer, text editorTag)
Returns the items in view from left to right as the camera sees them, with any terrain once at the end, for stepping through them (SceneEditor:BrowseView).
Parameters
layerLibraries.Interface.Controls.Scenes.Layers.EditorLayer3D: The 3D layereditorTagtext: The scene editor's tag, which marks its own items
Returns
Libraries.Containers.Array<Libraries.Interface.Item3D>: The items, left to right
GetLastNearest()
Returns the item the last Describe named first, the one nearest the middle of the view, or undefined if nothing was in view.
Returns
Libraries.Interface.Item3D: The item, or undefined