Code/Framework/AzToolsFramework/AzToolsFramework/Component/EditorLevelComponentAPIComponent.cpp
EditorComponentAPIRequests::AddComponentsOutcome EditorLevelComponentAPIComponent::AddComponentsOfType(const AZ::ComponentTypeList& componentTypeIds)
        {
            //Always get the EntityId of the Level.
            AZ::EntityId levelEntityId;
            ToolsApplicationRequestBus::BroadcastResult(levelEntityId, &ToolsApplicationRequests::GetCurrentLevelEntityId);
            if (!levelEntityId.IsValid())
            {
                return EditorComponentAPIRequests::AddComponentsOutcome(AZStd::string("Invalid Level EntityId. Most likely there's no level loaded in the Editor."));
            }

            EditorComponentAPIRequests::AddComponentsOutcome outcome;
            EditorComponentAPIBus::BroadcastResult(outcome, &EditorComponentAPIRequests::AddComponentsOfType, levelEntityId, componentTypeIds);
            return outcome;
        }
// Returns an Outcome object with the Component Id if successful, and the cause of the failure otherwise
Returns an Outcome object with the Component Id if successful, and the cause of the failure otherwise
Returns an Outcome object with the Component Id if successful and the cause of the failure otherwise
EditorComponentAPIRequests::AddComponentsOutcome EditorLevelComponentAPIComponent::AddComponentsOfType(const AZ::ComponentTypeList& componentTypeIds)
        {
            AZ::EntityId levelEntityId;
            ToolsApplicationRequestBus::BroadcastResult(levelEntityId, &ToolsApplicationRequests::GetCurrentLevelEntityId);
            if (!levelEntityId.IsValid())
            {
                return EditorComponentAPIRequests::AddComponentsOutcome(AZStd::string("Invalid Level EntityId. Most likely there's no level loaded in the Editor."));
            }
            EditorComponentAPIRequests::AddComponentsOutcome outcome;
            EditorComponentAPIBus::BroadcastResult(outcome, &EditorComponentAPIRequests::AddComponentsOfType, levelEntityId, componentTypeIds);
            return outcome;
        }
EditorComponentAPIRequests :: AddComponentsOutcome EditorLevelComponentAPIComponent :: AddComponentsOfType ( const AZ :: ComponentTypeList & componentTypeIds ) { AZ :: EntityId levelEntityId ; ToolsApplicationRequestBus :: BroadcastResult ( levelEntityId , & ToolsApplicationRequests :: GetCurrentLevelEntityId ) ; if ( ! levelEntityId . IsValid ( ) ) { return EditorComponentAPIRequests :: AddComponentsOutcome ( AZStd :: string ( " " ) ) ; } EditorComponentAPIRequests :: AddComponentsOutcome outcome ; EditorComponentAPIBus :: BroadcastResult ( outcome , & EditorComponentAPIRequests :: AddComponentsOfType , levelEntityId , componentTypeIds ) ; return outcome ; }
Returns an Outcome object with the Component Id if successful, and the cause of the failure otherwise
Returns an Outcome object with the Component Id if successful and the cause of the failure otherwise
//Always get the EntityId of the Level.