XII Release 0.1.0
Loading...
Searching...
No Matches
xiiEngineProcessDocumentContext Class Referenceabstract

#include <EngineProcessDocumentContext.h>

Inheritance diagram for xiiEngineProcessDocumentContext:
[legend]

Public Member Functions

 xiiEngineProcessDocumentContext (xiiBitflags< xiiEngineProcessDocumentContextFlags > flags)
virtual xiiStatus Initialize (const xiiUuid &documentGuid, const xiiVariant &metaData, xiiEngineProcessCommunicationChannel *pIPC, xiiStringView sDocumentType)
 Initializes the context and rolls back partially initialized state on failure.
void Deinitialize ()
 Releases initialized or partially initialized state. Repeated calls are safe.
xiiStringView GetDocumentType () const
 Returns the document type for which this context was created. Useful in case a context may be used for multiple document types.
void SendProcessMessage (xiiProcessMessage *pMsg=nullptr)
virtual void HandleMessage (const xiiEditorEngineDocumentMsg *pMsg)
xiiBoundingBoxSphere GetWorldBounds (xiiWorld *pWorld)
void ProcessEditorEngineSyncObjectMsg (const xiiEditorEngineSyncObjectMsg &msg)
const xiiUuid & GetDocumentGuid () const
virtual xiiStatus Reset ()
void ClearExistingObjects ()
virtual xiiWorldRttiConverterContext & GetContext ()
virtual const xiiWorldRttiConverterContext & GetContext () const
xiiWorld * GetWorld () const
xiiResult DrawGizmos (const xiiView &view)
xiiResult PickGizmo (const xiiView &view, float fNormalizedX, float fNormalizedY, xiiEditorGizmoPickResult &out_result)
virtual xiiGameObjectHandle ResolveStringToGameObjectHandle (const void *pString, xiiComponentHandle hThis, xiiStringView sProperty) const
 Tries to resolve a 'reference' (given in pData) to a xiiGameObject.
Public Member Functions inherited from xiiReflectedClass
virtual const xiiRTTI * GetDynamicRTTI () const
bool IsInstanceOf (const xiiRTTI *pType) const
 Returns whether the type of this instance is of the given type or derived from it.
template<typename T>
XII_ALWAYS_INLINE bool IsInstanceOf () const
 Returns whether the type of this instance is of the given type or derived from it.

Static Public Member Functions

static xiiEngineProcessDocumentContext * GetDocumentContext (xiiUuid guid)
static xiiStatus AllocateDocumentContext (const xiiDocumentOpenMsgToEngine &request, xiiEngineProcessDocumentContext *&out_pContext)
 Copyright (c) Theophilus Eriata. All Rights Reserved.
static xiiStatus AddDocumentContext (xiiUuid guid, const xiiVariant &metaData, xiiEngineProcessDocumentContext *pView, xiiEngineProcessCommunicationChannel *pIPC, xiiStringView sDocumentType)
 Takes ownership on success. Failure leaves ownership unchanged and rolls back any initialization begun here.
static bool PendingOperationsInProgress ()
static void UpdateDocumentContexts ()
static void FinishFrame ()
 Consumes redraw requests after presentation; thumbnails request another frame on their next tick.
static bool TryGetWindowRedrawState (xiiRegisteredWindowHandle hWindow, bool &out_bRedrawRequested)
 Returns whether a window belongs to document views and combines their presentation requests.
static void DestroyDocumentContext (xiiUuid guid)
static void DestroyAllDocumentContexts ()
 Releases borrowed-world contexts before contexts which own their world.
Static Public Member Functions inherited from xiiNoBase
static const xiiRTTI * GetStaticRTTI ()

Public Attributes

xiiIPCObjectMirrorEngine m_Mirror
xiiWorldRttiConverterContext m_Context

Protected Member Functions

virtual xiiStatus OnInitialize ()
 OnDeinitialize must release any state acquired before this hook returns failure.
virtual void OnDeinitialize ()
virtual xiiEngineProcessViewContext * CreateViewContext ()=0
 Needs to be implemented to create a view context used for windows and thumbnails rendering.
virtual void DestroyViewContext (xiiEngineProcessViewContext *pContext)=0
 Needs to be implemented to destroy the view context created in CreateViewContext.
virtual bool PendingOperationInProgress () const
virtual void UpdateDocumentContext ()
virtual xiiStatus ExportDocument (const xiiExportDocumentMsgToEngine *pMsg)
 Exports to current document resource to file. Make sure to write xiiAssetFileHeader at the start of it.
void UpdateSyncObjects ()
void CreateThumbnailViewContext (const xiiCreateThumbnailMsgToEngine *pMsg)
 Creates the thumbnail view context. It uses 'CreateViewContext' in combination with an off-screen render target.
void DestroyThumbnailViewContext ()
 Once a thumbnail is successfully rendered, the thumbnail view context is destroyed again.
virtual bool UpdateThumbnailViewContext (xiiEngineProcessViewContext *pThumbnailViewContext)
virtual void OnThumbnailViewContextRequested ()
 Called before a thumbnail context is created.
virtual void OnThumbnailViewContextCreated ()
 Called after a thumbnail context was created. Allows to insert code before the thumbnail is generated.
virtual void OnDestroyThumbnailViewContext ()
 Called before a thumbnail context is destroyed. Used for cleanup of what was done in OnThumbnailViewContextCreated().
void SetTagOnObject (const xiiUuid &object, const char *szTag, bool bSet, bool recursive)
 Sets or removes the given tag on the object and optionally all children.
void SetTagRecursive (xiiGameObject *pObject, const xiiTag &tag)
 Sets the given tag on the object and all children.
void ClearTagRecursive (xiiGameObject *pObject, const xiiTag &tag)
 Clears the given tag on the object and all children.
const xiiEngineProcessViewContext * GetViewContext (xiiUInt32 uiView) const

Protected Attributes

xiiWorld * m_pWorld = nullptr
xiiBitflags< xiiEngineProcessDocumentContextFlags > m_Flags
xiiUuid m_DocumentGuid
xiiVariant m_MetaData
xiiEngineProcessCommunicationChannel * m_pIPC = nullptr
xiiHybridArray< xiiEngineProcessViewContext *, 4 > m_ViewContexts
xiiMap< xiiUuid, xiiEditorEngineSyncObject * > m_SyncObjects

Friends

class xiiEditorEngineSyncObject

Detailed Description

A document context is the counter part to an editor document on the engine side.

For every document in the editor that requires engine output (rendering, picking, etc.), there is a xiiEngineProcessDocumentContext created in the engine process.

Member Function Documentation

◆ AllocateDocumentContext()

xiiStatus xiiEngineProcessDocumentContext::AllocateDocumentContext ( const xiiDocumentOpenMsgToEngine & request,
xiiEngineProcessDocumentContext *& out_pContext )
static

Copyright (c) Theophilus Eriata. All Rights Reserved.

Allocates the unique reflected context registered for the requested document type. A custom static AllocateContext(const xiiDocumentOpenMsgToEngine*) may reject the request by returning null. On success the caller owns the uninitialized context and must register it or deallocate it through its RTTI allocator. On failure out_pContext is null. Does not modify the document registry.

◆ CreateViewContext()

virtual xiiEngineProcessViewContext * xiiEngineProcessDocumentContext::CreateViewContext ( )
protectedpure virtual

◆ DestroyViewContext()

virtual void xiiEngineProcessDocumentContext::DestroyViewContext ( xiiEngineProcessViewContext * pContext)
protectedpure virtual

◆ DrawGizmos()

xiiResult xiiEngineProcessDocumentContext::DrawGizmos ( const xiiView & view)

Submits this document's synchronized handles to the view's normal debug-render graph passes. Requires exclusive document/world access. A view from another world is rejected.

◆ ExportDocument()

xiiStatus xiiEngineProcessDocumentContext::ExportDocument ( const xiiExportDocumentMsgToEngine * pMsg)
protectedvirtual

Exports to current document resource to file. Make sure to write xiiAssetFileHeader at the start of it.

Reimplemented in xiiLayerContext, xiiRenderPipelineContext, xiiSceneContext, and xiiStateMachineContext.

◆ OnDestroyThumbnailViewContext()

void xiiEngineProcessDocumentContext::OnDestroyThumbnailViewContext ( )
protectedvirtual

Called before a thumbnail context is destroyed. Used for cleanup of what was done in OnThumbnailViewContextCreated().

Reimplemented in xiiSceneContext.

◆ OnInitialize()

xiiStatus xiiEngineProcessDocumentContext::OnInitialize ( )
protectedvirtual

OnDeinitialize must release any state acquired before this hook returns failure.

Reimplemented in xiiAnimatedMeshContext, xiiAnimationClipContext, xiiDecalContext, xiiLayerContext, xiiMaterialContext, xiiMeshContext, xiiSceneContext, xiiSkeletonContext, xiiTextureContext, and xiiTextureCubeContext.

◆ OnThumbnailViewContextCreated()

void xiiEngineProcessDocumentContext::OnThumbnailViewContextCreated ( )
protectedvirtual

Called after a thumbnail context was created. Allows to insert code before the thumbnail is generated.

Reimplemented in xiiSceneContext.

◆ PendingOperationInProgress()

bool xiiEngineProcessDocumentContext::PendingOperationInProgress ( ) const
protectedvirtual

Should return true if this context has any operation in progress like thumbnail rendering and thus needs to continue rendering even if no new messages from the editor come in.

◆ PickGizmo()

xiiResult xiiEngineProcessDocumentContext::PickGizmo ( const xiiView & view,
float fNormalizedX,
float fNormalizedY,
xiiEditorGizmoPickResult & out_result )

Picks document handles at normalized viewport coordinates. Overlay handles take priority, then nearest forward ray time; equal hits follow sync GUID order. Misses leave the output unchanged. Scene geometry occlusion is evaluated by the scene picking consumer using the returned ray time.

◆ ResolveStringToGameObjectHandle()

xiiGameObjectHandle xiiEngineProcessDocumentContext::ResolveStringToGameObjectHandle ( const void * pData,
xiiComponentHandle hThis,
xiiStringView sComponentProperty ) const
virtual

Tries to resolve a 'reference' (given in pData) to a xiiGameObject.

Tries to resolve a 'reference' (given in pData) to a xiiGameObject. hThis is the 'owner' of the reference and szComponentProperty is the name of the reference property in that component.

There are two different use cases:

1) hThis is invalid and szComponentProperty is null:

This is used by xiiPrefabReferenceComponent::SerializeComponent() to check whether a string represents a game object reference. It may be any arbitrary string and thus must not assert. In this case a reference is always a stringyfied GUID. Since this is only used for scene export, only the lookup shall be done and nothing else.

2) hThis and szComponentProperty represent a valid component+property combination:

This is called at edit time whenever a reference property is queried, which also happens whenever a reference is modified. In this case we need to maintain two maps: one that know which object references which other objects one that knows by which other objects an object is referenced These are needed to fix up references during undo/redo when objects get deleted and recreated. Ie. when an object that has references or is referenced gets deleted and then undo restores it, the references should appear as well.

Reimplemented in xiiSceneContext.

◆ UpdateDocumentContext()

void xiiEngineProcessDocumentContext::UpdateDocumentContext ( )
protectedvirtual

A tick functions that allows each document context to do processing that continues over multiple frames and can't be handled in HandleMessage directly.

Make sure to call the base implementation when overwriting as this handles the thumbnail rendering that takes multiple frames to complete.

Reimplemented in xiiLayerContext, and xiiSceneContext.

◆ UpdateThumbnailViewContext()

bool xiiEngineProcessDocumentContext::UpdateThumbnailViewContext ( xiiEngineProcessViewContext * pThumbnailViewContext)
protectedvirtual

Overwrite this function to apply the thumbnail render settings to the given context.

Return false if you need more frames to be rendered to setup everything correctly. If true is returned for 'ThumbnailConvergenceFramesTarget' frames in a row the thumbnail image is taken. This is to allow e.g. camera updates after more resources have been streamed in. The frame counter will start over to count to 'ThumbnailConvergenceFramesTarget' when a new resource is being loaded to make sure we do not make an image of half-streamed in data.

Reimplemented in xiiAnimatedMeshContext, xiiAnimationClipContext, xiiMaterialContext, xiiMeshContext, xiiSceneContext, and xiiSkeletonContext.


The documentation for this class was generated from the following files:
  • /home/runner/work/XII/XII/Source/Editor/EditorEngineProcessFramework/EngineProcess/EngineProcessDocumentContext.h
  • /home/runner/work/XII/XII/Source/Editor/EditorEngineProcessFramework/EngineProcess/Implementation/DocumentContextFactory.cpp
  • /home/runner/work/XII/XII/Source/Editor/EditorEngineProcessFramework/EngineProcess/Implementation/EngineProcessDocumentContext.cpp