diff options
author | Jere Tuliniemi <jere.tuliniemi@qt.io> | 2017-11-22 12:20:33 +0200 |
---|---|---|
committer | Jere Tuliniemi <jere.tuliniemi@qt.io> | 2017-11-22 10:49:00 +0000 |
commit | a32aaf7d3a14220f5d98f2fb4472f1019fc46257 (patch) | |
tree | 0b432f0bbbe365094c3d6f67de59eec72a01bbeb /examples | |
parent | d5ac7408b1f23eb7a87f177e6d374ca1c2590e18 (diff) |
Remove QML behavior example
Change-Id: I159df71d92dfc0a2d4609ef05b54693586239fa9
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/studio3d/qmlbehaviors/qmlbehaviors.uia | 16 | ||||
-rw-r--r-- | examples/studio3d/qmlbehaviors/qmlbehaviors.uip | 93 | ||||
-rw-r--r-- | examples/studio3d/qmlbehaviors/scripts/Billboard.qml | 182 | ||||
-rw-r--r-- | examples/studio3d/qmlbehaviors/scripts/CatchEvents.qml | 66 | ||||
-rw-r--r-- | examples/studio3d/qmlbehaviors/scripts/DateTime.qml | 60 | ||||
-rw-r--r-- | examples/studio3d/qmlbehaviors/scripts/Keyboard.qml | 199 | ||||
-rw-r--r-- | examples/studio3d/qmlbehaviors/scripts/SineWave.qml | 124 | ||||
-rw-r--r-- | examples/studio3d/qmlbehaviors/scripts/Toggle.qml | 117 |
8 files changed, 0 insertions, 857 deletions
diff --git a/examples/studio3d/qmlbehaviors/qmlbehaviors.uia b/examples/studio3d/qmlbehaviors/qmlbehaviors.uia deleted file mode 100644 index 1f0bb850..00000000 --- a/examples/studio3d/qmlbehaviors/qmlbehaviors.uia +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<application xmlns="http://qt.io/qt3dstudio/uia"> - <assets initial="qmlbehaviors"> - <presentation id="qmlbehaviors" src="qmlbehaviors.uip"/> - </assets> - - <statemachine ref="#logic"> - <visual-states> - <state ref="Initial"> - <enter> - <goto-slide element="main:Scene" rel="next"/> - </enter> - </state> - </visual-states> - </statemachine> -</application> diff --git a/examples/studio3d/qmlbehaviors/qmlbehaviors.uip b/examples/studio3d/qmlbehaviors/qmlbehaviors.uip deleted file mode 100644 index 2653fc03..00000000 --- a/examples/studio3d/qmlbehaviors/qmlbehaviors.uip +++ /dev/null @@ -1,93 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<UIP version="3" > - <Project > - <ProjectSettings author="" company="" presentationWidth="800" presentationHeight="480" maintainAspect="False" /> - <Classes > - <Behavior id="Billboard" name="Billboard" sourcepath="scripts\Billboard.qml" /> - <Behavior id="CatchEvents" name="CatchEvents" sourcepath="scripts\CatchEvents.qml" /> - <Behavior id="Keyboard" name="Keyboard" sourcepath="scripts\Keyboard.qml" /> - <Behavior id="SineWave" name="SineWave" sourcepath="scripts\SineWave.qml" /> - <Behavior id="Toggle" name="Toggle" sourcepath="scripts\Toggle.qml" /> - </Classes> - <Graph > - <Scene id="Scene" > - <Layer id="Layer" > - <Camera id="Camera" > - <Behavior id="Billboard_002" class="#Billboard" /> - </Camera> - <Light id="Light" /> - <Model id="Cube2" > - <Material id="Material_001" /> - <Behavior id="SineWave_001" class="#SineWave" /> - <Model id="Cube" > - <Material id="Material" /> - <Behavior id="Billboard_001" class="#Billboard" /> - </Model> - </Model> - <Model id="Sphere" > - <Material id="Material_002" /> - </Model> - <Model id="Rectangle" > - <Material id="Material_003" /> - <Behavior id="Toggle_001" class="#Toggle" /> - </Model> - </Layer> - <Behavior id="CatchEvents_001" class="#CatchEvents" /> - <Behavior id="Keyboard_001" class="#Keyboard" /> - </Scene> - </Graph> - <Logic > - <State name="Master Slide" component="#Scene" > - <Add ref="#Layer" /> - <Add ref="#Camera" /> - <Add ref="#Light" lightambient="0.333333 0 0" lighttype="Directional" rotation="29 36 0" /> - <State id="Scene-Slide1" name="Slide1" playmode="PingPong" > - <Add ref="#Billboard_002" name="Billboard" renderCamera="#Cube2" /> - <Add ref="#Cube2" name="Cube2" position="-410.66 -269.615 131.722" sourcepath="#Cube" > - <AnimationTrack property="position.x" type="EaseInOut" >0 -410.66 100 100 3.706 514.024 100 100 6.958 -17.5718 100 100 10 -531.565 100 100</AnimationTrack> - <AnimationTrack property="position.y" type="EaseInOut" >0 -246.021 100 100 3.706 -141.615 100 100 6.958 394.782 100 100 10 -154.656 100 100</AnimationTrack> - <AnimationTrack property="position.z" type="EaseInOut" >0 131.722 100 100 3.706 131.722 100 100 6.958 131.722 100 100 10 131.722 100 100</AnimationTrack> - <AnimationTrack property="rotation.x" type="EaseInOut" /> - <AnimationTrack property="rotation.y" type="EaseInOut" /> - <AnimationTrack property="rotation.z" type="EaseInOut" /> - <Action id="Cube2-Action" eyeball="True" triggerObject="#Cube2" event="onPressureDown" targetObject="#SineWave_001" handler="toggle" /> - </Add> - <Add ref="#Material_001" /> - <Add ref="#SineWave_001" name="SineWave" ampOffset="0" amplitude="45" /> - <Add ref="#Cube" name="Cube" position="-531.565 -276.656 131.722" scale="1 1 1" sourcepath="#Cube" > - <AnimationTrack property="position.x" type="EaseInOut" >0 0 100 100</AnimationTrack> - <AnimationTrack property="position.y" type="EaseInOut" >0 113.361 100 100</AnimationTrack> - <AnimationTrack property="position.z" type="EaseInOut" >0 0 100 100</AnimationTrack> - </Add> - <Add ref="#Material" name="Material" /> - <Add ref="#Billboard_001" name="Billboard" billboardType="Face Camera" renderCamera="#Camera" startImmediately="True" yOnly="False" /> - <Add ref="#Sphere" name="Sphere" position="191.969 4.33009 0" sourcepath="#Sphere" /> - <Add ref="#Material_002" /> - <Add ref="#Rectangle" name="Rectangle" position="56.2916 1.44336 0" sourcepath="#Rectangle" /> - <Add ref="#Material_003" /> - <Add ref="#Toggle_001" name="Toggle" > - <Action id="Toggle-Action" eyeball="True" triggerObject="#Toggle_001" event="onToggle" targetObject="#Material_002" handler="Set Property" > - <HandlerArgument name="Property Name" type="String" argtype="Property" value="diffuse" /> - <HandlerArgument name="Property Value" type="Float3" argtype="Dependent" value="0 0 1" /> - </Action> - <Action id="Toggle-Action_001" eyeball="True" triggerObject="#Toggle_001" event="onUntoggle" targetObject="#Material_002" handler="Set Property" > - <HandlerArgument name="Property Name" type="String" argtype="Property" value="diffuse" /> - <HandlerArgument name="Property Value" type="Float3" argtype="Dependent" value="1 1 1" /> - </Action> - </Add> - <Add ref="#CatchEvents_001" name="CatchEvents" /> - <Add ref="#Keyboard_001" name="Keyboard" > - <Action id="Keyboard-Action" eyeball="True" triggerObject="#Keyboard_001" event="onLEFTDown" targetObject="#Sphere" handler="Set Property" > - <HandlerArgument name="Property Name" type="String" argtype="Property" value="scale" /> - <HandlerArgument name="Property Value" type="Float3" argtype="Dependent" value="2 2 2" /> - </Action> - <Action id="Keyboard-Action_001" eyeball="True" triggerObject="#Keyboard_001" event="onLEFTUp" targetObject="#Sphere" handler="Set Property" > - <HandlerArgument name="Property Name" type="String" argtype="Property" value="scale" /> - <HandlerArgument name="Property Value" type="Float3" argtype="Dependent" value="1 1 1" /> - </Action> - </Add> - </State> - </State> - </Logic> - </Project> -</UIP> diff --git a/examples/studio3d/qmlbehaviors/scripts/Billboard.qml b/examples/studio3d/qmlbehaviors/scripts/Billboard.qml deleted file mode 100644 index 7b97dec5..00000000 --- a/examples/studio3d/qmlbehaviors/scripts/Billboard.qml +++ /dev/null @@ -1,182 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*[[ - <Property name="renderCamera" formalName="Render Camera" type="ObjectRef" default="Scene.Layer.Camera" description="The camera which will be rendering the scene." /> - <Property name="billboardType" formalName="Billboard Type" type="StringList" default="Face Camera" list="Face Camera,Match Camera Rotation" description="Always face the camera, or only match its rotation." /> - <Property name="yOnly" formalName="Y-Axis Only?" type="Boolean" default="False" description="Only rotate the object about the global y-axis?" /> - <Property name="startImmediately" formalName="Start Immediately?" type="Boolean" default="True" publishLevel="Advanced" description="Start immediately, or wait for the Enable action to be called?" /> - - <Handler name="start" formalName="Start" category="Billboard" description="Begin keeping the parent object billboarded." /> - <Handler name="stop" formalName="Stop" category="Billboard" description="Stop rotating the parent object." /> -]]*/ - -import QtStudio3D.Behavior 1.0 - -Qt3DSBehavior { - //External: - property string renderCamera - property string billboardType - property bool yOnly - property bool startImmediately - //Internal: - property bool running: false - property var updateFunction - - function start() { - running = true; - } - - function stop() { - running = false; - } - - onInitialize: { - if (billboardType === "Face Camera") { - if (!yOnly) - updateFunction = faceCamera; - else - updateFunction = faceCameraGlobalY; - } - else { - if (!yOnly) - updateFunction = matchRotation; - else - updateFunction = matchRotationGlobalY; - } - - if (startImmediately) - start(); - } - - onUpdate: { - if (!running) - return; - - updateFunction(); - } - - function faceCamera() { - var cameraTransform = calculateGlobalTransform(renderCamera); - var cameraSpot = cameraTransform.row(3).toVector3d(); - var myTransform = calculateGlobalTransform(); - var mySpot = myTransform.row(3).toVector3d(); - - var matrix = calculateGlobalTransform(getParent()).inverted(); - matrix.m41 = 0; - matrix.m42 = 0; - matrix.m43 = 0; - - var rotateRay = cameraSpot - .minus(mySpot) - .times(matrix); - - var rotation = lookAt(rotateRay); - setAttributeVector("rotation", rotation); - } - - function faceCameraGlobalY() { - var cameraTransform = calculateGlobalTransform(renderCamera); - var cameraSpot = cameraTransform.row(3).toVector3d(); - var myTransform = calculateGlobalTransform(); - var mySpot = myTransform.row(3).toVector3d(); - - var rotateRay = cameraSpot.minus(mySpot); - - var rotation = getAttributeVector("rotation"); - rotation.y = Math.atan2(rotateRay.x, rotateRay.z); - setAttributeVector("rotation", rotation); - } - - function matchRotation() { - var cameraTransform = calculateGlobalTransform(renderCamera); - var cameraSpot = cameraTransform.row(3).toVector3d(); - - var matrix = calculateGlobalTransform(getParent()).inverted(); - matrix.m41 = 0; - matrix.m42 = 0; - matrix.m43 = 0; - - var rotateRay = Qt.vector3d(0, 0, 1) - .times(cameraTransform) - .minus(cameraSpot) - .times(matrix); - - var rotation = lookAt(rotateRay); - setAttributeVector("rotation", rotation); - } - - function matchRotationGlobalY() { - var cameraTransform = calculateGlobalTransform(renderCamera); - var cameraSpot = cameraTransform.row(3).toVector3d(); - - var rotateRay = Qt.vector3d(0, 0, 1) - .times(cameraTransform) - .minus(cameraSpot) - - var rotation = getAttributeVector("rotation"); - rotation.y = lookAt(rotateRay).y; - setAttributeVector("rotation", rotation); - } - - function getAttributeVector(name) { - var vec = Qt.vector3d(0, 0, 0); - getAttribute(name + ".x", vec.x); - getAttribute(name + ".y", vec.y); - getAttribute(name + ".z", vec.z); - return vec; - } - - function setAttributeVector(name, vec) { - setAttribute(name + ".x", vec.x); - setAttribute(name + ".y", vec.y); - setAttribute(name + ".z", vec.z); - } -} diff --git a/examples/studio3d/qmlbehaviors/scripts/CatchEvents.qml b/examples/studio3d/qmlbehaviors/scripts/CatchEvents.qml deleted file mode 100644 index 45e2bb25..00000000 --- a/examples/studio3d/qmlbehaviors/scripts/CatchEvents.qml +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtStudio3D.Behavior 1.0 - -Qt3DSBehavior { - onInitialize: { - registerForEvent("onPressureDown", onMouseDown); - registerForEvent("onPressureUp", onMouseUp); - } - - function onMouseDown() { - console.log("Mouse down!"); - } - - function onMouseUp() { - console.log("Mouse up!"); - } -} diff --git a/examples/studio3d/qmlbehaviors/scripts/DateTime.qml b/examples/studio3d/qmlbehaviors/scripts/DateTime.qml deleted file mode 100644 index 11dc2fd8..00000000 --- a/examples/studio3d/qmlbehaviors/scripts/DateTime.qml +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtStudio3D.Behavior 1.0 - -Qt3DSBehavior { - function onUpdate() { - var date = new Date(); - var timeString = date.getDate() + "/" + (date.getMonth()+1) + "/" + date.getFullYear() - + " " + date.getHours() + ":" + date.getMinutes() + "." + date.getSeconds(); - setAttribute("textstring", timeString); - } -} diff --git a/examples/studio3d/qmlbehaviors/scripts/Keyboard.qml b/examples/studio3d/qmlbehaviors/scripts/Keyboard.qml deleted file mode 100644 index fe1f935e..00000000 --- a/examples/studio3d/qmlbehaviors/scripts/Keyboard.qml +++ /dev/null @@ -1,199 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*[[ -<Event name="onLEFTDown" category="Navigation" /> -<Event name="onLEFTUp" category="Navigation" /> -<Event name="onRIGHTDown" category="Navigation" /> -<Event name="onRIGHTUp" category="Navigation" /> -<Event name="onUPDown" category="Navigation" /> -<Event name="onUPUp" category="Navigation" /> -<Event name="onDOWNDown" category="Navigation" /> -<Event name="onDOWNUp" category="Navigation" /> -]]*/ - -import QtStudio3D.Behavior 1.0 - -Qt3DSBehavior { - property var keyNames: ["NOKEY", - "ESCAPE", - "1", - "2", - "3", - "4", - "5", - "6", - "7", - "8", - "9", - "0", - "SUBTRACT", - "EQUALS", - "BACK", - "TAB", - "Q", - "W", - "E", - "R", - "T", - "Y", - "U", - "I", - "O", - "P", - "LBRACKET", - "RBRACKET", - "RETURN", - "LCONTROL", - "A", - "S", - "D", - "F", - "G", - "H", - "J", - "K", - "L", - "SEMICOLON", - "APOSTROPHE", - "GRAVE", - "LSHIFT", - "BACKSLASH", - "Z", - "X", - "C", - "V", - "B", - "N", - "M", - "COMMA", - "PERIOD", - "SLASH", - "RSHIFT", - "MULTIPLY", - "LALT", - "SPACE", - "CAPITAL", - "F1", - "F2", // 60 - "F3", - "F4", - "F5", - "F6", - "F7", - "F8", - "F9", - "F10", - "NUMLOCK", - "SCROLL", // 70 - "NUMPAD7", - "NUMPAD8", - "NUMPAD9", - "NUMPADSUBTRACT", - "NUMPAD4", - "NUMPAD5", - "NUMPAD6", - "NUMPADADD", - "NUMPAD1", - "NUMPAD2", // 80 - "NUMPAD3", - "NUMPAD0", - "NUMPADDECIMAL", - "NOOP", - "ZENKAKUHANKAKU", - "102ND", - "F11", - "F12", - "F13", - "F14", // 90 - "HIRAGANA", - "HENKAN", - "KATAKANAHIRAGANA", - "MUHENKAN", - "KPJPCOMMA", - "NUMPADENTER", - "RCONTROL", - "NUMPADDIVIDE", - "PRINTSCREEN", - "RALT", // 100 - "LINEFEED", - "HOME", - "UP", - "PGUP", - "LEFT", - "RIGHT", - "END", - "DOWN", - "PGDN", - "INSERT", // 110 - "DELETE", - "MACRO", - "MUTE", - "VOLUMEDOWN", - "VOLUMEUP", - "POWER", - "KPEQUAL", - "KPPLUSMINUS", - "PAUSE", - "SCALE"] - - onInitialize: { - registerForEvent("onKeyDown", onKeyDown); - registerForEvent("onKeyUp", onKeyUp); - } - - function onKeyDown(keyCode) { - fireEvent("on" + keyNames[keyCode] + "Down"); - } - - function onKeyUp(keyCode) { - fireEvent("on" + keyNames[keyCode] + "Up"); - } -} diff --git a/examples/studio3d/qmlbehaviors/scripts/SineWave.qml b/examples/studio3d/qmlbehaviors/scripts/SineWave.qml deleted file mode 100644 index 61303ae2..00000000 --- a/examples/studio3d/qmlbehaviors/scripts/SineWave.qml +++ /dev/null @@ -1,124 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*[[ - <Property name="attribute" formalName="Attribute Name" description="Attribute on the parent element to change." animatable="False" type="String" default="rotation.x" /> - <Property name="ampOffset" formalName="Center Value" description="Value to center around." animatable="False" type="Float" default="0" /> - <Property name="amplitude" formalName="Amplitude" description="Maximum value added to/subtracted from the center." animatable="True" type="Float" default="50" /> - <Property name="period" formalName="Period" description="Number of seconds to complete one full cycle." animatable="False" type="Float" default="5" /> - <Property name="timeOffset" formalName="Start Time Offset" description="Start the sine wave at a different point." animatable="False" type="Float" default="0" /> - <Property name="startImmediately" formalName="Start Immediately?" description="Start immediately or wait for the Start action to be called?" animatable="False" type="Boolean" default="True" /> - - <Handler name="start" formalName="Start" description="Start the Sine Wave control of the property." /> - <Handler name="stop" formalName="Stop" description="Stop the Sine Wave control of the property." /> - <Handler name="toggle" formalName="Toggle" description="If the behavior is running, stop it; otherwise, start it." /> - - <Event name="onStarted" description="Fires when the Sine Wave is started." /> - <Event name="onStopped" description="Fires when the Sine Wave is stopped." /> -]]*/ - -import QtStudio3D.Behavior 1.0 - -Qt3DSBehavior { - //External: - property string attribute - property real ampOffset - property real amplitude - property real period - property real timeOffset - property bool startImmediately - //Internal: - property bool running: false - property bool inDegrees: false - property real elapsedTime: 0 - - function start() { - if (!running) { - running = true; - fireEvent("onStarted"); - } - } - - function stop() { - if (running) { - running = false; - fireEvent("onStopped"); - } - } - - function toggle() { - if (running) - stop(); - else - start(); - } - - onInitialize: { - if (attribute.indexOf("rotation") != -1) - inDegrees = true; - - if (startImmediately) - start(); - } - - onUpdate: { - if (!running) - return; - - if (inDegrees) { - ampOffset *= (Math.PI / 180); - amplitude *= (Math.PI / 180); - } - - elapsedTime += getDeltaTime(); - var value = ampOffset + amplitude * Math.cos(elapsedTime * Math.PI * 2 / period); - setAttribute(attribute, value); - } -} diff --git a/examples/studio3d/qmlbehaviors/scripts/Toggle.qml b/examples/studio3d/qmlbehaviors/scripts/Toggle.qml deleted file mode 100644 index a6921477..00000000 --- a/examples/studio3d/qmlbehaviors/scripts/Toggle.qml +++ /dev/null @@ -1,117 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*[[ - <Property name="attribute" formalName="Attribute Name" description="Attribute on the parent element to change." animatable="False" type="String" default="rotation.x" /> - <Property name="firstValue" formalName="First Value" description="Value when not toggled." animatable="False" type="Float" default="0" /> - <Property name="secondValue" formalName="Second Value" description="Value when toggled." animatable="False" type="Float" default="1" /> - <Property name="timerInterval" formalName="Timer Interval" description="Interval for the toggles." animatable="False" type="Float" default="500" /> - <Property name="startImmediately" formalName="Start Immediately?" description="Start immediately or wait for the Start action to be called?" animatable="False" type="Boolean" default="True" /> - - <Handler name="start" formalName="Start" description="Start the toggling." /> - <Handler name="stop" formalName="Stop" description="Stop the toggling." /> - - <Event name="onToggle" description="Fires when toggled." /> - <Event name="onUntoggle" description="Fires when untoggled." /> -]]*/ - -import QtStudio3D.Behavior 1.0 - -Qt3DSBehavior { - //External: - property string attribute - property real firstValue - property real secondValue - property real timerInterval - property bool startImmediately - //Internal: - property int index: 0 - property bool running: false - property real timer: 0 - - function start() { - running = true; - setAttribute(attribute, firstValue); - } - - function stop() { - running = false; - } - - function toggle() { - if (index == 0) { - setAttribute(attribute, secondValue); - fireEvent("onToggle"); - } else if (index == 1) { - setAttribute(attribute, firstValue); - fireEvent("onUntoggle"); - } - index++; - if (index > 1) - index = 0; - } - - onInitialize: { - if (startImmediately) - start(); - } - - onUpdate: { - if (!running) - return; - - timer += getDeltaTime(); - var interval = timerInterval / 1000; - while (timer >= interval) { - timer -= interval; - toggle(); - } - } -} |