Merge remote-tracking branch 'origin/master' into gi
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -19,6 +19,7 @@ float3 ViewDir;
|
||||
float TimeParam;
|
||||
float4 ViewInfo;
|
||||
float4 ScreenSize;
|
||||
float4 ViewSize;
|
||||
@1META_CB_END
|
||||
|
||||
// Shader resources
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Content/Shaders/GI/DDGI.flax
LFS
BIN
Content/Shaders/GI/DDGI.flax
LFS
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Content/Shaders/SSR.flax
LFS
BIN
Content/Shaders/SSR.flax
LFS
Binary file not shown.
@@ -164,16 +164,16 @@ namespace FlaxEditor.Options
|
||||
var editorAnalyticsTrackingFile = Path.Combine(Editor.LocalCachePath, "noTracking");
|
||||
if (Options.General.EnableEditorAnalytics)
|
||||
{
|
||||
if (!File.Exists(editorAnalyticsTrackingFile))
|
||||
if (File.Exists(editorAnalyticsTrackingFile))
|
||||
{
|
||||
File.WriteAllText(editorAnalyticsTrackingFile, "Don't track me, please.");
|
||||
File.Delete(editorAnalyticsTrackingFile);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (File.Exists(editorAnalyticsTrackingFile))
|
||||
if (!File.Exists(editorAnalyticsTrackingFile))
|
||||
{
|
||||
File.Delete(editorAnalyticsTrackingFile);
|
||||
File.WriteAllText(editorAnalyticsTrackingFile, "Don't track me, please.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
#if USE_LARGE_WORLDS
|
||||
using Real = System.Double;
|
||||
#else
|
||||
using Real = System.Single;
|
||||
#endif
|
||||
|
||||
// Copyright (c) 2012-2022 Wojciech Figat. All rights reserved.
|
||||
|
||||
using System;
|
||||
@@ -683,6 +689,89 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
DefaultValues = new object[] { typeof(int).FullName, typeof(string).FullName },
|
||||
Elements = new[] { NodeElementArchetype.Factory.Output(0, string.Empty, null, 0) }
|
||||
},
|
||||
new NodeArchetype
|
||||
{
|
||||
TypeID = 15,
|
||||
Title = "Double",
|
||||
Description = "Constant floating point",
|
||||
Flags = NodeFlags.AllGraphs,
|
||||
Size = new Float2(110, 20),
|
||||
DefaultValues = new object[]
|
||||
{
|
||||
0.0d
|
||||
},
|
||||
Elements = new[]
|
||||
{
|
||||
NodeElementArchetype.Factory.Output(0, "Value", typeof(double), 0),
|
||||
NodeElementArchetype.Factory.Float(0, 0, 0)
|
||||
},
|
||||
},
|
||||
new NodeArchetype
|
||||
{
|
||||
TypeID = 16,
|
||||
Title = "Vector2",
|
||||
Description = "Constant Vector2",
|
||||
Flags = NodeFlags.AllGraphs,
|
||||
Size = new Float2(130, 60),
|
||||
DefaultValues = new object[]
|
||||
{
|
||||
Vector2.Zero
|
||||
},
|
||||
Elements = new[]
|
||||
{
|
||||
NodeElementArchetype.Factory.Output(0, "Value", typeof(Vector2), 0),
|
||||
NodeElementArchetype.Factory.Output(1, "X", typeof(Real), 1),
|
||||
NodeElementArchetype.Factory.Output(2, "Y", typeof(Real), 2),
|
||||
NodeElementArchetype.Factory.Vector_X(0, 1 * Surface.Constants.LayoutOffsetY, 0),
|
||||
NodeElementArchetype.Factory.Vector_Y(0, 2 * Surface.Constants.LayoutOffsetY, 0)
|
||||
}
|
||||
},
|
||||
new NodeArchetype
|
||||
{
|
||||
TypeID = 17,
|
||||
Title = "Vector3",
|
||||
Description = "Constant Vector3",
|
||||
Flags = NodeFlags.AllGraphs,
|
||||
Size = new Float2(130, 80),
|
||||
DefaultValues = new object[]
|
||||
{
|
||||
Vector3.Zero
|
||||
},
|
||||
Elements = new[]
|
||||
{
|
||||
NodeElementArchetype.Factory.Output(0, "Value", typeof(Vector3), 0),
|
||||
NodeElementArchetype.Factory.Output(1, "X", typeof(Real), 1),
|
||||
NodeElementArchetype.Factory.Output(2, "Y", typeof(Real), 2),
|
||||
NodeElementArchetype.Factory.Output(3, "Z", typeof(Real), 3),
|
||||
NodeElementArchetype.Factory.Vector_X(0, 1 * Surface.Constants.LayoutOffsetY, 0),
|
||||
NodeElementArchetype.Factory.Vector_Y(0, 2 * Surface.Constants.LayoutOffsetY, 0),
|
||||
NodeElementArchetype.Factory.Vector_Z(0, 3 * Surface.Constants.LayoutOffsetY, 0)
|
||||
}
|
||||
},
|
||||
new NodeArchetype
|
||||
{
|
||||
TypeID = 18,
|
||||
Title = "Vector4",
|
||||
Description = "Constant Vector4",
|
||||
Flags = NodeFlags.AllGraphs,
|
||||
Size = new Float2(130, 100),
|
||||
DefaultValues = new object[]
|
||||
{
|
||||
Vector4.Zero
|
||||
},
|
||||
Elements = new[]
|
||||
{
|
||||
NodeElementArchetype.Factory.Output(0, "Value", typeof(Vector4), 0),
|
||||
NodeElementArchetype.Factory.Output(1, "X", typeof(Real), 1),
|
||||
NodeElementArchetype.Factory.Output(2, "Y", typeof(Real), 2),
|
||||
NodeElementArchetype.Factory.Output(3, "Z", typeof(Real), 3),
|
||||
NodeElementArchetype.Factory.Output(4, "W", typeof(Real), 4),
|
||||
NodeElementArchetype.Factory.Vector_X(0, 1 * Surface.Constants.LayoutOffsetY, 0),
|
||||
NodeElementArchetype.Factory.Vector_Y(0, 2 * Surface.Constants.LayoutOffsetY, 0),
|
||||
NodeElementArchetype.Factory.Vector_Z(0, 3 * Surface.Constants.LayoutOffsetY, 0),
|
||||
NodeElementArchetype.Factory.Vector_W(0, 4 * Surface.Constants.LayoutOffsetY, 0)
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -863,6 +863,19 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
NodeElementArchetype.Factory.TextBox(0, 40, 300, 200, 0),
|
||||
}
|
||||
},
|
||||
new NodeArchetype
|
||||
{
|
||||
TypeID = 39,
|
||||
Title = "View Size",
|
||||
Description = "The size of the view. The draw rectangle size in GUI materials.",
|
||||
Flags = NodeFlags.MaterialGraph,
|
||||
Size = new Float2(150, 40),
|
||||
Elements = new[]
|
||||
{
|
||||
NodeElementArchetype.Factory.Output(0, "Size", typeof(Float2), 0),
|
||||
NodeElementArchetype.Factory.Output(1, "Inv Size", typeof(Float2), 1),
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +86,6 @@ API_ENUM() enum class AlphaBlendMode : byte
|
||||
class AlphaBlend
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Converts the input alpha value from a linear 0-1 value into the output alpha described by blend mode.
|
||||
/// </summary>
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
struct NodeAnimationData
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The target node name.
|
||||
/// </summary>
|
||||
@@ -34,7 +33,6 @@ public:
|
||||
LinearCurve<Float3> Scale;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NodeAnimationData"/> class.
|
||||
/// </summary>
|
||||
@@ -46,7 +44,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Evaluates the animation transformation at the specified time (only for the curves with non-empty data).
|
||||
/// </summary>
|
||||
@@ -98,7 +95,6 @@ public:
|
||||
struct AnimationData
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The duration of the animation (in frames).
|
||||
/// </summary>
|
||||
@@ -125,7 +121,6 @@ public:
|
||||
Array<NodeAnimationData> Channels;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the length of the animation (in seconds).
|
||||
/// </summary>
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
class AnimationsService : public EngineService
|
||||
{
|
||||
public:
|
||||
|
||||
AnimationsService()
|
||||
: EngineService(TEXT("Animations"), -10)
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@ class Asset;
|
||||
/// </summary>
|
||||
API_CLASS(Static) class FLAXENGINE_API Animations
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(Animations);
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(Animations);
|
||||
|
||||
/// <summary>
|
||||
/// The system for Animations update.
|
||||
|
||||
@@ -286,15 +286,12 @@ template<class T, typename KeyFrame = LinearCurveKeyframe<T>>
|
||||
class CurveBase
|
||||
{
|
||||
public:
|
||||
|
||||
typedef Span<KeyFrame> KeyFrameData;
|
||||
|
||||
protected:
|
||||
|
||||
T _default;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Curve"/> class.
|
||||
/// </summary>
|
||||
@@ -320,7 +317,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the default value for the keyframes.
|
||||
/// </summary>
|
||||
@@ -338,7 +334,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Evaluates the animation curve value at the specified time.
|
||||
/// </summary>
|
||||
@@ -466,7 +461,6 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
/// <summary>
|
||||
/// Returns a pair of keys that can be used for interpolating to field the value at the provided time.
|
||||
/// </summary>
|
||||
@@ -507,16 +501,13 @@ template<class T, typename KeyFrame = LinearCurveKeyframe<T>>
|
||||
class Curve : public CurveBase<T, KeyFrame>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef CurveBase<T, KeyFrame> Base;
|
||||
using KeyFrameCollection = Array<KeyFrame>;
|
||||
|
||||
private:
|
||||
|
||||
KeyFrameCollection _keyframes;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Curve"/> class.
|
||||
/// </summary>
|
||||
@@ -552,7 +543,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the length of the animation curve, from time zero to last keyframe.
|
||||
/// </summary>
|
||||
@@ -627,7 +617,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Evaluates the animation curve value at the specified time.
|
||||
/// </summary>
|
||||
@@ -745,7 +734,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
FORCE_INLINE KeyFrame& operator[](int32 index)
|
||||
{
|
||||
return _keyframes[index];
|
||||
|
||||
@@ -135,21 +135,21 @@ bool AnimGraphBase::onNodeLoaded(Node* n)
|
||||
// Check if this node needs a state container
|
||||
switch (n->GroupID)
|
||||
{
|
||||
// Tools
|
||||
// Tools
|
||||
case 7:
|
||||
switch (n->TypeID)
|
||||
{
|
||||
// Time
|
||||
// Time
|
||||
case 5:
|
||||
ADD_BUCKET(AnimationBucketInit);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
// Animation
|
||||
// Animation
|
||||
case 9:
|
||||
switch (n->TypeID)
|
||||
{
|
||||
// Output
|
||||
// Output
|
||||
case 1:
|
||||
_rootNode = n;
|
||||
if (_rootNode->Values.Count() < 1)
|
||||
@@ -158,16 +158,16 @@ bool AnimGraphBase::onNodeLoaded(Node* n)
|
||||
_rootNode->Values[0] = (int32)RootMotionMode::NoExtraction;
|
||||
}
|
||||
break;
|
||||
// Animation
|
||||
// Animation
|
||||
case 2:
|
||||
ADD_BUCKET(AnimationBucketInit);
|
||||
n->Assets[0] = (Asset*)Content::LoadAsync<Animation>((Guid)n->Values[0]);
|
||||
break;
|
||||
// Blend with Mask
|
||||
// Blend with Mask
|
||||
case 11:
|
||||
n->Assets[0] = (Asset*)Content::LoadAsync<SkeletonMask>((Guid)n->Values[1]);
|
||||
break;
|
||||
// Multi Blend 1D
|
||||
// Multi Blend 1D
|
||||
case 12:
|
||||
{
|
||||
ADD_BUCKET(MultiBlendBucketInit);
|
||||
@@ -183,7 +183,7 @@ bool AnimGraphBase::onNodeLoaded(Node* n)
|
||||
Sorting::SortArray(n->Data.MultiBlend1D.IndicesSorted, ANIM_GRAPH_MULTI_BLEND_MAX_ANIMS, &SortMultiBlend1D, n);
|
||||
break;
|
||||
}
|
||||
// Multi Blend 2D
|
||||
// Multi Blend 2D
|
||||
case 13:
|
||||
{
|
||||
ADD_BUCKET(MultiBlendBucketInit);
|
||||
@@ -216,15 +216,17 @@ bool AnimGraphBase::onNodeLoaded(Node* n)
|
||||
Delaunay2D::Triangulate(vertices, triangles);
|
||||
if (triangles.Count() == 0)
|
||||
{
|
||||
switch (vertices.Count())
|
||||
// Insert dummy triangles to have something working (eg. blend points are on the same axis)
|
||||
int32 verticesLeft = vertices.Count();
|
||||
while (verticesLeft >= 3)
|
||||
{
|
||||
case 1:
|
||||
triangles.Add(Delaunay2D::Triangle(0, 0, 0));
|
||||
break;
|
||||
case 2:
|
||||
triangles.Add(Delaunay2D::Triangle(0, 1, 0));
|
||||
break;
|
||||
verticesLeft -= 3;
|
||||
triangles.Add(Delaunay2D::Triangle(verticesLeft, verticesLeft + 1, verticesLeft + 2));
|
||||
}
|
||||
if (verticesLeft == 1)
|
||||
triangles.Add(Delaunay2D::Triangle(0, 0, 0));
|
||||
else if (verticesLeft == 2)
|
||||
triangles.Add(Delaunay2D::Triangle(0, 1, 0));
|
||||
}
|
||||
|
||||
// Store triangles vertices indices (map the back to the anim node slots)
|
||||
@@ -239,13 +241,13 @@ bool AnimGraphBase::onNodeLoaded(Node* n)
|
||||
|
||||
break;
|
||||
}
|
||||
// Blend Pose
|
||||
// Blend Pose
|
||||
case 14:
|
||||
{
|
||||
ADD_BUCKET(BlendPoseBucketInit);
|
||||
break;
|
||||
}
|
||||
// State Machine
|
||||
// State Machine
|
||||
case 18:
|
||||
{
|
||||
ADD_BUCKET(StateMachineBucketInit);
|
||||
@@ -261,7 +263,7 @@ bool AnimGraphBase::onNodeLoaded(Node* n)
|
||||
|
||||
break;
|
||||
}
|
||||
// Entry
|
||||
// Entry
|
||||
case 19:
|
||||
{
|
||||
const auto entryTargetId = (int32)n->Values[0];
|
||||
@@ -273,7 +275,7 @@ bool AnimGraphBase::onNodeLoaded(Node* n)
|
||||
_rootNode = entryTarget;
|
||||
break;
|
||||
}
|
||||
// State
|
||||
// State
|
||||
case 20:
|
||||
{
|
||||
// Load the graph
|
||||
@@ -370,19 +372,19 @@ bool AnimGraphBase::onNodeLoaded(Node* n)
|
||||
|
||||
break;
|
||||
}
|
||||
// State Output
|
||||
// State Output
|
||||
case 21:
|
||||
{
|
||||
_rootNode = n;
|
||||
break;
|
||||
}
|
||||
// Rule Output
|
||||
// Rule Output
|
||||
case 22:
|
||||
{
|
||||
_rootNode = n;
|
||||
break;
|
||||
}
|
||||
// Animation Graph Function
|
||||
// Animation Graph Function
|
||||
case 24:
|
||||
{
|
||||
auto& data = n->Data.AnimationGraphFunction;
|
||||
@@ -401,9 +403,9 @@ bool AnimGraphBase::onNodeLoaded(Node* n)
|
||||
data.Graph = LoadSubGraph(graphData.Get(), graphData.Length(), TEXT("Animation Graph Function"));
|
||||
break;
|
||||
}
|
||||
// Transform Node (local/model space)
|
||||
// Get Node Transform (local/model space)
|
||||
// IK Aim, Two Bone IK
|
||||
// Transform Node (local/model space)
|
||||
// Get Node Transform (local/model space)
|
||||
// IK Aim, Two Bone IK
|
||||
case 25:
|
||||
case 26:
|
||||
case 28:
|
||||
@@ -418,7 +420,7 @@ bool AnimGraphBase::onNodeLoaded(Node* n)
|
||||
data.NodeIndex = -1;
|
||||
break;
|
||||
}
|
||||
// Copy Node
|
||||
// Copy Node
|
||||
case 27:
|
||||
{
|
||||
auto& data = n->Data.CopyNode;
|
||||
@@ -442,7 +444,7 @@ bool AnimGraphBase::onNodeLoaded(Node* n)
|
||||
}
|
||||
}
|
||||
break;
|
||||
// Custom
|
||||
// Custom
|
||||
case 13:
|
||||
{
|
||||
// Clear data
|
||||
|
||||
@@ -167,7 +167,6 @@ enum class RootMotionMode
|
||||
class AnimGraphStateTransition
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The transition flag types.
|
||||
/// </summary>
|
||||
@@ -195,7 +194,6 @@ public:
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The destination state node.
|
||||
/// </summary>
|
||||
@@ -230,9 +228,8 @@ DECLARE_ENUM_OPERATORS(AnimGraphStateTransition::FlagTypes);
|
||||
/// <seealso cref="GraphParameter" />
|
||||
API_CLASS() class AnimGraphParameter : public VisjectGraphParameter
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_WITH_CONSTRUCTOR_IMPL(AnimGraphParameter, VisjectGraphParameter);
|
||||
DECLARE_SCRIPTING_TYPE_WITH_CONSTRUCTOR_IMPL(AnimGraphParameter, VisjectGraphParameter);
|
||||
public:
|
||||
|
||||
AnimGraphParameter(const AnimGraphParameter& other)
|
||||
: AnimGraphParameter()
|
||||
{
|
||||
@@ -271,7 +268,6 @@ class FLAXENGINE_API AnimGraphInstanceData
|
||||
{
|
||||
friend AnimGraphExecutor;
|
||||
public:
|
||||
|
||||
// ---- Quick documentation ----
|
||||
// AnimGraphInstanceData holds a single animation graph instance playback data.
|
||||
// It has parameters (the same layout as graph) that can be modified per instance (eg. by game scripts).
|
||||
@@ -335,7 +331,6 @@ public:
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The instance data version number. Used to sync the Anim Graph data with the instance state. Handles Anim Graph reloads to ensure data is valid.
|
||||
/// </summary>
|
||||
@@ -392,7 +387,6 @@ public:
|
||||
Array<AnimGraphSlot, InlinedAllocation<4>> Slots;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Clears this container data.
|
||||
/// </summary>
|
||||
@@ -409,7 +403,6 @@ public:
|
||||
void Invalidate();
|
||||
|
||||
private:
|
||||
|
||||
struct Event
|
||||
{
|
||||
AnimEvent* Instance;
|
||||
@@ -433,7 +426,6 @@ struct AnimGraphTransitionData
|
||||
class AnimGraphBox : public VisjectGraphBox
|
||||
{
|
||||
public:
|
||||
|
||||
AnimGraphBox()
|
||||
{
|
||||
}
|
||||
@@ -452,7 +444,6 @@ public:
|
||||
class AnimGraphNode : public VisjectGraphNode<AnimGraphBox>
|
||||
{
|
||||
public:
|
||||
|
||||
struct MultiBlend1DData
|
||||
{
|
||||
/// <summary>
|
||||
@@ -575,7 +566,6 @@ public:
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The animation graph.
|
||||
/// </summary>
|
||||
@@ -592,13 +582,11 @@ public:
|
||||
AdditionalData Data;
|
||||
|
||||
public:
|
||||
|
||||
AnimGraphNode()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the per-node node transformations cache (cached).
|
||||
/// </summary>
|
||||
@@ -614,7 +602,6 @@ public:
|
||||
class AnimGraphBase : public VisjectGraph<AnimGraphNode, AnimGraphBox, AnimGraphParameter>
|
||||
{
|
||||
protected:
|
||||
|
||||
AnimGraph* _graph;
|
||||
Node* _rootNode = nullptr;
|
||||
|
||||
@@ -624,7 +611,6 @@ protected:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The sub graphs nested in this graph.
|
||||
/// </summary>
|
||||
@@ -651,7 +637,6 @@ public:
|
||||
int32 BucketsCountTotal;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Finalizes an instance of the <see cref="AnimGraphBase"/> class.
|
||||
/// </summary>
|
||||
@@ -661,7 +646,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the root node of the graph (cache don load).
|
||||
/// </summary>
|
||||
@@ -680,7 +664,6 @@ public:
|
||||
AnimSubGraph* LoadSubGraph(const void* data, int32 dataLength, const Char* name);
|
||||
|
||||
public:
|
||||
|
||||
// [Graph]
|
||||
bool Load(ReadStream* stream, bool loadMeta) override;
|
||||
void Clear() override;
|
||||
@@ -689,7 +672,6 @@ public:
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
// [Graph]
|
||||
bool onNodeLoaded(Node* n) override;
|
||||
};
|
||||
@@ -707,7 +689,6 @@ class AnimSubGraph : public AnimGraphBase
|
||||
friend AnimGraphParameter;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AnimSubGraph" /> class.
|
||||
/// </summary>
|
||||
@@ -730,7 +711,6 @@ class AnimGraph : public AnimGraphBase
|
||||
friend AnimGraphExecutor;
|
||||
|
||||
private:
|
||||
|
||||
typedef void (*InitBucketHandler)(AnimGraphInstanceData::Bucket&);
|
||||
|
||||
bool _isFunction, _isRegisteredForScriptingEvents;
|
||||
@@ -740,7 +720,6 @@ private:
|
||||
Asset* _owner;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AnimGraph"/> class.
|
||||
/// </summary>
|
||||
@@ -758,7 +737,6 @@ public:
|
||||
~AnimGraph();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The Anim Graph data version number. Used to sync the Anim Graph data with the instances state. Handles Anim Graph reloads to ensure data is valid.
|
||||
/// </summary>
|
||||
@@ -773,7 +751,6 @@ public:
|
||||
AssetReference<SkinnedModel> BaseModel;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether this graph is ready for the animation evaluation.
|
||||
/// </summary>
|
||||
@@ -787,7 +764,6 @@ public:
|
||||
bool CanUseWithSkeleton(SkinnedModel* other) const;
|
||||
|
||||
private:
|
||||
|
||||
void ClearCustomNode(Node* node);
|
||||
bool InitCustomNode(Node* node);
|
||||
|
||||
@@ -798,7 +774,6 @@ private:
|
||||
void OnScriptsLoaded();
|
||||
|
||||
public:
|
||||
|
||||
// [Graph]
|
||||
bool Load(ReadStream* stream, bool loadMeta) override;
|
||||
bool onParamCreated(Parameter* p) override;
|
||||
@@ -829,7 +804,6 @@ class AnimGraphExecutor : public VisjectExecutor
|
||||
{
|
||||
friend AnimGraphNode;
|
||||
private:
|
||||
|
||||
AnimGraph& _graph;
|
||||
RootMotionMode _rootMotionMode = RootMotionMode::NoExtraction;
|
||||
int32 _skeletonNodesCount = 0;
|
||||
@@ -838,7 +812,6 @@ private:
|
||||
static ThreadLocal<AnimGraphContext> Context;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the managed runtime calls.
|
||||
/// </summary>
|
||||
@@ -851,7 +824,6 @@ public:
|
||||
explicit AnimGraphExecutor(AnimGraph& graph);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Updates the graph animation.
|
||||
/// </summary>
|
||||
@@ -891,7 +863,6 @@ public:
|
||||
void ResetBuckets(AnimGraphContext& context, AnimGraphBase* graph);
|
||||
|
||||
private:
|
||||
|
||||
Value eatBox(Node* caller, Box* box) override;
|
||||
Graph* GetCurrentGraph() const override;
|
||||
|
||||
|
||||
@@ -516,7 +516,7 @@ void AnimGraphExecutor::ProcessGroupParameters(Box* box, Node* node, Value& valu
|
||||
auto& context = Context.Get();
|
||||
switch (node->TypeID)
|
||||
{
|
||||
// Get
|
||||
// Get
|
||||
case 1:
|
||||
{
|
||||
// Get parameter
|
||||
@@ -628,7 +628,7 @@ void AnimGraphExecutor::ProcessGroupTools(Box* box, Node* nodeBase, Value& value
|
||||
auto node = (AnimGraphNode*)nodeBase;
|
||||
switch (node->TypeID)
|
||||
{
|
||||
// Time
|
||||
// Time
|
||||
case 5:
|
||||
{
|
||||
auto& bucket = context.Data->State[node->BucketIndex].Animation;
|
||||
@@ -655,11 +655,11 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
auto node = (AnimGraphNode*)nodeBase;
|
||||
switch (node->TypeID)
|
||||
{
|
||||
// Animation Output
|
||||
// Animation Output
|
||||
case 1:
|
||||
value = tryGetValue(box, Value::Null);
|
||||
break;
|
||||
// Animation
|
||||
// Animation
|
||||
case 2:
|
||||
{
|
||||
const auto anim = node->Assets[0].As<Animation>();
|
||||
@@ -670,7 +670,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
|
||||
switch (box->ID)
|
||||
{
|
||||
// Animation
|
||||
// Animation
|
||||
case 0:
|
||||
{
|
||||
const float length = anim ? anim->GetLength() : 0.0f;
|
||||
@@ -690,21 +690,21 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
|
||||
break;
|
||||
}
|
||||
// Normalized Time
|
||||
// Normalized Time
|
||||
case 1:
|
||||
value = startTimePos + bucket.TimePosition;
|
||||
if (anim && anim->IsLoaded())
|
||||
value.AsFloat /= anim->GetLength();
|
||||
break;
|
||||
// Time
|
||||
// Time
|
||||
case 2:
|
||||
value = startTimePos + bucket.TimePosition;
|
||||
break;
|
||||
// Length
|
||||
// Length
|
||||
case 3:
|
||||
value = anim ? anim->GetLength() : 0.0f;
|
||||
break;
|
||||
// Is Playing
|
||||
// Is Playing
|
||||
case 4:
|
||||
// If anim was updated during this or a previous frame
|
||||
value = bucket.LastUpdateFrame >= context.CurrentFrameIndex - 1;
|
||||
@@ -712,7 +712,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Transform Bone (local/model space)
|
||||
// Transform Bone (local/model space)
|
||||
case 3:
|
||||
case 4:
|
||||
{
|
||||
@@ -762,7 +762,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
value = nodes;
|
||||
break;
|
||||
}
|
||||
// Local To Model
|
||||
// Local To Model
|
||||
case 5:
|
||||
{
|
||||
// [Deprecated on 15.05.2020, expires on 15.05.2021]
|
||||
@@ -794,7 +794,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
value = dst;*/
|
||||
break;
|
||||
}
|
||||
// Model To Local
|
||||
// Model To Local
|
||||
case 6:
|
||||
{
|
||||
// [Deprecated on 15.05.2020, expires on 15.05.2021]
|
||||
@@ -833,7 +833,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
value = dst;*/
|
||||
break;
|
||||
}
|
||||
// Copy Bone
|
||||
// Copy Bone
|
||||
case 7:
|
||||
{
|
||||
// [Deprecated on 13.05.2020, expires on 13.05.2021]
|
||||
@@ -885,7 +885,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
value = nodes;
|
||||
break;
|
||||
}
|
||||
// Get Bone Transform
|
||||
// Get Bone Transform
|
||||
case 8:
|
||||
{
|
||||
// [Deprecated on 13.05.2020, expires on 13.05.2021]
|
||||
@@ -899,7 +899,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
value = Variant(Transform::Identity);
|
||||
break;
|
||||
}
|
||||
// Blend
|
||||
// Blend
|
||||
case 9:
|
||||
{
|
||||
const float alpha = Math::Saturate((float)tryGetValue(node->GetBox(3), node->Values[0]));
|
||||
@@ -909,12 +909,12 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
{
|
||||
value = tryGetValue(node->GetBox(1), Value::Null);
|
||||
}
|
||||
// Only B
|
||||
// Only B
|
||||
else if (Math::NearEqual(alpha, 1.0f, ANIM_GRAPH_BLEND_THRESHOLD))
|
||||
{
|
||||
value = tryGetValue(node->GetBox(2), Value::Null);
|
||||
}
|
||||
// Blend A and B
|
||||
// Blend A and B
|
||||
else
|
||||
{
|
||||
const auto valueA = tryGetValue(node->GetBox(1), Value::Null);
|
||||
@@ -938,7 +938,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
|
||||
break;
|
||||
}
|
||||
// Blend Additive
|
||||
// Blend Additive
|
||||
case 10:
|
||||
{
|
||||
const float alpha = Math::Saturate((float)tryGetValue(node->GetBox(3), node->Values[0]));
|
||||
@@ -948,7 +948,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
{
|
||||
value = tryGetValue(node->GetBox(1), Value::Null);
|
||||
}
|
||||
// Blend A and B
|
||||
// Blend A and B
|
||||
else
|
||||
{
|
||||
const auto valueA = tryGetValue(node->GetBox(1), Value::Null);
|
||||
@@ -985,7 +985,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
|
||||
break;
|
||||
}
|
||||
// Blend with Mask
|
||||
// Blend with Mask
|
||||
case 11:
|
||||
{
|
||||
const float alpha = Math::Saturate((float)tryGetValue(node->GetBox(3), node->Values[0]));
|
||||
@@ -996,7 +996,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
{
|
||||
value = tryGetValue(node->GetBox(1), Value::Null);
|
||||
}
|
||||
// Blend A and B with mask
|
||||
// Blend A and B with mask
|
||||
else
|
||||
{
|
||||
auto valueA = tryGetValue(node->GetBox(1), Value::Null);
|
||||
@@ -1033,7 +1033,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
|
||||
break;
|
||||
}
|
||||
// Multi Blend 1D
|
||||
// Multi Blend 1D
|
||||
case 12:
|
||||
{
|
||||
ASSERT(box->ID == 0);
|
||||
@@ -1122,7 +1122,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
|
||||
break;
|
||||
}
|
||||
// Multi Blend 2D
|
||||
// Multi Blend 2D
|
||||
case 13:
|
||||
{
|
||||
ASSERT(box->ID == 0);
|
||||
@@ -1225,9 +1225,9 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
break;
|
||||
}
|
||||
|
||||
const auto v0 = points[1] - points[0];
|
||||
const auto v1 = points[2] - points[0];
|
||||
const auto v2 = p - points[0];
|
||||
auto v0 = points[1] - points[0];
|
||||
auto v1 = points[2] - points[0];
|
||||
auto v2 = p - points[0];
|
||||
|
||||
const float d00 = Float2::Dot(v0, v0);
|
||||
const float d01 = Float2::Dot(v0, v1);
|
||||
@@ -1237,8 +1237,53 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
const float coeff = (d00 * d11 - d01 * d01);
|
||||
if (Math::IsZero(coeff))
|
||||
{
|
||||
// Use only vertex A for invalid triangle
|
||||
value = SampleAnimation(node, loop, data.Length, startTimePos, bucket.TimePosition, newTimePos, aAnim, aData.W);
|
||||
const bool xAxis = Math::IsZero(v0.X) && Math::IsZero(v1.X);
|
||||
const bool yAxis = Math::IsZero(v0.Y) && Math::IsZero(v1.Y);
|
||||
if (xAxis || yAxis)
|
||||
{
|
||||
if (yAxis)
|
||||
{
|
||||
// Use code for X-axis case so swap coordinates
|
||||
Swap(v0.X, v0.Y);
|
||||
Swap(v1.X, v1.Y);
|
||||
Swap(v2.X, v2.Y);
|
||||
Swap(p.X, p.Y);
|
||||
}
|
||||
|
||||
// Use 1D blend if points are on the same line (degenerated triangle)
|
||||
// TODO: simplify this code
|
||||
if (v1.Y >= v0.Y)
|
||||
{
|
||||
if (p.Y < v0.Y && v1.Y >= v0.Y)
|
||||
{
|
||||
const float alpha = p.Y / v0.Y;
|
||||
value = SampleAnimationsWithBlend(node, loop, data.Length, startTimePos, bucket.TimePosition, newTimePos, aAnim, bAnim, aData.W, bData.W, alpha);
|
||||
}
|
||||
else
|
||||
{
|
||||
const float alpha = (p.Y - v0.Y) / (v1.Y - v0.Y);
|
||||
value = SampleAnimationsWithBlend(node, loop, data.Length, startTimePos, bucket.TimePosition, newTimePos, bAnim, cAnim, bData.W, cData.W, alpha);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p.Y < v1.Y)
|
||||
{
|
||||
const float alpha = p.Y / v1.Y;
|
||||
value = SampleAnimationsWithBlend(node, loop, data.Length, startTimePos, bucket.TimePosition, newTimePos, aAnim, cAnim, aData.W, cData.W, alpha);
|
||||
}
|
||||
else
|
||||
{
|
||||
const float alpha = (p.Y - v1.Y) / (v0.Y - v1.Y);
|
||||
value = SampleAnimationsWithBlend(node, loop, data.Length, startTimePos, bucket.TimePosition, newTimePos, cAnim, bAnim, cData.W, bData.W, alpha);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use only vertex A for invalid triangle
|
||||
value = SampleAnimation(node, loop, data.Length, startTimePos, bucket.TimePosition, newTimePos, aAnim, aData.W);
|
||||
}
|
||||
break;
|
||||
}
|
||||
const float v = (d11 * d20 - d01 * d21) / coeff;
|
||||
@@ -1280,7 +1325,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
}
|
||||
}
|
||||
|
||||
// Check if use the closes sample
|
||||
// Check if use the closest sample
|
||||
if ((void*)value == nullptr && hasBest)
|
||||
{
|
||||
const auto aAnim = node->Assets[bestAnims[0]].As<Animation>();
|
||||
@@ -1304,7 +1349,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
|
||||
break;
|
||||
}
|
||||
// Blend Pose
|
||||
// Blend Pose
|
||||
case 14:
|
||||
{
|
||||
ASSERT(box->ID == 0);
|
||||
@@ -1353,7 +1398,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
|
||||
break;
|
||||
}
|
||||
// Get Root Motion
|
||||
// Get Root Motion
|
||||
case 15:
|
||||
{
|
||||
auto pose = tryGetValue(node->GetBox(2), Value::Null);
|
||||
@@ -1384,7 +1429,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Set Root Motion
|
||||
// Set Root Motion
|
||||
case 16:
|
||||
{
|
||||
auto pose = tryGetValue(node->GetBox(1), Value::Null);
|
||||
@@ -1402,7 +1447,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
value = nodes;
|
||||
break;
|
||||
}
|
||||
// Add Root Motion
|
||||
// Add Root Motion
|
||||
case 17:
|
||||
{
|
||||
auto pose = tryGetValue(node->GetBox(1), Value::Null);
|
||||
@@ -1420,7 +1465,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
value = nodes;
|
||||
break;
|
||||
}
|
||||
// State Machine
|
||||
// State Machine
|
||||
case 18:
|
||||
{
|
||||
const int32 maxTransitionsPerUpdate = node->Values[2].AsInt;
|
||||
@@ -1581,51 +1626,51 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
|
||||
break;
|
||||
}
|
||||
// Entry
|
||||
// Entry
|
||||
case 19:
|
||||
{
|
||||
// Not used
|
||||
CRASH;
|
||||
break;
|
||||
}
|
||||
// State
|
||||
// State
|
||||
case 20:
|
||||
{
|
||||
// Not used
|
||||
CRASH;
|
||||
break;
|
||||
}
|
||||
// State Output
|
||||
// State Output
|
||||
case 21:
|
||||
value = box->HasConnection() ? eatBox(nodeBase, box->FirstConnection()) : Value::Null;
|
||||
break;
|
||||
// Rule Output
|
||||
// Rule Output
|
||||
case 22:
|
||||
value = box->HasConnection() ? eatBox(nodeBase, box->FirstConnection()) : Value::Null;
|
||||
break;
|
||||
// Transition Source State Anim
|
||||
// Transition Source State Anim
|
||||
case 23:
|
||||
{
|
||||
const AnimGraphTransitionData& transitionsData = context.TransitionData;
|
||||
switch (box->ID)
|
||||
{
|
||||
// Length
|
||||
// Length
|
||||
case 0:
|
||||
value = transitionsData.Length;
|
||||
break;
|
||||
// Time
|
||||
// Time
|
||||
case 1:
|
||||
value = transitionsData.Position;
|
||||
break;
|
||||
// Normalized Time
|
||||
// Normalized Time
|
||||
case 2:
|
||||
value = transitionsData.Position / transitionsData.Length;
|
||||
break;
|
||||
// Remaining Time
|
||||
// Remaining Time
|
||||
case 3:
|
||||
value = transitionsData.Length - transitionsData.Position;
|
||||
break;
|
||||
// Remaining Normalized Time
|
||||
// Remaining Normalized Time
|
||||
case 4:
|
||||
value = 1.0f - (transitionsData.Position / transitionsData.Length);
|
||||
break;
|
||||
@@ -1634,7 +1679,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Animation Graph Function
|
||||
// Animation Graph Function
|
||||
case 24:
|
||||
{
|
||||
// Load function graph
|
||||
@@ -1683,7 +1728,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
context.GraphStack.Pop();
|
||||
break;
|
||||
}
|
||||
// Transform Bone (local/model space)
|
||||
// Transform Bone (local/model space)
|
||||
case 25:
|
||||
case 26:
|
||||
{
|
||||
@@ -1741,7 +1786,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
value = nodes;
|
||||
break;
|
||||
}
|
||||
// Copy Node
|
||||
// Copy Node
|
||||
case 27:
|
||||
{
|
||||
// Get input
|
||||
@@ -1790,7 +1835,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
value = nodes;
|
||||
break;
|
||||
}
|
||||
// Get Node Transform (model space)
|
||||
// Get Node Transform (model space)
|
||||
case 28:
|
||||
{
|
||||
// Get input
|
||||
@@ -1802,7 +1847,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
value = Variant(Transform::Identity);
|
||||
break;
|
||||
}
|
||||
// Aim IK
|
||||
// Aim IK
|
||||
case 29:
|
||||
{
|
||||
// Get input
|
||||
@@ -1847,7 +1892,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
value = nodes;
|
||||
break;
|
||||
}
|
||||
// Get Node Transform (local space)
|
||||
// Get Node Transform (local space)
|
||||
case 30:
|
||||
{
|
||||
// Get input
|
||||
@@ -1859,7 +1904,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
value = Variant(Transform::Identity);
|
||||
break;
|
||||
}
|
||||
// Two Bone IK
|
||||
// Two Bone IK
|
||||
case 31:
|
||||
{
|
||||
// Get input
|
||||
@@ -2023,7 +2068,7 @@ void AnimGraphExecutor::ProcessGroupFunction(Box* boxBase, Node* node, Value& va
|
||||
return;
|
||||
switch (node->TypeID)
|
||||
{
|
||||
// Function Input
|
||||
// Function Input
|
||||
case 1:
|
||||
{
|
||||
// Find the function call
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
class FLAXENGINE_API InverseKinematics
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Rotates a node so it aims at a target. Solves the transformation (rotation) that needs to be applied to the node such that a provided forward vector (in node local space) aims at the target position (in skeleton model space).
|
||||
/// </summary>
|
||||
|
||||
@@ -13,9 +13,8 @@
|
||||
/// </summary>
|
||||
API_CLASS(NoSpawn) class FLAXENGINE_API SceneAnimation final : public BinaryAsset
|
||||
{
|
||||
DECLARE_BINARY_ASSET_HEADER(SceneAnimation, 1);
|
||||
DECLARE_BINARY_ASSET_HEADER(SceneAnimation, 1);
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The animation timeline track data.
|
||||
/// </summary>
|
||||
@@ -412,12 +411,10 @@ public:
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
BytesContainer _data;
|
||||
MemoryWriteStream _runtimeData;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The frames amount per second of the timeline animation.
|
||||
/// </summary>
|
||||
@@ -439,14 +436,12 @@ public:
|
||||
int32 TrackStatesCount;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the animation duration (in seconds).
|
||||
/// </summary>
|
||||
API_PROPERTY() float GetDuration() const;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the serialized timeline data.
|
||||
/// </summary>
|
||||
@@ -466,14 +461,12 @@ public:
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
// [BinaryAsset]
|
||||
#if USE_EDITOR
|
||||
void GetReferences(Array<Guid>& output) const override;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
// [SceneAnimationBase]
|
||||
LoadResult load() override;
|
||||
void unload(bool isReloading) override;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
/// </summary>
|
||||
API_CLASS() class FLAXENGINE_API SceneAnimationPlayer : public Actor, public IPostFxSettingsProvider
|
||||
{
|
||||
DECLARE_SCENE_OBJECT(SceneAnimationPlayer);
|
||||
DECLARE_SCENE_OBJECT(SceneAnimationPlayer);
|
||||
|
||||
/// <summary>
|
||||
/// Describes the scene animation updates frequency.
|
||||
@@ -32,7 +32,6 @@ DECLARE_SCENE_OBJECT(SceneAnimationPlayer);
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
enum class PlayState
|
||||
{
|
||||
Stopped,
|
||||
@@ -74,7 +73,6 @@ private:
|
||||
} _postFxSettings;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The scene animation to play.
|
||||
/// </summary>
|
||||
@@ -136,7 +134,6 @@ public:
|
||||
bool UsePrefabObjects = false;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the value that determines whether the scene animation is playing.
|
||||
/// </summary>
|
||||
@@ -209,7 +206,6 @@ public:
|
||||
API_FUNCTION() void MapTrack(const StringView& from, const Guid& to);
|
||||
|
||||
private:
|
||||
|
||||
void Restore(SceneAnimation* anim, int32 stateIndexOffset);
|
||||
bool TickPropertyTrack(int32 trackIndex, int32 stateIndexOffset, SceneAnimation* anim, float time, const SceneAnimation::Track& track, TrackInstance& state, void* target);
|
||||
typedef Array<SceneAnimation*, FixedAllocation<8>> CallStack;
|
||||
@@ -219,7 +215,6 @@ private:
|
||||
void ResetState();
|
||||
|
||||
public:
|
||||
|
||||
// [Actor]
|
||||
bool HasContentLoaded() const override;
|
||||
void Serialize(SerializeStream& stream, const void* otherObj) override;
|
||||
@@ -237,7 +232,6 @@ public:
|
||||
void Blend(PostProcessSettings& other, float weight) override;
|
||||
|
||||
protected:
|
||||
|
||||
// [Actor]
|
||||
void BeginPlay(SceneBeginData* data) override;
|
||||
void EndPlay() override;
|
||||
|
||||
@@ -23,19 +23,17 @@
|
||||
/// </summary>
|
||||
API_CLASS(Abstract, NoSpawn) class FLAXENGINE_API Asset : public ManagedScriptingObject
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(Asset);
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(Asset);
|
||||
friend Content;
|
||||
friend LoadAssetTask;
|
||||
friend class ContentService;
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The asset loading result.
|
||||
/// </summary>
|
||||
DECLARE_ENUM_7(LoadResult, Ok, Failed, MissingDataChunk, CannotLoadData, CannotLoadStorage, CannotLoadInitData, InvalidData);
|
||||
|
||||
protected:
|
||||
|
||||
volatile int64 _refCount;
|
||||
ContentLoadTask* _loadingTask;
|
||||
|
||||
@@ -45,7 +43,6 @@ protected:
|
||||
int8 _isVirtual : 1; // Indicates that asset is pure virtual (generated or temporary, has no storage so won't be saved)
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Asset"/> class.
|
||||
/// </summary>
|
||||
@@ -54,7 +51,6 @@ public:
|
||||
explicit Asset(const SpawnParams& params, const AssetInfo* info);
|
||||
|
||||
public:
|
||||
|
||||
typedef Delegate<Asset*> EventType;
|
||||
|
||||
/// <summary>
|
||||
@@ -78,7 +74,6 @@ public:
|
||||
CriticalSection Locker;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets asset's reference count. Asset will be automatically unloaded when this reaches zero.
|
||||
/// </summary>
|
||||
@@ -101,7 +96,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the path to the asset storage file. In Editor it reflects the actual file, in cooked Game, it fakes the Editor path to be informative for developers.
|
||||
/// </summary>
|
||||
@@ -143,7 +137,6 @@ public:
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Reloads the asset.
|
||||
/// </summary>
|
||||
@@ -195,7 +188,6 @@ public:
|
||||
void DeleteManaged();
|
||||
|
||||
protected:
|
||||
|
||||
/// <summary>
|
||||
/// Creates the loading tasks sequence (allows to inject custom tasks to asset loading logic).
|
||||
/// </summary>
|
||||
@@ -225,7 +217,6 @@ protected:
|
||||
virtual void unload(bool isReloading) = 0;
|
||||
|
||||
protected:
|
||||
|
||||
virtual bool IsInternalType() const;
|
||||
|
||||
bool onLoad(LoadAssetTask* task);
|
||||
@@ -237,7 +228,6 @@ protected:
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
// [ManagedScriptingObject]
|
||||
String ToString() const override;
|
||||
void OnDeleteObject() override;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
/// </summary>
|
||||
API_STRUCT() struct AssetInfo
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(AssetInfo);
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(AssetInfo);
|
||||
|
||||
/// <summary>
|
||||
/// Unique ID.
|
||||
@@ -28,7 +28,6 @@ DECLARE_SCRIPTING_TYPE_MINIMAL(AssetInfo);
|
||||
API_FIELD() String Path;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AssetInfo"/> struct.
|
||||
/// </summary>
|
||||
@@ -51,7 +50,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the string.
|
||||
/// </summary>
|
||||
|
||||
@@ -10,15 +10,12 @@
|
||||
class FLAXENGINE_API AssetReferenceBase
|
||||
{
|
||||
public:
|
||||
|
||||
typedef Delegate<> EventType;
|
||||
|
||||
protected:
|
||||
|
||||
Asset* _asset = nullptr;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The asset loaded event (fired when asset gets loaded or is already loaded after change).
|
||||
/// </summary>
|
||||
@@ -48,7 +45,6 @@ public:
|
||||
~AssetReferenceBase();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the asset ID or Guid::Empty if not set.
|
||||
/// </summary>
|
||||
@@ -71,7 +67,6 @@ public:
|
||||
String ToString() const;
|
||||
|
||||
protected:
|
||||
|
||||
void OnSet(Asset* asset);
|
||||
void OnLoaded(Asset* asset);
|
||||
void OnUnloaded(Asset* asset);
|
||||
@@ -84,12 +79,10 @@ template<typename T>
|
||||
API_CLASS(InBuild) class AssetReference : public AssetReferenceBase
|
||||
{
|
||||
public:
|
||||
|
||||
typedef T AssetType;
|
||||
typedef AssetReference<T> Type;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AssetReference"/> class.
|
||||
/// </summary>
|
||||
@@ -139,7 +132,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
FORCE_INLINE AssetReference& operator=(const AssetReference& other)
|
||||
{
|
||||
OnSet(other.Get());
|
||||
@@ -220,7 +212,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Sets the asset reference.
|
||||
/// </summary>
|
||||
|
||||
@@ -14,14 +14,14 @@ class AnimEvent;
|
||||
/// </summary>
|
||||
API_CLASS(NoSpawn) class FLAXENGINE_API Animation : public BinaryAsset
|
||||
{
|
||||
DECLARE_BINARY_ASSET_HEADER(Animation, 1);
|
||||
DECLARE_BINARY_ASSET_HEADER(Animation, 1);
|
||||
|
||||
/// <summary>
|
||||
/// Contains basic information about the animation asset contents.
|
||||
/// </summary>
|
||||
API_STRUCT() struct FLAXENGINE_API InfoData
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(InfoData);
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(InfoData);
|
||||
|
||||
/// <summary>
|
||||
/// Length of the animation in seconds.
|
||||
@@ -62,14 +62,12 @@ DECLARE_BINARY_ASSET_HEADER(Animation, 1);
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
#if USE_EDITOR
|
||||
bool _registeredForScriptingReload = false;
|
||||
void OnScriptsReloadStart();
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The animation data.
|
||||
/// </summary>
|
||||
@@ -92,7 +90,6 @@ public:
|
||||
Dictionary<SkinnedModel*, NodeToChannel> MappingCache;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the length of the animation (in seconds).
|
||||
/// </summary>
|
||||
@@ -160,16 +157,13 @@ public:
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
void OnSkinnedModelUnloaded(Asset* obj);
|
||||
|
||||
public:
|
||||
|
||||
// [BinaryAsset]
|
||||
void OnScriptingDispose() override;
|
||||
|
||||
protected:
|
||||
|
||||
// [BinaryAsset]
|
||||
LoadResult load() override;
|
||||
void unload(bool isReloading) override;
|
||||
|
||||
@@ -10,9 +10,8 @@
|
||||
/// </summary>
|
||||
API_CLASS(NoSpawn) class FLAXENGINE_API AnimationGraph : public BinaryAsset
|
||||
{
|
||||
DECLARE_BINARY_ASSET_HEADER(AnimationGraph, 1);
|
||||
DECLARE_BINARY_ASSET_HEADER(AnimationGraph, 1);
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The animation graph.
|
||||
/// </summary>
|
||||
@@ -24,7 +23,6 @@ public:
|
||||
AnimGraphExecutor GraphExecutor;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the base model asset used for the animation preview and the skeleton layout source.
|
||||
/// </summary>
|
||||
@@ -58,20 +56,17 @@ public:
|
||||
API_FUNCTION() bool SaveSurface(BytesContainer& data);
|
||||
|
||||
private:
|
||||
|
||||
void FindDependencies(AnimGraphBase* graph);
|
||||
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
// [BinaryAsset]
|
||||
#if USE_EDITOR
|
||||
void GetReferences(Array<Guid>& output) const override;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
// [BinaryAsset]
|
||||
LoadResult load() override;
|
||||
void unload(bool isReloading) override;
|
||||
|
||||
@@ -147,7 +147,6 @@ void AnimationGraphFunction::ProcessGraphForSignature(AnimGraphBase* graph, bool
|
||||
p.Type = GetGraphFunctionTypeName_Deprecated(node.Values[0]);
|
||||
#endif
|
||||
p.Name = name;
|
||||
|
||||
}
|
||||
}
|
||||
else if (node.Type == GRAPH_NODE_MAKE_TYPE(16, 2)) // Function Output
|
||||
|
||||
@@ -10,9 +10,8 @@
|
||||
/// </summary>
|
||||
API_CLASS(NoSpawn) class FLAXENGINE_API AnimationGraphFunction : public BinaryAsset
|
||||
{
|
||||
DECLARE_BINARY_ASSET_HEADER(AnimationGraphFunction, 1);
|
||||
DECLARE_BINARY_ASSET_HEADER(AnimationGraphFunction, 1);
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The loaded anim graph function graph data (serialized anim graph).
|
||||
/// </summary>
|
||||
@@ -59,11 +58,9 @@ public:
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
void ProcessGraphForSignature(AnimGraphBase* graph, bool canUseOutputs);
|
||||
|
||||
protected:
|
||||
|
||||
// [BinaryAsset]
|
||||
LoadResult load() override;
|
||||
void unload(bool isReloading) override;
|
||||
|
||||
@@ -9,5 +9,5 @@
|
||||
/// </summary>
|
||||
API_CLASS(NoSpawn) class FLAXENGINE_API CubeTexture : public TextureBase
|
||||
{
|
||||
DECLARE_BINARY_ASSET_HEADER(CubeTexture, TexturesSerializedVersion);
|
||||
DECLARE_BINARY_ASSET_HEADER(CubeTexture, TexturesSerializedVersion);
|
||||
};
|
||||
|
||||
@@ -9,10 +9,9 @@
|
||||
/// </summary>
|
||||
API_CLASS(NoSpawn) class FLAXENGINE_API IESProfile : public TextureBase
|
||||
{
|
||||
DECLARE_BINARY_ASSET_HEADER(IESProfile, TexturesSerializedVersion);
|
||||
DECLARE_BINARY_ASSET_HEADER(IESProfile, TexturesSerializedVersion);
|
||||
|
||||
public:
|
||||
|
||||
struct CustomDataLayout
|
||||
{
|
||||
float Brightness;
|
||||
@@ -20,7 +19,6 @@ public:
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The light brightness in Lumens, imported from IES profile.
|
||||
/// </summary>
|
||||
@@ -32,7 +30,6 @@ public:
|
||||
API_FIELD() float TextureMultiplier;
|
||||
|
||||
protected:
|
||||
|
||||
// [BinaryAsset]
|
||||
bool init(AssetInitData& initData) override;
|
||||
};
|
||||
|
||||
@@ -12,13 +12,11 @@ class MaterialShader;
|
||||
/// </summary>
|
||||
API_CLASS(NoSpawn) class FLAXENGINE_API Material : public ShaderAssetTypeBase<MaterialBase>
|
||||
{
|
||||
DECLARE_BINARY_ASSET_HEADER(Material, ShadersSerializedVersion);
|
||||
DECLARE_BINARY_ASSET_HEADER(Material, ShadersSerializedVersion);
|
||||
private:
|
||||
|
||||
MaterialShader* _materialShader = nullptr;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Tries to load surface graph from the asset.
|
||||
/// </summary>
|
||||
@@ -39,7 +37,6 @@ public:
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
// [MaterialBase]
|
||||
bool IsMaterialInstance() const override;
|
||||
|
||||
@@ -58,7 +55,6 @@ public:
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
// [MaterialBase]
|
||||
LoadResult load() override;
|
||||
void unload(bool isReloading) override;
|
||||
|
||||
@@ -12,9 +12,8 @@
|
||||
/// <seealso cref="FlaxEngine.BinaryAsset" />
|
||||
API_CLASS(Abstract, NoSpawn) class FLAXENGINE_API MaterialBase : public BinaryAsset, public IMaterial
|
||||
{
|
||||
DECLARE_ASSET_HEADER(MaterialBase);
|
||||
DECLARE_ASSET_HEADER(MaterialBase);
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The material parameters collection.
|
||||
/// </summary>
|
||||
@@ -32,7 +31,6 @@ public:
|
||||
virtual bool IsMaterialInstance() const = 0;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the material parameters collection.
|
||||
/// </summary>
|
||||
@@ -78,7 +76,6 @@ public:
|
||||
API_FUNCTION() MaterialInstance* CreateVirtualInstance();
|
||||
|
||||
public:
|
||||
|
||||
// [BinaryAsset]
|
||||
#if USE_EDITOR
|
||||
void GetReferences(Array<Guid>& output) const override
|
||||
|
||||
@@ -10,9 +10,8 @@
|
||||
/// </summary>
|
||||
API_CLASS(NoSpawn) class FLAXENGINE_API MaterialFunction : public BinaryAsset
|
||||
{
|
||||
DECLARE_BINARY_ASSET_HEADER(MaterialFunction, 1);
|
||||
DECLARE_BINARY_ASSET_HEADER(MaterialFunction, 1);
|
||||
public:
|
||||
|
||||
#if COMPILE_WITH_MATERIAL_GRAPH
|
||||
|
||||
/// <summary>
|
||||
@@ -60,7 +59,6 @@ public:
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
// [BinaryAsset]
|
||||
LoadResult load() override;
|
||||
void unload(bool isReloading) override;
|
||||
|
||||
@@ -9,13 +9,11 @@
|
||||
/// </summary>
|
||||
API_CLASS(NoSpawn) class FLAXENGINE_API MaterialInstance : public MaterialBase
|
||||
{
|
||||
DECLARE_BINARY_ASSET_HEADER(MaterialInstance, 4);
|
||||
DECLARE_BINARY_ASSET_HEADER(MaterialInstance, 4);
|
||||
private:
|
||||
|
||||
MaterialBase* _baseMaterial = nullptr;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the base material. If value gets changed parameters collection is restored to the default values of the new material.
|
||||
/// </summary>
|
||||
@@ -43,14 +41,12 @@ public:
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
void OnBaseSet();
|
||||
void OnBaseUnset();
|
||||
void OnBaseUnloaded(Asset* p);
|
||||
void OnBaseParamsChanged();
|
||||
|
||||
public:
|
||||
|
||||
// [MaterialBase]
|
||||
bool IsMaterialInstance() const override;
|
||||
#if USE_EDITOR
|
||||
@@ -67,7 +63,6 @@ public:
|
||||
void Bind(BindParameters& params) override;
|
||||
|
||||
protected:
|
||||
|
||||
// [MaterialBase]
|
||||
LoadResult load() override;
|
||||
void unload(bool isReloading) override;
|
||||
|
||||
@@ -13,16 +13,14 @@ class StreamModelLODTask;
|
||||
/// </summary>
|
||||
API_CLASS(NoSpawn) class FLAXENGINE_API Model : public ModelBase
|
||||
{
|
||||
DECLARE_BINARY_ASSET_HEADER(Model, 25);
|
||||
DECLARE_BINARY_ASSET_HEADER(Model, 25);
|
||||
friend Mesh;
|
||||
friend StreamModelLODTask;
|
||||
private:
|
||||
|
||||
int32 _loadedLODs = 0;
|
||||
StreamModelLODTask* _streamingTask = nullptr;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Model level of details. The first entry is the highest quality LOD0 followed by more optimized versions.
|
||||
/// </summary>
|
||||
@@ -34,14 +32,12 @@ public:
|
||||
API_FIELD(ReadOnly) SDFData SDF;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Finalizes an instance of the <see cref="Model"/> class.
|
||||
/// </summary>
|
||||
~Model();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this instance is initialized.
|
||||
/// </summary>
|
||||
@@ -103,7 +99,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Requests the LOD data asynchronously (creates task that will gather chunk data or null if already here).
|
||||
/// </summary>
|
||||
@@ -127,7 +122,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Determines if there is an intersection between the Model and a Ray in given world using given instance.
|
||||
/// </summary>
|
||||
@@ -156,7 +150,6 @@ public:
|
||||
API_FUNCTION() BoundingBox GetBox(int32 lodIndex = 0) const;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Draws the meshes. Binds vertex and index buffers and invokes the draw calls.
|
||||
/// </summary>
|
||||
@@ -185,7 +178,6 @@ public:
|
||||
void Draw(const RenderContext& renderContext, const Mesh::DrawInfo& info);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Setups the model LODs collection including meshes creation.
|
||||
/// </summary>
|
||||
@@ -205,7 +197,7 @@ public:
|
||||
API_FUNCTION() bool Save(bool withMeshDataFromGpu = false, const StringView& path = StringView::Empty);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Generates the Sign Distant Field for this model.
|
||||
/// </summary>
|
||||
@@ -223,7 +215,6 @@ public:
|
||||
API_FUNCTION() void SetSDF(const SDFData& sdf);
|
||||
|
||||
private:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes this model to an empty collection of LODs with meshes.
|
||||
/// </summary>
|
||||
@@ -232,7 +223,6 @@ private:
|
||||
bool Init(const Span<int32>& meshesCountPerLod);
|
||||
|
||||
public:
|
||||
|
||||
// [ModelBase]
|
||||
void SetupMaterialSlots(int32 slotsCount) override;
|
||||
int32 GetLODsCount() const override;
|
||||
@@ -251,7 +241,6 @@ public:
|
||||
Task* CreateStreamingTask(int32 residency) override;
|
||||
|
||||
protected:
|
||||
|
||||
// [ModelBase]
|
||||
LoadResult load() override;
|
||||
void unload(bool isReloading) override;
|
||||
|
||||
@@ -9,16 +9,14 @@
|
||||
/// </summary>
|
||||
API_CLASS(NoSpawn) class FLAXENGINE_API RawDataAsset : public BinaryAsset
|
||||
{
|
||||
DECLARE_BINARY_ASSET_HEADER(RawDataAsset, 1);
|
||||
DECLARE_BINARY_ASSET_HEADER(RawDataAsset, 1);
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The bytes array stored in the asset.
|
||||
/// </summary>
|
||||
API_FIELD() Array<byte> Data;
|
||||
|
||||
public:
|
||||
|
||||
#if USE_EDITOR
|
||||
|
||||
/// <summary>
|
||||
@@ -31,7 +29,6 @@ public:
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
// [BinaryAsset]
|
||||
LoadResult load() override;
|
||||
void unload(bool isReloading) override;
|
||||
|
||||
@@ -12,20 +12,17 @@ class GPUShader;
|
||||
/// </summary>
|
||||
API_CLASS(NoSpawn) class FLAXENGINE_API Shader : public ShaderAssetTypeBase<BinaryAsset>
|
||||
{
|
||||
DECLARE_BINARY_ASSET_HEADER(Shader, ShadersSerializedVersion);
|
||||
DECLARE_BINARY_ASSET_HEADER(Shader, ShadersSerializedVersion);
|
||||
private:
|
||||
|
||||
GPUShader* _shader;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Finalizes an instance of the <see cref="Shader"/> class.
|
||||
/// </summary>
|
||||
~Shader();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The GPU shader object (not null).
|
||||
/// </summary>
|
||||
@@ -40,7 +37,6 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
// [BinaryAsset]
|
||||
LoadResult load() override;
|
||||
void unload(bool isReloading) override;
|
||||
|
||||
@@ -14,14 +14,12 @@ class MemoryWriteStream;
|
||||
/// </summary>
|
||||
API_CLASS(NoSpawn) class FLAXENGINE_API SkeletonMask : public BinaryAsset
|
||||
{
|
||||
DECLARE_BINARY_ASSET_HEADER(SkeletonMask, 2);
|
||||
DECLARE_BINARY_ASSET_HEADER(SkeletonMask, 2);
|
||||
private:
|
||||
|
||||
Array<String> _maskedNodes;
|
||||
BitArray<> _mask;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The referenced skinned model skeleton that defines the masked nodes hierarchy.
|
||||
/// </summary>
|
||||
@@ -47,7 +45,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the per-skeleton-node boolean mask (read-only).
|
||||
/// </summary>
|
||||
@@ -66,11 +63,9 @@ public:
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
void OnSkeletonUnload();
|
||||
|
||||
public:
|
||||
|
||||
// [BinaryAsset]
|
||||
#if USE_EDITOR
|
||||
void GetReferences(Array<Guid>& output) const override
|
||||
@@ -83,7 +78,6 @@ public:
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
// [BinaryAsset]
|
||||
LoadResult load() override;
|
||||
void unload(bool isReloading) override;
|
||||
|
||||
@@ -14,16 +14,14 @@ class StreamSkinnedModelLODTask;
|
||||
/// </summary>
|
||||
API_CLASS(NoSpawn) class FLAXENGINE_API SkinnedModel : public ModelBase
|
||||
{
|
||||
DECLARE_BINARY_ASSET_HEADER(SkinnedModel, 4);
|
||||
DECLARE_BINARY_ASSET_HEADER(SkinnedModel, 4);
|
||||
friend SkinnedMesh;
|
||||
friend StreamSkinnedModelLODTask;
|
||||
private:
|
||||
|
||||
int32 _loadedLODs = 0;
|
||||
StreamSkinnedModelLODTask* _streamingTask = nullptr;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Model level of details. The first entry is the highest quality LOD0 followed by more optimized versions.
|
||||
/// </summary>
|
||||
@@ -35,14 +33,12 @@ public:
|
||||
SkeletonData Skeleton;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Finalizes an instance of the <see cref="SkinnedModel"/> class.
|
||||
/// </summary>
|
||||
~SkinnedModel();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this instance is initialized.
|
||||
/// </summary>
|
||||
@@ -154,7 +150,6 @@ public:
|
||||
API_PROPERTY() Array<String> GetBlendShapes();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Requests the LOD data asynchronously (creates task that will gather chunk data or null if already here).
|
||||
/// </summary>
|
||||
@@ -170,7 +165,6 @@ public:
|
||||
void GetLODData(int32 lodIndex, BytesContainer& data) const;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Determines if there is an intersection between the SkinnedModel and a Ray in given world using given instance.
|
||||
/// </summary>
|
||||
@@ -199,7 +193,6 @@ public:
|
||||
API_FUNCTION() BoundingBox GetBox(int32 lodIndex = 0) const;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Draws the meshes. Binds vertex and index buffers and invokes the draw calls.
|
||||
/// </summary>
|
||||
@@ -218,7 +211,6 @@ public:
|
||||
void Draw(RenderContext& renderContext, const SkinnedMesh::DrawInfo& info);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Setups the model LODs collection including meshes creation.
|
||||
/// </summary>
|
||||
@@ -256,7 +248,6 @@ public:
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes this skinned model to an empty collection of meshes. Ensure to init SkeletonData manually after the call.
|
||||
/// </summary>
|
||||
@@ -265,7 +256,6 @@ private:
|
||||
bool Init(const Span<int32>& meshesCountPerLod);
|
||||
|
||||
public:
|
||||
|
||||
// [ModelBase]
|
||||
void SetupMaterialSlots(int32 slotsCount) override;
|
||||
int32 GetLODsCount() const override;
|
||||
@@ -284,7 +274,6 @@ public:
|
||||
Task* CreateStreamingTask(int32 residency) override;
|
||||
|
||||
protected:
|
||||
|
||||
// [ModelBase]
|
||||
LoadResult load() override;
|
||||
void unload(bool isReloading) override;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
/// </summary>
|
||||
API_CLASS(NoSpawn) class FLAXENGINE_API Texture : public TextureBase
|
||||
{
|
||||
DECLARE_BINARY_ASSET_HEADER(Texture, TexturesSerializedVersion);
|
||||
DECLARE_BINARY_ASSET_HEADER(Texture, TexturesSerializedVersion);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the texture format type.
|
||||
@@ -22,7 +22,6 @@ DECLARE_BINARY_ASSET_HEADER(Texture, TexturesSerializedVersion);
|
||||
API_PROPERTY() bool IsNormalMap() const;
|
||||
|
||||
public:
|
||||
|
||||
#if USE_EDITOR
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -54,15 +54,15 @@ bool VisualScriptGraph::onNodeLoaded(Node* n)
|
||||
{
|
||||
switch (n->GroupID)
|
||||
{
|
||||
// Function
|
||||
// Function
|
||||
case 16:
|
||||
switch (n->TypeID)
|
||||
{
|
||||
// Invoke Method
|
||||
// Invoke Method
|
||||
case 4:
|
||||
n->Data.InvokeMethod.Method = nullptr;
|
||||
break;
|
||||
// Get/Set Field
|
||||
// Get/Set Field
|
||||
case 7:
|
||||
case 8:
|
||||
n->Data.GetSetField.Field = nullptr;
|
||||
@@ -176,7 +176,7 @@ void VisualScriptExecutor::ProcessGroupParameters(Box* box, Node* node, Value& v
|
||||
{
|
||||
switch (node->TypeID)
|
||||
{
|
||||
// Get
|
||||
// Get
|
||||
case 3:
|
||||
{
|
||||
int32 paramIndex;
|
||||
@@ -200,7 +200,7 @@ void VisualScriptExecutor::ProcessGroupParameters(Box* box, Node* node, Value& v
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Set
|
||||
// Set
|
||||
case 4:
|
||||
{
|
||||
int32 paramIndex;
|
||||
@@ -235,11 +235,11 @@ void VisualScriptExecutor::ProcessGroupTools(Box* box, Node* node, Value& value)
|
||||
{
|
||||
switch (node->TypeID)
|
||||
{
|
||||
// This Instance
|
||||
// This Instance
|
||||
case 19:
|
||||
value = ThreadStacks.Get().Stack->Instance;
|
||||
break;
|
||||
// Cast
|
||||
// Cast
|
||||
case 25:
|
||||
{
|
||||
if (box->ID == 0)
|
||||
@@ -297,7 +297,7 @@ void VisualScriptExecutor::ProcessGroupTools(Box* box, Node* node, Value& value)
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Cast Value
|
||||
// Cast Value
|
||||
case 26:
|
||||
{
|
||||
if (box->ID == 0)
|
||||
@@ -375,7 +375,7 @@ void VisualScriptExecutor::ProcessGroupFunction(Box* boxBase, Node* node, Value&
|
||||
{
|
||||
switch (node->TypeID)
|
||||
{
|
||||
// Method Override
|
||||
// Method Override
|
||||
case 3:
|
||||
{
|
||||
if (boxBase->ID == 0)
|
||||
@@ -392,7 +392,7 @@ void VisualScriptExecutor::ProcessGroupFunction(Box* boxBase, Node* node, Value&
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Invoke Method
|
||||
// Invoke Method
|
||||
case 4:
|
||||
{
|
||||
// Call Impulse or Pure Method
|
||||
@@ -604,14 +604,14 @@ void VisualScriptExecutor::ProcessGroupFunction(Box* boxBase, Node* node, Value&
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Return
|
||||
// Return
|
||||
case 5:
|
||||
{
|
||||
auto& scope = ThreadStacks.Get().Stack->Scope;
|
||||
scope->FunctionReturn = tryGetValue(node->GetBox(1), Value::Zero);
|
||||
break;
|
||||
}
|
||||
// Function
|
||||
// Function
|
||||
case 6:
|
||||
{
|
||||
if (boxBase->ID == 0)
|
||||
@@ -630,7 +630,7 @@ void VisualScriptExecutor::ProcessGroupFunction(Box* boxBase, Node* node, Value&
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Get Field
|
||||
// Get Field
|
||||
case 7:
|
||||
{
|
||||
auto& cache = node->Data.GetSetField;
|
||||
@@ -716,7 +716,7 @@ void VisualScriptExecutor::ProcessGroupFunction(Box* boxBase, Node* node, Value&
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Get Field
|
||||
// Get Field
|
||||
case 8:
|
||||
{
|
||||
auto& cache = node->Data.GetSetField;
|
||||
@@ -809,7 +809,7 @@ void VisualScriptExecutor::ProcessGroupFunction(Box* boxBase, Node* node, Value&
|
||||
eatBox(node, returnedImpulse->FirstConnection());
|
||||
break;
|
||||
}
|
||||
// Bind/Unbind
|
||||
// Bind/Unbind
|
||||
case 9:
|
||||
case 10:
|
||||
{
|
||||
@@ -937,7 +937,7 @@ void VisualScriptExecutor::ProcessGroupFlow(Box* boxBase, Node* node, Value& val
|
||||
{
|
||||
switch (node->TypeID)
|
||||
{
|
||||
// If
|
||||
// If
|
||||
case 1:
|
||||
{
|
||||
const bool condition = (bool)tryGetValue(node->GetBox(1), Value::Zero);
|
||||
@@ -946,7 +946,7 @@ void VisualScriptExecutor::ProcessGroupFlow(Box* boxBase, Node* node, Value& val
|
||||
eatBox(node, boxBase->FirstConnection());
|
||||
break;
|
||||
}
|
||||
// For Loop
|
||||
// For Loop
|
||||
case 2:
|
||||
{
|
||||
const auto scope = ThreadStacks.Get().Stack->Scope;
|
||||
@@ -959,7 +959,7 @@ void VisualScriptExecutor::ProcessGroupFlow(Box* boxBase, Node* node, Value& val
|
||||
}
|
||||
switch (boxBase->ID)
|
||||
{
|
||||
// Loop
|
||||
// Loop
|
||||
case 0:
|
||||
{
|
||||
if (iteratorIndex == scope->ReturnedValues.Count())
|
||||
@@ -980,13 +980,13 @@ void VisualScriptExecutor::ProcessGroupFlow(Box* boxBase, Node* node, Value& val
|
||||
eatBox(node, boxBase->FirstConnection());
|
||||
break;
|
||||
}
|
||||
// Break
|
||||
// Break
|
||||
case 3:
|
||||
// Reset loop iterator
|
||||
if (iteratorIndex != scope->ReturnedValues.Count())
|
||||
scope->ReturnedValues[iteratorIndex].Value.AsInt = MAX_int32 - 1;
|
||||
break;
|
||||
// Index
|
||||
// Index
|
||||
case 5:
|
||||
if (iteratorIndex != scope->ReturnedValues.Count())
|
||||
value = scope->ReturnedValues[iteratorIndex].Value;
|
||||
@@ -994,7 +994,7 @@ void VisualScriptExecutor::ProcessGroupFlow(Box* boxBase, Node* node, Value& val
|
||||
}
|
||||
break;
|
||||
}
|
||||
// While Loop
|
||||
// While Loop
|
||||
case 3:
|
||||
{
|
||||
const auto scope = ThreadStacks.Get().Stack->Scope;
|
||||
@@ -1007,7 +1007,7 @@ void VisualScriptExecutor::ProcessGroupFlow(Box* boxBase, Node* node, Value& val
|
||||
}
|
||||
switch (boxBase->ID)
|
||||
{
|
||||
// Loop
|
||||
// Loop
|
||||
case 0:
|
||||
{
|
||||
if (iteratorIndex == scope->ReturnedValues.Count())
|
||||
@@ -1027,13 +1027,13 @@ void VisualScriptExecutor::ProcessGroupFlow(Box* boxBase, Node* node, Value& val
|
||||
eatBox(node, boxBase->FirstConnection());
|
||||
break;
|
||||
}
|
||||
// Break
|
||||
// Break
|
||||
case 2:
|
||||
// Reset loop iterator
|
||||
if (iteratorIndex != scope->ReturnedValues.Count())
|
||||
scope->ReturnedValues[iteratorIndex].Value.AsInt = -1;
|
||||
break;
|
||||
// Index
|
||||
// Index
|
||||
case 4:
|
||||
if (iteratorIndex != scope->ReturnedValues.Count())
|
||||
value = scope->ReturnedValues[iteratorIndex].Value;
|
||||
@@ -1041,7 +1041,7 @@ void VisualScriptExecutor::ProcessGroupFlow(Box* boxBase, Node* node, Value& val
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Sequence
|
||||
// Sequence
|
||||
case 4:
|
||||
{
|
||||
const int32 count = (int32)node->Values[0];
|
||||
@@ -1053,7 +1053,7 @@ void VisualScriptExecutor::ProcessGroupFlow(Box* boxBase, Node* node, Value& val
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Branch On Enum
|
||||
// Branch On Enum
|
||||
case 5:
|
||||
{
|
||||
const Value v = tryGetValue(node->GetBox(1), Value::Null);
|
||||
@@ -1075,7 +1075,7 @@ void VisualScriptExecutor::ProcessGroupFlow(Box* boxBase, Node* node, Value& val
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Delay
|
||||
// Delay
|
||||
case 6:
|
||||
{
|
||||
boxBase = node->GetBox(2);
|
||||
@@ -1115,7 +1115,7 @@ void VisualScriptExecutor::ProcessGroupFlow(Box* boxBase, Node* node, Value& val
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Array For Each
|
||||
// Array For Each
|
||||
case 7:
|
||||
{
|
||||
const auto scope = ThreadStacks.Get().Stack->Scope;
|
||||
@@ -1135,7 +1135,7 @@ void VisualScriptExecutor::ProcessGroupFlow(Box* boxBase, Node* node, Value& val
|
||||
}
|
||||
switch (boxBase->ID)
|
||||
{
|
||||
// Loop
|
||||
// Loop
|
||||
case 0:
|
||||
{
|
||||
if (iteratorIndex == scope->ReturnedValues.Count())
|
||||
@@ -1173,18 +1173,18 @@ void VisualScriptExecutor::ProcessGroupFlow(Box* boxBase, Node* node, Value& val
|
||||
eatBox(node, boxBase->FirstConnection());
|
||||
break;
|
||||
}
|
||||
// Break
|
||||
// Break
|
||||
case 2:
|
||||
// Reset loop iterator
|
||||
if (iteratorIndex != scope->ReturnedValues.Count())
|
||||
scope->ReturnedValues[iteratorIndex].Value.AsInt = MAX_int32 - 1;
|
||||
break;
|
||||
// Item
|
||||
// Item
|
||||
case 4:
|
||||
if (iteratorIndex != scope->ReturnedValues.Count() && arrayIndex != scope->ReturnedValues.Count())
|
||||
value = scope->ReturnedValues[arrayIndex].Value.AsArray()[(int32)scope->ReturnedValues[iteratorIndex].Value];
|
||||
break;
|
||||
// Index
|
||||
// Index
|
||||
case 5:
|
||||
if (iteratorIndex != scope->ReturnedValues.Count())
|
||||
value = (int32)scope->ReturnedValues[iteratorIndex].Value;
|
||||
@@ -1702,13 +1702,13 @@ void VisualScriptingBinaryModule::OnScriptsReloading()
|
||||
{
|
||||
switch (node.Type)
|
||||
{
|
||||
// Invoke Method
|
||||
// Invoke Method
|
||||
case GRAPH_NODE_MAKE_TYPE(16, 4):
|
||||
{
|
||||
node.Data.InvokeMethod.Method = nullptr;
|
||||
break;
|
||||
}
|
||||
// Get/Set Field
|
||||
// Get/Set Field
|
||||
case GRAPH_NODE_MAKE_TYPE(16, 7):
|
||||
case GRAPH_NODE_MAKE_TYPE(16, 8):
|
||||
{
|
||||
@@ -2224,7 +2224,7 @@ String VisualScripting::GetStackTrace()
|
||||
String node;
|
||||
switch (frame->Node->Type)
|
||||
{
|
||||
// Get/Set Parameter
|
||||
// Get/Set Parameter
|
||||
case GRAPH_NODE_MAKE_TYPE(6, 3):
|
||||
case GRAPH_NODE_MAKE_TYPE(6, 4):
|
||||
{
|
||||
@@ -2233,19 +2233,19 @@ String VisualScripting::GetStackTrace()
|
||||
node += param ? param->Name : ((Guid)frame->Node->Values[0]).ToString();
|
||||
break;
|
||||
}
|
||||
// Method Override
|
||||
// Method Override
|
||||
case GRAPH_NODE_MAKE_TYPE(16, 3):
|
||||
node = (StringView)frame->Node->Values[0];
|
||||
node += TEXT("()");
|
||||
break;
|
||||
// Invoke Method
|
||||
// Invoke Method
|
||||
case GRAPH_NODE_MAKE_TYPE(16, 4):
|
||||
node = (StringView)frame->Node->Values[0];
|
||||
node += TEXT(".");
|
||||
node += (StringView)frame->Node->Values[1];
|
||||
node += TEXT("()");
|
||||
break;
|
||||
// Function
|
||||
// Function
|
||||
case GRAPH_NODE_MAKE_TYPE(16, 6):
|
||||
node = String(frame->Script->GetScriptTypeName());
|
||||
for (int32 i = 0; i < frame->Script->_methods.Count(); i++)
|
||||
|
||||
@@ -33,7 +33,6 @@ class VisualScriptExecutor : public VisjectExecutor
|
||||
{
|
||||
friend VisualScripting;
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="VisualScriptExecutor"/> class.
|
||||
/// </summary>
|
||||
@@ -58,12 +57,11 @@ private:
|
||||
/// <seealso cref="BinaryAsset" />
|
||||
API_CLASS(NoSpawn, Sealed) class FLAXENGINE_API VisualScript : public BinaryAsset
|
||||
{
|
||||
DECLARE_BINARY_ASSET_HEADER(VisualScript, 1);
|
||||
DECLARE_BINARY_ASSET_HEADER(VisualScript, 1);
|
||||
friend VisualScripting;
|
||||
friend VisualScriptExecutor;
|
||||
friend VisualScriptingBinaryModule;
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Visual Script flag types.
|
||||
/// </summary>
|
||||
@@ -90,7 +88,7 @@ public:
|
||||
/// </summary>
|
||||
API_STRUCT() struct Metadata
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(Metadata);
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(Metadata);
|
||||
|
||||
/// <summary>
|
||||
/// The base class typename.
|
||||
@@ -147,7 +145,6 @@ public:
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
Dictionary<Guid, Instance> _instances;
|
||||
ScriptingTypeHandle _scriptingTypeHandle;
|
||||
ScriptingTypeHandle _scriptingTypeHandleCached;
|
||||
@@ -160,7 +157,6 @@ private:
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The Visual Script graph.
|
||||
/// </summary>
|
||||
@@ -172,7 +168,6 @@ public:
|
||||
API_FIELD(ReadOnly) Metadata Meta;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the typename of the Visual Script. Identifies it's scripting type.
|
||||
/// </summary>
|
||||
@@ -280,7 +275,6 @@ public:
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
// [BinaryAsset]
|
||||
#if USE_EDITOR
|
||||
void GetReferences(Array<Guid>& output) const override
|
||||
@@ -293,14 +287,12 @@ public:
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
// [BinaryAsset]
|
||||
LoadResult load() override;
|
||||
void unload(bool isReloading) override;
|
||||
AssetChunksFlag getChunksToPreload() const override;
|
||||
|
||||
private:
|
||||
|
||||
void CacheScriptingType();
|
||||
};
|
||||
|
||||
@@ -312,25 +304,21 @@ class FLAXENGINE_API VisualScriptingBinaryModule : public BinaryModule
|
||||
{
|
||||
friend VisualScript;
|
||||
private:
|
||||
|
||||
StringAnsi _name;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="VisualScriptingBinaryModule"/> class.
|
||||
/// </summary>
|
||||
VisualScriptingBinaryModule();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The visual script assets loaded into the module with exposes scripting types. Order matches the Types array.
|
||||
/// </summary>
|
||||
Array<AssetReference<VisualScript>> Scripts;
|
||||
|
||||
private:
|
||||
|
||||
static ScriptingObject* VisualScriptObjectSpawn(const ScriptingObjectSpawnParams& params);
|
||||
#if USE_EDITOR
|
||||
void OnScriptsReloading();
|
||||
@@ -338,7 +326,6 @@ private:
|
||||
static void OnEvent(ScriptingObject* object, Span<Variant> parameters, ScriptingTypeHandle eventType, StringView eventName);
|
||||
|
||||
public:
|
||||
|
||||
// [BinaryModule]
|
||||
const StringAnsi& GetName() const override;
|
||||
bool IsLoaded() const override;
|
||||
@@ -363,7 +350,6 @@ public:
|
||||
class FLAXENGINE_API VisualScripting
|
||||
{
|
||||
public:
|
||||
|
||||
struct NodeBoxValue
|
||||
{
|
||||
uint32 NodeId;
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
class AssetsContainer : public Array<AssetReference<Asset>>
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Loads an asset.
|
||||
/// </summary>
|
||||
|
||||
@@ -459,12 +459,10 @@ const String& BinaryAsset::GetPath() const
|
||||
class InitAssetTask : public ContentLoadTask
|
||||
{
|
||||
private:
|
||||
|
||||
WeakAssetReference<BinaryAsset> _asset;
|
||||
FlaxStorage::LockData _dataLock;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="InitAssetTask"/> class.
|
||||
/// </summary>
|
||||
@@ -477,7 +475,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// [ContentLoadTask]
|
||||
bool HasReference(Object* obj) const override
|
||||
{
|
||||
@@ -485,7 +482,6 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
// [ContentLoadTask]
|
||||
Result run() override
|
||||
{
|
||||
@@ -507,6 +503,7 @@ protected:
|
||||
|
||||
return Result::Ok;
|
||||
}
|
||||
|
||||
void OnEnd() override
|
||||
{
|
||||
_dataLock.Release();
|
||||
|
||||
@@ -21,23 +21,20 @@
|
||||
/// <seealso cref="Asset" />
|
||||
API_CLASS(Abstract, NoSpawn) class FLAXENGINE_API BinaryAsset : public Asset
|
||||
{
|
||||
DECLARE_ASSET_HEADER(BinaryAsset);
|
||||
DECLARE_ASSET_HEADER(BinaryAsset);
|
||||
protected:
|
||||
|
||||
AssetHeader _header;
|
||||
FlaxStorageReference _storageRef; // Allow asset to have missing storage reference but only before asset is loaded or if it's virtual
|
||||
bool _isSaving;
|
||||
Array<BinaryAsset*> _dependantAssets;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Finalizes an instance of the <see cref="BinaryAsset"/> class.
|
||||
/// </summary>
|
||||
~BinaryAsset();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The asset storage container.
|
||||
/// </summary>
|
||||
@@ -58,7 +55,6 @@ public:
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the asset serialized version.
|
||||
/// </summary>
|
||||
@@ -87,7 +83,6 @@ public:
|
||||
bool InitVirtual(AssetInitData& initData);
|
||||
|
||||
public:
|
||||
|
||||
#if USE_EDITOR
|
||||
|
||||
#if COMPILE_WITH_ASSETS_IMPORTER
|
||||
@@ -128,7 +123,6 @@ public:
|
||||
bool HasDependenciesModified() const;
|
||||
|
||||
protected:
|
||||
|
||||
/// <summary>
|
||||
/// Called when one of the asset dependencies gets modified (it was saved or reloaded or reimported).
|
||||
/// </summary>
|
||||
@@ -140,7 +134,6 @@ protected:
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the specified asset.
|
||||
/// </summary>
|
||||
@@ -161,7 +154,6 @@ protected:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the asset chunk.
|
||||
/// </summary>
|
||||
@@ -293,7 +285,6 @@ public:
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
/// <summary>
|
||||
/// Load data from the chunks
|
||||
/// </summary>
|
||||
@@ -301,13 +292,11 @@ protected:
|
||||
virtual LoadResult load() = 0;
|
||||
|
||||
private:
|
||||
|
||||
#if USE_EDITOR
|
||||
void OnStorageReloaded(FlaxStorage* storage, bool failed);
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
// [Asset]
|
||||
#if USE_EDITOR
|
||||
void OnDeleteObject() override;
|
||||
@@ -315,7 +304,6 @@ public:
|
||||
const String& GetPath() const final override;
|
||||
|
||||
protected:
|
||||
|
||||
// [Asset]
|
||||
ContentLoadTask* createLoadingTask() override;
|
||||
LoadResult loadAsset() override;
|
||||
|
||||
@@ -578,7 +578,7 @@ bool AssetsCache::IsEntryValid(Entry& e)
|
||||
return isValid;
|
||||
}
|
||||
}
|
||||
// Check for json resource
|
||||
// Check for json resource
|
||||
else if (JsonStorageProxy::IsValidExtension(extension))
|
||||
{
|
||||
// Check Json storage layer
|
||||
|
||||
@@ -40,7 +40,6 @@ DECLARE_ENUM_OPERATORS(AssetsCacheFlags);
|
||||
class FLAXENGINE_API AssetsCache
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The registry entry structure.
|
||||
/// </summary>
|
||||
@@ -75,7 +74,6 @@ public:
|
||||
typedef Dictionary<String, Guid> PathsMapping;
|
||||
|
||||
private:
|
||||
|
||||
bool _isDirty;
|
||||
CriticalSection _locker;
|
||||
Registry _registry;
|
||||
@@ -83,14 +81,12 @@ private:
|
||||
String _path;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AssetsCache"/> class.
|
||||
/// </summary>
|
||||
AssetsCache();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets amount of registered assets
|
||||
/// </summary>
|
||||
@@ -104,7 +100,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Init registry
|
||||
/// </summary>
|
||||
@@ -127,7 +122,6 @@ public:
|
||||
static bool Save(const StringView& path, const Registry& entries, const PathsMapping& pathsMapping, const AssetsCacheFlags flags = AssetsCacheFlags::None);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Finds the asset path by id. In editor it returns the actual asset path, at runtime it returns the mapped asset path.
|
||||
/// </summary>
|
||||
|
||||
@@ -66,7 +66,6 @@ bool findAsset(const Guid& id, const String& directory, Array<String>& tmpCache,
|
||||
class ContentService : public EngineService
|
||||
{
|
||||
public:
|
||||
|
||||
ContentService()
|
||||
: EngineService(TEXT("Content"), -600)
|
||||
{
|
||||
@@ -294,7 +293,7 @@ bool Content::GetAssetInfo(const StringView& path, AssetInfo& info)
|
||||
return Cache.FindAsset(path, info);
|
||||
}
|
||||
}
|
||||
// Check for json resource
|
||||
// Check for json resource
|
||||
else if (JsonStorageProxy::IsValidExtension(extension))
|
||||
{
|
||||
// Check Json storage layer
|
||||
@@ -1081,7 +1080,7 @@ bool findAsset(const Guid& id, const String& directory, Array<String>& tmpCache,
|
||||
LOG(Error, "Cannot open file '{0}' error code: {1}", path, 0);
|
||||
}
|
||||
}
|
||||
// Check for json resource
|
||||
// Check for json resource
|
||||
else if (JsonStorageProxy::IsValidExtension(extension))
|
||||
{
|
||||
// Check Json storage layer
|
||||
|
||||
@@ -15,7 +15,7 @@ class AssetsCache;
|
||||
// Content and assets statistics container.
|
||||
API_STRUCT() struct FLAXENGINE_API ContentStats
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(ContentStats);
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(ContentStats);
|
||||
|
||||
// Amount of asset objects in memory.
|
||||
API_FIELD() int32 AssetsCount = 0;
|
||||
@@ -32,11 +32,10 @@ DECLARE_SCRIPTING_TYPE_MINIMAL(ContentStats);
|
||||
/// </summary>
|
||||
API_CLASS(Static) class FLAXENGINE_API Content
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(Content);
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(Content);
|
||||
friend Engine;
|
||||
friend Asset;
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The time between content pool updates.
|
||||
/// </summary>
|
||||
@@ -48,7 +47,6 @@ public:
|
||||
static TimeSpan AssetsUnloadInterval;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the assets registry.
|
||||
/// </summary>
|
||||
@@ -56,7 +54,6 @@ public:
|
||||
static AssetsCache* GetRegistry();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Finds the asset info by id.
|
||||
/// </summary>
|
||||
@@ -87,7 +84,6 @@ public:
|
||||
API_FUNCTION() static Array<Guid, HeapAllocation> GetAllAssetsByType(const MClass* type);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the asset factory used by the given asset type id.
|
||||
/// </summary>
|
||||
@@ -103,7 +99,6 @@ public:
|
||||
static IAssetFactory* GetAssetFactory(const AssetInfo& assetInfo);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Generates temporary asset path.
|
||||
/// </summary>
|
||||
@@ -111,7 +106,6 @@ public:
|
||||
API_FUNCTION() static String CreateTemporaryAssetPath();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets content statistics.
|
||||
/// </summary>
|
||||
@@ -263,7 +257,6 @@ public:
|
||||
static bool IsAssetTypeIdInvalid(const ScriptingTypeHandle& type, const ScriptingTypeHandle& assetType);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Finds the asset with at given path. Checks all loaded assets.
|
||||
/// </summary>
|
||||
@@ -279,7 +272,6 @@ public:
|
||||
API_FUNCTION() static Asset* GetAsset(const Guid& id);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the specified asset.
|
||||
/// </summary>
|
||||
@@ -293,7 +285,6 @@ public:
|
||||
API_FUNCTION(Attributes="HideInEditor") static void DeleteAsset(const StringView& path);
|
||||
|
||||
public:
|
||||
|
||||
#if USE_EDITOR
|
||||
|
||||
/// <summary>
|
||||
@@ -364,13 +355,11 @@ public:
|
||||
API_EVENT() static Delegate<Asset*> AssetReloading;
|
||||
|
||||
private:
|
||||
|
||||
static void tryCallOnLoaded(Asset* asset);
|
||||
static void onAssetLoaded(Asset* asset);
|
||||
static void onAssetUnload(Asset* asset);
|
||||
static Asset* load(const Guid& id, const ScriptingTypeHandle& type, AssetInfo& assetInfo);
|
||||
|
||||
private:
|
||||
|
||||
static void deleteFileSafety(const StringView& path, const Guid& id);
|
||||
};
|
||||
|
||||
@@ -19,7 +19,6 @@ class FlaxStorage;
|
||||
class FLAXENGINE_API BinaryAssetFactoryBase : public IAssetFactory
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the specified asset. It's called in background before actual asset loading.
|
||||
/// </summary>
|
||||
@@ -28,7 +27,6 @@ public:
|
||||
bool Init(BinaryAsset* asset);
|
||||
|
||||
protected:
|
||||
|
||||
virtual BinaryAsset* Create(const AssetInfo& info) = 0;
|
||||
virtual bool IsVersionSupported(uint32 serializedVersion) const = 0;
|
||||
#if USE_EDITOR
|
||||
@@ -36,7 +34,6 @@ protected:
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
// [IAssetFactory]
|
||||
Asset* New(const AssetInfo& info) override;
|
||||
Asset* NewVirtual(const AssetInfo& info) override;
|
||||
@@ -50,7 +47,6 @@ template<typename T>
|
||||
class BinaryAssetFactory : public BinaryAssetFactoryBase
|
||||
{
|
||||
public:
|
||||
|
||||
// [BinaryAssetFactoryBase]
|
||||
bool IsVersionSupported(uint32 serializedVersion) const override
|
||||
{
|
||||
@@ -58,7 +54,6 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
// [BinaryAssetFactoryBase]
|
||||
BinaryAsset* Create(const AssetInfo& info) override
|
||||
{
|
||||
|
||||
@@ -15,7 +15,6 @@ class IAssetUpgrader;
|
||||
class FLAXENGINE_API IAssetFactory
|
||||
{
|
||||
public:
|
||||
|
||||
typedef Dictionary<StringView, IAssetFactory*> Collection;
|
||||
|
||||
/// <summary>
|
||||
@@ -28,7 +27,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Finalizes an instance of the <see cref="IAssetFactory"/> class.
|
||||
/// </summary>
|
||||
@@ -37,7 +35,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Determines whenever the virtual assets are supported by this asset tpe factory.
|
||||
/// </summary>
|
||||
|
||||
@@ -13,16 +13,15 @@
|
||||
class FLAXENGINE_API JsonAssetFactoryBase : public IAssetFactory
|
||||
{
|
||||
protected:
|
||||
|
||||
virtual JsonAssetBase* Create(const AssetInfo& info) = 0;
|
||||
|
||||
public:
|
||||
|
||||
// [IAssetFactory]
|
||||
Asset* New(const AssetInfo& info) override
|
||||
{
|
||||
return Create(info);
|
||||
}
|
||||
|
||||
Asset* NewVirtual(const AssetInfo& info) override
|
||||
{
|
||||
return Create(info);
|
||||
@@ -37,7 +36,6 @@ template<typename T>
|
||||
class JsonAssetFactory : public JsonAssetFactoryBase
|
||||
{
|
||||
protected:
|
||||
|
||||
// [JsonAssetFactoryBase]
|
||||
JsonAssetBase* Create(const AssetInfo& info) override
|
||||
{
|
||||
|
||||
@@ -12,13 +12,11 @@
|
||||
/// <seealso cref="Asset" />
|
||||
API_CLASS(Abstract, NoSpawn) class FLAXENGINE_API JsonAssetBase : public Asset
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(JsonAssetBase);
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(JsonAssetBase);
|
||||
protected:
|
||||
|
||||
String _path;
|
||||
|
||||
protected:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="JsonAssetBase"/> class.
|
||||
/// </summary>
|
||||
@@ -27,7 +25,6 @@ protected:
|
||||
explicit JsonAssetBase(const SpawnParams& params, const AssetInfo* info);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The parsed json document.
|
||||
/// </summary>
|
||||
@@ -63,7 +60,6 @@ public:
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
// [Asset]
|
||||
const String& GetPath() const override;
|
||||
#if USE_EDITOR
|
||||
@@ -71,7 +67,6 @@ public:
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
// [Asset]
|
||||
LoadResult loadAsset() override;
|
||||
void unload(bool isReloading) override;
|
||||
@@ -86,12 +81,11 @@ protected:
|
||||
/// <seealso cref="JsonAssetBase" />
|
||||
API_CLASS(NoSpawn) class FLAXENGINE_API JsonAsset : public JsonAssetBase
|
||||
{
|
||||
DECLARE_ASSET_HEADER(JsonAsset);
|
||||
DECLARE_ASSET_HEADER(JsonAsset);
|
||||
private:
|
||||
ScriptingType::Dtor _dtor;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The scripting type of the deserialized unmanaged object instance (e.g. PhysicalMaterial).
|
||||
/// </summary>
|
||||
@@ -113,7 +107,6 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
// [JsonAssetBase]
|
||||
LoadResult loadAsset() override;
|
||||
void unload(bool isReloading) override;
|
||||
|
||||
@@ -16,7 +16,6 @@ class ContentLoadTask : public Task
|
||||
friend LoadingThread;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Describes work type
|
||||
/// </summary>
|
||||
@@ -28,14 +27,12 @@ public:
|
||||
DECLARE_ENUM_5(Result, Ok, AssetLoadError, MissingReferences, LoadDataError, TaskFailed);
|
||||
|
||||
private:
|
||||
|
||||
/// <summary>
|
||||
/// Task type
|
||||
/// </summary>
|
||||
Type _type;
|
||||
|
||||
protected:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ContentLoadTask"/> class.
|
||||
/// </summary>
|
||||
@@ -46,7 +43,6 @@ protected:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets a task type.
|
||||
/// </summary>
|
||||
@@ -57,7 +53,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Checks if async task is loading given asset resource
|
||||
/// </summary>
|
||||
@@ -69,11 +64,9 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
virtual Result run() = 0;
|
||||
|
||||
public:
|
||||
|
||||
// [Task]
|
||||
String ToString() const override
|
||||
{
|
||||
@@ -84,7 +77,6 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
// [Task]
|
||||
void Enqueue() override;
|
||||
bool Run() override;
|
||||
|
||||
@@ -31,7 +31,6 @@ using namespace ContentLoadingManagerImpl;
|
||||
class ContentLoadingManagerService : public EngineService
|
||||
{
|
||||
public:
|
||||
|
||||
ContentLoadingManagerService()
|
||||
: EngineService(TEXT("Content Loading Manager"), -500)
|
||||
{
|
||||
|
||||
@@ -14,13 +14,11 @@ class ContentLoadTask;
|
||||
class LoadingThread : public IRunnable
|
||||
{
|
||||
protected:
|
||||
|
||||
volatile int64 _exitFlag;
|
||||
Thread* _thread;
|
||||
int32 _totalTasksDoneCount;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Init
|
||||
/// </summary>
|
||||
@@ -32,7 +30,6 @@ public:
|
||||
~LoadingThread();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the thread identifier.
|
||||
/// </summary>
|
||||
@@ -40,7 +37,6 @@ public:
|
||||
uint64 GetID() const;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if thread has empty exit flag, so it can continue it's work
|
||||
/// </summary>
|
||||
@@ -61,7 +57,6 @@ public:
|
||||
void Join();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Starts thread execution.
|
||||
/// </summary>
|
||||
@@ -76,7 +71,6 @@ public:
|
||||
void Run(ContentLoadTask* task);
|
||||
|
||||
public:
|
||||
|
||||
// [IRunnable]
|
||||
String ToString() const override;
|
||||
int32 Run() override;
|
||||
@@ -93,7 +87,6 @@ class ContentLoadingManager
|
||||
friend Asset;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Checks if current execution context is thread used to load assets.
|
||||
/// </summary>
|
||||
@@ -110,7 +103,6 @@ public:
|
||||
static LoadingThread* GetCurrentLoadThread();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets amount of enqueued tasks to perform.
|
||||
/// </summary>
|
||||
|
||||
@@ -170,7 +170,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the asset (or null if unassigned).
|
||||
/// </summary>
|
||||
|
||||
@@ -39,7 +39,6 @@ struct FLAXENGINE_API AssetHeader
|
||||
FlaxChunk* Chunks[ASSET_FILE_DATA_CHUNKS];
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AssetHeader"/> struct.
|
||||
/// </summary>
|
||||
@@ -51,7 +50,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the chunks.
|
||||
/// </summary>
|
||||
@@ -154,7 +152,6 @@ struct FLAXENGINE_API AssetInitData
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the hash code.
|
||||
/// </summary>
|
||||
|
||||
@@ -14,14 +14,12 @@ class FlaxPackage;
|
||||
class FLAXENGINE_API ContentStorageManager
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Auto-release timeout for unused asset chunks.
|
||||
/// </summary>
|
||||
static TimeSpan UnusedDataChunksLifetime;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the assets data storage container.
|
||||
/// </summary>
|
||||
@@ -78,7 +76,6 @@ public:
|
||||
static void EnsureUnlocked();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified path can be a binary asset file (based on it's extension).
|
||||
/// </summary>
|
||||
@@ -94,7 +91,6 @@ public:
|
||||
static bool IsFlaxStorageExtension(const String& extension);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the packages.
|
||||
/// </summary>
|
||||
|
||||
@@ -29,7 +29,6 @@ DECLARE_ENUM_OPERATORS(FlaxChunkFlags);
|
||||
class FLAXENGINE_API FlaxChunk
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Chunk of data location info
|
||||
/// </summary>
|
||||
@@ -68,7 +67,6 @@ public:
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The chunk location in file.
|
||||
/// </summary>
|
||||
@@ -90,7 +88,6 @@ public:
|
||||
BytesContainer Data;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FlaxChunk"/> class.
|
||||
/// </summary>
|
||||
@@ -106,7 +103,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets this chunk data pointer.
|
||||
/// </summary>
|
||||
|
||||
@@ -10,11 +10,9 @@
|
||||
class FLAXENGINE_API FlaxFile : public FlaxStorage
|
||||
{
|
||||
protected:
|
||||
|
||||
Entry _asset;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FlaxFile"/> class.
|
||||
/// </summary>
|
||||
@@ -22,7 +20,6 @@ public:
|
||||
FlaxFile(const StringView& path);
|
||||
|
||||
public:
|
||||
|
||||
// [FlaxStorage]
|
||||
String ToString() const override;
|
||||
bool IsPackage() const override;
|
||||
@@ -35,7 +32,6 @@ public:
|
||||
void Dispose() override;
|
||||
|
||||
protected:
|
||||
|
||||
// [FlaxStorage]
|
||||
bool GetEntry(const Guid& id, Entry& e) override;
|
||||
void AddEntry(Entry& e) override;
|
||||
|
||||
@@ -11,11 +11,9 @@
|
||||
class FLAXENGINE_API FlaxPackage : public FlaxStorage
|
||||
{
|
||||
protected:
|
||||
|
||||
Dictionary<Guid, Entry> _entries;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FlaxPackage"/> class.
|
||||
/// </summary>
|
||||
@@ -23,7 +21,6 @@ public:
|
||||
FlaxPackage(const StringView& path);
|
||||
|
||||
public:
|
||||
|
||||
// [FlaxStorage]
|
||||
String ToString() const override;
|
||||
bool IsPackage() const override;
|
||||
@@ -36,7 +33,6 @@ public:
|
||||
void Dispose() override;
|
||||
|
||||
protected:
|
||||
|
||||
// [FlaxStorage]
|
||||
bool GetEntry(const Guid& id, Entry& e) override;
|
||||
void AddEntry(Entry& e) override;
|
||||
|
||||
@@ -27,7 +27,6 @@ class FLAXENGINE_API FlaxStorage : public Object
|
||||
friend class BinaryAsset;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Magic code stored in file header to identify contents.
|
||||
/// </summary>
|
||||
@@ -88,7 +87,6 @@ public:
|
||||
};
|
||||
|
||||
protected:
|
||||
|
||||
// State
|
||||
uint32 _refCount;
|
||||
DateTime _lastRefLostTime;
|
||||
@@ -104,24 +102,20 @@ protected:
|
||||
String _path;
|
||||
|
||||
protected:
|
||||
|
||||
explicit FlaxStorage(const StringView& path);
|
||||
|
||||
private:
|
||||
|
||||
// Used by FlaxStorageReference:
|
||||
void AddRef();
|
||||
void RemoveRef();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Finalizes an instance of the <see cref="FlaxStorage"/> class.
|
||||
/// </summary>
|
||||
virtual ~FlaxStorage();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Locks the storage chunks data to prevent disposing them. Also ensures that file handles won't be closed while chunks are locked.
|
||||
/// </summary>
|
||||
@@ -147,7 +141,6 @@ public:
|
||||
static LockData Invalid;
|
||||
|
||||
private:
|
||||
|
||||
FlaxStorage* _storage;
|
||||
|
||||
LockData(FlaxStorage* storage)
|
||||
@@ -158,14 +151,13 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
LockData(const LockData& other)
|
||||
: _storage(other._storage)
|
||||
{
|
||||
if (_storage)
|
||||
_storage->LockChunks();
|
||||
}
|
||||
|
||||
|
||||
LockData(LockData&& other) noexcept
|
||||
: _storage(other._storage)
|
||||
{
|
||||
@@ -208,7 +200,6 @@ public:
|
||||
other._storage = nullptr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@@ -228,7 +219,6 @@ public:
|
||||
LockData LockSafe();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the references count.
|
||||
/// </summary>
|
||||
@@ -335,7 +325,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Loads package from the file.
|
||||
/// </summary>
|
||||
@@ -417,7 +406,6 @@ public:
|
||||
virtual void Dispose();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Ticks this instance.
|
||||
/// </summary>
|
||||
@@ -428,7 +416,6 @@ public:
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
#if USE_EDITOR
|
||||
|
||||
/// <summary>
|
||||
@@ -489,7 +476,6 @@ public:
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
bool LoadAssetHeader(const Entry& e, AssetInitData& data);
|
||||
void AddChunk(FlaxChunk* chunk);
|
||||
virtual void AddEntry(Entry& e) = 0;
|
||||
|
||||
@@ -10,11 +10,9 @@
|
||||
struct FLAXENGINE_API FlaxStorageReference
|
||||
{
|
||||
private:
|
||||
|
||||
FlaxStorage* _storage;
|
||||
|
||||
public:
|
||||
|
||||
FlaxStorageReference(FlaxStorage* storage)
|
||||
: _storage(storage)
|
||||
{
|
||||
@@ -36,14 +34,12 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
FORCE_INLINE FlaxStorage* Get() const
|
||||
{
|
||||
return _storage;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
FlaxStorageReference& operator=(const FlaxStorageReference& other)
|
||||
{
|
||||
if (this != &other)
|
||||
|
||||
@@ -14,7 +14,6 @@ struct AssetInfo;
|
||||
class FLAXENGINE_API JsonStorageProxy
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified extension can be a json resource file.
|
||||
/// </summary>
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
class AudioClipUpgrader : public BinaryAssetUpgrader
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AudioClipUpgrader"/> class.
|
||||
/// </summary>
|
||||
@@ -30,7 +29,6 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
// ============================================
|
||||
// Version 1:
|
||||
// Designed: 26.02.2018
|
||||
@@ -88,32 +86,32 @@ private:
|
||||
int32 numSamples;
|
||||
switch (oldHeader.Format)
|
||||
{
|
||||
case AudioFormat::Raw:
|
||||
{
|
||||
numSamples = chunk->Size() / (oldHeader.Info.BitDepth / 8);
|
||||
break;
|
||||
}
|
||||
case AudioFormat::Vorbis:
|
||||
{
|
||||
case AudioFormat::Raw:
|
||||
{
|
||||
numSamples = chunk->Size() / (oldHeader.Info.BitDepth / 8);
|
||||
break;
|
||||
}
|
||||
case AudioFormat::Vorbis:
|
||||
{
|
||||
#if COMPILE_WITH_OGG_VORBIS
|
||||
OggVorbisDecoder decoder;
|
||||
MemoryReadStream stream(chunk->Get(), chunk->Size());
|
||||
AudioDataInfo outInfo;
|
||||
if (!decoder.Open(&stream, outInfo, 0))
|
||||
{
|
||||
LOG(Warning, "Audio data open failed (OggVorbisDecoder).");
|
||||
return true;
|
||||
}
|
||||
numSamples = outInfo.NumSamples;
|
||||
OggVorbisDecoder decoder;
|
||||
MemoryReadStream stream(chunk->Get(), chunk->Size());
|
||||
AudioDataInfo outInfo;
|
||||
if (!decoder.Open(&stream, outInfo, 0))
|
||||
{
|
||||
LOG(Warning, "Audio data open failed (OggVorbisDecoder).");
|
||||
return true;
|
||||
}
|
||||
numSamples = outInfo.NumSamples;
|
||||
#else
|
||||
LOG(Warning, "OggVorbisDecoder is disabled.");
|
||||
return true;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
default:
|
||||
LOG(Warning, "Unknown audio data format.");
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
LOG(Warning, "Unknown audio data format.");
|
||||
return true;
|
||||
}
|
||||
newHeader.SamplesPerChunk[chunkIndex] = numSamples;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ struct FLAXENGINE_API AssetMigrationContext
|
||||
AssetInitData Output;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Allocates the chunk in the output data so upgrader can write to it.
|
||||
/// </summary>
|
||||
@@ -68,7 +67,6 @@ typedef bool (*UpgradeHandler)(AssetMigrationContext& context);
|
||||
class FLAXENGINE_API BinaryAssetUpgrader : public IAssetUpgrader
|
||||
{
|
||||
public:
|
||||
|
||||
struct Upgrader
|
||||
{
|
||||
uint32 CurrentVersion;
|
||||
@@ -77,12 +75,10 @@ public:
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
Upgrader const* _upgraders;
|
||||
int32 _upgradersCount;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Upgrades the specified asset data serialized version.
|
||||
/// </summary>
|
||||
@@ -114,7 +110,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Copies all the chunks from the input data to the output container.
|
||||
/// </summary>
|
||||
@@ -179,7 +174,6 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
BinaryAssetUpgrader()
|
||||
{
|
||||
_upgraders = nullptr;
|
||||
@@ -193,7 +187,6 @@ protected:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// [IAssetUpgrader]
|
||||
bool ShouldUpgrade(uint32 serializedVersion) const override
|
||||
{
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
class FontAssetUpgrader : public BinaryAssetUpgrader
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FontAssetUpgrader"/> class.
|
||||
/// </summary>
|
||||
@@ -29,7 +28,6 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
// ============================================
|
||||
// Version 1:
|
||||
// Designed: long time ago in a galaxy far far away
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
class FLAXENGINE_API IAssetUpgrader
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Finalizes an instance of the <see cref="IAssetUpgrader"/> class.
|
||||
/// </summary>
|
||||
@@ -21,7 +20,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Checks if given asset version should be converted.
|
||||
/// </summary>
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
class MaterialInstanceUpgrader : public BinaryAssetUpgrader
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MaterialInstanceUpgrader"/> class.
|
||||
/// </summary>
|
||||
@@ -32,7 +31,6 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
// ============================================
|
||||
// Version 4:
|
||||
// Designed: 5/18/2017
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
class ModelAssetUpgrader : public BinaryAssetUpgrader
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ModelAssetUpgrader"/> class.
|
||||
/// </summary>
|
||||
@@ -36,7 +35,6 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
// ============================================
|
||||
// Version 25:
|
||||
// The same as version 24 except Vertex Buffer 1 has `Color32 Color` component per vertex added
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
class ShaderAssetUpgrader : public BinaryAssetUpgrader
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ShaderAssetUpgrader"/> class.
|
||||
/// </summary>
|
||||
@@ -29,7 +28,6 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
// ============================================
|
||||
// Version 18:
|
||||
// Designed: 7/24/2019
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
class SkeletonMaskUpgrader : public BinaryAssetUpgrader
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SkeletonMaskUpgrader"/> class.
|
||||
/// </summary>
|
||||
@@ -31,7 +30,6 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
static bool Upgrade_1_To_2(AssetMigrationContext& context)
|
||||
{
|
||||
ASSERT(context.Input.SerializedVersion == 1 && context.Output.SerializedVersion == 2);
|
||||
@@ -85,7 +83,7 @@ private:
|
||||
if (context.AllocateChunk(0))
|
||||
return true;
|
||||
MemoryWriteStream stream(4096);
|
||||
|
||||
|
||||
const Guid skeletonId = skeleton.GetID();
|
||||
stream.Write(&skeletonId);
|
||||
stream.WriteInt32(nodesMask.Count());
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user