diff options
Diffstat (limited to 'src/render/jobs/updateskinningpalettejob.cpp')
-rw-r--r-- | src/render/jobs/updateskinningpalettejob.cpp | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/src/render/jobs/updateskinningpalettejob.cpp b/src/render/jobs/updateskinningpalettejob.cpp index 1ee9101f9..0f5d3d6d6 100644 --- a/src/render/jobs/updateskinningpalettejob.cpp +++ b/src/render/jobs/updateskinningpalettejob.cpp @@ -79,7 +79,11 @@ void UpdateSkinningPaletteJob::run() // Find all the armature components and update their skinning palettes QVector<HArmature> dirtyArmatures; - findDirtyArmatures(m_root, dirtyArmatures); + m_root->traverse([&dirtyArmatures](Entity *entity) { + const auto armatureHandle = entity->componentHandle<Armature>(); + if (!armatureHandle.isNull() && !dirtyArmatures.contains(armatureHandle)) + dirtyArmatures.push_back(armatureHandle); + }); // Update the skeleton for each dirty armature auto skeletonManager = m_nodeManagers->skeletonManager(); @@ -96,22 +100,6 @@ void UpdateSkinningPaletteJob::run() } } -void UpdateSkinningPaletteJob::findDirtyArmatures(Entity *entity, - QVector<HArmature> &armatures) const -{ - // Just return all enabled armatures found on entities for now - // TODO: Be smarter about limiting which armatures we update. For e.g. only - // those with skeletons that have changed and only those that are within view - // of one or more renderviews. - const auto armatureHandle = entity->componentHandle<Armature>(); - if (!armatureHandle.isNull() && !armatures.contains(armatureHandle)) - armatures.push_back(armatureHandle); - - const auto children = entity->children(); - for (const auto child : children) - findDirtyArmatures(child, armatures); -} - } // namespace Render } // namespace Qt3DRender |