Unsolved How to change diffuse map of cylinder in studio3D of qml?
-
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!
The documnet indicates that the diffusemap can be changed using image element. -
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.
-
@sierdzio Yes, I just copy the path as the picture shows:
-
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.jpegThis would end up with
qrc:/images/myimage.jpeg
. -
@SGaist No, actually, I have tried the following code:
Image { id: imageToBeReplaced; source: "qrc:/../../Desktop/paragramPicture.jpg"; }
The image could display normally.
-
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
-
@filipdns No, my mouse event is detected, I use consol.log(..) function to show something.
-
yes it's what I say, the event is detected me too but the action requested is not do
-
@filipdns yes, other request can be processed, opacity etc. Is the function wrong?
-
@small_bird Could anyone help me? The official staff?
-
@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 :)
-
@mrjj yes, hope the official staff can help us,as it is the newest technology of qt 3d studio
-
@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. -
@mrjj En, take your advice! Thanks a lot!