fix errors when generic nodes fail to add slots (#7508)

Signed-off-by: carlitosan <82187351+carlitosan@users.noreply.github.com>
monroegm-disable-blank-issue-2
carlitosan 4 years ago committed by GitHub
parent 8cd8638316
commit f74e980659
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1098,7 +1098,7 @@ protected:
slotConfiguration.SetType(Data::FromAZType<AZStd::decay_t<ResultType>>());
slotConfiguration.SetConnectionType(ConnectionType::Output);
node.AddSlot(slotConfiguration);
AZ_VerifyError("ScriptCanvas", node.AddSlot(slotConfiguration).IsValid(), "Node failed to add a required Data Out slot");
}
};
@ -1115,12 +1115,11 @@ protected:
static void CreateDataSlot(Node& node, ConnectionType connectionType)
{
DataSlotConfiguration slotConfiguration;
slotConfiguration.m_name = t_Traits::GetResultName(Index);
slotConfiguration.SetType(Data::FromAZType<AZStd::decay_t<AZStd::tuple_element_t<Index, ResultType>>>());
slotConfiguration.SetConnectionType(connectionType);
node.AddSlot(slotConfiguration);
AZ_VerifyError("ScriptCanvas", node.AddSlot(slotConfiguration).IsValid(), "Node failed to add a required Data Out slot");
}
template<AZStd::size_t... Is>

@ -82,15 +82,30 @@ namespace ScriptCanvas
static const size_t s_numNames = SCRIPT_CANVAS_FUNCTION_VAR_ARGS(__VA_ARGS__);\
/*static const size_t s_numResults = ScriptCanvas::Internal::extended_tuple_size<ResultType>::value;*/\
\
static const char* GetArgName(size_t i)\
static AZStd::string GetArgName(size_t i)\
{\
return GetName(i).data();\
AZStd::string_view argName = GetName(i);\
if (!argName.empty())\
{\
return argName;\
}\
else\
{\
return AZStd::string::format("Input [%zu]", i);\
}\
}\
\
static const char* GetResultName(size_t i)\
static AZStd::string GetResultName(size_t i)\
{\
AZStd::string_view result = GetName(i + s_numArgs);\
return !result.empty() ? result.data() : "Result";\
AZStd::string_view resultName = GetName(i + s_numArgs);\
if (!resultName.empty())\
{\
return resultName;\
}\
else\
{\
return AZStd::string::format("Result [%zu]", i);\
}\
}\
\
static const char* GetDependency() { return CATEGORY; }\
@ -260,7 +275,7 @@ namespace ScriptCanvas
slotConfiguration.ConfigureDatum(AZStd::move(Datum(Data::FromAZType(Data::Traits<ArgType>::GetAZType()), Datum::eOriginality::Copy)));
slotConfiguration.SetConnectionType(connectionType);
AddSlot(slotConfiguration);
AZ_VerifyError("ScriptCanvas", AddSlot(slotConfiguration).IsValid(), "NodeFunctionGenericMultiReturn failed to add a required data slot");
}
template<typename... t_Args, AZStd::size_t... Is>
@ -278,12 +293,12 @@ namespace ScriptCanvas
{
{
ExecutionSlotConfiguration slotConfiguration("In", ConnectionType::Input);
AddSlot(slotConfiguration);
AZ_VerifyError("ScriptCanvas", AddSlot(slotConfiguration).IsValid(), "NodeFunctionGenericMultiReturn failed to add a required Execution In slot");
}
{
ExecutionSlotConfiguration slotConfiguration("Out", ConnectionType::Output);
AddSlot(slotConfiguration);
AZ_VerifyError("ScriptCanvas", AddSlot(slotConfiguration).IsValid(), "NodeFunctionGenericMultiReturn failed to add a required Execution Out slot");
}
AddInputDatumSlotHelper(typename AZStd::function_traits<t_Func>::arg_sequence{}, AZStd::make_index_sequence<AZStd::function_traits<t_Func>::arity>{});

@ -257,7 +257,7 @@ namespace ScriptCanvas
r.SetLength(static_cast<float>(optionalScale));
return std::make_tuple(r, length);
}
SCRIPT_CANVAS_GENERIC_FUNCTION_NODE_WITH_DEFAULTS(DirectionTo, DirectionToDefaults, k_categoryName, "{49A2D7F6-6CD3-420E-8A79-D46B00DB6CED}", "Returns a direction vector between two points and the distance between them, by default the direction will be normalized, but it may be optionally scaled using the Scale parameter if different from 1.0", "From", "To", "Scale");
SCRIPT_CANVAS_GENERIC_FUNCTION_NODE_WITH_DEFAULTS(DirectionTo, DirectionToDefaults, k_categoryName, "{49A2D7F6-6CD3-420E-8A79-D46B00DB6CED}", "Returns a direction vector between two points and the distance between them, by default the direction will be normalized, but it may be optionally scaled using the Scale parameter if different from 1.0", "From", "To", "Scale", "Direction", "Length");
using Registrar = RegistrarGeneric <
AbsoluteNode

@ -343,8 +343,17 @@ namespace ScriptCanvas
r.SetLength(static_cast<float>(optionalScale));
return std::make_tuple(r, length);
}
SCRIPT_CANVAS_GENERIC_FUNCTION_NODE_WITH_DEFAULTS(DirectionTo, DirectionToDefaults, k_categoryName, "{28FBD529-4C9A-4E34-B8A0-A13B5DB3C331}", "Returns a direction vector between two points and the distance between them, by default the direction will be normalized, but it may be optionally scaled using the Scale parameter if different from 1.0", "From", "To", "Scale");
SCRIPT_CANVAS_GENERIC_FUNCTION_NODE_WITH_DEFAULTS
( DirectionTo
, DirectionToDefaults
, k_categoryName, "{28FBD529-4C9A-4E34-B8A0-A13B5DB3C331}"
, "Returns a direction vector between two points and the distance between them, by default the direction will be normalized, but it may be optionally scaled using the Scale parameter if different from 1.0"
, "From"
, "To"
, "Scale"
, "Direction"
, "Length");
using Registrar = RegistrarGeneric <
AbsoluteNode

@ -228,7 +228,7 @@ namespace ScriptCanvas
r.SetLength(static_cast<float>(optionalScale));
return std::make_tuple(r, length);
}
SCRIPT_CANVAS_GENERIC_FUNCTION_NODE_WITH_DEFAULTS(DirectionTo, DirectionToDefaults, k_categoryName, "{463762DE-E541-4AFE-80C2-FED1C5273319}", "Returns a direction vector between two points and the distance between them, by default the direction will be normalized, but it may be optionally scaled using the Scale parameter if different from 1.0", "From", "To", "Scale");
SCRIPT_CANVAS_GENERIC_FUNCTION_NODE_WITH_DEFAULTS(DirectionTo, DirectionToDefaults, k_categoryName, "{463762DE-E541-4AFE-80C2-FED1C5273319}", "Returns a direction vector between two points and the distance between them, by default the direction will be normalized, but it may be optionally scaled using the Scale parameter if different from 1.0", "From", "To", "Scale", "Direction", "Length");
using Registrar = RegistrarGeneric <
AbsoluteNode,

Loading…
Cancel
Save