You.i Engine
CYISceneManager Class Reference

Detailed Description

Scene trees composed of CYISceneNode objects are registered with the scene manager in order for them to be displayed to the user and so that they can receive inputs.

Scene trees are often loaded from layout files using LoadScene(), and then registered with the scene manager using AddScene(). At this point they are also staged meaning that they will be considered when the draw list is constructed during Update(). Scenes which are not staged do not receive inputs, views in those scenes may not receive focus, and those scenes will not be considered for rendering.

Loading a scene from a layout, and adding it to the scene manager:

CYISceneNode *pFullComposition = pSceneManager->LoadScene("FullComposition.layout");
pSceneManager->AddScene("fullcomp", pFullComposition);

When loading a scene certain properties of the scene must be defined. The scaling and alignment rules define how the scene adapts its designed dimensions to the dimensions at which it is being displayed. For instance, CYISceneManager::SCALE_STRETCH applied to a scene which is loaded at full-screen will naively stretch it to fit the dimensions of the display.

The return value from LoadScene() is a pointer to the root of the scene defined by the layout file provided. At this point individual elements are extracted using CYISceneNode::GetNode or CYISceneView::FindNode on the resultant scene root:

CYIListView *pListView = pFullComposition->GetNode<CYIListView>("FullList");
if (!m_pListView)
{
return false;
}

When adding a scene using AddScene() it is possible to display the scene in a sub-region of the screen. It is also possible to layer screens over top of one another by using layer indices. Scenes which are not full-screen and which are not the bottom-most layer should indicate that they are CYISceneManager::LAYER_TRANSPARENT, meaning that they can be drawn over other scenes.

Changes to focus are driven by the scene manager. The directional key events: CYIKeyEvent::YI_KEY_ARROW_UP, CYIKeyEvent::YI_KEY_ARROW_DOWN, CYIKeyEvent::YI_KEY_ARROW_LEFT, and CYIKeyEvent::YI_KEY_ARROW_RIGHT drive focus between views depending on their on-screen position and orientation. Additionally CYIEvent::YI_KEY_TAB drives focus "forward" and "reverse" depending on left to right and top-down focus order, unless otherwise specified.

CYIEvent instances are driven through the CYIApp into the CYISceneManager for redirection to the appropriate location. Events of type CYIActionEvent, which are mouse and touch events, are offered to the scene tree using their spatial coordinates. These spatial coordinates are converted from window to world space and intersected with CYISceneNode bounding boxes until a target is found. The phase at which events are moving down the tree in search of a target is referred to as the "capture" phase. The completion of a "capture" marks the "at target" phase at which the event is handled by the target node. Following this is the "bubble" phase in which all ancestors of the target node are offered the event again.

#include <scenetree/YiSceneManager.h>

Inheritance diagram for CYISceneManager:

Public Types

enum  LAYER_TYPE {
  LAYER_OPAQUE,
  LAYER_TRANSPARENT
}
 Specifies layering rules on a scene. Transparent scenes may be drawn over other scenes. More...
 
enum  SCALE_TYPE {
  SCALE_FILL,
  SCALE_FIT,
  SCALE_STRETCH,
  SCALE_ACTUAL_SIZE,
  SCALE_RESPONSIVE_LAYOUT
}
 Scaling rules define how the scene adapts to having different dimensions. More...
 
enum  V_ALIGN_TYPE {
  V_ALIGN_TOP,
  V_ALIGN_CENTER,
  V_ALIGN_BOTTOM
}
 Vertical alignment. More...
 
enum  H_ALIGN_TYPE {
  H_ALIGN_LEFT,
  H_ALIGN_CENTER,
  H_ALIGN_RIGHT
}
 Horizontal alignment. More...
 
enum  MISSING_CLASS_HANDLING_MODE {
  ABORT,
  SWAP_WITH_SCENE_VIEW
}
 Optional fallback rules for missing view types during scene loading. More...
 

Public Member Functions

 CYISceneManager ()
 
virtual ~CYISceneManager ()
 
std::unique_ptr< CYISceneViewLoadScene (const CYIString &filename, SCALE_TYPE scaleType=SCALE_STRETCH, V_ALIGN_TYPE vAlign=V_ALIGN_CENTER, H_ALIGN_TYPE hAlign=H_ALIGN_CENTER, MISSING_CLASS_HANDLING_MODE eMissingHandlingMode=ABORT)
 
std::unique_ptr< CYISceneViewLoadScene (const CYIString &filename, const YI_RECT_REL &screenRegion, SCALE_TYPE scaleType=SCALE_STRETCH, V_ALIGN_TYPE vAlign=V_ALIGN_CENTER, H_ALIGN_TYPE hAlign=H_ALIGN_CENTER, MISSING_CLASS_HANDLING_MODE eMissingHandlingMode=ABORT)
 
void UpdateScene (CYISceneView *pRoot)
 
void UpdateScene (CYISceneView *pRoot, SCALE_TYPE scaleType, V_ALIGN_TYPE vAlign, H_ALIGN_TYPE hAlign)
 
void UpdateScene (CYISceneView *pRoot, const YI_RECT_REL &screenRegion, SCALE_TYPE scaleType=SCALE_STRETCH, V_ALIGN_TYPE vAlign=V_ALIGN_CENTER, H_ALIGN_TYPE hAlign=H_ALIGN_CENTER)
 
void UpdateStagedScenes ()
 
void UpdateUnstagedScenes ()
 
void UpdateAllScenes ()
 
void UpdateBackground ()
 
void OnSurfaceSizeChanged ()
 
bool GetSceneUpdateProperties (CYISceneView *pRoot, SCALE_TYPE &eScaleType, V_ALIGN_TYPE &eVAlign, H_ALIGN_TYPE &eHAlign) const
 
std::unique_ptr< CYITimelineImportTimeline (CYISceneNode *pRootNode, const CYIString &filename)
 
bool AddScene (const CYIString &name, std::unique_ptr< CYISceneNode > pSceneNode, int32_t nLayerIndex=0, LAYER_TYPE eLayerType=LAYER_OPAQUE, const CYIViewport *pCustomViewport=nullptr)
 
std::unique_ptr< CYISceneNodeRemoveScene (CYISceneNode *pSceneNode)
 
std::unique_ptr< CYISceneNodeRemoveScene (const CYIString &name)
 
bool UpdateSceneProperties (const CYIString &name, LAYER_TYPE eLayerType=LAYER_OPAQUE, const CYIViewport *pCustomViewport=nullptr)
 
bool GetSceneProperties (const CYIString &name, LAYER_TYPE &eLayerType, CYIViewport &viewport) const
 
uint32_t GetStagedSceneCount () const
 
CYISceneNodeGetStagedScene (uint32_t uIndex) const
 
CYISceneNodeGetStagedScene (const CYIString &name) const
 
std::vector< CYISceneNode * > GetStagedScenes () const
 
uint32_t GetUnstagedSceneCount () const
 
CYISceneNodeGetUnstagedScene (uint32_t uIndex) const
 
CYISceneNodeGetUnstagedScene (const CYIString &name) const
 
std::vector< CYISceneNode * > GetUnstagedScenes () const
 
uint32_t GetSceneCount () const
 
CYISceneNodeGetScene (uint32_t uIndex) const
 
CYISceneNodeGetScene (const CYIString &name) const
 
std::vector< CYISceneNode * > GetScenes () const
 
const CYIStringGetSceneName (CYISceneNode *pScene) const
 
void ShowStagedScenes ()
 
void HideStagedScenes ()
 
void ShowScene (const CYIString &name)
 
void HideScene (const CYIString &name)
 
bool UpdateSceneLayerIndex (const CYIString &name, int32_t nLayerIndex)
 
bool GetSceneLayerIndex (const CYIString &name, int32_t &nLayerIndex)
 
bool StageScene (const CYIString &name)
 
bool StageSceneBefore (const CYIString &name, const CYIString &nameRelative)
 
bool StageSceneAfter (const CYIString &name, const CYIString &nameRelative)
 
bool StageSceneAtFront (const CYIString &name)
 
bool StageSceneAtBack (const CYIString &name)
 
bool UnstageScene (const CYIString &name)
 
bool IsSceneStaged (const CYIString &name) const
 
void DestroyScenes ()
 
CYISceneNodeGetNode (const CYIString &name) const
 
bool MoveBefore (const CYIString &nameToMove, const CYIString &nameRelative)
 
bool MoveAfter (const CYIString &nameToMove, const CYIString &nameRelative)
 
bool BringToFront (const CYIString &name)
 
bool SendToBack (const CYIString &name)
 
bool MoveForward (const CYIString &name)
 
bool MoveBackward (const CYIString &name)
 
CYISceneNodeGetNode (const CYIString &name, const CYIRuntimeTypeInfo &enforceClassType) const
 
template<class YI_SCENE_NODE_SUBCLASS >
YI_SCENE_NODE_SUBCLASS * GetNode (const CYIString &name) const
 
bool Update (bool bForceDirty, bool bForceRender=false)
 
bool Layout (CYISceneNode *pNode)
 
void Draw () const
 
void SetKeyboardCaptureNode (CYISceneNode *pNode)
 
CYISceneNodeGetKeyboardCaptureNode () const
 
void SetPointerCaptureNode (CYISceneNode *pNode, uint8_t uPointerID)
 
CYISceneNodeGetPointerCaptureNode (uint8_t uPointerID)
 
void SetTrackpadCaptureNode (CYISceneNode *pNode)
 
CYISceneNodeGetTrackpadCaptureNode () const
 
void SetEventCaptureRootNode (CYISceneNode *pNode)
 
CYISceneNodeGetEventCaptureRootNode ()
 
bool AddGlobalEventListener (YI_EVENT_TYPE eEventType, CYIEventHandler *pListener, CYIEventTarget::EVENT_PHASE ePhase=CYIEventTarget::BUBBLE)
 
bool RemoveGlobalEventListener (YI_EVENT_TYPE eEventType, CYIEventHandler *pListener, CYIEventTarget::EVENT_PHASE ePhase=CYIEventTarget::BUBBLE)
 
void OnSpecialEventTargetDestroyed (CYISceneNode *pNode)
 
bool IsReachable (const CYISceneNode *pNode) const
 
CYISceneViewGetViewWithFocus () const
 
CYISceneViewGetViewWithFocus (const CYISceneNode *pRootNode) const
 
bool RequestFocus (const CYISceneView *pViewToFocus, CYIFocus::FOCUS_ROOT_RULE eFocusRootRule=CYIFocus::FOCUS_ROOT_DESCENDANTS_UPDATE_CONTEXT)
 
bool MoveFocus (CYIFocus::FOCUS_DIRECTION eDirection, const CYIFocusSearchOptions &options=CYIFocusSearchOptions())
 
void ClearFocus ()
 
bool CanBeFocused (const CYISceneView *pView) const
 
CYICameraControllerGetCameraController ()
 
void QueueTimelineForPlayback (CYITimeline *pTimeline)
 
CYISceneNodeGetTargetNodeAtScreenLocation (int32_t nScreenX, int32_t nScreenY) const
 
void SetBackgroundColor (const CYIColor &color)
 
const CYIColorGetBackgroundColor ()
 
- Public Member Functions inherited from CYIEventHandler
 CYIEventHandler ()
 
 CYIEventHandler (const CYIEventHandler &)
 
virtual ~CYIEventHandler ()
 
CYIEventHandleroperator= (const CYIEventHandler &)
 
bool RegisterEventFilter (CYIEventFilter *pFilter)
 
bool UnregisterEventFilter (CYIEventFilter *pFilter)
 
bool PreFilter (const std::shared_ptr< CYIEventDispatcher > &pDispatcher, CYIEvent *pEvent)
 
bool PostFilter (const std::shared_ptr< CYIEventDispatcher > &pDispatcher, CYIEvent *pEvent)
 
bool AreEventsEnabled () const
 
void EnableEvents (bool bEnable)
 
- Public Member Functions inherited from CYISignalHandler
 CYISignalHandler ()
 
 CYISignalHandler (const CYISignalHandler &rSignalHandler)
 
virtual ~CYISignalHandler ()
 
CYISignalHandleroperator= (const CYISignalHandler &rSignalHandler)
 
void MoveToThread (CYIThread *pThread)
 This function allows the user to override the default thread affinity to any CYIThread that may or may not be running. More...
 
CYIThreadHandle GetThreadAffinity () const
 
void SetThreadAffinity (const CYIThreadHandle &rThreadAffinity)
 
virtual bool IsConnected () const
 
virtual bool IsConnected (const CYISignalBase &rSignal) const
 
void Disconnect (CYISignalBase &rSignal)
 
void DisconnectFromAllSignals ()
 
- Public Member Functions inherited from CYIThread::Listener
 Listener ()
 
virtual ~Listener ()
 
virtual void OnThreadStarted (CYIThread *)
 
virtual void OnThreadTerminated (CYIThread *)
 
virtual void OnThreadFinished (CYIThread *)
 
- Public Member Functions inherited from CYIScriptableObject
 CYIScriptableObject ()
 
 CYIScriptableObject (const CYIScriptableObject &other)
 
CYIScriptableObjectoperator= (const CYIScriptableObject &other)
 
virtual ~CYIScriptableObject ()
 
CYIBindingImplementationGetBindingImplementation () const
 
void SetBindingImplementation (CYIBindingImplementation *pBindingImplementation)
 
virtual const CYIRuntimeTypeInfoGetRuntimeTypeInfoForScriptObject () const
 

Public Attributes

CYISignal< const CYIString &, CYISceneNode * > SceneStaged
 
CYISignal< const CYIString &, CYISceneNode * > SceneUnstaged
 

Protected Member Functions

bool DispatchEvent (const std::shared_ptr< CYIEventDispatcher > &pDispatcher, CYIEvent *pEvent, CYISceneNode *pTarget)
 
virtual bool HandleEvent (const std::shared_ptr< CYIEventDispatcher > &pDispatcher, CYIEvent *pEvent) override
 

Friends

class CYIFocusPriv
 
class CYISceneManagerPriv
 
class CYISceneNode
 
class CYISceneNodeUtilityPriv
 

Additional Inherited Members

- Protected Attributes inherited from CYIEventHandler
bool m_bEnableEvents
 

Member Enumeration Documentation

Horizontal alignment.

Defines how the scene will be aligned on the horizontal axis, given the CYISceneManager::SCALE_TYPE. Specified when loading a scene using LoadScene().

Enumerator
H_ALIGN_LEFT 
H_ALIGN_CENTER 
H_ALIGN_RIGHT 

Specifies layering rules on a scene. Transparent scenes may be drawn over other scenes.

When adding scenes, layering instructions are provided.

Generally, the bottom-most layer should be drawn opaquely with subsequent layers drawn transparently. If multiple scenes are present on screen using sub-regions, such as in the case of a split-screen view, then the bottom-most layer in each subregion should be opaque.

Enumerator
LAYER_OPAQUE 

Will clear its viewport prior to rendering

LAYER_TRANSPARENT 

Will draw without clearing its viewport

Optional fallback rules for missing view types during scene loading.

CYISceneView subclasses are resolved during scene import in LoadScene(). Default behaviour will assert and fail scene import if the root is a view subclass that is not able to be resolved, due to missing definitions. This provides an optional fallback to the base CYISceneView. Subviews will follow the same behavior.

Enumerator
ABORT 
SWAP_WITH_SCENE_VIEW 

Scaling rules define how the scene adapts to having different dimensions.

Scaling rules are applied during LoadScene() and define how a screen will adapt from its designed dimensions to its target dimensions.

Enumerator
SCALE_FILL 

Maintains aspect ratio. The scene will be scaled to fill and possibly overflow the target dimensions, with extra content being cropped.

SCALE_FIT 

Maintains aspect ratio. The scene will be scaled to fit inside the target dimensions, and will be letterboxed or pillarboxed inside of the region.

SCALE_STRETCH 

Does not maintain aspect ratio. The scene will be stretched to exactly fill the target dimensions.

SCALE_ACTUAL_SIZE 

Maintains aspect ratio. The scene maintains its designed dimensions.

SCALE_RESPONSIVE_LAYOUT 

Scales the content based on the responsive layout anchors found within. If no responsive layout anchors are found the composition will stretch.

Vertical alignment.

Defines how the scene will be aligned on the vertical axis, given the CYISceneManager::SCALE_TYPE. Specified when loading a scene using LoadScene().

Enumerator
V_ALIGN_TOP 
V_ALIGN_CENTER 
V_ALIGN_BOTTOM 

Constructor & Destructor Documentation

CYISceneManager::CYISceneManager ( )
virtual CYISceneManager::~CYISceneManager ( )
virtual

Member Function Documentation

bool CYISceneManager::AddGlobalEventListener ( YI_EVENT_TYPE  eEventType,
CYIEventHandler pListener,
CYIEventTarget::EVENT_PHASE  ePhase = CYIEventTarget::BUBBLE 
)

The pListener will be notified of any eEventType events occurring in the scene tree, during their ePhase, regardless of the target of the events. Returns false if the listener is null or is already registered.

See also
CYIEventTarget::AddEventListener
bool CYISceneManager::AddScene ( const CYIString name,
std::unique_ptr< CYISceneNode pSceneNode,
int32_t  nLayerIndex = 0,
LAYER_TYPE  eLayerType = LAYER_OPAQUE,
const CYIViewport pCustomViewport = nullptr 
)

The pSceneNode, often previously loaded via LoadScene(), is registered with the scene manager with the given name and becomes eligible for rendering, input handling, and staging and unstaging.

Note
The scene is unstaged by default.

pSceneNode must not have a parent and it must have a render target. Failure to meet these conditions results in pSceneNode being deleted and false being returned.

If other scenes have been added this scene will draw above or below them based on its nLayerIndex. A nLayerIndex of 1 will draw on top of an index of 0.

eLayerType determines whether anything will visually appear beneath the scene in layer order. Scenes which have a higher nLayerIndex must often specify CYISceneManager::LAYER_TRANSPARENT, unless they are full-screen and opaque.

The scene can be displayed in pCustomViewport which is a rectangular region specified in window coordinates, where (0,0) is the bottom-left of the window.

Note
If all scenes registered in the scene manager are CYISceneManager::LAYER_TRANSPARENT and every pixel on the screen is not drawn with full opacity at some point during the rendering, then the previous contents of the screen buffer will appear.
The scene manager takes ownership of pSceneNode.
bool CYISceneManager::BringToFront ( const CYIString name)

The scene named name will be moved so that it is drawn overtop all of the scenes, its layer index will be equal to the current layer index of the current top-most scene.

bool CYISceneManager::CanBeFocused ( const CYISceneView pView) const

Returns true if the given view can receive focus.

In order to receive focus a view must be reachable, have its visibility set to true, and be set to focusable.

See also
CYISceneView::IsFocusable
CYISceneNode::IsTrulyVisible
CYISceneManager::IsReachable
void CYISceneManager::ClearFocus ( )

Clears the currently focused view, if any.

void CYISceneManager::DestroyScenes ( )

Destroys all scenes and clears the staged and un-staged collections.

bool CYISceneManager::DispatchEvent ( const std::shared_ptr< CYIEventDispatcher > &  pDispatcher,
CYIEvent pEvent,
CYISceneNode pTarget 
)
protected

Send an event to the specified target (and its ancestors). Applies the CYIEventTarget::CAPTURE and CYIEventTarget::BUBBLE phases.

void CYISceneManager::Draw ( ) const

Draws the content of the scene tree.

See also
Update(bool)
const CYIColor& CYISceneManager::GetBackgroundColor ( )

Returns the current background color.

See also
SetBackgroundColor
CYICameraController& CYISceneManager::GetCameraController ( )

Returns the camera controller, which is used to animate the camera dynamically to different nodes.

See also
CYICameraController
CYISceneNode* CYISceneManager::GetEventCaptureRootNode ( )

Returns the node that has been set as the capture node for all events using SetEventCaptureRootNode(), or null if no node is capturing events.

CYISceneNode* CYISceneManager::GetKeyboardCaptureNode ( ) const

Returns the node which is currently capturing all keyboard events, or null if there is no capture node.

CYISceneNode* CYISceneManager::GetNode ( const CYIString name) const

Returns the first encountered node with name from within the staged scenes.

See also
GetScene(const CYIString&) const
CYISceneNode::GetNode(const CYIString&)
CYISceneNode* CYISceneManager::GetNode ( const CYIString name,
const CYIRuntimeTypeInfo enforceClassType 
) const

Returns the first encountered node with name matching enforceClassType from within the staged scenes.

See also
CYISceneNode::GetNode(const CYIString&, const CYIRuntimeTypeInfo&)
template<class YI_SCENE_NODE_SUBCLASS >
YI_SCENE_NODE_SUBCLASS * CYISceneManager::GetNode ( const CYIString name) const
inline

Returns the first encountered node with name matching YI_SCENE_NODE_SUBCLASS from within the staged scenes.

See also
CYISceneNode::GetNode(const CYIString&)
CYISceneNode* CYISceneManager::GetPointerCaptureNode ( uint8_t  uPointerID)

Returns the node that has been set as the capture node for uPointerID using SetPointerCaptureNode(), or null if no node is capturing it.

CYISceneNode* CYISceneManager::GetScene ( uint32_t  uIndex) const

Returns the scene at the zero based index uIndex, or null if uIndex is greater than or equal to the number of scenes.

See also
GetSceneCount()
Note
The scene manager retains ownership of the returned scene node.
Warning
The index of scenes may change as scenes are added, removed, staged, and unstaged.
CYISceneNode* CYISceneManager::GetScene ( const CYIString name) const

Returns a scene, previously added by AddScene(), with the given name, or null if it is not found.

Note
The scene manager retains ownership of the returned scene node.
uint32_t CYISceneManager::GetSceneCount ( ) const

Returns the number of scenes which have been added using AddScene(), both staged and unstaged.

bool CYISceneManager::GetSceneLayerIndex ( const CYIString name,
int32_t &  nLayerIndex 
)

Retrieve the layer index of the scene node named by name. Returns false if name does not name a root scene node.

const CYIString& CYISceneManager::GetSceneName ( CYISceneNode pScene) const

Returns the name of pScene in the scene manager. If pScene wasn't added to the scene manager returns an empty string.

bool CYISceneManager::GetSceneProperties ( const CYIString name,
LAYER_TYPE eLayerType,
CYIViewport viewport 
) const

Retrieves the properties of a scene specified by name.

Returns false if no scene named name has been added.

The values of eLayerType and viewport are set to the properties of this scene.

std::vector<CYISceneNode *> CYISceneManager::GetScenes ( ) const

Returns all scenes in the scene manager.

See also
GetStagedScenes()
GetUnstagedScenes()
Note
The scene manager retains ownership of the returned scene nodes.
bool CYISceneManager::GetSceneUpdateProperties ( CYISceneView pRoot,
SCALE_TYPE eScaleType,
V_ALIGN_TYPE eVAlign,
H_ALIGN_TYPE eHAlign 
) const

Retrieves the current scale, vertical alignment and horizontal alignment set on the scene pointed to by pRoot. Returns true if the scene's update properties have been set by a previous call to UpdateScene() or LoadScene(). Returns false if the scene's update properties have not yet been set.

Note
If this method returns false the default scene update properties will be supplied.
See also
LoadScene(const CYIString &filename, const YI_RECT_REL &screenRegion, SCALE_TYPE scaleType, V_ALIGN_TYPE vAlign, H_ALIGN_TYPE hAlign, MISSING_CLASS_HANDLING_MODE);
UpdateScene(CYISceneView *pRoot, const YI_RECT_REL &screenRegion, SCALE_TYPE scaleType, V_ALIGN_TYPE vAlign, H_ALIGN_TYPE hAlign)
CYISceneNode* CYISceneManager::GetStagedScene ( uint32_t  uIndex) const

Returns the staged scene at the zero based index uIndex, or null if uIndex is greater than or equal to the number of staged scenes.

See also
GetStagedSceneCount()
Note
The scene manager retains ownership of the returned scene node.
Warning
The index of scenes may change as scenes are added, removed, staged, and unstaged.
CYISceneNode* CYISceneManager::GetStagedScene ( const CYIString name) const

Returns the staged scene matching the name provided, or null if it is not found.

Note
The scene manager retains ownership of the returned scene node.
uint32_t CYISceneManager::GetStagedSceneCount ( ) const

Returns the number of scenes which have been staged using StageScene().

std::vector<CYISceneNode *> CYISceneManager::GetStagedScenes ( ) const

Returns all of the currently staged scenes.

See also
GetScenes()
GetUnstagedScenes()
Note
The scene manager retains ownership of the returned scene nodes.
CYISceneNode* CYISceneManager::GetTargetNodeAtScreenLocation ( int32_t  nScreenX,
int32_t  nScreenY 
) const

Returns the node located at the provided screen-space location, or null if there is no node present. The location is relative to the top-left of the screen.

CYISceneNode* CYISceneManager::GetTrackpadCaptureNode ( ) const

Returns the node which is currently capturing all trackpad events, or null if there is no capture node.

CYISceneNode* CYISceneManager::GetUnstagedScene ( uint32_t  uIndex) const

Returns the unstaged scene at the zero based index uIndex, or null if uIndex is greater than or equal to the number of unstaged scenes.

See also
GetUnstagedSceneCount()
Note
The scene manager retains ownership of the returned scene node.
Warning
The index of scenes may change as scenes are added, removed, staged, and unstaged.
CYISceneNode* CYISceneManager::GetUnstagedScene ( const CYIString name) const

Returns the unstaged scene matching the name provided, or null if it is not found.

Note
The scene manager retains ownership of the returned scene node.
uint32_t CYISceneManager::GetUnstagedSceneCount ( ) const

Returns the number of scenes which have been added using AddScene() but have been unstaged with UnstageScene().

std::vector<CYISceneNode *> CYISceneManager::GetUnstagedScenes ( ) const

Returns all of the currently unstaged scenes.

See also
GetScenes()
GetStagedScenes()
Note
The scene manager retains ownership of the returned scene nodes.
CYISceneView* CYISceneManager::GetViewWithFocus ( ) const

Returns the view that currently has focus, or null if no view has focus.

CYISceneView* CYISceneManager::GetViewWithFocus ( const CYISceneNode pRootNode) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Returns the view that currently has focus only if it is in the tree under and including pRootNode.

virtual bool CYISceneManager::HandleEvent ( const std::shared_ptr< CYIEventDispatcher > &  pDispatcher,
CYIEvent pEvent 
)
overrideprotectedvirtual

Scene manager event handling. Does not bubble down to the collection of root scene nodes.

Implements CYIEventHandler.

void CYISceneManager::HideScene ( const CYIString name)

Hide a root node by name.

void CYISceneManager::HideStagedScenes ( )

Hide all staged root scene nodes.

std::unique_ptr<CYITimeline> CYISceneManager::ImportTimeline ( CYISceneNode pRootNode,
const CYIString filename 
)
bool CYISceneManager::IsReachable ( const CYISceneNode pNode) const

Returns true if this pNode is present in a staged scene.

bool CYISceneManager::IsSceneStaged ( const CYIString name) const

Returns true if a scene with name is staged.

bool CYISceneManager::Layout ( CYISceneNode pNode)

Performs a layout pass on the scene node subtree starting at pNode. Returns true if the scene tree requires a redraw.

Note
If the subtree starting at pNode is dirty after the layout pass, CYISceneNode::Update() is called on the subtree.
This function cannot be called while a layout pass is in progress. Doing so results in a warning being logged and in the function returning false immediately.
std::unique_ptr<CYISceneView> CYISceneManager::LoadScene ( const CYIString filename,
SCALE_TYPE  scaleType = SCALE_STRETCH,
V_ALIGN_TYPE  vAlign = V_ALIGN_CENTER,
H_ALIGN_TYPE  hAlign = H_ALIGN_CENTER,
MISSING_CLASS_HANDLING_MODE  eMissingHandlingMode = ABORT 
)

Loads a composition into the scene. Returns null in case of failure.

The layout at filename will be loaded using scaleType scaling rules and hAlign, vAlign alignment into a full-screen region. The dimensions of the fullscreen region are determined at the time of the call. On platforms where the screen dimensions can be modified such as in portrait-to-landscape orientation changes, LoadScene() must be called in the correct orientation.

eMissingHandlingMode describes an optional fallback if the root scene view has a view specialization that cannot be resolved due to missing definitions or bad assets.

std::unique_ptr<CYISceneView> CYISceneManager::LoadScene ( const CYIString filename,
const YI_RECT_REL screenRegion,
SCALE_TYPE  scaleType = SCALE_STRETCH,
V_ALIGN_TYPE  vAlign = V_ALIGN_CENTER,
H_ALIGN_TYPE  hAlign = H_ALIGN_CENTER,
MISSING_CLASS_HANDLING_MODE  eMissingHandlingMode = ABORT 
)

Loads a composition into the scene. Returns null in case of failure.

The layout at filename will be loaded using scaleType scaling rules and hAlign, vAlign alignment into a full-screen region. The dimensions of the fullscreen region are determined at the time of the call. On platforms where the screen dimensions can be modified such as in portrait-to-landscape orientation changes, LoadScene() must be called in the correct orientation.

eMissingHandlingMode describes an optional fallback if the root scene view has a view specialization that cannot be resolved due to missing definitions or bad assets.

The screenRegion defines the size and location of the scene to be loaded. screenRegion's origin is the bottom-left of the window.

See also
LoadScene(const CYIString &, SCALE_TYPE, V_ALIGN_TYPE, H_ALIGN_TYPE, MISSING_CLASS_HANDLING_MODE).
bool CYISceneManager::MoveAfter ( const CYIString nameToMove,
const CYIString nameRelative 
)

The scene named nameToMove will be moved so that it is drawn after nameRelative, its layer index will be equal to the current layer index of nameRelative.

bool CYISceneManager::MoveBackward ( const CYIString name)

The scene named name will be moved so that it is drawn one layer below, its layer index will be equal to the layer index of the scene below which it is now drawing.

bool CYISceneManager::MoveBefore ( const CYIString nameToMove,
const CYIString nameRelative 
)

The scene named nameToMove will be moved so that it is drawn before nameRelative, its layer index will be equal to the current layer index of nameRelative.

bool CYISceneManager::MoveFocus ( CYIFocus::FOCUS_DIRECTION  eDirection,
const CYIFocusSearchOptions options = CYIFocusSearchOptions() 
)

'Moves' the focus in direction eDirection, relative to the view that currently has focus. If no view currently has focus, a focus search is started from the current focus root.

options can be used to further restrict the set of valid focus candidates.

Returns true if focus was successfully moved.

bool CYISceneManager::MoveForward ( const CYIString name)

The scene named name will be moved so that it is drawn one layer above, its layer index will be equal to the layer index of the scene above which it is now drawing.

void CYISceneManager::OnSpecialEventTargetDestroyed ( CYISceneNode pNode)

Notifies the scene manager that a special event target is being destroyed, so that it may clean up its references.

void CYISceneManager::OnSurfaceSizeChanged ( )

Updates all scenes, updates the background, and sends a YI_EVENT_TYPE::YI_ACTION_LEAVE event to all recipients of YI_EVENT_TYPE::YI_ACTION_MOVE or YI_EVENT_TYPE::YI_ACTION_DOWN if they have not received one already.

See also
UpdateAllScenes
UpdateBackground
void CYISceneManager::QueueTimelineForPlayback ( CYITimeline pTimeline)

Queues a CYITimeline object for playback on the UI thread. Calling this function on the UI thread will cause the timeline to be played back during the next draw cycle.

bool CYISceneManager::RemoveGlobalEventListener ( YI_EVENT_TYPE  eEventType,
CYIEventHandler pListener,
CYIEventTarget::EVENT_PHASE  ePhase = CYIEventTarget::BUBBLE 
)

The pListener will no longer be a global event listener. Returns false if the listener was not registered with AddGlobalEventListener().

See also
CYIEventTarget::RemoveEventListener
std::unique_ptr<CYISceneNode> CYISceneManager::RemoveScene ( CYISceneNode pSceneNode)

Removes a scene which was previously added with AddScene(). Returns a null pointer if the scene has not been added.

See also
AddScene(const CYIString &, std::unique_ptr<CYISceneNode>, int32_t, LAYER_TYPE, const CYIViewport *)
std::unique_ptr<CYISceneNode> CYISceneManager::RemoveScene ( const CYIString name)

Removes a scene with name which was previously added with AddScene(). Returns a null pointer if no such named scene is found.

bool CYISceneManager::RequestFocus ( const CYISceneView pViewToFocus,
CYIFocus::FOCUS_ROOT_RULE  eFocusRootRule = CYIFocus::FOCUS_ROOT_DESCENDANTS_UPDATE_CONTEXT 
)

Requests that pViewToFocus receive focus. The view will receive focus if it is focusable. Returns true if pViewToFocus obtained focus or had focus before the request.

For a view to take focus, it must meet the following requirements: it is visible, attached to the tree, and focusable.

eFocusRootRule dictates whether the focus system will allow the focus request to move to a view outside of the current focus root. When CYIFocus::FOCUS_ROOT_DESCENDANTS_UPDATE_CONTEXT is provided this method will return true if pViewToFocus's focus root is updated with pViewToFocus as the current focus in that context.

pViewToFocus must be non-null. If focus needs to be cleared, ClearFocus can be used.

See also
CYISceneView::RequestFocus
bool CYISceneManager::SendToBack ( const CYIString name)

The scene named name will be moved so that it is drawn behind all of the scenes, its layer index will be equal to the current layer index of the current bottom-most scene.

void CYISceneManager::SetBackgroundColor ( const CYIColor color)

Sets the solid background color which will be visible behind all scenes.

The default background color is CYIColor::Named().Black.

Note
This background color will only be visible behind the bottom-most scene if the scene was added with a layer type of CYISceneManager::LAYER_TRANSPARENT. If the scene was added with a layer type of CYISceneManager::LAYER_OPAQUE the scene's background color will be visible instead.
void CYISceneManager::SetEventCaptureRootNode ( CYISceneNode pNode)

pNode will capture all events.

Note
The scene manager does not take ownership of pNode.
void CYISceneManager::SetKeyboardCaptureNode ( CYISceneNode pNode)

pNode will receive all keyboard events. There may only be one keyboard capture node at a time. The previous node, if any, will no longer capture keyboard events.

Note
The scene manager does not take ownership of pNode.
void CYISceneManager::SetPointerCaptureNode ( CYISceneNode pNode,
uint8_t  uPointerID 
)

pNode will capture all action events from uPointerID. There may only be one pointer capture node at a time. The previous node, if any, will no longer capture pointer events.

Note
The scene manager does not take ownership of pNode.
See also
CYIActionEvent::m_uPointerID
void CYISceneManager::SetTrackpadCaptureNode ( CYISceneNode pNode)

pNode will receive all trackpad events. There may only be one trackpad capture node at a time. The previous node, if any, will no longer capture trackpad events.

Note
The scene manager does not take ownership of pNode.
void CYISceneManager::ShowScene ( const CYIString name)

Show a root node by name.

void CYISceneManager::ShowStagedScenes ( )

Show all staged root scene nodes.

bool CYISceneManager::StageScene ( const CYIString name)

Stages a scene with name that has been registered to the scene manager with AddScene(). Staged scenes will be drawn and are eligible for inputs and focus events.

Returns false if no scene with name is registered or if the scene is already staged.

bool CYISceneManager::StageSceneAfter ( const CYIString name,
const CYIString nameRelative 
)

Stages a scene with name that has been registered to the scene manager with AddScene(). Staged scenes will be drawn and are eligible for inputs and focus events.

Returns false if no scene with name is registered or if the scene is already staged.

The scene named name will be staged so that it is drawn after the scene named nameRelative, its layer index will be equal to the current layer index of scene with name nameRelative.

bool CYISceneManager::StageSceneAtBack ( const CYIString name)

Stages a scene with name that has been registered to the scene manager with AddScene(). Staged scenes will be drawn and are eligible for inputs and focus events.

Returns false if no scene with name is registered or if the scene is already staged.

The scene named name will be staged so that it is drawn overtop of all of the scenes, its layer index will be equal to the current layer index of the current bottom-most scene.

bool CYISceneManager::StageSceneAtFront ( const CYIString name)

Stages a scene with name that has been registered to the scene manager with AddScene(). Staged scenes will be drawn and are eligible for inputs and focus events.

Returns false if no scene with name is registered or if the scene is already staged.

The scene named name will be staged so that it is drawn overtop of all of the scenes, its layer index will be equal to the current layer index of the current top-most scene.

bool CYISceneManager::StageSceneBefore ( const CYIString name,
const CYIString nameRelative 
)

Stages a scene with name that has been registered to the scene manager with AddScene(). Staged scenes will be drawn and are eligible for inputs and focus events.

Returns false if no scene with name is registered or if the scene is already staged.

The scene named name will be staged so that it is drawn before the scene named nameRelative, its layer index will be equal to the current layer index of scene with name nameRelative.

bool CYISceneManager::UnstageScene ( const CYIString name)

Unstages a scene with name that has been registered to the scene manager with AddScene(). Unstaged scenes will not be drawn and are ineligible for inputs and focus events.

Returns false if the scene is not staged.

bool CYISceneManager::Update ( bool  bForceDirty,
bool  bForceRender = false 
)

Drives changes to the scene tree, layouts, and focus within the scenes. Sending true for bForceDirty causes a complete update regardless of the scene tree's dirty state. Setting true for bForceRender causes a re-generation of the draw list regardless of the scene tree's dirty state.

Returns true if the scene tree requires a redraw.

void CYISceneManager::UpdateAllScenes ( )

Updates all scenes managed by the scene manager using the current surface rectange and the scale, vertical alignment and horizontal alignment specified previously by LoadScene() or UpdateScene(). If these have not previously been called the default values of CYISceneManager::SCALE_STRETCH, CYISceneManager::V_ALIGN_CENTER and CYISceneManager::H_ALIGN_CENTER will be used.

See also
UpdateScene(CYISceneView*, SCALE_TYPE, V_ALIGN_TYPE, H_ALIGN_TYPE)
void CYISceneManager::UpdateBackground ( )

Updates the background for the current surface size. This can be called when the surface size changes to update the background to match the current surface without updating all scenes.

See also
OnSurfaceSizeChanged
void CYISceneManager::UpdateScene ( CYISceneView pRoot)

Updates an existing scene using the current surface rectangle and the scale, vertical alignment and horizontal alignment specified previously by LoadScene or UpdateScene. If these have not previously been called the default values of CYISceneManager::SCALE_STRETCH, CYISceneManager::V_ALIGN_CENTER and CYISceneManager::H_ALIGN_CENTER will be used.

See also
UpdateScene(CYISceneView*, SCALE_TYPE, V_ALIGN_TYPE, H_ALIGN_TYPE)
UpdateScene(CYISceneView*, const YI_RECT_REL &, SCALE_TYPE, V_ALIGN_TYPE, H_ALIGN_TYPE)
void CYISceneManager::UpdateScene ( CYISceneView pRoot,
SCALE_TYPE  scaleType,
V_ALIGN_TYPE  vAlign,
H_ALIGN_TYPE  hAlign 
)
void CYISceneManager::UpdateScene ( CYISceneView pRoot,
const YI_RECT_REL screenRegion,
SCALE_TYPE  scaleType = SCALE_STRETCH,
V_ALIGN_TYPE  vAlign = V_ALIGN_CENTER,
H_ALIGN_TYPE  hAlign = H_ALIGN_CENTER 
)

Updates an existing scene using a custom rectangle.

See also
UpdateScene(CYISceneView*, SCALE_TYPE, V_ALIGN_TYPE, H_ALIGN_TYPE)
UpdateScene(CYISceneView*)
bool CYISceneManager::UpdateSceneLayerIndex ( const CYIString name,
int32_t  nLayerIndex 
)

The scene named by name will be moved in the layer order to the new nLayerIndex. Returns false if name does not name a root scene node.

Layers with larger indices draw overtop of scenes with lower indices.

See also
AddScene(const CYIString &, CYISceneNode *, int32_t, LAYER_TYPE, const CYIViewport *)
bool CYISceneManager::UpdateSceneProperties ( const CYIString name,
LAYER_TYPE  eLayerType = LAYER_OPAQUE,
const CYIViewport pCustomViewport = nullptr 
)

Updates the properties of a scene that has already been added. name specifies the name of the scene to update.

Returns false if no scene named name has been added.

Note
This method overwrites the scene render target attributes.
See also
AddScene()
void CYISceneManager::UpdateStagedScenes ( )

Updates all staged scenes using the current surface rectange and the scale, vertical alignment and horizontal alignment specified previously by LoadScene() or UpdateScene(). If these have not previously been called the default values of CYISceneManager::SCALE_STRETCH, CYISceneManager::V_ALIGN_CENTER and CYISceneManager::H_ALIGN_CENTER will be used.

See also
UpdateScene(CYISceneView*, SCALE_TYPE, V_ALIGN_TYPE, H_ALIGN_TYPE)
void CYISceneManager::UpdateUnstagedScenes ( )

Updates all un-staged scenes using the current surface rectange and the scale, vertical alignment and horizontal alignment specified previously by LoadScene() or UpdateScene(). If these have not previously been called the default values of CYISceneManager::SCALE_STRETCH, CYISceneManager::V_ALIGN_CENTER and CYISceneManager::H_ALIGN_CENTER will be used.

See also
UpdateScene(CYISceneView*, SCALE_TYPE, V_ALIGN_TYPE, H_ALIGN_TYPE)

Friends And Related Function Documentation

friend class CYIFocusPriv
friend
friend class CYISceneManagerPriv
friend

The scene node is a friend of this class because the scene manager maintains a private queue of nodes to be deleted, which the scene node needs to access through QueueForDeletion().

friend class CYISceneNode
friend
friend class CYISceneNodeUtilityPriv
friend

Member Data Documentation

CYISignal<const CYIString &, CYISceneNode *> CYISceneManager::SceneStaged

Emitted when a scene is staged. The first signal parameter is the scene name, and the second is the root node of the scene.

CYISignal<const CYIString &, CYISceneNode *> CYISceneManager::SceneUnstaged

Emitted when a scene is unstaged. The first signal parameter is the scene name, and the second is the root node of the scene.


The documentation for this class was generated from the following file: