summaryrefslogtreecommitdiffstats
path: root/src/core/nodes
Commit message (Collapse)AuthorAgeFilesLines
* QBackendNode: fix a small typoAurélien Brooke2024-01-181-1/+1
| | | | | Change-Id: I932571833ae612f635178189b3302f54bb15351c Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Fix the creation of backend nodes if using the parent entity constructorAurélien Brooke2024-01-151-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On an already running simulation, when adding entities with the constructor taking a parent node, no backend node was created if a component was previously added to the tree with QEntity::addComponent(). In QEntity::addComponent(), we call _q_ensureBackendNodeCreated() on the component, creating the backend nodes of the whole tree, which marks them with m_hasBackendNode = true. Then, when we try to create a new entity by using the constructor which takes a parent entity (e.g. `auto positions = new QAttribute(entity);`), we effectively call NodePostConstructorInit::addNode(). But since the parent node is still in the m_nodesToConstruct queue (we didn't return to the event loop yet), the function did not queue the new entity for backend node creation. To fix this, allow the new entity to be added in the creation queue, even if the parent in the queue has already been created itself (m_hasBackendNode == true). * The bug does not happen when creating the whole tree in advance and then calling setRootEntity(). * It also does not happen if not calling QEntity::addComponent(), because then the parent backend node is not created, so it will create its child one automatically once itself is created. * Finally, not giving a parent node and explicitly calling setParent() later was also working. QTBUG-120964 contains an example materializing the crash, caused by the missing Attribute backend node. Fixes: QTBUG-77139 Fixes: QTBUG-100387 Fixes: QTBUG-120964 Pick-to: 6.6 6.7 Change-Id: I908f1b5ecc2a845564d38bc634a2c645ad1a8074 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* QEntity: fix a std::move-from-const in destructorAurélien Brooke2024-01-131-1/+1
| | | | | | | | | | The quadratic fix proposed by commit cbffb898fc3625a04a9569e232c0f6231d4d3505 was actually not doing anything because std::move() was applied to a const variable. Pick-to: 6.6 6.7 Change-Id: Ieff6341493fd026ad45e0c3e26f0cdb4797b4a6a Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Fix Race Condition in NodePostConstructorInit::processNodesPhilip Schuchardt2023-10-101-0/+2
| | | | | | | | | | | | | This fixes QTBUG-116770. This moves m_aspectEngine to the correct thread when it's created in Scene3DItem. And prevents processNodes from being called on the wrong thread. [ChangeLog] Fix Race Condition in NodePostConstructorInit::processNodes Fixes: QTBUG-116770 Pick-to: 6.6 6.5 Change-Id: Iaf47ffd99ab6f920559b596a9baa8c253c135e40 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Build with QT_NO_CONTEXTLESS_CONNECTAhmad Samir2023-07-221-5/+6
| | | | | | | | | | | This disables the 3-arg QObject::connect() overload: QObject::connect(sender, signal, functor) For details see: https://lists.qt-project.org/pipermail/development/2023-July/044141.html Change-Id: If62d07f687d9ea86995ea813add49216ccaf15cc Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Remove qmake build filesMike Krus2023-03-171-27/+0
| | | | | | | | Except in examples Pick-to: 6.5 Change-Id: I31b06ddfc79f14dde3369518a76d57606daf939f Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-201-1/+1
| | | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace. Task-number: QTBUG-99313 Change-Id: I1b3c7c4058726c55199fd8ba74b6d6890ad8dd93 Reviewed-by: Mike Krus <mike.krus@kdab.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Port from container::count() and length() to size() - V4Marc Mutz2022-10-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to handle typedefs and accesses through pointers, too: const std::string o = "object"; auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); }; auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) { auto exprOfDeclaredType = [&](auto decl) { return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o); }; return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes)))); }; auto renameMethod = [&] (ArrayRef<StringRef> classes, StringRef from, StringRef to) { return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)), callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))), changeTo(cat(access(o, cat(to)), "()")), cat("use '", to, "' instead of '", from, "'")); }; renameMethod(<classes>, "count", "size"); renameMethod(<classes>, "length", "size"); a.k.a qt-port-to-std-compatible-api V4 with config Scope: 'Container'. Change-Id: I3b040fa72968753048fd669c073ae80c3ba1bdad Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Qt3DCore: includemocsMike Krus2022-06-224-0/+8
| | | | | | | Task-number: QTBUG-103286 Pick-to: 6.3 6.2 5.15 Change-Id: Ifca1713c5e2f3582788a8f0537621e166bda4492 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Use SPDX license identifiersLucie Gérard2022-06-2222-836/+44
| | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: I8105424281eed871037fa6c463871ca8829876b5 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Make sure all private headers include at least one otherThiago Macieira2022-03-082-4/+4
| | | | | | | | | | See script in qtbase/util/includeprivate for the rules. Since these files are being touched anyway, I also ran the updatecopyright.pl script too. Change-Id: Ib056b47dde3341ef9a52ffff13ef677e471674b6 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Replace QT_BEGIN_LICENSE:LGPL3 headerKai Köhne2021-08-102-20/+26
| | | | | | | | | | Replace outdated LGPL3 with LGPL header in src, and GPL3-EXCEPT in tests. Task-number: QTBUG-90321 Pick-to: 6.2 Change-Id: I3f6491cb402a993a4341a983c780337e8658c256 Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
* Doc: Fix documentation warningsTopi Reinio2020-11-254-71/+3
| | | | | | | Pick-to: 6.0 6.0.0 Fixes: QTBUG-88842 Change-Id: Ie8ea1914c5e740c0c4bf25f4754a008aff6401cd Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Replace old Q_DECL statements with modern C++Allan Sandfeld Jensen2020-11-025-25/+25
| | | | | | | | Since we have long depended on C++11 now, all of these can go. Change-Id: I8808af2cd5ce192864c636b521dadd7de189563b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Fix a crash when node is added and destroyed immediatelySean Harmer2020-10-011-0/+5
| | | | | | | | | | | | | | When a node is added to the scene it is scheduled for a post-creation initialization. However, if the node is destroyed before this post-creation queue has been processed we will crash. This commit ensures that the node being deleted is removed from the post-creation queue. Usually the queue will be empty and so this should not add a performance penalty. Pick-to: 5.15 Change-Id: Ibe4289e1e54cdb145f8588f15dc4ad894e427582 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Add QNodePrivate::registerDestructionHelper for std::vector containersPaul Lemire2020-09-231-0/+10
| | | | | | | | | Ideally should support generic containers but clang seems to fail to generate the symbol on the mac. Change-Id: Ic1d6d815ab9aff60a97b3b0047228f55d7efe158 Pick-to: 5.15 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Use QList instead of QVector in implementation and docsJarek Kobus2020-07-097-11/+10
| | | | | | | | | Fix some const correctness. Use list-initialization. Task-number: QTBUG-84469 Change-Id: I9c56742581f48f89a3b02e4121fae414117c7a25 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Use QList instead of QVectorJarek Kobus2020-07-077-12/+12
| | | | | | Task-number: QTBUG-84469 Change-Id: Ic726ce85e01190dbc64426388fd454c54ae3c3e3 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Remove unused codeMike Krus2020-06-291-7/+0
| | | | | Change-Id: Ic4b2de774e1b3f3e94b4e560e003718d2c20adfd Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Add ; to Q_UNUSEDLars Schmertmann2020-06-242-11/+11
| | | | | | | | This is required to remove the ; from the macro with Qt 6. Task-number: QTBUG-82978 Change-Id: I2e126d0be8efa0aa89c4a91a681b549f38c8cec4 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* QNode: remove property tracking modePaul Lemire2020-06-173-89/+0
| | | | | | | This serves no purpose since the synchronous synching was put in place. Change-Id: I4509cc348168d614388f73a26f8420b26629ace6 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Fix compile warnings related to deprecations or unused variablesPaul Lemire2020-06-081-2/+2
| | | | | Change-Id: I3d8fa0940a22f40bec3809b302cc59a40a5c3c52 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Silence a few warningsMike Krus2020-05-191-1/+1
| | | | | | | | Missing override, unused variables and functions. Also fixes qHash API in QNodeID. Change-Id: Ieb223eb2464780f79050372040f418bb2360c8d5 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Fix build for Qt6Mike Krus2020-05-062-1/+1
| | | | | | | | | | | | | - updated dependencies, excluding qtgamepad for now - fixed issues with Q_PROPERTY not supporting forward declarations - fixed for changes in QtQuick private API - fixed for changes in QtOpenGLVersionFunctions API - fixed for removal of QT_OPENGL_ES* macros - fixed for changes in QtConcurrent API - fixed RHI based build Change-Id: I42ccd2f101b7f0a78e2860c6d551722bf6710a11 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Merge remote-tracking branch 'origin/5.15' into devMike Krus2020-04-271-8/+9
|\ | | | | | | Change-Id: Id669d5c1aab29965eac0dabd1cb497e908dac23e
| * Fix scene graph dumpMike Krus2020-03-201-8/+9
| | | | | | | | | | | | | | Might have QNodes "between" parents and child entities. Change-Id: Ie041508ec96c39b779bc75a6ad4d38c604e322e2 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Track dirty state on front end nodesMike Krus2020-04-074-1/+21
| | | | | | | | | | | | | | Nothing clears the state yet, will be up to the core aspect to do that. Change-Id: Ia3a5297a4b837b1d67545bd29ddce56666c520f3 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Add QBackendNode::syncFromFrontEnd to public APIMike Krus2020-02-273-0/+22
| | | | | | | | | | | | | | | | | | Removes need to per aspect overrides of QAbstractAspectPrivate::syncDirtyFrontEndNode which was required in Qt5 to preserve BC. Change-Id: Ib3b05af1c3ded1c985d35e4dec0fe203cdc907cb Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Remove deprecated classes and functionsPaul Lemire2020-02-1112-486/+24
|/ | | | | | | Mostly old messaging API Change-Id: I17eb2206b2ede56d2f7d36375d5e711d6149019f Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Fix deprecation handlingMike Krus2020-01-142-0/+6
| | | | | | Change-Id: If981333f7a3d78028d4f08c59867453d4192b955 Task-number: QTBUG-81058 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Add commands to dump frame graph and scene graphMike Krus2020-01-092-0/+51
| | | | | | | | prints to the console, also dump the list of paths in the frame graph to help understand render views. Change-Id: Ic4756e09545971b224a239fafc6667b0ca3d4572 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Deprecate message APIMike Krus2019-12-094-21/+34
| | | | | | | | Deprecates the message classes and the public APIs to send/receive them. (deprecates the constructors as deprecating classes breaks syncqt) Change-Id: I4908f15c3c5f1d63969a0f2e11f6ecb22e2e3748 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Fix compile warning (again)Mike Krus2019-11-151-1/+1
| | | | | Change-Id: Ic20d37a8bf875247c1af31fa4ded757564f953fc Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Merge remote-tracking branch 'origin/5.13' into 5.14Liang Qi2019-11-141-1/+1
|\ | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/core/nodes/qnode_p.h src/render/renderers/opengl/renderer/renderview.cpp Change-Id: I24483612f9f395e9ffc0bd6163bbfa092b13b7cb
| * QNode: stop using hash<node,connection> for bookkeeping5.13Paul Lemire2019-11-042-9/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is totally valid to have actually the same node used for 2 distinct connections (e.g setting 2 different node properties to the same node). With the hash, the second setter call would overwrite the first connection resulting in leaving a dangling connection around potentially resulting in crashes. Instead use a QVector<pair<node, connection>> and adjust code accordingly. Change-Id: I49870c409c3f7b629c8f1bdfcb8757a904db2490 Reviewed-by: Mike Krus <mike.krus@kdab.com> (cherry picked from commit 906f8a62f89a7ce2343a155e6db62616e66dc14b) Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Doc: Fix documentation warningsTopi Reinio2019-11-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Add (basic) documentation for Qt3DAnimation::QAnimationCallback. - Add missing namespace qualifiers for \class, \fn, \instantiates, \sa, and \property commands. - Remove linking to example file pages, as QDoc no longe treats them as linkable targets. - Fix function/QML method parameter documentation - Fix missing \qmlproperty types - Fix linking to QKeyEvent in QtGui. - Move Qt3DRender::Quick namespace documentation to where QDoc can see it. - Add enum documentation for Qt3DRender::QBlitFramebuffer::InterpolationMethod and Qt3DRender::QMesh::Status. - Other minor fixes This brings the current warning count to zero. Fixes: QTBUG-79822 Change-Id: I1154a7f9c34917a3f240e99da0e7a300be7d65a0 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* | Fix compile warningsMike Krus2019-11-081-1/+1
| | | | | | | | | | Change-Id: Iac18b5fddec79295dd9e4249fd16eb2f121fe771 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | QNode: stop using hash<node,connection> for bookkeepingv5.14.0-beta3Paul Lemire2019-11-042-9/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | It is totally valid to have actually the same node used for 2 distinct connections (e.g setting 2 different node properties to the same node). With the hash, the second setter call would overwrite the first connection resulting in leaving a dangling connection around potentially resulting in crashes. Instead use a QVector<pair<node, connection>> and adjust code accordingly. Change-Id: I49870c409c3f7b629c8f1bdfcb8757a904db2490 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* | QNode::updateNode: ensure postConstructorInit of node is calledPaul Lemire2019-10-281-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a QNode subclass is created doing Subclass(parent) with parent != nullptr QNodePrivate::_q_postContrustorInit is called through a queued invocation due to the fact that the QNode ctor is called before the subclass ctor is (and we need the class to be fully constructed to do proper initialization). When adding a QNode subclass created as described above, and immediately referencing it as a property of another QNode, we can end up in cases where the backend gets aware of the node being referenced in the relationship and tries to create its backend. Unfortunately due to the queued invocation of _q_postConstructorInit, the frontend node has yet to be fully initialized, resulting in the creation of the backend node to assert/crash. Therefore, when updateNode is called (whenever a subnode is referenced in a relationship) we now ensure that postConstructorInit gets (or has already been) called. Change-Id: Iea6e0b5a59c676f5db2946bec2f8c345accc32b0 Task-number: QTBUG-79350 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* | Remove use of node/components added/removed messagesMike Krus2019-10-046-22/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | Introduce mechanism to notify backend nodes of changes in relationship between nodes. If a component is added or removed from an entity, or if a node is added or removed from a property of another node, then just rely on the node being marked as dirty when syncing takes place. For nodes that do not support syncing, messages are delivered as before but allocated on the stack rather than the heap. Change-Id: I06affac77e42a9998d9c7f44e231c7724c52b320 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* | Clean up includesMike Krus2019-10-013-4/+3
| | | | | | | | | | | | | | | | | | Remove include statements for classes that are no longer used. Makes it easier to find remaining use cases that need addressed before complete removal in Qt 6. Change-Id: I60529ba1929ad64b162d3847d5df47cde2a60dad Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Update QCameraLens to use direct syncPaul Lemire2019-09-241-0/+3
| | | | | | | | | | Change-Id: I5b1af685c640c218d3720d5339b14dfc913e01c5 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Update mapping classes to use direct syncMike Krus2019-09-232-0/+6
| | | | | | | | | | | | | | QChannelMapping, QSkeletonMapping and QCallbackMapping updated. Change-Id: I10b78d86856f6ad01fbb313fdcbe9f87f6d926ac Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Process pending nodes needing _q_postConstructorInit at start of frameJim Albamont2019-09-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | NodePostConstructorInit::processNodes and QAspectManager::processFrame are both triggered by the event loop which means the frame can happen before the processNodes call. We want to ensure processNodes is called first so those pending nodes can be created during the processFrame call otherwise they will get deferred until the next frame. Created a test to show this and removed the now unnecessary double calls to processEvents in several other tests. Change-Id: I7a3f7b34be2858b4acdb9275804b458f9366ec67 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Update QEntity to use direct sync modeMike Krus2019-09-171-7/+1
| | | | | | | | | | | | Change-Id: I9fa6e67607baa66250789b8bf618f30bd45aad98 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> Reviewed-by: Mike Krus <mike.krus@kdab.com>
* | Use direct access to remove backend nodesPaul Lemire2019-09-161-5/+2
| | | | | | | | | | | | | | | | | | - Stop using messages - Remove QSceneObserverInterface - Ensure backend node creation/destruction is done at the right time Change-Id: I470825af344ab65bf05e93fc149b61d1b9eefc96 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Merge remote-tracking branch 'origin/5.13' into 5.14Qt Forward Merge Bot2019-09-111-2/+2
|\| | | | | | | Change-Id: I4e73060c1941773efcc568f010f5b073ebb10d4a
| * Fix a -Werror=shadow in EntityLiang Qi2019-08-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Triggered by gcc version 4.8.5 (SUSE Linux): src/core/nodes/qentity.h: In member function ‘QVector<T*> Qt3DCore::QEntity::componentsOfType() const’: src/core/nodes/qentity.h:69:32: error: declaration of ‘components’ shadows a member of 'this' [-Werror=shadow] const QComponentVector components = this->components(); ^ Change-Id: I02507b3ff75b0f21d958955f3ce9a8b01f471d05 Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
* | Use sync method when initializing new backend nodesMike Krus2019-08-295-19/+21
| | | | | | | | | | | | | | | | | | | | | | If the node type supports syncing, use that rather than the creation message. The message is still needed since that is passed to the instantiation functor (none of qt3d's classes appear to use anything but the node id, but can't be sure no other classes do, and can't add other virtual method without breaking BC). Change-Id: Id99f448070b8722a7809b968798772c9eb3c8397 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* | Do direct notification of backend nodeswip/refactorMike Krus2019-08-285-59/+39
|/ | | | | | | | | | | | | | | | | Since aspect manager is now on main thread, we can directly update backend nodes safely. Track nodes which have changed properties and notify the backend nodes as part of the frame loop. This avoid allocating and delivering many change messages. To follow: - implement on all nodes - look at backend to frontend syncing - figure out what to do with non property messages (components added/removed, commands, ...) Change-Id: Ia0c442b0528e728c4324d168200bae021bc29266 Reviewed-by: Mike Krus <mike.krus@kdab.com> Reviewed-by: Paul Lemire <paul.lemire@kdab.com>