summaryrefslogtreecommitdiffstats
path: root/src/runtime/q3dsanimationmanager.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix dynamic keyframesChristian Strømme2018-11-261-4/+5
| | | | | | | | | | Don't generate dynamic kf on first entry to a slide, since there are no "from" values yet. Task-number: QT3DS-2209 Change-Id: Ib4e59968d9099b77ea6d11f1b627b77cad194a23 Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Revert "Improve state handling"Christian Strømme2018-11-061-1/+1
| | | | | | | | | | | This commit is introducing to many regressions at this point, so the best option is to revert it now and re-apply once the remaining issue are resolved. This reverts commit 55b43d3e1c3a100f4ad41d94c132afd2a0d029b3. Change-Id: If2733c506aa64a242a4605d81d69f66e2f7aae41 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Fix dynamic keyframe regressionLaszlo Agocs2018-10-311-15/+16
| | | | | | | | | | | | | Adding the dummy first/last keyframes should be postponed until after the first keyframe is updated by the dynamic keyframe logic. Add also the test scene from the report: clicking the rectangle should only start moving after 2 seconds (assuming you click fast enough after opening the scene) Task-number: QT3DS-2577 Change-Id: If768179c8aafd541798af21d397e1e93164354db Reviewed-by: Christian Stromme <christian.stromme@qt.io>
* Improve state handlingChristian Strømme2018-10-291-1/+1
| | | | | | | | | | | | | | | | | | | | This is an attempt to clean up and make the state changes more sane, i.e., by trying do everything once and in the right order. There are still ugliness in this code, but it should be more easily to follow now, aided by extra inline commentary. This change should also improve some of the flickering seen in some examples when changing slides, as we try avoid re-setting stuff when we don't need to. Since time updates for the new slide is deferred until the first time callback, some of the test needed to be changed to their QTRY_* version. Also, there's now a clear distinction between stopped and paused, where paused means the slides progress is stopped at time t, as expected and stopped means the slides values and state is reset to it's initial state. Task-number: QT3DS-1866 Change-Id: I7a9b61ee3ad4a976e0e8d4de386704dcf0d526bf Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Fix how we create the key for the AnimationValueChangeChristian Strømme2018-09-281-11/+9
| | | | | | | | | | | The optimization done in e18f3739 got lost due to a last minute change, this change rectifies that mistake. Note that even though the change didn't give the results as initially intended, it was not a regression. Change-Id: I3e24fe0f0339d965f79a8276a9a0b4c7b8e92261 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Fix flickering when changing slidesChristian Strømme2018-09-121-0/+2
| | | | | | | | This was introduce by e18f37399218, as the change forgot to clear the queue when the slide changed. Change-Id: Idc5cac8549bfe39c3a35499b0ef9f5984cc6a005 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Look-up change flags when creating animation callbacksChristian Strømme2018-09-111-2/+4
| | | | | | | | | mapping the property change to a change flag is expensive, so look-up the change flag when creating the animation callback, as it won't change after that and we can just cache it for later updates. Change-Id: I520a3be298735c55aac6e8e6e8cb2215f2c9d75e Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Improve how we store and compress animation value changesChristian Strømme2018-09-111-27/+31
| | | | | | | | | | Instead of using a multi-hash and re-iterating over the same values multiple times, we now crate a hash from the AnimationValueChange data and can assume change updates are compressed and are unique for each target-property pair. Change-Id: Id0bbbe887b7f7630a426021774d68f6307a5cf65 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Quick fix for animations getting out of syncChristian Strømme2018-09-071-0/+20
| | | | | | | | | | | | A clip on Qt3D's side gets its duration calculated from the first and last keyframe position, so to make sure we don't end up with animation clips that are shorter then the expected duration, we now insert extra keyframs at the start and end of each clip if needed. This should ensure that the clips are more or less in sync, as expected. Taks-number: QT3DS-2183 Change-Id: Idd2715ede6c8bb2698ed9ea9e2262703cc28866d Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Refactor animation handlingChristian Strømme2018-06-221-376/+89
| | | | | | | | Simplify the communication and mapping between animating values by using the new property system. Change-Id: Ie2a014778a1f05c916243f6c5d3299801fc43293 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Part one of the property re-workChristian Strømme2018-06-221-6/+6
| | | | | | | | | | To make the property system more flexible we now use the metaObject infrastructure to keep track of the graph objects properties etc. The goal of this change is to make it easier to add new properties and access/modify those properties at run-time. Change-Id: I82ee2ac34c4a2ae8c9576a4cd04d57e2058ca9be Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Move the slide position callback out of the animation classChristian Strømme2018-06-011-88/+0
| | | | | | | | | The callback for the time updates belongs to the slideplayer and also deserves a better name the "DummyCallback", so moved it into the slideplayer's source file and renamed it to Q3DSSlidePositionCallback. Change-Id: I073dfd59ef4f95f0c03b73205069ed5af7fb912b Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Don't re-create the slide animator unless it changesChristian Strømme2018-06-011-20/+20
| | | | | Change-Id: I7b01f5b23bbdf206829f23b609264cb6f901c527 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Add enabled/disabled state to the graph objectsChristian Strømme2018-05-291-1/+4
| | | | | | | | | | If a layer has sub-presentation set, mark all objects in the layer as disabled to avoid those from being processed. Task-number: QT3DS-1731 Change-Id: I672ba567837bc0e5ec2c9d1773216a9b80385fb2 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Ensure animated color components are in range [0, 1]Laszlo Agocs2018-05-181-2/+28
| | | | | | | ...and never very slightly above 1. Change-Id: I9ba17d75a383c3f2a76464f59db471eb12b045dc Reviewed-by: Christian Stromme <christian.stromme@qt.io>
* Don't update the slide position value unless it changesChristian Strømme2018-05-151-1/+7
| | | | | | | Saves us some work by discarding values that didn't actually change. Change-Id: I1f777426bd385199a6cc68fac8dc5c3891968bc8 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Always use the slideplayer associated with the slide to update the timeChristian Strømme2018-05-151-7/+6
| | | | | | | | Components manage their own objects, so they need to know when the time changes. Change-Id: I4f5a6f8daa9b33fe71b74e4c18657c042d1513d7 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Remove the rollback dataChristian Strømme2018-05-081-28/+0
| | | | | | | | | This isn't really needed, we already reset the properties in handleSlideChange() in the scene manager by calling applyPropertyChanges(). Change-Id: I1fd59ea4746232f19a8977e2da507c814f565b0f Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Don't notify about property updates while changing slidesChristian Stromme2018-05-081-32/+23
| | | | | | | | | | We need to wait until the animations start to avoid flickering, so we now filter out the eyeball changes, and only notify about those. The rest will be updates once the animators start. Task-number: QT3DS-1572 Change-Id: Iae0c068e27b508a983ddbcaf83d3e62b184cae2b Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Move logging categories to a single central placeLaszlo Agocs2018-05-041-8/+7
| | | | | | | | | | | Also add a new category for the animation manager. The behavior does not change (debug prints are enabled). Not sure if we really want to change this at all (unless it affects performance). But the option to do so by a single function call is now there. Change-Id: Idf0973f37c35475c03405b0e56b2f1b6fb63cd84 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Add support for dynamic key-framesChristian Strømme2018-04-261-23/+66
| | | | | | Task-number: QT3DS-121 Change-Id: Iaadd36ed6024a328f73815394551c5a7ec32c576 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Compact AnimatableExtraMetaChristian Stromme2018-04-171-2/+2
| | | | | | | | | | Using more lightweight callback functions saves us more then 5k bytes for the extraMeta array alone. In addition we save 48 bytes for each Animatable object and 28 bytes for each AnimatedValueRollbackData object. Change-Id: I7a18fbfe3ea69700d938483e2f2a8b3b3d097467 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Update smooth constantChristian Strømme2018-04-031-1/+1
| | | | | | | | | We used an approximation to work around an issue in our bezier calculation, since that has now been resolved, we can use a more descriptive and correct value. Change-Id: I845a84baebc43f4f50d8951ea39e8c4897d44bbb Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Always create the slide animator, even if there's no animation tracksChristian Strømme2018-03-261-2/+2
| | | | | | | | The slide animator should run and report time updates even if there are no animations on the slide. Change-Id: I5a3137a31b6964a7583be99f948d8d432722b89e Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Support using Alias NodesAndy Nichols2018-03-261-2/+16
| | | | | | | | | | | | | | | | | | Alias nodes are weird, and end just just being copies in practice. Anytime there is a Alias node in the scene, a copy of the referenced node's sub-tree is copied and instanced. This is recreating the behavior in runtime 1.x, but is also not so useful because changes to the original reference at runtime are not reflected by these references. There is also some unusual behavior when it comes to the states defined by the slide graph, because it is hard to define which states should be used by the new instances. This commit tries to recreate the behavior of runtime 1.x, however this is difficult because there is significant differences between how things look in the editor vs the runtime for 1.x already. Change-Id: I37446da8d0710ac43e9db2516f9c540201a51c5f Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Fix a bug with flickering component animationsAdam Treat2018-03-261-0/+5
| | | | | | | | | | | | | | The way we currently handle timeline visibility is a dummy callback from the animationmanager to the main slideplayer that then iterates through its objects (which can be component objects with their own slides) and recursively calls SlidePlayer::setSlideTime. This is a problem for independently animating a component while its parent slide is stopped or paused for instance. This patch fixes a bug that causes flickering in one of our test cases and references a TODO for enabling independent control of the component. Change-Id: I26f888c139f441ff9206e5e33ab66c5cb02f47f1 Reviewed-by: Christian Stromme <christian.stromme@qt.io>
* Temporary fix for animations on objects unlinked from the scenegraphLaszlo Agocs2018-03-141-1/+17
| | | | | | | | This leads to leaking attached->animationData and the callback pointers in it. Needs a more sophisticated solution later. Change-Id: I7c6313efd0268b7f010392219abfca902dbcd6dd Reviewed-by: Christian Stromme <christian.stromme@qt.io>
* Update node visibility based on starttime/endtimeAdam Treat2018-03-121-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Honor all items starttimes on initializing a slide to be shown Honor the starttime/endtime for components and refactor/consolidate code Refactors SlidePlayer so that the setSlideTime method can replace the updateSlideVisibility method. Consolidates the two methods for taking care to mark a slide and its children as visible/hidden. In addition, the patch honors the starttime/endtime properities for components. In order to do this it was necessary to change the SliderPlayer time API (seek, position, duration) to use milliseconds instead of a normalized range from 0 - 1. I've also fixed bugs with positionChanged signal so that it consistently emits only after the animation engine has registered the change and only when the position has actually changed. This required a small change to SlideExplorerWidget as well. Fixes slideplayer test to take into account changes to (seek, position, duration) indicated above and fixes a bug in the slideChanged signal that was not being captured before. Finally, I've added tests for component starttime/endtime visibility. Task-number: QT3DS-123 Change-Id: Iebc8c0a6365d6551aec70f76aacffd7c00cd8ac4 Reviewed-by: Christian Stromme <christian.stromme@qt.io>
* Adjust calculation of the control points for the easing valuesChristian Strømme2018-03-071-4/+8
| | | | | | | | This is a follow up change to 4166e5e2e052313e to get closer to the smooth easing curves in Studio 1.0 Change-Id: Ibcf664cc90184cd5eb6f2fa4237b33bb2dcf14b3 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Add support for keyframes with easing valuesChristian Strømme2018-02-271-29/+81
| | | | | Change-Id: I9765912d02b128c8c90419f355894c8031cd53d3 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Add utility function for getting the start and end time for a slideChristian Strømme2018-02-271-20/+4
| | | | | | | | | | | Get the start and end time from the slide by looking at the parents layer. This assumes that the properties for the layer(s) has been updates before being called. If the parent doesn't have a layer, e.g., because it's a component, then we get the time by going through the the start and endtime of the slide's objects. Change-Id: Id8d2d134de3efd880ee5379b1316d5f1d3502f5a Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Avoid asserting for incomplete animation channelsLaszlo Agocs2018-02-221-3/+12
| | | | | | | | | | The .uip always specifies all components but let's play nice with programmatically created animations that fail to do this. Forcing the values for the non-specified channels to 0 is better than getting an assert. Change-Id: I8a1f14229c056d50effacfc82eaee977d40ccb3e Reviewed-by: Christian Stromme <christian.stromme@qt.io>
* Q3DSUipPresentation: unify to constref from constptr return valuesLaszlo Agocs2018-02-201-9/+9
| | | | | | | | | | | since other parts (e.g. effects, custom materials) already do this. In practice the calling code gets nicer usually since the dereferencing can be dropped. Task-number: QT3DS-1175 Change-Id: I81e678db13057989f81273cfd3566310d93c5911 Reviewed-by: Christian Stromme <christian.stromme@qt.io>
* Revise how properties can be set on graph objectsLaszlo Agocs2018-02-201-89/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Introduce proper setters The pattern would be Q3DSPropertyChange setSomething(TYPE newSomethingValue); which would then allow writing the following, using starttime and endtime as an example obj->notifyPropertyChanges({ obj->setStartTime(5000), obj->setEndTime(6000) }); to both set and notify about the change. Pretty convenient. 2. Move the anim setters out of the way The static, variant-based setters and getters used by the animation system are moved to their own classes. (Q3DSnnnn -> Q3DSnnnnAnimator) This makes the Q3DSnnnn classes a lot cleaner and the static stuff can also be hidden later on, if needed (since they do not need to be public as long as the friend declaration is there). 3. Custom property getters/setters for CustomMaterialInstance and EffectInstance This should be self-explanatory: QVariantMap customProperties() const QVariant customProperty(const QString &name) const Q3DSPropertyChange setCustomProperty(const QString &name, const QVariant &value) Additionally they both get a ctor that takes a Q3DSEffect or Q3DSCustomMaterial. 4. Make a bunch of functions on Q3DSUipPresentation and Q3DSSlide public. This will not suffice for creating a full scene programatically with animations and everything, but is a good start, as shown in the new autotest. Task-number: QT3DS-1123 Change-Id: I3a96fc8a38e7d483ab802bddf94999c68525b33f Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Make init animatior lambda staticChristian Strømme2018-02-191-1/+1
| | | | | | | | The lambda doesn't need to capture anything, so remove the capture list and make it static. Change-Id: If5ef0c966c1ae8675863e074fae8ec6417671a78 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Make the two uses of Q3DSPropertyChange distinct in the APILaszlo Agocs2018-02-191-1/+1
| | | | | | | | | | | | | | | | | A Q3DSPropertyChangeList can be used in two ways: 1. passed both to applyPropertyChanges and notifyPropertyChanges In this case both the property name and value must be set, obviously. 2. when passed only to notifyPropertyChanges Here there is no value since the new values are expected to be already set via some other mechanism (i.e. the static setters in case of animations). As a first step towards cleaning up how values are get/set for graph object members, make this distinction obvious in Q3dSPropertyChange. Change-Id: I96afe73932ad272426b9cbc511b6f596a0e8ed87 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Add slide playerChristian Strømme2018-02-141-205/+298
| | | | | | | This adds logic for handling slides and their animations. Change-Id: I368d16fd2164dca41931ee2b566b16d5098a99ad Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Improve readabilty in the animation managerChristian Strømme2018-02-081-32/+40
| | | | | Change-Id: Ia9d4e8fdbb48c2b3e0d374d3ce36b5ede03f23e8 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Make seeking in the slide explorer functionalChristian Stromme2018-02-071-0/+2
| | | | | | | | | | This is a bit crude, as we're missing the abstractions needed to properly control the playback of the slides, so this only adds the bare minimum for doing start/pause/seek operations in the explorer. Change-Id: I77b36ce68c3843832de04d2f6db1e7d461c92499 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Make (almost) everything privateLaszlo Agocs2018-02-011-2/+2
| | | | | Change-Id: Iecb4f6bacd2e142ebf449432cdb39836332833bb Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Studio3D: add scenegraph node and renderer objectLaszlo Agocs2018-02-011-0/+3
| | | | | | | | | | Not functional yet, although the implementation is mostly complete. The API is obviously not there, for now we'll just have a source property to allow testing the internals. Change-Id: I6b189aa30a0bc486edb041879e094641e0e51ffc Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Make some headers privateLaszlo Agocs2018-02-011-1/+1
| | | | | | | | | | | Eventually most (perhaps all) classes in the runtime will become private since the user-facing API is Studio3D and the yet-to-be-implemented 3DS1-style C++ APIs. Start some progress on this. Change-Id: Ia145f114d1b57ecc8aa0902859d8715474563031 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Follow QChannelMapping -> QCallbackMapping changeLaszlo Agocs2018-01-031-1/+2
| | | | | Change-Id: I7f91e6d7e9b02d1c2a4cdcea72b917e158eeee3c Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Make custom material and effect properties animatableLaszlo Agocs2017-12-011-44/+91
| | | | | | | | Even effects are handled now although that cannot be tested yet. Task-number: QT3DS-618 Change-Id: I37d440e0712a6ff86d8e0783d5c4c1b9a930971d Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Make custom materials and effects store variantsLaszlo Agocs2017-12-011-1/+1
| | | | | | | | | | This enables passing the QVariant value to QParameters later on with little or no adaptation. (e.g. textures are filenames and will still need to be turned into QAbstractTexture* on the scenemanager level, but many others, like floats or vectors, will work as-is) Change-Id: Ibfbb81bc571562f04fa233c86245a0371fd9d217 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Drop the now-unused componentCount fieldLaszlo Agocs2017-12-011-76/+77
| | | | | Change-Id: Ieed0f3fb365d32414e05011b355b9fa0a9662d2f Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Fix crashing camera animationsLaszlo Agocs2017-11-301-1/+1
| | | | | | | Swap Change-Id: Ia6eb29f8b80aef16638044e55302425a3eb2b540 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Custom material animation enablersLaszlo Agocs2017-11-301-10/+43
| | | | | | Task-number: QT3DS-618 Change-Id: I397d2df2ccae7204f9f77bae14906fc3471a36a2 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Consider previous slide when updating clip animatorsAndy Nichols2017-11-291-32/+72
| | | | | | | | | | | | The previous logic made assumptions that there were only the master and current slide, and did not account for updating animations between slides. I think there are still some rough edges with this but it fixes many errors with the current behavior. Change-Id: I8de85ac3aa27a2d7cd2f142ec9fef490e871bda0 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Add shadow map FoV propertyLaszlo Agocs2017-11-101-0/+1
| | | | | | | | | Plus take the always-show changes for shadow properties from 3DS1 (not that it matters for the runtime). Task-number: QT3DS-300 Change-Id: I46eec1b2e03475e3ba0343b97909f904c54d5fd8 Reviewed-by: Andy Nichols <andy.nichols@qt.io>