XII Release 0.1.0
Loading...
Searching...
No Matches
xiiDocument Class Referenceabstract
Inheritance diagram for xiiDocument:
[legend]

Classes

struct  PasteInfo
 

Public Member Functions

 xiiDocument (xiiStringView sPath, xiiDocumentObjectManager *pDocumentObjectManagerImpl)
 
Document State Functions
bool IsModified () const
 
bool IsReadOnly () const
 
const xiiUuid GetGuid () const
 
const xiiDocumentObjectManagerGetObjectManager () const
 
xiiDocumentObjectManagerGetObjectManager ()
 
xiiSelectionManagerGetSelectionManager () const
 
xiiCommandHistoryGetCommandHistory () const
 
virtual xiiObjectAccessorBaseGetObjectAccessor () const
 
Clipboard Functions
virtual void GetSupportedMimeTypesForPasting (xiiHybridArray< xiiString, 4 > &out_mimeTypes) const
 Whether this document supports pasting the given mime format into it.
 
virtual bool CopySelectedObjects (xiiAbstractObjectGraph &out_objectGraph, xiiStringBuilder &out_sMimeType) const
 Creates the abstract graph of data to be copied and returns the mime type for the clipboard to identify the data.
 
virtual bool Paste (const xiiArrayPtr< PasteInfo > &info, const xiiAbstractObjectGraph &objectGraph, bool bAllowPickedPosition, xiiStringView sMimeType)
 
Inter Document Communication
void BroadcastInterDocumentMessage (xiiReflectedClass *pMessage, xiiDocument *pSender)
 This will deliver the message to all open documents. The documents may respond, e.g. by modifying the content of the message.
 
virtual void OnInterDocumentMessage (xiiReflectedClass *pMessage, xiiDocument *pSender)
 Called on all documents when BroadcastInterDocumentMessage() is called.
 
Editing Functionality
virtual xiiEditorInputContextGetEditorInputContextOverride ()
 Allows to return a single input context that currently overrides all others (in priority).
 
Misc Functions
virtual void DeleteSelectedObjects () const
 
const xiiSet< xiiString > & GetUnknownObjectTypes () const
 
xiiUInt32 GetUnknownObjectTypeInstances () const
 
void SetAddToResetFilesList (bool b)
 If disabled, this document will not be put into the recent files list.
 
bool GetAddToRecentFilesList () const
 Whether this document shall be put into the recent files list.
 
void ShowDocumentStatus (const xiiFormatString &msg) const
 Broadcasts a status message event. The window that displays the document may show this in some form, e.g. in the status bar.
 
virtual xiiResult ComputeObjectTransformation (const xiiDocumentObject *pObject, xiiTransform &out_result) const
 Tries to compute the position and rotation for an object in the document. Returns XII_SUCCESS if it was possible.
 
virtual xiiManipulatorSearchStrategy GetManipulatorSearchStrategy () const
 Needed by xiiManipulatorManager to know where to look for the manipulator attributes.
 
- Public Member Functions inherited from xiiReflectedClass
virtual const xiiRTTIGetDynamicRTTI () 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.
 

Public Attributes

xiiUniquePtr< xiiObjectMetaData< xiiUuid, xiiDocumentObjectMetaData > > m_DocumentObjectMetaData
 
xiiEvent< const xiiDocumentEvent & > m_EventsOne
 
xiiEvent< const xiiObjectAccessorChangeEvent & > m_ObjectAccessorChangeEvents
 

Static Public Attributes

static xiiEvent< const xiiDocumentEvent & > s_EventsAny
 

Protected Member Functions

void SetModified (bool b)
 
void SetReadOnly (bool b)
 
virtual xiiTaskGroupID InternalSaveDocument (AfterSaveCallback callback)
 
virtual xiiStatus InternalLoadDocument ()
 
virtual xiiDocumentInfoCreateDocumentInfo ()=0
 
virtual void InternalAfterSaveDocument ()
 A hook to execute additional code after SUCCESSFULLY saving a document. E.g. manual asset transform can be done here.
 
virtual void AttachMetaDataBeforeSaving (xiiAbstractObjectGraph &graph) const
 
virtual void RestoreMetaDataAfterLoading (const xiiAbstractObjectGraph &graph, bool bUndoable)
 
virtual void InitializeAfterLoading (bool bFirstTimeCreation)
 
virtual void InitializeAfterLoadingAndSaving ()
 
virtual void BeforeClosing ()
 
void SetUnknownObjectTypes (const xiiSet< xiiString > &Types, xiiUInt32 uiInstances)
 

Protected Attributes

xiiUniquePtr< xiiDocumentObjectManagerm_pObjectManager
 
xiiUniquePtr< xiiCommandHistorym_pCommandHistory
 
xiiUniquePtr< xiiSelectionManagerm_pSelectionManager
 
xiiUniquePtr< xiiObjectCommandAccessorm_pObjectAccessor
 Default object accessor used by every doc.
 
xiiDocumentInfom_pDocumentInfo = nullptr
 
const xiiDocumentTypeDescriptorm_pTypeDescriptor = nullptr
 

Friends

class xiiDocumentManager
 
class xiiCommandHistory
 
class xiiSaveDocumentTask
 
class xiiAfterSaveDocumentTask
 

Document Management Functions

using AfterSaveCallback = xiiDelegate<void(xiiDocument*, xiiStatus)>
 
xiiStringView GetDocumentPath () const
 Returns the absolute path to the document.
 
xiiStatus SaveDocument (bool bForce=false)
 Saves the document, if it is modified. If bForce is true, the document will be written, even if it is not considered modified.
 
xiiTaskGroupID SaveDocumentAsync (AfterSaveCallback callback, bool bForce=false)
 
void DocumentRenamed (xiiStringView sNewDocumentPath)
 
xiiStatus LoadDocument ()
 
void EnsureVisible ()
 Brings the corresponding window to the front.
 
xiiDocumentManagerGetDocumentManager () const
 
bool HasWindowBeenRequested () const
 
const xiiDocumentTypeDescriptorGetDocumentTypeDescriptor () const
 
xiiStringView GetDocumentTypeName () const
 Returns the document's type name. Same as GetDocumentTypeDescriptor()->m_sDocumentTypeName.
 
const xiiDocumentInfoGetDocumentInfo () const
 
virtual bool CanEngineProcessBeRestarted () const
 Asks the document whether a restart of the engine process is allowed at this time.
 
static xiiStatus ReadDocument (xiiStringView sDocumentPath, xiiUniquePtr< xiiAbstractObjectGraph > &ref_pHeader, xiiUniquePtr< xiiAbstractObjectGraph > &ref_pObjects, xiiUniquePtr< xiiAbstractObjectGraph > &ref_pTypes)
 
static xiiStatus ReadAndRegisterTypes (const xiiAbstractObjectGraph &types)
 

Main / Sub-Document Functions

xiiDocumentm_pHostDocument = nullptr
 
xiiDocumentm_pActiveSubDocument = nullptr
 
bool IsMainDocument () const
 Returns whether this document is a main document, i.e. self contained.
 
bool IsSubDocument () const
 Returns whether this document is a sub-document, i.e. is part of another document.
 
const xiiDocumentGetMainDocument () const
 In case this is a sub-document, returns the main document this belongs to. Otherwise 'this' is returned.
 
const xiiDocumentGetActiveSubDocument () const
 At any given time, only the active sub-document can be edited. This returns the active sub-document which can also be this document itself. Changes to the active sub-document are generally triggered by xiiDocumentObjectStructureEvent::Type::AfterReset.
 
xiiDocumentGetMainDocument ()
 
xiiDocumentGetActiveSubDocument ()
 

Prefab Functions

virtual bool ArePrefabsAllowed () const
 Whether the document allows to create prefabs in it. This may note be allowed for prefab documents themselves, to prevent nested prefabs.
 
virtual void UpdatePrefabs ()
 Updates ALL prefabs in the document with the latest changes. Merges the current prefab templates with the instances in the document.
 
void RevertPrefabs (xiiArrayPtr< const xiiDocumentObject * > selection)
 Resets the given objects to their template prefab state, if they have local modifications.
 
virtual void UnlinkPrefabs (xiiArrayPtr< const xiiDocumentObject * > selection)
 Removes the link between a prefab instance and its template, turning the instance into a regular object.
 
virtual xiiStatus CreatePrefabDocumentFromSelection (xiiStringView sFile, const xiiRTTI *pRootType, xiiDelegate< void(xiiAbstractObjectNode *)> adjustGraphNodeCB={}, xiiDelegate< void(xiiDocumentObject *)> adjustNewNodesCB={}, xiiDelegate< void(xiiAbstractObjectGraph &graph, xiiDynamicArray< xiiAbstractObjectNode * > &graphRootNodes)> finalizeGraphCB={})
 
virtual xiiStatus CreatePrefabDocument (xiiStringView sFile, xiiArrayPtr< const xiiDocumentObject * > rootObjects, const xiiUuid &invPrefabSeed, xiiUuid &out_newDocumentGuid, xiiDelegate< void(xiiAbstractObjectNode *)> adjustGraphNodeCB={}, bool bKeepOpen=false, xiiDelegate< void(xiiAbstractObjectGraph &graph, xiiDynamicArray< xiiAbstractObjectNode * > &graphRootNodes)> finalizeGraphCB={})
 
virtual xiiUuid ReplaceByPrefab (const xiiDocumentObject *pRootObject, xiiStringView sPrefabFile, const xiiUuid &prefabAsset, const xiiUuid &prefabSeed, bool bEnginePrefab)
 
virtual xiiUuid RevertPrefab (const xiiDocumentObject *pObject)
 
virtual void UpdatePrefabsRecursive (xiiDocumentObject *pObject)
 
virtual void UpdatePrefabObject (xiiDocumentObject *pObject, const xiiUuid &PrefabAsset, const xiiUuid &PrefabSeed, xiiStringView sBasePrefab)
 

Additional Inherited Members

- Static Public Member Functions inherited from xiiNoBase
static const xiiRTTIGetStaticRTTI ()
 

Member Function Documentation

◆ ArePrefabsAllowed()

virtual bool xiiDocument::ArePrefabsAllowed ( ) const
inlinevirtual

Whether the document allows to create prefabs in it. This may note be allowed for prefab documents themselves, to prevent nested prefabs.

Reimplemented in xiiSceneDocument.

◆ CanEngineProcessBeRestarted()

virtual bool xiiDocument::CanEngineProcessBeRestarted ( ) const
inlinevirtual

Asks the document whether a restart of the engine process is allowed at this time.

Documents that are currently interacting with the engine process (active play-the-game mode) should return false. All others should return true. As long as any document returns false, automatic engine process reload is suppressed.

Reimplemented in xiiSceneDocument.

◆ ComputeObjectTransformation()

xiiResult xiiDocument::ComputeObjectTransformation ( const xiiDocumentObject * pObject,
xiiTransform & out_result ) const
virtual

Tries to compute the position and rotation for an object in the document. Returns XII_SUCCESS if it was possible.

Reimplemented in xiiGameObjectDocument.

◆ CopySelectedObjects()

virtual bool xiiDocument::CopySelectedObjects ( xiiAbstractObjectGraph & out_objectGraph,
xiiStringBuilder & out_sMimeType ) const
inlinevirtual

Creates the abstract graph of data to be copied and returns the mime type for the clipboard to identify the data.

Reimplemented in xiiAnimationGraphAssetDocument, xiiMaterialAssetDocument, xiiRenderPipelineAssetDocument, xiiSceneDocument, xiiStateMachineAssetDocument, and xiiVisualScriptClassAssetDocument.

◆ GetEditorInputContextOverride()

virtual xiiEditorInputContext * xiiDocument::GetEditorInputContextOverride ( )
inlinevirtual

Allows to return a single input context that currently overrides all others (in priority).

Used to implement custom tools that need to have priority over selection and camera movement.

Reimplemented in xiiGameObjectDocument.

◆ GetManipulatorSearchStrategy()

virtual xiiManipulatorSearchStrategy xiiDocument::GetManipulatorSearchStrategy ( ) const
inlinevirtual

Needed by xiiManipulatorManager to know where to look for the manipulator attributes.

Override this function for document types that use manipulators. The xiiManipulatorManager will assert that the document type doesn't return 'None' once it is in use.

Reimplemented in xiiPropertyAnimAssetDocument, xiiSceneDocument, and xiiSkeletonAssetDocument.

◆ GetSupportedMimeTypesForPasting()

virtual void xiiDocument::GetSupportedMimeTypesForPasting ( xiiHybridArray< xiiString, 4 > & out_mimeTypes) const
inlinevirtual

◆ InternalAfterSaveDocument()

virtual void xiiDocument::InternalAfterSaveDocument ( )
inlineprotectedvirtual

A hook to execute additional code after SUCCESSFULLY saving a document. E.g. manual asset transform can be done here.

Reimplemented in xiiAssetDocument.

◆ InternalSaveDocument()

xiiTaskGroupID xiiDocument::InternalSaveDocument ( AfterSaveCallback callback)
protectedvirtual

Reimplemented in xiiAssetDocument, and xiiScene2Document.

◆ OnInterDocumentMessage()

virtual void xiiDocument::OnInterDocumentMessage ( xiiReflectedClass * pMessage,
xiiDocument * pSender )
inlinevirtual

Called on all documents when BroadcastInterDocumentMessage() is called.

Use the RTTI information to identify whether the message is of interest.

Reimplemented in xiiSceneDocument.

◆ RevertPrefab()

xiiUuid xiiDocument::RevertPrefab ( const xiiDocumentObject * pObject)
virtual

Reimplemented in xiiSceneDocument.

◆ UnlinkPrefabs()

void xiiDocument::UnlinkPrefabs ( xiiArrayPtr< const xiiDocumentObject * > selection)
virtual

Removes the link between a prefab instance and its template, turning the instance into a regular object.

Reimplemented in xiiSceneDocument.

◆ UpdatePrefabs()

void xiiDocument::UpdatePrefabs ( )
virtual

Updates ALL prefabs in the document with the latest changes. Merges the current prefab templates with the instances in the document.

Reimplemented in xiiSceneDocument.


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