Merge branch 'development' of https://github.com/o3de/o3de into carlitosan/development

This commit is contained in:
chcurran
2021-07-15 11:56:28 -07:00
44 changed files with 581 additions and 460 deletions
@@ -157,8 +157,11 @@ ScriptContextDebug::EnumRegisteredClasses(EnumClass enumClass, EnumMethod enumMe
lua_pop(l, 2); // pop the Class name and behaviorClass
lua_pushnil(l);
// iterate over the key/value pairs
while (lua_next(l, -2) != 0)
{
// if key: string value: function
if (lua_isstring(l, -2) && lua_isfunction(l, -1))
{
const char* name = lua_tostring(l, -2);
@@ -167,6 +170,7 @@ ScriptContextDebug::EnumRegisteredClasses(EnumClass enumClass, EnumMethod enumMe
bool isRead = true;
bool isWrite = true;
// check if there is a getter provided
lua_getupvalue(l, -1, 1);
if (lua_isnil(l, -1))
{
@@ -174,6 +178,7 @@ ScriptContextDebug::EnumRegisteredClasses(EnumClass enumClass, EnumMethod enumMe
}
lua_pop(l, 1);
// check if there is a setter provided
lua_getupvalue(l, -1, 2);
if (lua_isnil(l, -1))
{
@@ -181,6 +186,7 @@ ScriptContextDebug::EnumRegisteredClasses(EnumClass enumClass, EnumMethod enumMe
}
lua_pop(l, 1);
// enumerate the remaining property
if (!enumProperty(&behaviorClass->m_typeId, name, isRead, isWrite, userData))
{
lua_pop(l, 5);
@@ -189,21 +195,30 @@ ScriptContextDebug::EnumRegisteredClasses(EnumClass enumClass, EnumMethod enumMe
}
else
{
// for any non-built in methods
if (strncmp(name, "__", 2) != 0)
{
const char* dbgParamInfo = NULL;
lua_getupvalue(l, -1, 2);
// attempt to get the name
bool popDebugName = lua_getupvalue(l, -1, 2) != nullptr;
if (lua_isstring(l, -1))
{
dbgParamInfo = lua_tostring(l, -1);
}
// enumerate the method's parameters
if (!enumMethod(&behaviorClass->m_typeId, name, dbgParamInfo, userData))
{
lua_pop(l, 6);
return;
}
lua_pop(l, 1); // pop the DBG name
// if we were able to get the name, pop it from the stack
if (popDebugName)
{
lua_pop(l, 1);
}
}
}
}
@@ -205,6 +205,25 @@ namespace AzFramework
class InputDeviceImplementationRequest : public AZ::EBusTraits
{
public:
////////////////////////////////////////////////////////////////////////////////////////////
//! EBus Trait: requests can be addressed to a specific InputDeviceId so that they are only
//! handled by one input device that has connected to the bus using that unique id, or they
//! can be broadcast to all input devices that have connected to the bus, regardless of id.
//! Connected input devices are ordered by their local player index from lowest to highest.
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ByIdAndOrdered;
////////////////////////////////////////////////////////////////////////////////////////////
//! EBus Trait: requests should be handled by only one input device connected to each id
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
////////////////////////////////////////////////////////////////////////////////////////////
//! EBus Trait: requests can be addressed to a specific InputDeviceId
using BusIdType = InputDeviceId;
////////////////////////////////////////////////////////////////////////////////////////////
//! EBus Trait: requests are handled by connected devices in the order of local player index
using BusIdOrderCompare = AZStd::less<BusIdType>;
////////////////////////////////////////////////////////////////////////////////////////////
//! Alias for the EBus implementation of this interface
using Bus = AZ::EBus<InputDeviceImplementationRequest<InputDeviceType>>;
@@ -214,11 +233,12 @@ namespace AzFramework
using CreateFunctionType = typename InputDeviceType::Implementation*(*)(InputDeviceType&);
////////////////////////////////////////////////////////////////////////////////////////////
//! Create a custom implementation for all the existing instances of this input device type.
//! Set a custom implementation for this input device type, either for a specific instance
//! by addressing the call to an InputDeviceId, or for all existing instances by broadcast.
//! Passing InputDeviceType::Implementation::Create as the argument will create the default
//! device implementation, while passing nullptr will delete any existing implementation.
//! \param[in] createFunction Pointer to the function that will create the implementation.
virtual void CreateCustomImplementation(CreateFunctionType createFunction) = 0;
virtual void SetCustomImplementation(CreateFunctionType createFunction) = 0;
};
////////////////////////////////////////////////////////////////////////////////////////////////
@@ -238,7 +258,7 @@ namespace AzFramework
AZ_INLINE InputDeviceImplementationRequestHandler(InputDeviceType& inputDevice)
: m_inputDevice(inputDevice)
{
InputDeviceImplementationRequest<InputDeviceType>::Bus::Handler::BusConnect();
InputDeviceImplementationRequest<InputDeviceType>::Bus::Handler::BusConnect(m_inputDevice.GetInputDeviceId());
}
////////////////////////////////////////////////////////////////////////////////////////////
@@ -251,8 +271,8 @@ namespace AzFramework
using CreateFunctionType = typename InputDeviceType::Implementation*(*)(InputDeviceType&);
////////////////////////////////////////////////////////////////////////////////////////////
//! \ref InputDeviceImplementationRequest<InputDeviceType>::CreateCustomImplementation
AZ_INLINE void CreateCustomImplementation(CreateFunctionType createFunction) override
//! \ref InputDeviceImplementationRequest<InputDeviceType>::SetCustomImplementation
AZ_INLINE void SetCustomImplementation(CreateFunctionType createFunction) override
{
AZStd::unique_ptr<typename InputDeviceType::Implementation> newImplementation;
if (createFunction)