You.i Engine
CYIViewTemplate Class Referenceabstract

Detailed Description

A view template defines information about a view, so it can be built automatically.

This class defines an interface for view construction information.

See also
CYIAEViewTemplate

#include <import/YiViewTemplate.h>

Inheritance diagram for CYIViewTemplate:

Classes

class  Source
 Defines information about the sources a view template may have. More...
 

Public Member Functions

virtual ~CYIViewTemplate ()
 
std::unique_ptr< CYISceneViewBuildView (CYISceneManager *pSceneManager, const std::shared_ptr< CYIAssetViewTemplate > &pAssetViewTemplate)
 
virtual void SetTimelineSource (std::shared_ptr< CYIAssetTimelineSource > pTimelineSource)=0
 
virtual std::shared_ptr< CYIAssetTimelineSourceGetTimelineSource ()=0
 
virtual std::unique_ptr< CYITimelineBuildTimeline (CYISceneNode *pRootNode)=0
 
virtual std::unique_ptr< CYITimelineBuildTimeline (CYISceneNode *pRootNode, const CYIString &markerName)=0
 
virtual std::unique_ptr< CYITimelineBuildTimeline (CYISceneNode *pRootNode, CYIMarkerData::ID id)=0
 
virtual std::unique_ptr< CYITimelineBuildTimeline (CYISceneNode *pRootNode, int32_t startOffset, int32_t duration)=0
 
virtual void GetSize (float &width, float &height)=0
 
virtual float GetHeight ()=0
 
virtual float GetWidth ()=0
 
virtual float GetDefaultCameraDistance ()
 
virtual CYIString GetName () const =0
 
virtual const CYIStringGetViewClassName () const =0
 
virtual bool GetBackgroundColor (CYIColor *pColor)=0
 
virtual const std::vector< CYIString > & GetChildTemplateNames ()=0
 
virtual size_t GetApproximateSize () const =0
 
virtual std::vector< SourceGetSources () const =0
 
- Public Member Functions inherited from IYIPropertiesSource
virtual ~IYIPropertiesSource ()=default
 
virtual CYIOptional< CYIStringViewGetProperty (CYIStringView propertyName) const =0
 
bool GetProperty (CYIStringView propertyName, CYIString *pValue) const
 
virtual std::map< CYIString, CYIStringGetProperties () const =0
 
virtual void ForEachProperty (const std::function< void(const CYIString &, const CYIString &)> &action) const =0
 
virtual bool HasProperties () const =0
 

Static Public Member Functions

static std::shared_ptr< CYIAssetViewTemplateGetViewTemplate (const CYIString &viewTemplateName)
 
static glm::vec2 GetViewTemplateSize (const CYIString &viewTemplateName)
 

Protected Member Functions

 CYIViewTemplate ()
 

Friends

class CYISceneView
 

Constructor & Destructor Documentation

◆ ~CYIViewTemplate()

virtual CYIViewTemplate::~CYIViewTemplate ( )
inlinevirtual

◆ CYIViewTemplate()

CYIViewTemplate::CYIViewTemplate ( )
inlineprotected

Member Function Documentation

◆ BuildTimeline() [1/4]

virtual std::unique_ptr<CYITimeline> CYIViewTemplate::BuildTimeline ( CYISceneNode pRootNode)
pure virtual

Returns a timeline referencing the entire duration of the timeline source associated with this template. The timeline's tracks will be associated with the tree rooted at pRootNode.

Implemented in CYIAEViewTemplate.

◆ BuildTimeline() [2/4]

virtual std::unique_ptr<CYITimeline> CYIViewTemplate::BuildTimeline ( CYISceneNode pRootNode,
const CYIString markerName 
)
pure virtual

Returns a timeline referencing a portion of the timeline source associated with this template. The timeline's tracks will be associated with the tree rooted at pRootNode.

The portion to be returned is named by markerName. If markerName is not valid for this associated timeline source, null is returned.

See also
CYIMarkerData

Implemented in CYIAEViewTemplate.

◆ BuildTimeline() [3/4]

virtual std::unique_ptr<CYITimeline> CYIViewTemplate::BuildTimeline ( CYISceneNode pRootNode,
CYIMarkerData::ID  id 
)
pure virtual

Returns a timeline referencing a portion of the timeline source associated with this template. The timeline's tracks will be associated with the tree rooted at pRootNode.

The portion to be returned is specified by id, as an alternative to marker names. If id is not valid for this associated timeline source, null is returned.

See also
CYIMarkerData

Implemented in CYIAEViewTemplate.

◆ BuildTimeline() [4/4]

virtual std::unique_ptr<CYITimeline> CYIViewTemplate::BuildTimeline ( CYISceneNode pRootNode,
int32_t  startOffset,
int32_t  duration 
)
pure virtual

Returns a timeline referencing a portion of the timeline source associated with this template. The timeline's tracks will be associated with the tree rooted at pRootNode.

The portion to be returned starts at startOffset and has size duration. A non-null timeline will always be returned even if startOffset and duration are not valid for the timeline source.

Implemented in CYIAEViewTemplate.

◆ BuildView()

std::unique_ptr<CYISceneView> CYIViewTemplate::BuildView ( CYISceneManager pSceneManager,
const std::shared_ptr< CYIAssetViewTemplate > &  pAssetViewTemplate 
)

Constructs a view instance from pAssetViewTemplate.

Note
Before a CYISceneView is ready to be used, the Init() method must also be called.

Consider the following example to construct and initialize a CYISceneView:

std::shared_ptr<CYIAssetViewTemplate> pAssetViewTemplate = CYIViewTemplate::GetViewTemplate("CustomViews_CustomButton");
std::shared_ptr<CYIViewTemplate> pViewTemplate = pAssetViewTemplate->GetTemplate();
pSceneView = pViewTemplate->BuildView(m_pSceneManager, pAssetViewTemplate);
pSceneView->Init();

The caller is responsible for destroying the view.

◆ GetApproximateSize()

virtual size_t CYIViewTemplate::GetApproximateSize ( ) const
pure virtual

Returns the approximate size of this class, which has use in implementing asset caching strategies.

Implemented in CYIAEViewTemplate.

◆ GetBackgroundColor()

virtual bool CYIViewTemplate::GetBackgroundColor ( CYIColor pColor)
pure virtual

Stores the background color of this template into pColor. Return false if this template does not have a background color.

Implemented in CYIAEViewTemplate.

◆ GetChildTemplateNames()

virtual const std::vector<CYIString>& CYIViewTemplate::GetChildTemplateNames ( )
pure virtual

Returns a unique list of names of view templates references by this view template. Names are in the form <AEPFile_<CompName>.

Note that view templates may have multiple references to the same template, but each name will only show up once in this list.

Implemented in CYIAEViewTemplate.

◆ GetDefaultCameraDistance()

virtual float CYIViewTemplate::GetDefaultCameraDistance ( )
virtual

The distance from which the view template was designed to be viewed.

Reimplemented in CYIAEViewTemplate.

◆ GetHeight()

virtual float CYIViewTemplate::GetHeight ( )
pure virtual

Returns the height of this view template.

The height of the template will be the height of the view created from the template. The height of the view is expressed in local space of the created view.

Implemented in CYIAEViewTemplate.

◆ GetName()

virtual CYIString CYIViewTemplate::GetName ( ) const
pure virtual

Returns the name of this template, corresponding to the AE comp name.

Implemented in CYIAEViewTemplate.

◆ GetSize()

virtual void CYIViewTemplate::GetSize ( float &  width,
float &  height 
)
pure virtual

Returns the width and height of this view template, stored in width and height respectively.

The size of the template will be the size of the view created from the template. The size of the view is expressed in local space of the created view.

Implemented in CYIAEViewTemplate.

◆ GetSources()

virtual std::vector<Source> CYIViewTemplate::GetSources ( ) const
pure virtual

Returns a list of the view template's sources.

Implemented in CYIAEViewTemplate.

◆ GetTimelineSource()

virtual std::shared_ptr<CYIAssetTimelineSource> CYIViewTemplate::GetTimelineSource ( )
pure virtual

Returns the timeline source associated with this view template.

See also
SetTimelineSource

Implemented in CYIAEViewTemplate.

◆ GetViewClassName()

virtual const CYIString& CYIViewTemplate::GetViewClassName ( ) const
pure virtual

Returns the name of the view class that should be instansiated when constructing a view with this template. An empty string can also be returned, implying the default view class.

Implemented in CYIAEViewTemplate.

◆ GetViewTemplate()

static std::shared_ptr<CYIAssetViewTemplate> CYIViewTemplate::GetViewTemplate ( const CYIString viewTemplateName)
static

Returns a view template named viewTemplateName. If the view template was never loaded, it will be loaded automatically and added to the asset manager.

If the view template could not be found or could not be loaded, this function returns null.

Note
Template name format is <AEPFile>_<CompName> - not to be confused with the filename of the asset which includes the .layout extension.

◆ GetViewTemplateSize()

static glm::vec2 CYIViewTemplate::GetViewTemplateSize ( const CYIString viewTemplateName)
static

Returns the size of a view template with name viewTemplateName. This uses GetViewTemplate internally, so if you already have a view template it would be better to query its size directly.

If the view template could not be found, size (0,0) is returned.

The size of the template will be the size of the view created from the template. The size of the view is expressed in local space of the created view.

See also
GetViewTemplate

◆ GetWidth()

virtual float CYIViewTemplate::GetWidth ( )
pure virtual

Returns the width of this view template.

The width of the template will be the width of the view created from the template. The width of the view is expressed in local space of the created view.

Implemented in CYIAEViewTemplate.

◆ SetTimelineSource()

virtual void CYIViewTemplate::SetTimelineSource ( std::shared_ptr< CYIAssetTimelineSource pTimelineSource)
pure virtual

Associates pTimelineSource with this view template.

The timeline asset specifies how nodes generated by this view template will be animated.

Implemented in CYIAEViewTemplate.

Friends And Related Function Documentation

◆ CYISceneView

friend class CYISceneView
friend

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