Plasma Engine  2.0
Loading...
Searching...
No Matches
plDocument Class Referenceabstract
Inheritance diagram for plDocument:

Classes

struct  PasteInfo
 

Public Member Functions

 plDocument (plStringView sPath, plDocumentObjectManager *pDocumentObjectManagerImpl)
 
Document State Functions
bool IsModified () const
 
bool IsReadOnly () const
 
const plUuid GetGuid () const
 
const plDocumentObjectManagerGetObjectManager () const
 
plDocumentObjectManagerGetObjectManager ()
 
plSelectionManagerGetSelectionManager () const
 
plCommandHistoryGetCommandHistory () const
 
virtual plObjectAccessorBaseGetObjectAccessor () const
 
Clipboard Functions
virtual void GetSupportedMimeTypesForPasting (plHybridArray< plString, 4 > &out_mimeTypes) const
 Whether this document supports pasting the given mime format into it.
 
virtual bool CopySelectedObjects (plAbstractObjectGraph &out_objectGraph, plStringBuilder &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 plArrayPtr< PasteInfo > &info, const plAbstractObjectGraph &objectGraph, bool bAllowPickedPosition, plStringView sMimeType)
 
Inter Document Communication
void BroadcastInterDocumentMessage (plReflectedClass *pMessage, plDocument *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 (plReflectedClass *pMessage, plDocument *pSender)
 Called on all documents when BroadcastInterDocumentMessage() is called.
 
Editing Functionality
virtual plEditorInputContextGetEditorInputContextOverride ()
 Allows to return a single input context that currently overrides all others (in priority).
 
Misc Functions
virtual void DeleteSelectedObjects () const
 
const plSet< plString > & GetUnknownObjectTypes () const
 
plUInt32 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 plFormatString &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 plResult ComputeObjectTransformation (const plDocumentObject *pObject, plTransform &out_result) const
 Tries to compute the position and rotation for an object in the document. Returns PL_SUCCESS if it was possible.
 
virtual plManipulatorSearchStrategy GetManipulatorSearchStrategy () const
 Needed by plManipulatorManager to know where to look for the manipulator attributes.
 
- Public Member Functions inherited from plReflectedClass
virtual const plRTTIGetDynamicRTTI () const
 
bool IsInstanceOf (const plRTTI *pType) const
 Returns whether the type of this instance is of the given type or derived from it.
 
template<typename T >
PL_ALWAYS_INLINE bool IsInstanceOf () const
 Returns whether the type of this instance is of the given type or derived from it.
 

Public Attributes

plUniquePtr< plObjectMetaData< plUuid, plDocumentObjectMetaData > > m_DocumentObjectMetaData
 
plEvent< const plDocumentEvent & > m_EventsOne
 
plEvent< const plObjectAccessorChangeEvent & > m_ObjectAccessorChangeEvents
 

Static Public Attributes

static plEvent< const plDocumentEvent & > s_EventsAny
 

Protected Member Functions

void SetModified (bool b)
 
void SetReadOnly (bool b)
 
virtual plTaskGroupID InternalSaveDocument (AfterSaveCallback callback)
 
virtual plStatus InternalLoadDocument ()
 
virtual plDocumentInfoCreateDocumentInfo ()=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 (plAbstractObjectGraph &graph) const
 
virtual void RestoreMetaDataAfterLoading (const plAbstractObjectGraph &graph, bool bUndoable)
 
virtual void InitializeAfterLoading (bool bFirstTimeCreation)
 
virtual void InitializeAfterLoadingAndSaving ()
 
virtual void BeforeClosing ()
 
void SetUnknownObjectTypes (const plSet< plString > &Types, plUInt32 uiInstances)
 

Protected Attributes

plUniquePtr< plDocumentObjectManagerm_pObjectManager
 
plUniquePtr< plCommandHistorym_pCommandHistory
 
plUniquePtr< plSelectionManagerm_pSelectionManager
 
plUniquePtr< plObjectCommandAccessorm_pObjectAccessor
 Default object accessor used by every doc.
 
plDocumentInfom_pDocumentInfo = nullptr
 
const plDocumentTypeDescriptorm_pTypeDescriptor = nullptr
 

Friends

class plDocumentManager
 
class plCommandHistory
 
class plSaveDocumentTask
 
class plAfterSaveDocumentTask
 

Document Management Functions

using AfterSaveCallback = plDelegate<void(plDocument*, plStatus)>
 
plStringView GetDocumentPath () const
 Returns the absolute path to the document.
 
plStatus 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.
 
plTaskGroupID SaveDocumentAsync (AfterSaveCallback callback, bool bForce=false)
 
void DocumentRenamed (plStringView sNewDocumentPath)
 
plStatus LoadDocument ()
 
void EnsureVisible ()
 Brings the corresponding window to the front.
 
plDocumentManagerGetDocumentManager () const
 
bool HasWindowBeenRequested () const
 
const plDocumentTypeDescriptorGetDocumentTypeDescriptor () const
 
plStringView GetDocumentTypeName () const
 Returns the document's type name. Same as GetDocumentTypeDescriptor()->m_sDocumentTypeName.
 
const plDocumentInfoGetDocumentInfo () const
 
virtual bool CanEngineProcessBeRestarted () const
 Asks the document whether a restart of the engine process is allowed at this time.
 
static plStatus ReadDocument (plStringView sDocumentPath, plUniquePtr< plAbstractObjectGraph > &ref_pHeader, plUniquePtr< plAbstractObjectGraph > &ref_pObjects, plUniquePtr< plAbstractObjectGraph > &ref_pTypes)
 
static plStatus ReadAndRegisterTypes (const plAbstractObjectGraph &types)
 

Main / Sub-Document Functions

plDocumentm_pHostDocument = nullptr
 
plDocumentm_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 plDocumentGetMainDocument () const
 In case this is a sub-document, returns the main document this belongs to. Otherwise 'this' is returned.
 
const plDocumentGetActiveSubDocument () 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 plDocumentObjectStructureEvent::Type::AfterReset.
 
plDocumentGetMainDocument ()
 
plDocumentGetActiveSubDocument ()
 

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 (const plDeque< const plDocumentObject * > &selection)
 Resets the given objects to their template prefab state, if they have local modifications.
 
virtual void UnlinkPrefabs (const plDeque< const plDocumentObject * > &selection)
 Removes the link between a prefab instance and its template, turning the instance into a regular object.
 
virtual plStatus CreatePrefabDocumentFromSelection (plStringView sFile, const plRTTI *pRootType, plDelegate< void(plAbstractObjectNode *)> adjustGraphNodeCB={}, plDelegate< void(plDocumentObject *)> adjustNewNodesCB={}, plDelegate< void(plAbstractObjectGraph &graph, plDynamicArray< plAbstractObjectNode * > &graphRootNodes)> finalizeGraphCB={})
 
virtual plStatus CreatePrefabDocument (plStringView sFile, plArrayPtr< const plDocumentObject * > rootObjects, const plUuid &invPrefabSeed, plUuid &out_newDocumentGuid, plDelegate< void(plAbstractObjectNode *)> adjustGraphNodeCB={}, bool bKeepOpen=false, plDelegate< void(plAbstractObjectGraph &graph, plDynamicArray< plAbstractObjectNode * > &graphRootNodes)> finalizeGraphCB={})
 
virtual plUuid ReplaceByPrefab (const plDocumentObject *pRootObject, plStringView sPrefabFile, const plUuid &prefabAsset, const plUuid &prefabSeed, bool bEnginePrefab)
 
virtual plUuid RevertPrefab (const plDocumentObject *pObject)
 
virtual void UpdatePrefabsRecursive (plDocumentObject *pObject)
 
virtual void UpdatePrefabObject (plDocumentObject *pObject, const plUuid &PrefabAsset, const plUuid &PrefabSeed, plStringView sBasePrefab)
 

Additional Inherited Members

- Static Public Member Functions inherited from plNoBase
static const plRTTIGetStaticRTTI ()
 

Member Function Documentation

◆ ArePrefabsAllowed()

virtual bool plDocument::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 plSceneDocument.

◆ CanEngineProcessBeRestarted()

virtual bool plDocument::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 plSceneDocument.

◆ ComputeObjectTransformation()

plResult plDocument::ComputeObjectTransformation ( const plDocumentObject * pObject,
plTransform & out_result ) const
virtual

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

Reimplemented in plGameObjectDocument, and plParticleEffectAssetDocument.

◆ CopySelectedObjects()

virtual bool plDocument::CopySelectedObjects ( plAbstractObjectGraph & out_objectGraph,
plStringBuilder & 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 plAnimationGraphAssetDocument, plMaterialAssetDocument, plProcGenGraphAssetDocument, plRenderPipelineAssetDocument, plSceneDocument, plStateMachineAssetDocument, and plVisualScriptClassAssetDocument.

◆ GetEditorInputContextOverride()

virtual plEditorInputContext * plDocument::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 plGameObjectDocument.

◆ GetManipulatorSearchStrategy()

virtual plManipulatorSearchStrategy plDocument::GetManipulatorSearchStrategy ( ) const
inlinevirtual

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

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

Reimplemented in plPropertyAnimAssetDocument, plSceneDocument, and plSkeletonAssetDocument.

◆ GetSupportedMimeTypesForPasting()

virtual void plDocument::GetSupportedMimeTypesForPasting ( plHybridArray< plString, 4 > & out_mimeTypes) const
inlinevirtual

◆ InternalAfterSaveDocument()

virtual void plDocument::InternalAfterSaveDocument ( )
inlineprotectedvirtual

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

Reimplemented in plAssetDocument.

◆ InternalSaveDocument()

plTaskGroupID plDocument::InternalSaveDocument ( AfterSaveCallback callback)
protectedvirtual

Reimplemented in plAssetDocument, and plScene2Document.

◆ OnInterDocumentMessage()

virtual void plDocument::OnInterDocumentMessage ( plReflectedClass * pMessage,
plDocument * pSender )
inlinevirtual

Called on all documents when BroadcastInterDocumentMessage() is called.

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

Reimplemented in plSceneDocument.

◆ RevertPrefab()

plUuid plDocument::RevertPrefab ( const plDocumentObject * pObject)
virtual

Reimplemented in plSceneDocument.

◆ UnlinkPrefabs()

void plDocument::UnlinkPrefabs ( const plDeque< const plDocumentObject * > & selection)
virtual

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

Reimplemented in plSceneDocument.

◆ UpdatePrefabs()

void plDocument::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 plSceneDocument.


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