Open 3D Engine Atom Gem API Reference 24.09.2
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AtomToolsFramework::AtomToolsDocument Class Reference

#include <AtomToolsDocument.h>

Inherits AtomToolsDocumentRequestBus::Handler, and AzToolsFramework::AssetSystemBus::Handler.

Inherited by AtomToolsFramework::AtomToolsAnyDocument, AtomToolsFramework::GraphDocument, MaterialEditor::MaterialDocument, and ShaderManagementConsole::ShaderManagementConsoleDocument.

Public Member Functions

 AZ_RTTI (AtomToolsDocument, "{7E6CA0C4-077C-4849-B24C-6796AF3B640B}")
 
 AZ_CLASS_ALLOCATOR (AtomToolsDocument, AZ::SystemAllocator)
 
 AZ_DISABLE_COPY_MOVE (AtomToolsDocument)
 
 AtomToolsDocument (const AZ::Crc32 &toolId, const DocumentTypeInfo &documentTypeInfo)
 
const DocumentTypeInfoGetDocumentTypeInfo () const override
 
DocumentObjectInfoVector GetObjectInfo () const override
 
const AZ::Uuid & GetId () const override
 
const AZStd::string & GetAbsolutePath () const override
 
bool Open (const AZStd::string &loadPath) override
 
bool Reopen () override
 
bool Save () override
 
bool SaveAsCopy (const AZStd::string &savePath) override
 
bool SaveAsChild (const AZStd::string &savePath) override
 
bool Close () override
 
void Clear () override
 
bool IsOpen () const override
 
bool IsModified () const override
 
bool CanSaveAsChild () const override
 
bool CanUndo () const override
 
bool CanRedo () const override
 
bool Undo () override
 
bool Redo () override
 
bool BeginEdit () override
 
bool EndEdit () override
 

Static Public Member Functions

static void Reflect (AZ::ReflectContext *context)
 

Protected Types

using UndoRedoFunction = AZStd::function<void()>
 
using UndoRedoFunctionPair = AZStd::pair<UndoRedoFunction, UndoRedoFunction>
 
using UndoRedoHistory = AZStd::vector<UndoRedoFunctionPair>
 

Protected Member Functions

virtual bool OpenSucceeded ()
 
virtual bool OpenFailed ()
 
virtual bool SaveSucceeded ()
 
virtual bool SaveFailed ()
 
virtual bool ReopenRecordState ()
 
virtual bool ReopenRestoreState ()
 
void AddUndoRedoHistory (const UndoRedoFunction &undoCommand, const UndoRedoFunction &redoCommand)
 Add new undo redo command functions at the current position in the undo history.
 
void SourceFileChanged (AZStd::string relativePath, AZStd::string scanFolder, AZ::Uuid sourceUUID) override
 

Protected Attributes

const AZ::Crc32 m_toolId = {}
 
const DocumentTypeInfo m_documentTypeInfo = {}
 
const AZ::Uuid m_id = AZ::Uuid::CreateRandom()
 The unique id of this document, used for all bus notifications and requests.
 
AZStd::string m_absolutePath
 The absolute path to the document source file.
 
AZStd::string m_savePathNormalized
 The normalized, absolute path where the document will be saved.
 
AZ::RPI::MaterialUtils::ImportedJsonFiles m_sourceDependencies
 
bool m_ignoreSourceFileChangeToSelf = false
 If this flag is true then the next source file change notification for this document will be ignored.
 
UndoRedoHistory m_undoHistory
 
UndoRedoHistory m_undoHistoryBeforeReopen
 
int m_undoHistoryIndex = {}
 
int m_undoHistoryIndexBeforeReopen = {}
 

Detailed Description

AtomToolsDocument is intended to be used as a base class for a tools' concrete document types. It implements most of the basic functionality expected by AtomToolsDocumentRequestBus, validating file paths, file types, providing support for undo, redo, and other operations. A derived class should override functions to build document type info, populate object info, load, save, track undo and redo data specific to that document type.

Member Function Documentation

◆ ReopenRecordState()

virtual bool AtomToolsFramework::AtomToolsDocument::ReopenRecordState ( )
protectedvirtual

Record state that needs to be restored after a document is reopened. This can be overridden to record additional data.

◆ ReopenRestoreState()

virtual bool AtomToolsFramework::AtomToolsDocument::ReopenRestoreState ( )
protectedvirtual

Restore state that was recorded prior to document being reloaded. This can be overridden to restore additional data.

Member Data Documentation

◆ m_sourceDependencies

AZ::RPI::MaterialUtils::ImportedJsonFiles AtomToolsFramework::AtomToolsDocument::m_sourceDependencies
protected

This contains absolute paths of other source files that affect this document. If any of the source files in this container are modified, the document system is notified to reload this document.


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