Hi all,

For a project I'm working on I need to create 3D objects whose geometry depends 
on data coming from an external input line:
so, to test the whole mechanism, I'm trying to use Qt3D to spawn objects with 
custom geometry inside an event triggered by a timer.
I tried using both Qt v5.6.1 and Qt v5.7.0 and I got different (and, in my 
opinion, odd) behaviours.

Here is my QML Timer code:

Timer
{
    id: spawnTrigger

    interval: 1000
    running: true
    repeat: true
    triggeredOnStart: true

    onTriggered:
    {
        var randomX = Math.random() * 20 - 10;
        SceneManager.spawnCustomGeometry(sceneRoot, Qt.vector3d(randomX, 0, 0));
    }

    //This works fine.
    //Component.onCompleted:
    //{
    //    var randomX = Math.random() * 20 - 10;
    //    SceneManager.spawnCustomGeometry(sceneRoot, Qt.vector3d(randomX, 0, 
0));
    //}
}

The 'SceneManager.spawnCustomGeometry()' function uses the 'createObject()' 
function to instantiate the custom geometry described inside a QML file,
which is loaded via Qt.createComponent().

The behaviour I get is the following:

- Using Qt v5.6.1:
    - If the 'triggeredOnStart' property is set to false, the custom geometry 
does not show up and the application continues running.
    - If the 'triggeredOnStart' property is set to true, the custom geometry 
shows up just once and the application continues running.

- Using Qt v5.7.0:
    - If the 'triggeredOnStart' property is set to false, the custom geometry 
does not show up and the application crashes.
    - If the 'triggeredOnStart' property is set to true, the custom geometry 
shows up just once and the application crashes.

With Qt v5.7.0, in both cases the call stack is the following (so far it has 
been the same for every crash):

- Call stack on Windows 7 x64 OS with MinGW32:
    1  QMetaObject::inherits                            qmetaobject.cpp    339 
0x8d12b1
    2  Qt3DRender::Render::Entity::sceneChangeEvent     entity.cpp         213 
0x3bf9bdf9
    3  Qt3DCore::QBackendNodePrivate::sceneChangeEvent  qbackendnode.cpp   82  
0x380cfa1b
    4  Qt3DCore::QChangeArbiter::distributeQueueChanges qchangearbiter.cpp 132 
0x380c1f12
    5  Qt3DCore::QChangeArbiter::syncChanges            qchangearbiter.cpp 179 
0x380c21c0
    6  Qt3DCore::QAspectManager::exec                   qaspectmanager.cpp 273 
0x380c7e07
    7  Qt3DCore::QAspectThread::run                     qaspectthread.cpp  85  
0x380c8772
    8  QThreadPrivate::start(void *) *4                 qthread_win.cpp    391 
0x78b777
    9  msvcrt!_itow_s                                                          
0x76541287
    10 msvcrt!_endthreadex                                                     
0x76541328
    11 KERNEL32!BaseThreadInitThunk                                            
0x7673337a
    12 ntdll!RtlInitializeExceptionChain                                       
0x76ef92e2
    13 ntdll!RtlInitializeExceptionChain                                       
0x76ef92b5
    14 ??

- Call stack on Ubuntu Linux 14.04 x64:
    1 QMetaObject::inherits(QMetaObject const *) const                          
                                   0x7ffff65a8045
    2 ??                                                                        
                                   0x7fffde2d0d77
    3 
Qt3DCore::QChangeArbiter::distributeQueueChanges(std::vector<QSharedPointer<Qt3DCore::QSceneChange>>
 *)      0x7fffddb923d8
    4 Qt3DCore::QChangeArbiter::syncChanges()                                   
                                   0x7fffddb9255f
    5 Qt3DCore::QAspectManager::exec()                                          
                                   0x7fffddb9e6e6
    6 ??                                                                        
                                   0x7fffddb9fa92
    7 ??                                                                        
                                   0x7ffff63d95f9
    8 start_thread                                                              
              pthread_create.c 312 0x7ffff54db184
    9 clone                                                                     
              clone.S          111 0x7ffff5b4937d

By the log messages I put inside the 'SceneManager.spawnCustomGeometry()' 
function, I can tell for sure that the call to 'createObject()' is being 
performed every time the timer event is triggered (as expected).

>From the results I got, it seems to me that no custom geometry can be 
>instantiated once the parent object creation has been fully completed.
Am I right or did I overlook something important?

I have attached the test applications source code to this message, in case 
anyone needs it.

Any help would be greatly appreciated!

Best regards,
Carlo


________________________________

VISITA IL NOSTRO NUOVO SITO WEB! - VISIT OUR NEW WEB SITE! 
www.magnetimarelli.com

Confidential Notice: This message - including its attachments - may contain 
proprietary, confidential and/or legally protected information and is intended 
solely for the use of the designated addressee(s) above. If you are not the 
intended recipient be aware that any downloading, copying, disclosure, 
distribution or use of the contents of the above information is strictly 
prohibited.
If you have received this communication by mistake, please forward the message 
back to the sender at the email address above, delete the message from all 
mailboxes and any other electronic storage medium and destroy all copies.
Disclaimer Notice: Internet communications cannot be guaranteed to be safe or 
error-free. Therefore we do not assure that this message is complete or 
accurate and we do not accept liability for any errors or omissions in the 
contents of this message.

Attachment: Test_Qt.7z
Description: Test_Qt.7z

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to