Merge pull request #6921 from aws-lumberyard-dev/Atom/guthadam/atom_tools_document_count_function

Atom Tools: added function to get the number of active documents
This commit is contained in:
Guthrie Adams
2022-01-18 15:22:42 -06:00
committed by GitHub
3 changed files with 10 additions and 0 deletions
@@ -71,6 +71,9 @@ namespace AtomToolsFramework
//! Save all documents
virtual bool SaveAllDocuments() = 0;
//! Get number of allocated documents
virtual AZ::u32 GetDocumentCount() const = 0;
};
using AtomToolsDocumentSystemRequestBus = AZ::EBus<AtomToolsDocumentSystemRequests>;
@@ -69,6 +69,7 @@ namespace AtomToolsFramework
->Event("SaveDocumentAsCopy", &AtomToolsDocumentSystemRequestBus::Events::SaveDocumentAsCopy)
->Event("SaveDocumentAsChild", &AtomToolsDocumentSystemRequestBus::Events::SaveDocumentAsChild)
->Event("SaveAllDocuments", &AtomToolsDocumentSystemRequestBus::Events::SaveAllDocuments)
->Event("GetDocumentCount", &AtomToolsDocumentSystemRequestBus::Events::GetDocumentCount)
;
behaviorContext->EBus<AtomToolsDocumentRequestBus>("AtomToolsDocumentRequestBus")
@@ -457,6 +458,11 @@ namespace AtomToolsFramework
return result;
}
AZ::u32 AtomToolsDocumentSystemComponent::GetDocumentCount() const
{
return aznumeric_cast<AZ::u32>(m_documentMap.size());
}
AZ::Uuid AtomToolsDocumentSystemComponent::OpenDocumentImpl(AZStd::string_view sourcePath, bool checkIfAlreadyOpen)
{
AZStd::string requestedPath = sourcePath;
@@ -74,6 +74,7 @@ namespace AtomToolsFramework
bool SaveDocumentAsCopy(const AZ::Uuid& documentId, AZStd::string_view targetPath) override;
bool SaveDocumentAsChild(const AZ::Uuid& documentId, AZStd::string_view targetPath) override;
bool SaveAllDocuments() override;
AZ::u32 GetDocumentCount() const override;
////////////////////////////////////////////////////////////////////////
AZ::Uuid OpenDocumentImpl(AZStd::string_view sourcePath, bool checkIfAlreadyOpen);