Merge remote-tracking branch 'origin/master' into 1.7
This commit is contained in:
@@ -146,7 +146,7 @@ void AnimatedModel::SetCurrentPose(const Array<Matrix>& nodesTransformation, boo
|
||||
Matrix invWorld;
|
||||
Matrix::Invert(world, invWorld);
|
||||
for (auto& m : GraphInstance.NodesPose)
|
||||
m = invWorld * m;
|
||||
m = m * invWorld;
|
||||
}
|
||||
OnAnimationUpdated();
|
||||
}
|
||||
@@ -774,7 +774,13 @@ void AnimatedModel::OnAnimationUpdated_Sync()
|
||||
// Update synchronous stuff
|
||||
UpdateSockets();
|
||||
ApplyRootMotion(GraphInstance.RootMotion);
|
||||
AnimationUpdated();
|
||||
if (!_isDuringUpdateEvent)
|
||||
{
|
||||
// Prevent stack-overflow when gameplay modifies the pose within the event
|
||||
_isDuringUpdateEvent = true;
|
||||
AnimationUpdated();
|
||||
_isDuringUpdateEvent = false;
|
||||
}
|
||||
}
|
||||
|
||||
void AnimatedModel::OnAnimationUpdated()
|
||||
|
||||
@@ -67,6 +67,7 @@ private:
|
||||
AnimationUpdateMode _actualMode;
|
||||
uint32 _counter;
|
||||
Real _lastMinDstSqr;
|
||||
bool _isDuringUpdateEvent = false;
|
||||
uint64 _lastUpdateFrame;
|
||||
mutable MeshDeformation* _deformation = nullptr;
|
||||
ScriptingObjectReference<AnimatedModel> _masterPose;
|
||||
|
||||
@@ -740,16 +740,20 @@ Actor* FindActorRecursive(Actor* node, const Tag& tag)
|
||||
return result;
|
||||
}
|
||||
|
||||
void FindActorsRecursive(Actor* node, const Tag& tag, Array<Actor*>& result)
|
||||
void FindActorsRecursive(Actor* node, const Tag& tag, const bool activeOnly, Array<Actor*>& result)
|
||||
{
|
||||
if (activeOnly && !node->GetIsActive())
|
||||
return;
|
||||
if (node->HasTag(tag))
|
||||
result.Add(node);
|
||||
for (Actor* child : node->Children)
|
||||
FindActorsRecursive(child, tag, result);
|
||||
FindActorsRecursive(child, tag, activeOnly, result);
|
||||
}
|
||||
|
||||
void FindActorsRecursiveByParentTags(Actor* node, const Array<Tag>& tags, Array<Actor*>& result)
|
||||
void FindActorsRecursiveByParentTags(Actor* node, const Array<Tag>& tags, const bool activeOnly, Array<Actor*>& result)
|
||||
{
|
||||
if (activeOnly && !node->GetIsActive())
|
||||
return;
|
||||
for (Tag tag : tags)
|
||||
{
|
||||
if (node->HasTag(tag))
|
||||
@@ -759,7 +763,7 @@ void FindActorsRecursiveByParentTags(Actor* node, const Array<Tag>& tags, Array<
|
||||
}
|
||||
}
|
||||
for (Actor* child : node->Children)
|
||||
FindActorsRecursiveByParentTags(child, tags, result);
|
||||
FindActorsRecursiveByParentTags(child, tags, activeOnly, result);
|
||||
}
|
||||
|
||||
Actor* Level::FindActor(const Tag& tag, Actor* root)
|
||||
@@ -785,24 +789,24 @@ void FindActorRecursive(Actor* node, const Tag& tag, Array<Actor*>& result)
|
||||
FindActorRecursive(child, tag, result);
|
||||
}
|
||||
|
||||
Array<Actor*> Level::FindActors(const Tag& tag, Actor* root)
|
||||
Array<Actor*> Level::FindActors(const Tag& tag, const bool activeOnly, Actor* root)
|
||||
{
|
||||
PROFILE_CPU();
|
||||
Array<Actor*> result;
|
||||
if (root)
|
||||
{
|
||||
FindActorsRecursive(root, tag, result);
|
||||
FindActorsRecursive(root, tag, activeOnly, result);
|
||||
}
|
||||
else
|
||||
{
|
||||
ScopeLock lock(ScenesLock);
|
||||
for (Scene* scene : Scenes)
|
||||
FindActorsRecursive(scene, tag, result);
|
||||
FindActorsRecursive(scene, tag, activeOnly, result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Array<Actor*> Level::FindActorsByParentTag(const Tag& parentTag, Actor* root)
|
||||
Array<Actor*> Level::FindActorsByParentTag(const Tag& parentTag, const bool activeOnly, Actor* root)
|
||||
{
|
||||
PROFILE_CPU();
|
||||
Array<Actor*> result;
|
||||
@@ -814,19 +818,19 @@ Array<Actor*> Level::FindActorsByParentTag(const Tag& parentTag, Actor* root)
|
||||
}
|
||||
if (subTags.Count() == 1)
|
||||
{
|
||||
result = FindActors(subTags[0], root);
|
||||
result = FindActors(subTags[0], activeOnly, root);
|
||||
return result;
|
||||
}
|
||||
|
||||
if (root)
|
||||
{
|
||||
FindActorsRecursiveByParentTags(root, subTags, result);
|
||||
FindActorsRecursiveByParentTags(root, subTags, activeOnly, result);
|
||||
}
|
||||
else
|
||||
{
|
||||
ScopeLock lock(ScenesLock);
|
||||
for (Scene* scene : Scenes)
|
||||
FindActorsRecursiveByParentTags(scene, subTags, result);
|
||||
FindActorsRecursiveByParentTags(scene, subTags, activeOnly, result);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -494,17 +494,19 @@ public:
|
||||
/// Tries to find the actors with the given tag (returns all found).
|
||||
/// </summary>
|
||||
/// <param name="tag">The tag of the actor to search for.</param>
|
||||
/// <param name="activeOnly">Find only active actors.</param>
|
||||
/// <param name="root">The custom root actor to start searching from (hierarchical), otherwise null to search all loaded scenes.</param>
|
||||
/// <returns>Found actors or empty if none.</returns>
|
||||
API_FUNCTION() static Array<Actor*> FindActors(const Tag& tag, Actor* root = nullptr);
|
||||
API_FUNCTION() static Array<Actor*> FindActors(const Tag& tag, const bool activeOnly = false, Actor* root = nullptr);
|
||||
|
||||
/// <summary>
|
||||
/// Search actors using a parent parentTag.
|
||||
/// </summary>
|
||||
/// <param name="parentTag">The tag to search actors with subtags belonging to this tag</param>
|
||||
/// <param name="activeOnly">Find only active actors.</param>
|
||||
/// <param name="root">The custom root actor to start searching from (hierarchical), otherwise null to search all loaded scenes.</param>
|
||||
/// <returns>Returns all actors that have subtags belonging to the given parent parentTag</returns>
|
||||
API_FUNCTION() static Array<Actor*> FindActorsByParentTag(const Tag& parentTag, Actor* root = nullptr);
|
||||
API_FUNCTION() static Array<Actor*> FindActorsByParentTag(const Tag& parentTag, const bool activeOnly = false, Actor* root = nullptr);
|
||||
|
||||
private:
|
||||
// Actor API
|
||||
|
||||
@@ -23,8 +23,8 @@ namespace FlaxEngine
|
||||
if (_keyframes == null || _keyframes.Length != count)
|
||||
_keyframes = new BezierCurve<Transform>.Keyframe[count];
|
||||
#if !BUILD_RELEASE
|
||||
if (Marshal.SizeOf(typeof(BezierCurve<Transform>.Keyframe)) != Transform.SizeInBytes * 3 + sizeof(float))
|
||||
throw new Exception("Invalid size of BezierCurve keyframe " + Marshal.SizeOf(typeof(BezierCurve<Transform>.Keyframe)) + " bytes.");
|
||||
if (System.Runtime.CompilerServices.Unsafe.SizeOf<BezierCurve<Transform>.Keyframe>() != Transform.SizeInBytes * 3 + sizeof(float))
|
||||
throw new Exception("Invalid size of BezierCurve keyframe " + System.Runtime.CompilerServices.Unsafe.SizeOf<BezierCurve<Transform>.Keyframe>() + " bytes.");
|
||||
#endif
|
||||
Internal_GetKeyframes(__unmanagedPtr, _keyframes);
|
||||
return _keyframes;
|
||||
|
||||
Reference in New Issue
Block a user