diff --git a/Source/Editor/GUI/Timeline/ParticleSystemTimeline.cs b/Source/Editor/GUI/Timeline/ParticleSystemTimeline.cs
index 365eb58ca..40beeeaa0 100644
--- a/Source/Editor/GUI/Timeline/ParticleSystemTimeline.cs
+++ b/Source/Editor/GUI/Timeline/ParticleSystemTimeline.cs
@@ -201,10 +201,9 @@ namespace FlaxEditor.GUI.Timeline
var idx = stream.ReadInt32();
var id = stream.ReadGuid();
object value = null;
- if (version == 2)
- stream.ReadCommonValue(ref value);
- else
- value = stream.ReadVariant();
+ if (version <= 2)
+ throw new Exception("Not supported asset version. Open and re-save asset with Flax 1.11.");
+ value = stream.ReadVariant();
Emitters[idx].ParametersOverrides.Add(id, value);
}
diff --git a/Source/Editor/Surface/VisjectSurfaceContext.Serialization.cs b/Source/Editor/Surface/VisjectSurfaceContext.Serialization.cs
index ed19b937f..083086ba9 100644
--- a/Source/Editor/Surface/VisjectSurfaceContext.Serialization.cs
+++ b/Source/Editor/Surface/VisjectSurfaceContext.Serialization.cs
@@ -4,7 +4,6 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
-using FlaxEditor.Scripting;
using FlaxEditor.Surface.Elements;
using FlaxEditor.Utilities;
using FlaxEngine;
@@ -503,205 +502,8 @@ namespace FlaxEditor.Surface
var tmpHints = _cachedConnections.Value;
var guidBytes = new byte[16];
if (version < 7000)
- {
- // Time saved (not used anymore to prevent binary diffs after saving unmodified surface)
- stream.ReadInt64();
-
- // Nodes count
- int nodesCount = stream.ReadInt32();
- if (Nodes.Capacity < nodesCount)
- Nodes.Capacity = nodesCount;
- tmpHints.Clear();
- tmpHints.Capacity = Mathf.Max(tmpHints.Capacity, nodesCount * 4);
-
- // Parameters count
- int parametersCount = stream.ReadInt32();
- if (Parameters.Capacity < parametersCount)
- Parameters.Capacity = parametersCount;
-
- // For each node
- for (int i = 0; i < nodesCount; i++)
- {
- // ID
- uint id = stream.ReadUInt32();
-
- // Type
- ushort typeId = stream.ReadUInt16();
- ushort groupId = stream.ReadUInt16();
-
- // Create node
- SurfaceNode node;
- if (groupId == Archetypes.Custom.GroupID)
- node = new DummyCustomNode(id, this);
- else
- node = NodeFactory.CreateNode(nodeArchetypes, id, this, groupId, typeId);
- if (node == null)
- node = new MissingNode(id, this, groupId, typeId);
- Nodes.Add(node);
- }
-
- // For each param
- for (int i = 0; i < parametersCount; i++)
- {
- // Create param
- var param = new SurfaceParameter();
- Parameters.Add(param);
-
- // Properties
- param.Type = new ScriptType(GetGraphParameterValueType((GraphParamType_Deprecated)stream.ReadByte()));
- stream.Read(guidBytes, 0, 16);
- param.ID = new Guid(guidBytes);
- param.Name = stream.ReadStr(97);
- param.IsPublic = stream.ReadByte() != 0;
- bool isStatic = stream.ReadByte() != 0;
- bool isUIVisible = stream.ReadByte() != 0;
- bool isUIEditable = stream.ReadByte() != 0;
-
- // References [Deprecated]
- int refsCount = stream.ReadInt32();
- for (int j = 0; j < refsCount; j++)
- {
- uint refID = stream.ReadUInt32();
- }
-
- // Value
- stream.ReadCommonValue(ref param.Value);
-
- // Meta
- param.Meta.Load(stream);
- }
-
- // For each node
- for (int i = 0; i < nodesCount; i++)
- {
- var node = Nodes[i];
-
- int valuesCnt = stream.ReadInt32();
- int firstValueReadIdx = 0;
-
- // Special case for missing nodes
- if (node is DummyCustomNode customNode)
- {
- node = null;
-
- // Values check
- if (valuesCnt < 2)
- throw new Exception("Missing custom nodes data.");
-
- // Node typename check
- object typeNameValue = null;
- stream.ReadCommonValue(ref typeNameValue);
- firstValueReadIdx = 1;
- string typeName = typeNameValue as string ?? string.Empty;
-
- // Find custom node archetype that matches this node type (it must be unique)
- if (customNodes?.Archetypes != null && typeName.Length != 0)
- {
- NodeArchetype arch = null;
- foreach (var nodeArchetype in customNodes.Archetypes)
- {
- if (string.Equals(Archetypes.Custom.GetNodeTypeName(nodeArchetype), typeName, StringComparison.OrdinalIgnoreCase))
- {
- arch = nodeArchetype;
- break;
- }
- }
- if (arch != null)
- node = NodeFactory.CreateNode(customNode.ID, this, customNodes, arch);
- }
-
- // Fallback to the
- if (node == null)
- {
- Editor.LogWarning(string.Format("Cannot find custom node archetype for {0}", typeName));
- node = new MissingNode(customNode.ID, this, Archetypes.Custom.GroupID, customNode.Archetype.TypeID);
- }
- Nodes[i] = node;
-
- // Store node typename in values container
- node.Values[0] = typeName;
- }
- if (node is MissingNode)
- {
- // Read all values
- Array.Resize(ref node.Values, valuesCnt);
- for (int j = firstValueReadIdx; j < valuesCnt; j++)
- {
- // ReSharper disable once PossibleNullReferenceException
- stream.ReadCommonValue(ref node.Values[j]);
- }
- firstValueReadIdx = valuesCnt = node.Values.Length;
- }
-
- // Values
- int nodeValuesCnt = node.Values?.Length ?? 0;
- if (valuesCnt == nodeValuesCnt)
- {
- for (int j = firstValueReadIdx; j < valuesCnt; j++)
- {
- // ReSharper disable once PossibleNullReferenceException
- stream.ReadCommonValue(ref node.Values[j]);
- }
- }
- else if ((node.Archetype.Flags & NodeFlags.VariableValuesSize) != 0)
- {
- node.Values = new object[valuesCnt];
- for (int j = firstValueReadIdx; j < valuesCnt; j++)
- {
- // ReSharper disable once PossibleNullReferenceException
- stream.ReadCommonValue(ref node.Values[j]);
- }
- }
- else
- {
- Editor.LogWarning(string.Format("Invalid node values. Loaded: {0}, expected: {1}. Type: {2}, {3}", valuesCnt, nodeValuesCnt, node.Archetype.Title, node.Archetype.TypeID));
-
- object dummy = null;
- for (int j = firstValueReadIdx; j < valuesCnt; j++)
- {
- stream.ReadCommonValue(ref dummy);
-
- if (j < nodeValuesCnt &&
- dummy != null &&
- node.Values[j] != null &&
- node.Values[j].GetType() == dummy.GetType())
- {
- node.Values[j] = dummy;
- }
- }
- }
-
- // Boxes
- ushort boxesCount = stream.ReadUInt16();
- for (int j = 0; j < boxesCount; j++)
- {
- var id = stream.ReadByte();
- stream.ReadUInt32(); // Skip type
- ushort connectionsCnt = stream.ReadUInt16();
-
- ConnectionHint hint;
- hint.NodeB = node.ID;
- hint.BoxB = id;
-
- for (int k = 0; k < connectionsCnt; k++)
- {
- uint targetNodeID = stream.ReadUInt32();
- byte targetBoxID = stream.ReadByte();
-
- hint.NodeA = targetNodeID;
- hint.BoxA = targetBoxID;
-
- tmpHints.Add(hint);
- }
- }
-
- // Meta
- node.Meta.Load(stream);
-
- OnControlLoaded(node, SurfaceNodeActions.Load);
- }
- }
- else if (version == 7000)
+ throw new Exception("Not supported Visject Surface version. Open and re-save asset with Flax 1.11.");
+ if (version == 7000)
{
// Nodes count
int nodesCount = stream.ReadInt32();
diff --git a/Source/Editor/Utilities/Utils.cs b/Source/Editor/Utilities/Utils.cs
index d6d908f3f..62af28bc0 100644
--- a/Source/Editor/Utilities/Utils.cs
+++ b/Source/Editor/Utilities/Utils.cs
@@ -667,310 +667,6 @@ namespace FlaxEditor.Utilities
stream.Write(value.Size.Y);
}
- internal static void ReadCommonValue(this BinaryReader stream, ref object value)
- {
- byte type = stream.ReadByte();
-
- switch (type)
- {
- case 0: // CommonType::Bool:
- value = stream.ReadByte() != 0;
- break;
- case 1: // CommonType::Integer:
- {
- value = stream.ReadInt32();
- }
- break;
- case 2: // CommonType::Float:
- {
- value = stream.ReadSingle();
- }
- break;
- case 3: // CommonType::Vector2:
- {
- value = stream.ReadFloat2();
- }
- break;
- case 4: // CommonType::Vector3:
- {
- value = stream.ReadFloat3();
- }
- break;
- case 5: // CommonType::Vector4:
- {
- value = stream.ReadFloat4();
- }
- break;
- case 6: // CommonType::Color:
- {
- value = stream.ReadColor();
- }
- break;
- case 7: // CommonType::Guid:
- {
- value = stream.ReadGuid();
- }
- break;
- case 8: // CommonType::String:
- {
- int length = stream.ReadInt32();
- if (length <= 0)
- {
- value = string.Empty;
- }
- else
- {
- var data = new char[length];
- for (int i = 0; i < length; i++)
- {
- var c = stream.ReadUInt16();
- data[i] = (char)(c ^ 953);
- }
- value = new string(data);
- }
- break;
- }
- case 9: // CommonType::Box:
- {
- value = new BoundingBox(new Vector3(stream.ReadSingle(), stream.ReadSingle(), stream.ReadSingle()),
- new Vector3(stream.ReadSingle(), stream.ReadSingle(), stream.ReadSingle()));
- }
- break;
- case 10: // CommonType::Rotation:
- {
- value = stream.ReadQuaternion();
- }
- break;
- case 11: // CommonType::Transform:
- {
- value = new Transform(new Vector3(stream.ReadSingle(), stream.ReadSingle(), stream.ReadSingle()),
- new Quaternion(stream.ReadSingle(), stream.ReadSingle(), stream.ReadSingle(), stream.ReadSingle()),
- new Float3(stream.ReadSingle(), stream.ReadSingle(), stream.ReadSingle()));
- }
- break;
- case 12: // CommonType::Sphere:
- {
- value = new BoundingSphere(new Vector3(stream.ReadSingle(), stream.ReadSingle(), stream.ReadSingle()),
- stream.ReadSingle());
- }
- break;
- case 13: // CommonType::Rect:
- {
- value = new Rectangle(stream.ReadSingle(), stream.ReadSingle(), stream.ReadSingle(), stream.ReadSingle());
- }
- break;
- case 15: // CommonType::Matrix
- {
- value = new Matrix(stream.ReadSingle(), stream.ReadSingle(), stream.ReadSingle(), stream.ReadSingle(),
- stream.ReadSingle(), stream.ReadSingle(), stream.ReadSingle(), stream.ReadSingle(),
- stream.ReadSingle(), stream.ReadSingle(), stream.ReadSingle(), stream.ReadSingle(),
- stream.ReadSingle(), stream.ReadSingle(), stream.ReadSingle(), stream.ReadSingle());
- break;
- }
- case 16: // CommonType::Blob
- {
- int length = stream.ReadInt32();
- value = stream.ReadBytes(length);
- break;
- }
- case 18: // CommonType::Ray
- {
- value = new Ray(new Vector3(stream.ReadSingle(), stream.ReadSingle(), stream.ReadSingle()),
- new Vector3(stream.ReadSingle(), stream.ReadSingle(), stream.ReadSingle()));
- break;
- }
- case 19: // CommonType::Int2
- {
- value = stream.ReadInt2();
- break;
- }
- case 20: // CommonType::Int3
- {
- value = stream.ReadInt3();
- break;
- }
- case 21: // CommonType::Int4
- {
- value = stream.ReadInt4();
- break;
- }
- default: throw new SystemException();
- }
- }
-
- internal static void WriteCommonValue(this BinaryWriter stream, object value)
- {
- if (value is bool asBool)
- {
- stream.Write((byte)0);
- stream.Write((byte)(asBool ? 1 : 0));
- }
- else if (value is int asInt)
- {
- stream.Write((byte)1);
- stream.Write(asInt);
- }
- else if (value is long asLong)
- {
- stream.Write((byte)1);
- stream.Write((int)asLong);
- }
- else if (value is float asFloat)
- {
- stream.Write((byte)2);
- stream.Write(asFloat);
- }
- else if (value is double asDouble)
- {
- stream.Write((byte)2);
- stream.Write((float)asDouble);
- }
- else if (value is Vector2 asVector2)
- {
- stream.Write((byte)3);
- stream.Write((float)asVector2.X);
- stream.Write((float)asVector2.Y);
- }
- else if (value is Vector3 asVector3)
- {
- stream.Write((byte)4);
- stream.Write((float)asVector3.X);
- stream.Write((float)asVector3.Y);
- stream.Write((float)asVector3.Z);
- }
- else if (value is Vector4 asVector4)
- {
- stream.Write((byte)5);
- stream.Write((float)asVector4.X);
- stream.Write((float)asVector4.Y);
- stream.Write((float)asVector4.Z);
- stream.Write((float)asVector4.W);
- }
- else if (value is Color asColor)
- {
- stream.Write((byte)6);
- stream.Write(asColor.R);
- stream.Write(asColor.G);
- stream.Write(asColor.B);
- stream.Write(asColor.A);
- }
- else if (value is Guid asGuid)
- {
- stream.Write((byte)7);
- stream.WriteGuid(ref asGuid);
- }
- else if (value is string asString)
- {
- stream.Write((byte)8);
- stream.Write(asString.Length);
- for (int i = 0; i < asString.Length; i++)
- stream.Write((ushort)(asString[i] ^ -14));
- }
- else if (value is BoundingBox asBox)
- {
- stream.Write((byte)9);
- stream.Write((float)asBox.Minimum.X);
- stream.Write((float)asBox.Minimum.Y);
- stream.Write((float)asBox.Minimum.Z);
- stream.Write((float)asBox.Maximum.X);
- stream.Write((float)asBox.Maximum.Y);
- stream.Write((float)asBox.Maximum.Z);
- }
- else if (value is Quaternion asRotation)
- {
- stream.Write((byte)10);
- stream.Write(asRotation.X);
- stream.Write(asRotation.Y);
- stream.Write(asRotation.Z);
- stream.Write(asRotation.X);
- }
- else if (value is Transform asTransform)
- {
- stream.Write((byte)11);
- stream.Write((float)asTransform.Translation.X);
- stream.Write((float)asTransform.Translation.Y);
- stream.Write((float)asTransform.Translation.Z);
- stream.Write(asTransform.Orientation.X);
- stream.Write(asTransform.Orientation.Y);
- stream.Write(asTransform.Orientation.Z);
- stream.Write(asTransform.Orientation.X);
- stream.Write(asTransform.Scale.X);
- stream.Write(asTransform.Scale.Y);
- stream.Write(asTransform.Scale.Z);
- }
- else if (value is BoundingSphere asSphere)
- {
- stream.Write((byte)12);
- stream.Write((float)asSphere.Center.X);
- stream.Write((float)asSphere.Center.Y);
- stream.Write((float)asSphere.Center.Z);
- stream.Write((float)asSphere.Radius);
- }
- else if (value is Rectangle asRect)
- {
- stream.Write((byte)13);
- stream.Write(asRect.Location.X);
- stream.Write(asRect.Location.Y);
- stream.Write(asRect.Size.X);
- stream.Write(asRect.Size.Y);
- }
- else if (value is Matrix asMatrix)
- {
- stream.Write((byte)15);
- stream.Write(asMatrix.M11);
- stream.Write(asMatrix.M12);
- stream.Write(asMatrix.M13);
- stream.Write(asMatrix.M14);
- stream.Write(asMatrix.M21);
- stream.Write(asMatrix.M22);
- stream.Write(asMatrix.M23);
- stream.Write(asMatrix.M24);
- stream.Write(asMatrix.M31);
- stream.Write(asMatrix.M32);
- stream.Write(asMatrix.M33);
- stream.Write(asMatrix.M34);
- stream.Write(asMatrix.M41);
- stream.Write(asMatrix.M42);
- stream.Write(asMatrix.M43);
- stream.Write(asMatrix.M44);
- }
- else if (value is byte[] asBlob)
- {
- stream.Write((byte)16);
- stream.Write(asBlob.Length);
- stream.Write(asBlob);
- }
- else if (value is Ray asRay)
- {
- stream.Write((byte)18);
- stream.Write((float)asRay.Position.X);
- stream.Write((float)asRay.Position.Y);
- stream.Write((float)asRay.Position.Z);
- stream.Write((float)asRay.Direction.X);
- stream.Write((float)asRay.Direction.Y);
- stream.Write((float)asRay.Direction.Z);
- }
- else if (value is Int2 asInt2)
- {
- stream.Write((byte)19);
- stream.Write(asInt2);
- }
- else if (value is Int3 asInt3)
- {
- stream.Write((byte)20);
- stream.Write(asInt3);
- }
- else if (value is Int4 asInt4)
- {
- stream.Write((byte)21);
- stream.Write(asInt4);
- }
- else
- {
- throw new NotSupportedException(string.Format("Invalid Common Value type {0}", value != null ? value.GetType().ToString() : "null"));
- }
- }
-
///
/// Shows the source code window.
///
diff --git a/Source/Engine/Content/Assets/Material.cpp b/Source/Engine/Content/Assets/Material.cpp
index b4cf55d4d..79b7352cd 100644
--- a/Source/Engine/Content/Assets/Material.cpp
+++ b/Source/Engine/Content/Assets/Material.cpp
@@ -3,6 +3,7 @@
#include "Material.h"
#include "Engine/Core/Log.h"
#include "Engine/Core/Types/DataContainer.h"
+#include "Engine/Content/Deprecated.h"
#include "Engine/Content/Upgraders/ShaderAssetUpgrader.h"
#include "Engine/Content/Factories/BinaryAssetFactory.h"
#include "Engine/Graphics/GPUDevice.h"
diff --git a/Source/Engine/Core/Types/CommonValue.cpp b/Source/Engine/Core/Types/CommonValue.cpp
deleted file mode 100644
index 5731578a6..000000000
--- a/Source/Engine/Core/Types/CommonValue.cpp
+++ /dev/null
@@ -1,182 +0,0 @@
-// Copyright (c) Wojciech Figat. All rights reserved.
-
-#include "CommonValue.h"
-#include "Engine/Scripting/ScriptingObject.h"
-
-PRAGMA_DISABLE_DEPRECATION_WARNINGS
-
-const CommonValue CommonValue::Zero(0.0f);
-const CommonValue CommonValue::One(1.0f);
-const CommonValue CommonValue::Null(static_cast(nullptr));
-const CommonValue CommonValue::False(false);
-const CommonValue CommonValue::True(true);
-
-const Char* ToString(CommonType value)
-{
- const Char* result;
- switch (value)
- {
- case CommonType::Bool:
- result = TEXT("Bool");
- break;
- case CommonType::Integer:
- result = TEXT("Integer");
- break;
- case CommonType::Float:
- result = TEXT("Float");
- break;
- case CommonType::Vector2:
- result = TEXT("Vector2");
- break;
- case CommonType::Vector3:
- result = TEXT("Vector3");
- break;
- case CommonType::Vector4:
- result = TEXT("Vector4");
- break;
- case CommonType::Color:
- result = TEXT("Color");
- break;
- case CommonType::Guid:
- result = TEXT("Guid");
- break;
- case CommonType::String:
- result = TEXT("String");
- break;
- case CommonType::Box:
- result = TEXT("Box");
- break;
- case CommonType::Rotation:
- result = TEXT("Rotation");
- break;
- case CommonType::Transform:
- result = TEXT("Transform");
- break;
- case CommonType::Sphere:
- result = TEXT("Sphere");
- break;
- case CommonType::Rectangle:
- result = TEXT("Rectangle");
- break;
- case CommonType::Pointer:
- result = TEXT("Pointer");
- break;
- case CommonType::Matrix:
- result = TEXT("Matrix");
- break;
- case CommonType::Blob:
- result = TEXT("Blob");
- break;
- case CommonType::Object:
- result = TEXT("Object");
- break;
- case CommonType::Ray:
- result = TEXT("Ray");
- break;
- default:
- result = TEXT("");
- break;
- }
- return result;
-}
-
-bool CommonValue::NearEqual(const CommonValue& a, const CommonValue& b, float epsilon)
-{
- ASSERT(a.Type == b.Type);
- switch (a.Type)
- {
- case CommonType::Bool:
- return a.AsBool == b.AsBool;
- case CommonType::Integer:
- return Math::Abs(a.AsInteger - b.AsInteger) < epsilon;
- case CommonType::Float:
- return Math::Abs(a.AsFloat - b.AsFloat) < epsilon;
- case CommonType::Vector2:
- return Float2::NearEqual(a.AsVector2, b.AsVector2, epsilon);
- case CommonType::Vector3:
- return Float3::NearEqual(a.AsVector3, b.AsVector3, epsilon);
- case CommonType::Vector4:
- return Float4::NearEqual(a.AsVector4, b.AsVector4, epsilon);
- case CommonType::Color:
- return Color::NearEqual(a.AsColor, b.AsColor, epsilon);
- case CommonType::Guid:
- return a.AsGuid == b.AsGuid;
- case CommonType::String:
- return StringUtils::Compare(a.AsString, b.AsString) > 0;
- case CommonType::Box:
- return BoundingBox::NearEqual(a.AsBox, b.AsBox, epsilon);
- case CommonType::Rotation:
- return Quaternion::NearEqual(a.AsRotation, b.AsRotation, epsilon);
- case CommonType::Transform:
- return Transform::NearEqual(a.AsTransform, b.AsTransform, epsilon);
- case CommonType::Sphere:
- return BoundingSphere::NearEqual(a.AsSphere, b.AsSphere, epsilon);
- case CommonType::Rectangle:
- return Rectangle::NearEqual(a.AsRectangle, b.AsRectangle, epsilon);
- case CommonType::Ray:
- return Ray::NearEqual(a.AsRay, b.AsRay, epsilon);
- case CommonType::Pointer:
- case CommonType::Object:
- return a.AsPointer == b.AsPointer;
- case CommonType::Matrix:
- return a.AsMatrix == b.AsMatrix;
- case CommonType::Blob:
- return a.AsBlob.Length == b.AsBlob.Length;
- default: CRASH;
- return false;
- }
-}
-
-CommonValue CommonValue::Lerp(const CommonValue& a, const CommonValue& b, float alpha)
-{
- ASSERT(a.Type == b.Type);
- switch (a.Type)
- {
- case CommonType::Bool:
- return alpha < 0.5f ? a : b;
- case CommonType::Integer:
- return Math::Lerp(a.AsInteger, b.AsInteger, alpha);
- case CommonType::Float:
- return Math::Lerp(a.AsFloat, b.AsFloat, alpha);
- case CommonType::Vector2:
- return Float2::Lerp(a.AsVector2, b.AsVector2, alpha);
- case CommonType::Vector3:
- return Float3::Lerp(a.AsVector3, b.AsVector3, alpha);
- case CommonType::Vector4:
- return Float4::Lerp(a.AsVector4, b.AsVector4, alpha);
- case CommonType::Color:
- return Color::Lerp(a.AsColor, b.AsColor, alpha);
- case CommonType::Box:
- return BoundingBox(Vector3::Lerp(a.AsBox.Minimum, b.AsBox.Minimum, alpha), Vector3::Lerp(a.AsBox.Maximum, b.AsBox.Maximum, alpha));
- case CommonType::Rotation:
- return Quaternion::Lerp(a.AsRotation, b.AsRotation, alpha);
- case CommonType::Transform:
- return Transform::Lerp(a.AsTransform, b.AsTransform, alpha);
- case CommonType::Sphere:
- return BoundingSphere(Vector3::Lerp(a.AsSphere.Center, b.AsSphere.Center, alpha), Math::Lerp(a.AsSphere.Radius, b.AsSphere.Radius, alpha));
- case CommonType::Rectangle:
- return Rectangle(Float2::Lerp(a.AsRectangle.Location, b.AsRectangle.Location, alpha), Float2::Lerp(a.AsRectangle.Size, b.AsRectangle.Size, alpha));
- case CommonType::Ray:
- return Ray(Vector3::Lerp(a.AsRay.Position, b.AsRay.Position, alpha), Vector3::Normalize(Vector3::Lerp(a.AsRay.Direction, b.AsRay.Direction, alpha)));
- default:
- return a;
- }
-}
-
-Guid CommonValue::GetObjectId() const
-{
- ASSERT(Type == CommonType::Object);
- return AsObject ? AsObject->GetID() : Guid::Empty;
-}
-
-void CommonValue::LinkObject()
-{
- AsObject->Deleted.Bind(this);
-}
-
-void CommonValue::UnlinkObject()
-{
- AsObject->Deleted.Unbind(this);
-}
-
-PRAGMA_ENABLE_DEPRECATION_WARNINGS
diff --git a/Source/Engine/Core/Types/CommonValue.h b/Source/Engine/Core/Types/CommonValue.h
deleted file mode 100644
index 70f2af77d..000000000
--- a/Source/Engine/Core/Types/CommonValue.h
+++ /dev/null
@@ -1,1144 +0,0 @@
-// Copyright (c) Wojciech Figat. All rights reserved.
-
-#pragma once
-
-#include "Engine/Core/Types/Guid.h"
-#include "Engine/Core/Types/String.h"
-#include "Engine/Core/Types/StringView.h"
-#include "Engine/Core/Math/Vector4.h"
-#include "Engine/Core/Math/Rectangle.h"
-#include "Engine/Core/Math/BoundingBox.h"
-#include "Engine/Core/Math/Transform.h"
-#include "Engine/Core/Math/Ray.h"
-#include "Engine/Core/Math/Color.h"
-#include "Engine/Core/Math/BoundingSphere.h"
-#include "Engine/Core/Math/Matrix.h"
-
-///
-/// Common values types.
-/// [Deprecated on 31.07.2020, expires on 31.07.2022]
-///
-enum class CommonType
-{
- Bool,
- Integer,
- Float,
- Vector2,
- Vector3,
- Vector4,
- Color,
- Guid,
- String,
- Box,
- Rotation,
- Transform,
- Sphere,
- Rectangle,
- Pointer,
- Matrix,
- Blob,
- Object,
- Ray,
-};
-
-const Char* ToString(CommonType value);
-
-class ScriptingObject;
-
-///
-/// Container for value that can have different types
-/// [Deprecated on 31.07.2020, expires on 31.07.2022]
-///
-struct DEPRECATED("Use Variant.") FLAXENGINE_API CommonValue
-{
-public:
- ///
- /// Type
- ///
- CommonType Type;
-
- union
- {
- bool AsBool;
- int32 AsInteger;
- float AsFloat;
- Float2 AsVector2;
- Float3 AsVector3;
- Float4 AsVector4;
- Color AsColor;
- Guid AsGuid;
- Char* AsString;
- BoundingBox AsBox;
- Transform AsTransform;
- Quaternion AsRotation;
- BoundingSphere AsSphere;
- Rectangle AsRectangle;
- Ray AsRay;
- void* AsPointer;
- Matrix AsMatrix;
- ScriptingObject* AsObject;
-
- struct
- {
- byte* Data;
- int32 Length;
- } AsBlob;
- };
-
-public:
- // 0.0f (floating-point value type)
- static const CommonValue Zero;
-
- // 1.0f (floating-point value type)
- static const CommonValue One;
-
- // nullptr (pointer value type)
- static const CommonValue Null;
-
- // false (bool value type)
- static const CommonValue False;
-
- // true (bool value type)
- static const CommonValue True;
-
-public:
- ///
- /// Default constructor (bool)
- ///
- CommonValue()
- : Type(CommonType::Bool)
- , AsBool(false)
- {
- }
-
- ///
- /// Init
- ///
- /// Value
- CommonValue(bool value)
- : Type(CommonType::Bool)
- , AsBool(value)
- {
- }
-
- ///
- /// Init
- ///
- /// Value
- CommonValue(int32 value)
- : Type(CommonType::Integer)
- , AsInteger(value)
- {
- }
-
- ///
- /// Init
- ///
- /// Value
- CommonValue(float value)
- : Type(CommonType::Float)
- , AsFloat(value)
- {
- }
-
- ///
- /// Init
- ///
- /// Value
- CommonValue(const Float2& value)
- : Type(CommonType::Vector2)
- , AsVector2(value)
- {
- }
-
- ///
- /// Init
- ///
- /// Value
- CommonValue(const Float3& value)
- : Type(CommonType::Vector3)
- , AsVector3(value)
- {
- }
-
- ///
- /// Init
- ///
- /// Value
- CommonValue(const Float4& value)
- : Type(CommonType::Vector4)
- , AsVector4(value)
- {
- }
-
- ///
- /// Init
- ///
- /// Value
- CommonValue(const Color& value)
- : Type(CommonType::Color)
- , AsColor(value)
- {
- }
-
- ///
- /// Init
- ///
- /// Value
- CommonValue(const Matrix& value)
- : Type(CommonType::Matrix)
- , AsMatrix(value)
- {
- }
-
- ///
- /// Init
- ///
- /// Value
- CommonValue(const Guid& value)
- : Type(CommonType::Guid)
- , AsGuid(value)
- {
- }
-
- ///
- /// Init
- ///
- /// Value
- CommonValue(const String& value)
- : Type(CommonType::Bool)
- , AsString(nullptr)
- {
- Set(value);
- }
-
- ///
- /// Init
- ///
- /// Value
- CommonValue(const BoundingBox& value)
- : Type(CommonType::Box)
- , AsBox(value)
- {
- }
-
- ///
- /// Init
- ///
- /// Value
- CommonValue(const Transform& value)
- : Type(CommonType::Transform)
- , AsTransform(value)
- {
- }
-
- ///
- /// Init
- ///
- /// Value
- CommonValue(const Quaternion& value)
- : Type(CommonType::Rotation)
- , AsRotation(value)
- {
- }
-
- ///
- /// Init
- ///
- /// Value
- CommonValue(const BoundingSphere& value)
- : Type(CommonType::Sphere)
- , AsSphere(value)
- {
- }
-
- ///
- /// Init
- ///
- /// Value
- CommonValue(const Rectangle& value)
- : Type(CommonType::Rectangle)
- , AsRectangle(value)
- {
- }
-
- ///
- /// Init
- ///
- /// Value
- CommonValue(const Ray& value)
- : Type(CommonType::Ray)
- , AsRay(value)
- {
- }
-
- ///
- /// Init
- ///
- /// Value
- CommonValue(void* value)
- : Type(CommonType::Pointer)
- , AsPointer(value)
- {
- }
-
- ///
- /// Init
- ///
- /// Value
- CommonValue(ScriptingObject* value)
- : Type(CommonType::Object)
- , AsObject(value)
- {
- if (value)
- LinkObject();
- }
-
- CommonValue(byte* data, int32 length)
- : Type(CommonType::Blob)
- {
- AsBlob.Length = length;
- if (length)
- {
- AsBlob.Data = (byte*)Allocator::Allocate(length);
- Platform::MemoryCopy(AsBlob.Data, data, length);
- }
- else
- {
- AsBlob.Data = nullptr;
- }
- }
-
- ///
- /// Copy constructor
- ///
- /// The other value
- CommonValue(const CommonValue& other)
- {
- if (other.Type == CommonType::String)
- {
- Type = CommonType::String;
-
- const int32 length = StringUtils::Length(other.AsString);
- if (length > 0)
- {
- AsString = (Char*)Allocator::Allocate((length + 1) * sizeof(Char));
- Platform::MemoryCopy(AsString, other.AsString, sizeof(Char) * length);
- AsString[length] = 0;
- }
- else
- {
- AsString = nullptr;
- }
- }
- else if (other.Type == CommonType::Blob)
- {
- Type = CommonType::Blob;
-
- const int32 length = other.AsBlob.Length;
- if (length > 0)
- {
- AsBlob.Data = (byte*)Allocator::Allocate(length);
- Platform::MemoryCopy(AsBlob.Data, other.AsBlob.Data, length);
- AsBlob.Length = length;
- }
- else
- {
- AsBlob.Data = nullptr;
- AsBlob.Length = 0;
- }
- }
- else
- {
- Platform::MemoryCopy(this, &other, sizeof(CommonValue));
- }
- }
-
- ///
- /// Destructor
- ///
- ~CommonValue()
- {
- SetType(CommonType::Bool);
- }
-
-public:
- ///
- /// Assignment operator
- ///
- /// Other value
- CommonValue& operator=(const CommonValue& other)
- {
- if (Type == CommonType::String && AsString)
- {
- Allocator::Free(AsString);
- AsString = nullptr;
- }
- else if (Type == CommonType::Blob && AsBlob.Data)
- {
- Allocator::Free(AsBlob.Data);
- AsBlob.Data = nullptr;
- AsBlob.Length = 0;
- }
-
- if (other.Type == CommonType::String)
- {
- Type = CommonType::String;
-
- const int32 length = StringUtils::Length(other.AsString);
- if (length > 0)
- {
- AsString = (Char*)Allocator::Allocate((length + 1) * sizeof(Char));
- Platform::MemoryCopy(AsString, other.AsString, sizeof(Char) * length);
- AsString[length] = 0;
- }
- else
- {
- AsString = nullptr;
- }
- }
- else if (other.Type == CommonType::Blob)
- {
- Type = CommonType::Blob;
-
- const int32 length = other.AsBlob.Length;
- if (length > 0)
- {
- AsBlob.Data = (byte*)Allocator::Allocate(length);
- Platform::MemoryCopy(AsBlob.Data, other.AsBlob.Data, length);
- AsBlob.Length = length;
- }
- else
- {
- AsBlob.Data = nullptr;
- AsBlob.Length = 0;
- }
- }
- else
- {
- Platform::MemoryCopy(this, &other, sizeof(CommonValue));
- }
-
- return *this;
- }
-
-public:
- ///
- /// Gets value as boolean (if can convert it)
- ///
- /// Value
- FORCE_INLINE bool GetBool() const
- {
- bool isValid;
- return GetBool(isValid);
- }
-
- ///
- /// Gets value as boolean (if can convert it)
- ///
- /// Contains true if value has been converted, otherwise false
- /// Value
- bool GetBool(bool& isValid) const
- {
- isValid = true;
-
- switch (Type)
- {
- case CommonType::Bool:
- return AsBool;
- case CommonType::Integer:
- return AsInteger != 0;
- case CommonType::Float:
- return !Math::IsZero(AsFloat);
- case CommonType::Vector2:
- return !Math::IsZero(AsVector2.X);
- case CommonType::Vector3:
- return !Math::IsZero(AsVector3.X);
- case CommonType::Vector4:
- return !Math::IsZero(AsVector4.X);
- case CommonType::Color:
- return !Math::IsZero(AsColor.R);
- }
-
- isValid = false;
- return false;
- }
-
- ///
- /// Gets value as integer (if can convert it)
- ///
- /// Value
- FORCE_INLINE int32 GetInteger() const
- {
- bool isValid;
- return GetInteger(isValid);
- }
-
- ///
- /// Gets value as integer (if can convert it)
- ///
- /// Contains true if value has been converted, otherwise false
- /// Value
- int32 GetInteger(bool& isValid) const
- {
- isValid = true;
-
- switch (Type)
- {
- case CommonType::Bool:
- return AsBool ? 1 : 0;
- case CommonType::Integer:
- return AsInteger;
- case CommonType::Float:
- return static_cast(AsFloat);
- case CommonType::Vector2:
- return static_cast(AsVector2.X);
- case CommonType::Vector3:
- return static_cast(AsVector3.X);
- case CommonType::Vector4:
- return static_cast(AsVector4.X);
- case CommonType::Color:
- return static_cast(AsColor.R);
- }
-
- isValid = false;
- return 0;
- }
-
- ///
- /// Gets value as float (if can convert it)
- ///
- /// Value
- FORCE_INLINE float GetFloat() const
- {
- bool isValid;
- return GetFloat(isValid);
- }
-
- ///
- /// Gets value as float (if can convert it)
- ///
- /// Contains true if value has been converted, otherwise false
- /// Value
- float GetFloat(bool& isValid) const
- {
- isValid = true;
-
- switch (Type)
- {
- case CommonType::Bool:
- return AsBool ? 1.0f : 0.0f;
- case CommonType::Integer:
- return static_cast(AsInteger);
- case CommonType::Float:
- return AsFloat;
- case CommonType::Vector2:
- return AsVector2.X;
- case CommonType::Vector3:
- return AsVector3.X;
- case CommonType::Vector4:
- return AsVector4.X;
- case CommonType::Color:
- return AsColor.R;
- }
-
- isValid = false;
- return 0.0f;
- }
-
- ///
- /// Gets value as Vector2 (if can convert it)
- ///
- /// Value
- FORCE_INLINE Float2 GetVector2() const
- {
- bool isValid;
- return GetVector2(isValid);
- }
-
- ///
- /// Gets value as Vector2 (if can convert it)
- ///
- /// Contains true if value has been converted, otherwise false
- /// Value
- Float2 GetVector2(bool& isValid) const
- {
- isValid = true;
- switch (Type)
- {
- case CommonType::Bool:
- return Float2(AsBool ? 1.0f : 0.0f);
- case CommonType::Integer:
- return Float2(static_cast(AsInteger));
- case CommonType::Float:
- return Float2(AsFloat);
- case CommonType::Vector2:
- return AsVector2;
- case CommonType::Vector3:
- return Float2(AsVector3);
- case CommonType::Vector4:
- return Float2(AsVector4);
- case CommonType::Color:
- return Float2(AsColor);
- }
- isValid = false;
- return Float2::Zero;
- }
-
- ///
- /// Gets value as Vector3 (if can convert it)
- ///
- /// Value
- FORCE_INLINE Float3 GetVector3() const
- {
- bool isValid;
- return GetVector3(isValid);
- }
-
- ///
- /// Gets value as Vector3 (if can convert it)
- ///
- /// Contains true if value has been converted, otherwise false
- /// Value
- Float3 GetVector3(bool& isValid) const
- {
- isValid = true;
- switch (Type)
- {
- case CommonType::Bool:
- return Float3(AsBool ? 1.0f : 0.0f);
- case CommonType::Integer:
- return Float3(static_cast(AsInteger));
- case CommonType::Float:
- return Float3(AsFloat);
- case CommonType::Vector2:
- return Float3(AsVector2, 0);
- case CommonType::Vector3:
- return AsVector3;
- case CommonType::Vector4:
- return Vector3(AsVector4);
- case CommonType::Color:
- return Vector3(AsColor);
- }
- isValid = false;
- return Float3::Zero;
- }
-
- ///
- /// Gets value as Vector4 (if can convert it)
- ///
- /// Value
- FORCE_INLINE Float4 GetVector4() const
- {
- bool isValid;
- return GetVector4(isValid);
- }
-
- ///
- /// Gets value as Vector4 (if can convert it)
- ///
- /// Contains true if value has been converted, otherwise false
- /// Value
- Float4 GetVector4(bool& isValid) const
- {
- isValid = true;
- switch (Type)
- {
- case CommonType::Bool:
- return Float4(AsBool ? 1.0f : 0.0f);
- case CommonType::Integer:
- return Float4(static_cast(AsInteger));
- case CommonType::Float:
- return Float4(AsFloat);
- case CommonType::Vector2:
- return Float4(AsVector2, 0, 0);
- case CommonType::Vector3:
- return Float4(AsVector3, 0);
- case CommonType::Vector4:
- return AsVector4;
- case CommonType::Color:
- return Float4(AsColor);
- }
- isValid = false;
- return Float4::Zero;
- }
-
- ///
- /// Gets value as Quaternion (if can convert it)
- ///
- /// Value
- FORCE_INLINE Quaternion GetRotation() const
- {
- bool isValid;
- return GetRotation(isValid);
- }
-
- ///
- /// Gets value as Quaternion (if can convert it)
- ///
- /// Contains true if value has been converted, otherwise false
- /// Value
- Quaternion GetRotation(bool& isValid) const
- {
- isValid = true;
-
- switch (Type)
- {
- case CommonType::Vector3:
- return Quaternion::Euler(AsVector3);
- case CommonType::Vector4:
- return Quaternion(AsVector4);
- case CommonType::Rotation:
- return AsRotation;
- }
-
- isValid = false;
- return Quaternion::Identity;
- }
-
- ///
- /// Gets value as Color (if can convert it)
- ///
- /// Value
- FORCE_INLINE Color GetColor() const
- {
- bool isValid;
- return GetColor(isValid);
- }
-
- ///
- /// Gets value as Color (if can convert it)
- ///
- /// Contains true if value has been converted, otherwise false
- /// Value
- Color GetColor(bool& isValid) const
- {
- isValid = true;
-
- switch (Type)
- {
- case CommonType::Bool:
- return Color(AsBool ? 1.0f : 0.0f);
- case CommonType::Integer:
- return Color(static_cast(AsInteger));
- case CommonType::Float:
- return Color(AsFloat);
- case CommonType::Vector2:
- return Color(AsVector2.X, AsVector2.Y, 0, 1);
- case CommonType::Vector3:
- return Color(AsVector3, 1);
- case CommonType::Vector4:
- return Color(AsVector4);
- case CommonType::Color:
- return AsColor;
- }
-
- isValid = false;
- return Color::Black;
- }
-
-public:
- ///
- /// Set new value and change type to Bool
- ///
- /// Value to assign
- void Set(bool value)
- {
- SetType(CommonType::Bool);
- AsBool = value;
- }
-
- ///
- /// Set new value and change type to Integer
- ///
- /// Value to assign
- void Set(int32 value)
- {
- SetType(CommonType::Integer);
- AsInteger = value;
- }
-
- ///
- /// Set new value and change type to Float
- ///
- /// Value to assign
- void Set(float value)
- {
- SetType(CommonType::Float);
- AsFloat = value;
- }
-
- ///
- /// Set new value and change type to Vector2
- ///
- /// Value to assign
- void Set(const Float2& value)
- {
- SetType(CommonType::Vector2);
- AsVector2 = value;
- }
-
- ///
- /// Set new value and change type to Vector3
- ///
- /// Value to assign
- void Set(const Float3& value)
- {
- SetType(CommonType::Vector3);
- AsVector3 = value;
- }
-
- ///
- /// Set new value and change type to Vector4
- ///
- /// Value to assign
- void Set(const Float4& value)
- {
- SetType(CommonType::Vector4);
- AsVector4 = value;
- }
-
- ///
- /// Set new value and change type to Color
- ///
- /// Value to assign
- void Set(const Color& value)
- {
- SetType(CommonType::Color);
- AsColor = value;
- }
-
- ///
- /// Set new value and change type to Matrix
- ///
- /// Value to assign
- void Set(const Matrix& value)
- {
- SetType(CommonType::Matrix);
- AsMatrix = value;
- }
-
- ///
- /// Set new value and change type to Guid
- ///
- /// Value to assign
- void Set(const Guid& value)
- {
- SetType(CommonType::Guid);
- AsGuid = value;
- }
-
- ///
- /// Set new value and change type to String
- ///
- /// Value to assign
- void Set(const StringView& value)
- {
- SetType(CommonType::String);
- int32 length = value.Length();
- if (length > 0)
- {
- AsString = (Char*)Allocator::Allocate((length + 1) * sizeof(Char));
- Platform::MemoryCopy(AsString, *value, sizeof(Char) * length);
- AsString[length] = 0;
- }
- else
- {
- AsString = nullptr;
- }
- }
-
- ///
- /// Set new value and change type to Box
- ///
- /// Value to assign
- void Set(const BoundingBox& value)
- {
- SetType(CommonType::Box);
- AsBox = value;
- }
-
- ///
- /// Set new value and change type to Rotation
- ///
- /// Value to assign
- void Set(const Quaternion& value)
- {
- SetType(CommonType::Rotation);
- AsRotation = value;
- }
-
- ///
- /// Set new value and change type to Transform
- ///
- /// Value to assign
- void Set(const Transform& value)
- {
- SetType(CommonType::Transform);
- AsTransform = value;
- }
-
- ///
- /// Set new value and change type to Sphere
- ///
- /// Value to assign
- void Set(const BoundingSphere& value)
- {
- SetType(CommonType::Sphere);
- AsSphere = value;
- }
-
- ///
- /// Set new value and change type to Rectangle
- ///
- /// Value to assign
- void Set(const Rectangle& value)
- {
- SetType(CommonType::Rectangle);
- AsRectangle = value;
- }
-
- ///
- /// Set new value and change type to Rectangle
- ///
- /// Value to assign
- void Set(const Ray& value)
- {
- SetType(CommonType::Ray);
- AsRay = value;
- }
-
- ///
- /// Sets the common value type to binary blob. Allocates the bloc with the given data capacity.
- ///
- /// The length (in bytes).
- void SetBlob(int32 length)
- {
- SetType(CommonType::Blob);
- AsBlob.Length = length;
- if (length)
- {
- AsBlob.Data = (byte*)Allocator::Allocate(length);
- }
- else
- {
- AsBlob.Data = nullptr;
- }
- }
-
- ///
- /// Sets the value to object reference.
- ///
- /// The object to reference.
- void SetObject(ScriptingObject* obj)
- {
- SetType(CommonType::Object);
- AsObject = obj;
- if (obj)
- LinkObject();
- }
-
-public:
- ///
- /// Change common value type
- ///
- /// New type
- void SetType(CommonType type)
- {
- if (Type != type)
- {
- if (Type == CommonType::String && AsString)
- {
- Allocator::Free(AsString);
- AsString = nullptr;
- }
- else if (Type == CommonType::Blob && AsBlob.Data)
- {
- Allocator::Free(AsBlob.Data);
- AsBlob.Data = nullptr;
- AsBlob.Length = 0;
- }
- else if (Type == CommonType::Object && AsObject)
- {
- UnlinkObject();
- AsObject = nullptr;
- }
-
- Type = type;
- }
- }
-
-public:
- ///
- /// Casts value from its type to another
- ///
- /// Output type
- /// Changed value
- CommonValue Cast(CommonType to) const
- {
- return Cast(*this, to);
- }
-
- ///
- /// Casts value from its type to another
- ///
- /// Value to cast
- /// Output type
- /// Changed value
- static CommonValue Cast(const CommonValue& v, CommonType to)
- {
- // If they are the same types, then just return value
- if (v.Type == to)
- {
- // The same
- return v;
- }
-
- // Switch on some switches to switch between the switches
- switch (to)
- {
- case CommonType::Bool:
- return v.GetBool();
- case CommonType::Integer:
- return v.GetInteger();
- case CommonType::Float:
- return v.GetFloat();
- case CommonType::Vector2:
- return v.GetVector2();
- case CommonType::Vector3:
- return v.GetVector3();
- case CommonType::Vector4:
- return v.GetVector4();
- case CommonType::Rotation:
- return v.GetRotation();
- case CommonType::Color:
- return v.GetColor();
- }
-
- CRASH;
- return Null;
- }
-
-public:
- friend bool operator==(const CommonValue& a, const CommonValue& b)
- {
- ASSERT(a.Type == b.Type);
- switch (a.Type)
- {
- case CommonType::Bool:
- return a.AsBool == b.AsBool;
- case CommonType::Integer:
- return a.AsInteger == b.AsInteger;
- case CommonType::Float:
- return a.AsFloat == b.AsFloat;
- case CommonType::Vector2:
- return a.AsVector2 == b.AsVector2;
- case CommonType::Vector3:
- return a.AsVector3 == b.AsVector3;
- case CommonType::Vector4:
- return a.AsVector4 == b.AsVector4;
- case CommonType::Color:
- return a.AsColor == b.AsColor;
- case CommonType::Guid:
- return a.AsGuid == b.AsGuid;
- case CommonType::String:
- return StringUtils::Compare(a.AsString, b.AsString) == 0;
- case CommonType::Box:
- return a.AsBox == b.AsBox;
- case CommonType::Rotation:
- return a.AsRotation == b.AsRotation;
- case CommonType::Transform:
- return a.AsTransform == b.AsTransform;
- case CommonType::Sphere:
- return a.AsSphere == b.AsSphere;
- case CommonType::Rectangle:
- return a.AsRectangle == b.AsRectangle;
- case CommonType::Ray:
- return a.AsRay == b.AsRay;
- case CommonType::Pointer:
- case CommonType::Object:
- return a.AsPointer == b.AsPointer;
- case CommonType::Matrix:
- return a.AsMatrix == b.AsMatrix;
- case CommonType::Blob:
- return a.AsBlob.Data == b.AsBlob.Data && a.AsBlob.Length == b.AsBlob.Length;
- default: CRASH;
- return false;
- }
- }
-
- friend bool operator!=(const CommonValue& a, const CommonValue& b)
- {
- return !operator==(a, b);
- }
-
- friend bool operator>(const CommonValue& a, const CommonValue& b)
- {
- ASSERT(a.Type == b.Type);
- switch (a.Type)
- {
- case CommonType::Bool:
- return a.AsBool > b.AsBool;
- case CommonType::Integer:
- return a.AsInteger > b.AsInteger;
- case CommonType::Float:
- return a.AsFloat > b.AsFloat;
- case CommonType::Vector2:
- return a.AsVector2 > b.AsVector2;
- case CommonType::Vector3:
- return a.AsVector3 > b.AsVector3;
- case CommonType::Vector4:
- return a.AsVector4 > b.AsVector4;
- //case CommonType::Color: return a.AsColor > b.AsColor;
- //case CommonType::Guid: return a.AsGuid > b.AsGuid;
- case CommonType::String:
- return StringUtils::Compare(a.AsString, b.AsString) > 0;
- //case CommonType::Box: return a.AsBox > b.AsBox;
- //case CommonType::Rotation: return a.AsRotation > b.AsRotation;
- //case CommonType::Transform: return a.AsTransform > b.AsTransform;
- //case CommonType::Sphere: return a.AsSphere > b.AsSphere;
- //case CommonType::Rectangle: return a.AsRectangle > b.AsRectangle;
- //case CommonType::Ray: return a.AsRay > b.AsRay;
- case CommonType::Pointer:
- case CommonType::Object:
- return a.AsPointer > b.AsPointer;
- //case CommonType::Matrix: return a.AsMatrix > b.AsMatrix;
- case CommonType::Blob:
- return a.AsBlob.Length > b.AsBlob.Length;
- default: CRASH;
- return false;
- }
- }
-
- friend bool operator<(const CommonValue& a, const CommonValue& b)
- {
- return !operator==(a, b) && !operator>(a, b);
- }
-
- friend bool operator>=(const CommonValue& a, const CommonValue& b)
- {
- return !operator<(a, b);
- }
-
- friend bool operator<=(const CommonValue& a, const CommonValue& b)
- {
- return !operator>(a, b);
- }
-
-public:
- static bool NearEqual(const CommonValue& a, const CommonValue& b, float epsilon);
-
- static CommonValue Lerp(const CommonValue& a, const CommonValue& b, float alpha);
-
- // Gets the ID of the object (valid only if common value is of type Object).
- Guid GetObjectId() const;
-
-private:
- void OnObjectDeleted(ScriptingObject* obj)
- {
- AsObject = nullptr;
- }
-
- void LinkObject();
- void UnlinkObject();
-};
diff --git a/Source/Engine/Core/Types/Variant.cpp b/Source/Engine/Core/Types/Variant.cpp
index dcabe8e48..da9e3b39b 100644
--- a/Source/Engine/Core/Types/Variant.cpp
+++ b/Source/Engine/Core/Types/Variant.cpp
@@ -1,7 +1,6 @@
// Copyright (c) Wojciech Figat. All rights reserved.
#include "Variant.h"
-#include "CommonValue.h"
#include "Engine/Core/Collections/HashFunctions.h"
#include "Engine/Core/Collections/Dictionary.h"
#include "Engine/Content/Asset.h"
@@ -964,78 +963,6 @@ Variant::Variant(const Span& v)
}
}
-PRAGMA_DISABLE_DEPRECATION_WARNINGS
-#include "Engine/Content/Deprecated.h"
-Variant::Variant(const CommonValue& value)
- : Variant()
-{
- // [Deprecated on 31.07.2020, expires on 31.07.2022]
- MARK_CONTENT_DEPRECATED();
- switch (value.Type)
- {
- case CommonType::Bool:
- *this = value.AsBool;
- break;
- case CommonType::Integer:
- *this = value.AsInteger;
- break;
- case CommonType::Float:
- *this = value.AsFloat;
- break;
- case CommonType::Vector2:
- *this = value.AsVector2;
- break;
- case CommonType::Vector3:
- *this = value.AsVector3;
- break;
- case CommonType::Vector4:
- *this = value.AsVector4;
- break;
- case CommonType::Color:
- *this = value.AsColor;
- break;
- case CommonType::Guid:
- *this = value.AsGuid;
- break;
- case CommonType::String:
- SetString(StringView(value.AsString));
- break;
- case CommonType::Box:
- *this = Variant(value.AsBox);
- break;
- case CommonType::Rotation:
- *this = value.AsRotation;
- break;
- case CommonType::Transform:
- *this = Variant(value.AsTransform);
- break;
- case CommonType::Sphere:
- *this = value.AsSphere;
- break;
- case CommonType::Rectangle:
- *this = value.AsRectangle;
- break;
- case CommonType::Pointer:
- *this = value.AsPointer;
- break;
- case CommonType::Matrix:
- *this = Variant(value.AsMatrix);
- break;
- case CommonType::Blob:
- SetBlob(value.AsBlob.Data, value.AsBlob.Length);
- break;
- case CommonType::Object:
- SetObject(value.AsObject);
- break;
- case CommonType::Ray:
- *this = Variant(value.AsRay);
- break;
- default:
- CRASH;
- }
-}
-PRAGMA_ENABLE_DEPRECATION_WARNINGS
-
Variant::~Variant()
{
switch (Type.Type)
diff --git a/Source/Engine/Core/Types/Variant.h b/Source/Engine/Core/Types/Variant.h
index 5c057bc65..7b60907f7 100644
--- a/Source/Engine/Core/Types/Variant.h
+++ b/Source/Engine/Core/Types/Variant.h
@@ -7,7 +7,6 @@
class Asset;
struct Transform;
-struct CommonValue;
template
class AssetReference;
struct ScriptingTypeHandle;
@@ -264,7 +263,6 @@ public:
explicit Variant(Dictionary&& v);
explicit Variant(const Dictionary& v);
explicit Variant(const Span& v);
- explicit Variant(const CommonValue& v);
template
Variant(const class AssetReference& v)
diff --git a/Source/Engine/Engine/GameplayGlobals.cpp b/Source/Engine/Engine/GameplayGlobals.cpp
index 582e1151f..43f18f22a 100644
--- a/Source/Engine/Engine/GameplayGlobals.cpp
+++ b/Source/Engine/Engine/GameplayGlobals.cpp
@@ -2,60 +2,12 @@
#include "GameplayGlobals.h"
#include "Engine/Core/Log.h"
-#include "Engine/Core/Types/CommonValue.h"
#include "Engine/Serialization/MemoryReadStream.h"
#include "Engine/Serialization/MemoryWriteStream.h"
#include "Engine/Content/Factories/BinaryAssetFactory.h"
-#include "Engine/Content/Upgraders/BinaryAssetUpgrader.h"
#include "Engine/Threading/Threading.h"
-#if USE_EDITOR
-
-class GameplayGlobalsUpgrader : public BinaryAssetUpgrader
-{
-public:
- GameplayGlobalsUpgrader()
- {
- const Upgrader upgraders[] =
- {
- { 1, 2, &Upgrade_1_To_2 }, // [Deprecated on 31.07.2020, expires on 31.07.2022]
- };
- setup(upgraders, ARRAY_COUNT(upgraders));
- }
-
-private:
- static bool Upgrade_1_To_2(AssetMigrationContext& context)
- {
- // [Deprecated on 31.07.2020, expires on 31.07.2022]
- PRAGMA_DISABLE_DEPRECATION_WARNINGS
- ASSERT(context.Input.SerializedVersion == 1 && context.Output.SerializedVersion == 2);
- if (context.AllocateChunk(0))
- return true;
- auto& data = context.Input.Header.Chunks[0]->Data;
- MemoryReadStream stream(data.Get(), data.Length());
- MemoryWriteStream output;
- int32 count;
- stream.ReadInt32(&count);
- output.WriteInt32(count);
- String name;
- for (int32 i = 0; i < count; i++)
- {
- stream.Read(name, 71);
- CommonValue commonValue;
- stream.ReadCommonValue(&commonValue);
- Variant variant(commonValue);
- output.WriteVariant(variant);
- }
- context.Output.Header.Chunks[0]->Data.Copy(output.GetHandle(), output.GetPosition());
- PRAGMA_ENABLE_DEPRECATION_WARNINGS
-
- return false;
- }
-};
-
-#endif
-
-REGISTER_BINARY_ASSET_WITH_UPGRADER(GameplayGlobals, "FlaxEngine.GameplayGlobals", GameplayGlobalsUpgrader, true);
+REGISTER_BINARY_ASSET(GameplayGlobals, "FlaxEngine.GameplayGlobals", true);
GameplayGlobals::GameplayGlobals(const SpawnParams& params, const AssetInfo* info)
: BinaryAsset(params, info)
diff --git a/Source/Engine/Particles/Graph/GPU/ParticleEmitterGraph.GPU.cpp b/Source/Engine/Particles/Graph/GPU/ParticleEmitterGraph.GPU.cpp
index ab559f640..d08cfcaa3 100644
--- a/Source/Engine/Particles/Graph/GPU/ParticleEmitterGraph.GPU.cpp
+++ b/Source/Engine/Particles/Graph/GPU/ParticleEmitterGraph.GPU.cpp
@@ -3,10 +3,10 @@
#if COMPILE_WITH_PARTICLE_GPU_GRAPH
#include "ParticleEmitterGraph.GPU.h"
+#include "Engine/Core/Math/Matrix.h"
#include "Engine/Serialization/FileReadStream.h"
#include "Engine/Visject/ShaderGraphUtilities.h"
#include "Engine/Engine/Globals.h"
-#include "Engine/Core/Types/CommonValue.h"
///
/// GPU particles shader source code template has special marks for generated code.
diff --git a/Source/Engine/Particles/ParticleEffect.cpp b/Source/Engine/Particles/ParticleEffect.cpp
index 14467664c..5e11cb2d9 100644
--- a/Source/Engine/Particles/ParticleEffect.cpp
+++ b/Source/Engine/Particles/ParticleEffect.cpp
@@ -2,7 +2,6 @@
#include "ParticleEffect.h"
#include "Particles.h"
-#include "Engine/Core/Types/CommonValue.h"
#include "Engine/Content/Deprecated.h"
#include "Engine/Serialization/JsonTools.h"
#include "Engine/Serialization/Serialization.h"
@@ -728,86 +727,39 @@ void ParticleEffect::Deserialize(DeserializeStream& stream, ISerializeModifier*
const auto overridesMember = stream.FindMember("Overrides");
if (overridesMember != stream.MemberEnd())
{
- // [Deprecated on 25.11.2018, expires on 25.11.2022]
- if (modifier->EngineBuild < 6197)
+ const auto& overrides = overridesMember->value;
+ CHECK(overrides.IsArray());
+ _parametersOverrides.EnsureCapacity(_parametersOverrides.Count() + overrides.Size());
+ for (rapidjson::SizeType i = 0; i < overrides.Size(); i++)
{
- PRAGMA_DISABLE_DEPRECATION_WARNINGS
- MARK_CONTENT_DEPRECATED();
- const auto& overrides = overridesMember->value;
- ASSERT(overrides.IsArray());
- _parametersOverrides.EnsureCapacity(_parametersOverrides.Count() + overrides.Size());
- for (rapidjson::SizeType i = 0; i < overrides.Size(); i++)
+ auto& o = (DeserializeStream&)overrides[i];
+ const String trackName = JsonTools::GetString(o, "Track");
+ const Guid id = JsonTools::GetGuid(o, "Id");
+ ParameterOverride* e = nullptr;
+ for (auto& q : _parametersOverrides)
{
- const auto& o = (DeserializeStream&)overrides[i];
- const String trackName = JsonTools::GetString(o, "Track");
- const Guid id = JsonTools::GetGuid(o, "Id");
- ParameterOverride* e = nullptr;
- for (auto& q : _parametersOverrides)
+ if (q.Id == id && q.Track == trackName)
{
- if (q.Id == id && q.Track == trackName)
- {
- e = &q;
- break;
- }
- }
- if (e)
- {
- // Update overriden parameter value
- CommonValue value;
- auto mValue = SERIALIZE_FIND_MEMBER(o, "Value");
- if (mValue != o.MemberEnd())
- e->Value = Variant(JsonTools::GetCommonValue(mValue->value));
- }
- else
- {
- // Add parameter override
- auto& p = _parametersOverrides.AddOne();
- p.Track = trackName;
- p.Id = id;
- CommonValue value;
- auto mValue = SERIALIZE_FIND_MEMBER(o, "Value");
- if (mValue != o.MemberEnd())
- p.Value = Variant(JsonTools::GetCommonValue(mValue->value));
+ e = &q;
+ break;
}
}
- PRAGMA_ENABLE_DEPRECATION_WARNINGS
- }
- else
- {
- const auto& overrides = overridesMember->value;
- ASSERT(overrides.IsArray());
- _parametersOverrides.EnsureCapacity(_parametersOverrides.Count() + overrides.Size());
- for (rapidjson::SizeType i = 0; i < overrides.Size(); i++)
+ if (e)
{
- auto& o = (DeserializeStream&)overrides[i];
- const String trackName = JsonTools::GetString(o, "Track");
- const Guid id = JsonTools::GetGuid(o, "Id");
- ParameterOverride* e = nullptr;
- for (auto& q : _parametersOverrides)
- {
- if (q.Id == id && q.Track == trackName)
- {
- e = &q;
- break;
- }
- }
- if (e)
- {
- // Update overriden parameter value
- const auto mValue = SERIALIZE_FIND_MEMBER(o, "Value");
- if (mValue != stream.MemberEnd())
- Serialization::Deserialize(mValue->value, e->Value, modifier);
- }
- else
- {
- // Add parameter override
- auto& p = _parametersOverrides.AddOne();
- p.Track = trackName;
- p.Id = id;
- const auto mValue = SERIALIZE_FIND_MEMBER(o, "Value");
- if (mValue != stream.MemberEnd())
- Serialization::Deserialize(mValue->value, p.Value, modifier);
- }
+ // Update overriden parameter value
+ const auto mValue = SERIALIZE_FIND_MEMBER(o, "Value");
+ if (mValue != stream.MemberEnd())
+ Serialization::Deserialize(mValue->value, e->Value, modifier);
+ }
+ else
+ {
+ // Add parameter override
+ auto& p = _parametersOverrides.AddOne();
+ p.Track = trackName;
+ p.Id = id;
+ const auto mValue = SERIALIZE_FIND_MEMBER(o, "Value");
+ if (mValue != stream.MemberEnd())
+ Serialization::Deserialize(mValue->value, p.Value, modifier);
}
}
}
diff --git a/Source/Engine/Particles/ParticleEmitter.cpp b/Source/Engine/Particles/ParticleEmitter.cpp
index f4c883e20..a29cc9ee0 100644
--- a/Source/Engine/Particles/ParticleEmitter.cpp
+++ b/Source/Engine/Particles/ParticleEmitter.cpp
@@ -4,6 +4,7 @@
#include "ParticleSystem.h"
#include "ParticleEffect.h"
#include "Particles.h"
+#include "Engine/Content/Deprecated.h"
#include "Engine/Content/Factories/BinaryAssetFactory.h"
#include "Engine/Content/Upgraders/ShaderAssetUpgrader.h"
#include "Engine/Core/Log.h"
diff --git a/Source/Engine/Particles/ParticleSystem.cpp b/Source/Engine/Particles/ParticleSystem.cpp
index 8354f48cb..41a8cb1c1 100644
--- a/Source/Engine/Particles/ParticleSystem.cpp
+++ b/Source/Engine/Particles/ParticleSystem.cpp
@@ -2,7 +2,6 @@
#include "ParticleSystem.h"
#include "ParticleEffect.h"
-#include "Engine/Core/Types/CommonValue.h"
#include "Engine/Level/Level.h"
#include "Engine/Content/Deprecated.h"
#include "Engine/Content/Factories/BinaryAssetFactory.h"
@@ -225,158 +224,6 @@ Asset::LoadResult ParticleSystem::load()
#endif
switch (version)
{
- PRAGMA_DISABLE_DEPRECATION_WARNINGS
- case 1:
- {
- // [Deprecated on 23.07.2019, expires on 27.04.2021]
- MARK_CONTENT_DEPRECATED();
-
- // Load properties
- stream.ReadFloat(&FramesPerSecond);
- stream.ReadInt32(&DurationFrames);
-
- // Load emitters
- int32 emittersCount;
- stream.ReadInt32(&emittersCount);
- Emitters.Resize(emittersCount, false);
-
- // Load tracks
- Guid id;
- int32 tracksCount;
- stream.ReadInt32(&tracksCount);
- Tracks.Resize(tracksCount, false);
- for (int32 i = 0; i < tracksCount; i++)
- {
- auto& track = Tracks[i];
-
- track.Type = (Track::Types)stream.ReadByte();
- track.Flag = (Track::Flags)stream.ReadByte();
- stream.ReadInt32(&track.ParentIndex);
- stream.ReadInt32(&track.ChildrenCount);
- stream.ReadString(&track.Name, -13);
- track.Disabled = (int32)track.Flag & (int32)Track::Flags::Mute || (track.ParentIndex != -1 && Tracks[track.ParentIndex].Disabled);
-
- switch (track.Type)
- {
- case Track::Types::Emitter:
- stream.Read(id);
- stream.ReadInt32(&track.AsEmitter.Index);
- stream.ReadInt32(&track.AsEmitter.StartFrame);
- stream.ReadInt32(&track.AsEmitter.DurationFrames);
- Emitters[track.AsEmitter.Index] = id;
- break;
- case Track::Types::Folder:
- stream.Read(track.Color);
- break;
- default:
- return LoadResult::InvalidData;
- }
- }
-
- // Wait for all tracks to be loaded - particle system cannot be used if any of the emitters is not loaded yet
- // Note: this loop might trigger loading referenced assets on this thread
- for (int32 i = 0; i < Emitters.Count(); i++)
- {
- if (Emitters[i])
- Emitters[i]->WaitForLoaded();
- }
-
- // Load parameters overrides
- int32 overridesCount = 0;
- if (stream.CanRead())
- stream.ReadInt32(&overridesCount);
- if (overridesCount != 0)
- {
- EmitterParameterOverrideKey key;
- CommonValue value;
- for (int32 i = 0; i < overridesCount; i++)
- {
- stream.ReadInt32(&key.First);
- stream.Read(key.Second);
- stream.ReadCommonValue(&value);
- SKIP_UNUSED_PARAM_OVERRIDE();
- EmittersParametersOverrides.Add(key, Variant(value));
- }
- }
-
- break;
- }
- case 2:
- {
- // [Deprecated on 31.07.2020, expires on 31.07.2022]
- MARK_CONTENT_DEPRECATED();
-
- // Load properties
- stream.ReadFloat(&FramesPerSecond);
- stream.ReadInt32(&DurationFrames);
-
- // Load emitters
- int32 emittersCount;
- stream.ReadInt32(&emittersCount);
- Emitters.Resize(emittersCount, false);
-
- // Load tracks
- Guid id;
- int32 tracksCount;
- stream.ReadInt32(&tracksCount);
- Tracks.Resize(tracksCount, false);
- for (int32 i = 0; i < tracksCount; i++)
- {
- auto& track = Tracks[i];
-
- track.Type = (Track::Types)stream.ReadByte();
- track.Flag = (Track::Flags)stream.ReadByte();
- stream.ReadInt32(&track.ParentIndex);
- stream.ReadInt32(&track.ChildrenCount);
- stream.ReadString(&track.Name, -13);
- track.Disabled = (int32)track.Flag & (int32)Track::Flags::Mute || (track.ParentIndex != -1 && Tracks[track.ParentIndex].Disabled);
- stream.Read(track.Color);
-
- switch (track.Type)
- {
- case Track::Types::Emitter:
- stream.Read(id);
- stream.ReadInt32(&track.AsEmitter.Index);
- stream.ReadInt32(&track.AsEmitter.StartFrame);
- stream.ReadInt32(&track.AsEmitter.DurationFrames);
- Emitters[track.AsEmitter.Index] = id;
- break;
- case Track::Types::Folder:
- break;
- default:
- return LoadResult::InvalidData;
- }
- }
-
- // Wait for all tracks to be loaded - particle system cannot be used if any of the emitters is not loaded yet
- // Note: this loop might trigger loading referenced assets on this thread
- for (int32 i = 0; i < Emitters.Count(); i++)
- {
- if (Emitters[i])
- Emitters[i]->WaitForLoaded();
- }
-
- // Load parameters overrides
- int32 overridesCount = 0;
- if (stream.CanRead())
- stream.ReadInt32(&overridesCount);
- if (overridesCount != 0)
- {
- EmitterParameterOverrideKey key;
- CommonValue value;
- for (int32 i = 0; i < overridesCount; i++)
- {
- stream.ReadInt32(&key.First);
- stream.Read(key.Second);
- stream.ReadCommonValue(&value);
- SKIP_UNUSED_PARAM_OVERRIDE();
- EmittersParametersOverrides[key] = Variant(value);
- }
- }
-
- break;
- }
- PRAGMA_ENABLE_DEPRECATION_WARNINGS
case 3: // [Deprecated on 03.09.2021 expires on 03.09.2023]
MARK_CONTENT_DEPRECATED();
case 4:
diff --git a/Source/Engine/Particles/ParticlesSimulation.cpp b/Source/Engine/Particles/ParticlesSimulation.cpp
index bc1fa9eea..ef5be3ab0 100644
--- a/Source/Engine/Particles/ParticlesSimulation.cpp
+++ b/Source/Engine/Particles/ParticlesSimulation.cpp
@@ -6,7 +6,6 @@
#include "Particles.h"
#include "Engine/Graphics/GPUBuffer.h"
#include "Engine/Graphics/GPUDevice.h"
-#include "Engine/Core/Types/CommonValue.h"
ParticleEmitterInstance::ParticleEmitterInstance()
{
diff --git a/Source/Engine/Serialization/JsonTools.cpp b/Source/Engine/Serialization/JsonTools.cpp
index 32d229a08..1e5b8fff6 100644
--- a/Source/Engine/Serialization/JsonTools.cpp
+++ b/Source/Engine/Serialization/JsonTools.cpp
@@ -3,7 +3,6 @@
#include "JsonTools.h"
#include "ISerializable.h"
#include "Engine/Core/Collections/Dictionary.h"
-#include "Engine/Core/Types/CommonValue.h"
#include "Engine/Core/Types/DateTime.h"
#include "Engine/Profiler/ProfilerCPU.h"
#include "Engine/Scripting/ScriptingObjectReference.h"
@@ -284,87 +283,3 @@ DateTime JsonTools::GetDateTime(const Value& value)
{
return DateTime(value.GetInt64());
}
-
-PRAGMA_DISABLE_DEPRECATION_WARNINGS
-#include "Engine/Content/Deprecated.h"
-CommonValue JsonTools::GetCommonValue(const Value& value)
-{
- // [Deprecated on 31.07.2020, expires on 31.07.2022]
- MARK_CONTENT_DEPRECATED();
- CommonValue result;
- const auto typeMember = value.FindMember("Type");
- const auto valueMember = value.FindMember("Value");
- if (typeMember != value.MemberEnd() && typeMember->value.IsInt() && valueMember != value.MemberEnd())
- {
- const auto& v = valueMember->value;
- switch ((CommonType)typeMember->value.GetInt())
- {
- case CommonType::Bool:
- result = v.GetBool();
- break;
- case CommonType::Integer:
- result = v.GetInt();
- break;
- case CommonType::Float:
- result = v.GetFloat();
- break;
- case CommonType::Vector2:
- result = GetFloat2(v);
- break;
- case CommonType::Vector3:
- result = GetFloat3(v);
- break;
- case CommonType::Vector4:
- result = GetFloat4(v);
- break;
- case CommonType::Color:
- result = GetColor(v);
- break;
- case CommonType::Guid:
- result = GetGuid(v);
- break;
- case CommonType::String:
- result = v.GetText();
- break;
- case CommonType::Box:
- result = GetBoundingBox(v);
- break;
- case CommonType::Rotation:
- result = GetQuaternion(v);
- break;
- case CommonType::Transform:
- result = GetTransform(v);
- break;
- case CommonType::Sphere:
- result = GetBoundingSphere(v);
- break;
- case CommonType::Rectangle:
- result = GetRectangle(v);
- break;
- case CommonType::Ray:
- result = GetRay(v);
- break;
- case CommonType::Pointer:
- result = (void*)v.GetInt64();
- break;
- case CommonType::Matrix:
- result = GetMatrix(v);
- break;
- case CommonType::Blob:
- {
- const int32 length = v.GetStringLength();
- result.SetBlob(length);
- Encryption::Base64Decode(v.GetString(), length, result.AsBlob.Data);
- break;
- }
- case CommonType::Object:
- result = FindObject(GetGuid(v), ScriptingObject::GetStaticClass());
- break;
- default:
- CRASH;
- break;
- }
- }
- return result;
-}
-PRAGMA_ENABLE_DEPRECATION_WARNINGS
diff --git a/Source/Engine/Serialization/JsonTools.h b/Source/Engine/Serialization/JsonTools.h
index 0e807c784..0d5c7115d 100644
--- a/Source/Engine/Serialization/JsonTools.h
+++ b/Source/Engine/Serialization/JsonTools.h
@@ -20,8 +20,6 @@
#include "Engine/Core/Math/Matrix.h"
#include "ISerializable.h"
-struct CommonValue;
-
///
/// Json value container utilities.
///
@@ -103,7 +101,6 @@ public:
static Guid GetGuid(const Value& value);
static DateTime GetDate(const Value& value);
static DateTime GetDateTime(const Value& value);
- static CommonValue GetCommonValue(const Value& value);
public:
FORCE_INLINE static String GetString(const Value& node, const char* name)
diff --git a/Source/Engine/Serialization/JsonWriter.cpp b/Source/Engine/Serialization/JsonWriter.cpp
index 577d3da70..aec164edf 100644
--- a/Source/Engine/Serialization/JsonWriter.cpp
+++ b/Source/Engine/Serialization/JsonWriter.cpp
@@ -2,10 +2,18 @@
#include "JsonWriter.h"
#include "Engine/Core/Log.h"
-#include "Engine/Core/Types/CommonValue.h"
#include "Engine/Content/Content.h"
+#include "Engine/Core/Math/Vector2.h"
+#include "Engine/Core/Math/Vector3.h"
+#include "Engine/Core/Math/Vector4.h"
#include "Engine/Core/Math/Color.h"
+#include "Engine/Core/Math/Ray.h"
#include "Engine/Core/Math/Plane.h"
+#include "Engine/Core/Math/Matrix.h"
+#include "Engine/Core/Math/Rectangle.h"
+#include "Engine/Core/Math/Transform.h"
+#include "Engine/Core/Math/BoundingBox.h"
+#include "Engine/Core/Math/BoundingSphere.h"
#include "Engine/Core/Types/DateTime.h"
#include "Engine/Level/Prefabs/Prefab.h"
#include "Engine/Level/SceneObject.h"
@@ -244,84 +252,6 @@ void JsonWriter::Matrix(const ::Matrix& value)
EndObject();
}
-PRAGMA_DISABLE_DEPRECATION_WARNINGS
-void JsonWriter::CommonValue(const ::CommonValue& value)
-{
- // [Deprecated on 31.07.2020, expires on 31.07.2022]
- StartObject();
-
- JKEY("Type");
- Int((int32)value.Type);
-
- JKEY("Value");
- switch (value.Type)
- {
- case CommonType::Bool:
- Bool(value.AsBool);
- break;
- case CommonType::Integer:
- Int(value.AsInteger);
- break;
- case CommonType::Float:
- Float(value.AsFloat);
- break;
- case CommonType::Vector2:
- Vector2(value.AsVector2);
- break;
- case CommonType::Vector3:
- Vector3(value.AsVector3);
- break;
- case CommonType::Vector4:
- Vector4(value.AsVector4);
- break;
- case CommonType::Color:
- Color(value.AsColor);
- break;
- case CommonType::Guid:
- Guid(value.AsGuid);
- break;
- case CommonType::String:
- String(value.AsString);
- break;
- case CommonType::Box:
- BoundingBox(value.AsBox);
- break;
- case CommonType::Rotation:
- Quaternion(value.AsRotation);
- break;
- case CommonType::Transform:
- Transform(value.AsTransform);
- break;
- case CommonType::Sphere:
- BoundingSphere(value.AsSphere);
- break;
- case CommonType::Rectangle:
- Rectangle(value.AsRectangle);
- break;
- case CommonType::Ray:
- Ray(value.AsRay);
- break;
- case CommonType::Pointer:
- Int64((int64)value.AsPointer);
- break;
- case CommonType::Matrix:
- Matrix(value.AsMatrix);
- break;
- case CommonType::Blob:
- Blob(value.AsBlob.Data, value.AsBlob.Length);
- break;
- case CommonType::Object:
- Guid(value.GetObjectId());
- break;
- default:
- CRASH;
- break;
- }
-
- EndObject();
-}
-PRAGMA_ENABLE_DEPRECATION_WARNINGS
-
void JsonWriter::Transform(const ::Transform& value)
{
StartObject();
diff --git a/Source/Engine/Serialization/JsonWriter.h b/Source/Engine/Serialization/JsonWriter.h
index f7f5c4c4c..b7dc1846e 100644
--- a/Source/Engine/Serialization/JsonWriter.h
+++ b/Source/Engine/Serialization/JsonWriter.h
@@ -6,7 +6,6 @@
#include "Engine/Core/Types/StringView.h"
#include "Engine/Utilities/StringConverter.h"
-struct CommonValue;
class ISerializable;
// Helper macro for JSON serialization keys (reduces allocations count)
@@ -140,7 +139,6 @@ public:
void Quaternion(const Quaternion& value);
void Ray(const Ray& value);
void Matrix(const Matrix& value);
- void CommonValue(const CommonValue& value);
void Transform(const ::Transform& value);
void Transform(const ::Transform& value, const ::Transform* other);
void Plane(const Plane& value);
diff --git a/Source/Engine/Serialization/ReadStream.h b/Source/Engine/Serialization/ReadStream.h
index ce76e8424..cc2b7e73b 100644
--- a/Source/Engine/Serialization/ReadStream.h
+++ b/Source/Engine/Serialization/ReadStream.h
@@ -108,7 +108,6 @@ public:
void Read(String& data, int16 lock);
void Read(StringAnsi& data);
void Read(StringAnsi& data, int8 lock);
- void Read(CommonValue& data);
void Read(VariantType& data);
void Read(Variant& data);
@@ -238,10 +237,6 @@ public:
/// [Deprecated on 11.10.2022, expires on 11.10.2024]
DEPRECATED("Use Read method") void ReadString(String* data, int16 lock);
- // Reads CommonValue from the stream
- /// [Deprecated on 11.10.2022, expires on 11.10.2024]
- DEPRECATED("Use Read method") void ReadCommonValue(CommonValue* data);
-
// Reads VariantType from the stream
/// [Deprecated on 11.10.2022, expires on 11.10.2024]
DEPRECATED("Use Read method") void ReadVariantType(VariantType* data);
diff --git a/Source/Engine/Serialization/Stream.cpp b/Source/Engine/Serialization/Stream.cpp
index 4c9b94042..6d2dde57d 100644
--- a/Source/Engine/Serialization/Stream.cpp
+++ b/Source/Engine/Serialization/Stream.cpp
@@ -5,9 +5,18 @@
#include "JsonWriters.h"
#include "JsonSerializer.h"
#include "MemoryReadStream.h"
-#include "Engine/Core/Types/CommonValue.h"
#include "Engine/Core/Types/Variant.h"
#include "Engine/Core/Collections/Dictionary.h"
+#include "Engine/Core/Math/Vector2.h"
+#include "Engine/Core/Math/Vector3.h"
+#include "Engine/Core/Math/Vector4.h"
+#include "Engine/Core/Math/Matrix.h"
+#include "Engine/Core/Math/Ray.h"
+#include "Engine/Core/Math/Rectangle.h"
+#include "Engine/Core/Math/Transform.h"
+#include "Engine/Core/Math/BoundingBox.h"
+#include "Engine/Core/Math/BoundingSphere.h"
+#include "Engine/Core/Math/Color.h"
#include "Engine/Content/Asset.h"
#include "Engine/Core/Cache.h"
#include "Engine/Debug/Exceptions/JsonParseException.h"
@@ -105,137 +114,6 @@ void ReadStream::Read(String& data, int16 lock)
}
}
-PRAGMA_DISABLE_DEPRECATION_WARNINGS
-void ReadStream::Read(CommonValue& data)
-{
- // [Deprecated on 31.07.2020, expires on 31.07.2022]
- byte type;
- ReadByte(&type);
- switch (static_cast(type))
- {
- case CommonType::Bool:
- data.Set(ReadBool());
- break;
- case CommonType::Integer:
- {
- int32 v;
- ReadInt32(&v);
- data.Set(v);
- }
- break;
- case CommonType::Float:
- {
- float v;
- ReadFloat(&v);
- data.Set(v);
- }
- break;
- case CommonType::Vector2:
- {
- Float2 v;
- Read(v);
- data.Set(v);
- }
- break;
- case CommonType::Vector3:
- {
- Float3 v;
- Read(v);
- data.Set(v);
- }
- break;
- case CommonType::Vector4:
- {
- Float4 v;
- Read(v);
- data.Set(v);
- }
- break;
- case CommonType::Color:
- {
- Color v;
- Read(v);
- data.Set(v);
- }
- break;
- case CommonType::Guid:
- {
- Guid v;
- Read(v);
- data.Set(v);
- }
- break;
- case CommonType::String:
- {
- String v;
- Read(v, 953);
- data.Set(v);
- }
- break;
- case CommonType::Box:
- {
- BoundingBox v;
- Read(v);
- data.Set(v);
- }
- break;
- case CommonType::Rotation:
- {
- Quaternion v;
- Read(v);
- data.Set(v);
- }
- break;
- case CommonType::Transform:
- {
- Transform v;
- Read(v);
- data.Set(v);
- }
- break;
- case CommonType::Sphere:
- {
- BoundingSphere v;
- Read(v);
- data.Set(v);
- }
- break;
- case CommonType::Rectangle:
- {
- Rectangle v;
- Read(v);
- data.Set(v);
- }
- case CommonType::Ray:
- {
- Ray v;
- Read(v);
- data.Set(v);
- }
- break;
- case CommonType::Matrix:
- {
- Matrix v;
- Read(v);
- data.Set(v);
- }
- break;
- case CommonType::Blob:
- {
- int32 length;
- Read(length);
- data.SetBlob(length);
- if (length > 0)
- {
- ReadBytes(data.AsBlob.Data, length);
- }
- }
- break;
- default: CRASH;
- }
-}
-PRAGMA_ENABLE_DEPRECATION_WARNINGS
-
void ReadStream::Read(VariantType& data)
{
data = VariantType((VariantType::Types)ReadByte());
@@ -550,13 +428,6 @@ void ReadStream::ReadString(String* data, int16 lock)
Read(*data, lock);
}
-PRAGMA_DISABLE_DEPRECATION_WARNINGS
-void ReadStream::ReadCommonValue(CommonValue* data)
-{
- Read(*data);
-}
-PRAGMA_ENABLE_DEPRECATION_WARNINGS
-
void ReadStream::ReadVariantType(VariantType* data)
{
Read(*data);
@@ -740,71 +611,6 @@ void WriteStream::Write(const StringAnsiView& data, int8 lock)
WriteUint8((uint8)((uint8)data[i] ^ lock));
}
-PRAGMA_DISABLE_DEPRECATION_WARNINGS
-void WriteStream::Write(const CommonValue& data)
-{
- // [Deprecated on 31.07.2020, expires on 31.07.2022]
- WriteByte(static_cast(data.Type));
- switch (data.Type)
- {
- case CommonType::Bool:
- Write(data.AsBool);
- break;
- case CommonType::Integer:
- Write(data.AsInteger);
- break;
- case CommonType::Float:
- Write(data.AsFloat);
- break;
- case CommonType::Vector2:
- Write(data.AsVector2);
- break;
- case CommonType::Vector3:
- Write(data.AsVector3);
- break;
- case CommonType::Vector4:
- Write(data.AsVector4);
- break;
- case CommonType::Color:
- Write(data.AsColor);
- break;
- case CommonType::Guid:
- Write(data.AsGuid);
- break;
- case CommonType::String:
- Write(data.AsString, 953);
- break;
- case CommonType::Box:
- Write(data.AsBox);
- break;
- case CommonType::Rotation:
- Write(data.AsRotation);
- break;
- case CommonType::Transform:
- Write(data.AsTransform);
- break;
- case CommonType::Sphere:
- Write(data.AsSphere);
- break;
- case CommonType::Rectangle:
- Write(data.AsRectangle);
- break;
- case CommonType::Ray:
- Write(data.AsRay);
- break;
- case CommonType::Matrix:
- Write(data.AsMatrix);
- break;
- case CommonType::Blob:
- WriteInt32(data.AsBlob.Length);
- if (data.AsBlob.Length > 0)
- WriteBytes(data.AsBlob.Data, data.AsBlob.Length);
- break;
- default: CRASH;
- }
-}
-PRAGMA_ENABLE_DEPRECATION_WARNINGS
-
void WriteStream::Write(const VariantType& data)
{
WriteByte((byte)data.Type);
@@ -1004,13 +810,6 @@ void WriteStream::WriteStringAnsi(const StringAnsiView& data, int8 lock)
Write(data, lock);
}
-PRAGMA_DISABLE_DEPRECATION_WARNINGS
-void WriteStream::WriteCommonValue(const CommonValue& data)
-{
- Write(data);
-}
-PRAGMA_ENABLE_DEPRECATION_WARNINGS
-
void WriteStream::WriteVariantType(const VariantType& data)
{
Write(data);
diff --git a/Source/Engine/Serialization/Stream.h b/Source/Engine/Serialization/Stream.h
index 5c585ecf9..7e82467f5 100644
--- a/Source/Engine/Serialization/Stream.h
+++ b/Source/Engine/Serialization/Stream.h
@@ -10,7 +10,6 @@
class ReadStream;
class WriteStream;
-struct CommonValue;
struct Variant;
struct VariantType;
class ISerializable;
diff --git a/Source/Engine/Serialization/WriteStream.h b/Source/Engine/Serialization/WriteStream.h
index 0412353fb..f027deabb 100644
--- a/Source/Engine/Serialization/WriteStream.h
+++ b/Source/Engine/Serialization/WriteStream.h
@@ -133,7 +133,6 @@ public:
void Write(const StringView& data, int16 lock);
void Write(const StringAnsiView& data);
void Write(const StringAnsiView& data, int8 lock);
- void Write(const CommonValue& data);
void Write(const VariantType& data);
void Write(const Variant& data);
@@ -262,11 +261,6 @@ public:
// @param lock Characters pass in the stream
DEPRECATED("Use Write method") void WriteStringAnsi(const StringAnsiView& data, int8 lock);
- // Writes CommonValue to the stream
- /// [Deprecated on 11.10.2022, expires on 11.10.2024]
- // @param data Data to write
- DEPRECATED("Use Write method") void WriteCommonValue(const CommonValue& data);
-
// Writes VariantType to the stream
/// [Deprecated on 11.10.2022, expires on 11.10.2024]
// @param data Data to write
diff --git a/Source/Engine/Visject/Graph.h b/Source/Engine/Visject/Graph.h
index 39d6267ec..19aa3e892 100644
--- a/Source/Engine/Visject/Graph.h
+++ b/Source/Engine/Visject/Graph.h
@@ -7,13 +7,10 @@
#include "VisjectMeta.h"
#include "GraphNode.h"
#include "GraphParameter.h"
-#include "Engine/Content/Deprecated.h"
#include "Engine/Serialization/ReadStream.h"
#include "Engine/Serialization/WriteStream.h"
// [Deprecated on 31.07.2020, expires on 31.07.2022]
-extern FLAXENGINE_API void ReadOldGraphParamValue_Deprecated(byte graphParamType, ReadStream* stream, GraphParameter* param);
-extern FLAXENGINE_API void ReadOldGraphNodeValue_Deprecated(ReadStream* stream, Variant& result);
extern FLAXENGINE_API void ReadOldGraphBoxType_Deprecated(uint32 connectionType, VariantType& type);
extern FLAXENGINE_API StringView GetGraphFunctionTypeName_Deprecated(const Variant& v);
@@ -183,158 +180,10 @@ public:
Array tmpHints;
if (version < 7000)
{
- // [Deprecated on 31.07.2020, expires on 31.07.2022]
- MARK_CONTENT_DEPRECATED();
-
- // Time saved
- int64 timeSaved;
- stream->ReadInt64(&timeSaved);
-
- // Nodes count
- int32 nodesCount;
- stream->ReadInt32(&nodesCount);
- Nodes.Resize(nodesCount, false);
-
- // Parameters count
- int32 parametersCount;
- stream->ReadInt32(¶metersCount);
- Parameters.Resize(parametersCount, false);
-
- // For each node
- for (int32 i = 0; i < nodesCount; i++)
- {
- auto node = &Nodes[i];
-
- // ID
- stream->ReadUint32(&node->ID);
-
- // Type
- stream->ReadUint32(&node->Type);
-
- if (onNodeCreated(node))
- return true;
- }
-
- // For each param
- for (int32 i = 0; i < parametersCount; i++)
- {
- // Create param
- auto param = &Parameters[i];
-
- // Properties
- auto type = stream->ReadByte();
- stream->Read(param->Identifier);
- stream->Read(param->Name, 97);
- param->IsPublic = stream->ReadBool();
- bool isStatic = stream->ReadBool();
- bool isUIVisible = stream->ReadBool();
- bool isUIEditable = stream->ReadBool();
-
- // References [Deprecated]
- int32 refsCount;
- stream->ReadInt32(&refsCount);
- for (int32 j = 0; j < refsCount; j++)
- {
- uint32 refID;
- stream->ReadUint32(&refID);
- }
-
- // Value
- ReadOldGraphParamValue_Deprecated(type, stream, param);
-
- // Meta
- if (param->Meta.Load(stream, loadMeta))
- return true;
-
- if (onParamCreated(param))
- return true;
- }
-
- // For each node
- for (int32 i = 0; i < nodesCount; i++)
- {
- auto node = &Nodes[i];
-
- // Values
- int32 valuesCnt;
- stream->ReadInt32(&valuesCnt);
- node->Values.Resize(valuesCnt);
- for (int32 j = 0; j < valuesCnt; j++)
- ReadOldGraphNodeValue_Deprecated(stream, node->Values[j]);
-
- // Boxes
- uint16 boxesCount;
- stream->ReadUint16(&boxesCount);
- node->Boxes.Clear();
- for (int32 j = 0; j < boxesCount; j++)
- {
- byte boxID = stream->ReadByte();
- node->Boxes.Resize(node->Boxes.Count() > boxID + 1 ? node->Boxes.Count() : boxID + 1);
- Box* box = &node->Boxes[boxID];
-
- box->Parent = node;
- box->ID = boxID;
- uint32 connectionType;
- stream->ReadUint32((uint32*)&connectionType);
- ReadOldGraphBoxType_Deprecated(connectionType, box->Type);
-
- uint16 connectionsCount;
- stream->ReadUint16(&connectionsCount);
- box->Connections.Resize(connectionsCount);
- for (int32 k = 0; k < connectionsCount; k++)
- {
- uint32 targetNodeID;
- stream->ReadUint32(&targetNodeID);
- byte targetBoxID = stream->ReadByte();
- TmpConnectionHint hint;
- hint.Node = GetNode(targetNodeID);
- if (hint.Node == nullptr)
- return true;
- hint.BoxID = targetBoxID;
- box->Connections[k] = (Box*)(intptr)tmpHints.Count();
- tmpHints.Add(hint);
- }
- }
-
- // Meta
- if (node->Meta.Load(stream, loadMeta))
- return true;
-
- if (onNodeLoaded(node))
- return true;
- }
-
- // Visject Meta
- if (Meta.Load(stream, loadMeta))
- return true;
-
- // Setup connections
- for (int32 i = 0; i < Nodes.Count(); i++)
- {
- auto node = &Nodes[i];
- for (int32 j = 0; j < node->Boxes.Count(); j++)
- {
- Box* box = &node->Boxes[j];
- if (box->Parent == nullptr)
- continue;
- for (int32 k = 0; k < box->Connections.Count(); k++)
- {
- int32 hintIndex = (int32)(intptr)box->Connections[k];
- TmpConnectionHint hint = tmpHints[hintIndex];
- box->Connections[k] = hint.Node->GetBox(hint.BoxID);
- }
- }
- }
-
- // Ending char
- byte end;
- stream->ReadByte(&end);
- if (end != '\t')
- {
- return true;
- }
+ LOG(Warning, "Not supported Visject Surface version. Open and re-save asset with Flax 1.11.");
+ return true;
}
- else if (version == 7000)
+ if (version == 7000)
{
// Nodes count
int32 nodesCount;
diff --git a/Source/Engine/Visject/GraphUtilities.cpp b/Source/Engine/Visject/GraphUtilities.cpp
index eb551864b..36bfe297f 100644
--- a/Source/Engine/Visject/GraphUtilities.cpp
+++ b/Source/Engine/Visject/GraphUtilities.cpp
@@ -1,6 +1,9 @@
// Copyright (c) Wojciech Figat. All rights reserved.
#include "GraphUtilities.h"
+#include "Engine/Core/Math/Vector2.h"
+#include "Engine/Core/Math/Vector3.h"
+#include "Engine/Core/Math/Vector4.h"
// [Deprecated on 31.07.2020, expires on 31.07.2022]
enum class GraphParamType_Deprecated
@@ -56,130 +59,17 @@ enum class GraphConnectionType_Deprecated : uint32
};
// Required by deprecated graph data upgrade code
+#include "Engine/Content/Deprecated.h"
#include "Engine/Content/Assets/Texture.h"
#include "Engine/Content/Assets/CubeTexture.h"
#include "Engine/Scripting/ScriptingObjectReference.h"
-#include "Engine/Core/Types/CommonValue.h"
#include "Engine/Level/Actor.h"
PRAGMA_DISABLE_DEPRECATION_WARNINGS
-FLAXENGINE_API void ReadOldGraphParamValue_Deprecated(byte graphParamType, ReadStream* stream, GraphParameter* param)
-{
- // [Deprecated on 31.07.2020, expires on 31.07.2022]
- CommonValue value;
- stream->ReadCommonValue(&value);
- switch ((GraphParamType_Deprecated)graphParamType)
- {
- case GraphParamType_Deprecated::Bool:
- param->Type = VariantType(VariantType::Bool);
- param->Value = value.GetBool();
- break;
- case GraphParamType_Deprecated::Integer:
- param->Type = VariantType(VariantType::Int);
- param->Value = value.GetInteger();
- break;
- case GraphParamType_Deprecated::Float:
- param->Type = VariantType(VariantType::Float);
- param->Value = value.GetFloat();
- break;
- case GraphParamType_Deprecated::Vector2:
- param->Type = VariantType(VariantType::Float2);
- param->Value = value.GetVector2();
- break;
- case GraphParamType_Deprecated::Vector3:
- param->Type = VariantType(VariantType::Float3);
- param->Value = value.GetVector3();
- break;
- case GraphParamType_Deprecated::Vector4:
- param->Type = VariantType(VariantType::Float4);
- param->Value = value.GetVector4();
- break;
- case GraphParamType_Deprecated::Color:
- param->Type = VariantType(VariantType::Color);
- param->Value = value.GetColor();
- break;
- case GraphParamType_Deprecated::Texture:
- case GraphParamType_Deprecated::NormalMap:
- ASSERT(value.Type == CommonType::Guid);
- param->Type = VariantType(VariantType::Asset, TEXT("FlaxEngine.Texture"));
- param->Value.SetAsset(LoadAsset(value.AsGuid, Texture::TypeInitializer));
- break;
- case GraphParamType_Deprecated::String:
- ASSERT(value.Type == CommonType::String);
- param->Type = VariantType(VariantType::String);
- param->Value.SetString(StringView(value.AsString));
- break;
- case GraphParamType_Deprecated::Box:
- ASSERT(value.Type == CommonType::Box);
- param->Type = VariantType(VariantType::BoundingBox);
- param->Value = Variant(value.AsBox);
- break;
- case GraphParamType_Deprecated::Rotation:
- ASSERT(value.Type == CommonType::Rotation);
- param->Type = VariantType(VariantType::Quaternion);
- param->Value = value.AsRotation;
- break;
- case GraphParamType_Deprecated::Transform:
- ASSERT(value.Type == CommonType::Transform);
- param->Type = VariantType(VariantType::Transform);
- param->Value = Variant(value.AsTransform);
- break;
- case GraphParamType_Deprecated::Asset:
- ASSERT(value.Type == CommonType::Guid);
- param->Type = VariantType(VariantType::Asset);
- param->Value.SetAsset(LoadAsset(value.AsGuid, Asset::TypeInitializer));
- break;
- case GraphParamType_Deprecated::Rectangle:
- ASSERT(value.Type == CommonType::Rectangle);
- param->Type = VariantType(VariantType::Rectangle);
- param->Value = value.AsRectangle;
- break;
- case GraphParamType_Deprecated::Matrix:
- ASSERT(value.Type == CommonType::Matrix);
- param->Type = VariantType(VariantType::Matrix);
- param->Value = Variant(value.AsMatrix);
- break;
- case GraphParamType_Deprecated::Actor:
- ASSERT(value.Type == CommonType::Guid);
- param->Type = VariantType(VariantType::Object, TEXT("FlaxEngine.Actor"));
- param->Value.SetObject(FindObject(value.AsGuid, Actor::GetStaticClass()));
- break;
- case GraphParamType_Deprecated::CubeTexture:
- ASSERT(value.Type == CommonType::Guid);
- param->Type = VariantType(VariantType::Asset, TEXT("FlaxEngine.CubeTexture"));
- param->Value.SetAsset(LoadAsset(value.AsGuid, CubeTexture::TypeInitializer));
- break;
- case GraphParamType_Deprecated::GPUTexture:
- case GraphParamType_Deprecated::GPUTextureArray:
- case GraphParamType_Deprecated::GPUTextureVolume:
- case GraphParamType_Deprecated::GPUTextureCube:
- param->Type = VariantType(VariantType::Object, TEXT("FlaxEngine.GPUTexture"));
- param->Value.SetObject(nullptr);
- break;
- case GraphParamType_Deprecated::SceneTexture:
- param->Type = VariantType(VariantType::Enum, TEXT("FlaxEngine.MaterialSceneTextures"));
- param->Value.AsUint64 = (uint64)value.AsInteger;
- break;
- case GraphParamType_Deprecated::ChannelMask:
- param->Type = VariantType(VariantType::Enum, TEXT("FlaxEngine.ChannelMask"));
- param->Value.AsUint64 = (uint64)value.AsInteger;
- break;
- default:
- CRASH;
- }
-}
-
-FLAXENGINE_API void ReadOldGraphNodeValue_Deprecated(ReadStream* stream, Variant& result)
-{
- // [Deprecated on 31.07.2020, expires on 31.07.2022]
- CommonValue value;
- stream->ReadCommonValue(&value);
- result = Variant(value);
-}
-
FLAXENGINE_API void ReadOldGraphBoxType_Deprecated(uint32 connectionType, VariantType& type)
{
// [Deprecated on 31.07.2020, expires on 31.07.2022]
+ MARK_CONTENT_DEPRECATED();
switch ((GraphConnectionType_Deprecated)connectionType)
{
case GraphConnectionType_Deprecated::Invalid:
@@ -247,6 +137,7 @@ FLAXENGINE_API void ReadOldGraphBoxType_Deprecated(uint32 connectionType, Varian
FLAXENGINE_API StringView GetGraphFunctionTypeName_Deprecated(const Variant& v)
{
// [Deprecated on 31.07.2020, expires on 31.07.2022]
+ MARK_CONTENT_DEPRECATED();
if (v.Type.Type == VariantType::String)
return (StringView)v;
if (v.Type.Type == VariantType::Int)