Script Canvas, replace the text replacement system to a JSON file based one (#5228)

It is now possible to right click on nodes on the node palette to navigate to the file that holds the text data for any given node, this way it is easy to update and improve the naming of titles, subtitles, categories, tool tips and slots.
This commit is contained in:
Luis Sempé
2021-11-11 11:53:51 -08:00
committed by GitHub
parent 9d93282e42
commit 9e2a3226fd
1382 changed files with 209123 additions and 1515 deletions
@@ -13,6 +13,7 @@
#include <ScriptCanvas/Core/Contracts/MethodOverloadContract.h>
#include <ScriptCanvas/Libraries/Core/Method.h>
#include "../../GraphCanvas/Code/Source/Translation/TranslationBus.h"
namespace ScriptCanvas
{
@@ -55,7 +56,19 @@ namespace ScriptCanvas
{
const Data::Type outputType = (unpackedTypes.size() == 1 && AZ::BehaviorContextHelper::IsStringParameter(*result)) ? Data::Type::String() : Data::FromAZType(unpackedTypes[resultIndex]);
const AZStd::string resultSlotName(AZStd::string::format("Result: %s", Data::GetName(outputType).data()));
AZStd::string resultSlotName(AZStd::string::format("Result: %s", Data::GetName(outputType).data()));
GraphCanvas::TranslationKey key;
key << "BehaviorClass" << *outputConfig.config.m_className << "methods" << *outputConfig.config.m_lookupName << "results" << resultIndex << "details";
GraphCanvas::TranslationRequests::Details details;
GraphCanvas::TranslationRequestBus::BroadcastResult(details, &GraphCanvas::TranslationRequests::GetDetails, key, details);
if (!details.m_name.empty())
{
resultSlotName = details.m_name;
}
SlotId addedSlotId;
if (outputConfig.isReturnValueOverloaded)
@@ -1160,8 +1160,8 @@ namespace ScriptCanvas
if (!slot->IsDynamicSlot() || slot->HasDisplayType())
{
InitializeVariableReference((*slot), {});
}
}
}
}
else
{
ModifiableDatumView datumView;
@@ -2391,7 +2391,8 @@ namespace ScriptCanvas
if (variableIds.count(variableId) > 0)
{
InitializeVariableReference(slot, variableIds);
slot.ClearVariableReference();
NodeNotificationsBus::Event(GetEntityId(), &NodeNotifications::OnSlotInputChanged, slot.GetId());
}
}
@@ -886,6 +886,8 @@ protected:
// The SlotIterator& parameter is populated with an iterator to the inserted or found slot within the slot list
AZ::Outcome<SlotIdIteratorMap::iterator, AZStd::string> FindOrInsertSlot(AZ::s64 index, const SlotConfiguration& slotConfig, SlotIterator& iterOut);
public:
// This function is only called once, when the node is added to a graph, as opposed to Init(), which will be called
// soon after construction, or after deserialization. So the functionality in configure does not need to be idempotent.
void Configure();
@@ -94,7 +94,7 @@ namespace ScriptCanvas
}\
\
static const char* GetDependency() { return CATEGORY; }\
static const char* GetCategory() { if (ISDEPRECATED) return AZ_STRINGIZE(CATEGORY /Deprecated); else return CATEGORY; };\
static const char* GetCategory() { if (IsDeprecated()) return "Deprecated"; else return CATEGORY; };\
static const char* GetDescription() { return DESCRIPTION; };\
static const char* GetNodeName() { return #NODE_NAME; };\
static bool IsDeprecated() { return ISDEPRECATED; };\
@@ -25,6 +25,7 @@ namespace ScriptCanvas
GetterFunction m_getterFunction;
Data::Type m_propertyType;
AZStd::string m_propertyName;
AZStd::string m_displayName;
};
using GetterContainer = AZStd::unordered_map<AZStd::string, GetterWrapper>;
@@ -35,6 +36,7 @@ namespace ScriptCanvas
SetterFunction m_setterFunction;
Data::Type m_propertyType;
AZStd::string m_propertyName;
AZStd::string m_displayName;
};
using SetterContainer = AZStd::unordered_map<AZStd::string, SetterWrapper>;
@@ -84,7 +86,7 @@ namespace ScriptCanvas
using PropertyType = AZStd::decay_t<AZStd::invoke_result_t<FunctionType, GetterType>>;
static_assert(!AZStd::is_void<PropertyType>::value, "Getter function must return a non-void type");
static GetterWrapper Callback(AZStd::string_view propertyName, const FunctionType& propertyGetter)
static GetterWrapper Callback(AZStd::string_view propertyName, const FunctionType& propertyGetter, AZStd::string_view displayName)
{
GetterFunction getterWrapper = [propertyGetter](const Datum& thisDatum) -> AZ::Outcome<Datum, AZStd::string>
{
@@ -97,7 +99,7 @@ namespace ScriptCanvas
return AZ::Success(Datum(AZStd::invoke(propertyGetter, thisObject)));
};
return { getterWrapper, Data::FromAZType<PropertyType>(), propertyName };
return { getterWrapper, Data::FromAZType<PropertyType>(), propertyName, displayName };
}
};
@@ -107,7 +109,7 @@ namespace ScriptCanvas
static_assert(!AZStd::is_void<SetterType>::value, "Setter function must be either a member function pointer that accepts 1 arguments or an invokable object that accepts 2 argument");
static_assert(!AZStd::is_void<PropertyType>::value, "Property being set must be a non-void type");
static SetterWrapper Callback(AZStd::string_view propertyName, const FunctionType& propertySetter)
static SetterWrapper Callback(AZStd::string_view propertyName, const FunctionType& propertySetter, AZStd::string_view displayName)
{
SetterFunction setterWrapper = [propertySetter](Datum& thisDatum, const Datum& propertyDatum) -> AZ::Outcome<void, AZStd::string>
{
@@ -128,7 +130,7 @@ namespace ScriptCanvas
return AZ::Success();
};
return { setterWrapper, Data::FromAZType<PropertyType>(), propertyName };
return { setterWrapper, Data::FromAZType<PropertyType>(), propertyName, displayName };
}
};
}
@@ -178,20 +180,20 @@ namespace ScriptCanvas
static GetterContainer GetGetterWrappers(const Data::Type&)
{
GetterContainer getterFunctions;
getterFunctions.emplace("x", WrapGetter<decltype(&Data::QuaternionType::GetX)>::Callback("x", &Data::QuaternionType::GetX));
getterFunctions.emplace("y", WrapGetter<decltype(&Data::QuaternionType::GetY)>::Callback("y", &Data::QuaternionType::GetY));
getterFunctions.emplace("z", WrapGetter<decltype(&Data::QuaternionType::GetZ)>::Callback("z", &Data::QuaternionType::GetZ));
getterFunctions.emplace("w", WrapGetter<decltype(&Data::QuaternionType::GetW)>::Callback("w", &Data::QuaternionType::GetW));
getterFunctions.emplace("x", WrapGetter<decltype(&Data::QuaternionType::GetX)>::Callback("x", &Data::QuaternionType::GetX, "X"));
getterFunctions.emplace("y", WrapGetter<decltype(&Data::QuaternionType::GetY)>::Callback("y", &Data::QuaternionType::GetY, "Y"));
getterFunctions.emplace("z", WrapGetter<decltype(&Data::QuaternionType::GetZ)>::Callback("z", &Data::QuaternionType::GetZ, "Z"));
getterFunctions.emplace("w", WrapGetter<decltype(&Data::QuaternionType::GetW)>::Callback("w", &Data::QuaternionType::GetW, "W"));
return getterFunctions;
}
static SetterContainer GetSetterWrappers(const Data::Type&)
{
SetterContainer setterFunctions;
setterFunctions.emplace("x", WrapSetter<decltype(&Data::QuaternionType::SetX)>::Callback("x", &Data::QuaternionType::SetX));
setterFunctions.emplace("y", WrapSetter<decltype(&Data::QuaternionType::SetY)>::Callback("y", &Data::QuaternionType::SetY));
setterFunctions.emplace("z", WrapSetter<decltype(&Data::QuaternionType::SetZ)>::Callback("z", &Data::QuaternionType::SetZ));
setterFunctions.emplace("w", WrapSetter<decltype(&Data::QuaternionType::SetW)>::Callback("w", &Data::QuaternionType::SetW));
setterFunctions.emplace("x", WrapSetter<decltype(&Data::QuaternionType::SetX)>::Callback("x", &Data::QuaternionType::SetX, "X"));
setterFunctions.emplace("y", WrapSetter<decltype(&Data::QuaternionType::SetY)>::Callback("y", &Data::QuaternionType::SetY, "Y"));
setterFunctions.emplace("z", WrapSetter<decltype(&Data::QuaternionType::SetZ)>::Callback("z", &Data::QuaternionType::SetZ, "Z"));
setterFunctions.emplace("w", WrapSetter<decltype(&Data::QuaternionType::SetW)>::Callback("w", &Data::QuaternionType::SetW, "W"));
return setterFunctions;
}
};
@@ -202,16 +204,16 @@ namespace ScriptCanvas
static GetterContainer GetGetterWrappers(const Data::Type&)
{
GetterContainer getterFunctions;
getterFunctions.emplace("x", WrapGetter<decltype(&Data::Vector2Type::GetX)>::Callback("x", &Data::Vector2Type::GetX));
getterFunctions.emplace("y", WrapGetter<decltype(&Data::Vector2Type::GetY)>::Callback("y", &Data::Vector2Type::GetY));
getterFunctions.emplace("x", WrapGetter<decltype(&Data::Vector2Type::GetX)>::Callback("x", &Data::Vector2Type::GetX, "X"));
getterFunctions.emplace("y", WrapGetter<decltype(&Data::Vector2Type::GetY)>::Callback("y", &Data::Vector2Type::GetY, "Y"));
return getterFunctions;
}
static SetterContainer GetSetterWrappers(const Data::Type&)
{
SetterContainer setterFunctions;
setterFunctions.emplace("x", WrapSetter<decltype(&Data::Vector2Type::SetX)>::Callback("x", &Data::Vector2Type::SetX));
setterFunctions.emplace("y", WrapSetter<decltype(&Data::Vector2Type::SetY)>::Callback("y", &Data::Vector2Type::SetY));
setterFunctions.emplace("x", WrapSetter<decltype(&Data::Vector2Type::SetX)>::Callback("x", &Data::Vector2Type::SetX, "X"));
setterFunctions.emplace("y", WrapSetter<decltype(&Data::Vector2Type::SetY)>::Callback("y", &Data::Vector2Type::SetY, "Y"));
return setterFunctions;
}
};
@@ -222,18 +224,18 @@ namespace ScriptCanvas
static GetterContainer GetGetterWrappers(const Data::Type&)
{
GetterContainer getterFunctions;
getterFunctions.emplace("x", WrapGetter<decltype(&Data::Vector3Type::GetX)>::Callback("x", &Data::Vector3Type::GetX));
getterFunctions.emplace("y", WrapGetter<decltype(&Data::Vector3Type::GetY)>::Callback("y", &Data::Vector3Type::GetY));
getterFunctions.emplace("z", WrapGetter<decltype(&Data::Vector3Type::GetZ)>::Callback("z", &Data::Vector3Type::GetZ));
getterFunctions.emplace("x", WrapGetter<decltype(&Data::Vector3Type::GetX)>::Callback("x", &Data::Vector3Type::GetX, "X"));
getterFunctions.emplace("y", WrapGetter<decltype(&Data::Vector3Type::GetY)>::Callback("y", &Data::Vector3Type::GetY, "Y"));
getterFunctions.emplace("z", WrapGetter<decltype(&Data::Vector3Type::GetZ)>::Callback("z", &Data::Vector3Type::GetZ, "Z"));
return getterFunctions;
}
static SetterContainer GetSetterWrappers(const Data::Type&)
{
SetterContainer setterFunctions;
setterFunctions.emplace("x", WrapSetter<decltype(&Data::Vector3Type::SetX)>::Callback("x", &Data::Vector3Type::SetX));
setterFunctions.emplace("y", WrapSetter<decltype(&Data::Vector3Type::SetY)>::Callback("y", &Data::Vector3Type::SetY));
setterFunctions.emplace("z", WrapSetter<decltype(&Data::Vector3Type::SetZ)>::Callback("z", &Data::Vector3Type::SetZ));
setterFunctions.emplace("x", WrapSetter<decltype(&Data::Vector3Type::SetX)>::Callback("x", &Data::Vector3Type::SetX, "X"));
setterFunctions.emplace("y", WrapSetter<decltype(&Data::Vector3Type::SetY)>::Callback("y", &Data::Vector3Type::SetY, "Y"));
setterFunctions.emplace("z", WrapSetter<decltype(&Data::Vector3Type::SetZ)>::Callback("z", &Data::Vector3Type::SetZ, "Z"));
return setterFunctions;
}
};
@@ -244,20 +246,20 @@ namespace ScriptCanvas
static GetterContainer GetGetterWrappers(const Data::Type&)
{
GetterContainer getterFunctions;
getterFunctions.emplace("x", WrapGetter<decltype(&Data::Vector4Type::GetX)>::Callback("x", &Data::Vector4Type::GetX));
getterFunctions.emplace("y", WrapGetter<decltype(&Data::Vector4Type::GetY)>::Callback("y", &Data::Vector4Type::GetY));
getterFunctions.emplace("z", WrapGetter<decltype(&Data::Vector4Type::GetZ)>::Callback("z", &Data::Vector4Type::GetZ));
getterFunctions.emplace("w", WrapGetter<decltype(&Data::Vector4Type::GetW)>::Callback("w", &Data::Vector4Type::GetW));
getterFunctions.emplace("x", WrapGetter<decltype(&Data::Vector4Type::GetX)>::Callback("x", &Data::Vector4Type::GetX, "X"));
getterFunctions.emplace("y", WrapGetter<decltype(&Data::Vector4Type::GetY)>::Callback("y", &Data::Vector4Type::GetY, "Y"));
getterFunctions.emplace("z", WrapGetter<decltype(&Data::Vector4Type::GetZ)>::Callback("z", &Data::Vector4Type::GetZ, "Z"));
getterFunctions.emplace("w", WrapGetter<decltype(&Data::Vector4Type::GetW)>::Callback("w", &Data::Vector4Type::GetW, "W"));
return getterFunctions;
}
static SetterContainer GetSetterWrappers(const Data::Type&)
{
SetterContainer setterFunctions;
setterFunctions.emplace("x", WrapSetter<decltype(&Data::Vector4Type::SetX)>::Callback("x", &Data::Vector4Type::SetX));
setterFunctions.emplace("y", WrapSetter<decltype(&Data::Vector4Type::SetY)>::Callback("y", &Data::Vector4Type::SetY));
setterFunctions.emplace("z", WrapSetter<decltype(&Data::Vector4Type::SetZ)>::Callback("z", &Data::Vector4Type::SetZ));
setterFunctions.emplace("w", WrapSetter<decltype(&Data::Vector4Type::SetW)>::Callback("w", &Data::Vector4Type::SetW));
setterFunctions.emplace("x", WrapSetter<decltype(&Data::Vector4Type::SetX)>::Callback("x", &Data::Vector4Type::SetX, "X"));
setterFunctions.emplace("y", WrapSetter<decltype(&Data::Vector4Type::SetY)>::Callback("y", &Data::Vector4Type::SetY, "Y"));
setterFunctions.emplace("z", WrapSetter<decltype(&Data::Vector4Type::SetZ)>::Callback("z", &Data::Vector4Type::SetZ, "Z"));
setterFunctions.emplace("w", WrapSetter<decltype(&Data::Vector4Type::SetW)>::Callback("w", &Data::Vector4Type::SetW, "W"));
return setterFunctions;
}
};
@@ -268,20 +270,20 @@ namespace ScriptCanvas
static GetterContainer GetGetterWrappers(const Data::Type&)
{
GetterContainer getterFunctions;
getterFunctions.emplace("r", WrapGetter<decltype(&Data::ColorType::GetR)>::Callback("r", &Data::ColorType::GetR));
getterFunctions.emplace("g", WrapGetter<decltype(&Data::ColorType::GetG)>::Callback("g", &Data::ColorType::GetG));
getterFunctions.emplace("b", WrapGetter<decltype(&Data::ColorType::GetB)>::Callback("b", &Data::ColorType::GetB));
getterFunctions.emplace("a", WrapGetter<decltype(&Data::ColorType::GetA)>::Callback("a", &Data::ColorType::GetA));
getterFunctions.emplace("r", WrapGetter<decltype(&Data::ColorType::GetR)>::Callback("r", &Data::ColorType::GetR, "Red"));
getterFunctions.emplace("g", WrapGetter<decltype(&Data::ColorType::GetG)>::Callback("g", &Data::ColorType::GetG, "Green"));
getterFunctions.emplace("b", WrapGetter<decltype(&Data::ColorType::GetB)>::Callback("b", &Data::ColorType::GetB, "Blue"));
getterFunctions.emplace("a", WrapGetter<decltype(&Data::ColorType::GetA)>::Callback("a", &Data::ColorType::GetA, "Alpha"));
return getterFunctions;
}
static SetterContainer GetSetterWrappers(const Data::Type&)
{
SetterContainer setterFunctions;
setterFunctions.emplace("r", WrapSetter<decltype(&Data::ColorType::SetR)>::Callback("r", &Data::ColorType::SetR));
setterFunctions.emplace("g", WrapSetter<decltype(&Data::ColorType::SetG)>::Callback("g", &Data::ColorType::SetG));
setterFunctions.emplace("b", WrapSetter<decltype(&Data::ColorType::SetB)>::Callback("b", &Data::ColorType::SetB));
setterFunctions.emplace("a", WrapSetter<decltype(&Data::ColorType::SetA)>::Callback("a", &Data::ColorType::SetA));
setterFunctions.emplace("r", WrapSetter<decltype(&Data::ColorType::SetR)>::Callback("r", &Data::ColorType::SetR, "Red"));
setterFunctions.emplace("g", WrapSetter<decltype(&Data::ColorType::SetG)>::Callback("g", &Data::ColorType::SetG, "Green"));
setterFunctions.emplace("b", WrapSetter<decltype(&Data::ColorType::SetB)>::Callback("b", &Data::ColorType::SetB, "Blue"));
setterFunctions.emplace("a", WrapSetter<decltype(&Data::ColorType::SetA)>::Callback("a", &Data::ColorType::SetA, "Alpha"));
return setterFunctions;
}
};
@@ -292,16 +294,16 @@ namespace ScriptCanvas
static GetterContainer GetGetterWrappers(const Data::Type&)
{
GetterContainer getterFunctions;
getterFunctions.emplace("normal", WrapGetter<decltype(&Data::PlaneType::GetNormal)>::Callback("normal", &Data::PlaneType::GetNormal));
getterFunctions.emplace("distance", WrapGetter<decltype(&Data::PlaneType::GetDistance)>::Callback("distance", &Data::PlaneType::GetDistance));
getterFunctions.emplace("mormal", WrapGetter<decltype(&Data::PlaneType::GetNormal)>::Callback("normal", &Data::PlaneType::GetNormal, "Normal"));
getterFunctions.emplace("distance", WrapGetter<decltype(&Data::PlaneType::GetDistance)>::Callback("distance", &Data::PlaneType::GetDistance, "Distance"));
return getterFunctions;
}
static SetterContainer GetSetterWrappers(const Data::Type&)
{
SetterContainer setterFunctions;
setterFunctions.emplace("normal", WrapSetter<decltype(&Data::PlaneType::SetNormal)>::Callback("normal", &Data::PlaneType::SetNormal));
setterFunctions.emplace("distance", WrapSetter<decltype(&Data::PlaneType::SetDistance)>::Callback("distance", &Data::PlaneType::SetDistance));
setterFunctions.emplace("normal", WrapSetter<decltype(&Data::PlaneType::SetNormal)>::Callback("normal", &Data::PlaneType::SetNormal, "Normal"));
setterFunctions.emplace("distance", WrapSetter<decltype(&Data::PlaneType::SetDistance)>::Callback("distance", &Data::PlaneType::SetDistance, "Distance"));
return setterFunctions;
}
};
@@ -312,17 +314,17 @@ namespace ScriptCanvas
static GetterContainer GetGetterWrappers(const Data::Type&)
{
GetterContainer getterFunctions;
getterFunctions.emplace("basisX", WrapGetter<decltype(&Data::TransformType::GetBasisX)>::Callback("basisX", &Data::TransformType::GetBasisX));
getterFunctions.emplace("basisY", WrapGetter<decltype(&Data::TransformType::GetBasisY)>::Callback("basisY", &Data::TransformType::GetBasisY));
getterFunctions.emplace("basisZ", WrapGetter<decltype(&Data::TransformType::GetBasisZ)>::Callback("basisZ", &Data::TransformType::GetBasisZ));
getterFunctions.emplace("translation", WrapGetter<decltype(&Data::TransformType::GetTranslation)>::Callback("translation", &Data::TransformType::GetTranslation));
getterFunctions.emplace("basisX", WrapGetter<decltype(&Data::TransformType::GetBasisX)>::Callback("basisX", &Data::TransformType::GetBasisX, "X Axis"));
getterFunctions.emplace("basisY", WrapGetter<decltype(&Data::TransformType::GetBasisY)>::Callback("basisY", &Data::TransformType::GetBasisY, "Y Axis"));
getterFunctions.emplace("basisZ", WrapGetter<decltype(&Data::TransformType::GetBasisZ)>::Callback("basisZ", &Data::TransformType::GetBasisZ, "Z Axis"));
getterFunctions.emplace("translation", WrapGetter<decltype(&Data::TransformType::GetTranslation)>::Callback("translation", &Data::TransformType::GetTranslation, "Translation"));
return getterFunctions;
}
static SetterContainer GetSetterWrappers(const Data::Type&)
{
SetterContainer setterFunctions;
setterFunctions.emplace("translation", WrapSetter<void(AZ::Transform::*)(const AZ::Vector3&)>::Callback("translation", &Data::TransformType::SetTranslation));
setterFunctions.emplace("translation", WrapSetter<void(AZ::Transform::*)(const AZ::Vector3&)>::Callback("translation", &Data::TransformType::SetTranslation, "Translation"));
return setterFunctions;
}
};
@@ -333,16 +335,16 @@ namespace ScriptCanvas
static GetterContainer GetGetterWrappers(const Data::Type&)
{
GetterContainer getterFunctions;
getterFunctions.emplace("min", WrapGetter<decltype(&Data::AABBType::GetMin)>::Callback("min", &Data::AABBType::GetMin));
getterFunctions.emplace("max", WrapGetter<decltype(&Data::AABBType::GetMax)>::Callback("max", &Data::AABBType::GetMax));
getterFunctions.emplace("min", WrapGetter<decltype(&Data::AABBType::GetMin)>::Callback("min", &Data::AABBType::GetMin, "Minimum"));
getterFunctions.emplace("max", WrapGetter<decltype(&Data::AABBType::GetMax)>::Callback("max", &Data::AABBType::GetMax, "Maximum"));
return getterFunctions;
}
static SetterContainer GetSetterWrappers(const Data::Type&)
{
SetterContainer setterFunctions;
setterFunctions.emplace("min", WrapSetter<decltype(&Data::AABBType::SetMin)>::Callback("min", &Data::AABBType::SetMin));
setterFunctions.emplace("max", WrapSetter<decltype(&Data::AABBType::SetMax)>::Callback("max", &Data::AABBType::SetMax));
setterFunctions.emplace("min", WrapSetter<decltype(&Data::AABBType::SetMin)>::Callback("min", &Data::AABBType::SetMin, "Minimum"));
setterFunctions.emplace("max", WrapSetter<decltype(&Data::AABBType::SetMax)>::Callback("max", &Data::AABBType::SetMax, "Maximum"));
return setterFunctions;
}
};
@@ -353,23 +355,23 @@ namespace ScriptCanvas
static GetterContainer GetGetterWrappers(const Data::Type&)
{
GetterContainer getterFunctions;
getterFunctions.emplace("axisX", WrapGetter<decltype(&Data::OBBType::GetAxisX)>::Callback("axisX", &Data::OBBType::GetAxisX));
getterFunctions.emplace("axisY", WrapGetter<decltype(&Data::OBBType::GetAxisY)>::Callback("axisY", &Data::OBBType::GetAxisY));
getterFunctions.emplace("axisZ", WrapGetter<decltype(&Data::OBBType::GetAxisZ)>::Callback("axisZ", &Data::OBBType::GetAxisZ));
getterFunctions.emplace("halfLengthX", WrapGetter<decltype(&Data::OBBType::GetHalfLengthX)>::Callback("halfLengthX", &Data::OBBType::GetHalfLengthX));
getterFunctions.emplace("halfLengthY", WrapGetter<decltype(&Data::OBBType::GetHalfLengthY)>::Callback("halfLengthY", &Data::OBBType::GetHalfLengthY));
getterFunctions.emplace("halfLengthZ", WrapGetter<decltype(&Data::OBBType::GetHalfLengthZ)>::Callback("halfLengthZ", &Data::OBBType::GetHalfLengthZ));
getterFunctions.emplace("position", WrapGetter<decltype(&Data::OBBType::GetPosition)>::Callback("position", &Data::OBBType::GetPosition));
getterFunctions.emplace("axisX", WrapGetter<decltype(&Data::OBBType::GetAxisX)>::Callback("axisX", &Data::OBBType::GetAxisX, "X Axis"));
getterFunctions.emplace("axisY", WrapGetter<decltype(&Data::OBBType::GetAxisY)>::Callback("axisY", &Data::OBBType::GetAxisY, "Y Axis"));
getterFunctions.emplace("Z Axis", WrapGetter<decltype(&Data::OBBType::GetAxisZ)>::Callback("axisZ", &Data::OBBType::GetAxisZ, "Z Axis"));
getterFunctions.emplace("halfLengthX", WrapGetter<decltype(&Data::OBBType::GetHalfLengthX)>::Callback("halfLengthX", &Data::OBBType::GetHalfLengthX, "Half Length X"));
getterFunctions.emplace("halfLengthY", WrapGetter<decltype(&Data::OBBType::GetHalfLengthY)>::Callback("halfLengthY", &Data::OBBType::GetHalfLengthY, "Half Length Y"));
getterFunctions.emplace("halfLengthZ", WrapGetter<decltype(&Data::OBBType::GetHalfLengthZ)>::Callback("halfLengthZ", &Data::OBBType::GetHalfLengthZ, "Half Length Z"));
getterFunctions.emplace("position", WrapGetter<decltype(&Data::OBBType::GetPosition)>::Callback("position", &Data::OBBType::GetPosition, "Position"));
return getterFunctions;
}
static SetterContainer GetSetterWrappers(const Data::Type&)
{
SetterContainer setterFunctions;
setterFunctions.emplace("halfLengthX", WrapSetter<decltype(&Data::OBBType::SetHalfLengthX)>::Callback("halfLengthX", &Data::OBBType::SetHalfLengthX));
setterFunctions.emplace("halfLengthY", WrapSetter<decltype(&Data::OBBType::SetHalfLengthY)>::Callback("halfLengthY", &Data::OBBType::SetHalfLengthY));
setterFunctions.emplace("halfLengthZ", WrapSetter<decltype(&Data::OBBType::SetHalfLengthZ)>::Callback("halfLengthZ", &Data::OBBType::SetHalfLengthZ));
setterFunctions.emplace("position", WrapSetter<decltype(&Data::OBBType::SetPosition)>::Callback("position", &Data::OBBType::SetPosition));
setterFunctions.emplace("halfLengthX", WrapSetter<decltype(&Data::OBBType::SetHalfLengthX)>::Callback("halfLengthX", &Data::OBBType::SetHalfLengthX, "Half Length X"));
setterFunctions.emplace("halfLengthY", WrapSetter<decltype(&Data::OBBType::SetHalfLengthY)>::Callback("halfLengthY", &Data::OBBType::SetHalfLengthY, "Half Length Y"));
setterFunctions.emplace("halfLengthZ", WrapSetter<decltype(&Data::OBBType::SetHalfLengthZ)>::Callback("halfLengthZ", &Data::OBBType::SetHalfLengthZ, "Half Length Z"));
setterFunctions.emplace("position", WrapSetter<decltype(&Data::OBBType::SetPosition)>::Callback("position", &Data::OBBType::SetPosition, "Position"));
return setterFunctions;
}
};
@@ -380,18 +382,18 @@ namespace ScriptCanvas
static GetterContainer GetGetterWrappers(const Data::Type&)
{
GetterContainer getterFunctions;
getterFunctions.emplace("basisX", WrapGetter<decltype(&Data::Matrix3x3Type::GetBasisX)>::Callback("basisX", &Data::Matrix3x3Type::GetBasisX));
getterFunctions.emplace("basisY", WrapGetter<decltype(&Data::Matrix3x3Type::GetBasisY)>::Callback("basisY", &Data::Matrix3x3Type::GetBasisY));
getterFunctions.emplace("basisZ", WrapGetter<decltype(&Data::Matrix3x3Type::GetBasisZ)>::Callback("basisZ", &Data::Matrix3x3Type::GetBasisZ));
getterFunctions.emplace("basisX", WrapGetter<decltype(&Data::Matrix3x3Type::GetBasisX)>::Callback("basisX", &Data::Matrix3x3Type::GetBasisX, "Position"));
getterFunctions.emplace("basisY", WrapGetter<decltype(&Data::Matrix3x3Type::GetBasisY)>::Callback("basisY", &Data::Matrix3x3Type::GetBasisY, "Position"));
getterFunctions.emplace("basisZ", WrapGetter<decltype(&Data::Matrix3x3Type::GetBasisZ)>::Callback("basisZ", &Data::Matrix3x3Type::GetBasisZ, "Position"));
return getterFunctions;
}
static SetterContainer GetSetterWrappers(const Data::Type&)
{
SetterContainer setterFunctions;
setterFunctions.emplace("basisX", WrapSetter<void(AZ::Matrix3x3::*)(const AZ::Vector3&)>::Callback("basisX", &Data::Matrix3x3Type::SetBasisX));
setterFunctions.emplace("basisY", WrapSetter<void(AZ::Matrix3x3::*)(const AZ::Vector3&)>::Callback("basisY", &Data::Matrix3x3Type::SetBasisY));
setterFunctions.emplace("basisZ", WrapSetter<void(AZ::Matrix3x3::*)(const AZ::Vector3&)>::Callback("basisZ", &Data::Matrix3x3Type::SetBasisZ));
setterFunctions.emplace("basisX", WrapSetter<void(AZ::Matrix3x3::*)(const AZ::Vector3&)>::Callback("basisX", &Data::Matrix3x3Type::SetBasisX, "X Axis"));
setterFunctions.emplace("basisY", WrapSetter<void(AZ::Matrix3x3::*)(const AZ::Vector3&)>::Callback("basisY", &Data::Matrix3x3Type::SetBasisY, "Y Axis"));
setterFunctions.emplace("basisZ", WrapSetter<void(AZ::Matrix3x3::*)(const AZ::Vector3&)>::Callback("basisZ", &Data::Matrix3x3Type::SetBasisZ, "Z Axis"));
return setterFunctions;
}
};
@@ -402,20 +404,20 @@ namespace ScriptCanvas
static GetterContainer GetGetterWrappers(const Data::Type&)
{
GetterContainer getterFunctions;
getterFunctions.emplace("basisX", WrapGetter<decltype(&Data::Matrix4x4Type::GetBasisX)>::Callback("basisX", &Data::Matrix4x4Type::GetBasisX));
getterFunctions.emplace("basisY", WrapGetter<decltype(&Data::Matrix4x4Type::GetBasisY)>::Callback("basisY", &Data::Matrix4x4Type::GetBasisY));
getterFunctions.emplace("basisZ", WrapGetter<decltype(&Data::Matrix4x4Type::GetBasisZ)>::Callback("basisZ", &Data::Matrix4x4Type::GetBasisZ));
getterFunctions.emplace("translation", WrapGetter<decltype(&Data::Matrix4x4Type::GetTranslation)>::Callback("translation", &Data::Matrix4x4Type::GetTranslation));
getterFunctions.emplace("basisX", WrapGetter<decltype(&Data::Matrix4x4Type::GetBasisX)>::Callback("basisX", &Data::Matrix4x4Type::GetBasisX, "X Axis"));
getterFunctions.emplace("basisY", WrapGetter<decltype(&Data::Matrix4x4Type::GetBasisY)>::Callback("basisY", &Data::Matrix4x4Type::GetBasisY, "Y Axis"));
getterFunctions.emplace("basisZ", WrapGetter<decltype(&Data::Matrix4x4Type::GetBasisZ)>::Callback("basisZ", &Data::Matrix4x4Type::GetBasisZ, "Z Axis"));
getterFunctions.emplace("Translation", WrapGetter<decltype(&Data::Matrix4x4Type::GetTranslation)>::Callback("translation", &Data::Matrix4x4Type::GetTranslation, "Translation"));
return getterFunctions;
}
static SetterContainer GetSetterWrappers(const Data::Type&)
{
SetterContainer setterFunctions;
setterFunctions.emplace("basisX", WrapSetter<void(AZ::Matrix4x4::*)(const AZ::Vector4&)>::Callback("basisX", &Data::Matrix4x4Type::SetBasisX));
setterFunctions.emplace("basisY", WrapSetter<void(AZ::Matrix4x4::*)(const AZ::Vector4&)>::Callback("basisY", &Data::Matrix4x4Type::SetBasisY));
setterFunctions.emplace("basisZ", WrapSetter<void(AZ::Matrix4x4::*)(const AZ::Vector4&)>::Callback("basisZ", &Data::Matrix4x4Type::SetBasisZ));
setterFunctions.emplace("translation", WrapSetter<void(AZ::Matrix4x4::*)(const AZ::Vector3&)>::Callback("translation", &Data::Matrix4x4Type::SetTranslation));
setterFunctions.emplace("basisX", WrapSetter<void(AZ::Matrix4x4::*)(const AZ::Vector4&)>::Callback("basisX", &Data::Matrix4x4Type::SetBasisX, "X Axis"));
setterFunctions.emplace("basisY", WrapSetter<void(AZ::Matrix4x4::*)(const AZ::Vector4&)>::Callback("basisY", &Data::Matrix4x4Type::SetBasisY, "Y Axis"));
setterFunctions.emplace("basisZ", WrapSetter<void(AZ::Matrix4x4::*)(const AZ::Vector4&)>::Callback("basisZ", &Data::Matrix4x4Type::SetBasisZ, "Z Axis"));
setterFunctions.emplace("translation", WrapSetter<void(AZ::Matrix4x4::*)(const AZ::Vector3&)>::Callback("translation", &Data::Matrix4x4Type::SetTranslation, "Translation"));
return setterFunctions;
}
};
@@ -132,7 +132,7 @@ namespace ScriptCanvas
void BooleanExpression::InitializeBooleanExpression()
{
AZ_Assert(false, "InitializeBooleanExpression must be overridden");
AZ_Error("Script Canvas", false, "InitializeBooleanExpression implementation should be provided");
}
void BooleanExpression::OnInit()
@@ -5,6 +5,7 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include <ScriptCanvas/Libraries/Core/ExtractProperty.h>
#include <Libraries/Core/MethodUtility.h>
@@ -183,6 +184,10 @@ namespace ScriptCanvas
DataSlotConfiguration config;
AZStd::string slotName = AZStd::string::format("%s: %s", propertyName.data(), Data::GetName(getterWrapper.m_propertyType).data());
if (!getterWrapper.m_displayName.empty())
{
slotName = getterWrapper.m_displayName;
}
if (existingSlots.find(slotName) == existingSlots.end())
{
@@ -193,7 +193,7 @@ namespace ScriptCanvas
{
DataSlotConfiguration slotConfiguration;
slotConfiguration.m_name = AZStd::string::format("%s: %s", propertyName.data(), Data::GetName(getterWrapper.m_propertyType).data());
slotConfiguration.m_name = (getterWrapper.m_displayName.empty()) ? propertyName.data() : getterWrapper.m_displayName;
slotConfiguration.SetType(getterWrapper.m_propertyType);
slotConfiguration.SetConnectionType(ConnectionType::Output);
@@ -294,7 +294,7 @@ namespace ScriptCanvas
{
DataSlotConfiguration slotConfiguration;
slotConfiguration.m_name = AZStd::string::format("%s: %s", propertyName.data(), Data::GetName(getterWrapper.m_propertyType).data());
slotConfiguration.m_name = (getterWrapper.m_displayName.empty()) ? propertyName.data() : getterWrapper.m_displayName;
slotConfiguration.SetType(getterWrapper.m_propertyType);
slotConfiguration.SetConnectionType(ConnectionType::Output);
@@ -21,7 +21,7 @@ namespace ScriptCanvas
namespace EntityNodes
{
using namespace Data;
static const char* k_categoryName = "Entity/Entity";
static constexpr const char* k_categoryName = "Entity/Entity";
template<int t_Index>
AZ_INLINE void DefaultScale(Node& node) { SetDefaultValuesByIndex<t_Index>::_(node, Data::One()); }
@@ -19,7 +19,7 @@ namespace ScriptCanvas
{
using namespace Data;
using namespace MathNodeUtilities;
static const char* k_categoryName = "Math/AABB";
static constexpr const char* k_categoryName = "Math/AABB";
AZ_INLINE AABBType AddAABB(AABBType a, const AABBType& b)
{
@@ -15,7 +15,7 @@ namespace ScriptCanvas
{
namespace CRCNodes
{
static const char* k_categoryName = "Math/Crc32";
static constexpr const char* k_categoryName = "Math/Crc32";
AZ_INLINE Data::CRCType FromString(Data::StringType value)
{
@@ -19,7 +19,7 @@ namespace ScriptCanvas
{
using namespace Data;
using namespace MathNodeUtilities;
static const char* k_categoryName = "Math/Color";
static constexpr const char* k_categoryName = "Math/Color";
AZ_INLINE ColorType Add(ColorType a, ColorType b)
{
@@ -14,7 +14,7 @@ namespace ScriptCanvas
{
namespace MathNodes
{
static const char* k_categoryName = "Math";
static constexpr const char* k_categoryName = "Math";
AZ_INLINE Data::NumberType MultiplyAndAdd(Data::NumberType multiplicand, Data::NumberType multiplier, Data::NumberType addend)
{
@@ -15,7 +15,7 @@ namespace ScriptCanvas
{
namespace RandomNodes
{
static const char* k_categoryName = "Math/Random";
static constexpr const char* k_categoryName = "Math/Random";
// RandomColor
AZ_INLINE void SetRandomColorDefaults(Node& node)
@@ -15,7 +15,7 @@ namespace ScriptCanvas
{
namespace Matrix3x3Nodes
{
static const char* k_categoryName = "Math/Matrix3x3";
static constexpr const char* k_categoryName = "Math/Matrix3x3";
AZ_INLINE Data::Matrix3x3Type Add(const Data::Matrix3x3Type& lhs, const Data::Matrix3x3Type& rhs)
{
@@ -14,7 +14,7 @@ namespace ScriptCanvas
{
namespace Matrix4x4Nodes
{
static const char* k_categoryName = "Math/Matrix4x4";
static constexpr const char* k_categoryName = "Math/Matrix4x4";
AZ_INLINE Data::Matrix4x4Type FromColumns(const Data::Vector4Type& col0, const Data::Vector4Type& col1, const Data::Vector4Type& col2, const Data::Vector4Type& col3)
{
@@ -19,7 +19,7 @@ namespace ScriptCanvas
{
using namespace Data;
using namespace MathNodeUtilities;
static const char* k_categoryName = "Math/OBB";
static constexpr const char* k_categoryName = "Math/OBB";
AZ_INLINE OBBType FromAabb(const AABBType& source)
{
@@ -19,7 +19,7 @@ namespace ScriptCanvas
{
using namespace Data;
using namespace MathNodeUtilities;
static const char* k_categoryName = "Math/Plane";
static constexpr const char* k_categoryName = "Math/Plane";
AZ_INLINE NumberType DistanceToPoint(PlaneType source, Vector3Type point)
{
@@ -20,7 +20,7 @@ namespace ScriptCanvas
{
using namespace Data;
using namespace MathNodeUtilities;
static const char* k_categoryName = "Math/Quaternion";
static constexpr const char* k_categoryName = "Math/Quaternion";
AZ_INLINE QuaternionType Add(QuaternionType a, QuaternionType b)
{
@@ -20,7 +20,7 @@ namespace ScriptCanvas
{
using namespace Data;
using namespace MathNodeUtilities;
static const char* k_categoryName = "Math/Transform";
static constexpr const char* k_categoryName = "Math/Transform";
AZ_INLINE std::tuple<NumberType, TransformType> ExtractUniformScale(TransformType source)
{
@@ -19,7 +19,7 @@ namespace ScriptCanvas
{
using namespace MathNodeUtilities;
using namespace Data;
static const char* k_categoryName = "Math/Vector2";
static constexpr const char* k_categoryName = "Math/Vector2";
AZ_INLINE Vector2Type Absolute(const Vector2Type source)
{
@@ -21,7 +21,7 @@ namespace ScriptCanvas
{
using namespace MathNodeUtilities;
using namespace Data;
static const char* k_categoryName = "Math/Vector3";
static constexpr const char* k_categoryName = "Math/Vector3";
AZ_INLINE Vector3Type Absolute(const Vector3Type source)
{
@@ -19,7 +19,7 @@ namespace ScriptCanvas
{
using namespace MathNodeUtilities;
using namespace Data;
static const char* k_categoryName = "Math/Vector4";
static constexpr const char* k_categoryName = "Math/Vector4";
AZ_INLINE Vector4Type Absolute(const Vector4Type source)
{
@@ -14,7 +14,7 @@ namespace ScriptCanvas
{
namespace StringNodes
{
static const char* k_categoryName = "String";
static constexpr const char* k_categoryName = "String";
AZ_INLINE Data::StringType ToLower(Data::StringType sourceString)
{