Open 3D Engine AzToolsFramework API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AzToolsFramework::EditorEntityContextRequests Class Referenceabstract

#include <EditorEntityContextBus.h>

Inherits AZ::EBusTraits.

Public Member Functions

virtual AzFramework::EntityContextId GetEditorEntityContextId ()=0
 Retrieve the Id of the editor entity context.
 
virtual AzFramework::EntityContext * GetEditorEntityContextInstance ()=0
 
virtual AZ::EntityId CreateNewEditorEntity (const char *name)=0
 
virtual AZ::EntityId CreateNewEditorEntityWithId (const char *name, const AZ::EntityId &entityId)=0
 
virtual void AddEditorEntity (AZ::Entity *entity)=0
 Registers an existing entity with the editor context.
 
virtual void AddEditorEntities (const EntityList &entities)=0
 Registers an existing set of entities with the editor context.
 
virtual void HandleEntitiesAdded (const EntityList &entities)=0
 Triggers registered callbacks for an existing set of entities with the editor context.
 
virtual void FinalizeEditorEntity (AZ::Entity *entity)=0
 Creates an editor ready entity, and sends out notification for the creation.
 
virtual bool DestroyEditorEntity (AZ::EntityId entityId)=0
 
virtual bool CloneEditorEntities (const EntityIdList &sourceEntities, EntityList &resultEntities, AZ::SliceComponent::EntityIdToEntityIdMap &sourceToCloneEntityIdMap)=0
 
virtual bool SaveToStreamForEditor (AZ::IO::GenericStream &stream, const EntityList &entitiesInLayers, AZ::SliceComponent::SliceReferenceToInstancePtrs &instancesInLayers)=0
 
virtual void GetLooseEditorEntities (EntityList &entityList)=0
 
virtual bool SaveToStreamForGame (AZ::IO::GenericStream &stream, AZ::DataStream::StreamType streamType)=0
 
virtual bool LoadFromStream (AZ::IO::GenericStream &stream)=0
 
virtual bool LoadFromStreamWithLayers (AZ::IO::GenericStream &stream, QString levelPakFile)=0
 
virtual void ResetEditorContext ()=0
 Completely resets the context (slices and entities deleted).
 
virtual void StartPlayInEditor ()=0
 
virtual void StopPlayInEditor ()=0
 When stopping, we shut down the game context and re-activate the editor context.
 
virtual bool IsEditorRunningGame ()=0
 Is used to check whether the Editor is running the game simulation or in normal edit mode.
 
virtual bool IsEditorRequestingGame ()=0
 Has the Editor been requested to move to Game Mode (but may not have fully entered it yet).
 
virtual bool IsEditorEntity (AZ::EntityId id)=0
 
virtual void AddRequiredComponents (AZ::Entity &entity)=0
 Adds the required editor components to the entity.
 
virtual const AZ::ComponentTypeList & GetRequiredComponentTypes ()=0
 Returns an array of the required editor component types added by AddRequiredComponents()
 
virtual bool MapEditorIdToRuntimeId (const AZ::EntityId &editorId, AZ::EntityId &runtimeId)=0
 
virtual bool MapRuntimeIdToEditorId (const AZ::EntityId &runtimeId, AZ::EntityId &editorId)=0
 

Static Public Attributes

static constexpr bool LocklessDispatch = true
 
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single
 

Detailed Description

Bus for making requests to the edit-time entity context component.

Member Function Documentation

◆ CloneEditorEntities()

virtual bool AzToolsFramework::EditorEntityContextRequests::CloneEditorEntities ( const EntityIdList &  sourceEntities,
EntityList &  resultEntities,
AZ::SliceComponent::EntityIdToEntityIdMap &  sourceToCloneEntityIdMap 
)
pure virtual

Clones a set of entities and optionally creates the Sandbox objects to wrap them. This function doesn't automatically add new entities to any entity context, callers are responsible for that.

Parameters
sourceEntities- the source set of entities to clone
resultEntities- the set of entities cloned from the source
sourceToCloneEntityIdMap[out]The map between source entity ids and clone entity ids
Returns
true means cloning succeeded, false otherwise

◆ CreateNewEditorEntity()

virtual AZ::EntityId AzToolsFramework::EditorEntityContextRequests::CreateNewEditorEntity ( const char *  name)
pure virtual

Creates an entity in the editor context.

Returns
the EntityId for the created Entity

◆ CreateNewEditorEntityWithId()

virtual AZ::EntityId AzToolsFramework::EditorEntityContextRequests::CreateNewEditorEntityWithId ( const char *  name,
const AZ::EntityId &  entityId 
)
pure virtual

Creates an entity in the editor context.

Parameters
nameThe name to give the newly created entity.
entityIdThe entity ID to create the new entity with.
Returns
the EntityId for the created Entity

◆ DestroyEditorEntity()

virtual bool AzToolsFramework::EditorEntityContextRequests::DestroyEditorEntity ( AZ::EntityId  entityId)
pure virtual

Destroys an entity in the editor context.

Returns
whether or not the entity was destroyed. A false return value signifies the entity did not belong to the game context.

◆ GetLooseEditorEntities()

virtual void AzToolsFramework::EditorEntityContextRequests::GetLooseEditorEntities ( EntityList &  entityList)
pure virtual

Returns entities that are not part of a slice.

Parameters
entityListThe entity list to populate with loose entities.

◆ IsEditorEntity()

virtual bool AzToolsFramework::EditorEntityContextRequests::IsEditorEntity ( AZ::EntityId  id)
pure virtual
Returns
true if the entity is owned by the editor entity context.

◆ LoadFromStream()

virtual bool AzToolsFramework::EditorEntityContextRequests::LoadFromStream ( AZ::IO::GenericStream &  stream)
pure virtual

Loads the context's slice root from the specified buffer.

Returns
true if successfully loaded. Failure is possible if the source file is corrupt or data could not be up-converted.

◆ LoadFromStreamWithLayers()

virtual bool AzToolsFramework::EditorEntityContextRequests::LoadFromStreamWithLayers ( AZ::IO::GenericStream &  stream,
QString  levelPakFile 
)
pure virtual

Loads the context's slice root from the specified buffer, and loads any layers referenced by the context.

Parameters
streamThe stream to load from.
levelPakFileThe path to the level's pak file, which is used to find the layers.
Returns
true if successfully loaded.

◆ MapEditorIdToRuntimeId()

virtual bool AzToolsFramework::EditorEntityContextRequests::MapEditorIdToRuntimeId ( const AZ::EntityId &  editorId,
AZ::EntityId &  runtimeId 
)
pure virtual

Maps an editor Id to a runtime entity Id. Relevant only during in-editor simulation.

Parameters
Idof editor entity
destinationparameter for runtime entity Id
Returns
true if editor Id was found in the editor Id map

◆ MapRuntimeIdToEditorId()

virtual bool AzToolsFramework::EditorEntityContextRequests::MapRuntimeIdToEditorId ( const AZ::EntityId &  runtimeId,
AZ::EntityId &  editorId 
)
pure virtual

Maps an runtime Id to a editor entity Id. Relevant only during in-editor simulation.

Parameters
Idof runtime entity
destinationparameter for editor entity Id
Returns
true if runtime Id was found in the Id map

◆ SaveToStreamForEditor()

virtual bool AzToolsFramework::EditorEntityContextRequests::SaveToStreamForEditor ( AZ::IO::GenericStream &  stream,
const EntityList &  entitiesInLayers,
AZ::SliceComponent::SliceReferenceToInstancePtrs &  instancesInLayers 
)
pure virtual

Saves the context's slice root to the specified buffer. Entities are saved as-is (with editor components).

Parameters
streamThe stream to save the editor entity context to.
entitiesInLayersA list of entities that were saved into layers. These won't be saved to the editor entity context stream.
Returns
true if successfully saved. Failure is only possible if serialization data is corrupt.

◆ SaveToStreamForGame()

virtual bool AzToolsFramework::EditorEntityContextRequests::SaveToStreamForGame ( AZ::IO::GenericStream &  stream,
AZ::DataStream::StreamType  streamType 
)
pure virtual

Saves the context's slice root to the specified buffer. Entities undergo conversion for game: editor -> game components.

Returns
true if successfully saved. Failure is only possible if serialization data is corrupt.

◆ StartPlayInEditor()

virtual void AzToolsFramework::EditorEntityContextRequests::StartPlayInEditor ( )
pure virtual

Play-in-editor transitions. When starting, we deactivate the editor context and startup the game context.


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