@@ -139,6 +139,24 @@ VariantType::VariantType(const StringAnsiView& typeName)
|
||||
return;
|
||||
}
|
||||
}
|
||||
{
|
||||
// Aliases
|
||||
if (typeName == "FlaxEngine.Vector2")
|
||||
{
|
||||
new(this) VariantType(Vector2);
|
||||
return;
|
||||
}
|
||||
if (typeName == "FlaxEngine.Vector3")
|
||||
{
|
||||
new(this) VariantType(Vector3);
|
||||
return;
|
||||
}
|
||||
if (typeName == "FlaxEngine.Vector4")
|
||||
{
|
||||
new(this) VariantType(Vector4);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Check case for array
|
||||
if (typeName.EndsWith(StringAnsiView("[]"), StringSearchCase::CaseSensitive))
|
||||
|
||||
@@ -685,9 +685,9 @@ void VisjectExecutor::ProcessGroupPacking(Box* box, Node* node, Value& value)
|
||||
case 36:
|
||||
{
|
||||
// Get value with structure data
|
||||
Variant structureValue = eatBox(node, node->GetBox(0)->FirstConnection());
|
||||
if (!node->GetBox(0)->HasConnection())
|
||||
return;
|
||||
Variant structureValue = eatBox(node, node->GetBox(0)->FirstConnection());
|
||||
|
||||
// Find type
|
||||
const StringView typeName(node->Values[0]);
|
||||
@@ -741,6 +741,12 @@ void VisjectExecutor::ProcessGroupPacking(Box* box, Node* node, Value& value)
|
||||
return;
|
||||
}
|
||||
const ScriptingType& type = typeHandle.GetType();
|
||||
if (structureValue.Type.Type != VariantType::Structure) // If structureValue is eg. Float we can try to cast it to a required structure type
|
||||
{
|
||||
VariantType typeVariantType(typeNameAnsiView);
|
||||
if (Variant::CanCast(structureValue, typeVariantType))
|
||||
structureValue = Variant::Cast(structureValue, typeVariantType);
|
||||
}
|
||||
structureValue.InvertInline(); // Extract any Float3/Int32 into Structure type from inlined format
|
||||
const ScriptingTypeHandle structureValueTypeHandle = Scripting::FindScriptingType(structureValue.Type.GetTypeName());
|
||||
if (structureValue.Type.Type != VariantType::Structure || typeHandle != structureValueTypeHandle)
|
||||
|
||||
Reference in New Issue
Block a user