QLM UI Connections with property eulerRotation.x problem
-
I study for Quick3D animation .... a try as first step to create a swipe app with a VIew3D inside a Rectangle on a page, using a Teapot example so my qml.ui code
/* initial part of page code not interesting here*/ Node { id: standAloneScene //! [rootnode] DirectionalLight { ambientColor: Qt.rgba(1.0, 1.0, 1.0, 1.0) } Model { id: startingRotation source: "#Cube" y: -104 scale: Qt.vector3d(3, 3, 0.1) eulerRotation.x: -90 materials: [ DefaultMaterial { diffuseColor: Qt.rgba(0.8, 0.8, 0.8, 1.0) } ] } Model { id: startModel source: "teapot.mesh" y: -100 scale: Qt.vector3d(50, 50, 50) materials: [ PrincipledMaterial { baseColor: "#41cd52" metalness: 0.75 roughness: 0.1 specularAmount: 1.0 indexOfRefraction: 2.5 opacity: 1.0 } ] PropertyAnimation on eulerRotation.y { id: startAnimation loops: Animation.Infinite duration: 5000 to: 0 from: -360 } } //! [cameras start] // The predefined cameras. They have to be part of the scene, i.e. inside the root node. // Animated perspective camera Node { id: nodeOne PerspectiveCamera { id: cameraPerspectiveOne z: 600 } PropertyAnimation on eulerRotation.x { id: xAnimation loops: Animation.Infinite duration: 5000 to: -360 from: 0 } } // Stationary perspective camera PerspectiveCamera { id: cameraPerspectiveTwo z: 600 } //! [cameras start] // Second animated perspective camera Node { id: nodeTwo PerspectiveCamera { id: cameraPerspectiveThree x: 500 eulerRotation.y: 90 } PropertyAnimation on eulerRotation.y { id: yAnimation loops: Animation.Infinite duration: 5000 to: 0 from: -360 } } // Stationary orthographic camera viewing from the top OrthographicCamera { id: cameraOrthographicTop y: 600 eulerRotation.x: -90 } // Stationary orthographic camera viewing from the front OrthographicCamera { id: cameraOrthographicFront z: 600 } //! [cameras end] // Stationary orthographic camera viewing from left OrthographicCamera { id: cameraOrthographicLeft x: -600 eulerRotation.y: -90 } } //! [cameras end] Rectangle { id: animation x: 70 y: 50 width: 500 height: 320 color: "#00000000" border.color: "#25bb5c" anchors.top: parent.top anchors.topMargin: 47 View3D { id: topLeftView anchors.fill: parent importScene: standAloneScene camera: cameraPerspectiveOne environment: SceneEnvironment { clearColor: "skyblue" backgroundMode: SceneEnvironment.Color } Row { id: controlsContainer width: 200 height: 20 anchors.left: parent.left anchors.top: parent.top anchors.leftMargin: 0 anchors.topMargin: 0 spacing: 10 padding: 10 //! [buttons] RoundButton { id: camera1 text: "Camera 1" font.pointSize: 7 highlighted: topLeftView.camera == cameraPerspectiveOne } //! [buttons] RoundButton { id: camera2 text: "Camera 2" font.pointSize: 7 highlighted: topLeftView.camera == cameraPerspectiveTwo } RoundButton { id: camera3 text: "Camera 3" font.pointSize: 7 highlighted: topLeftView.camera == cameraPerspectiveThree } } } } /* end part of page code not interesting here*/
as you can see I modify the exemple just for try the View3D quick spaces .... so I have my qml file ...
ApplicationWindow { id: window visible: true width: 640 height: 480 title: qsTr("my test app") SwipeView { id: swipeView anchors.fill: parent currentIndex: tabBar.currentIndex CommandForm { camera1.onClicked: { topLeftView.camera = cameraPerspectiveOne } nodeOne.onSceneTransformChanged: { startAnimation.start() } camera2.onClicked: { topLeftView.camera = cameraPerspectiveTwo yAnimation.running = true } camera3.onClicked: { topLeftView.camera = cameraPerspectiveThree xAnimation.running = true } } ControlProgramForm {} /* than other parth not interesting here */
But I have find no way to start from qml file instead of qml.ui file these java command: PropertyAnimation on eulerRotation.y { /* some code here*/}
Of course is obvius that on qml.ui file these java command is warming "behaviour type command not supported" .... but not find some property alias function or signal that can perform these java call outside of qml.ui file and inside my main.qml that is the right place to do these. I have try some logical call from main.qml without success (connections for example).... any how I can change static perspective of Teapot view if leave "on eulerRotation.n" and can see dinamic change (with right infinite rotation) if use original code PropertyAnimation on eulerRotation.y { /* some code here*/}.
Seems I'm not able to start infinyte loop animation from property eulerRotation.x or usinf call "onEulerRotationChanged".
I would leave that warming at all and write the right code and not the wrong one.
thanks for any suggestion
-
I study for Quick3D animation .... a try as first step to create a swipe app with a VIew3D inside a Rectangle on a page, using a Teapot example so my qml.ui code
/* initial part of page code not interesting here*/ Node { id: standAloneScene //! [rootnode] DirectionalLight { ambientColor: Qt.rgba(1.0, 1.0, 1.0, 1.0) } Model { id: startingRotation source: "#Cube" y: -104 scale: Qt.vector3d(3, 3, 0.1) eulerRotation.x: -90 materials: [ DefaultMaterial { diffuseColor: Qt.rgba(0.8, 0.8, 0.8, 1.0) } ] } Model { id: startModel source: "teapot.mesh" y: -100 scale: Qt.vector3d(50, 50, 50) materials: [ PrincipledMaterial { baseColor: "#41cd52" metalness: 0.75 roughness: 0.1 specularAmount: 1.0 indexOfRefraction: 2.5 opacity: 1.0 } ] PropertyAnimation on eulerRotation.y { id: startAnimation loops: Animation.Infinite duration: 5000 to: 0 from: -360 } } //! [cameras start] // The predefined cameras. They have to be part of the scene, i.e. inside the root node. // Animated perspective camera Node { id: nodeOne PerspectiveCamera { id: cameraPerspectiveOne z: 600 } PropertyAnimation on eulerRotation.x { id: xAnimation loops: Animation.Infinite duration: 5000 to: -360 from: 0 } } // Stationary perspective camera PerspectiveCamera { id: cameraPerspectiveTwo z: 600 } //! [cameras start] // Second animated perspective camera Node { id: nodeTwo PerspectiveCamera { id: cameraPerspectiveThree x: 500 eulerRotation.y: 90 } PropertyAnimation on eulerRotation.y { id: yAnimation loops: Animation.Infinite duration: 5000 to: 0 from: -360 } } // Stationary orthographic camera viewing from the top OrthographicCamera { id: cameraOrthographicTop y: 600 eulerRotation.x: -90 } // Stationary orthographic camera viewing from the front OrthographicCamera { id: cameraOrthographicFront z: 600 } //! [cameras end] // Stationary orthographic camera viewing from left OrthographicCamera { id: cameraOrthographicLeft x: -600 eulerRotation.y: -90 } } //! [cameras end] Rectangle { id: animation x: 70 y: 50 width: 500 height: 320 color: "#00000000" border.color: "#25bb5c" anchors.top: parent.top anchors.topMargin: 47 View3D { id: topLeftView anchors.fill: parent importScene: standAloneScene camera: cameraPerspectiveOne environment: SceneEnvironment { clearColor: "skyblue" backgroundMode: SceneEnvironment.Color } Row { id: controlsContainer width: 200 height: 20 anchors.left: parent.left anchors.top: parent.top anchors.leftMargin: 0 anchors.topMargin: 0 spacing: 10 padding: 10 //! [buttons] RoundButton { id: camera1 text: "Camera 1" font.pointSize: 7 highlighted: topLeftView.camera == cameraPerspectiveOne } //! [buttons] RoundButton { id: camera2 text: "Camera 2" font.pointSize: 7 highlighted: topLeftView.camera == cameraPerspectiveTwo } RoundButton { id: camera3 text: "Camera 3" font.pointSize: 7 highlighted: topLeftView.camera == cameraPerspectiveThree } } } } /* end part of page code not interesting here*/
as you can see I modify the exemple just for try the View3D quick spaces .... so I have my qml file ...
ApplicationWindow { id: window visible: true width: 640 height: 480 title: qsTr("my test app") SwipeView { id: swipeView anchors.fill: parent currentIndex: tabBar.currentIndex CommandForm { camera1.onClicked: { topLeftView.camera = cameraPerspectiveOne } nodeOne.onSceneTransformChanged: { startAnimation.start() } camera2.onClicked: { topLeftView.camera = cameraPerspectiveTwo yAnimation.running = true } camera3.onClicked: { topLeftView.camera = cameraPerspectiveThree xAnimation.running = true } } ControlProgramForm {} /* than other parth not interesting here */
But I have find no way to start from qml file instead of qml.ui file these java command: PropertyAnimation on eulerRotation.y { /* some code here*/}
Of course is obvius that on qml.ui file these java command is warming "behaviour type command not supported" .... but not find some property alias function or signal that can perform these java call outside of qml.ui file and inside my main.qml that is the right place to do these. I have try some logical call from main.qml without success (connections for example).... any how I can change static perspective of Teapot view if leave "on eulerRotation.n" and can see dinamic change (with right infinite rotation) if use original code PropertyAnimation on eulerRotation.y { /* some code here*/}.
Seems I'm not able to start infinyte loop animation from property eulerRotation.x or usinf call "onEulerRotationChanged".
I would leave that warming at all and write the right code and not the wrong one.
thanks for any suggestion