![]() |
ezEngine
Release 25.03
|
A document context is the counter part to an editor document on the engine side. More...
#include <EngineProcessDocumentContext.h>
Public Member Functions | |
ezEngineProcessDocumentContext (ezBitflags< ezEngineProcessDocumentContextFlags > flags) | |
virtual void | Initialize (const ezUuid &documentGuid, const ezVariant &metaData, ezEngineProcessCommunicationChannel *pIPC, ezStringView sDocumentType) |
void | Deinitialize () |
ezStringView | 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 (ezProcessMessage *pMsg=nullptr) |
virtual void | HandleMessage (const ezEditorEngineDocumentMsg *pMsg) |
ezBoundingBoxSphere | GetWorldBounds (ezWorld *pWorld) |
void | ProcessEditorEngineSyncObjectMsg (const ezEditorEngineSyncObjectMsg &msg) |
const ezUuid & | GetDocumentGuid () const |
virtual void | Reset () |
void | ClearExistingObjects () |
virtual ezWorldRttiConverterContext & | GetContext () |
virtual const ezWorldRttiConverterContext & | GetContext () const |
ezWorld * | GetWorld () const |
virtual ezGameObjectHandle | ResolveStringToGameObjectHandle (const void *pString, ezComponentHandle hThis, ezStringView sProperty) const |
Tries to resolve a 'reference' (given in pData) to an ezGameObject. More... | |
![]() | |
virtual const ezRTTI * | GetDynamicRTTI () const |
bool | IsInstanceOf (const ezRTTI *pType) const |
Returns whether the type of this instance is of the given type or derived from it. | |
template<typename T > | |
EZ_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 ezEngineProcessDocumentContext * | GetDocumentContext (ezUuid guid) |
static void | AddDocumentContext (ezUuid guid, const ezVariant &metaData, ezEngineProcessDocumentContext *pView, ezEngineProcessCommunicationChannel *pIPC, ezStringView sDocumentType) |
static bool | PendingOperationsInProgress () |
static void | UpdateDocumentContexts () |
static void | DestroyDocumentContext (ezUuid guid) |
![]() | |
static const ezRTTI * | GetStaticRTTI () |
Public Attributes | |
ezIPCObjectMirrorEngine | m_Mirror |
ezWorldRttiConverterContext | m_Context |
Protected Member Functions | |
virtual void | OnInitialize () |
virtual void | OnDeinitialize () |
virtual ezEngineProcessViewContext * | CreateViewContext ()=0 |
Needs to be implemented to create a view context used for windows and thumbnails rendering. | |
virtual void | DestroyViewContext (ezEngineProcessViewContext *pContext)=0 |
Needs to be implemented to destroy the view context created in CreateViewContext. | |
virtual bool | PendingOperationInProgress () const |
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. | |
virtual void | UpdateDocumentContext () |
A tick functions that allows each document context to do processing that continues over multiple frames and can't be handled in HandleMessage directly. More... | |
virtual ezStatus | ExportDocument (const ezExportDocumentMsgToEngine *pMsg) |
Exports to current document resource to file. Make sure to write ezAssetFileHeader at the start of it. | |
void | UpdateSyncObjects () |
void | CreateThumbnailViewContext (const ezCreateThumbnailMsgToEngine *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 (ezEngineProcessViewContext *pThumbnailViewContext) |
Overwrite this function to apply the thumbnail render settings to the given context. More... | |
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 ezUuid &object, const char *szTag, bool bSet, bool recursive) |
Sets or removes the given tag on the object and optionally all children. | |
void | SetTagRecursive (ezGameObject *pObject, const ezTag &tag) |
Sets the given tag on the object and all children. | |
void | ClearTagRecursive (ezGameObject *pObject, const ezTag &tag) |
Clears the given tag on the object and all children. | |
const ezEngineProcessViewContext * | GetViewContext (ezUInt32 uiView) const |
Protected Attributes | |
ezWorld * | m_pWorld = nullptr |
ezBitflags< ezEngineProcessDocumentContextFlags > | m_Flags |
ezUuid | m_DocumentGuid |
ezVariant | m_MetaData |
ezEngineProcessCommunicationChannel * | m_pIPC = nullptr |
ezHybridArray< ezEngineProcessViewContext *, 4 > | m_ViewContexts |
ezMap< ezUuid, ezEditorEngineSyncObject * > | m_SyncObjects |
Friends | |
class | ezEditorEngineSyncObject |
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 ezEngineProcessDocumentContext created in the engine process.
|
virtual |
Tries to resolve a 'reference' (given in pData) to an ezGameObject.
Tries to resolve a 'reference' (given in pData) to an ezGameObject. 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 ezPrefabReferenceComponent::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 ezSceneContext.
|
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 ezSceneContext, and ezLayerContext.
|
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 ezSceneContext, ezAnimatedMeshContext, ezMeshContext, ezMaterialContext, ezJoltCollisionMeshContext, ezParticleContext, ezCollisionMeshContext, ezSkeletonContext, ezKrautTreeContext, ezRmlUiDocumentContext, and ezAnimationClipContext.