Files
o3de/Code/Editor/Include/EditorCoreAPI.cpp
T
Steve Pham b4a2edec6a Final update copyright headers to reference license files at the repo root (#1693)
* Final update copyright headers to reference license files at the repo root

Signed-off-by: spham <spham@amazon.com>

* Fix copyright validator unit tests to support the stale O3DE header scenario

Signed-off-by: spham <spham@amazon.com>
2021-06-30 19:51:55 -07:00

55 lines
1.2 KiB
C++

/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "EditorDefs.h"
#include "EditorCoreAPI.h"
#include <AzCore/Module/Environment.h>
static IEditor* s_pEditor = nullptr;
void SetIEditor(IEditor* pEditor)
{
//this function is called multiple times so only check once if the static editor pointer is null
if (s_pEditor == nullptr)
{
assert(pEditor);
s_pEditor = pEditor;
}
else if (pEditor == nullptr)
{
//clearing the static editor pointer
s_pEditor = nullptr;
}
else
{
assert(pEditor == s_pEditor); //trigger a warning that multiple instances of the editor are attempting to register
}
}
IEditor* GetIEditor()
{
return s_pEditor;
}
void SetEditorCoreEnvironment(SSystemGlobalEnvironment* pEnv)
{
assert(!gEnv);
gEnv = pEnv;
}
void AttachEditorCoreAZEnvironment(AZ::EnvironmentInstance pAzEnv)
{
AZ::Environment::Attach(pAzEnv);
}
void DetachEditorCoreAZEnvironment()
{
AZ::Environment::Detach();
}