Merge branch 'development' into cmake/SPEC-7484
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> # Conflicts: # Code/Editor/ResourceSelectorHost.cpp
This commit is contained in:
@@ -17,9 +17,8 @@
|
||||
// Editor
|
||||
#include "Include/IPlugin.h"
|
||||
|
||||
|
||||
using TPfnCreatePluginInstance = IPlugin *(*)(PLUGIN_INIT_PARAM *pInitParam);
|
||||
using TPfnQueryPluginSettings = void (*)(SPluginSettings &);
|
||||
using TPfnCreatePluginInstance = IPlugin* (*)(PLUGIN_INIT_PARAM* pInitParam);
|
||||
using TPfnQueryPluginSettings = void (*)(SPluginSettings&);
|
||||
|
||||
CPluginManager::CPluginManager()
|
||||
{
|
||||
@@ -155,7 +154,7 @@ bool CPluginManager::LoadPlugins(const char* pPathWithMask)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (plugins.size() == 0)
|
||||
if (plugins.empty())
|
||||
{
|
||||
CLogFile::FormatLine("[Plugin Manager] Cannot find any plugins in plugin directory '%s'", strPath.toUtf8().data());
|
||||
return false;
|
||||
@@ -269,13 +268,13 @@ void CPluginManager::RegisterPlugin(QLibrary* dllHandle, IPlugin* pPlugin)
|
||||
|
||||
IPlugin* CPluginManager::GetPluginByGUID(const char* pGUID)
|
||||
{
|
||||
for (auto it = m_plugins.begin(); it != m_plugins.end(); ++it)
|
||||
for (const SPluginEntry& pluginEntry : m_plugins)
|
||||
{
|
||||
const char* pPluginGuid = it->pPlugin->GetPluginGUID();
|
||||
const char* pPluginGuid = pluginEntry.pPlugin->GetPluginGUID();
|
||||
|
||||
if (pPluginGuid && !strcmp(pPluginGuid, pGUID))
|
||||
{
|
||||
return it->pPlugin;
|
||||
return pluginEntry.pPlugin;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -332,14 +331,11 @@ IUIEvent* CPluginManager::GetEventByIDAndPluginID(uint8 aPluginID, uint8 aEventI
|
||||
|
||||
bool CPluginManager::CanAllPluginsExitNow()
|
||||
{
|
||||
for (auto it = m_plugins.begin(); it != m_plugins.end(); ++it)
|
||||
for (const SPluginEntry& pluginEntry : m_plugins)
|
||||
{
|
||||
if (it->pPlugin)
|
||||
if (pluginEntry.pPlugin && !pluginEntry.pPlugin->CanExitNow())
|
||||
{
|
||||
if (!it->pPlugin->CanExitNow())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <QPainter>
|
||||
#include <QPalette>
|
||||
#include <AzCore/Casting/numeric_cast.h>
|
||||
#include <AzCore/std/algorithm.h>
|
||||
|
||||
namespace DrawingPrimitives
|
||||
{
|
||||
|
||||
@@ -75,11 +75,7 @@ public:
|
||||
|
||||
void SetGlobalSelection(const char* resourceType, const char* value) override
|
||||
{
|
||||
if (!resourceType)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!value)
|
||||
if (!resourceType || !value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <AtomCore/std/containers/vector_set_base.h>
|
||||
#include <AzCore/std/containers/fixed_vector.h>
|
||||
|
||||
namespace AZStd
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Math/Crc.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/TypeInfoSimple.h>
|
||||
|
||||
#include <AzCore/std/containers/unordered_set.h>
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#define AZCORE_ENTITY_ID_H
|
||||
|
||||
#include <AzCore/base.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/TypeInfoSimple.h>
|
||||
#include <AzCore/std/string/string.h>
|
||||
|
||||
/** @file
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include <type_traits>
|
||||
#include <AzCore/base.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/TypeInfoSimple.h>
|
||||
#include <AzCore/std/limits.h>
|
||||
#include <AzCore/std/string/string_view.h>
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <AzCore/Casting/numeric_cast.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/IO/Path/Path_fwd.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/std/string/fixed_string.h>
|
||||
#include <AzCore/std/string/string.h>
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Module/Environment.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/std/parallel/shared_mutex.h>
|
||||
#include <AzCore/std/typetraits/is_constructible.h>
|
||||
#include <AzCore/std/typetraits/is_assignable.h>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/base.h>
|
||||
|
||||
#include <AzCore/std/hash.h>
|
||||
#include <AzCore/std/string/string_view.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -108,7 +108,7 @@ namespace AZ
|
||||
|
||||
namespace AZStd
|
||||
{
|
||||
template<>
|
||||
template<>
|
||||
struct hash<AZ::Crc32>
|
||||
{
|
||||
size_t operator()(const AZ::Crc32& id) const
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
#include <AzCore/Math/Vector3.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
|
||||
@@ -9,8 +9,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/base.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/TypeInfoSimple.h>
|
||||
#include <AzCore/Math/Random_Platform.h>
|
||||
#include <AzCore/Casting/numeric_cast.h>
|
||||
#include <AzCore/std/containers/array.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Math/Internal/MathTypes.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/TypeInfoSimple.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Math/Internal/MathTypes.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/TypeInfoSimple.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
|
||||
@@ -1006,12 +1006,6 @@ namespace AZ
|
||||
AZ_TYPE_INFO_INTERNAL_FUNCTION_VARIATION_SPECIALIZATION(AZStd::function, "{C9F9C644-CCC3-4F77-A792-F5B5DBCA746E}");
|
||||
} // namespace AZ
|
||||
|
||||
#define AZ_TYPE_INFO_INTERNAL_1(_ClassName) static_assert(false, "You must provide a ClassName,ClassUUID")
|
||||
#define AZ_TYPE_INFO_INTERNAL_2(_ClassName, _ClassUuid) \
|
||||
void TYPEINFO_Enable(){} \
|
||||
static const char* TYPEINFO_Name() { return #_ClassName; } \
|
||||
static const AZ::TypeId& TYPEINFO_Uuid() { static AZ::TypeId s_uuid(_ClassUuid); return s_uuid; }
|
||||
|
||||
// Template class type info
|
||||
#define AZ_TYPE_INFO_INTERNAL_TEMPLATE(_ClassName, _ClassUuid, ...)\
|
||||
void TYPEINFO_Enable() {}\
|
||||
@@ -1050,39 +1044,11 @@ namespace AZ
|
||||
#define AZ_TYPE_INFO_INTERNAL_17 AZ_TYPE_INFO_INTERNAL_TEMPLATE
|
||||
#define AZ_TYPE_INFO_INTERNAL(...) AZ_MACRO_SPECIALIZE(AZ_TYPE_INFO_INTERNAL_, AZ_VA_NUM_ARGS(__VA_ARGS__), (__VA_ARGS__))
|
||||
|
||||
#define AZ_TYPE_INFO_1 AZ_TYPE_INFO_INTERNAL_1
|
||||
#define AZ_TYPE_INFO_2 AZ_TYPE_INFO_INTERNAL_2
|
||||
#define AZ_TYPE_INFO_3 AZ_TYPE_INFO_INTERNAL_TEMPLATE_DEPRECATED
|
||||
#define AZ_TYPE_INFO_4 AZ_TYPE_INFO_INTERNAL_TEMPLATE_DEPRECATED
|
||||
#define AZ_TYPE_INFO_5 AZ_TYPE_INFO_INTERNAL_TEMPLATE_DEPRECATED
|
||||
#define AZ_TYPE_INFO_6 AZ_TYPE_INFO_INTERNAL_TEMPLATE_DEPRECATED
|
||||
#define AZ_TYPE_INFO_7 AZ_TYPE_INFO_INTERNAL_TEMPLATE_DEPRECATED
|
||||
#define AZ_TYPE_INFO_8 AZ_TYPE_INFO_INTERNAL_TEMPLATE_DEPRECATED
|
||||
#define AZ_TYPE_INFO_9 AZ_TYPE_INFO_INTERNAL_TEMPLATE_DEPRECATED
|
||||
#define AZ_TYPE_INFO_10 AZ_TYPE_INFO_INTERNAL_TEMPLATE_DEPRECATED
|
||||
#define AZ_TYPE_INFO_11 AZ_TYPE_INFO_INTERNAL_TEMPLATE_DEPRECATED
|
||||
#define AZ_TYPE_INFO_12 AZ_TYPE_INFO_INTERNAL_TEMPLATE_DEPRECATED
|
||||
#define AZ_TYPE_INFO_13 AZ_TYPE_INFO_INTERNAL_TEMPLATE_DEPRECATED
|
||||
#define AZ_TYPE_INFO_14 AZ_TYPE_INFO_INTERNAL_TEMPLATE_DEPRECATED
|
||||
#define AZ_TYPE_INFO_15 AZ_TYPE_INFO_INTERNAL_TEMPLATE_DEPRECATED
|
||||
#define AZ_TYPE_INFO_16 AZ_TYPE_INFO_INTERNAL_TEMPLATE_DEPRECATED
|
||||
#define AZ_TYPE_INFO_17 AZ_TYPE_INFO_INTERNAL_TEMPLATE_DEPRECATED
|
||||
|
||||
// Fall-back for the original version of AZ_TYPE_INFO that accepted template arguments. This should not be used, unless
|
||||
// to fix issues where AZ_TYPE_INFO was incorrectly used and the old UUID has to be maintained.
|
||||
#define AZ_TYPE_INFO_LEGACY AZ_TYPE_INFO_INTERNAL
|
||||
|
||||
/**
|
||||
* Use this macro inside a class to allow it to be identified across modules and serialized (in different contexts).
|
||||
* The expected input is the class and the assigned uuid as a string or an instance of a uuid.
|
||||
* Example:
|
||||
* class MyClass
|
||||
* {
|
||||
* public:
|
||||
* AZ_TYPE_INFO(MyClass, "{BD5B1568-D232-4EBF-93BD-69DB66E3773F}");
|
||||
* ...
|
||||
*/
|
||||
#define AZ_TYPE_INFO(...) AZ_MACRO_SPECIALIZE(AZ_TYPE_INFO_, AZ_VA_NUM_ARGS(__VA_ARGS__), (__VA_ARGS__))
|
||||
#include <AzCore/RTTI/TypeInfoSimple.h>
|
||||
|
||||
/**
|
||||
* Use this macro outside a class to allow it to be identified across modules and serialized (in different contexts).
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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/Math/Uuid.h>
|
||||
#include <AzCore/std/typetraits/is_enum.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
using TypeId = AZ::Uuid;
|
||||
}
|
||||
|
||||
#define AZ_TYPE_INFO_INTERNAL_1(_ClassName) static_assert(false, "You must provide a ClassName,ClassUUID")
|
||||
#define AZ_TYPE_INFO_INTERNAL_2(_ClassName, _ClassUuid) \
|
||||
void TYPEINFO_Enable(){} \
|
||||
static const char* TYPEINFO_Name() { return #_ClassName; } \
|
||||
static const AZ::TypeId& TYPEINFO_Uuid() { static AZ::TypeId s_uuid(_ClassUuid); return s_uuid; }
|
||||
|
||||
#define AZ_TYPE_INFO_1 AZ_TYPE_INFO_INTERNAL_1
|
||||
#define AZ_TYPE_INFO_2 AZ_TYPE_INFO_INTERNAL_2
|
||||
|
||||
/**
|
||||
* Use this macro inside a class to allow it to be identified across modules and serialized (in different contexts).
|
||||
* The expected input is the class and the assigned uuid as a string or an instance of a uuid.
|
||||
* Example:
|
||||
* class MyClass
|
||||
* {
|
||||
* public:
|
||||
* AZ_TYPE_INFO(MyClass, "{BD5B1568-D232-4EBF-93BD-69DB66E3773F}");
|
||||
* ...
|
||||
*/
|
||||
#define AZ_TYPE_INFO(...) AZ_MACRO_SPECIALIZE(AZ_TYPE_INFO_, AZ_VA_NUM_ARGS(__VA_ARGS__), (__VA_ARGS__))
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#define AZCORE_DATA_OVERLAY_H
|
||||
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/TypeInfoSimple.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include <AzCore/Serialization/Json/BaseJsonSerializer.h>
|
||||
#include <AzCore/Memory/Memory.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/RTTI.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include <AzCore/Serialization/Json/BaseJsonSerializer.h>
|
||||
#include <AzCore/Memory/Memory.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/RTTI.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include <AzCore/Serialization/Json/BaseJsonSerializer.h>
|
||||
#include <AzCore/Memory/Memory.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/RTTI.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
|
||||
@@ -434,6 +434,7 @@ set(FILES
|
||||
Preprocessor/Sequences.h
|
||||
RTTI/RTTI.h
|
||||
RTTI/TypeInfo.h
|
||||
RTTI/TypeInfoSimple.h
|
||||
RTTI/ReflectContext.h
|
||||
RTTI/ReflectContext.cpp
|
||||
RTTI/ReflectionManager.h
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include <AzCore/std/base.h>
|
||||
#include <AzCore/std/typetraits/integral_constant.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/TypeInfoSimple.h>
|
||||
|
||||
namespace AZStd
|
||||
{
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <AzCore/std/typetraits/integral_constant.h>
|
||||
#include <AzCore/std/typetraits/void_t.h>
|
||||
#include <AzCore/std/createdestroy.h>
|
||||
#include <AzCore/std/limits.h>
|
||||
|
||||
namespace AZStd
|
||||
{
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
#include <AzCore/std/base.h>
|
||||
#include <AzCore/std/ratio.h>
|
||||
#include <AzCore/std/utils.h>
|
||||
#include <AzCore/std/typetraits/common_type.h>
|
||||
#include <AzCore/std/typetraits/is_convertible.h>
|
||||
#include <AzCore/std/typetraits/is_floating_point.h>
|
||||
|
||||
@@ -5,14 +5,17 @@
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef AZSTD_DEQUE_H
|
||||
#define AZSTD_DEQUE_H 1
|
||||
|
||||
|
||||
#include <AzCore/std/allocator.h>
|
||||
#include <AzCore/std/algorithm.h>
|
||||
#include <AzCore/std/createdestroy.h>
|
||||
#include <AzCore/std/typetraits/aligned_storage.h>
|
||||
#include <AzCore/std/typetraits/alignment_of.h>
|
||||
#include <AzCore/std/typetraits/is_integral.h>
|
||||
|
||||
namespace AZStd
|
||||
{
|
||||
@@ -1242,4 +1245,3 @@ namespace AZStd
|
||||
}
|
||||
|
||||
#endif // AZSTD_DEQUE_H
|
||||
#pragma once
|
||||
|
||||
@@ -7,12 +7,14 @@
|
||||
*/
|
||||
#ifndef AZSTD_LIST_H
|
||||
#define AZSTD_LIST_H 1
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/std/allocator.h>
|
||||
#include <AzCore/std/algorithm.h>
|
||||
#include <AzCore/std/createdestroy.h>
|
||||
#include <AzCore/std/typetraits/alignment_of.h>
|
||||
#include <AzCore/std/typetraits/is_constructible.h>
|
||||
#include <AzCore/std/typetraits/is_integral.h>
|
||||
|
||||
namespace AZStd
|
||||
{
|
||||
@@ -1346,4 +1348,3 @@ namespace AZStd
|
||||
}
|
||||
|
||||
#endif // AZSTD_LIST_H
|
||||
#pragma once
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#include <AzCore/std/algorithm.h>
|
||||
#include <AzCore/std/createdestroy.h>
|
||||
#include <AzCore/std/utils.h>
|
||||
//#include <AzCore/std/containers/deque.h>
|
||||
|
||||
namespace AZStd
|
||||
{
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
#ifndef AZSTD_VECTOR_H
|
||||
#define AZSTD_VECTOR_H 1
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/std/allocator.h>
|
||||
#include <AzCore/std/algorithm.h>
|
||||
#include <AzCore/std/createdestroy.h>
|
||||
#include <AzCore/std/typetraits/alignment_of.h>
|
||||
#include <AzCore/std/typetraits/is_integral.h>
|
||||
|
||||
namespace AZStd
|
||||
{
|
||||
@@ -1395,6 +1395,3 @@ namespace AZStd
|
||||
return removedCount;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // AZSTD_VECTOR_H
|
||||
#pragma once
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <AzCore/std/typetraits/is_function.h>
|
||||
#include <AzCore/std/typetraits/is_trivially_copyable.h>
|
||||
#include <AzCore/std/typetraits/is_void.h>
|
||||
#include <AzCore/std/utils.h> // AZStd::addressof
|
||||
|
||||
namespace AZStd
|
||||
{
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <AzCore/std/typetraits/type_id.h>
|
||||
#include <AzCore/std/typetraits/alignment_of.h>
|
||||
#include <AzCore/std/typetraits/is_member_pointer.h>
|
||||
#include <AzCore/std/typetraits/is_const.h>
|
||||
#include <AzCore/std/typetraits/remove_cvref.h>
|
||||
#include <AzCore/std/createdestroy.h>
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <AzCore/std/function/function_base.h>
|
||||
#include <AzCore/std/function/invoke.h>
|
||||
#include <AzCore/std/typetraits/is_integral.h>
|
||||
#include <AzCore/std/typetraits/remove_cvref.h>
|
||||
#include <AzCore/std/allocator.h>
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Math/MathUtils.h>
|
||||
#include <AzCore/std/containers/node_handle.h>
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
#include <AzCore/std/containers/fixed_vector.h>
|
||||
|
||||
@@ -8,8 +8,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/std/base.h>
|
||||
#include <AzCore/std/utils.h>
|
||||
#include <AzCore/std/typetraits/integral_constant.h>
|
||||
#include <AzCore/std/typetraits/void_t.h>
|
||||
#include <AzCore/std/typetraits/is_convertible.h>
|
||||
|
||||
#include <AzCore/std/typetraits/is_base_of.h> // use by ConstIteratorCast
|
||||
#include <AzCore/std/typetraits/remove_cv.h>
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/std/parallel/config.h>
|
||||
#include <AzCore/std/typetraits/conditional.h>
|
||||
#include <AzCore/std/typetraits/is_integral.h>
|
||||
#include <atomic>
|
||||
|
||||
namespace AZStd
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
#ifndef AZSTD_SMART_PTR_INTRUSIVE_PTR_H
|
||||
#define AZSTD_SMART_PTR_INTRUSIVE_PTR_H
|
||||
#pragma once
|
||||
|
||||
//
|
||||
// intrusive_ptr.hpp
|
||||
@@ -19,10 +18,10 @@
|
||||
//
|
||||
// See http://www.boost.org/libs/smart_ptr/intrusive_ptr.html for documentation.
|
||||
//
|
||||
|
||||
#include <AzCore/std/smart_ptr/sp_convertible.h>
|
||||
#include <AzCore/RTTI/RTTI.h>
|
||||
#include <AzCore/std/smart_ptr/sp_convertible.h>
|
||||
#include <AzCore/std/typetraits/is_abstract.h>
|
||||
#include <AzCore/std/typetraits/typetraits.h>
|
||||
|
||||
namespace AZStd
|
||||
{
|
||||
@@ -112,7 +111,7 @@ namespace AZStd
|
||||
CountPolicy::add_ref(px);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
~intrusive_ptr()
|
||||
{
|
||||
if (px != 0)
|
||||
@@ -120,7 +119,7 @@ namespace AZStd
|
||||
CountPolicy::release(px);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class U>
|
||||
enable_if_t<is_convertible<U*, T*>::value, intrusive_ptr&> operator=(intrusive_ptr<U> const& rhs)
|
||||
{
|
||||
@@ -157,28 +156,28 @@ namespace AZStd
|
||||
this_type(rhs).swap(*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
intrusive_ptr& operator=(T* rhs)
|
||||
{
|
||||
this_type(rhs).swap(*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
void reset()
|
||||
{
|
||||
this_type().swap(*this);
|
||||
}
|
||||
|
||||
|
||||
void reset(T* rhs)
|
||||
{
|
||||
this_type(rhs).swap(*this);
|
||||
}
|
||||
|
||||
|
||||
T* get() const
|
||||
{
|
||||
return px;
|
||||
}
|
||||
|
||||
|
||||
T& operator*() const
|
||||
{
|
||||
AZ_Assert(px != 0, "You can't dereference a null pointer");
|
||||
@@ -298,6 +297,3 @@ namespace AZStd
|
||||
|
||||
// operator<< - not supported
|
||||
} // namespace AZStd
|
||||
|
||||
#endif // #ifndef AZSTD_SMART_PTR_INTRUSIVE_PTR_H
|
||||
#pragma once
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <AzCore/std/base.h>
|
||||
#include <AzCore/std/iterator.h>
|
||||
#include <AzCore/std/allocator.h>
|
||||
#include <AzCore/std/algorithm.h>
|
||||
#include <AzCore/std/typetraits/alignment_of.h>
|
||||
#include <AzCore/std/typetraits/is_integral.h>
|
||||
|
||||
|
||||
@@ -8,15 +8,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Casting/numeric_cast.h>
|
||||
#include <AzCore/std/algorithm.h>
|
||||
#include <AzCore/std/createdestroy.h>
|
||||
#include <AzCore/std/iterator.h>
|
||||
#include <AzCore/std/hash.h>
|
||||
|
||||
|
||||
namespace AZStd
|
||||
{
|
||||
namespace StringInternal
|
||||
{
|
||||
constexpr size_t min_size(size_t left, size_t right) { return (left < right) ? left : right; }
|
||||
|
||||
template<class Traits, class CharT, class SizeT>
|
||||
constexpr SizeT char_find(const CharT* s, size_t count, CharT ch, SizeT npos = static_cast<SizeT>(-1)) noexcept
|
||||
{
|
||||
@@ -83,7 +84,7 @@ namespace AZStd
|
||||
}
|
||||
|
||||
// Add one to offset so that for loop condition can check against 0 as the breakout condition
|
||||
size_t lastIndex = (AZStd::min)(offset, size - count) + 1;
|
||||
size_t lastIndex = StringInternal::min_size(offset, size - count) + 1;
|
||||
|
||||
for (; lastIndex; --lastIndex)
|
||||
{
|
||||
@@ -576,7 +577,7 @@ namespace AZStd
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
size_type rlen = AZStd::min<size_type>(count, size() - pos);
|
||||
size_type rlen = StringInternal::min_size(count, size() - pos);
|
||||
Traits::copy(dest, data() + pos, rlen);
|
||||
return rlen;
|
||||
}
|
||||
@@ -584,12 +585,12 @@ namespace AZStd
|
||||
constexpr basic_string_view substr(size_type pos = 0, size_type count = npos) const
|
||||
{
|
||||
AZ_Assert(pos <= size(), "Cannot create substring where position is larger than size");
|
||||
return pos > size() ? basic_string_view() : basic_string_view(data() + pos, AZStd::min<size_type>(count, size() - pos));
|
||||
return pos > size() ? basic_string_view() : basic_string_view(data() + pos, StringInternal::min_size(count, size() - pos));
|
||||
}
|
||||
|
||||
constexpr int compare(basic_string_view other) const
|
||||
{
|
||||
size_t cmpSize = AZStd::min<size_type>(size(), other.size());
|
||||
size_t cmpSize = StringInternal::min_size(size(), other.size());
|
||||
int cmpval = cmpSize == 0 ? 0 : Traits::compare(data(), other.data(), cmpSize);
|
||||
if (cmpval == 0)
|
||||
{
|
||||
@@ -891,6 +892,8 @@ namespace AZStd
|
||||
return hash;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
struct hash;
|
||||
template<class Element, class Traits>
|
||||
struct hash<basic_string_view<Element, Traits>>
|
||||
{
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/std/typetraits/conditional.h>
|
||||
#include <AzCore/std/typetraits/integral_constant.h> // for true_type
|
||||
|
||||
namespace AZStd
|
||||
{
|
||||
|
||||
@@ -9,11 +9,12 @@
|
||||
|
||||
#include <AzCore/std/typetraits/aligned_storage.h>
|
||||
#include <AzCore/std/typetraits/alignment_of.h>
|
||||
#include <AzCore/std/utils.h>
|
||||
#include <AzCore/std/typetraits/conditional.h>
|
||||
#include <AzCore/std/parallel/atomic.h>
|
||||
|
||||
namespace AZStd
|
||||
{
|
||||
using std::forward;
|
||||
// Extension: static_storage: Used to initialize statics in a thread-safe manner
|
||||
// These are similar to default_delete/no_delete, except they just invoke the destructor (or not)
|
||||
template <class T>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <AzCore/std/typetraits/is_lvalue_reference.h>
|
||||
#include <AzCore/std/typetraits/void_t.h>
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
namespace AZStd
|
||||
{
|
||||
|
||||
+1
@@ -11,6 +11,7 @@
|
||||
#include <AzCore/PlatformIncl.h>
|
||||
#include <AzCore/std/parallel/mutex.h>
|
||||
#include <AzCore/std/parallel/condition_variable.h>
|
||||
#include <AzCore/std/parallel/atomic.h>
|
||||
|
||||
namespace AZ::Platform
|
||||
{
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
#include <AzCore/Debug/StackTracer.h>
|
||||
#include <AzCore/Math/MathUtils.h>
|
||||
#include <AzCore/Math/Crc.h>
|
||||
|
||||
#include <AzCore/PlatformIncl.h>
|
||||
#include <AzCore/std/containers/fixed_vector.h>
|
||||
|
||||
@@ -2051,10 +2051,11 @@ namespace UnitTest
|
||||
|
||||
TEST_F(SmartPtr, IntrusivePtr_DynamicCast)
|
||||
{
|
||||
|
||||
AZStd::intrusive_ptr<RefCountedClass> basePointer = new RefCountedSubclass;
|
||||
|
||||
AZStd::intrusive_ptr<RefCountedSubclass> correctCast = dynamic_pointer_cast<RefCountedSubclass>(basePointer);
|
||||
AZStd::intrusive_ptr<RefCountedSubclassB> wrongCast = dynamic_pointer_cast<RefCountedSubclassB>(basePointer);
|
||||
AZStd::intrusive_ptr<RefCountedSubclass> correctCast = azdynamic_cast<RefCountedSubclass *>(basePointer);
|
||||
AZStd::intrusive_ptr<RefCountedSubclassB> wrongCast = azdynamic_cast<RefCountedSubclassB *>(basePointer);
|
||||
|
||||
EXPECT_TRUE(correctCast.get() == basePointer.get());
|
||||
EXPECT_TRUE(wrongCast.get() == nullptr);
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include <AzCore/EBus/Event.h>
|
||||
#include <AzCore/IO/FileIO.h>
|
||||
#include <AzCore/RTTI/RTTI.h>
|
||||
#include <AzCore/std/containers/map.h>
|
||||
#include <AzCore/std/smart_ptr/intrusive_base.h>
|
||||
#include <AzCore/std/smart_ptr/intrusive_ptr.h>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/TypeInfoSimple.h>
|
||||
#include <AzFramework/Asset/SimpleAsset.h>
|
||||
|
||||
namespace AzFramework
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/TypeInfoSimple.h>
|
||||
#include <AzCore/Memory/Memory.h>
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
#include <AzCore/std/string/string.h>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/TypeInfoSimple.h>
|
||||
#include <AzCore/Memory/Memory.h>
|
||||
#include <AzCore/std/containers/array.h>
|
||||
#include <AzCore/std/string/string.h>
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/TypeInfoSimple.h>
|
||||
#include <AzCore/Memory/Memory.h>
|
||||
#include <AzCore/std/containers/array.h>
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <AzCore/Math/Aabb.h>
|
||||
#include <AzCore/Memory/Memory.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/TypeInfoSimple.h>
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
#include <AzCore/std/string/string.h>
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include <AzCore/Asset/AssetCommon.h>
|
||||
#include <AzCore/Math/Uuid.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/TypeInfoSimple.h>
|
||||
#include <AzCore/std/hash.h>
|
||||
#include <AzCore/std/string/string.h>
|
||||
|
||||
|
||||
@@ -11,6 +11,11 @@
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <AzCore/Math/Vector3.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
class SerializeContext;
|
||||
} // namespace AZ
|
||||
|
||||
namespace AzFramework
|
||||
{
|
||||
//! Represents the camera state populated by the viewport camera.
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
#include <AzCore/base.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <AzCore/Math/Vector3.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/TypeInfoSimple.h>
|
||||
#include <AzCore/Casting/numeric_cast.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/TypeInfoSimple.h>
|
||||
#include <AzCore/RTTI/TypeSafeIntegral.h>
|
||||
#include <AzCore/std/smart_ptr/unique_ptr.h>
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/TypeInfoSimple.h>
|
||||
|
||||
#include <QRect>
|
||||
#include <QKeySequence>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <AzCore/Asset/AssetManagerBus.h>
|
||||
#include <AzCore/IO/FileIO.h>
|
||||
#include <AzCore/Outcome/Outcome.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/TypeInfoSimple.h>
|
||||
#include <AzCore/std/containers/map.h>
|
||||
#include <AzCore/std/containers/set.h>
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
|
||||
@@ -1727,6 +1727,7 @@ namespace AzToolsFramework
|
||||
|
||||
AliasPath absoluteInstancePath = commonOwningInstance.GetAbsoluteInstanceAliasPath();
|
||||
absoluteInstancePath.Append(newInstanceAlias);
|
||||
absoluteInstancePath.Append(PrefabDomUtils::ContainerEntityName);
|
||||
|
||||
AZ::EntityId newEntityId = InstanceEntityIdMapper::GenerateEntityIdForAliasPath(absoluteInstancePath);
|
||||
duplicatedEntityIds.push_back(newEntityId);
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@ namespace AzToolsFramework
|
||||
|
||||
m_leftAreaContainer = new QWidget(this);
|
||||
m_middleAreaContainer = new QWidget(this);
|
||||
const int minimumControlWidth = 192;
|
||||
const int minimumControlWidth = 142;
|
||||
m_middleAreaContainer->setMinimumWidth(minimumControlWidth);
|
||||
m_mainLayout->addWidget(m_leftAreaContainer, LabelColumnStretch, Qt::AlignLeft);
|
||||
m_mainLayout->addWidget(m_middleAreaContainer, ValueColumnStretch);
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
namespace AZ
|
||||
{
|
||||
class ReflectContext;
|
||||
class SerializeContext;
|
||||
}
|
||||
|
||||
namespace AzToolsFramework
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/TypeInfoSimple.h>
|
||||
#include <AzFramework/Asset/SimpleAsset.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <AzCore/std/containers/list.h>
|
||||
#include <AzCore/std/smart_ptr/shared_ptr.h>
|
||||
#include <QSortFilterProxyModel>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include "AssetDetailsPanel.h"
|
||||
#include <AzCore/std/smart_ptr/shared_ptr.h>
|
||||
#include <QScopedPointer>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
#include <AzCore/RTTI/RTTI.h>
|
||||
#include <AzCore/std/smart_ptr/shared_ptr.h>
|
||||
|
||||
struct aiNode;
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <SceneAPI/SceneCore/Utilities/HashHelper.h>
|
||||
#include <AzCore/std/string/string.h>
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
#include <AzCore/std/optional.h>
|
||||
#include <cinttypes>
|
||||
|
||||
namespace AZ::SceneAPI::Utilities
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/std/string/string.h>
|
||||
#include <AzCore/std/parallel/atomic.h>
|
||||
|
||||
namespace AWSMetrics
|
||||
{
|
||||
|
||||
+1
@@ -9,6 +9,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/base.h>
|
||||
#include <AzCore/RTTI/RTTI.h>
|
||||
#include <AzCore/Name/Name.h>
|
||||
#include <AzCore/Math/Uuid.h>
|
||||
#include <AzCore/std/containers/unordered_map.h>
|
||||
|
||||
@@ -159,9 +159,14 @@ namespace AZ::RPI
|
||||
|
||||
// Determine the vertex index range for the morph target.
|
||||
const uint32_t numVertices = blendShapeData->GetVertexCount();
|
||||
AZ_Assert(blendShapeData->GetVertexCount() == sourceMesh.m_meshData->GetVertexCount(),
|
||||
"Blend shape (%s) contains more/less vertices (%d) than the neutral mesh (%d).",
|
||||
blendShapeName.c_str(), numVertices, sourceMesh.m_meshData->GetVertexCount());
|
||||
if (blendShapeData->GetVertexCount() != sourceMesh.m_meshData->GetVertexCount())
|
||||
{
|
||||
AZ_Error(ModelAssetBuilderComponent::s_builderName, false,
|
||||
"Skipping blend shape (%s) as it contains more/less vertices (%d) than the neutral mesh (%d). "
|
||||
"The blend shape is most likely influencing multiple meshes, which is currently not supported.",
|
||||
blendShapeName.c_str(), numVertices, sourceMesh.m_meshData->GetVertexCount());
|
||||
return;
|
||||
}
|
||||
|
||||
// The start index is after any previously added deltas
|
||||
metaData.m_startIndex = aznumeric_cast<uint32_t>(packedCompressedMorphTargetVertexData.size());
|
||||
|
||||
@@ -24,10 +24,6 @@ namespace EMotionFX
|
||||
m_actorInstance = nullptr;
|
||||
m_actor = nullptr;
|
||||
m_skeleton = nullptr;
|
||||
m_localSpaceTransforms.SetMemoryCategory(EMFX_MEMCATEGORY_ANIMGRAPH_POSE);
|
||||
m_modelSpaceTransforms.SetMemoryCategory(EMFX_MEMCATEGORY_ANIMGRAPH_POSE);
|
||||
m_flags.SetMemoryCategory(EMFX_MEMCATEGORY_ANIMGRAPH_POSE);
|
||||
m_morphWeights.SetMemoryCategory(EMFX_MEMCATEGORY_ANIMGRAPH_POSE);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,10 +51,10 @@ namespace EMotionFX
|
||||
|
||||
// resize the buffers
|
||||
const size_t numTransforms = m_actor->GetSkeleton()->GetNumNodes();
|
||||
m_localSpaceTransforms.ResizeFast(numTransforms);
|
||||
m_modelSpaceTransforms.ResizeFast(numTransforms);
|
||||
m_flags.ResizeFast(numTransforms);
|
||||
m_morphWeights.ResizeFast(actorInstance->GetMorphSetupInstance()->GetNumMorphTargets());
|
||||
m_localSpaceTransforms.resize_no_construct(numTransforms);
|
||||
m_modelSpaceTransforms.resize_no_construct(numTransforms);
|
||||
m_flags.resize_no_construct(numTransforms);
|
||||
m_morphWeights.resize_no_construct(actorInstance->GetMorphSetupInstance()->GetNumMorphTargets());
|
||||
|
||||
for (const auto& poseDataItem : m_poseDatas)
|
||||
{
|
||||
@@ -79,11 +75,11 @@ namespace EMotionFX
|
||||
|
||||
// resize the buffers
|
||||
const size_t numTransforms = m_actor->GetSkeleton()->GetNumNodes();
|
||||
m_localSpaceTransforms.ResizeFast(numTransforms);
|
||||
m_modelSpaceTransforms.ResizeFast(numTransforms);
|
||||
m_localSpaceTransforms.resize_no_construct(numTransforms);
|
||||
m_modelSpaceTransforms.resize_no_construct(numTransforms);
|
||||
|
||||
const size_t oldSize = m_flags.GetLength();
|
||||
m_flags.ResizeFast(numTransforms);
|
||||
const size_t oldSize = m_flags.size();
|
||||
m_flags.resize_no_construct(numTransforms);
|
||||
if (oldSize < numTransforms && clearAllFlags == false)
|
||||
{
|
||||
for (size_t i = oldSize; i < numTransforms; ++i)
|
||||
@@ -93,7 +89,7 @@ namespace EMotionFX
|
||||
}
|
||||
|
||||
MorphSetup* morphSetup = m_actor->GetMorphSetup(0);
|
||||
m_morphWeights.ResizeFast((morphSetup) ? morphSetup->GetNumMorphTargets() : 0);
|
||||
m_morphWeights.resize_no_construct((morphSetup) ? morphSetup->GetNumMorphTargets() : 0);
|
||||
|
||||
for (const auto& poseDataItem : m_poseDatas)
|
||||
{
|
||||
@@ -111,11 +107,11 @@ namespace EMotionFX
|
||||
void Pose::SetNumTransforms(size_t numTransforms)
|
||||
{
|
||||
// resize the buffers
|
||||
m_localSpaceTransforms.ResizeFast(numTransforms);
|
||||
m_modelSpaceTransforms.ResizeFast(numTransforms);
|
||||
m_localSpaceTransforms.resize_no_construct(numTransforms);
|
||||
m_modelSpaceTransforms.resize_no_construct(numTransforms);
|
||||
|
||||
const size_t oldSize = m_flags.GetLength();
|
||||
m_flags.ResizeFast(numTransforms);
|
||||
const size_t oldSize = m_flags.size();
|
||||
m_flags.resize_no_construct(numTransforms);
|
||||
|
||||
for (size_t i = oldSize; i < numTransforms; ++i)
|
||||
{
|
||||
@@ -127,10 +123,18 @@ namespace EMotionFX
|
||||
|
||||
void Pose::Clear(bool clearMem)
|
||||
{
|
||||
m_localSpaceTransforms.Clear(clearMem);
|
||||
m_modelSpaceTransforms.Clear(clearMem);
|
||||
m_flags.Clear(clearMem);
|
||||
m_morphWeights.Clear(clearMem);
|
||||
const auto clear = [clearMem](auto& vector)
|
||||
{
|
||||
vector.clear();
|
||||
if (clearMem)
|
||||
{
|
||||
vector.shrink_to_fit();
|
||||
}
|
||||
};
|
||||
clear(m_localSpaceTransforms);
|
||||
clear(m_modelSpaceTransforms);
|
||||
clear(m_flags);
|
||||
clear(m_morphWeights);
|
||||
|
||||
ClearPoseDatas();
|
||||
}
|
||||
@@ -139,7 +143,7 @@ namespace EMotionFX
|
||||
// clear the pose flags
|
||||
void Pose::ClearFlags(uint8 newFlags)
|
||||
{
|
||||
MCore::MemSet((uint8*)m_flags.GetPtr(), newFlags, sizeof(uint8) * m_flags.GetLength());
|
||||
MCore::MemSet((uint8*)m_flags.data(), newFlags, sizeof(uint8) * m_flags.size());
|
||||
}
|
||||
|
||||
|
||||
@@ -398,30 +402,27 @@ namespace EMotionFX
|
||||
// invalidate all local transforms
|
||||
void Pose::InvalidateAllLocalSpaceTransforms()
|
||||
{
|
||||
const size_t numFlags = m_flags.GetLength();
|
||||
for (size_t i = 0; i < numFlags; ++i)
|
||||
for (uint8& flag : m_flags)
|
||||
{
|
||||
m_flags[i] &= ~FLAG_LOCALTRANSFORMREADY;
|
||||
flag &= ~FLAG_LOCALTRANSFORMREADY;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Pose::InvalidateAllModelSpaceTransforms()
|
||||
{
|
||||
const size_t numFlags = m_flags.GetLength();
|
||||
for (size_t i = 0; i < numFlags; ++i)
|
||||
for (uint8& flag : m_flags)
|
||||
{
|
||||
m_flags[i] &= ~FLAG_MODELTRANSFORMREADY;
|
||||
flag &= ~FLAG_MODELTRANSFORMREADY;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Pose::InvalidateAllLocalAndModelSpaceTransforms()
|
||||
{
|
||||
const size_t numFlags = m_flags.GetLength();
|
||||
for (size_t i = 0; i < numFlags; ++i)
|
||||
for (uint8& flag : m_flags)
|
||||
{
|
||||
m_flags[i] &= ~(FLAG_LOCALTRANSFORMREADY | FLAG_MODELTRANSFORMREADY);
|
||||
flag &= ~(FLAG_LOCALTRANSFORMREADY | FLAG_MODELTRANSFORMREADY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -469,8 +470,8 @@ namespace EMotionFX
|
||||
// make sure the number of transforms are equal
|
||||
MCORE_ASSERT(destPose);
|
||||
MCORE_ASSERT(outPose);
|
||||
MCORE_ASSERT(m_localSpaceTransforms.GetLength() == destPose->m_localSpaceTransforms.GetLength());
|
||||
MCORE_ASSERT(m_localSpaceTransforms.GetLength() == outPose->m_localSpaceTransforms.GetLength());
|
||||
MCORE_ASSERT(m_localSpaceTransforms.size() == destPose->m_localSpaceTransforms.size());
|
||||
MCORE_ASSERT(m_localSpaceTransforms.size() == outPose->m_localSpaceTransforms.size());
|
||||
MCORE_ASSERT(instance->GetIsMixing() == false);
|
||||
|
||||
// get some motion instance properties which we use to decide the optimized blending routine
|
||||
@@ -509,7 +510,7 @@ namespace EMotionFX
|
||||
}
|
||||
|
||||
// blend the morph weights
|
||||
const size_t numMorphs = m_morphWeights.GetLength();
|
||||
const size_t numMorphs = m_morphWeights.size();
|
||||
MCORE_ASSERT(actorInstance->GetMorphSetupInstance()->GetNumMorphTargets() == numMorphs);
|
||||
MCORE_ASSERT(numMorphs == destPose->GetNumMorphWeights());
|
||||
for (size_t i = 0; i < numMorphs; ++i)
|
||||
@@ -533,7 +534,7 @@ namespace EMotionFX
|
||||
outPose->InvalidateAllModelSpaceTransforms();
|
||||
|
||||
// blend the morph weights
|
||||
const size_t numMorphs = m_morphWeights.GetLength();
|
||||
const size_t numMorphs = m_morphWeights.size();
|
||||
MCORE_ASSERT(actorInstance->GetMorphSetupInstance()->GetNumMorphTargets() == numMorphs);
|
||||
MCORE_ASSERT(numMorphs == destPose->GetNumMorphWeights());
|
||||
for (size_t i = 0; i < numMorphs; ++i)
|
||||
@@ -550,8 +551,8 @@ namespace EMotionFX
|
||||
// make sure the number of transforms are equal
|
||||
MCORE_ASSERT(destPose);
|
||||
MCORE_ASSERT(outPose);
|
||||
MCORE_ASSERT(m_localSpaceTransforms.GetLength() == destPose->m_localSpaceTransforms.GetLength());
|
||||
MCORE_ASSERT(m_localSpaceTransforms.GetLength() == outPose->m_localSpaceTransforms.GetLength());
|
||||
MCORE_ASSERT(m_localSpaceTransforms.size() == destPose->m_localSpaceTransforms.size());
|
||||
MCORE_ASSERT(m_localSpaceTransforms.size() == outPose->m_localSpaceTransforms.size());
|
||||
MCORE_ASSERT(instance->GetIsMixing());
|
||||
|
||||
const bool additive = (instance->GetBlendMode() == BLENDMODE_ADDITIVE);
|
||||
@@ -564,7 +565,7 @@ namespace EMotionFX
|
||||
Transform result;
|
||||
|
||||
const MotionLinkData* motionLinkData = instance->GetMotion()->GetMotionData()->FindMotionLinkData(actorInstance->GetActor());
|
||||
AZ_Assert(motionLinkData->GetJointDataLinks().size() == m_localSpaceTransforms.GetLength(), "Expecting there to be the same amount of motion links as pose transforms.");
|
||||
AZ_Assert(motionLinkData->GetJointDataLinks().size() == m_localSpaceTransforms.size(), "Expecting there to be the same amount of motion links as pose transforms.");
|
||||
|
||||
// blend all transforms
|
||||
if (!additive)
|
||||
@@ -589,7 +590,7 @@ namespace EMotionFX
|
||||
outPose->InvalidateAllModelSpaceTransforms();
|
||||
|
||||
// blend the morph weights
|
||||
const size_t numMorphs = m_morphWeights.GetLength();
|
||||
const size_t numMorphs = m_morphWeights.size();
|
||||
MCORE_ASSERT(actorInstance->GetMorphSetupInstance()->GetNumMorphTargets() == numMorphs);
|
||||
MCORE_ASSERT(numMorphs == destPose->GetNumMorphWeights());
|
||||
for (size_t i = 0; i < numMorphs; ++i)
|
||||
@@ -619,7 +620,7 @@ namespace EMotionFX
|
||||
outPose->InvalidateAllModelSpaceTransforms();
|
||||
|
||||
// blend the morph weights
|
||||
const size_t numMorphs = m_morphWeights.GetLength();
|
||||
const size_t numMorphs = m_morphWeights.size();
|
||||
MCORE_ASSERT(actorInstance->GetMorphSetupInstance()->GetNumMorphTargets() == numMorphs);
|
||||
MCORE_ASSERT(numMorphs == destPose->GetNumMorphWeights());
|
||||
for (size_t i = 0; i < numMorphs; ++i)
|
||||
@@ -647,10 +648,10 @@ namespace EMotionFX
|
||||
return;
|
||||
}
|
||||
|
||||
m_modelSpaceTransforms.MemCopyContentsFrom(sourcePose->m_modelSpaceTransforms);
|
||||
m_localSpaceTransforms.MemCopyContentsFrom(sourcePose->m_localSpaceTransforms);
|
||||
m_flags.MemCopyContentsFrom(sourcePose->m_flags);
|
||||
m_morphWeights.MemCopyContentsFrom(sourcePose->m_morphWeights);
|
||||
m_modelSpaceTransforms = sourcePose->m_modelSpaceTransforms;
|
||||
m_localSpaceTransforms = sourcePose->m_localSpaceTransforms;
|
||||
m_flags = sourcePose->m_flags;
|
||||
m_morphWeights = sourcePose->m_morphWeights;
|
||||
|
||||
// Deactivate pose datas from the current pose that are not in the source that we copy from.
|
||||
// This is needed in order to prevent leftover pose datas and to avoid de-/allocations.
|
||||
@@ -727,11 +728,11 @@ namespace EMotionFX
|
||||
m_localSpaceTransforms[nodeNr].Zero();
|
||||
}
|
||||
|
||||
const size_t numMorphs = m_morphWeights.GetLength();
|
||||
const size_t numMorphs = m_morphWeights.size();
|
||||
MCORE_ASSERT(m_actorInstance->GetMorphSetupInstance()->GetNumMorphTargets() == numMorphs);
|
||||
for (size_t i = 0; i < numMorphs; ++i)
|
||||
for (float& morphWeight : m_morphWeights)
|
||||
{
|
||||
m_morphWeights[i] = 0.0f;
|
||||
morphWeight = 0.0f;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -742,11 +743,11 @@ namespace EMotionFX
|
||||
m_localSpaceTransforms[i].Zero();
|
||||
}
|
||||
|
||||
const size_t numMorphs = m_morphWeights.GetLength();
|
||||
const size_t numMorphs = m_morphWeights.size();
|
||||
MCORE_ASSERT(m_actor->GetMorphSetup(0)->GetNumMorphTargets() == numMorphs);
|
||||
for (size_t i = 0; i < numMorphs; ++i)
|
||||
for (float& morphWeight : m_morphWeights)
|
||||
{
|
||||
m_morphWeights[i] = 0.0f;
|
||||
morphWeight = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -795,7 +796,7 @@ namespace EMotionFX
|
||||
}
|
||||
|
||||
// blend the morph weights
|
||||
const size_t numMorphs = m_morphWeights.GetLength();
|
||||
const size_t numMorphs = m_morphWeights.size();
|
||||
MCORE_ASSERT(m_actorInstance->GetMorphSetupInstance()->GetNumMorphTargets() == numMorphs);
|
||||
MCORE_ASSERT(numMorphs == other->GetNumMorphWeights());
|
||||
for (size_t i = 0; i < numMorphs; ++i)
|
||||
@@ -814,7 +815,7 @@ namespace EMotionFX
|
||||
}
|
||||
|
||||
// blend the morph weights
|
||||
const size_t numMorphs = m_morphWeights.GetLength();
|
||||
const size_t numMorphs = m_morphWeights.size();
|
||||
MCORE_ASSERT(m_actor->GetMorphSetup(0)->GetNumMorphTargets() == numMorphs);
|
||||
MCORE_ASSERT(numMorphs == other->GetNumMorphWeights());
|
||||
for (size_t i = 0; i < numMorphs; ++i)
|
||||
@@ -841,7 +842,7 @@ namespace EMotionFX
|
||||
}
|
||||
|
||||
// blend the morph weights
|
||||
const size_t numMorphs = m_morphWeights.GetLength();
|
||||
const size_t numMorphs = m_morphWeights.size();
|
||||
MCORE_ASSERT(m_actorInstance->GetMorphSetupInstance()->GetNumMorphTargets() == numMorphs);
|
||||
MCORE_ASSERT(numMorphs == destPose->GetNumMorphWeights());
|
||||
for (size_t i = 0; i < numMorphs; ++i)
|
||||
@@ -865,7 +866,7 @@ namespace EMotionFX
|
||||
}
|
||||
|
||||
// blend the morph weights
|
||||
const size_t numMorphs = m_morphWeights.GetLength();
|
||||
const size_t numMorphs = m_morphWeights.size();
|
||||
MCORE_ASSERT(m_actor->GetMorphSetup(0)->GetNumMorphTargets() == numMorphs);
|
||||
MCORE_ASSERT(numMorphs == destPose->GetNumMorphWeights());
|
||||
for (size_t i = 0; i < numMorphs; ++i)
|
||||
@@ -886,7 +887,7 @@ namespace EMotionFX
|
||||
|
||||
Pose& Pose::MakeRelativeTo(const Pose& other)
|
||||
{
|
||||
AZ_Assert(m_localSpaceTransforms.GetLength() == other.m_localSpaceTransforms.GetLength(), "Poses must be of the same size");
|
||||
AZ_Assert(m_localSpaceTransforms.size() == other.m_localSpaceTransforms.size(), "Poses must be of the same size");
|
||||
if (m_actorInstance)
|
||||
{
|
||||
const size_t numNodes = m_actorInstance->GetNumEnabledNodes();
|
||||
@@ -899,7 +900,7 @@ namespace EMotionFX
|
||||
}
|
||||
else
|
||||
{
|
||||
const size_t numNodes = m_localSpaceTransforms.GetLength();
|
||||
const size_t numNodes = m_localSpaceTransforms.size();
|
||||
for (size_t i = 0; i < numNodes; ++i)
|
||||
{
|
||||
Transform& transform = const_cast<Transform&>(GetLocalSpaceTransform(i));
|
||||
@@ -907,7 +908,7 @@ namespace EMotionFX
|
||||
}
|
||||
}
|
||||
|
||||
const size_t numMorphs = m_morphWeights.GetLength();
|
||||
const size_t numMorphs = m_morphWeights.size();
|
||||
AZ_Assert(numMorphs == other.GetNumMorphWeights(), "Number of morphs in the pose doesn't match the number of morphs inside the provided input pose.");
|
||||
for (size_t i = 0; i < numMorphs; ++i)
|
||||
{
|
||||
@@ -921,7 +922,7 @@ namespace EMotionFX
|
||||
|
||||
Pose& Pose::ApplyAdditive(const Pose& additivePose, float weight)
|
||||
{
|
||||
AZ_Assert(m_localSpaceTransforms.GetLength() == additivePose.m_localSpaceTransforms.GetLength(), "Poses must be of the same size");
|
||||
AZ_Assert(m_localSpaceTransforms.size() == additivePose.m_localSpaceTransforms.size(), "Poses must be of the same size");
|
||||
if (m_actorInstance)
|
||||
{
|
||||
AZ_Assert(weight > -MCore::Math::epsilon && weight < (1 + MCore::Math::epsilon), "Expected weight to be between 0..1");
|
||||
@@ -939,7 +940,7 @@ namespace EMotionFX
|
||||
}
|
||||
else
|
||||
{
|
||||
AZ_Assert(m_localSpaceTransforms.GetLength() == additivePose.m_localSpaceTransforms.GetLength(), "Poses must be of the same size");
|
||||
AZ_Assert(m_localSpaceTransforms.size() == additivePose.m_localSpaceTransforms.size(), "Poses must be of the same size");
|
||||
if (m_actorInstance)
|
||||
{
|
||||
const size_t numNodes = m_actorInstance->GetNumEnabledNodes();
|
||||
@@ -959,7 +960,7 @@ namespace EMotionFX
|
||||
}
|
||||
else
|
||||
{
|
||||
const size_t numNodes = m_localSpaceTransforms.GetLength();
|
||||
const size_t numNodes = m_localSpaceTransforms.size();
|
||||
for (size_t i = 0; i < numNodes; ++i)
|
||||
{
|
||||
Transform& transform = const_cast<Transform&>(GetLocalSpaceTransform(i));
|
||||
@@ -974,7 +975,7 @@ namespace EMotionFX
|
||||
}
|
||||
}
|
||||
|
||||
const size_t numMorphs = m_morphWeights.GetLength();
|
||||
const size_t numMorphs = m_morphWeights.size();
|
||||
AZ_Assert(numMorphs == additivePose.GetNumMorphWeights(), "Number of morphs in the pose doesn't match the number of morphs inside the provided input pose.");
|
||||
for (size_t i = 0; i < numMorphs; ++i)
|
||||
{
|
||||
@@ -989,7 +990,7 @@ namespace EMotionFX
|
||||
|
||||
Pose& Pose::ApplyAdditive(const Pose& additivePose)
|
||||
{
|
||||
AZ_Assert(m_localSpaceTransforms.GetLength() == additivePose.m_localSpaceTransforms.GetLength(), "Poses must be of the same size");
|
||||
AZ_Assert(m_localSpaceTransforms.size() == additivePose.m_localSpaceTransforms.size(), "Poses must be of the same size");
|
||||
if (m_actorInstance)
|
||||
{
|
||||
const size_t numNodes = m_actorInstance->GetNumEnabledNodes();
|
||||
@@ -1009,7 +1010,7 @@ namespace EMotionFX
|
||||
}
|
||||
else
|
||||
{
|
||||
const size_t numNodes = m_localSpaceTransforms.GetLength();
|
||||
const size_t numNodes = m_localSpaceTransforms.size();
|
||||
for (size_t i = 0; i < numNodes; ++i)
|
||||
{
|
||||
Transform& transform = const_cast<Transform&>(GetLocalSpaceTransform(i));
|
||||
@@ -1024,7 +1025,7 @@ namespace EMotionFX
|
||||
}
|
||||
}
|
||||
|
||||
const size_t numMorphs = m_morphWeights.GetLength();
|
||||
const size_t numMorphs = m_morphWeights.size();
|
||||
AZ_Assert(numMorphs == additivePose.GetNumMorphWeights(), "Number of morphs in the pose doesn't match the number of morphs inside the provided input pose.");
|
||||
for (size_t i = 0; i < numMorphs; ++i)
|
||||
{
|
||||
@@ -1038,7 +1039,7 @@ namespace EMotionFX
|
||||
|
||||
Pose& Pose::MakeAdditive(const Pose& refPose)
|
||||
{
|
||||
AZ_Assert(m_localSpaceTransforms.GetLength() == refPose.m_localSpaceTransforms.GetLength(), "Poses must be of the same size");
|
||||
AZ_Assert(m_localSpaceTransforms.size() == refPose.m_localSpaceTransforms.size(), "Poses must be of the same size");
|
||||
if (m_actorInstance)
|
||||
{
|
||||
const size_t numNodes = m_actorInstance->GetNumEnabledNodes();
|
||||
@@ -1057,7 +1058,7 @@ namespace EMotionFX
|
||||
}
|
||||
else
|
||||
{
|
||||
const size_t numNodes = m_localSpaceTransforms.GetLength();
|
||||
const size_t numNodes = m_localSpaceTransforms.size();
|
||||
for (size_t i = 0; i < numNodes; ++i)
|
||||
{
|
||||
Transform& transform = const_cast<Transform&>(GetLocalSpaceTransform(i));
|
||||
@@ -1071,7 +1072,7 @@ namespace EMotionFX
|
||||
}
|
||||
}
|
||||
|
||||
const size_t numMorphs = m_morphWeights.GetLength();
|
||||
const size_t numMorphs = m_morphWeights.size();
|
||||
AZ_Assert(numMorphs == refPose.GetNumMorphWeights(), "Number of morphs in the pose doesn't match the number of morphs inside the provided input pose.");
|
||||
for (size_t i = 0; i < numMorphs; ++i)
|
||||
{
|
||||
@@ -1101,7 +1102,7 @@ namespace EMotionFX
|
||||
}
|
||||
|
||||
// blend the morph weights
|
||||
const size_t numMorphs = m_morphWeights.GetLength();
|
||||
const size_t numMorphs = m_morphWeights.size();
|
||||
MCORE_ASSERT(m_actorInstance->GetMorphSetupInstance()->GetNumMorphTargets() == numMorphs);
|
||||
MCORE_ASSERT(numMorphs == destPose->GetNumMorphWeights());
|
||||
for (size_t i = 0; i < numMorphs; ++i)
|
||||
@@ -1123,7 +1124,7 @@ namespace EMotionFX
|
||||
}
|
||||
|
||||
// blend the morph weights
|
||||
const size_t numMorphs = m_morphWeights.GetLength();
|
||||
const size_t numMorphs = m_morphWeights.size();
|
||||
MCORE_ASSERT(m_actor->GetMorphSetup(0)->GetNumMorphTargets() == numMorphs);
|
||||
MCORE_ASSERT(numMorphs == destPose->GetNumMorphWeights());
|
||||
for (size_t i = 0; i < numMorphs; ++i)
|
||||
@@ -1274,23 +1275,19 @@ namespace EMotionFX
|
||||
// zero all morph weights
|
||||
void Pose::ZeroMorphWeights()
|
||||
{
|
||||
const size_t numMorphs = m_morphWeights.GetLength();
|
||||
for (size_t m = 0; m < numMorphs; ++m)
|
||||
{
|
||||
m_morphWeights[m] = 0.0f;
|
||||
}
|
||||
AZStd::fill(begin(m_morphWeights), end(m_morphWeights), 0.0f);
|
||||
}
|
||||
|
||||
|
||||
void Pose::ResizeNumMorphs(size_t numMorphTargets)
|
||||
{
|
||||
m_morphWeights.Resize(numMorphTargets);
|
||||
m_morphWeights.resize(numMorphTargets);
|
||||
}
|
||||
|
||||
|
||||
Pose& Pose::PreMultiply(const Pose& other)
|
||||
{
|
||||
AZ_Assert(m_localSpaceTransforms.GetLength() == other.m_localSpaceTransforms.GetLength(), "Poses must be of the same size");
|
||||
AZ_Assert(m_localSpaceTransforms.size() == other.m_localSpaceTransforms.size(), "Poses must be of the same size");
|
||||
if (m_actorInstance)
|
||||
{
|
||||
const size_t numNodes = m_actorInstance->GetNumEnabledNodes();
|
||||
@@ -1304,7 +1301,7 @@ namespace EMotionFX
|
||||
}
|
||||
else
|
||||
{
|
||||
const size_t numNodes = m_localSpaceTransforms.GetLength();
|
||||
const size_t numNodes = m_localSpaceTransforms.size();
|
||||
for (size_t i = 0; i < numNodes; ++i)
|
||||
{
|
||||
Transform& transform = const_cast<Transform&>(GetLocalSpaceTransform(i));
|
||||
@@ -1320,7 +1317,7 @@ namespace EMotionFX
|
||||
|
||||
Pose& Pose::Multiply(const Pose& other)
|
||||
{
|
||||
AZ_Assert(m_localSpaceTransforms.GetLength() == other.m_localSpaceTransforms.GetLength(), "Poses must be of the same size");
|
||||
AZ_Assert(m_localSpaceTransforms.size() == other.m_localSpaceTransforms.size(), "Poses must be of the same size");
|
||||
if (m_actorInstance)
|
||||
{
|
||||
const size_t numNodes = m_actorInstance->GetNumEnabledNodes();
|
||||
@@ -1333,7 +1330,7 @@ namespace EMotionFX
|
||||
}
|
||||
else
|
||||
{
|
||||
const size_t numNodes = m_localSpaceTransforms.GetLength();
|
||||
const size_t numNodes = m_localSpaceTransforms.size();
|
||||
for (size_t i = 0; i < numNodes; ++i)
|
||||
{
|
||||
Transform& transform = const_cast<Transform&>(GetLocalSpaceTransform(i));
|
||||
@@ -1348,7 +1345,7 @@ namespace EMotionFX
|
||||
|
||||
Pose& Pose::MultiplyInverse(const Pose& other)
|
||||
{
|
||||
AZ_Assert(m_localSpaceTransforms.GetLength() == other.m_localSpaceTransforms.GetLength(), "Poses must be of the same size");
|
||||
AZ_Assert(m_localSpaceTransforms.size() == other.m_localSpaceTransforms.size(), "Poses must be of the same size");
|
||||
if (m_actorInstance)
|
||||
{
|
||||
const size_t numNodes = m_actorInstance->GetNumEnabledNodes();
|
||||
@@ -1363,7 +1360,7 @@ namespace EMotionFX
|
||||
}
|
||||
else
|
||||
{
|
||||
const size_t numNodes = m_localSpaceTransforms.GetLength();
|
||||
const size_t numNodes = m_localSpaceTransforms.size();
|
||||
for (size_t i = 0; i < numNodes; ++i)
|
||||
{
|
||||
Transform& transform = const_cast<Transform&>(GetLocalSpaceTransform(i));
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/std/containers/unordered_map.h>
|
||||
#include <MCore/Source/AlignedArray.h>
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
#include <EMotionFX/Source/PoseData.h>
|
||||
#include <EMotionFX/Source/Transform.h>
|
||||
|
||||
@@ -98,9 +98,9 @@ namespace EMotionFX
|
||||
|
||||
Transform CalcTrajectoryTransform() const;
|
||||
|
||||
MCORE_INLINE const Transform* GetLocalSpaceTransforms() const { return m_localSpaceTransforms.GetReadPtr(); }
|
||||
MCORE_INLINE const Transform* GetModelSpaceTransforms() const { return m_modelSpaceTransforms.GetReadPtr(); }
|
||||
MCORE_INLINE size_t GetNumTransforms() const { return m_localSpaceTransforms.GetLength(); }
|
||||
MCORE_INLINE const Transform* GetLocalSpaceTransforms() const { return m_localSpaceTransforms.data(); }
|
||||
MCORE_INLINE const Transform* GetModelSpaceTransforms() const { return m_modelSpaceTransforms.data(); }
|
||||
MCORE_INLINE size_t GetNumTransforms() const { return m_localSpaceTransforms.size(); }
|
||||
MCORE_INLINE const ActorInstance* GetActorInstance() const { return m_actorInstance; }
|
||||
MCORE_INLINE const Actor* GetActor() const { return m_actor; }
|
||||
MCORE_INLINE const Skeleton* GetSkeleton() const { return m_skeleton; }
|
||||
@@ -116,7 +116,7 @@ namespace EMotionFX
|
||||
|
||||
MCORE_INLINE void SetMorphWeight(size_t index, float weight) { m_morphWeights[index] = weight; }
|
||||
MCORE_INLINE float GetMorphWeight(size_t index) const { return m_morphWeights[index]; }
|
||||
MCORE_INLINE size_t GetNumMorphWeights() const { return m_morphWeights.GetLength(); }
|
||||
MCORE_INLINE size_t GetNumMorphWeights() const { return m_morphWeights.size(); }
|
||||
void ResizeNumMorphs(size_t numMorphTargets);
|
||||
|
||||
/**
|
||||
@@ -193,11 +193,11 @@ namespace EMotionFX
|
||||
T* GetAndPreparePoseData(ActorInstance* linkToActorInstance) { return azdynamic_cast<T*>(GetAndPreparePoseData(azrtti_typeid<T>(), linkToActorInstance)); }
|
||||
|
||||
private:
|
||||
mutable MCore::AlignedArray<Transform, 16> m_localSpaceTransforms;
|
||||
mutable MCore::AlignedArray<Transform, 16> m_modelSpaceTransforms;
|
||||
mutable MCore::AlignedArray<uint8, 16> m_flags;
|
||||
mutable AZStd::vector<Transform> m_localSpaceTransforms;
|
||||
mutable AZStd::vector<Transform> m_modelSpaceTransforms;
|
||||
mutable AZStd::vector<uint8> m_flags;
|
||||
AZStd::unordered_map<AZ::TypeId, AZStd::unique_ptr<PoseData> > m_poseDatas;
|
||||
MCore::AlignedArray<float, 16> m_morphWeights; /**< The morph target weights. */
|
||||
AZStd::vector<float> m_morphWeights; /**< The morph target weights. */
|
||||
const ActorInstance* m_actorInstance;
|
||||
const Actor* m_actor;
|
||||
const Skeleton* m_skeleton;
|
||||
|
||||
@@ -1,783 +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 "StandardHeaders.h"
|
||||
#include "MCoreSystem.h"
|
||||
#include "Algorithms.h"
|
||||
#include "MemoryManager.h"
|
||||
|
||||
|
||||
namespace MCore
|
||||
{
|
||||
/**
|
||||
* Dynamic array template, using aligned memory allocations.
|
||||
* This array template allows dynamic sizing. It also stores the memory category of the data.
|
||||
* It can theoretically store 18446744073709551614 items (maximum size_t value - 1 for the invalid index).
|
||||
*/
|
||||
template <typename T, uint32 alignment>
|
||||
class AlignedArray
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* The memory block ID, used inside the memory manager.
|
||||
* This will make all arrays remain in the same memory blocks, which is more efficient in a lot of cases.
|
||||
* However, array data can still remain in other blocks.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
MEMORYBLOCK_ID = 3
|
||||
};
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
* Initializes the array so it's empty and has no memory allocated.
|
||||
*/
|
||||
MCORE_INLINE AlignedArray()
|
||||
: m_data(nullptr)
|
||||
, m_length(0)
|
||||
, m_maxLength(0)
|
||||
, m_memCategory(MCORE_MEMCATEGORY_ARRAY) {}
|
||||
|
||||
/**
|
||||
* Constructor which creates a given number of elements.
|
||||
* @param elems The element data.
|
||||
* @param num The number of elements in 'elems'.
|
||||
* @param memCategory The memory category the array is in.
|
||||
*/
|
||||
MCORE_INLINE explicit AlignedArray(T* elems, size_t num, uint16 memCategory = MCORE_MEMCATEGORY_ARRAY)
|
||||
: m_length(num)
|
||||
, m_maxLength(AllocSize(num))
|
||||
, m_memCategory(memCategory)
|
||||
{
|
||||
m_data = (T*)AlignedAllocate(m_maxLength * sizeof(T), alignment, m_memCategory, MEMORYBLOCK_ID, MCORE_FILE, MCORE_LINE);
|
||||
for (size_t i = 0; i < m_length; ++i)
|
||||
{
|
||||
Construct(i, elems[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor which initializes the length of the array on a given number.
|
||||
* @param initSize The number of ellements to allocate space for.
|
||||
* @param memCategory The memory category the array is in.
|
||||
*/
|
||||
MCORE_INLINE explicit AlignedArray(size_t initSize, uint16 memCategory = MCORE_MEMCATEGORY_ARRAY)
|
||||
: m_data(nullptr)
|
||||
, m_length(initSize)
|
||||
, m_maxLength(initSize)
|
||||
, m_memCategory(memCategory)
|
||||
{
|
||||
if (m_maxLength > 0)
|
||||
{
|
||||
m_data = (T*)AlignedAllocate(m_maxLength * sizeof(T), alignment, m_memCategory, MEMORYBLOCK_ID, MCORE_FILE, MCORE_LINE);
|
||||
for (size_t i = 0; i < m_length; ++i)
|
||||
{
|
||||
Construct(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy constructor.
|
||||
* @param other The other array to copy the data from.
|
||||
*/
|
||||
AlignedArray(const AlignedArray<T, alignment>& other)
|
||||
: m_data(nullptr)
|
||||
, m_length(0)
|
||||
, m_maxLength(0)
|
||||
, m_memCategory(MCORE_MEMCATEGORY_ARRAY) { *this = other; }
|
||||
|
||||
/**
|
||||
* Move constructor.
|
||||
* @param other The array to move the data from.
|
||||
*/
|
||||
AlignedArray(AlignedArray<T, alignment>&& other) { m_data = other.m_data; m_length = other.m_length; m_maxLength = other.m_maxLength; m_memCategory = other.m_memCategory; other.m_data = nullptr; other.m_length = 0; other.m_maxLength = 0; }
|
||||
|
||||
/**
|
||||
* Destructor. Deletes all entry data.
|
||||
* However, if you store pointers to objects, these objects won't be deleted.<br>
|
||||
* Example:<br>
|
||||
* <pre>
|
||||
* AlignedArray< Object*, 16 > data;
|
||||
* for (size_t i=0; i<10; i++)
|
||||
* data.Add( new Object() );
|
||||
* </pre>
|
||||
* Now when the array 'data' will be destructed, it will NOT free up the memory of the integers which you allocated by hand, using new.
|
||||
* In order to free up this memory, you can do this:
|
||||
* <pre>
|
||||
* for (size_t i=0; i<data.GetLength(); ++i)
|
||||
* delete data[i];
|
||||
* data.Clear();
|
||||
* </pre>
|
||||
*/
|
||||
~AlignedArray()
|
||||
{
|
||||
for (size_t i = 0; i < m_length; ++i)
|
||||
{
|
||||
Destruct(i);
|
||||
}
|
||||
if (m_data)
|
||||
{
|
||||
AlignedFree(m_data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the memory category ID where allocations made by this array belong to.
|
||||
* On default the memory category is 0, which means unknown.
|
||||
* @result The memory category ID.
|
||||
*/
|
||||
MCORE_INLINE uint16 GetMemoryCategory() const { return m_memCategory; }
|
||||
|
||||
/**
|
||||
* Set the memory category ID, where allocations made by this array will belong to.
|
||||
* On default, after construction of the array, the category ID is 0, which means it is unknown.
|
||||
* @param categoryID The memory category ID where this arrays allocations belong to.
|
||||
*/
|
||||
MCORE_INLINE void SetMemoryCategory(uint16 categoryID) { m_memCategory = categoryID; }
|
||||
|
||||
/**
|
||||
* Get a pointer to the first element.
|
||||
* @result A pointer to the first element.
|
||||
*/
|
||||
MCORE_INLINE T* GetPtr() { return m_data; }
|
||||
|
||||
/**
|
||||
* Get a pointer to the first element.
|
||||
* @result A pointer to the first element.
|
||||
*/
|
||||
MCORE_INLINE T* GetPtr() const { return m_data; }
|
||||
|
||||
/**
|
||||
* Get a given item/element.
|
||||
* @param pos The item/element number.
|
||||
* @result A reference to the element.
|
||||
*/
|
||||
MCORE_INLINE T& GetItem(size_t pos) { return m_data[pos]; }
|
||||
|
||||
/**
|
||||
* Get the first element.
|
||||
* @result A reference to the first element.
|
||||
*/
|
||||
MCORE_INLINE T& GetFirst() { return m_data[0]; }
|
||||
|
||||
/**
|
||||
* Get the last element.
|
||||
* @result A reference to the last element.
|
||||
*/
|
||||
MCORE_INLINE T& GetLast() { return m_data[m_length - 1]; }
|
||||
|
||||
/**
|
||||
* Get a read-only pointer to the first element.
|
||||
* @result A read-only pointer to the first element.
|
||||
*/
|
||||
MCORE_INLINE const T* GetReadPtr() const { return m_data; }
|
||||
|
||||
/**
|
||||
* Get a read-only reference to a given element number.
|
||||
* @param pos The element number.
|
||||
* @result A read-only reference to the given element.
|
||||
*/
|
||||
MCORE_INLINE const T& GetItem(size_t pos) const { return m_data[pos]; }
|
||||
|
||||
/**
|
||||
* Get a read-only reference to the first element.
|
||||
* @result A read-only reference to the first element.
|
||||
*/
|
||||
MCORE_INLINE const T& GetFirst() const { return m_data[0]; }
|
||||
|
||||
/**
|
||||
* Get a read-only reference to the last element.
|
||||
* @result A read-only reference to the last element.
|
||||
*/
|
||||
MCORE_INLINE const T& GetLast() const { return m_data[m_length - 1]; }
|
||||
|
||||
/**
|
||||
* Check if the array is empty or not.
|
||||
* @result Returns true when there are no elements in the array, otherwise false is returned.
|
||||
*/
|
||||
MCORE_INLINE bool GetIsEmpty() const { return (m_length == 0); }
|
||||
|
||||
/**
|
||||
* Checks if the passed index is in the array's range.
|
||||
* @param index The index to check.
|
||||
* @return True if the passed index is valid, false if not.
|
||||
*/
|
||||
MCORE_INLINE bool GetIsValidIndex(size_t index) const { return (index < m_length); }
|
||||
|
||||
/**
|
||||
* Get the number of elements in the array.
|
||||
* @result The number of elements in the array.
|
||||
*/
|
||||
MCORE_INLINE size_t GetLength() const { return m_length; }
|
||||
|
||||
/**
|
||||
* Get the maximum number of elements. This is the number of elements there currently is space for to store.
|
||||
* However, never use this to make for-loops to iterate through all elements. Use GetLength() instead for that.
|
||||
* This purely has to do with pre-allocating, to reduce the number of reallocs.
|
||||
* @result The maximum array length.
|
||||
*/
|
||||
MCORE_INLINE size_t GetMaxLength() const { return m_maxLength; }
|
||||
|
||||
/**
|
||||
* Calculates the memory usage used by this array.
|
||||
* @param includeMembers Include the class members in the calculation? (default=true).
|
||||
* @result The number of bytes allocated by this array.
|
||||
*/
|
||||
MCORE_INLINE size_t CalcMemoryUsage(bool includeMembers = true) const
|
||||
{
|
||||
size_t result = m_maxLength * sizeof(T);
|
||||
if (includeMembers)
|
||||
{
|
||||
result += sizeof(AlignedArray<T, alignment>);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a given element to a given value.
|
||||
* @param pos The element number.
|
||||
* @param value The value to store at that element number.
|
||||
*/
|
||||
MCORE_INLINE void SetElem(size_t pos, const T& value) { m_data[pos] = value; }
|
||||
|
||||
/**
|
||||
* Add a given element to the back of the array.
|
||||
* @param x The element to add.
|
||||
*/
|
||||
MCORE_INLINE void Add(const T& x) { Grow(++m_length); Construct(m_length - 1, x); }
|
||||
|
||||
/**
|
||||
* Add a given element to the back of the array, but without pre-allocation caching.
|
||||
* @param x The element to add.
|
||||
*/
|
||||
MCORE_INLINE void AddExact(const T& x) { GrowExact(++m_length); Construct(m_length - 1, x); }
|
||||
|
||||
/**
|
||||
* Add a given array to the back of this array.
|
||||
* @param a The array to add.
|
||||
*/
|
||||
MCORE_INLINE void Add(const AlignedArray<T, alignment>& a)
|
||||
{
|
||||
size_t l = m_length;
|
||||
Grow(m_length + a.m_length);
|
||||
for (size_t i = 0; i < a.GetLength(); ++i)
|
||||
{
|
||||
Construct(l + i, a[i]);
|
||||
}
|
||||
} // TODO: a.GetLength() can be precaled before loop?
|
||||
|
||||
/**
|
||||
* Add an empty (default constructed) element to the back of the array.
|
||||
*/
|
||||
MCORE_INLINE void AddEmpty() { Grow(++m_length); Construct(m_length - 1); }
|
||||
|
||||
/**
|
||||
* Add an empty (default constructed) element to the back of the array, but without pre-allocation caching.
|
||||
*/
|
||||
MCORE_INLINE void AddEmptyExact() { GrowExact(++m_length); Construct(m_length - 1); }
|
||||
|
||||
/**
|
||||
* Remove the first array element.
|
||||
*/
|
||||
MCORE_INLINE void RemoveFirst()
|
||||
{
|
||||
if (m_length > 0)
|
||||
{
|
||||
Remove(0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the last array element.
|
||||
*/
|
||||
MCORE_INLINE void RemoveLast()
|
||||
{
|
||||
if (m_length > 0)
|
||||
{
|
||||
Destruct(--m_length);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert an empty element (default constructed) at a given position in the array.
|
||||
* @param pos The position to create the empty element.
|
||||
*/
|
||||
MCORE_INLINE void Insert(size_t pos) { Grow(m_length + 1); MoveElements(pos + 1, pos, m_length - pos - 1); Construct(pos); }
|
||||
|
||||
/**
|
||||
* Insert a given element at a given position in the array.
|
||||
* @param pos The position to insert the empty element.
|
||||
* @param x The element to store at this position.
|
||||
*/
|
||||
MCORE_INLINE void Insert(size_t pos, const T& x) { Grow(m_length + 1); MoveElements(pos + 1, pos, m_length - pos - 1); Construct(pos, x); }
|
||||
|
||||
/**
|
||||
* Remove an element at a given position.
|
||||
* @param pos The element number to remove.
|
||||
*/
|
||||
MCORE_INLINE void Remove(size_t pos)
|
||||
{
|
||||
Destruct(pos);
|
||||
if (m_length > 1)
|
||||
{
|
||||
MoveElements(pos, pos + 1, m_length - pos - 1);
|
||||
}
|
||||
m_length--;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a given number of elements starting at a given position in the array.
|
||||
* @param pos The start element, so to start removing from.
|
||||
* @param num The number of elements to remove from this position.
|
||||
*/
|
||||
MCORE_INLINE void Remove(size_t pos, size_t num)
|
||||
{
|
||||
for (size_t i = pos; i < pos + num; ++i)
|
||||
{
|
||||
Destruct(i);
|
||||
}
|
||||
MoveElements(pos, pos + num, m_length - pos - num);
|
||||
m_length -= num;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a given element with a given value.
|
||||
* Only the first element with the given value will be removed.
|
||||
* @param item The item/element to remove.
|
||||
*/
|
||||
MCORE_INLINE bool RemoveByValue(const T& item)
|
||||
{
|
||||
size_t index = Find(item);
|
||||
if (index == InvalidIndex)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
Remove(index);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a given element in the array and place the last element in the array at the created empty position.
|
||||
* So if we have an array with the following characters : ABCDEFG<br>
|
||||
* And we perform a SwapRemove(2), we will remove element C and place the last element (G) at the empty created position where C was located.
|
||||
* So we will get this:<br>
|
||||
* AB.DEFG [where . is empty, after we did the SwapRemove(2)]<br>
|
||||
* ABGDEF [this is the result. G has been moved to the empty position].
|
||||
*/
|
||||
MCORE_INLINE void SwapRemove(size_t pos)
|
||||
{
|
||||
Destruct(pos);
|
||||
if (pos != m_length - 1)
|
||||
{
|
||||
Construct(pos, m_data[m_length - 1]);
|
||||
Destruct(m_length - 1);
|
||||
}
|
||||
m_length--;
|
||||
} // remove element at <pos> and place the last element of the array in that position
|
||||
|
||||
/**
|
||||
* Swap two elements.
|
||||
* @param pos1 The first element number.
|
||||
* @param pos2 The second element number.
|
||||
*/
|
||||
MCORE_INLINE void Swap(size_t pos1, size_t pos2)
|
||||
{
|
||||
if (pos1 != pos2)
|
||||
{
|
||||
Swap(GetItem(pos1), GetItem(pos2));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the array contents. So GetLength() will return 0 after performing this method.
|
||||
* @param clearMem If set to true (default) the allocated memory will also be released. If set to false, GetMaxLength() will still return the number of elements
|
||||
* which the array contained before calling the Clear() method.
|
||||
*/
|
||||
MCORE_INLINE void Clear(bool clearMem = true)
|
||||
{
|
||||
for (size_t i = 0; i < m_length; ++i)
|
||||
{
|
||||
Destruct(i);
|
||||
}
|
||||
m_length = 0;
|
||||
if (clearMem)
|
||||
{
|
||||
this->Free();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Make sure the array has enough space to store a given number of elements.
|
||||
* @param newLength The number of elements we want to make sure that will fit in the array.
|
||||
*/
|
||||
MCORE_INLINE void AssureSize(size_t newLength)
|
||||
{
|
||||
if (m_length >= newLength)
|
||||
{
|
||||
return;
|
||||
}
|
||||
size_t oldLen = m_length;
|
||||
Grow(newLength);
|
||||
for (size_t i = oldLen; i < newLength; ++i)
|
||||
{
|
||||
Construct(i);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Make sure this array has enough allocated storage to grow to a given number of elements elements without having to realloc.
|
||||
* @param minLength The minimum length the array should have (actually the minimum maxLength, because this has no influence on what GetLength() will return).
|
||||
*/
|
||||
MCORE_INLINE void Reserve(size_t minLength)
|
||||
{
|
||||
if (m_maxLength < minLength)
|
||||
{
|
||||
Realloc(minLength);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Make the array as small as possible. So remove all extra pre-allocated data, so that the array consumes the least possible amount of memory.
|
||||
*/
|
||||
MCORE_INLINE void Shrink()
|
||||
{
|
||||
if (m_length == m_maxLength)
|
||||
{
|
||||
return;
|
||||
}
|
||||
MCORE_ASSERT(m_maxLength >= m_length);
|
||||
Realloc(m_length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the array contains a given element.
|
||||
* @param x The element to check.
|
||||
* @result Returns true when the array contains the element, otherwise false is returned.
|
||||
*/
|
||||
MCORE_INLINE bool Contains(const T& x) const { return (Find(x) != InvalidIndex); }
|
||||
|
||||
/**
|
||||
* Find the position of a given element.
|
||||
* @param x The element to find.
|
||||
* @result Returns the index in the array, ranging from [0 to GetLength()-1] when found, otherwise InvalidIndex is returned.
|
||||
*/
|
||||
MCORE_INLINE size_t Find(const T& x) const
|
||||
{
|
||||
for (size_t i = 0; i < m_length; ++i)
|
||||
{
|
||||
if (m_data[i] == x)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return InvalidIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy the contents of another array into this one using a direct memory copy.
|
||||
* This does not call copy constructors of the objects, but just copies the raw memory data.
|
||||
* This resizes this array to be the exact length of the array we will copy the data from.
|
||||
* @param other The array to copy the data from.
|
||||
*/
|
||||
MCORE_INLINE void MemCopyContentsFrom(const AlignedArray<T, alignment>& other) { Resize(other.GetLength()); MemCopy((uint8*)m_data, (uint8*)other.m_data, sizeof(T) * other.m_length); }
|
||||
|
||||
// sort function and standard sort function
|
||||
typedef int32 (MCORE_CDECL * CmpFunc)(const T& itemA, const T& itemB);
|
||||
static int32 MCORE_CDECL StdCmp(const T& itemA, const T& itemB)
|
||||
{
|
||||
if (itemA < itemB)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else if (itemA == itemB)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
static int32 MCORE_CDECL StdPtrObjCmp(const T& itemA, const T& itemB)
|
||||
{
|
||||
if (*itemA < *itemB)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else if (*itemA == *itemB)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort the complete array using a given sort function.
|
||||
* @param cmp The sort function to use.
|
||||
*/
|
||||
MCORE_INLINE void Sort(CmpFunc cmp) { InnerSort(0, m_length - 1, cmp); }
|
||||
|
||||
/**
|
||||
* Sort a given part of the array using a given sort function.
|
||||
* The default parameters are set so that it will sort the compelete array with a default compare function (which uses the < and > operators).
|
||||
* The method will sort all elements between the given 'first' and 'last' element (first and last are also included in the sort).
|
||||
* @param first The first element to start sorting.
|
||||
* @param last The last element to sort (when set to InvalidIndex, GetLength()-1 will be used).
|
||||
* @param cmp The compare function.
|
||||
*/
|
||||
MCORE_INLINE void Sort(size_t first = 0, size_t last = InvalidIndex, CmpFunc cmp = StdCmp)
|
||||
{
|
||||
if (last == InvalidIndex)
|
||||
{
|
||||
last = m_length - 1;
|
||||
}
|
||||
InnerSort(first, last, cmp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a sort on a given part of the array.
|
||||
* @param first The first element to start the sorting at.
|
||||
* @param last The last element to end the sorting.
|
||||
* @param cmp The compare function.
|
||||
*/
|
||||
MCORE_INLINE void InnerSort(int32 first, int32 last, CmpFunc cmp)
|
||||
{
|
||||
if (first >= last)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int32 split = Partition(first, last, cmp);
|
||||
InnerSort(first, split - 1, cmp);
|
||||
InnerSort(split + 1, last, cmp);
|
||||
}
|
||||
|
||||
// resize in a fast way that doesn't call constructors or destructors
|
||||
void ResizeFast(size_t newLength)
|
||||
{
|
||||
if (m_length == newLength)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (newLength > m_length)
|
||||
{
|
||||
GrowExact(newLength);
|
||||
}
|
||||
|
||||
m_length = newLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resize the array to a given size.
|
||||
* This does not mean an actual realloc will be made. This will only happen when the new length is bigger than the maxLength of the array.
|
||||
* @param newLength The new length the array should be.
|
||||
*/
|
||||
void Resize(size_t newLength)
|
||||
{
|
||||
if (m_length == newLength)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// check for growing or shrinking array
|
||||
if (newLength > m_length)
|
||||
{
|
||||
// growing array, construct empty elements at end of array
|
||||
const size_t oldLen = m_length;
|
||||
GrowExact(newLength);
|
||||
for (size_t i = oldLen; i < newLength; ++i)
|
||||
{
|
||||
Construct(i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// shrinking array, destruct elements at end of array
|
||||
for (size_t i = newLength; i < m_length; ++i)
|
||||
{
|
||||
Destruct(i);
|
||||
}
|
||||
|
||||
m_length = newLength;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Move "numElements" elements starting from the source index, to the dest index.
|
||||
* Please note thate the array has to be large enough. You can't move data past the end of the array.
|
||||
* @param destIndex The destination index.
|
||||
* @param sourceIndex The source index, where the source elements start.
|
||||
* @param numElements The number of elements to move.
|
||||
*/
|
||||
MCORE_INLINE void MoveElements(size_t destIndex, size_t sourceIndex, size_t numElements)
|
||||
{
|
||||
if (numElements > 0)
|
||||
{
|
||||
MemMove(m_data + destIndex, m_data + sourceIndex, numElements * sizeof(T));
|
||||
}
|
||||
}
|
||||
|
||||
// operators
|
||||
bool operator==(const AlignedArray<T, alignment>& other) const
|
||||
{
|
||||
if (m_length != other.m_length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (size_t i = 0; i < m_length; ++i)
|
||||
{
|
||||
if (m_data[i] != other.m_data[i])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
AlignedArray<T, alignment>& operator= (const AlignedArray<T, alignment>& other)
|
||||
{
|
||||
if (&other != this)
|
||||
{
|
||||
Clear(false);
|
||||
m_memCategory = other.m_memCategory;
|
||||
Grow(other.m_length);
|
||||
for (size_t i = 0; i < m_length; ++i)
|
||||
{
|
||||
Construct(i, other.m_data[i]);
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
AlignedArray<T, alignment>& operator= (AlignedArray<T, alignment>&& other)
|
||||
{
|
||||
MCORE_ASSERT(&other != this);
|
||||
if (m_data)
|
||||
{
|
||||
AlignedFree(m_data);
|
||||
}
|
||||
m_data = other.m_data;
|
||||
m_memCategory = other.m_memCategory;
|
||||
m_length = other.m_length;
|
||||
m_maxLength = other.m_maxLength;
|
||||
other.m_data = nullptr;
|
||||
other.m_length = 0;
|
||||
other.m_maxLength = 0;
|
||||
return *this;
|
||||
}
|
||||
AlignedArray<T, alignment>& operator+=(const T& other) { Add(other); return *this; }
|
||||
AlignedArray<T, alignment>& operator+=(const AlignedArray<T, alignment>& other) { Add(other); return *this; }
|
||||
MCORE_INLINE T& operator[](size_t index) { MCORE_ASSERT(index < m_length); return m_data[index]; }
|
||||
MCORE_INLINE const T& operator[](size_t index) const { MCORE_ASSERT(index < m_length); return m_data[index]; }
|
||||
|
||||
private:
|
||||
T* m_data; /**< The element data. */
|
||||
size_t m_length; /**< The number of used elements in the array. */
|
||||
size_t m_maxLength; /**< The number of elements that we have allocated memory for. */
|
||||
uint16 m_memCategory; /**< The memory category ID. */
|
||||
|
||||
// private functions
|
||||
MCORE_INLINE void Grow(size_t newLength)
|
||||
{
|
||||
m_length = newLength;
|
||||
if (m_maxLength >= newLength)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Realloc(AllocSize(newLength));
|
||||
}
|
||||
MCORE_INLINE void GrowExact(size_t newLength)
|
||||
{
|
||||
m_length = newLength;
|
||||
if (m_maxLength < newLength)
|
||||
{
|
||||
Realloc(newLength);
|
||||
}
|
||||
}
|
||||
MCORE_INLINE size_t AllocSize(size_t num) { return 1 + num /*+num/8*/; }
|
||||
MCORE_INLINE void Alloc(size_t num) { m_data = (T*)AlignedAllocate(num * sizeof(T), alignment, m_memCategory, MEMORYBLOCK_ID, MCORE_FILE, MCORE_LINE); }
|
||||
MCORE_INLINE void Realloc(size_t newSize)
|
||||
{
|
||||
if (newSize == 0)
|
||||
{
|
||||
this->Free();
|
||||
return;
|
||||
}
|
||||
if (m_data)
|
||||
{
|
||||
m_data = (T*)AlignedRealloc(m_data, newSize * sizeof(T), m_maxLength * sizeof(T), alignment, m_memCategory, MEMORYBLOCK_ID, MCORE_FILE, MCORE_LINE);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_data = (T*)AlignedAllocate(newSize * sizeof(T), alignment, m_memCategory, MEMORYBLOCK_ID, MCORE_FILE, MCORE_LINE);
|
||||
}
|
||||
|
||||
m_maxLength = newSize;
|
||||
}
|
||||
void Free()
|
||||
{
|
||||
m_length = 0;
|
||||
m_maxLength = 0;
|
||||
if (m_data)
|
||||
{
|
||||
AlignedFree(m_data);
|
||||
m_data = nullptr;
|
||||
}
|
||||
}
|
||||
MCORE_INLINE void Construct(size_t index, const T& original) { ::new(m_data + index)T(original); } // copy-construct an element at <index> which is a copy of <original>
|
||||
MCORE_INLINE void Construct(size_t index) { ::new(m_data + index)T; } // construct an element at place <index>
|
||||
MCORE_INLINE void Destruct(size_t index)
|
||||
{
|
||||
#if (MCORE_COMPILER == MCORE_COMPILER_MSVC)
|
||||
MCORE_UNUSED(index); // work around an MSVC compiler bug, where it triggers a warning that parameter 'index' is unused
|
||||
#endif
|
||||
(m_data + index)->~T();
|
||||
}
|
||||
|
||||
// partition part of array (for sorting)
|
||||
int32 Partition(int32 left, int32 right, CmpFunc cmp)
|
||||
{
|
||||
::MCore::Swap(m_data[left], m_data[ (left + right) >> 1 ]);
|
||||
|
||||
T& target = m_data[right];
|
||||
int32 i = left - 1;
|
||||
int32 j = right;
|
||||
|
||||
bool neverQuit = true; // workaround to disable a "warning C4127: conditional expression is constant"
|
||||
while (neverQuit)
|
||||
{
|
||||
while (i < j)
|
||||
{
|
||||
if (cmp(m_data[++i], target) >= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (j > i)
|
||||
{
|
||||
if (cmp(m_data[--j], target) <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i >= j)
|
||||
{
|
||||
break;
|
||||
}
|
||||
::MCore::Swap(m_data[i], m_data[j]);
|
||||
}
|
||||
|
||||
::MCore::Swap(m_data[i], m_data[right]);
|
||||
return i;
|
||||
}
|
||||
};
|
||||
} // namespace MCore
|
||||
@@ -11,7 +11,6 @@ set(FILES
|
||||
Source/Algorithms.cpp
|
||||
Source/Algorithms.h
|
||||
Source/Algorithms.inl
|
||||
Source/AlignedArray.h
|
||||
Source/Array2D.h
|
||||
Source/Array2D.inl
|
||||
Source/Attribute.cpp
|
||||
|
||||
@@ -498,7 +498,7 @@ namespace MysticQt
|
||||
}
|
||||
if (findPreviousMaximizedDialogNeeded)
|
||||
{
|
||||
for (auto curDialog = AZStd::make_reverse_iterator(dialog) + 1; curDialog != m_dialogs.rend(); ++curDialog)
|
||||
for (auto curDialog = AZStd::make_reverse_iterator(dialog); curDialog != m_dialogs.rend(); ++curDialog)
|
||||
{
|
||||
if (curDialog->m_maximizeSize && curDialog->m_frame->isHidden() == false)
|
||||
{
|
||||
|
||||
+4
-2
@@ -379,10 +379,12 @@ namespace AZ::SceneGenerationComponents
|
||||
|
||||
auto [optimizedMesh, optimizedUVs, optimizedTangents, optimizedBitangents, optimizedVertexColors, optimizedSkinWeights] = OptimizeMesh(mesh, mesh, uvDatas, tangentDatas, bitangentDatas, colorDatas, skinWeightDatas, meshGroup, hasBlendShapes);
|
||||
|
||||
AZ_TracePrintf(AZ::SceneAPI::Utilities::LogWindow, "Base mesh: %zu vertices, optimized mesh: %zu vertices, %0.02f%% of the original",
|
||||
AZ_TracePrintf(AZ::SceneAPI::Utilities::LogWindow, "Optimized mesh '%s': Original: %zu vertices -> optimized: %zu vertices, %0.02f%% of the original (hasBlendShapes=%s)",
|
||||
graph.GetNodeName(nodeIndex).GetName(),
|
||||
mesh->GetUsedControlPointCount(),
|
||||
optimizedMesh->GetUsedControlPointCount(),
|
||||
((float)optimizedMesh->GetUsedControlPointCount() / (float)mesh->GetUsedControlPointCount()) * 100.0f
|
||||
((float)optimizedMesh->GetUsedControlPointCount() / (float)mesh->GetUsedControlPointCount()) * 100.0f,
|
||||
hasBlendShapes ? "Yes" : "No"
|
||||
);
|
||||
|
||||
const NodeIndex optimizedMeshNodeIndex = graph.AddChild(graph.GetNodeParent(nodeIndex), name.c_str(), AZStd::move(optimizedMesh));
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "RecentFiles.h"
|
||||
#include "CommonSettingsConfigurations.h"
|
||||
#include <AzCore/std/algorithm.h>
|
||||
|
||||
#include <QDir>
|
||||
#include <QSettings>
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
"CONFIGURATION": "profile",
|
||||
"SCRIPT_PATH": "scripts/build/TestImpactAnalysis/tiaf_driver.py",
|
||||
"SCRIPT_PARAMETERS":
|
||||
"--config=\"!OUTPUT_DIRECTORY!/bin/TestImpactFramework/profile/Persistent/tiaf.json\" --src-branch=!BRANCH_NAME! --dst-branch=!BRANCH_NAME! --commit=!CHANGE_ID! --s3-bucket=!TEST_IMPACT_S3_BUCKET! --mars-index-prefix=jonawals --suite=main --test-failure-policy=continue"
|
||||
"--config=\"!OUTPUT_DIRECTORY!/bin/TestImpactFramework/profile/Persistent/tiaf.json\" --src-branch=!BRANCH_NAME! --dst-branch=!CHANGE_TARGET! --commit=!CHANGE_ID! --s3-bucket=!TEST_IMPACT_S3_BUCKET! --mars-index-prefix=jonawals --suite=main --test-failure-policy=continue"
|
||||
}
|
||||
},
|
||||
"debug_vs2019": {
|
||||
|
||||
@@ -32,7 +32,9 @@ class Repo:
|
||||
|
||||
try:
|
||||
# Remove the existing file (if any) and create the parent directory
|
||||
output_path.unlink(missing_ok=True)
|
||||
# output_path.unlink(missing_ok=True) # missing_ok is only available in Python 3.8+
|
||||
if output_path.is_file():
|
||||
output_path.unlink()
|
||||
output_path.parent.mkdir(exist_ok=True)
|
||||
except EnvironmentError as e:
|
||||
raise RuntimeError(f"Could not create path for output file '{output_path}'")
|
||||
|
||||
@@ -48,14 +48,11 @@ class PersistentStorageS3(PersistentStorage):
|
||||
for object in self._bucket.objects.filter(Prefix=self._historic_data_key):
|
||||
logger.info(f"Historic data found for branch '{branch}'.")
|
||||
|
||||
# Archive the existing object with the name of the existing last commit hash
|
||||
archive_key = f"{self._dir}/archive/{self._last_commit_hash}.{object_extension}"
|
||||
logger.info(f"Archiving existing historic data to {archive_key}...")
|
||||
self._bucket.copy({"Bucket": self._bucket.name, "Key": self._historic_data_key}, archive_key)
|
||||
|
||||
# Decode the historic data object into raw bytes
|
||||
logger.info(f"Attempting to decode historic data object...")
|
||||
response = object.get()
|
||||
file_stream = response['Body']
|
||||
logger.info(f"Decoding complete.")
|
||||
|
||||
# Decompress and unpack the zipped historic data JSON
|
||||
historic_data_json = zlib.decompress(file_stream.read()).decode('UTF-8')
|
||||
@@ -79,7 +76,7 @@ class PersistentStorageS3(PersistentStorage):
|
||||
try:
|
||||
data = BytesIO(zlib.compress(bytes(historic_data_json, "UTF-8")))
|
||||
logger.info(f"Uploading historic data to location '{self._historic_data_key}'...")
|
||||
self._bucket.upload_fileobj(data, self._historic_data_key)
|
||||
self._bucket.upload_fileobj(data, self._historic_data_key, ExtraArgs={'ACL': 'bucket-owner-full-control'})
|
||||
logger.info("Upload complete.")
|
||||
except botocore.exceptions.BotoCoreError as e:
|
||||
logger.error(f"There was a problem with the s3 bucket: {e}")
|
||||
|
||||
Reference in New Issue
Block a user