Skip to main content

Auto Values

Introduction

Auto values are values which are internally computed by SceneComposer or Candera or inherited from other objects in certain situations. In these situations, it is useful to show the computed value and an information that the value is computed.

Example: TextNode2D.LineHeight property can have a computed value. Setting it to any other value than 0, will make the value fixed and effectively used by Candera to separate the lines of text. But when setting it to 0, internally, Candera will use instead the line height value (let’let’s say 42) specified by the associated text style. In this case, the value 0 is a trigger for computing a different value internally. And we call the computed 42 value an auto value.



Triggers of Auto-Value Properties

There are several triggers for a property to have an auto value:

  1. Value. This is the most common one - a certain value of the property makes the property auto (usually the default value is the trigger value in examples above, for Line Height, 0 is also the default value. In this case, having the default value triggers becoming auto).

  2. Other configuration like properties of parent, parent type, and so on.. (example: when a node is a child of a layout group, the node’node’s position becomes auto because it’it’s computed by the layout group).

  3. Always Auto they are values computed by Candera for properties which are not configurable (for example, PreferredSize is a value computed during measuring elements in a Layout process. This is not configurable, but is a value computed based on other values. It may be meaningful for users when understanding of layout is needed).



Functionality of Auto-Values

The text "(Auto)" inside of a readonlyread-only properties field indicates that this property has an Auto-Value. The user can interact with auto-values through the switch button which is available in the Properties panel on the right side of the Auto-Value field. In the image below, you can see that the vertical and horizontal size value is an Auto-Value, each having a corresponding switch button on their right.

drawing-4-1676293607.png

As can be seen in the image above, a suffix indicates that the value is "auto". As expected, if the button is used the value will become editable and the user will be allowed to modify it as desired.



Auto-Value Properties

  • TextNode2D.LineHeight
    • Type: integer
    • Trigger: having default value (0)
    • Is metainfo property: No
    • Retrieve auto value: retrieve the line height metric from the metrics of the associated TextStyle
  • CanvasText.LineHeight
    • Same as TextNode2D.LineHeight
  • Node2D.Position
    • Type: Vector2
    • Trigger: parent is layouter
    • Is metainfo property: No
    • Retrieve auto value: query SCHost, requires scene being loaded
  • Node2D.Scale
    • Type: Vector2
    • Trigger: parent is layouter and stretch is not None except for when the node has a 9-patch image
    • Is metainfo property: No
    • Retrieve auto value: query SCHost, requires scene being loaded
  • CanvasNode.Position
    • Type: Vector3
    • Trigger: parent is layouter. Only X and Y are auto
    • Is metainfo property: No
    • Retrieve auto value: query SCHost, requires scene being loaded
  • CanvasNode.Scale
    • Type: Vector2
    • Trigger: parent is layouter and stretch is not None except for when the node has a 9-patch image
    • Is metainfo property: No
    • Retrieve auto value: query SCHost, requires scene being loaded
  • Node2D.BoundingRectangle
    • Type: Rectangle
    • Trigger: Width and Height having default value (-1)
    • Is metainfo property: No
    • Retrieve auto value: query SCHost, add method to retrieve the computed bounding box, requires scene being loaded
  • Camera2D.Viewport
    • Type: Rectangle
    • Trigger: Width and Height having default value (-1)
    • Is metainfo property: No
    • Retrieve auto value: compute the value based on RenderTarget dimensions and Candera rules
  • Camera2D.ScissorRectangle
    • Type: Rectangle (only Width and Height can be auto)
    • Trigger: Width and Height having default value (-1)
    • Is metainfo property: No
    • Retrieve auto value: compute the value based on RenderTarget dimensions and Candera rules
  • RenderTarget.Width
    • Type: integer
    • Trigger: having default value (-1)
    • Is metainfo property: Yes
    • Retrieve auto value: compute the value based on display dimensions (-1 means display width)
  • RenderTarget.Height
    • Type: integer
    • Trigger: having default value (-1)
    • Is metainfo property: Yes
    • Retrieve auto value: compute the value based on display dimensions (-1 means display height)
  • Node.Size (Layout)
    • Type: Vector2
    • Trigger: having default value (-1; -1)
    • Is metainfo property: Yes
    • Retrieve auto value: retrieve the ActualSize value from SCHost, which is computed by the Layouter. SCHost already acquires that value to use it to show the adorner for size (using a layout monitor which is notified about layout processing events and values).
  • CanvasNode.Size (Layout)
    • Type: Vector3 (only X and Y can be auto)
    • Trigger: having default values (-1; -1) for X and Y (only X and Y can be auto)
    • Is metainfo property: Yes
    • Retrieve auto value: retrieve the ActualSize value from SCHost, which is computed by the Layouter. SCHost already acquires that value to use it to show the adorner for size (using a layout monitor which is notified about layout processing events and values).
  • CanvasText.Size
    • This property is different from the layout size, but has the same name.
    • Type: Vector2
    • Trigger: having default values (-1; -1) for X and Y
    • Is metainfo property: Yes
    • Retrieve auto value: retrieve value computed by the CanvasNode through SCHost.



Improving Other UI Areas

The introduction of auto-value concept has an important consequence: user no longer sees the values if the values are the default ones (like 0 for LineHeight or -1 for Viewport.X). However, there are still cases for which, the default value is shown but auto-value cannot be implemented because doesn’doesn’t make sense. For these situations, additional improvements can be made.

  • MaxSize: This Layout property has a default value of -1 which represents that value is not specified and should be considered infinite. This property can be turned into an optional property, so that by default it shows an unchecked checkbox indicating that MaxSize is not set.
  • MinSize: Same as for MaxSize, can be turned into optional.

There are also properties which are not configurable in SceneComposer, nor they are visible in the property panel. They could be displayed in the property panel, but stay read-only, only for the purpose of providing information about internals.

  • PreferredSize: Read-only property, can be added to Layout category to display the corresponding value computed by Candera. Value to be retrieved from SCHost.
  • ArrangeSize: Read-only property, can be added to Layout category to display the corresponding value computed by Candera. Value to be retrieved from SCHost.
  • ArrangePosition: Read-only property, can be added to Layout category to display the corresponding value computed by Candera. Value to be retrieved from SCHost.

 

 

Following items can be used to create a new node in the scene graph:

04_3d_toolbox_2.PNG
Group: Represents a parent container for nodes or other groups.
Candera::Group
04_3d_toolbox_3.PNG
Light: Different types of light could be added to illuminate the scene objects. Read more... 
Candera::Light
04_3d_toolbox_4.PNG
Camera: To be linked to a render target, where the render result of the camera will be drawn. Read more... 
Candera::Camera
04_3d_toolbox_5.PNG
Reflection Camera: Creates a reflection of a specific camera on a given reflection plane. Read more... 
Candera::ReflectionCamera
04_3d_toolbox_6.PNG
Stereo Camera: Creates the effect of stereo 3D. Read more... 
Candera::StereoCamera
04_3d_toolbox_7.PNG
Sky Box: A type of mapping that gives the user the feeling of immersion into a large environment. Read more... 
Candera::SkyBox
04_3d_toolbox_8.PNG
Billboard: A textured or colored 2D area.
Candera::Billboard
04_3d_toolbox_9.PNG
Planar Shadow: Provides the possibility to "throw" some shadows on a configurable planar surface. Read more... 
Candera::PlanarShadow
04_3d_toolbox_10.PNG
MorphingMesh: A mesh that stores weight values for morphing. Read more... 
Candera::MorphingMesh
04_3d_toolbox_11.PNG
LodNode: A node which accommodates multiple nodes, each of them representing a certain, predefined level of detail. Read more... 
Candera::LodNode
04_3d_toolbox_12.PNG
PointSprite: Displayed as a flat square polygon which is always facing the camera (screen-aligned). It can be textured and scaled to simulate perspective.
Candera::PointSprite
04_3d_toolbox_19.PNG
Canvas: A node which acts as a surface. Read more... 
Candera::Canvas
04_3d_toolbox_20.PNG
CanvasGroup: A node which can contain other canvas nodes. Read more... 
Candera::CanvasGroup
04_3d_toolbox_21.PNG
CanvasSprite: A node which represents a solid object, offering the possibility to render a texture, a flat colored rectangle or other visual effects. Read more... 
Candera::CanvasSprite
04_3d_toolbox_22.PNG
CanvasText: A node which facilitates displaying text on Canvas.
Candera::CanvasText