Loading actor in editor using asset system.

Signed-off-by: rhhong <rhhong@amazon.com>
monroegm-disable-blank-issue-2
rhhong 4 years ago
parent 5f52664026
commit 42e748760d

@ -22,6 +22,7 @@
#include "CommandManager.h"
#include <EMotionFX/Source/EMotionFXManager.h>
#include <AzFramework/API/ApplicationAPI.h>
#include <Source/Integration/Assets/ActorAsset.h>
namespace CommandSystem
@ -729,7 +730,8 @@ namespace CommandSystem
m_oldWorkspaceDirtyFlag = GetCommandManager()->GetWorkspaceDirtyFlag();
// get rid of the actor
EMotionFX::GetActorManager().UnregisterActor(EMotionFX::GetActorManager().FindSharedActorByID(actor->GetID()));
const AZ::Data::AssetId actorAssetId = EMotionFX::GetActorManager().FindAssetIdByActorId(actor->GetID());
EMotionFX::GetActorManager().UnregisterActor(actorAssetId);
// mark the workspace as dirty
GetCommandManager()->SetWorkspaceDirtyFlag(true);
@ -818,7 +820,6 @@ namespace CommandSystem
{
continue;
}
// ignore visualization actor instances
if (actorInstance->GetIsUsedForVisualization())
{
@ -849,12 +850,6 @@ namespace CommandSystem
// get the current actor
EMotionFX::Actor* actor = EMotionFX::GetActorManager().GetActor(i);
// ignore runtime-owned actors
if (actor->GetIsOwnedByRuntime())
{
continue;
}
// ignore visualization actors
if (actor->GetIsUsedForVisualization())
{

@ -17,6 +17,7 @@
#include <EMotionFX/Exporters/ExporterLib/Exporter/Exporter.h>
#include "CommandManager.h"
#include <AzFramework/API/ApplicationAPI.h>
#include <Source/Integration/Assets/ActorAsset.h>
namespace CommandSystem
@ -65,35 +66,24 @@ namespace CommandSystem
filename = EMotionFX::EMotionFXManager::ResolvePath(filename.c_str());
}
AZ::Data::AssetId actorAssetId;
EBUS_EVENT_RESULT(
actorAssetId, AZ::Data::AssetCatalogRequestBus, GetAssetIdByPath, filename.c_str(), AZ::Data::s_invalidAssetType, false);
// check if we have already loaded the actor
EMotionFX::Actor* actorFromManager = EMotionFX::GetActorManager().FindActorByFileName(filename.c_str());
if (actorFromManager)
const size_t actorIndex = EMotionFX::GetActorManager().FindActorIndex(actorAssetId);
if (actorIndex != InvalidIndex)
{
AZStd::to_string(outResult, actorFromManager->GetID());
return true;
}
// init the settings
EMotionFX::Importer::ActorSettings settings;
// extract default values from the command syntax automatically, if they aren't specified explicitly
settings.m_loadLimits = parameters.GetValueAsBool("loadLimits", this);
settings.m_loadMorphTargets = parameters.GetValueAsBool("loadMorphTargets", this);
settings.m_loadSkeletalLoDs = parameters.GetValueAsBool("loadSkeletalLODs", this);
settings.m_dualQuatSkinning = parameters.GetValueAsBool("dualQuatSkinning", this);
// try to load the actor
AZStd::shared_ptr<EMotionFX::Actor> actor {EMotionFX::GetImporter().LoadActor(filename.c_str(), &settings)};
if (!actor)
{
outResult = AZStd::string::format("Failed to load actor from '%s'. File may not exist at this path or may have incorrect permissions", filename.c_str());
return false;
}
// Because the actor is directly loaded from disk (without going through an actor asset), we need to ask for a blocking
// load for the asset that actor is depend on.
actor->Finalize(EMotionFX::Actor::LoadRequirement::RequireBlockingLoad);
// Do a blocking load of the asset.
AZ::Data::Asset<EMotionFX::Integration::ActorAsset> actorAsset =
AZ::Data::AssetManager::Instance().GetAsset<EMotionFX::Integration::ActorAsset>(
actorAssetId, AZ::Data::AssetLoadBehavior::Default);
actorAsset.BlockUntilLoadComplete();
EMotionFX::Actor* actor = actorAsset->GetActor();
// set the actor id in case we have specified it as parameter
if (actorID != MCORE_INVALIDINDEX32)
{
@ -113,7 +103,6 @@ namespace CommandSystem
GetCommandManager()->ExecuteCommandInsideCommand(AZStd::string::format("Select -actorID %i", actor->GetID()).c_str(), outResult);
}
// mark the workspace as dirty
m_oldWorkspaceDirtyFlag = GetCommandManager()->GetWorkspaceDirtyFlag();
GetCommandManager()->SetWorkspaceDirtyFlag(true);
@ -121,7 +110,8 @@ namespace CommandSystem
// return the id of the newly created actor
AZStd::to_string(outResult, actor->GetID());
EMotionFX::GetActorManager().RegisterActor(AZStd::move(actor));
// Register actor asset.
EMotionFX::GetActorManager().RegisterActor(actorAsset);
return true;
}
@ -145,14 +135,14 @@ namespace CommandSystem
}
// find the actor based on the given id
AZStd::shared_ptr<EMotionFX::Actor> actor = EMotionFX::GetActorManager().FindSharedActorByID(actorID);
if (actor == nullptr)
AZ::Data::AssetId actorAssetId = EMotionFX::GetActorManager().FindAssetIdByActorId(actorID);
if (!actorAssetId.IsValid())
{
outResult = AZStd::string::format("Cannot remove actor. Actor ID %i is not valid.", actorID);
return false;
}
EMotionFX::GetActorManager().UnregisterActor(actor);
EMotionFX::GetActorManager().UnregisterActor(actorAssetId);
// update our render actors
AZStd::string updateRenderActorsResult;

@ -183,11 +183,6 @@ namespace CommandSystem
for (size_t i = 0; i < numActors; ++i)
{
EMotionFX::Actor* actor = EMotionFX::GetActorManager().GetActor(i);
if (actor->GetIsOwnedByRuntime())
{
continue;
}
if (unselect == false)
{
@ -211,11 +206,6 @@ namespace CommandSystem
return false;
}
if (actor->GetIsOwnedByRuntime())
{
return false;
}
if (unselect == false)
{
selection.AddActor(actor);
@ -244,11 +234,6 @@ namespace CommandSystem
{
EMotionFX::Actor* actor = EMotionFX::GetActorManager().GetActor(i);
if (actor->GetIsOwnedByRuntime())
{
continue;
}
if (AzFramework::StringFunc::Equal(valueString.c_str(), actor->GetName(), false /* no case */))
{
if (unselect == false)

@ -8,7 +8,6 @@
#include <AzCore/std/smart_ptr/shared_ptr.h>
#include <EMotionFX/Source/Actor.h>
#include <EMotionFX/Source/AutoRegisteredActor.h>
#include <EMotionFX/Source/Importer/Importer.h>
#include <EMotionFX/CommandSystem/Source/MetaData.h>
#include <EMotionFX/Exporters/ExporterLib/Exporter/Exporter.h>

@ -8,7 +8,6 @@
#pragma once
#include <AzCore/std/optional.h>
#include <EMotionFX/Source/AutoRegisteredActor.h>
#include <SceneAPI/SceneCore/Components/ExportingComponent.h>
#include <SceneAPI/SceneCore/Events/ExportProductList.h>
#include <Integration/System/SystemCommon.h>
@ -44,7 +43,7 @@ namespace EMotionFX
static AZStd::optional<AZ::SceneAPI::Events::ExportProduct> GetFirstProductByType(
const ActorGroupExportContext& context, AZ::Data::AssetType type);
AutoRegisteredActor m_actor;
AZStd::shared_ptr<Actor> m_actor;
AZStd::vector<AZStd::string> m_actorMaterialReferences;
};
} // namespace Pipeline

@ -91,9 +91,6 @@ namespace EMotionFX
m_simulatedObjectSetup = AZStd::make_shared<SimulatedObjectSetup>(this);
m_optimizeSkeleton = false;
#if defined(EMFX_DEVELOPMENT_BUILD)
m_isOwnedByRuntime = false;
#endif // EMFX_DEVELOPMENT_BUILD
// make sure we have at least allocated the first LOD of materials and facial setups
m_materials.reserve(4); // reserve space for 4 lods
@ -2074,25 +2071,6 @@ namespace EMotionFX
return m_usedForVisualization;
}
void Actor::SetIsOwnedByRuntime(bool isOwnedByRuntime)
{
#if defined(EMFX_DEVELOPMENT_BUILD)
m_isOwnedByRuntime = isOwnedByRuntime;
#else
AZ_UNUSED(isOwnedByRuntime);
#endif
}
bool Actor::GetIsOwnedByRuntime() const
{
#if defined(EMFX_DEVELOPMENT_BUILD)
return m_isOwnedByRuntime;
#else
return true;
#endif
}
const AZ::Aabb& Actor::GetStaticAabb() const
{
return m_staticAabb;

@ -720,12 +720,6 @@ namespace EMotionFX
void SetIsUsedForVisualization(bool flag);
bool GetIsUsedForVisualization() const;
/**
* Marks the actor as used by the engine runtime, as opposed to the tool suite.
*/
void SetIsOwnedByRuntime(bool isOwnedByRuntime);
bool GetIsOwnedByRuntime() const;
/**
* Recursively find the parent bone that is enabled in a given LOD, starting from a given node.
* For example if you have a finger bone, while the finger bones are disabled in the skeletal LOD, this function will return the index to the hand bone.
@ -940,8 +934,5 @@ namespace EMotionFX
bool m_usedForVisualization; /**< Indicates if the actor is used for visualization specific things and is not used as a normal in-game actor. */
bool m_optimizeSkeleton; /**< Indicates if we should perform/ */
bool m_isReady = false; /**< If actor as well as its dependent files are fully loaded and initialized.*/
#if defined(EMFX_DEVELOPMENT_BUILD)
bool m_isOwnedByRuntime; /**< Set if the actor is used/owned by the engine runtime. */
#endif // EMFX_DEVELOPMENT_BUILD
};
} // namespace EMotionFX

@ -31,7 +31,7 @@ namespace EMotionFX
SetScheduler(MultiThreadScheduler::Create());
// reserve memory
m_actors.reserve(512);
m_actorAssets.reserve(32);
m_actorInstances.reserve(1024);
m_rootActorInstances.reserve(1024);
}
@ -111,20 +111,23 @@ namespace EMotionFX
// register the actor
void ActorManager::RegisterActor(AZStd::shared_ptr<Actor> actor)
void ActorManager::RegisterActor(ActorAssetData actorAsset)
{
LockActors();
// check if we already registered
if (FindActorIndex(actor.get()) != InvalidIndex)
if (FindActorIndex(actorAsset.GetId()) != InvalidIndex)
{
MCore::LogWarning("EMotionFX::ActorManager::RegisterActor() - The actor at location 0x%x has already been registered as actor, most likely already by the LoadActor of the importer.", actor.get());
MCore::LogWarning(
"EMotionFX::ActorManager::RegisterActor() - The actor at location 0x%x has already been registered as actor, most likely "
"already by the LoadActor of the importer.",
actorAsset.GetAs<Integration::ActorAsset>()->GetActor());
UnlockActors();
return;
}
// register it
m_actors.emplace_back(AZStd::move(actor));
m_actorAssets.emplace_back(AZStd::move(actorAsset));
UnlockActors();
}
@ -146,60 +149,82 @@ namespace EMotionFX
Actor* ActorManager::FindActorByName(const char* actorName) const
{
// get the number of actors and iterate through them
const auto found = AZStd::find_if(m_actors.begin(), m_actors.end(), [actorName](const AZStd::shared_ptr<Actor>& a)
const auto found = AZStd::find_if(
m_actorAssets.begin(), m_actorAssets.end(),
[actorName](const ActorAssetData& a)
{
return a->GetNameString() == actorName;
return a.GetAs<Integration::ActorAsset>()->GetActor()->GetNameString() == actorName;
});
return (found != m_actors.end()) ? found->get() : nullptr;
return (found != m_actorAssets.end()) ? found->GetAs<Integration::ActorAsset>()->GetActor() : nullptr;
}
// find the actor for a given filename
Actor* ActorManager::FindActorByFileName(const char* fileName) const
{
const auto found = AZStd::find_if(m_actors.begin(), m_actors.end(), [fileName](const AZStd::shared_ptr<Actor>& a)
const auto found = AZStd::find_if(
m_actorAssets.begin(), m_actorAssets.end(),
[fileName](const ActorAssetData& a)
{
return AzFramework::StringFunc::Equal(a->GetFileNameString().c_str(), fileName, false /* no case */);
return AzFramework::StringFunc::Equal(
a.GetAs<Integration::ActorAsset>()->GetActor()->GetFileNameString().c_str(), fileName, false /* no case */);
});
return (found != m_actors.end()) ? found->get() : nullptr;
return (found != m_actorAssets.end()) ? found->GetAs<Integration::ActorAsset>()->GetActor() : nullptr;
}
// find the leader actor record for a given actor
size_t ActorManager::FindActorIndex(Actor* actor) const
size_t ActorManager::FindActorIndex(AZ::Data::AssetId assetId) const
{
const auto found = AZStd::find_if(m_actors.begin(), m_actors.end(), [actor](const AZStd::shared_ptr<Actor>& a)
const auto found = AZStd::find_if(
m_actorAssets.begin(), m_actorAssets.end(),
[assetId](const ActorAssetData& a)
{
return a.get() == actor;
return a.GetId() == assetId;
});
return (found != m_actors.end()) ? AZStd::distance(m_actors.begin(), found) : InvalidIndex;
return (found != m_actorAssets.end()) ? AZStd::distance(m_actorAssets.begin(), found) : InvalidIndex;
}
size_t ActorManager::FindActorIndex(const Actor* actor) const
{
const auto found = AZStd::find_if(
m_actorAssets.begin(), m_actorAssets.end(),
[actor](const ActorAssetData& a)
{
return a.GetAs<Integration::ActorAsset>()->GetActor() == actor;
});
return (found != m_actorAssets.end()) ? AZStd::distance(m_actorAssets.begin(), found) : InvalidIndex;
}
// find the actor for a given actor name
size_t ActorManager::FindActorIndexByName(const char* actorName) const
{
const auto found = AZStd::find_if(m_actors.begin(), m_actors.end(), [actorName](const AZStd::shared_ptr<Actor>& a)
const auto found = AZStd::find_if(
m_actorAssets.begin(), m_actorAssets.end(),
[actorName](const ActorAssetData& a)
{
return a->GetNameString() == actorName;
return a.GetAs<Integration::ActorAsset>()->GetActor()->GetNameString() == actorName;
});
return (found != m_actors.end()) ? AZStd::distance(m_actors.begin(), found) : InvalidIndex;
return (found != m_actorAssets.end()) ? AZStd::distance(m_actorAssets.begin(), found) : InvalidIndex;
}
// find the actor for a given actor filename
size_t ActorManager::FindActorIndexByFileName(const char* filename) const
{
const auto found = AZStd::find_if(m_actors.begin(), m_actors.end(), [filename](const AZStd::shared_ptr<Actor>& a)
const auto found = AZStd::find_if(
m_actorAssets.begin(), m_actorAssets.end(),
[filename](const ActorAssetData& a)
{
return a->GetFileNameString() == filename;
return a.GetAs<Integration::ActorAsset>()->GetActor()->GetFileNameString() == filename;
});
return (found != m_actors.end()) ? AZStd::distance(m_actors.begin(), found) : InvalidIndex;
return (found != m_actorAssets.end()) ? AZStd::distance(m_actorAssets.begin(), found) : InvalidIndex;
}
@ -237,22 +262,26 @@ namespace EMotionFX
// find the actor by the identification number
Actor* ActorManager::FindActorByID(uint32 id) const
{
const auto found = AZStd::find_if(m_actors.begin(), m_actors.end(), [id](const AZStd::shared_ptr<Actor>& a)
const auto found = AZStd::find_if(
m_actorAssets.begin(), m_actorAssets.end(),
[id](const ActorAssetData& a)
{
return a->GetID() == id;
return a.GetAs<Integration::ActorAsset>()->GetActor()->GetID() == id;
});
return (found != m_actors.end()) ? found->get() : nullptr;
return (found != m_actorAssets.end()) ? found->GetAs<Integration::ActorAsset>()->GetActor() : nullptr;
}
AZStd::shared_ptr<Actor> ActorManager::FindSharedActorByID(uint32 id) const
AZ::Data::AssetId ActorManager::FindAssetIdByActorId(uint32 id) const
{
const auto found = AZStd::find_if(m_actors.begin(), m_actors.end(), [id](const AZStd::shared_ptr<Actor>& a)
const auto found = AZStd::find_if(
m_actorAssets.begin(), m_actorAssets.end(),
[id](const ActorAssetData& a)
{
return a->GetID() == id;
return a.GetAs<Integration::ActorAsset>()->GetActor()->GetID() == id;
});
return (found != m_actors.end()) ? *found : nullptr;
return (found != m_actorAssets.end()) ? found->GetId() : AZ::Data::AssetId();
}
@ -264,14 +293,20 @@ namespace EMotionFX
// unregister an actor
void ActorManager::UnregisterActor(const AZStd::shared_ptr<Actor>& actor)
void ActorManager::UnregisterActor(AZ::Data::AssetId actorAssetID)
{
LockActors();
auto result = AZStd::find(m_actors.begin(), m_actors.end(), actor);
if (result != m_actors.end())
const auto found = AZStd::find_if(
m_actorAssets.begin(), m_actorAssets.end(),
[actorAssetID](const ActorAssetData& a)
{
return a.GetId() == actorAssetID;
});
if (found != m_actorAssets.end())
{
m_actors.erase(result);
m_actorAssets.erase(found);
}
UnlockActors();
}
@ -297,7 +332,7 @@ namespace EMotionFX
LockActors();
// clear all actors
m_actors.clear();
m_actorAssets.clear();
// TODO: what if there are still references to the actors inside the list of registered actor instances?
UnlockActors();
@ -390,7 +425,7 @@ namespace EMotionFX
Actor* ActorManager::GetActor(size_t nr) const
{
return m_actors[nr].get();
return m_actorAssets[nr].GetAs<Integration::ActorAsset>()->GetActor();
}

@ -16,7 +16,8 @@
#include <MCore/Source/MultiThreadManager.h>
#include <AzCore/std/containers/vector.h>
#include <AzCore/std/smart_ptr/weak_ptr.h>
#include <Source/Integration/Assets/ActorAsset.h>
#include <Source/Integration/System/SystemCommon.h>
namespace EMotionFX
{
@ -41,13 +42,14 @@ namespace EMotionFX
friend class EMotionFXManager;
public:
using ActorAssetData = AZ::Data::Asset<Integration::ActorAsset>;
static ActorManager* Create();
/**
* Register an actor.
* @param actor The actor to register.
*/
void RegisterActor(AZStd::shared_ptr<Actor> actor);
void RegisterActor(ActorAssetData actorAsset);
/**
* Unregister all actors.
@ -60,14 +62,14 @@ namespace EMotionFX
* Unregister a specific actor.
* @param actor The actor you passed to the RegisterActor function sometime before.
*/
void UnregisterActor(const AZStd::shared_ptr<Actor>& actor);
void UnregisterActor(AZ::Data::AssetId actorAssetID);
/**
* Get the number of registered actors.
* This does not include the clones that have been optionally created.
* @result The number of registered actors.
*/
MCORE_INLINE size_t GetNumActors() const { return m_actors.size(); }
MCORE_INLINE size_t GetNumActors() const { return m_actorAssets.size(); }
/**
* Get a given actor.
@ -99,7 +101,8 @@ namespace EMotionFX
* @param actor The actor object you once passed to RegisterActor.
* @result Returns the actor number, which is in range of [0..GetNumActors()-1], or returns MCORE_INVALIDINDEX32 when not found.
*/
size_t FindActorIndex(Actor* actor) const;
size_t FindActorIndex(AZ::Data::AssetId assetId) const;
size_t FindActorIndex(const Actor* actor) const;
/**
* Find the actor number for a given actor name.
@ -160,7 +163,7 @@ namespace EMotionFX
*/
Actor* FindActorByID(uint32 id) const;
AZStd::shared_ptr<Actor> FindSharedActorByID(uint32 id) const;
AZ::Data::AssetId FindAssetIdByActorId(uint32 id) const;
/**
* Check if the given actor instance is registered.
@ -255,9 +258,9 @@ namespace EMotionFX
void UnlockActors();
private:
AZStd::vector<ActorInstance*> m_actorInstances; /**< The registered actor instances. */
AZStd::vector<AZStd::shared_ptr<Actor>> m_actors; /**< The registered actors. */
AZStd::vector<ActorInstance*> m_rootActorInstances; /**< Root actor instances (roots of all attachment chains). */
AZStd::vector<ActorInstance*> m_actorInstances; /**< The registered actor instances. */
AZStd::vector<ActorAssetData> m_actorAssets;
AZStd::vector<ActorInstance*> m_rootActorInstances; /**< Root actor instances (roots of all attachment chains). */
ActorUpdateScheduler* m_scheduler; /**< The update scheduler to use. */
MCore::MutexRecursive m_actorLock; /**< The multithread lock for touching the actors array. */
MCore::MutexRecursive m_actorInstanceLock; /**< The multithread lock for touching the actor instances array. */

@ -1,109 +0,0 @@
/*
* 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
*
*/
#pragma once
#include <AzCore/std/smart_ptr/shared_ptr.h>
#include <EMotionFX/Source/EMotionFXManager.h>
#include <EMotionFX/Source/ActorManager.h>
namespace EMotionFX
{
class Actor;
/**
* @brief An Actor pointer that unregisters itself when it goes out of
* scope
*
* This class allows for simple functionality of automatically registering
* and unregistering an actor from the manager. Its primary use case is the
* ActorAsset, that shares ownership with the manager. But it can also be
* used anywhere that needs to make an Actor that needs to be in the
* Manager for a given period of time. A good example of this is anything
* that needs Actor commands to work on an actor that is made in a given
* scope. One main place where this happens is in the Actor asset processor
* code.
*/
class AutoRegisteredActor
{
public:
AutoRegisteredActor() = default;
template<class T>
AutoRegisteredActor(AZStd::shared_ptr<T> actor)
: m_actor(AZStd::move(actor))
{
Register(m_actor);
}
template<class T>
AutoRegisteredActor(AZStd::unique_ptr<T> actor)
: m_actor(AZStd::move(actor))
{
Register(m_actor);
}
// This class is not copyable, because a given actor cannot be
// registered with the manager multiple times
AutoRegisteredActor(const AutoRegisteredActor&) = delete;
AutoRegisteredActor& operator=(const AutoRegisteredActor&) = delete;
AutoRegisteredActor(AutoRegisteredActor&& other) noexcept
{
*this = AZStd::move(other);
}
AutoRegisteredActor& operator=(AutoRegisteredActor&& other) noexcept
{
if (this != &other)
{
Unregister(m_actor);
m_actor = AZStd::move(other.m_actor);
}
return *this;
}
~AutoRegisteredActor()
{
Unregister(m_actor);
}
Actor* operator->() const
{
return m_actor.operator->();
}
operator bool() const
{
return static_cast<bool>(m_actor);
}
Actor* get() const
{
return m_actor.get();
}
private:
void Register(const AZStd::shared_ptr<Actor>& actor)
{
if (actor)
{
GetActorManager().RegisterActor(actor);
}
}
void Unregister(const AZStd::shared_ptr<Actor>& actor)
{
if (actor)
{
GetActorManager().UnregisterActor(actor);
}
}
AZStd::shared_ptr<Actor> m_actor;
};
} // namespace EMotionFX

@ -112,10 +112,6 @@ namespace EMStudio
for (size_t i = 0; i < actorCount; ++i)
{
EMotionFX::Actor* actor = EMotionFX::GetActorManager().GetActor(i);
if (actor->GetIsOwnedByRuntime())
{
continue;
}
if (AzFramework::StringFunc::Equal(filename, actor->GetFileName()))
{

@ -1792,11 +1792,6 @@ namespace EMStudio
{
EMotionFX::Actor* actor = selectionList.GetActorInstance(i)->GetActor();
if (actor->GetIsOwnedByRuntime())
{
continue;
}
if (AZStd::find(savingActors.begin(), savingActors.end(), actor) == savingActors.end())
{
savingActors.push_back(actor);

@ -389,7 +389,7 @@ namespace EMStudio
// get the current actor and the number of clones
EMotionFX::Actor* actor = EMotionFX::GetActorManager().GetActor(i);
if (actor->GetIsOwnedByRuntime() || !actor->IsReady())
if (!actor->IsReady())
{
continue;
}
@ -421,7 +421,7 @@ namespace EMStudio
// At this point the render actor could point to an already deleted actor.
// In case the actor got deleted we might get an unexpected flag as result.
if (!found || (found && actor->GetIsOwnedByRuntime()) || (!actor->IsReady()))
if (!found || (!actor->IsReady()))
{
DestroyEMStudioActor(actor);
}

@ -65,8 +65,7 @@ namespace EMStudio
m_actorCheckbox = new QCheckBox("Actors");
m_actorCheckbox->setObjectName("EMFX.ResetSettingsDialog.Actors");
const bool hasActors = HasEntityInEditor(
EMotionFX::GetActorManager(), &EMotionFX::ActorManager::GetNumActors, &EMotionFX::ActorManager::GetActor);
const bool hasActors = EMotionFX::GetActorManager().GetNumActors() > 0;
m_actorCheckbox->setChecked(hasActors);
m_actorCheckbox->setDisabled(!hasActors);

@ -123,12 +123,6 @@ namespace EMStudio
continue;
}
// ignore engine actors
if (actor->GetIsOwnedByRuntime())
{
continue;
}
// create a tree item for the new attachment
QTreeWidgetItem* newItem = new QTreeWidgetItem(m_treeWidget);

@ -25,7 +25,6 @@ set(FILES
Source/AttachmentNode.h
Source/AttachmentSkin.cpp
Source/AttachmentSkin.h
Source/AutoRegisteredActor.h
Source/BaseObject.cpp
Source/BaseObject.h
Source/CompressedKeyFrames.h

@ -6,7 +6,6 @@
*
*/
#include <EMotionFX/Source/ActorManager.h>
#include <EMotionFX/Source/ActorInstance.h>
#include <EMotionFX/Source/EMotionFXManager.h>
#include <EMotionFX/Source/Importer/Importer.h>
@ -64,8 +63,6 @@ namespace EMotionFX
&actorSettings,
"");
// Set the is owned by runtime flag before finalizing the actor, as that uses the flag already.
assetData->m_emfxActor->SetIsOwnedByRuntime(true);
assetData->m_emfxActor->Finalize();
// Clear out the EMFX raw asset data.

@ -15,7 +15,7 @@
#include <Integration/Assets/AssetCommon.h>
#include <Integration/Rendering/RenderActor.h>
#include <EMotionFX/Source/AutoRegisteredActor.h>
//#include <EMotionFX/Source/AutoRegisteredActor.h>
namespace EMotionFX
@ -58,7 +58,7 @@ namespace EMotionFX
void InitRenderActor();
private:
AutoRegisteredActor m_emfxActor; ///< Pointer to shared EMotionFX actor
AZStd::shared_ptr<Actor> m_emfxActor;
AZStd::unique_ptr<RenderActor> m_renderActor;
};

Loading…
Cancel
Save