Merge branch 'stabilization/2106' into pyrunfile_args_fix
This commit is contained in:
@@ -161,7 +161,56 @@ namespace AZ
|
||||
return "A pair is an fixed size collection of two elements.";
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template<typename T>
|
||||
void GetTypeNamesFold(AZStd::vector<AZStd::string>& result, AZ::BehaviorContext& context)
|
||||
{
|
||||
result.push_back(OnDemandPrettyName<T>::Get(context));
|
||||
};
|
||||
|
||||
template<typename... T>
|
||||
void GetTypeNames(AZStd::vector<AZStd::string>& result, AZ::BehaviorContext& context)
|
||||
{
|
||||
(GetTypeNamesFold<T>(result, context), ...);
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
void GetTypeNamesFold(AZStd::string& result, AZ::BehaviorContext& context)
|
||||
{
|
||||
if (!result.empty())
|
||||
{
|
||||
result += ", ";
|
||||
}
|
||||
|
||||
result += OnDemandPrettyName<T>::Get(context);
|
||||
};
|
||||
|
||||
template<typename... T>
|
||||
void GetTypeNames(AZStd::string& result, AZ::BehaviorContext& context)
|
||||
{
|
||||
(GetTypeNamesFold<T>(result, context), ...);
|
||||
};
|
||||
|
||||
template<typename... T>
|
||||
struct OnDemandPrettyName<AZStd::tuple<T...>>
|
||||
{
|
||||
static AZStd::string Get(AZ::BehaviorContext& context)
|
||||
{
|
||||
AZStd::string typeNames;
|
||||
GetTypeNames<T...>(typeNames, context);
|
||||
return AZStd::string::format("Tuple<%s>", typeNames.c_str());
|
||||
}
|
||||
};
|
||||
|
||||
template<typename... T>
|
||||
struct OnDemandToolTip<AZStd::tuple<T...>>
|
||||
{
|
||||
static AZStd::string Get(AZ::BehaviorContext&)
|
||||
{
|
||||
return "A tuple is an fixed size collection of any number of any type of element.";
|
||||
}
|
||||
};
|
||||
|
||||
template<class Key, class MappedType, class Hasher, class EqualKey, class Allocator>
|
||||
struct OnDemandPrettyName< AZStd::unordered_map<Key, MappedType, Hasher, EqualKey, Allocator> >
|
||||
{
|
||||
|
||||
@@ -813,20 +813,27 @@ namespace AZ
|
||||
{
|
||||
using ContainerType = AZStd::tuple<T...>;
|
||||
|
||||
template<size_t Index>
|
||||
static void ReflectUnpackMethodFold(BehaviorContext::ClassBuilder<ContainerType>& builder)
|
||||
template<typename Targ, size_t Index>
|
||||
static void ReflectUnpackMethodFold(BehaviorContext::ClassBuilder<ContainerType>& builder, const AZStd::vector<AZStd::string>& typeNames)
|
||||
{
|
||||
const AZStd::string methodName = AZStd::string::format("Get%zu", Index);
|
||||
builder->Method(methodName.data(), [](ContainerType& value) { return AZStd::get<Index>(value); })
|
||||
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
|
||||
builder->Method(methodName.data(), [](ContainerType& thisPointer) { return AZStd::get<Index>(thisPointer); })
|
||||
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::List)
|
||||
->Attribute(AZ::ScriptCanvasAttributes::TupleGetFunctionIndex, Index)
|
||||
;
|
||||
|
||||
builder->Property
|
||||
( AZStd::string::format("element_%zu_%s", Index, typeNames[Index].c_str()).c_str()
|
||||
, [](ContainerType& thisPointer) { return AZStd::get<Index>(thisPointer); }
|
||||
, [](ContainerType& thisPointer, const Targ& element) { AZStd::get<Index>(thisPointer) = element; });
|
||||
}
|
||||
|
||||
template<size_t... Indices>
|
||||
template<typename... Targ, size_t... Indices>
|
||||
static void ReflectUnpackMethods(BehaviorContext::ClassBuilder<ContainerType>& builder, AZStd::index_sequence<Indices...>)
|
||||
{
|
||||
(ReflectUnpackMethodFold<Indices>(builder), ...);
|
||||
AZStd::vector<AZStd::string> typeNames;
|
||||
ScriptCanvasOnDemandReflection::GetTypeNames<T...>(typeNames, *builder.m_context);
|
||||
(ReflectUnpackMethodFold<Targ, Indices>(builder, typeNames), ...);
|
||||
}
|
||||
|
||||
static void Reflect(ReflectContext* context)
|
||||
@@ -851,9 +858,10 @@ namespace AZ
|
||||
->Attribute(AZ::ScriptCanvasAttributes::TupleConstructorFunction, constructorHolder)
|
||||
;
|
||||
|
||||
ReflectUnpackMethods(builder, AZStd::make_index_sequence<sizeof...(T)>{});
|
||||
ReflectUnpackMethods<T...>(builder, AZStd::make_index_sequence<sizeof...(T)>{});
|
||||
|
||||
builder->Method("GetSize", []() { return AZStd::tuple_size<ContainerType>::value; })
|
||||
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
|
||||
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::List)
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +113,8 @@ namespace AZ
|
||||
//! Save a string to a file. Otherwise returns a failure with error message.
|
||||
AZ::Outcome<void, AZStd::string> WriteFile(AZStd::string_view content, AZStd::string_view filePath);
|
||||
|
||||
//! Read a file into a string. Returns a failure with error message if the content could not be loaded.
|
||||
//! Read a file into a string. Returns a failure with error message if the content could not be loaded or if
|
||||
//! the file size is larger than the max file size provided.
|
||||
template<typename Container = AZStd::string>
|
||||
AZ::Outcome<Container, AZStd::string> ReadFile(AZStd::string_view filePath, size_t maxFileSize = DefaultMaxFileSize);
|
||||
}
|
||||
|
||||
+1
-7
@@ -185,13 +185,7 @@ namespace AzToolsFramework
|
||||
bool PrefabEditorEntityOwnershipService::LoadFromStream(AZ::IO::GenericStream& stream, AZStd::string_view filename)
|
||||
{
|
||||
Reset();
|
||||
// Make loading from stream to behave the same in terms of filesize as regular loading of prefabs
|
||||
// This may need to be revisited in the future for supporting higher sizes along with prefab loading
|
||||
if (stream.GetLength() > Prefab::MaxPrefabFileSize)
|
||||
{
|
||||
AZ_Error("Prefab", false, "'%.*s' prefab content is bigger than the max supported size (%f MB)", AZ_STRING_ARG(filename), Prefab::MaxPrefabFileSize / (1024.f * 1024.f));
|
||||
return false;
|
||||
}
|
||||
|
||||
const size_t bufSize = stream.GetLength();
|
||||
AZStd::unique_ptr<char[]> buf(new char[bufSize]);
|
||||
AZ::IO::SizeType bytes = stream.Read(bufSize, buf.get());
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace AzToolsFramework
|
||||
return InvalidTemplateId;
|
||||
}
|
||||
|
||||
auto readResult = AZ::Utils::ReadFile(GetFullPath(filePath).Native(), MaxPrefabFileSize);
|
||||
auto readResult = AZ::Utils::ReadFile(GetFullPath(filePath).Native(), AZStd::numeric_limits<size_t>::max());
|
||||
if (!readResult.IsSuccess())
|
||||
{
|
||||
AZ_Error(
|
||||
|
||||
@@ -21,8 +21,6 @@ namespace AzToolsFramework
|
||||
{
|
||||
namespace Prefab
|
||||
{
|
||||
constexpr size_t MaxPrefabFileSize = 1024 * 1024;
|
||||
|
||||
/*!
|
||||
* PrefabLoaderInterface
|
||||
* Interface for saving/loading Prefab files.
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <PhysX_precompiled.h>
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
#include <AzCore/std/smart_ptr/make_shared.h>
|
||||
#include <AzCore/std/parallel/scoped_lock.h>
|
||||
#include <AzFramework/Physics/PhysicsScene.h>
|
||||
#include <AzFramework/Physics/PhysicsSystem.h>
|
||||
#include <AzFramework/Physics/SystemBus.h>
|
||||
@@ -40,6 +41,8 @@ namespace PhysX
|
||||
} // namespace Internal
|
||||
|
||||
// PhysX::Ragdoll
|
||||
/*static*/ AZStd::mutex Ragdoll::m_sceneEventMutex;
|
||||
|
||||
void Ragdoll::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context);
|
||||
@@ -114,7 +117,10 @@ namespace PhysX
|
||||
|
||||
Ragdoll::~Ragdoll()
|
||||
{
|
||||
m_sceneStartSimHandler.Disconnect();
|
||||
{
|
||||
AZStd::scoped_lock lock(m_sceneEventMutex);
|
||||
m_sceneStartSimHandler.Disconnect();
|
||||
}
|
||||
|
||||
m_nodes.clear(); //the nodes destructor will remove the simulated body from the scene.
|
||||
}
|
||||
@@ -212,7 +218,13 @@ namespace PhysX
|
||||
}
|
||||
}
|
||||
|
||||
sceneInterface->RegisterSceneSimulationStartHandler(m_sceneOwner, m_sceneStartSimHandler);
|
||||
// the handler is also connected in EnableSimulationQueued(),
|
||||
// which will call this function, so if called from that path dont connect here.
|
||||
if (!m_sceneStartSimHandler.IsConnected())
|
||||
{
|
||||
AZStd::scoped_lock lock(m_sceneEventMutex);
|
||||
sceneInterface->RegisterSceneSimulationStartHandler(m_sceneOwner, m_sceneStartSimHandler);
|
||||
}
|
||||
sceneInterface->EnableSimulationOfBody(m_sceneOwner, m_bodyHandle);
|
||||
}
|
||||
|
||||
@@ -225,6 +237,7 @@ namespace PhysX
|
||||
|
||||
if (auto* sceneInterface = AZ::Interface<AzPhysics::SceneInterface>::Get())
|
||||
{
|
||||
AZStd::scoped_lock lock(m_sceneEventMutex);
|
||||
sceneInterface->RegisterSceneSimulationStartHandler(m_sceneOwner, m_sceneStartSimHandler);
|
||||
}
|
||||
|
||||
@@ -244,7 +257,10 @@ namespace PhysX
|
||||
return;
|
||||
}
|
||||
|
||||
m_sceneStartSimHandler.Disconnect();
|
||||
{
|
||||
AZStd::scoped_lock lock(m_sceneEventMutex);
|
||||
m_sceneStartSimHandler.Disconnect();
|
||||
}
|
||||
|
||||
physx::PxScene* pxScene = Internal::GetPxScene(m_sceneOwner);
|
||||
const size_t numNodes = m_nodes.size();
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/std/parallel/mutex.h>
|
||||
#include <AzFramework/Physics/RagdollPhysicsBus.h>
|
||||
#include <AzFramework/Physics/Ragdoll.h>
|
||||
#include <AzFramework/Physics/Common/PhysicsEvents.h>
|
||||
@@ -84,5 +85,6 @@ namespace PhysX
|
||||
bool m_queuedDisableSimulation = false;
|
||||
|
||||
AzPhysics::SceneEvents::OnSceneSimulationStartHandler m_sceneStartSimHandler;
|
||||
static AZStd::mutex m_sceneEventMutex;
|
||||
};
|
||||
} // namespace PhysX
|
||||
|
||||
@@ -3356,23 +3356,27 @@ namespace ScriptCanvas
|
||||
|
||||
if (executionIf->GetId().m_node->IsIfBranchPrefacedWithBooleanExpression())
|
||||
{
|
||||
auto removeChildOutcome = RemoveChild(executionIf->ModParent(), executionIf);
|
||||
if (!removeChildOutcome.IsSuccess())
|
||||
ExecutionTreePtr booleanExpression;
|
||||
|
||||
{
|
||||
AddError(executionIf->GetNodeId(), executionIf, ScriptCanvas::ParseErrors::FailedToRemoveChild);
|
||||
auto removeChildOutcome = RemoveChild(executionIf->ModParent(), executionIf);
|
||||
if (!removeChildOutcome.IsSuccess())
|
||||
{
|
||||
AddError(executionIf->GetNodeId(), executionIf, ScriptCanvas::ParseErrors::FailedToRemoveChild);
|
||||
}
|
||||
|
||||
if (!IsErrorFree())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const auto indexAndChild = removeChildOutcome.TakeValue();
|
||||
|
||||
booleanExpression = CreateChild(executionIf->ModParent(), executionIf->GetId().m_node, executionIf->GetId().m_slot);
|
||||
executionIf->ModParent()->InsertChild(indexAndChild.first, { indexAndChild.second.m_slot, indexAndChild.second.m_output, booleanExpression });
|
||||
executionIf->SetParent(booleanExpression);
|
||||
}
|
||||
|
||||
if (!IsErrorFree())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const auto indexAndChild = removeChildOutcome.TakeValue();
|
||||
|
||||
ExecutionTreePtr booleanExpression = CreateChild(executionIf->ModParent(), executionIf->GetId().m_node, executionIf->GetId().m_slot);
|
||||
executionIf->ModParent()->InsertChild(indexAndChild.first, { indexAndChild.second.m_slot, indexAndChild.second.m_output, booleanExpression });
|
||||
executionIf->SetParent(booleanExpression);
|
||||
|
||||
// make a condition here
|
||||
auto symbol = CheckLogicalExpressionSymbol(booleanExpression);
|
||||
if (symbol != Symbol::FunctionCall && symbol != Symbol::Count)
|
||||
@@ -3402,7 +3406,7 @@ namespace ScriptCanvas
|
||||
return;
|
||||
}
|
||||
|
||||
const auto indexAndChild2 = removeChildOutcome.TakeValue();
|
||||
const auto indexAndChild2 = removeChildOutcome2.TakeValue();
|
||||
|
||||
// parse if statement internal function
|
||||
ExecutionTreePtr internalFunction = CreateChild(booleanExpression->ModParent(), booleanExpression->GetId().m_node, booleanExpression->GetId().m_slot);
|
||||
@@ -4782,7 +4786,7 @@ namespace ScriptCanvas
|
||||
{
|
||||
PropertyExtractionPtr extraction = AZStd::make_shared<PropertyExtraction>();
|
||||
extraction->m_slot = slot;
|
||||
extraction->m_name = propertyField.first;
|
||||
extraction->m_name = AZ::ReplaceCppArtifacts(propertyField.first);
|
||||
execution->AddPropertyExtractionSource(slot, extraction);
|
||||
}
|
||||
else
|
||||
|
||||
+2499
File diff suppressed because it is too large
Load Diff
@@ -90,6 +90,11 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(ScriptCanvasTestFixture, ParseFunctionIfBranchWithConnectedInput)
|
||||
{
|
||||
RunUnitTestGraph("LY_SC_UnitTest_ParseFunctionIfBranchWithConnectedInput");
|
||||
}
|
||||
|
||||
TEST_F(ScriptCanvasTestFixture, UseRawBehaviorProperties)
|
||||
{
|
||||
RunUnitTestGraph("LY_SC_UnitTest_UseRawBehaviorProperties");
|
||||
|
||||
Reference in New Issue
Block a user