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. How to change diffuse map of cylinder in studio3D of qml?
Forum Updated to NodeBB v4.3 + New Features

How to change diffuse map of cylinder in studio3D of qml?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
14 Posts 5 Posters 3.2k Views 4 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.
  • small_birdS Offline
    small_birdS Offline
    small_bird
    wrote on last edited by small_bird
    #1
     Studio3D {
            id: studio3D
            anchors.fill: parent;
            Button{
                anchors.horizontalCenter: parent.horizontalCenter;
                anchors.top: parent.top;
                onClicked: {
                    textureElement.setAttribute("diffusemap",imageToBeReplaced);
                }
            }
    
            Image {
                id: imageToBeReplaced;
                source: "qrc:/../../Desktop/paragramPicture.jpg";
            }
            Presentation {
                id:presentation;
                source: "qrc:/../../Desktop/abcde.uip"
                SceneElement {
                    id: scene
                    elementPath: "Scene"
                }
                Element {
                    id: textureElement;
                    elementPath: "Scene.Layer.Cylinder.Material";
                }
            }
            ViewerSettings {
                scaleMode: ViewerSettings.ScaleModeFill
                showRenderStats: false
            }
            onRunningChanged: {
                console.log("Presentation ready!");
            }
        }
    }
    

    The code above can not change the diffuse map of the cylinder, why? Could anyone help me? Thanks in advance!
    0_1509629495046_sdfdsfssdfdsfds.PNG
    The documnet indicates that the diffusemap can be changed using image element.

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Are you sure your QRC paths are correct? Please check (for example using Image component), it is highly unusual for QRC path to contain cdup chars ("../"). Also, if you load QML from QRC, then there is no need to specify "qrc:/" in your paths, because QML engine automatically assumes all paths to be from QRC.

      (Z(:^

      small_birdS 1 Reply Last reply
      1
      • sierdzioS sierdzio

        Are you sure your QRC paths are correct? Please check (for example using Image component), it is highly unusual for QRC path to contain cdup chars ("../"). Also, if you load QML from QRC, then there is no need to specify "qrc:/" in your paths, because QML engine automatically assumes all paths to be from QRC.

        small_birdS Offline
        small_birdS Offline
        small_bird
        wrote on last edited by
        #3

        @sierdzio Yes, I just copy the path as the picture shows:

        0_1509949230525_qrc路径保存.png

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          You seem to have an unusual setup from the picture you posted. How does your project look on your hard drive ?

          In any case, as @sierdzio suggested, your paths look wrong from a QRC point of view. Unless something has changed, the files you put in a resource should be at the same level or lower than the .qrc file therefore, the paths you use in your application should start from there.

          e.g.:

          -- myfile.qrc
          -- images \
          ----myimage.jpeg

          This would end up with qrc:/images/myimage.jpeg.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          small_birdS 1 Reply Last reply
          0
          • SGaistS SGaist

            Hi,

            You seem to have an unusual setup from the picture you posted. How does your project look on your hard drive ?

            In any case, as @sierdzio suggested, your paths look wrong from a QRC point of view. Unless something has changed, the files you put in a resource should be at the same level or lower than the .qrc file therefore, the paths you use in your application should start from there.

            e.g.:

            -- myfile.qrc
            -- images \
            ----myimage.jpeg

            This would end up with qrc:/images/myimage.jpeg.

            small_birdS Offline
            small_birdS Offline
            small_bird
            wrote on last edited by
            #5

            @SGaist No, actually, I have tried the following code:

             Image {
                        id: imageToBeReplaced;
                        source: "qrc:/../../Desktop/paragramPicture.jpg";
                    }
            

            The image could display normally.

            1 Reply Last reply
            0
            • F Offline
              F Offline
              filipdns
              wrote on last edited by
              #6

              hello, I try to do something like that but my problem is the mouse event is detected but event don't do the onclick action, may be your problem is there and not from imagechange, I don't found the solution yet

              small_birdS 1 Reply Last reply
              0
              • F filipdns

                hello, I try to do something like that but my problem is the mouse event is detected but event don't do the onclick action, may be your problem is there and not from imagechange, I don't found the solution yet

                small_birdS Offline
                small_birdS Offline
                small_bird
                wrote on last edited by
                #7

                @filipdns No, my mouse event is detected, I use consol.log(..) function to show something.

                1 Reply Last reply
                0
                • F Offline
                  F Offline
                  filipdns
                  wrote on last edited by
                  #8

                  yes it's what I say, the event is detected me too but the action requested is not do

                  small_birdS 1 Reply Last reply
                  0
                  • F filipdns

                    yes it's what I say, the event is detected me too but the action requested is not do

                    small_birdS Offline
                    small_birdS Offline
                    small_bird
                    wrote on last edited by
                    #9

                    @filipdns yes, other request can be processed, opacity etc. Is the function wrong?

                    small_birdS 1 Reply Last reply
                    0
                    • small_birdS small_bird

                      @filipdns yes, other request can be processed, opacity etc. Is the function wrong?

                      small_birdS Offline
                      small_birdS Offline
                      small_bird
                      wrote on last edited by
                      #10

                      @small_bird Could anyone help me? The official staff?

                      mrjjM 1 Reply Last reply
                      0
                      • small_birdS small_bird

                        @small_bird Could anyone help me? The official staff?

                        mrjjM Offline
                        mrjjM Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        @small_bird said in How to change diffuse map of cylinder in studio3D of qml?:

                        the official staff?

                        This is a user forum. There is no official staff here :)

                        small_birdS 1 Reply Last reply
                        0
                        • mrjjM mrjj

                          @small_bird said in How to change diffuse map of cylinder in studio3D of qml?:

                          the official staff?

                          This is a user forum. There is no official staff here :)

                          small_birdS Offline
                          small_birdS Offline
                          small_bird
                          wrote on last edited by
                          #12

                          @mrjj yes, hope the official staff can help us,as it is the newest technology of qt 3d studio

                          mrjjM 1 Reply Last reply
                          0
                          • small_birdS small_bird

                            @mrjj yes, hope the official staff can help us,as it is the newest technology of qt 3d studio

                            mrjjM Offline
                            mrjjM Offline
                            mrjj
                            Lifetime Qt Champion
                            wrote on last edited by
                            #13

                            @small_bird
                            Well the official staff helps license holders.
                            Forum is for all us free users.

                            Since its brand new tech, not many have tried it yet so be prepared
                            to give it some time.

                            small_birdS 1 Reply Last reply
                            0
                            • mrjjM mrjj

                              @small_bird
                              Well the official staff helps license holders.
                              Forum is for all us free users.

                              Since its brand new tech, not many have tried it yet so be prepared
                              to give it some time.

                              small_birdS Offline
                              small_birdS Offline
                              small_bird
                              wrote on last edited by
                              #14

                              @mrjj En, take your advice! Thanks a lot!

                              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