summaryrefslogtreecommitdiffstats
path: root/src/animation
Commit message (Collapse)AuthorAgeFilesLines
* Fix animation local time calculation when changing playbackRateJuan José Casafranca2017-10-0610-51/+143
| | | | | | | | | | Animation local time was computed in absolute mode, as a scale of the global time that has passed since the start of the animation. Now is computed relative to the last local time, as the last local time + a scale of the elapsed global time. Change-Id: I5c29002602a5184174618ac7755ec94f5c7a328f Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Fix setting running property when animators finishSean Harmer2017-10-061-0/+1
| | | | | | | | We need to call the base class handler so that the generic code in QNode can process the call to update the running property. Change-Id: I7fa3c051f47c2a41c5620f1a72f309192d5ea907 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Add qDebug operator for MappingDataSean Harmer2017-10-061-0/+15
| | | | | Change-Id: Ic725f70329920b41ac18e7bfe4f249247b2cbc83 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Support loading animation data from glTF 2 filesSean Harmer2017-10-064-23/+1125
| | | | | | | | So far just skeletal animations. Morph targets will come in Qt 5.11. Change-Id: Ib1f3efe894ad993b97f79e7f71d92cb4836e4e32 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Merge branch '5.9' into 5.10Sean Harmer2017-10-052-18/+61
|\ | | | | | | | | | | | | Conflicts: src/animation/backend/animationutils.cpp Change-Id: I6bd0d1d15da00537a0bb064fc828b2460584b8e8
| * Fix reformatting of clip evaluation resultsSean Harmer2017-10-051-12/+48
| | | | | | | | | | | | | | | | | | | | | | | | This now correctly handles both the old ChannelMapping and the new SkeletonMapping use cases. There was some ambiguity about which way around the indices were being generated. It worked in previous cases for the limited data available to test with. This has been tested to work with both the JSON animation format and skeletal animations loaded from JSON and glTF 2 files. Change-Id: Ie8558c764cd8dc57d6cdad19bbc6a66052bc68d0 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
| * Improve debug output for fcurvesSean Harmer2017-10-051-6/+19
| | | | | | | | | | Change-Id: I4a9044933b182a2e0eba745483f1b8bc214dcdba Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Initialize callback to nullptr in MappingData structSean Harmer2017-10-031-1/+1
| | | | | | | | | | | | | | Otherwise we inadvertently send callbacks even when not requested. Change-Id: I398c930740133f39982d6b071443fbeee8b029a9 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Clear channel component indices for those not present in animationSean Harmer2017-10-033-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | This allows us to only create MappingData objects for those channels for which we actually have animation data. There is no point, and even more importantly, it is dangerous to try to do so as we will overwrite the existing data of the target properties. TODO: Fix this on 5.9 and forward merge to 5.10 Change-Id: Idb9d2fdef0e3297c0f35ad8c4af01b777321674d Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Update the local poses of the skeleton in the animation aspectSean Harmer2017-10-035-1/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present it is still needlessly, and incorrectly, updating the transforms of joints for which we have no animation data by using a default value of 0 for each component. This causes the joints to be scaled to 0 which is not particularly useful. We should only update joints for which we have valid animation data and leave the other joints alone. For a skeleton this will be OK as we have the initial set of local poses available. For regular QNode properties, the animator/mapper will need to take a snapshot of the current property value when the animation is started so that we can fill in the missing values when generating property changes. This should also be fixed on the 5.9 branch. Change-Id: Ib8f28c55cdfbca3f335777028f72250641092fc9 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Extend buildPropertyMappings to support skeleton mapping use caseSean Harmer2017-10-034-21/+92
| | | | | | | | | | Change-Id: I2eaf725022f5044d7faf647f8789e73de969d49b Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Merge branch '5.9' into 5.10Sean Harmer2017-09-3010-90/+94
|\| | | | | | | | | | | | | | | | | | | Conflicts: src/animation/backend/animationutils.cpp src/animation/backend/animationutils_p.h src/render/geometry/qmesh.cpp tests/auto/animation/animation.pro Change-Id: Ifb57bfb0b12b3ebf9ee177d4ea684134455b4143
| * Remove unused buildPropertyMappings() overload and testsSean Harmer2017-09-292-61/+0
| | | | | | | | | | | | | | Everything goes through the other overload now. Change-Id: Id0c196a6967a9f83e47092ca1fc7f4ab4ebe9309 Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
| * Move the non-blended animation codepath closer to the blended oneSean Harmer2017-09-294-15/+39
| | | | | | | | | | | | | | | | | | Will make it possible to reduce the amount of code to maintain and test. There are still several ways to optimize this too so best to only do it for one code path that all animators use. Change-Id: I05ebd4f41d88aa0bea37d4d17130bc79c96ebd5c Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
| * Add unit test for FindRunningClipAnimatorsJobSean Harmer2017-09-291-1/+9
| | | | | | | | | | | | | | Should pass before and after the refactoring. Change-Id: I9ef8f948f03a131546fc6485e9c66494ff383714 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
| * Add convenience function to ChannelMapper to return list of MappingsSean Harmer2017-09-272-0/+32
| | | | | | | | | | | | | | | | Caches the resolution of node ids to ChannelMappings. Updated test to check this new feature. Change-Id: I0c2f539c2bd91e7918b98c5b60c9ca486b63ec08 Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
| * Actually get matching clip indices for componentsSean Harmer2017-09-261-7/+6
| | | | | | | | | | | | | | | | | | | | | | Rather than assuming they are in order. The blended clip animator code path now behaves the same as the simple QClipAnimator in that it can handle clips with channel components not in the expected order. We can now look at making both share a common code path. Change-Id: I61848e07b4f418ba9f4c56f56f4f49c9a5fbd588 Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
| * Avoid deep copy in loopSean Harmer2017-09-261-1/+1
| | | | | | | | | | Change-Id: I5a86547ae669394c290b30427f98821bc7552a63 Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
| * Fix gathering clip value node idsSean Harmer2017-09-262-1/+5
| | | | | | | | | | | | | | | | This correctly handles the case where the blend tree consists of a single value node. Added test case to catch it. Change-Id: I8982d2081748866d163f107a4513bd2d17feb83a Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
* | Fix clock sync for the blendedclipanimatorJuan José Casafranca2017-09-271-0/+2
| | | | | | | | | | | | | | The clockId was not being sent to the backend as part of the change Change-Id: Ibaa57ec1853b5ec29942f027b68565d87838761e Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* | Merge branch '5.9' into 5.10Sean Harmer2017-09-129-15/+68
|\| | | | | | | Change-Id: Id6a3d4ec579a2f2a2e559c22a2293d0e184f0bdf
| * Get rid of the AllocationPolicy template argument in the ResourceManagerLars Knoll2017-09-111-10/+5
| | | | | | | | | | | | | | We always use the same policy anyway. Change-Id: I3349b8c19ce0e6239b140dfac7ba66f8dda1b9be Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
| * Re-build Blend-Trees when Clips have been loadedWieland Hagen2017-09-088-1/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We need to notify the BlendedClipAnimators, when any of the clips it depends on have been loaded. So we register each animator at the clips that it depends on, mark the animator dirty when the clip has been loaded and thus trigger a re-run of the BuildBlendTreesJob. Make sure to guard accesses to the Handler via mutexes, because backend objects can be marked dirty from various threads. Task-number: QTBUG-61941 Change-Id: I4890d0d76d3118538537252f920d9477bed8f934 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* | Add sceneChangeEvent to QClock backend nodev5.10.0-alpha1Juan José Casafranca2017-09-082-0/+18
| | | | | | | | | | | | | | | | QClock backend node didn't implement sceneChangeEvent, so there was no communication from frontend to backend node. Change-Id: Idf72cba7b7c1834d80694d28a6df4826f8e279aa Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* | Extend generateClipFormatIndices() to handle jointIndexSean Harmer2017-09-023-4/+7
| | | | | | | | | | | | | | AnimationClip now matches on name and jointIndex if jointIndex is valid. Change-Id: Id2b3f41bf465a847048537583fc244743c0d026b Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Extend QChannel and Channel to support jointIndex membersSean Harmer2017-09-024-0/+19
| | | | | | | | | | | | | | Needed for animartion aspect support of skeletons. Change-Id: I89027a62ffcac68318ef8c8645b4720e71ff1697 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Extend buildRequiredChannelsAndTypes to handle indexed targetsSean Harmer2017-09-025-6/+76
| | | | | | | | | | | | | | | | | | | | | | Specifically, this is needed for animating joints of a skeleton. If we later find other such indexed targets we can rename the jointIndex member to something more generic. For now this naming helps with reasoning as there are many kinds of index in play within the animation system. Change-Id: I348f255ee622aa11f26e5a3c1055bf5c12071c17 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Mirror QSkeletonMapping properties to ChannelMapping backend nodeSean Harmer2017-09-023-1/+18
| | | | | | | | | | Change-Id: Idb6aa59ae65351d8aa8bca31dd68a350bcb46973 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Add QSkeletonMapping to Qt3DAnimationSean Harmer2017-09-024-1/+281
| | | | | | | | | | | | | | Allows to easily map animation channels onto a target QAbstractSkeleton. Change-Id: I53c348fe19e00f7b57653f5525b67920319f83d6 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Create backend nodes for any QAbstractChannelMapping subclassSean Harmer2017-09-029-15/+296
| | | | | | | | | | | | | | | | | | | | Introduces a new creation change type to distinguish between the frontend node triggering the creation. Following commits will add the new channel mapping types and populate the backend node appropriately. Change-Id: I09b3cbcd3d716c9e9c18873066b9f282222ab783 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* | Merge dev into 5.10Frederik Gladhorn2017-09-021-1/+1
|\ \ | | | | | | | | | Change-Id: I1bef655947a7176f7931c7f1b8ed4c4176395451
| * | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-09-011-1/+1
| |\| | | | | | | | | | Change-Id: Ic4220f9957266c374f751d3612c60b81e9cea193
| | * Doc: add doc to undocumented methods/propertiesNico Vertriest2017-08-281-1/+1
| | | | | | | | | | | | | | | | | | Change-Id: I8967110b0237421299c2103f847a38e0526f9a6b Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | | Alter QChannelMapping to accept QAbstractChannelMapping pointersSean Harmer2017-08-313-9/+9
| | | | | | | | | | | | | | | | | | | | | In preparation for the new mapping subclasses. Change-Id: I3d659b350da72cca9f5ad195f7aa7fea3d943810 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | | Introduce QAbstractChannelMappingSean Harmer2017-08-317-9/+225
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This will act as the base class for the various specific use cases: * QChannelMapping for mapping to ordinary QNode properties * QSkeletonMapping for mapping to indexed joints in a skeleton * QCallbackMapping for calling a callback in response to an animation The last two of these are yet to be added. The final one is currently part of QChannelMapping but will be separated from it. All 3 types can map to the same type ChannelMapping backend node. Change-Id: Iaeeba0919628d8da4479b8569d3b10d9b5faccf4 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | | Send joint names and local poses from render to animation aspectSean Harmer2017-08-302-3/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | This will allow the animation aspect to easily update the local poses of all joints in a skeleton without needing to be able to address any frontend QJoint objects. Change-Id: Id2137f2533702387dc68296aba1dd8627b0599d6 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | | Add Skeleton backend node to the animation aspectSean Harmer2017-08-308-3/+186
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The animation aspect can already animate any property of a QNode subclass. However, the render aspect allows to render a skinned mesh utilising a QSkeletonLoader that does not create the corresponding frontend QJoint objects (subclasses of QNode). Some skeletons can be large (10's or 100's of joints) so this is a good memory conserving optimization. The consequence of not creating the frontend joints however, is that without the QNodes to address, we cannot animate their local poses. To combat this without giving up on the above optimization we add a backend node for QAbstractSkeleton to the animation aspect. This node contains a vector of local poses for the joints in the same order as the render aspect creates and flattens the joint hierarchy in (see the vector of JointInfo in the SkeletonData in the render aspect). The animation aspect can then use this special knowledge to efficiently animate the joints of a skeleton and each frame, inform the render aspect backend of the new set of local pose transformations, prior to the render aspect calculating the skinning matrix palette and supplying that to the armature component for rendering. This will require the animation aspect to be able to map channels in an animation onto the joint indices of the skeleton backend nodes. By default, they will be applied to matching indices in the vector of local poses. However, an optional name property will be allowed in the animation clip channels to permit re-mapping of animation clips to similar skeletons (i.e. allow animations to be reused between different skeletons where they share some joint names). This will be done in follow up commits. Change-Id: I81ad258f59bb0ddd6a49456840c860783f6fb340 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Merge branch '5.9' into devSean Harmer2017-08-194-10/+8
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/render/backend/renderer.cpp src/render/backend/renderview.cpp src/render/graphicshelpers/graphicscontext_p.h src/render/graphicshelpers/graphicshelperes2_p.h src/render/graphicshelpers/graphicshelpergl2_p.h src/render/graphicshelpers/graphicshelpergl3_2_p.h src/render/graphicshelpers/graphicshelpergl3_3_p.h src/render/graphicshelpers/graphicshelpergl4_p.h src/render/graphicshelpers/graphicshelperinterface_p.h src/render/jobs/pickboundingvolumejob.cpp tests/auto/animation/clipanimator/tst_clipanimator.cpp tests/auto/auto.pro tests/manual/manual.pro Also disabled the QQmlMetaType codepaths following commit 49a11e882059ee1729f776722e085dd21d378c36 in qtdeclarative. The QQmlMetaType codepaths will be re-enabled once a qt5.git integration has succeeded. Change-Id: Ia654d75425e6d406c472d19864383612208cad2b
| * Doc: correct declaration qml propertiesNico Vertriest2017-08-113-8/+6
| | | | | | | | | | | | | | | | | | | | qadditiveclipblend.cpp:173: warning: Unrecognizable QML module/component qualifier for AbstractClipBlendNode baseClip qadditiveclipblend.cpp:191: warning: Unrecognizable QML module/component qualifier for AbstractClipBlendNode additiveClip qblendedclipanimator.cpp:276: warning: Unrecognizable QML module/component qualifier for AbstractClipBlendNode blendTree qclipanimator.cpp:124: warning: Unrecognizable QML module/component qualifier for AbstractAnimationClip clip Change-Id: Ic761f75986e41dc4ec7ab9e97e6776e49498f870 Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
| * Use QSharedPointer::create() moreMarc Mutz2017-07-221-2/+2
| | | | | | | | | | | | | | | | | | | | This is the result of running the (experimental) clang-tidy check qt-modernize-qsharedpointer-create Discarded changes: none. Change-Id: Ic6368521ebf5841267ffe7917cc652627f7b26a7 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* | Fix Qt3DAnimation::Animation::Clock::playbackRateChip Collier2017-08-025-42/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes a small bug, removes unused properties from the clock node (`startTime`) and changes the type of the `playbackRate` property from `float` to `double` to match the rest of the animation aspect. QClockPrivate is no longer responsible for emitting the playbackRateChanged signal. Tests updated to account for this. [ChangeLog][Qt3DAnimation][Bugfix] The backend node (`Qt3DAnimation::Animation::Clock`) had an incorrect return type specified (`int` instead of `float`) which was narrowing the actual value during the evaluation of associated animation clips. Change-Id: I53ec78ba289cafcd2055582bee23ff1fc3481317 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* | Add clock property to QAbstractClipAnimatorChip Collier2017-07-2417-6/+93
| | | | | | | | | | | | | | | | | | Introduces "clock" property to QAbstractClipAnimator and updates associated tests. Updated backend animator nodes and associated evaluation jobs. Change-Id: Id18cabdd710b9b7253772642f21f63043d316a42 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* | Add QClock to Qt3DAnimationChip Collier2017-07-247-4/+432
| | | | | | | | | | | | | | | | | | | | | | Clocks are to be used the animation aspect to allow an application to vary animation clip playback rates. [ChangeLog][Qt3DAnimation][General] Introduce the QClock frontend and backend nodes. Change-Id: Ib73e76800deda07c2fd793d2e3eb3f8a6ee5becb Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* | Merge remote-tracking branch 'origin/5.9' into devAndy Nichols2017-07-119-25/+51
|\| | | | | | | Change-Id: I4ceccd338a937a2ada231f568ed02c7a87bd6e80
| * Avoid crashing when there is one single keyframeLaszlo Agocs2017-07-051-0/+2
| | | | | | | | | | Change-Id: Ibb98f9ab222acdd47ebdf7d2d6ca8639ed7681c1 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
| * Fix ClipAnimator crash when removing animatorsLaszlo Agocs2017-06-303-0/+30
| | | | | | | | | | | | | | | | | | When passing around animator handles, care must be taken before actually using them since the animator component may have been destroyed in the meantime. Change-Id: Ib963d1422e1626b5a06e5bb157a0b6aab76b961d Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
| * Doc: link errorsNico Vertriest2017-06-201-1/+1
| | | | | | | | | | | | | | | | | | qclipanimator.cpp:55: warning: Can't link to AbstractAnimationClip qparameter.cpp:47: warning: Can't link to 'Texture' qclipanimator.cpp:55: warning: Can't link to 'ChannelMapper' Change-Id: I84d8de99d5cfdc390b4e33fdae5882d60842b519 Reviewed-by: Martin Smith <martin.smith@qt.io>
| * Doc: correct \property statementsNico Vertriest2017-06-202-2/+2
| | | | | | | | | | | | | | | | qblendedclipanimator.cpp:276: warning: Unrecognizable QML module/component qualifier for AbstractClipBlendNode blendTree qclipanimator.cpp:124: warning: Unrecognizable QML module/component qualifier for AbstractAnimationClip clip Change-Id: Ia1b43f1089ad9d4c8079084c4b2d29e487a55b8a Reviewed-by: Martin Smith <martin.smith@qt.io>
| * Doc: correct \property and \qmlproperty statementsNico Vertriest2017-06-193-22/+16
| | | | | | | | | | | | | | | | | | | | | | | | functionrangefinder.cpp:54: warning: Invalid syntax in '\fn' qabstractclipanimator.cpp:127: warning: Unrecognizable QML module/component qualifier for bool running qabstractclipanimator.cpp:168: warning: Unrecognizable QML module/component qualifier for int loops qadditiveclipblend.cpp:173: warning: Unrecognizable QML module/component qualifier for AbstractClipBlendNode baseClip qadditiveclipblend.cpp:191: warning: Unrecognizable QML module/component qualifier for AbstractClipBlendNode additiveClip qabstractclipanimator.h:62: warning: No documentation for Qt3DAnimation::QAbstractClipAnimator::Loops Change-Id: Iab2686f55149a6998eac81ca0aab991b815b12d9 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* | Add support for animation callbacksLaszlo Agocs2017-06-2319-69/+468
| | | | | | | | | | | | | | | | Let QChannelMapping optionally specify a callback, which then gets invoked either directly on a worker thread or the gui thread. Change-Id: I871776f47cc921ceb254f9dc1a7b89ae5c5618d8 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>