Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Qt3D: Accessing QAspectEngine with Scene3D

Qt3D: Accessing QAspectEngine with Scene3D

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 416 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • PhilippEngelhardP Offline
    PhilippEngelhardP Offline
    PhilippEngelhard
    wrote on last edited by PhilippEngelhard
    #1

    I followed the "Writing a Custom Qt 3D Aspect" blog entry from https://www.kdab.com/writing-custom-qt-3d-aspect/. And the CustomAspect works fine.
    In that example a Qt3DQuickWindow is used. Now I want to use my custom aspect in my own project which is a QtQuick app, that uses a ApplicationWindow with a Scene3D embedded to display the Qt3D content.

    My question is: How do I access the QAspectEngine in such a case, so I can register my custom aspect?

    PhilippEngelhardP 1 Reply Last reply
    0
    • PhilippEngelhardP PhilippEngelhard

      I followed the "Writing a Custom Qt 3D Aspect" blog entry from https://www.kdab.com/writing-custom-qt-3d-aspect/. And the CustomAspect works fine.
      In that example a Qt3DQuickWindow is used. Now I want to use my custom aspect in my own project which is a QtQuick app, that uses a ApplicationWindow with a Scene3D embedded to display the Qt3D content.

      My question is: How do I access the QAspectEngine in such a case, so I can register my custom aspect?

      PhilippEngelhardP Offline
      PhilippEngelhardP Offline
      PhilippEngelhard
      wrote on last edited by
      #2

      I found no way to access the QAspectEngine directly, but you can register custom aspects like this:

      QT3D_REGISTER_NAMESPACED_ASPECT("customAspect", QT_PREPEND_NAMESPACE(mynamespace), CustomAspect)
      

      Then you can use this aspect in Scene3D:

      Scene3D {
          id: sceneView
          aspects: ["input", "logic", "customAspect"]
      }
      

      I had to create an unused instance of the custom aspect in my C++ code, to make it work. I guess because of the registerBackendType call in the constructor.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved