summaryrefslogtreecommitdiffstats
path: root/util/qt3d/assetviewer
diff options
context:
space:
mode:
Diffstat (limited to 'util/qt3d/assetviewer')
-rw-r--r--util/qt3d/assetviewer/assetviewer.desktop7
-rw-r--r--util/qt3d/assetviewer/assetviewer.pro25
-rw-r--r--util/qt3d/assetviewer/assetviewer.rc1
-rw-r--r--util/qt3d/assetviewer/main.cpp100
-rw-r--r--util/qt3d/assetviewer/qml/AssetViewer.qml292
-rw-r--r--util/qt3d/assetviewer/qml/BlenderValueSlider.qml175
-rw-r--r--util/qt3d/assetviewer/qml/ButtonBarPane.qml51
-rw-r--r--util/qt3d/assetviewer/qml/CheckBox.qml45
-rw-r--r--util/qt3d/assetviewer/qml/ColorPicker.qml286
-rw-r--r--util/qt3d/assetviewer/qml/ColorUtils.js61
-rw-r--r--util/qt3d/assetviewer/qml/HelpOverlay.qml56
-rw-r--r--util/qt3d/assetviewer/qml/ModelPropertiesPane.qml543
-rw-r--r--util/qt3d/assetviewer/qml/ModelViewport.qml452
-rw-r--r--util/qt3d/assetviewer/qml/SaveButton.qml12
-rw-r--r--util/qt3d/assetviewer/qml/Widgets/BlenderToggle.qml48
-rw-r--r--util/qt3d/assetviewer/qml/Widgets/Checkered.qml27
-rw-r--r--util/qt3d/assetviewer/qml/Widgets/ColorSelector.qml72
-rw-r--r--util/qt3d/assetviewer/qml/Widgets/ColorWidget.qml37
-rw-r--r--util/qt3d/assetviewer/qml/Widgets/HSVColor.qml15
-rw-r--r--util/qt3d/assetviewer/qml/Widgets/InputBox.qml39
-rw-r--r--util/qt3d/assetviewer/qml/Widgets/ModelViewportResize.qml30
-rw-r--r--util/qt3d/assetviewer/qml/Widgets/SliderHandle.qml76
-rw-r--r--util/qt3d/assetviewer/qml/Widgets/ZoomControls.qml41
-rw-r--r--util/qt3d/assetviewer/qml/Widgets/images/grow.pngbin252 -> 0 bytes
-rw-r--r--util/qt3d/assetviewer/qml/Widgets/images/shrink.pngbin249 -> 0 bytes
-rw-r--r--util/qt3d/assetviewer/qml/Widgets/images/zoomin.pngbin187 -> 0 bytes
-rw-r--r--util/qt3d/assetviewer/qml/Widgets/images/zoomout.pngbin155 -> 0 bytes
-rw-r--r--util/qt3d/assetviewer/qml/fileHandling.js106
-rw-r--r--util/qt3d/assetviewer/qml/images/help.pngbin737 -> 0 bytes
-rw-r--r--util/qt3d/assetviewer/qml/images/lock.pngbin273 -> 0 bytes
-rw-r--r--util/qt3d/assetviewer/qml/images/minus.pngbin224 -> 0 bytes
-rw-r--r--util/qt3d/assetviewer/qml/images/model.pngbin754 -> 0 bytes
-rw-r--r--util/qt3d/assetviewer/qml/images/open.pngbin596 -> 0 bytes
-rw-r--r--util/qt3d/assetviewer/qml/images/plus.pngbin224 -> 0 bytes
-rw-r--r--util/qt3d/assetviewer/qml/images/save.pngbin706 -> 0 bytes
-rw-r--r--util/qt3d/assetviewer/qml/images/unlock.pngbin292 -> 0 bytes
-rw-r--r--util/qt3d/assetviewer/qml/meshes/monkey.3dsbin13886 -> 0 bytes
-rw-r--r--util/qt3d/assetviewer/qml/meshes/penguin.3dsbin36301 -> 0 bytes
-rw-r--r--util/qt3d/assetviewer/qtquick3d.icobin67646 -> 0 bytes
-rw-r--r--util/qt3d/assetviewer/qtquick3d.pngbin4050 -> 0 bytes
-rw-r--r--util/qt3d/assetviewer/quickfile.cpp163
-rw-r--r--util/qt3d/assetviewer/quickfile.h46
42 files changed, 0 insertions, 2806 deletions
diff --git a/util/qt3d/assetviewer/assetviewer.desktop b/util/qt3d/assetviewer/assetviewer.desktop
deleted file mode 100644
index 1d682515..00000000
--- a/util/qt3d/assetviewer/assetviewer.desktop
+++ /dev/null
@@ -1,7 +0,0 @@
-[Desktop Entry]
-Type=Application
-Name=3D Asset Viewer
-Icon=/usr/share/icons/hicolor/80x80/apps/qtquick3d.png
-Exec=/usr/bin/invoker --type=e -s /usr/bin/modeltweak -fullscreen
-OnlyShowIn=X-MeeGo;
-X-MeeGo-Logical-Id=qtn_comm_appname_assetviewer
diff --git a/util/qt3d/assetviewer/assetviewer.pro b/util/qt3d/assetviewer/assetviewer.pro
deleted file mode 100644
index ee4737d3..00000000
--- a/util/qt3d/assetviewer/assetviewer.pro
+++ /dev/null
@@ -1,25 +0,0 @@
-TEMPLATE = app
-TARGET = assetviewer
-CONFIG += qt warn_on
-
-INSTALL_DIRS = qml
-CONFIG += qt3d_deploy_qml qt3dquick_deploy_pkg
-include(../../../pkg.pri)
-qtcAddDeployment()
-
-SOURCES += main.cpp \
- quickfile.cpp
-
-symbian {
- qmlDeployment2.sources = qml\meshes\*
- qmlDeployment2.path = qml\meshes
- DEPLOYMENT += qmlDeployment2
-}
-
-OTHER_FILES += \
- assetviewer.rc
-
-RC_FILE = assetviewer.rc
-
-HEADERS += \
- quickfile.h
diff --git a/util/qt3d/assetviewer/assetviewer.rc b/util/qt3d/assetviewer/assetviewer.rc
deleted file mode 100644
index 1b6228c9..00000000
--- a/util/qt3d/assetviewer/assetviewer.rc
+++ /dev/null
@@ -1 +0,0 @@
-IDI_ICON1 ICON DISCARDABLE "qtquick3d.ico"
diff --git a/util/qt3d/assetviewer/main.cpp b/util/qt3d/assetviewer/main.cpp
deleted file mode 100644
index 954ed4c6..00000000
--- a/util/qt3d/assetviewer/main.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui/QApplication>
-#include "qdeclarativeview3d.h"
-#include <QGraphicsObject>
-#include <QDebug>
-#include <QtDeclarative>
-
-#include "../../../demos/quick3d/qmlres.h"
-#include "quickfile.h"
-
-QString filename;
-
-int main(int argc, char *argv[])
-{
- qmlRegisterType<QuickFile>("AssetViewer", 1, 0, "QuickFile");
-
- QApplication app(argc, argv);
- QDeclarativeView3D view;
-
- QString qml = q_get_qmldir(QLatin1String("qml/AssetViewer.qml"));
- view.setSource(QUrl::fromLocalFile(qml));
- view.setWindowTitle(QString("3D Asset Viewer"));
-
- //disable close button
- // view.setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowMaximizeButtonHint | Qt::WindowMinimizeButtonHint);
-
- QString fn;
- QStringList args = QApplication::arguments();
- for (int i = 0; i < args.size(); ++i)
- {
- //FIXME: QML likes files relative to QML directory above, or full paths.
- // We need to sort out how this is implemented once we've worked how how it's going to
- // be called via Qt Creator.
- if (args.at(i).startsWith(QLatin1String("-model")) && (i+1 < args.size()))
- {
- fn = args.at(i+1);
- qDebug() << fn;
- QGraphicsObject *object = view.rootObject();
- object->setProperty("targetMesh", args.at(i+1));
- break;
- }
- }
-
- view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
-
-#ifdef Q_OS_SYMBIAN
- view.setAttribute(Qt::WA_LockLandscapeOrientation, true);
- view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
- view.showFullScreen();
-#else
- if (QApplication::arguments().contains(QLatin1String("-maximize")))
- view.showMaximized();
- else if (QApplication::arguments().contains(QLatin1String("-fullscreen")))
- view.showFullScreen();
- else
- view.show();
-#endif
-
- return app.exec();
-}
diff --git a/util/qt3d/assetviewer/qml/AssetViewer.qml b/util/qt3d/assetviewer/qml/AssetViewer.qml
deleted file mode 100644
index af5b4b96..00000000
--- a/util/qt3d/assetviewer/qml/AssetViewer.qml
+++ /dev/null
@@ -1,292 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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 Nokia Corporation and its Subsidiary(-ies) 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 QtQuick 1.0
-import Qt3D 1.0
-import AssetViewer 1.0
-import "fileHandling.js" as FileHandler
-import "Widgets"
-import "ColorUtils.js" as ColorUtils
-
-Rectangle {
- id: outerWindow;
- width: 1024
- height: 768
- property alias modelEffect: customEffect
- property alias modelMaterial: customMaterial
- property bool useCustomEffect: false
- property bool useCustomMaterial: false
-
- property bool changed: false
- Component.onCompleted: {
- outerWindow.changed = false;
- }
-
- Component.onDestruction: {
- if (outerWindow.changed)
- {
- FileHandler.save_qml(true);
- }
- }
-
- Rectangle {
- id: menu
- x: parent.x
- y: parent.y
- height: 24
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.top: parent.top
-
- color: "#B4B4B4"
- border.color: "black"
-
- ButtonBarPane {
- id: buttonBarPane
- anchors.fill: parent
- }
- }
-
- Rectangle {
- id: mainwindow
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.top: menu.bottom
- anchors.bottom: outerWindow.bottom
-
- color: "#444444"
- border.color: "black"
-
- property alias targetMesh: quickFile.filename
-
- QuickFile {
- id: quickFile
- filename: "meshes/penguin.3ds"
- title: "Open 3D Asset File"
- filter: "Asset files (*.*)"
- }
-
- QuickFile {
- id: textureFile
- filename: ""
- title: "Open Texture File"
- filter: "Images (*.gif *.png *.jpg *.tif *.bmp)"
- }
-
- Mesh {
- id: source_mesh
- source: quickFile.filename
- }
-
- Translation3D { id: transformTranslate; translate: Qt.vector3d(0, 0, 0); }
- Rotation3D { id: transformRotateX; axis: Qt.vector3d(1, 0, 0); angle: 0; }
- Rotation3D { id: transformRotateY; axis: Qt.vector3d(0, 1, 0); angle: 0; }
- Rotation3D { id: transformRotateZ; axis: Qt.vector3d(0, 0, 1); angle: 0; }
- Scale3D { id: transformScale; scale: Qt.vector3d(1, 1, 1); }
-
- Effect {
- id: customEffect;
- property alias hsv: hsvColor
- material: useCustomMaterial ? customMaterial : null;
- color: hsv.color
- blending: (hsv.alpha < 1.0)
- || (useCustomMaterial && (hsvAmbColor.alpha*hsvDifColor.alpha*hsvSpecColor.alpha < 1.0))
- texture: textureFile.filename
- }
- Material {
- id: customMaterial
- property alias amb_hsv: hsvAmbColor
- property alias dif_hsv: hsvDifColor
- property alias spec_hsv: hsvSpecColor
- ambientColor: hsvAmbColor.color
- diffuseColor: hsvDifColor.color
- specularColor: hsvSpecColor.color
- textureUrl: textureFile.filename
- }
- HSVColor { id: hsvColor }
- HSVColor { id: hsvAmbColor }
- HSVColor { id: hsvDifColor }
- HSVColor { id: hsvSpecColor }
-
- ModelViewport {
- id: mvpZY
- x: 0;
- y: 0;
- camera.eye: Qt.vector3d(20, 0, 0);
- stateName: "ZYMaximised"
- viewportName: "Z,Y axis (right)"
-
- rightVector: Qt.vector3d(0, 0, -1)
- upVector: Qt.vector3d(0, 1, 0)
-
- property alias position: transformTranslate.translate;
-
- onMouseTranslateX: if (!modelPropertiesPane.translateLocked) position = Qt.vector3d(position.x, position.y, translate.z + (down.x - mouse.x)/translateSensitivity)
- onMouseTranslateY: if (!modelPropertiesPane.translateLocked)position = Qt.vector3d(position.x, translate.y + (down.y - mouse.y)/translateSensitivity, position.z)
- onMouseRotateX: if (!modelPropertiesPane.rotateLocked)transformRotateY.angle = rotate.y - (down.x - mouse.x)/rotateSensitivity
- onMouseRotateY: if (!modelPropertiesPane.rotateLocked)transformRotateZ.angle = rotate.z - (down.y - mouse.y)/rotateSensitivity
- onMouseScaleX: if (!modelPropertiesPane.scaleLocked) {
- var s = scale3d.z - (down.x - mouse.x)/scaleSensitivity;
- transformScale.scale = Qt.vector3d(transformScale.scale.x, transformScale.scale.y, s<0 ? 0 : s)
- }
- onMouseScaleY: if (!modelPropertiesPane.scaleLocked) {
- var s = scale3d.y + (down.y - mouse.y)/scaleSensitivity;
- transformScale.scale = Qt.vector3d(transformScale.scale.x, s<0 ? 0 : s, transformScale.scale.z)
- }
- }
-
- ModelViewport {
- id: mvpXY
- x: parent.width/2
- y: 0;
- camera.eye: Qt.vector3d(0, 0, 20);
- stateName: "XYMaximised"
- viewportName: "X,Y axis (front)"
-
- rightVector: Qt.vector3d(1, 0, 0)
- upVector: Qt.vector3d(0, 1, 0)
-
- property alias position: transformTranslate.translate;
-
- onMouseTranslateX: if (!modelPropertiesPane.translateLocked)position = Qt.vector3d(translate.x - (down.x - mouse.x)/translateSensitivity, position.y, position.z)
- onMouseTranslateY: if (!modelPropertiesPane.translateLocked)position = Qt.vector3d(position.x, translate.y + (down.y - mouse.y)/translateSensitivity, position.z)
- onMouseRotateX: if (!modelPropertiesPane.rotateLocked) transformRotateY.angle = rotate.y - (down.x - mouse.x)/rotateSensitivity
- onMouseRotateY: if (!modelPropertiesPane.rotateLocked) transformRotateX.angle = rotate.x - (down.y - mouse.y)/rotateSensitivity
- onMouseScaleX: if (!modelPropertiesPane.scaleLocked) {
- var s = scale3d.x - (down.x - mouse.x)/scaleSensitivity
- transformScale.scale = Qt.vector3d(s<0 ? 0 : s, transformScale.scale.y, transformScale.scale.z)
- }
- onMouseScaleY: if (!modelPropertiesPane.scaleLocked) {
- var s = scale3d.y + (down.y - mouse.y)/scaleSensitivity
- transformScale.scale = Qt.vector3d(transformScale.scale.x, s<0 ? 0 : s, transformScale.scale.z)
- }
- }
-
- ModelViewport {
- id: mvpXZ
- x: parent.width/2;
- y: parent.height/2;
- camera.eye: Qt.vector3d(0, 20, 0);
- camera.upVector: Qt.vector3d(0, 0, -1);
- stateName: "XZMaximised"
- viewportName: "X,Z axis (top)"
-
- rightVector: Qt.vector3d(1, 0, 0)
- upVector: Qt.vector3d(0, 0, -1)
-
- property alias position: transformTranslate.translate;
-
- onMouseTranslateX: if (!modelPropertiesPane.translateLocked)position = Qt.vector3d(translate.x - (down.x - mouse.x)/translateSensitivity, position.y, position.z)
- onMouseTranslateY: if (!modelPropertiesPane.translateLocked)position = Qt.vector3d(position.x, position.y, translate.z - (down.y - mouse.y)/translateSensitivity)
- onMouseRotateX: if (!modelPropertiesPane.rotateLocked)transformRotateZ.angle = rotate.z + (down.x - mouse.x)/rotateSensitivity
- onMouseRotateY: if (!modelPropertiesPane.rotateLocked)transformRotateX.angle = rotate.x - (down.y - mouse.y)/rotateSensitivity
- onMouseScaleX: if (!modelPropertiesPane.scaleLocked) {
- var s = scale3d.x - (down.x - mouse.x)/scaleSensitivity;
- transformScale.scale = Qt.vector3d(s<0 ? 0 : s, transformScale.scale.y, transformScale.scale.z)
- }
- onMouseScaleY: if (!modelPropertiesPane.scaleLocked) {
- var s = scale3d.z + (down.y - mouse.y)/scaleSensitivity;
- transformScale.scale = Qt.vector3d(transformScale.scale.x, transformScale.scale.y, s<0 ? 0 : s)
- }
- }
-
- Rectangle {
- id: meshName
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.bottomMargin: 10
- anchors.bottom: parent.bottom
- radius: 10
- border.width: 1
- border.color: "black"
- color: "white"
- width: parent.width - 20
- height: 20
-
- Text {
- anchors.verticalCenter: parent.verticalCenter
- anchors.horizontalCenter: parent.horizontalCenter
- text: "Hold left mouse button to move, middle button to scale, and right button to rotate the asset."
- }
- }
-
- ModelPropertiesPane {
- id: modelPropertiesPane
- x: 16;
- y: parent.height / 2 + 16
- onChanged: {outerWindow.changed=true}
- }
-
- ColorPicker {
- id: colorPicker
- visible: false
- }
-
- HelpOverlay {
- id: helpOverlay
- visible: false
- }
-
- states: [
- State {
- name: "3Views"
- },
- State {
- name: "ZYMaximised"
- PropertyChanges { target: mvpZY; x: 0; y: 0; width: mainwindow.width; height: mainwindow.height; }
- PropertyChanges { target: mvpXY; x: mainwindow.width; y: 0; width: 0; height: mainwindow.height/2; }
- PropertyChanges { target: mvpXZ; x: mainwindow.width; y: mainwindow.height; width: 0; height: 0; }
- },
- State {
- name: "XYMaximised"
- PropertyChanges { target: mvpZY; x: 0; y: 0; width: 0; height: mainwindow.height/2; }
- PropertyChanges { target: mvpXY; x: 0; y: 0; width: mainwindow.width; height: mainwindow.height; }
- PropertyChanges { target: mvpXZ; x: mainwindow.width/2; y: mainwindow.height; width: mainwindow.width/2; height: 0; }
- },
- State {
- name: "XZMaximised"
- PropertyChanges { target: mvpZY; x: 0; y: 0; width: 0; height: 0; }
- PropertyChanges { target: mvpXY; x: mainwindow.width/2; y: 0; width: mainwindow.width/2; height: 0; }
- PropertyChanges { target: mvpXZ; x: 0; y: 0; width: mainwindow.width; height: mainwindow.height; }
- }
- ]
-
- state: "3Views"
- }
-}
diff --git a/util/qt3d/assetviewer/qml/BlenderValueSlider.qml b/util/qt3d/assetviewer/qml/BlenderValueSlider.qml
deleted file mode 100644
index 2f223380..00000000
--- a/util/qt3d/assetviewer/qml/BlenderValueSlider.qml
+++ /dev/null
@@ -1,175 +0,0 @@
-import QtQuick 1.0
-import Qt3D 1.0
-import AssetViewer 1.0
-
-Item {
- id: valueSlider
-
- property string label: "";
- property alias value: textInput.text;
- property double delta: 0.1;
- property double max: 1;
- property double min: -1;
- property bool limitMax: false;
- property bool limitMin: false;
- property bool locked: false
-
- width: rect.width
- height: 20
-
- property int textWidth: 80
-
- signal next
- signal prev
- signal gotFocus
- signal fail
- signal changed
-
- Rectangle {
- id: rect
- radius: 8
- border.width: 1
- border.color: "#191919"
- color: "#B4B4B4"
- width: radius/2 + valueSlider.textWidth + plus.width + minus.width
- height: parent.height
-
-
- Text {
- id: textLabel
- color: "black"
- width: textInput.width
- height: textInput.height
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- text: valueSlider.label + " " + textInput.text
- visible: true
- onTextChanged: changed();
- }
-
-
- TextInput {
- id: textInput
- readOnly: valueSlider.locked
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- horizontalAlignment: TextInput.AlignHCenter
- width: valueSlider.textWidth
- validator: DoubleValidator{}
- onAccepted: {
- parent.parent.update(text)
- focus = false
- }
- visible: false
- onFocusChanged: {
- if (focus == false) {
- parent.parent.update(text)
- visible = false
- textLabel.visible = true
- }
- else {
- visible = true
- textLabel.visible = false
- }
- }
-
- Keys.onTabPressed: valueSlider.next()
- Keys.onBacktabPressed: valueSlider.prev()
- }
- Image {
- id: plus
- source: "images/plus.png"
- anchors.left: textInput.right
- anchors.verticalCenter: parent.verticalCenter
- }
- Image {
- id: minus
- source: "images/minus.png"
- anchors.right: textInput.left
- anchors.verticalCenter: parent.verticalCenter
- }
- MouseArea {
- id: mouseArea
- anchors.fill: parent
- onEntered: parent.color = "#999999"
- onExited: parent.color = "#B4B4B4"
- hoverEnabled: true
- onClicked: {
- if (!valueSlider.locked)
- {
- if (mouse.x<width/3)
- decDelta();
- else if (mouse.x>width/3*2)
- incDelta();
- else {
- valueSlider.gotFocus()
- }
- } else {
- valueSlider.fail();
- }
-
- }
- onPressed: parent.color = "#808080"
- onReleased: parent.color = "#999999"
- }
- }
-
- Timer {
- interval: 100;
- running: mouseArea.pressedButtons & Qt.LeftButton && (mouseArea.mouseX > valueSlider.width/3*2)
- repeat: true
- onTriggered: if (!valueSlider.locked) incDelta()
- }
-
- Timer {
- interval: 100;
- running: mouseArea.pressedButtons & Qt.LeftButton && (mouseArea.mouseX < valueSlider.width/3)
- repeat: true
- onTriggered: if (!valueSlider.locked) decDelta()
- }
-
- function updateMe() {
- update(textInput.text)
- }
-
- function incDelta() {
- var t = value*1 + delta;
- if (limitMax)
- update(t>max ? max : t);
- else
- update(t);
-
- }
-
- function decDelta() {
- var t = value*1 - delta;
- if (limitMin)
- update(t<min ? min : t);
- else
- update(t);
- }
-
- onGotFocus: {
- textLabel.visible = false;
- textInput.visible = true;
- textInput.focus = true;
- textInput.selectAll();
- }
-
- onFocusChanged: if (focus) valueSlider.gotFocus()
-
- Keys.onUpPressed: {
- if (!valueSlider.locked) incDelta();
- else valueSlider.fail();
- }
- Keys.onDownPressed: {
- if (!valueSlider.locked) decDelta();
- else valueSlider.fail();
- }
- Keys.onReturnPressed: {
- if (!valueSlider.locked) updateMe();
- else valueSlider.fail();
- }
-}
diff --git a/util/qt3d/assetviewer/qml/ButtonBarPane.qml b/util/qt3d/assetviewer/qml/ButtonBarPane.qml
deleted file mode 100644
index bd85d5c8..00000000
--- a/util/qt3d/assetviewer/qml/ButtonBarPane.qml
+++ /dev/null
@@ -1,51 +0,0 @@
-import QtQuick 1.0
-import Qt3D 1.0
-import AssetViewer 1.0
-import "fileHandling.js" as FileHandler
-import "Widgets"
-
-Flow {
- id: menu
- anchors.left: parent.left
- anchors.leftMargin: 2
- anchors.top: parent.top
- anchors.topMargin: 2
- width: buttonWidth * 4 + spacing * 3
- height: parent.height
- spacing: 5
-
- property double buttonWidth: 105
-
- SaveButton {
- id: save
- width: buttonWidth
- buttonText: "Save QML"
- imageSrc: "images/save.png"
- }
-
- BlenderToggle {
- id: load
- width: buttonWidth
- onClicked:
- {
- if (outerWindow.changed)
- {
- FileHandler.save_qml(true);
- }
- var useEffect = useCustomEffect;
- useCustomEffect = false;
- quickFile.load();
- useCustomEffect = useEffect;
- }
- buttonText: "Load Asset"
- imageSrc: "images/model.png"
- }
-
- BlenderToggle {
- id: help
- width: buttonWidth
- onClicked: helpOverlay.visible = true
- buttonText: "Help!"
- imageSrc: "images/help.png"
- }
-}
diff --git a/util/qt3d/assetviewer/qml/CheckBox.qml b/util/qt3d/assetviewer/qml/CheckBox.qml
deleted file mode 100644
index efadd539..00000000
--- a/util/qt3d/assetviewer/qml/CheckBox.qml
+++ /dev/null
@@ -1,45 +0,0 @@
-import QtQuick 1.0
-
-Item {
- id: checkBox
- height: Math.max (textBox.height, check.height)
- width: textBox.width + check.width
- property alias text: textBox.text
- property bool checked: false
- signal clicked(bool checked)
- property variant color: Qt.rgba(1,1,1,1)
-
- Text {
- id: textBox
- anchors.left: parent.left
- color: checkBox.color
- }
-
- Rectangle {
- id: check
- width: 16
- height: 16
- anchors.right: parent.right
-
- border.color: checkBox.color
- border.width: 1
- color: Qt.rgba(0,0,0,0)
-
- Rectangle {
- anchors.centerIn: parent
-
- border.color: checkBox.color
- border.width: 1
-
- width: parent.width - 6
- height: parent.height - 6
- color: checkBox.color
- opacity: checked
- }
- }
-
- MouseArea {
- anchors.fill: parent
- onClicked: { checked = !checked; checkBox.clicked(checked) }
- }
-}
diff --git a/util/qt3d/assetviewer/qml/ColorPicker.qml b/util/qt3d/assetviewer/qml/ColorPicker.qml
deleted file mode 100644
index 641a6acc..00000000
--- a/util/qt3d/assetviewer/qml/ColorPicker.qml
+++ /dev/null
@@ -1,286 +0,0 @@
-import QtQuick 1.0
-import "Widgets"
-import "ColorUtils.js" as ColorUtils
-
-Rectangle {
- id: picker
- property alias alpha: alphaSlider.value
- property alias hue: hueSlider.value
- property alias sat: colorSelector.sat
- property alias val: colorSelector.val
- property variant colorSelect: Qt.hsla(hsl_hue, hsl_sat, hsl_lum, alpha)
- property HSVColor targetColor
-
- HSVColor { id: oldColor }
-
- property real hsl_hue: hue
- property real hsl_sat: sat*val*((hsl_lum <= 2) ? hsl_lum*2 : 2*(1 - hsl_lum))
- property real hsl_lum: ((2.0 - sat)*val)/2
-
- property int red: rgb[0]
- property int green: rgb[1]
- property int blue: rgb[2]
-
- property variant rgb: ColorUtils.hsvToRgb(hue, sat, val)
-
- onRgbChanged: updateTarget()
- onAlphaChanged: updateTarget()
-
- anchors.fill: parent
- property real bgAlpha: 0.5
- color: Qt.rgba(1,1,1,bgAlpha)
-
- function apply() {
- updateTarget();
- picker.visible = false;
- }
-
- function cancel() {
- resetTarget();
- picker.visible = false;
- }
-
- function setTarget(target) {
- targetColor = target;
- hue = target.hue;
- sat = target.sat;
- val = target.val;
- alpha = target.alpha;
- oldColor.hue = target.hue;
- oldColor.sat = target.sat;
- oldColor.val = target.val;
- oldColor.alpha = target.alpha
- }
-
- function updateTarget() {
- if (targetColor === null || !picker.visible) return;
- targetColor.hue = hue;
- targetColor.sat = sat;
- targetColor.val = val;
- targetColor.alpha = alpha;
- }
-
- function resetTarget() {
- if (targetColor === null) return;
- targetColor.hue = oldColor.hue;
- targetColor.sat = oldColor.sat;
- targetColor.val = oldColor.val;
- targetColor.alpha = oldColor.alpha;
- }
-
- MouseArea {
- anchors.fill: parent
- onClicked: {}
- }
-
- Rectangle {
- width: pickerLayout.implicitWidth+20
- height: 250
- anchors.centerIn: parent
-
- border.width: 2
- border.color: "white"
- color: mainwindow.color
-
- Row {
- id: pickerLayout
- anchors {
- top: parent.top
- horizontalCenter: parent.horizontalCenter
- margins: 10
- }
- height: 200
- spacing: 10
-
- Item {
- id: colorViewer
- width: height
- height: parent.height
- Rectangle {
- anchors.fill: parent
- rotation: -90
- gradient: Gradient {
- GradientStop { position: 0.0; color: Qt.hsla(hueSlider.value, 1.0, 1.0) }
- GradientStop { position: 1.0; color: Qt.hsla(hueSlider.value, 1.0, 0.5) }
- }
- }
- Rectangle {
- anchors.fill: parent
- border.color: "lightgray"
- gradient: Gradient {
- GradientStop { position: 0.0; color: Qt.rgba(0,0,0,0) }
- GradientStop { position: 1.0; color: Qt.rgba(0,0,0,1) }
- }
- }
-
- ColorSelector {
- id: colorSelector
- anchors.fill: parent
- }
- }
-
- Item {
- width: 20
- height: parent.height
- Rectangle {
- anchors.fill: parent
- border.color: "lightgray"
- gradient: Gradient {
- GradientStop { position: 1.0; color: Qt.hsla(1.0, 1.0, 0.5) }
- GradientStop { position: 0.85; color: Qt.hsla(0.85, 1.0, 0.5) }
- GradientStop { position: 0.76; color: Qt.hsla(0.76, 1.0, 0.5) }
- GradientStop { position: 0.5; color: Qt.hsla(0.5, 1.0, 0.5) }
- GradientStop { position: 0.33; color: Qt.hsla(0.33, 1.0, 0.5) }
- GradientStop { position: 0.16; color: Qt.hsla(0.16, 1.0, 0.5) }
- GradientStop { position: 0.0; color: Qt.hsla(0.0, 1.0, 0.5) }
- }
- }
-
- SliderHandle {
- id: hueSlider
- anchors.fill: parent
- }
- }
-
- Item {
- width: 20
- height: parent.height
-
- Checkered {
- anchors.fill: parent
- }
-
- Rectangle {
- anchors.fill: parent
- border.color: "lightgray"
- gradient: Gradient {
- GradientStop {
- position: 0.0;
- color: Qt.hsla(picker.hsl_hue, picker.hsl_sat, picker.hsl_lum)
- }
- GradientStop {
- position: 1.0;
- color: Qt.hsla(picker.hsl_hue, picker.hsl_sat, picker.hsl_lum, 0)
- }
- }
- }
-
- SliderHandle {
- id: alphaSlider
- anchors.fill: parent
- inverted: true
- }
- }
-
- Item {
- width: 60
- height: parent.height
-
- Item {
- id: preview
- width: parent.width; height: 40
- Checkered {
- anchors.fill: parent
- }
- Rectangle {
- anchors.fill: parent
- border.color: "lightgray"
- color: picker.colorSelect
- }
- }
-
- Column {
- anchors.top: preview.bottom
- anchors.topMargin: 5
- spacing: 3
- width: parent.width
-
- InputBox {
- id: redIn
- width: parent.width; height: 20
- label: "R:"
- }
-
- InputBox {
- id: greenIn
- width: parent.width; height: 20
- label: "G:"
- }
-
- InputBox {
- id: blueIn
- width: parent.width; height: 20
- label: "B:"
- }
-
- Binding {
- target: redIn.input; property: "text"
- value: Math.round(rgb[0])
- }
- Binding {
- target: greenIn.input; property: "text"
- value: Math.round(rgb[1])
- }
- Binding {
- target: blueIn.input; property: "text"
- value: Math.round(rgb[2])
- }
-
- Item {
- width: 5; height: 5
- }
-
- InputBox {
- id: hueIn
- width: parent.width; height: 20
- label: "H:"
- }
-
- InputBox {
- id: satIn
- width: parent.width; height: 20
- label: "S:"
- }
-
- InputBox {
- id: valIn
- width: parent.width; height: 20
- label: "V:"
- }
-
- Binding {
- target: hueIn.input; property: "text"
- value: Math.round(picker.hue*100)/100
- }
- Binding {
- target: satIn.input; property: "text"
- value: Math.round(picker.sat*100)/100
- }
- Binding {
- target: valIn.input; property: "text"
- value: Math.round(picker.val*100)/100
- }
- }
- }
- }
-
- Row {
- anchors {
- margins: 5
- top: pickerLayout.bottom
- horizontalCenter: parent.horizontalCenter
- }
- spacing: 10
- BlenderToggle {
- width: 80
- buttonText: "Apply"
- onClicked: picker.apply()
- }
- BlenderToggle {
- width: 80
- buttonText: "Cancel"
- onClicked: picker.cancel()
- }
- }
- }
-}
diff --git a/util/qt3d/assetviewer/qml/ColorUtils.js b/util/qt3d/assetviewer/qml/ColorUtils.js
deleted file mode 100644
index 5addf394..00000000
--- a/util/qt3d/assetviewer/qml/ColorUtils.js
+++ /dev/null
@@ -1,61 +0,0 @@
-.pragma library
-
-function rgbToHsv(r, g, b) {
- r = r/255; g = g/255; b = b/255;
- var max = Math.max(r, g, b), min = Math.min(r, g, b);
- var h, s, v = max;
-
- var d = max - min;
- s = max == 0 ? 0 : d / max;
-
- if (max == min){
- h = 0; // achromatic
- } else {
- switch (max) {
- case r: h = (g - b) / d + (g < b ? 6 : 0); break;
- case g: h = (b - r) / d + 2; break;
- case b: h = (r - g) / d + 4; break;
- }
- h /= 6;
- }
-
- return new Array(h, s, v);
-}
-
-function hsvToRgb(h, s, v) {
- var r, g, b;
-
- var i = Math.floor(h * 6);
- var f = h * 6 - i;
- var p = v * (1 - s);
- var q = v * (1 - f * s);
- var t = v * (1 - (1 - f) * s);
-
- switch (i % 6){
- case 0: r = v; g = t; b = p; break;
- case 1: r = q; g = v; b = p; break;
- case 2: r = p; g = v; b = t; break;
- case 3: r = p; g = q; b = v; break;
- case 4: r = t; g = p; b = v; break;
- case 5: r = v; g = p; b = q; break;
- }
-
- return new Array(r * 255, g * 255, b * 255);
-}
-
-function hsvToHsl(h, s, v) {
- var ss, l;
-
- l = ((2.0 - s)*v);
-
- ss = s*v*((l <= 1) ? l : 2 - l);
-
- l /= 2;
-
- return new Array(h, ss, l);
-}
-
-function hsvToColor(h, s, v, a) {
- var hsl = hsvToHsl(h,s,v);
- return Qt.hsla(hsl[0], hsl[1], hsl[2], a);
-}
diff --git a/util/qt3d/assetviewer/qml/HelpOverlay.qml b/util/qt3d/assetviewer/qml/HelpOverlay.qml
deleted file mode 100644
index 7b233e6f..00000000
--- a/util/qt3d/assetviewer/qml/HelpOverlay.qml
+++ /dev/null
@@ -1,56 +0,0 @@
-import QtQuick 1.0
-import Qt3D 1.0
-import AssetViewer 1.0
-
-Rectangle {
- anchors.fill: parent
- color: "#00000000"
-
- Rectangle {
- id: helpScreen
- width: parent.width/2
- height: parent.height/2
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
-
- border.width: 4
- radius: 4
- color: "lightyellow"
-
- Text {
- id: header
- font { pixelSize: 32; italic: true }
- text: "3D Asset Viewer Help"
- anchors.top: parent.top
- anchors.topMargin: 16
- anchors.horizontalCenter: parent.horizontalCenter
- }
- Text {
- anchors.top: header.bottom
- anchors.topMargin: 16
- anchors.left: parent.left
- anchors.leftMargin: 16
- anchors.right: parent.right
- anchors.rightMargin: 16
- textFormat: Text.RichText
- wrapMode: Text.WordWrap
- text: "Altering model parameters with the mouse:" +
- "<ul><li>Clicking on one of the panes with the <b>Left Mouse Button</b> and dragging will translate the position.</li>" +
- "<li>Clicking on one of the panes with the <b>Right Mouse Button</b> and dragging will rotate the position.</li>" +
- "<li>Clicking on one of the panes with the <b>Middle Mouse Button</b> and dragging will resize the model."
- }
-
- Text {
- anchors.bottom: parent.bottom
- anchors.bottomMargin: 16
- anchors.horizontalCenter: parent.horizontalCenter
- text: "[ Click to Close ]"
- }
- }
- MouseArea {
- anchors.fill: parent
- acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
- onClicked: parent.visible = false
- }
-}
-
diff --git a/util/qt3d/assetviewer/qml/ModelPropertiesPane.qml b/util/qt3d/assetviewer/qml/ModelPropertiesPane.qml
deleted file mode 100644
index 384a8b6e..00000000
--- a/util/qt3d/assetviewer/qml/ModelPropertiesPane.qml
+++ /dev/null
@@ -1,543 +0,0 @@
-import QtQuick 1.0
-import Qt3D 1.0
-import AssetViewer 1.0
-import "Widgets"
-import "ColorUtils.js" as ColorUtils
-
-Row {
- id: properties
- spacing: 30
- property alias rotateLocked: imageR.isLocked
- property alias scaleLocked: imageS.isLocked
- property alias translateLocked: imageP.isLocked;
-
- signal changed;
- Column {
- width: posX.width
- height: parent.height
- spacing: 4
-
- // POSITION
- Item {
- id: positionPanel
- width: parent.width
- height: imageP.height
-
- Text {
- anchors.left: parent.left
- anchors.leftMargin: 8
- text: "Position";
- color: "#FFFFFF";
- font.bold: true;
- }
- Image {
- id: imageP
- anchors.right: parent.right
- anchors.rightMargin: 8
-
- //Animation to pulse the lock icon if attempting to modify while locked.
- property bool bounce: false
-
- SequentialAnimation on scale{
- running: imageP.bounce
- NumberAnimation { to : 2.0; duration: 150; easing.type: "OutQuad" }
- NumberAnimation { to : 1.0; duration: 150; easing.type: "OutQuad" }
- NumberAnimation { to : 2.0; duration: 150; easing.type: "OutQuad" }
- NumberAnimation { to : 1.0; duration: 150; easing.type: "OutQuad" }
- onCompleted: imageP.bounce = false
- }
-
- //Manage locked/unlocked state
- state: "UNLOCKED"
- property bool isLocked: false
-
- states: [
- State {
- name: "UNLOCKED"
- PropertyChanges { target: imageP; source: "images/unlock.png"}
- PropertyChanges { target: imageP; isLocked: false;}
- },
- State {
- name: "LOCKED"
- PropertyChanges { target: imageP; source: "images/lock.png"}
- PropertyChanges { target: imageP; isLocked: true;}
- }
- ]
-
- MouseArea {
- anchors.fill: parent
- onDoubleClicked: {
- if (parent.state=="LOCKED")
- parent.state="UNLOCKED"
- else
- parent.state="LOCKED"
- }
- }
- }
- }
- BlenderValueSlider {
- focus: true
- id: posX
- label: "X:"
- locked: imageP.isLocked
- value: transformTranslate.translate.x.toFixed(3)
- function update (f) {
- transformTranslate.translate = Qt.vector3d(f, transformTranslate.translate.y, transformTranslate.translate.z);
- }
- onNext: { updateMe(); focus = false; posY.focus = true; }
- onPrev: { updateMe(); focus = false; scaleZ.focus = true; }
- onFail: { imageP.bounce=true; }
- onChanged: { properties.changed(); }
- }
- BlenderValueSlider {
- id: posY
- label: "Y:"
- locked: imageP.isLocked
- value: transformTranslate.translate.y.toFixed(3)
- function update (f) {
- transformTranslate.translate = Qt.vector3d(transformTranslate.translate.x, f, transformTranslate.translate.z);
- }
- onNext: { updateMe(); focus = false; posZ.focus = true; }
- onPrev: { updateMe(); focus = false; posX.focus = true; }
- onFail: { imageP.bounce=true; }
- onChanged: { properties.changed(); }
- }
- BlenderValueSlider {
- id: posZ
- label: "Z:"
- locked: imageP.isLocked
- value: transformTranslate.translate.z.toFixed(3)
- function update (f) {
- transformTranslate.translate = Qt.vector3d(transformTranslate.translate.x, transformTranslate.translate.y, f);
- }
- onNext: { updateMe(); focus = false; rotX.focus = true; }
- onPrev: { updateMe(); focus = false; posY.focus = true; }
- onFail: { imageP.bounce=true; }
- onChanged: { properties.changed(); }
- }
-
- // ROTATE
- Item {
- id: rotationPanel
- width: parent.width
- height: imageR.height
- property bool dirty: false
- Text {
- anchors.left: parent.left
- anchors.leftMargin: 8
- text: "Rotation";
- color: "#FFFFFF"
- font.bold: true
- }
-
- Image {
- id: imageR
- anchors.right: parent.right
- anchors.rightMargin: 8
-
- //Animation to pulse the lock icon if attempting to modify while locked.
- property bool bounce: false
-
- SequentialAnimation on scale{
- running: imageR.bounce
- NumberAnimation { to : 2.0; duration: 150; easing.type: "OutQuad" }
- NumberAnimation { to : 1.0; duration: 150; easing.type: "OutQuad" }
- NumberAnimation { to : 2.0; duration: 150; easing.type: "OutQuad" }
- NumberAnimation { to : 1.0; duration: 150; easing.type: "OutQuad" }
- onCompleted: imageR.bounce = false
- }
-
- //Manage locked/unlocked state
- state: "UNLOCKED"
- property bool isLocked: false
-
- states: [
- State {
- name: "UNLOCKED"
- PropertyChanges { target: imageR; source: "images/unlock.png"}
- PropertyChanges { target: imageR; isLocked: false;}
- },
- State {
- name: "LOCKED"
- PropertyChanges { target: imageR; source: "images/lock.png"}
- PropertyChanges { target: imageR; isLocked: true;}
- }
- ]
-
- MouseArea {
- anchors.fill: parent
- onDoubleClicked: {
- if (parent.state=="LOCKED")
- parent.state="UNLOCKED"
- else
- parent.state="LOCKED"
- }
- }
- }
- }
- BlenderValueSlider {
- id: rotX
- label: "X:"
- delta: 1
- locked: imageR.isLocked
- min: 0; limitMin: true
- max: 360; limitMax: true
- value: transformRotateX.angle.toFixed(3)
- function update (f) { transformRotateX.angle = f }
- onNext: { updateMe(); focus = false; rotY.focus = true; }
- onPrev: { updateMe(); focus = false; posZ.focus = true; }
- onFail: { imageR.bounce=true; }
- onChanged: { properties.changed(); }
- }
- BlenderValueSlider {
- id: rotY
- label: "Y:"
- delta: 1
- locked: imageR.isLocked
- min: 0; limitMin: true
- max: 360; limitMax: true
- value: transformRotateY.angle.toFixed(3)
- function update (f) { transformRotateY.angle = f }
- onNext: { updateMe(); focus = false; rotZ.focus = true; }
- onPrev: { updateMe(); focus = false; rotX.focus = true; }
- onFail: { imageR.bounce=true; }
- onChanged: { properties.changed(); }
- }
- BlenderValueSlider {
- id: rotZ
- label: "Z:"
- delta: 1
- locked: imageR.isLocked
- min: 0; limitMin: true
- max: 360; limitMax: true
- value: transformRotateZ.angle.toFixed(3)
- function update (f) { transformRotateZ.angle = f }
- onNext: { updateMe(); focus = false; scaleX.focus = true; }
- onPrev: { updateMe(); focus = false; rotY.focus = true; }
- onFail: { imageR.bounce=true; }
- onChanged: { properties.changed(); }
- }
-
- // SCALE
- Item {
- id: scalePanel
- width: parent.width
- height: imageS.height
- property bool dirty: false
-
- Item {
- width: parent.width
- height: scaleText.height
- Text {
- id: scaleText
- anchors.left: parent.left
- anchors.leftMargin: 8
- text: "Scale";
- color: "#FFFFFF"
- font.bold: true
- }
- }
-
- Image {
- id: imageS
- anchors.right: parent.right
- anchors.rightMargin: 8
-
- //Animation to pulse the lock icon if attempting to modify while locked.
- property bool bounce: false
-
- SequentialAnimation on scale{
- running: imageS.bounce
- NumberAnimation { to : 2.0; duration: 150; easing.type: "OutQuad" }
- NumberAnimation { to : 1.0; duration: 150; easing.type: "OutQuad" }
- NumberAnimation { to : 2.0; duration: 150; easing.type: "OutQuad" }
- NumberAnimation { to : 1.0; duration: 150; easing.type: "OutQuad" }
- onCompleted: imageS.bounce = false
- }
-
- //Manage locked/unlocked state
- state: "UNLOCKED"
- property bool isLocked: false
-
- states: [
- State {
- name: "UNLOCKED"
- PropertyChanges { target: imageS; source: "images/unlock.png"}
- PropertyChanges { target: imageS; isLocked: false;}
- },
- State {
- name: "LOCKED"
- PropertyChanges { target: imageS; source: "images/lock.png"}
- PropertyChanges { target: imageS; isLocked: true;}
- }
- ]
-
- MouseArea {
- anchors.fill: parent
- onDoubleClicked: {
- if (parent.state=="LOCKED")
- parent.state="UNLOCKED"
- else
- parent.state="LOCKED"
- }
- }
- }
- }
- BlenderValueSlider {
- id: scaleX
- label: "X:"
- locked: imageS.isLocked
- min: 0; limitMin: true
- value: transformScale.scale.x.toFixed(3)
- function update (f) { transformScale.scale = Qt.vector3d(f, transformScale.scale.y, transformScale.scale.z); }
- onNext: { updateMe(); focus = false; scaleY.focus = true; }
- onPrev: { updateMe(); focus = false; rotZ.focus = true; }
- onFail: { imageS.bounce=true; }
- onChanged: { properties.changed(); }
- }
- BlenderValueSlider {
- id: scaleY
- label: "Y:"
- locked: imageS.isLocked
- min: 0; limitMin: true
- value: transformScale.scale.y.toFixed(3)
- function update (f) { transformScale.scale = Qt.vector3d(transformScale.scale.x, f, transformScale.scale.z); }
- onNext: { updateMe(); focus = false; scaleZ.focus = true; }
- onPrev: { updateMe(); focus = false; scaleX.focus = true; }
- onFail: { imageS.bounce=true; }
- onChanged: { properties.changed(); }
- }
- BlenderValueSlider {
- id: scaleZ
- label: "Z:"
- locked: imageS.isLocked
- min: 0; limitMin: true
- value: transformScale.scale.z.toFixed(3)
- function update (f) { transformScale.scale = Qt.vector3d(transformScale.scale.x, transformScale.scale.y, f); }
- onNext: { updateMe(); focus = false; posX.focus = true; }
- onPrev: { updateMe(); focus = false; scaleY.focus = true; }
- onFail: { imageS.bounce=true; }
- onChanged: { properties.changed(); }
- }
- }
-
- // Material, Effect
- Column {
- width: 150
- spacing: 5
- Item {
- id: effectPanel
- width: parent.width
- height: imageS.height
- property bool dirty: false
-
- Item {
- width: parent.width
- height: effectText.height
- Text {
- id: effectText
- anchors.left: parent.left
- anchors.leftMargin: 8
- text: "Effect";
- color: "#FFFFFF"
- font.bold: true
- }
- }
- }
-
-
- CheckBox {
- id: fromMesh
- width: parent.width
- text: "From Mesh"
- checked: true
- onClicked: {
- useCustomEffect = !checked;
- if (checked) {
- // A horrible hack to reload the default mesh material
- // TODO: Find a better way of doing this (i.e. no runtime errors)
- source_mesh.source = "";
- source_mesh.source = targetMesh;
- }
- }
- }
-
- Column {
- enabled: !fromMesh.checked
- opacity: enabled ? 1.0: 0.5
- width: parent.width; spacing: 5
-
- move: Transition {
- NumberAnimation {
- properties: "y"
- easing.type: Easing.InOutQuad;
- duration: 150
- }
- }
-
- Behavior on opacity {
- NumberAnimation { easing.type: Easing.InOutQuad; duration: 100 }
- }
-
- CheckBox {
- width: parent.width
- text: "Decal"
- checked: false
- onClicked: {
- modelEffect.decal = checked
- }
- }
-
- Item {
- width: parent.width
- height: colorText.height
- Text {
- id: colorText
- anchors.left: parent.left
- anchors.leftMargin: 8
- text: "- Color";
- color: "#FFFFFF"
- font.bold: true
- }
- }
-
- CheckBox {
- id: simpleColor
- width: parent.width
- text: "Simple"
- checked: true
- onClicked: {
- useCustomMaterial = !checked;
- }
- }
-
- ColorWidget {
- id: flat
- visible: opacity != 0
- opacity: simpleColor.checked
- width: parent.width; height: 16
- targetColor: modelEffect.hsv
- text: "Flat Color"
- Behavior on opacity {
- NumberAnimation { easing.type: Easing.InOutQuad; duration: 100 }
- }
- }
-
- ColorWidget {
- id: ambient
- visible: opacity != 0
- opacity: !flat.visible
- width: parent.width; height: 16
- targetColor: modelMaterial.amb_hsv
- text: "Ambient Color"
- Behavior on opacity {
- NumberAnimation { easing.type: Easing.InOutQuad; duration: 100 }
- }
- }
-
- ColorWidget {
- id: diffuse
- visible: opacity != 0
- opacity: !flat.visible
- width: parent.width; height: 16
- targetColor: modelMaterial.dif_hsv
- text: "Diffuse Color"
- Behavior on opacity {
- NumberAnimation { easing.type: Easing.InOutQuad; duration: 100 }
- }
- }
-
- ColorWidget {
- id: specular
- visible: opacity != 0
- opacity: !flat.visible
- width: parent.width; height: 16
- targetColor: modelMaterial.spec_hsv
- text: "Specular Color"
- Behavior on opacity {
- NumberAnimation { easing.type: Easing.InOutQuad; duration: 100 }
- }
- }
-
- Item { width: parent.width; height: 5 }
-
- Item {
- visible: opacity != 0
- opacity: !flat.visible
- height: shineText.height + shinyValue.height + 5
- width: parent.width
-
- Behavior on opacity {
- NumberAnimation { easing.type: Easing.InOutQuad; duration: 100 }
- }
-
- Text {
- id: shineText
- text: "Shininess:"
- color: "white"
- }
- InputBox {
- anchors.right: parent.right
- width: parent.width - shineText.width - 5
- height: shineText.height
- input.text: modelMaterial.shininess
- }
- Rectangle {
- width: parent.width - 8; height: 1
- anchors.centerIn: shinyValue
- color: "gray"
- }
-
- SliderHandle {
- id: shinyValue
- width: parent.width; height: 10
- anchors { top: shineText.bottom; topMargin: 5 }
- horizontal: true
- onValueChanged: {
- modelMaterial.shininess = Math.round(value * 128)
- }
- }
- }
-
- Item { width: parent.width; height: 5 }
-
- Item {
- width: parent.width
- height: textureText.height
- Text {
- id: textureText
- anchors.left: parent.left
- anchors.leftMargin: 8
- text: "- Texture";
- color: "#FFFFFF"
- font.bold: true
- }
- }
-
- Item {
- width: parent.width
- height: texturePreview.height
- Image {
- id: texturePreview
- width: 60; height: width
- source: textureFile.filename
- }
- Rectangle {
- anchors.fill: texturePreview
- border.color: "white"
- border.width: 1
- color: "transparent"
- }
-
- BlenderToggle {
- width: 60; height: 20
- anchors.right: parent.right
- buttonText: "Open..."
- onClicked: {
- textureFile.load();
- }
- }
- }
- }
- }
-}
diff --git a/util/qt3d/assetviewer/qml/ModelViewport.qml b/util/qt3d/assetviewer/qml/ModelViewport.qml
deleted file mode 100644
index 541c147a..00000000
--- a/util/qt3d/assetviewer/qml/ModelViewport.qml
+++ /dev/null
@@ -1,452 +0,0 @@
-import QtQuick 1.0
-import Qt3D 1.0
-import Qt3D.Shapes 1.0
-import AssetViewer 1.0
-import "Widgets"
-
-Rectangle {
- id: view
- width: parent.width/2;
- height: parent.height/2
-
- color: parent.color
- border.color: parent.border.color
-
- property alias itemPosition: mainItem.position;
- property alias itemScale: mainItem.scale;
- property alias camera: viewport.camera
- property alias viewportName: viewportText.text;
-
- // the current x/y positions of the mouse when the onPressed event was triggered;
- // values are invalid if onRelease has occured
- property variant down;
-
- // current xyz values of the Translation3D/Rotation3Ds/Scale3D when onPressed was triggered;
- // values are invalid if onRelease has occured
- property variant translate;
- property variant rotate;
- property variant scale3d;
-
- // the pixel sensitivity values of the mousemovements
- // TODO: expose via api
- // TODO: maybe save in settings api?
- property double translateSensitivity: 32;
- property double rotateSensitivity: 8;
- property double scaleSensitivity: 32;
-
- // the name of this viewport's state
- property string stateName;
-
- property variant upVector: Qt.vector3d(0, 1, 0)
- property variant rightVector: Qt.vector3d(0, 1, 0)
-
- // the smoothness values for the state change transformations
- // TODO: this should be alterable via the gui and saved in a settings file
- Behavior on x { NumberAnimation { duration: 300 } }
- Behavior on y { NumberAnimation { duration: 300 } }
- Behavior on width { NumberAnimation { duration: 300 } }
- Behavior on height { NumberAnimation { duration: 300 } }
-
- signal mouseTranslateX(variant mouse)
- signal mouseTranslateY(variant mouse)
- signal mouseRotateX(variant mouse)
- signal mouseRotateY(variant mouse)
- signal mouseScaleX(variant mouse)
- signal mouseScaleY(variant mouse)
-
- property real cameraZoom: 1.0
-
- Viewport {
- id: viewport
- anchors.fill: parent
- picking: false
- blending: true
-
- // TODO: camera's position/rotation-around-origin/farplane should be alterable via gui
- camera: Camera {
- farPlane: 2000 // debugging
- projectionType: Camera.Orthographic
- viewSize: Qt.size(2*cameraZoom, 2*cameraZoom)
- }
- navigation: false
-
- Item3D {
- id: mainItem
- mesh: source_mesh
- transform: [
- transformScale,
- transformRotateX,
- transformRotateY,
- transformRotateZ,
- transformTranslate,
- ]
- effect: useCustomEffect ? modelEffect : null;
- }
-
- Effect {
- id: coordLinesThickEffect
- color: "white"
- }
- Effect {
- id: coordLinesThinEffect
- color: "black"
- }
-
- // horizontal lines
- Line {
- id: lineAxisRight
- width: 3.0
- vertices: [
- cameraZoom*(-10*rightVector.x), cameraZoom*(-10*rightVector.y), cameraZoom*(-10*rightVector.z),
- cameraZoom*(10*rightVector.x), cameraZoom*(10*rightVector.y), cameraZoom*(10*rightVector.z),
- cameraZoom*(10*rightVector.x + 0.001*upVector.x), cameraZoom*(10*rightVector.y + 0.001*upVector.y), cameraZoom*(10*rightVector.z + 0.001*upVector.z)
- ]
- effect: coordLinesThickEffect
- }
- Line {
- width: 1.0
- vertices: [
- cameraZoom*(-10*rightVector.x + 0.25*upVector.x), cameraZoom*(-10*rightVector.y + 0.25*upVector.y), cameraZoom*(-10*rightVector.z + 0.25*upVector.z),
- cameraZoom*(10*rightVector.x + 0.25*upVector.x), cameraZoom*(10*rightVector.y + 0.25*upVector.y), cameraZoom*(10*rightVector.z + 0.25*upVector.z),
- cameraZoom*(10*rightVector.x + 0.251*upVector.x), cameraZoom*(10*rightVector.y + 0.251*upVector.y), cameraZoom*(10*rightVector.z + 0.251*upVector.z)
- ]
- effect: coordLinesThinEffect
- }
- Line {
- width: 1.0
- vertices: [
- cameraZoom*(-10*rightVector.x + 0.5*upVector.x), cameraZoom*(-10*rightVector.y + 0.5*upVector.y), cameraZoom*(-10*rightVector.z + 0.5*upVector.z),
- cameraZoom*(10*rightVector.x + 0.5*upVector.x), cameraZoom*(10*rightVector.y + 0.5*upVector.y), cameraZoom*(10*rightVector.z + 0.5*upVector.z),
- cameraZoom*(10*rightVector.x + 0.501*upVector.x), cameraZoom*(10*rightVector.y + 0.501*upVector.y), cameraZoom*(10*rightVector.z + 0.501*upVector.z)
- ]
- effect: coordLinesThinEffect
- }
- Line {
- width: 1.0
- vertices: [
- cameraZoom*(-10*rightVector.x + 0.75*upVector.x), cameraZoom*(-10*rightVector.y + 0.75*upVector.y), cameraZoom*(-10*rightVector.z + 0.75*upVector.z),
- cameraZoom*(10*rightVector.x + 0.75*upVector.x), cameraZoom*(10*rightVector.y + 0.75*upVector.y), cameraZoom*(10*rightVector.z + 0.75*upVector.z),
- cameraZoom*(10*rightVector.x + 0.751*upVector.x), cameraZoom*(10*rightVector.y + 0.751*upVector.y), cameraZoom*(10*rightVector.z + 0.751*upVector.z)
- ]
- effect: coordLinesThinEffect
- }
- Line {
- width: 1.0
- vertices: [
- cameraZoom*(-10*rightVector.x - 0.25*upVector.x), cameraZoom*(-10*rightVector.y - 0.25*upVector.y), cameraZoom*(-10*rightVector.z - 0.25*upVector.z),
- cameraZoom*(10*rightVector.x - 0.25*upVector.x), cameraZoom*(10*rightVector.y - 0.25*upVector.y), cameraZoom*(10*rightVector.z - 0.25*upVector.z),
- cameraZoom*(10*rightVector.x - 0.251*upVector.x), cameraZoom*(10*rightVector.y - 0.251*upVector.y), cameraZoom*(10*rightVector.z - 0.251*upVector.z)
- ]
- effect: coordLinesThinEffect
- }
- Line {
- width: 1.0
- vertices: [
- cameraZoom*(-10*rightVector.x - 0.5*upVector.x), cameraZoom*(-10*rightVector.y - 0.5*upVector.y), cameraZoom*(-10*rightVector.z - 0.5*upVector.z),
- cameraZoom*(10*rightVector.x - 0.5*upVector.x), cameraZoom*(10*rightVector.y - 0.5*upVector.y), cameraZoom*(10*rightVector.z - 0.5*upVector.z),
- cameraZoom*(10*rightVector.x - 0.501*upVector.x), cameraZoom*(10*rightVector.y - 0.501*upVector.y), cameraZoom*(10*rightVector.z - 0.501*upVector.z)
- ]
- effect: coordLinesThinEffect
- }
- Line {
- width: 1.0
- vertices: [
- cameraZoom*(-10*rightVector.x - 0.75*upVector.x), cameraZoom*(-10*rightVector.y - 0.75*upVector.y), cameraZoom*(-10*rightVector.z - 0.75*upVector.z),
- cameraZoom*(10*rightVector.x - 0.75*upVector.x), cameraZoom*(10*rightVector.y - 0.75*upVector.y), cameraZoom*(10*rightVector.z - 0.75*upVector.z),
- cameraZoom*(10*rightVector.x - 0.751*upVector.x), cameraZoom*(10*rightVector.y - 0.751*upVector.y), cameraZoom*(10*rightVector.z - 0.751*upVector.z)
- ]
- effect: coordLinesThinEffect
- }
-
- // vertical lines
- Line {
- id: lineAxisUp
- width: 3.0
- vertices: [
- cameraZoom*(-10*upVector.x), cameraZoom*(-10*upVector.y), cameraZoom*(-10*upVector.z),
- cameraZoom*(10*upVector.x), cameraZoom*(10*upVector.y), cameraZoom*(10*upVector.z),
- cameraZoom*(10*upVector.x + 0.01*rightVector.x), cameraZoom*(10*upVector.y + 0.01*rightVector.y), cameraZoom*(10*upVector.z + 0.01*rightVector.z)
- ]
- effect: coordLinesThickEffect
- }
- Line {
- width: 1.0
- vertices: [
- cameraZoom*(-10*upVector.x + 0.25*rightVector.x), cameraZoom*(-10*upVector.y + 0.25*rightVector.y), cameraZoom*(-10*upVector.z + 0.25*rightVector.z),
- cameraZoom*(10*upVector.x + 0.25*rightVector.x), cameraZoom*(10*upVector.y + 0.25*rightVector.y), cameraZoom*(10*upVector.z + 0.25*rightVector.z),
- cameraZoom*(10*upVector.x + 0.251*rightVector.x), cameraZoom*(10*upVector.y + 0.251*rightVector.y), cameraZoom*(10*upVector.z + 0.251*rightVector.z)
- ]
- effect: coordLinesThinEffect
- }
- Line {
- width: 1.0
- vertices: [
- cameraZoom*(-10*upVector.x + 0.5*rightVector.x), cameraZoom*(-10*upVector.y + 0.5*rightVector.y), cameraZoom*(-10*upVector.z + 0.5*rightVector.z),
- cameraZoom*(10*upVector.x + 0.5*rightVector.x), cameraZoom*(10*upVector.y + 0.5*rightVector.y), cameraZoom*(10*upVector.z + 0.5*rightVector.z),
- cameraZoom*(10*upVector.x + 0.501*rightVector.x), cameraZoom*(10*upVector.y + 0.501*rightVector.y), cameraZoom*(10*upVector.z + 0.501*rightVector.z)
- ]
- effect: coordLinesThinEffect
- }
- Line {
- width: 1.0
- vertices: [
- cameraZoom*(-10*upVector.x + 0.75*rightVector.x), cameraZoom*(-10*upVector.y + 0.75*rightVector.y), cameraZoom*(-10*upVector.z + 0.75*rightVector.z),
- cameraZoom*(10*upVector.x + 0.75*rightVector.x), cameraZoom*(10*upVector.y + 0.75*rightVector.y), cameraZoom*(10*upVector.z + 0.75*rightVector.z),
- cameraZoom*(10*upVector.x + 0.751*rightVector.x), cameraZoom*(10*upVector.y + 0.751*rightVector.y), cameraZoom*(10*upVector.z + 0.751*rightVector.z)
- ]
- effect: coordLinesThinEffect
- }
- Line {
- width: 1.0
- vertices: [
- cameraZoom*(-10*upVector.x + 1.00*rightVector.x), cameraZoom*(-10*upVector.y + 1.00*rightVector.y), cameraZoom*(-10*upVector.z + 1.00*rightVector.z),
- cameraZoom*(10*upVector.x + 1.00*rightVector.x), cameraZoom*(10*upVector.y + 1.00*rightVector.y), cameraZoom*(10*upVector.z + 1.00*rightVector.z),
- cameraZoom*(10*upVector.x + 1.001*rightVector.x), cameraZoom*(10*upVector.y + 1.001*rightVector.y), cameraZoom*(10*upVector.z + 1.001*rightVector.z)
- ]
- effect: coordLinesThinEffect
- }
- Line {
- width: 1.0
- vertices: [
- cameraZoom*(-10*upVector.x - 0.25*rightVector.x), cameraZoom*(-10*upVector.y - 0.25*rightVector.y), cameraZoom*(-10*upVector.z - 0.25*rightVector.z),
- cameraZoom*(10*upVector.x - 0.25*rightVector.x), cameraZoom*(10*upVector.y - 0.25*rightVector.y), cameraZoom*(10*upVector.z - 0.25*rightVector.z),
- cameraZoom*(10*upVector.x - 0.251*rightVector.x), cameraZoom*(10*upVector.y - 0.251*rightVector.y), cameraZoom*(10*upVector.z - 0.251*rightVector.z)
- ]
- effect: coordLinesThinEffect
- }
- Line {
- width: 1.0
- vertices: [
- cameraZoom*(-10*upVector.x - 0.5*rightVector.x), cameraZoom*(-10*upVector.y - 0.5*rightVector.y), cameraZoom*(-10*upVector.z - 0.5*rightVector.z),
- cameraZoom*(10*upVector.x - 0.5*rightVector.x), cameraZoom*(10*upVector.y - 0.5*rightVector.y), cameraZoom*(10*upVector.z - 0.5*rightVector.z),
- cameraZoom*(10*upVector.x - 0.501*rightVector.x), cameraZoom*(10*upVector.y - 0.501*rightVector.y), cameraZoom*(10*upVector.z - 0.501*rightVector.z)
- ]
- effect: coordLinesThinEffect
- }
- Line {
- width: 1.0
- vertices: [
- cameraZoom*(-10*upVector.x - 0.75*rightVector.x), cameraZoom*(-10*upVector.y - 0.75*rightVector.y), cameraZoom*(-10*upVector.z - 0.75*rightVector.z),
- cameraZoom*(10*upVector.x - 0.75*rightVector.x), cameraZoom*(10*upVector.y - 0.75*rightVector.y), cameraZoom*(10*upVector.z - 0.75*rightVector.z),
- cameraZoom*(10*upVector.x - 0.751*rightVector.x), cameraZoom*(10*upVector.y - 0.751*rightVector.y), cameraZoom*(10*upVector.z - 0.751*rightVector.z)
- ]
- effect: coordLinesThinEffect
- }
- Line {
- width: 1.0
- vertices: [
- cameraZoom*(-10*upVector.x - 1.00*rightVector.x), cameraZoom*(-10*upVector.y - 1.00*rightVector.y), cameraZoom*(-10*upVector.z - 1.00*rightVector.z),
- cameraZoom*(10*upVector.x - 1.00*rightVector.x), cameraZoom*(10*upVector.y - 1.00*rightVector.y), cameraZoom*(10*upVector.z - 1.00*rightVector.z),
- cameraZoom*(10*upVector.x - 1.001*rightVector.x), cameraZoom*(10*upVector.y - 1.001*rightVector.y), cameraZoom*(10*upVector.z - 1.001*rightVector.z)
- ]
- effect: coordLinesThinEffect
- }
-
- }
-
- MouseArea {
- property int mouseDown: Qt.NoButton
-
- anchors.fill: parent
- acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
-
- onMouseXChanged: {
- if (mouseDown & Qt.LeftButton)
- mouseTranslateX(mouse)
- else if (mouseDown === Qt.RightButton)
- mouseRotateX(mouse);
- else if (mouseDown === Qt.MiddleButton)
- mouseScaleX(mouse)
- }
-
- onMouseYChanged: {
- if (mouseDown & Qt.LeftButton)
- mouseTranslateY(mouse)
- else if (mouseDown === Qt.RightButton)
- mouseRotateY(mouse);
- else if (mouseDown === Qt.MiddleButton)
- mouseScaleY(mouse)
- }
-
- onPressed: {
- // if we already have a mouse button down we don't want to do anything else until it's up again
- if (mouseDown !== Qt.NoButton)
- return;
-
- mouseDown = mouse.button;
- down = Qt.point(mouse.x, mouse.y)
- translate = transformTranslate.translate
- rotate = Qt.vector3d(transformRotateX.angle, transformRotateY.angle, transformRotateZ.angle)
- scale3d = transformScale.scale
- }
-
- // clear the current mouse button upon release
- onReleased: { mouseDown = Qt.NoButton }
- }
-
- ModelViewportResize {
- anchors {
- top: view.top; topMargin: 2;
- right: view.right; rightMargin: 2;
- }
- }
-
- ZoomControls {
- anchors {
- top: view.top; topMargin: 24;
- right: view.right; rightMargin: 2;
- }
- onZoomIn: {
- cameraZoom = 0.5 * cameraZoom;
- }
- onZoomOut: {
- cameraZoom = 2.0 * cameraZoom;
- }
- }
-
- Text {
- id: viewportText
- anchors {
- top: view.top; topMargin: 4;
- left: view.left; leftMargin: 4;
- }
- color: "white"
- font.pixelSize: 16
- }
-
- // --------- grid text begin ---------
-
- property bool bTall: view.width<view.height;
- property int minimalDimension: (bTall) ? view.width : view.height;
- property int textStep: minimalDimension/8;
-
- // horizontal
-
- Text {
- id: h_minus100
- text: -1.0*cameraZoom
- x: view.width/2 - 4*textStep - 10
- y: (view.height/2) - 14
- color: "white"
- font.pixelSize: 12
- visible: bTall==false
- }
- Text {
- id: h_minus075
- text: -0.75*cameraZoom
- x: view.width/2 - 3*textStep - 10
- y: (view.height/2) - 14
- color: "white"
- font.pixelSize: 12
- }
- Text {
- id: h_minus050
- text: -0.5*cameraZoom
- x: view.width/2 - 2*textStep - 10
- y: (view.height/2) - 14
- color: "white"
- font.pixelSize: 12
- }
- Text {
- id: h_minus025
- text: -0.25*cameraZoom
- x: view.width/2 - textStep - 10
- y: (view.height/2) - 14
- color: "white"
- font.pixelSize: 12
- }
- Text {
- id: h_zero
- text: "0.0"
- x: (view.width/2) - 10
- y: (view.height/2) - 14
- color: "white"
- font.pixelSize: 12
- }
- Text {
- id: h_plus025
- text: 0.25*cameraZoom
- x: view.width/2 + textStep - 5
- y: (view.height/2) - 14
- color: "white"
- font.pixelSize: 12
- }
- Text {
- id: h_plus050
- text: 0.5*cameraZoom
- x: view.width/2 + 2*textStep - 5
- y: (view.height/2) - 14
- color: "white"
- font.pixelSize: 12
- }
- Text {
- id: h_plus075
- text: 0.75*cameraZoom
- x: view.width/2 + 3*textStep - 5
- y: (view.height/2) - 14
- color: "white"
- font.pixelSize: 12
- }
- Text {
- id: h_plus100
- text: 1.0*cameraZoom
- x: view.width/2 + 4*textStep
- y: (view.height/2) - 14
- color: "white"
- font.pixelSize: 12
- visible: bTall==false
- }
-
- // vertical
-
- Text {
- id: v_minus075
- text: -0.75*cameraZoom
- x: (view.width/2)
- y: view.height/2 - 3*textStep - 5
- color: "white"
- font.pixelSize: 12
- }
- Text {
- id: v_minus050
- text: -0.5*cameraZoom
- x: (view.width/2)
- y: view.height/2 - 2*textStep - 6
- color: "white"
- font.pixelSize: 12
- }
- Text {
- id: v_minus025
- text: -0.25*cameraZoom
- x: (view.width/2)
- y: view.height/2 - textStep - 7
- color: "white"
- font.pixelSize: 12
- }
- Text {
- id: v_plus025
- text: 0.25*cameraZoom
- x: (view.width/2)
- y: view.height/2 + textStep - 8
- color: "white"
- font.pixelSize: 12
- }
- Text {
- id: v_plus050
- text: 0.5*cameraZoom
- x: (view.width/2)
- y: view.height/2 + 2*textStep - 9
- color: "white"
- font.pixelSize: 12
- }
- Text {
- id: v_plus075
- text: 0.75*cameraZoom
- x: (view.width/2)
- y: view.height/2 + 3*textStep - 10
- color: "white"
- font.pixelSize: 12
- }
-
- // --------- grid text end ---------
-}
diff --git a/util/qt3d/assetviewer/qml/SaveButton.qml b/util/qt3d/assetviewer/qml/SaveButton.qml
deleted file mode 100644
index 7cf788b1..00000000
--- a/util/qt3d/assetviewer/qml/SaveButton.qml
+++ /dev/null
@@ -1,12 +0,0 @@
-import QtQuick 1.0
-import Qt3D 1.0
-import AssetViewer 1.0
-import "Widgets"
-import "fileHandling.js" as FileHandler
-
-
-BlenderToggle {
- onClicked: {
- FileHandler.save_qml(false);
- }
-}
diff --git a/util/qt3d/assetviewer/qml/Widgets/BlenderToggle.qml b/util/qt3d/assetviewer/qml/Widgets/BlenderToggle.qml
deleted file mode 100644
index a9258fc8..00000000
--- a/util/qt3d/assetviewer/qml/Widgets/BlenderToggle.qml
+++ /dev/null
@@ -1,48 +0,0 @@
-import QtQuick 1.0
-import Qt3D 1.0
-import AssetViewer 1.0
-
-Rectangle {
- anchors.topMargin: 15
- anchors.leftMargin: 15
- border.width: 1
- border.color: "#191919"
- radius: 8
- height: 20
- color: "#999999"
-
- property alias buttonText: text.text
- property alias imageSrc: img.source
- property alias textColor: text.color
-
- signal clicked
-
-
- Image {
- id: img
- anchors.left: parent.left
- anchors.leftMargin: 5
- anchors.verticalCenter: parent.verticalCenter
- }
-
- Text {
- id: text
- anchors.fill: parent
- font.pixelSize: 12
- anchors.left: img.left
- anchors.leftMargin: 5
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- }
-
- MouseArea {
- anchors.fill: parent
- onClicked: parent.clicked()
- onPressed: parent.color = "#646464"
- onReleased: parent.color = "#999999"
- hoverEnabled: true
- onEntered: parent.color = "#BEBEBE"
- onExited: parent.color = "#999999"
- }
-}
-
diff --git a/util/qt3d/assetviewer/qml/Widgets/Checkered.qml b/util/qt3d/assetviewer/qml/Widgets/Checkered.qml
deleted file mode 100644
index 49bf1d82..00000000
--- a/util/qt3d/assetviewer/qml/Widgets/Checkered.qml
+++ /dev/null
@@ -1,27 +0,0 @@
-import QtQuick 1.0
-
-Grid {
- property variant color1: "#FFFFFF"
- property variant color2: "#BBBBBB"
- property variant cellSize: 10
- width: 20
- height: parent.height
- clip: true
-
- rows: height/cellSize
- columns: width/cellSize
- Repeater {
- model: parent.rows * parent.columns
- Rectangle {
- width: cellSize; height: cellSize;
- color: {
- var check;
- if (columns%2) check = index;
- else check = Math.floor(index/columns)%2 + index;
-
- if (check%2) return color1;
- else return color2;
- }
- }
- }
-}
diff --git a/util/qt3d/assetviewer/qml/Widgets/ColorSelector.qml b/util/qt3d/assetviewer/qml/Widgets/ColorSelector.qml
deleted file mode 100644
index a55a743f..00000000
--- a/util/qt3d/assetviewer/qml/Widgets/ColorSelector.qml
+++ /dev/null
@@ -1,72 +0,0 @@
-import QtQuick 1.0
-
-Item {
- id: select
- property real sat: 1.0
- property real val: 1.0
- width: parent.width
- height: parent.height
-
- Binding {
- target: handle; property: "x"
- value: select.sat * select.width
- }
- Binding {
- target: select; property: "sat"
- value: handle.x/width
- }
-
- Binding {
- target: handle; property: "y"
- value: (1.0 - select.val) * select.height
- }
- Binding {
- target: select; property: "val"
- value: 1.0 - handle.y/height
- }
-
- Item {
- id: handle
- width: 20
- height: width
- x: 0.0; y: 0.0
-
- Rectangle {
- x: -width/2
- y: x
- width: parent.width-2
- height: width
- radius: width/2
-
- border.color: "white"
- color: "transparent"
- }
- Rectangle {
- x: -width/2
- y: x
- width: parent.width
- height: width
- radius: width/2
-
- border.width: 2
- border.color: "black"
- color: "transparent"
- }
- }
-
- MouseArea {
- anchors.fill: parent
- function mouseEvent(mouse) {
- if (mouse.buttons & Qt.LeftButton) {
- handle.x = Math.max(0, Math.min(height, mouse.x))
- handle.y = Math.max(0, Math.min(height, mouse.y))
- }
- }
- onPressed: mouseEvent(mouse);
- onPositionChanged: mouseEvent(mouse);
- hoverEnabled: true
- onEntered: handle.opacity = 0.5;
- onExited: { if (!pressed) handle.opacity = 1.0 }
- onReleased: { if (!containsMouse) handle.opacity = 1.0 }
- }
-}
diff --git a/util/qt3d/assetviewer/qml/Widgets/ColorWidget.qml b/util/qt3d/assetviewer/qml/Widgets/ColorWidget.qml
deleted file mode 100644
index f60ff1b0..00000000
--- a/util/qt3d/assetviewer/qml/Widgets/ColorWidget.qml
+++ /dev/null
@@ -1,37 +0,0 @@
-import QtQuick 1.0
-
-Item {
- id: colorWidget
- width: parent.width; height: 16
-
- property variant targetColor
- property alias text: flatText.text
-
- Rectangle {
- height: 2
- anchors {
- left: parent.left; right: flatSet.right
- bottom: parent.bottom
- rightMargin: flatSet.width/2
- }
- color: colorWidget.targetColor.color
- }
- Text {
- id: flatText
- anchors { top: parent.top; left: parent.left }
- text:"Color"
- color: "white"
- }
- BlenderToggle {
- id: flatSet
- width: 32
- anchors { right: parent.right }
- height: parent.height
- buttonText: "Set"
- radius: 6
- onClicked: {
- colorPicker.setTarget(colorWidget.targetColor);
- colorPicker.visible = true
- }
- }
-}
diff --git a/util/qt3d/assetviewer/qml/Widgets/HSVColor.qml b/util/qt3d/assetviewer/qml/Widgets/HSVColor.qml
deleted file mode 100644
index 9e137428..00000000
--- a/util/qt3d/assetviewer/qml/Widgets/HSVColor.qml
+++ /dev/null
@@ -1,15 +0,0 @@
-import QtQuick 1.0
-import "../ColorUtils.js" as ColorUtils
-
-Item {
- property real hue: 0.0
- property real sat: 0.0
- property real val: 1.0
- property real alpha: 1.0
- property color color: ColorUtils.hsvToColor(hue, sat, val, alpha)
- property int red: rgb[0]
- property int green: rgb[1]
- property int blue: rgb[2]
-
- property variant rgb: ColorUtils.hsvToRgb(hue, sat, val)
-}
diff --git a/util/qt3d/assetviewer/qml/Widgets/InputBox.qml b/util/qt3d/assetviewer/qml/Widgets/InputBox.qml
deleted file mode 100644
index d3d31837..00000000
--- a/util/qt3d/assetviewer/qml/Widgets/InputBox.qml
+++ /dev/null
@@ -1,39 +0,0 @@
-import QtQuick 1.0
-
-Item {
- id: textInput
- width: 60
- height: 20
- property alias label: lbl.text
- property alias input: inputBox
-
-// Binding {
-// target: textInput; property: "value"
-// value: inputBox.text
-// }
-// Binding {
-// target: inputBox; property: "text"
-// value: { var result = textInput.value*100; return Math.round(result)/100 }
-// }
-
- Text {
- id: lbl
- color: "lightgray"
- anchors.left: parent.left
- }
-
- Rectangle {
- border.color: "gray"
- color: "transparent"
- width: 40
- height: inputBox.height
- anchors.right: parent.right
- TextInput {
- id: inputBox
- anchors { fill: parent; leftMargin: 5 }
- color: "white"
- text: { var result = textInput.value*100; return Math.round(result)/100 }
- selectByMouse: true; readOnly: true
- }
- }
-}
diff --git a/util/qt3d/assetviewer/qml/Widgets/ModelViewportResize.qml b/util/qt3d/assetviewer/qml/Widgets/ModelViewportResize.qml
deleted file mode 100644
index 96e8a2d6..00000000
--- a/util/qt3d/assetviewer/qml/Widgets/ModelViewportResize.qml
+++ /dev/null
@@ -1,30 +0,0 @@
-import QtQuick 1.0
-import Qt3D 1.0
-import AssetViewer 1.0
-
-Rectangle {
- radius: 4
- border.width: 1
- border.color: "#191919"
- width: 16 + 2
- height: 16 + 2
- color: "#999999"
-
- Image {
- id: img
- source: mainwindow.state !== "3Views" ? "images/shrink.png" : "images/grow.png"
- x: 2
- y: 2
- MouseArea {
- anchors.fill: parent
- onClicked: {
- if (view.stateName) {
- if (mainwindow.state !== "3Views")
- mainwindow.state = "3Views"
- else
- mainwindow.state = view.stateName
- }
- }
- }
- }
-}
diff --git a/util/qt3d/assetviewer/qml/Widgets/SliderHandle.qml b/util/qt3d/assetviewer/qml/Widgets/SliderHandle.qml
deleted file mode 100644
index 9f72cabc..00000000
--- a/util/qt3d/assetviewer/qml/Widgets/SliderHandle.qml
+++ /dev/null
@@ -1,76 +0,0 @@
-import QtQuick 1.0
-
-Item {
- id: slider
- width: parent.width
- height: parent.height
- property real value: 0.0
- property bool inverted: false
- property bool horizontal: false
-
- signal changed;
-
- Binding {
- target: slider; property: "value"
- value: {
- var res;
- var pos = horizontal ? handle.x : handle.y;
- var delta = horizontal ? width-handle.width : height-handle.height;
- res = pos/delta;
- return inverted ? 1-res : res
- }
- }
- Binding {
- target: handle; property: "y"
- value: {
- var res = inverted ? 1 - slider.value : slider.value
- if (!horizontal) return res*(height-handle.height);
- }
- }
- Binding {
- target: handle; property: "x"
- value: {
- var res = inverted ? 1 - slider.value : slider.value
- if (horizontal) return res*(width-handle.width);
- }
- }
-
- Rectangle {
- id: handle
- width: 8 + (horizontal ? 0 : parent.width)
- height: 8 + (!horizontal ? 0 : parent.height)
- anchors.horizontalCenter: horizontal ? undefined : parent.horizontalCenter
- anchors.verticalCenter: !horizontal ? undefined : parent.verticalCenter
- radius: 2
- Behavior on opacity {
- NumberAnimation { easing.type: Easing.InOutQuad; duration: 80 }
- }
- gradient: Gradient {
- GradientStop { position: 0.0; color: "#FFFFFF" }
- GradientStop { position: 1.0; color: "#FFFFFF" }
- }
- border.width: 1
- border.color: "darkgray"
- onXChanged: slider.changed()
- onYChanged: slider.changed()
- }
-
- MouseArea {
- id: mouseArea
- anchors.fill: parent
- function mouseEvent(mouse) {
- if (mouse.buttons & Qt.LeftButton) {
- if (horizontal)
- handle.x = Math.max(0, Math.min(width-handle.width, mouse.x-handle.width/2))
- else
- handle.y = Math.max(0, Math.min(height-handle.height, mouse.y-handle.height/2));
- }
- }
- onPressed: mouseEvent(mouse);
- onPositionChanged: mouseEvent(mouse);
- hoverEnabled: true
- onEntered: handle.opacity = 0.5;
- onExited: { if (!pressed) handle.opacity = 1.0 }
- onReleased: { if (!containsMouse) handle.opacity = 1.0 }
- }
-}
diff --git a/util/qt3d/assetviewer/qml/Widgets/ZoomControls.qml b/util/qt3d/assetviewer/qml/Widgets/ZoomControls.qml
deleted file mode 100644
index 7ad01ce0..00000000
--- a/util/qt3d/assetviewer/qml/Widgets/ZoomControls.qml
+++ /dev/null
@@ -1,41 +0,0 @@
-import QtQuick 1.0
-import Qt3D 1.0
-import AssetViewer 1.0
-
-Rectangle {
- radius: 4
- border.width: 1
- border.color: "#191919"
- width: 16 + 2
- height: 16 + 2 + 16 + 2
- color: "#999999"
-
- signal zoomIn()
- signal zoomOut()
-
- Image {
- id: imgIn
- source: "images/zoomin.png"
- x: 2
- y: 2
- MouseArea {
- anchors.fill: parent
- onClicked: {
- zoomIn()
- }
- }
- }
-
- Image {
- id: imgOut
- source: "images/zoomout.png"
- x: 2
- y: 20
- MouseArea {
- anchors.fill: parent
- onClicked: {
- zoomOut()
- }
- }
- }
-}
diff --git a/util/qt3d/assetviewer/qml/Widgets/images/grow.png b/util/qt3d/assetviewer/qml/Widgets/images/grow.png
deleted file mode 100644
index df154010..00000000
--- a/util/qt3d/assetviewer/qml/Widgets/images/grow.png
+++ /dev/null
Binary files differ
diff --git a/util/qt3d/assetviewer/qml/Widgets/images/shrink.png b/util/qt3d/assetviewer/qml/Widgets/images/shrink.png
deleted file mode 100644
index 285d3a9d..00000000
--- a/util/qt3d/assetviewer/qml/Widgets/images/shrink.png
+++ /dev/null
Binary files differ
diff --git a/util/qt3d/assetviewer/qml/Widgets/images/zoomin.png b/util/qt3d/assetviewer/qml/Widgets/images/zoomin.png
deleted file mode 100644
index e4434a07..00000000
--- a/util/qt3d/assetviewer/qml/Widgets/images/zoomin.png
+++ /dev/null
Binary files differ
diff --git a/util/qt3d/assetviewer/qml/Widgets/images/zoomout.png b/util/qt3d/assetviewer/qml/Widgets/images/zoomout.png
deleted file mode 100644
index 4c853bc6..00000000
--- a/util/qt3d/assetviewer/qml/Widgets/images/zoomout.png
+++ /dev/null
Binary files differ
diff --git a/util/qt3d/assetviewer/qml/fileHandling.js b/util/qt3d/assetviewer/qml/fileHandling.js
deleted file mode 100644
index 6ccfb1a1..00000000
--- a/util/qt3d/assetviewer/qml/fileHandling.js
+++ /dev/null
@@ -1,106 +0,0 @@
-function save_qml(closePrompt) {
-
- var effectData = "";
- if (useCustomEffect) {
- effectData +=
- " effect: Effect {\n" +
- " decal: " + customEffect.decal + "\n" +
- " blending: " + customEffect.blending + "\n";
-
- if (useCustomMaterial) {
- effectData +=
- " material: Material {\n" +
- " ambientColor: \"" + modelMaterial.ambientColor + "\"\n" +
- " diffuseColor: \"" + modelMaterial.diffuseColor + "\"\n" +
- " specularColor: \"" + modelMaterial.specularColor + "\"\n" +
- " shininess: " + modelMaterial.shininess + "\n" +
- " textureUrl: \"" + modelMaterial.textureUrl + "\"\n" +
- " }\n"
- } else {
- effectData +=
- " color: \"" + modelEffect.color + "\"\n" +
- " texture: \"" + modelEffect.texture + "\"\n"
- }
-
- effectData += " }\n"
- }
-
- var saveData =
- "// --------| WARNING |--------!!\n" +
- "// This is a generated file. Modifying the text or layout of \n" +
- "// this file will mean that the 3D Asset Viewer application will no \n" +
- "// longer be able to read it. \n\n" +
- "// Changing numeric values is allowable, though care should be taken\n" +
- "// not to inadvertantly change the file structure.\n\n" +
- "import QtQuick 1.0\n" +
- "import Qt3D 1.0\n" +
- "\n" +
- "Item3D {\n" +
- " property double translateX: 0; \n"+
- " property double translateY: 0; \n"+
- " property double translateZ: 0; \n"+
- " property double rotationX: 0; \n"+
- " property double rotationY: 0; \n"+
- " property double rotationZ: 0; \n"+
- " property double assetScale: 1.0; \n"+
-
- " Translation3D {\n" +
- " id: transformTranslate\n" +
- " translate: Qt.vector3d(" +
- transformTranslate.translate.x + "+translateX, " +
- transformTranslate.translate.y + "+translateY, " +
- transformTranslate.translate.z + "+translateZ)\n" +
- " }\n" +
- "\n" +
- " Rotation3D {\n" +
- " id: transformRotateX\n" +
- " angle: " + transformRotateX.angle + "+rotationX\n" +
- " axis: Qt.vector3d(1, 0, 0)\n" +
- " }\n" +
- "\n" +
- " Rotation3D {\n" +
- " id: transformRotateY\n" +
- " angle: " + transformRotateY.angle + "+rotationY\n" +
- " axis: Qt.vector3d(0, 1, 0)\n" +
- " }\n" +
- "\n" +
- " Rotation3D {\n" +
- " id: transformRotateZ\n" +
- " angle: " + transformRotateZ.angle + "+rotationZ\n" +
- " axis: Qt.vector3d(0, 0, 1)\n" +
- " }\n" +
- "\n" +
- " Scale3D {\n" +
- " id: transformScale\n" +
- " scale: Qt.vector3d(" +
- transformScale.scale.x + "*assetScale, " +
- transformScale.scale.y + "*assetScale, " +
- transformScale.scale.z + "*assetScale)\n" +
- " }\n" +
- "\n" +
- " Mesh {\n" +
- " id: source_mesh\n" +
- " source: \"%1\"\n" +
- " }\n" +
- "\n" +
- " mesh: source_mesh\n" +
- " transform: [\n" +
- " transformScale,\n" +
- " transformRotateX,\n" +
- " transformRotateY,\n" +
- " transformRotateZ,\n" +
- " transformTranslate,\n" +
- " ]\n" +
- effectData +
- "}\n";
-
- quickFile.filename = source_mesh.source
- quickFile.data = saveData
- if (closePrompt)
- var result = quickFile.promptSave()
- else
- result = quickFile.save()
-
- if (result !== "")
- console.log("If there was an error it will be after here:" + result)
-}
diff --git a/util/qt3d/assetviewer/qml/images/help.png b/util/qt3d/assetviewer/qml/images/help.png
deleted file mode 100644
index 452ac525..00000000
--- a/util/qt3d/assetviewer/qml/images/help.png
+++ /dev/null
Binary files differ
diff --git a/util/qt3d/assetviewer/qml/images/lock.png b/util/qt3d/assetviewer/qml/images/lock.png
deleted file mode 100644
index cafd8fc5..00000000
--- a/util/qt3d/assetviewer/qml/images/lock.png
+++ /dev/null
Binary files differ
diff --git a/util/qt3d/assetviewer/qml/images/minus.png b/util/qt3d/assetviewer/qml/images/minus.png
deleted file mode 100644
index a93156ea..00000000
--- a/util/qt3d/assetviewer/qml/images/minus.png
+++ /dev/null
Binary files differ
diff --git a/util/qt3d/assetviewer/qml/images/model.png b/util/qt3d/assetviewer/qml/images/model.png
deleted file mode 100644
index 62054e3c..00000000
--- a/util/qt3d/assetviewer/qml/images/model.png
+++ /dev/null
Binary files differ
diff --git a/util/qt3d/assetviewer/qml/images/open.png b/util/qt3d/assetviewer/qml/images/open.png
deleted file mode 100644
index 5db00d52..00000000
--- a/util/qt3d/assetviewer/qml/images/open.png
+++ /dev/null
Binary files differ
diff --git a/util/qt3d/assetviewer/qml/images/plus.png b/util/qt3d/assetviewer/qml/images/plus.png
deleted file mode 100644
index b1ba3774..00000000
--- a/util/qt3d/assetviewer/qml/images/plus.png
+++ /dev/null
Binary files differ
diff --git a/util/qt3d/assetviewer/qml/images/save.png b/util/qt3d/assetviewer/qml/images/save.png
deleted file mode 100644
index e1db4498..00000000
--- a/util/qt3d/assetviewer/qml/images/save.png
+++ /dev/null
Binary files differ
diff --git a/util/qt3d/assetviewer/qml/images/unlock.png b/util/qt3d/assetviewer/qml/images/unlock.png
deleted file mode 100644
index 80c3f945..00000000
--- a/util/qt3d/assetviewer/qml/images/unlock.png
+++ /dev/null
Binary files differ
diff --git a/util/qt3d/assetviewer/qml/meshes/monkey.3ds b/util/qt3d/assetviewer/qml/meshes/monkey.3ds
deleted file mode 100644
index e9a007b2..00000000
--- a/util/qt3d/assetviewer/qml/meshes/monkey.3ds
+++ /dev/null
Binary files differ
diff --git a/util/qt3d/assetviewer/qml/meshes/penguin.3ds b/util/qt3d/assetviewer/qml/meshes/penguin.3ds
deleted file mode 100644
index 26c09ac0..00000000
--- a/util/qt3d/assetviewer/qml/meshes/penguin.3ds
+++ /dev/null
Binary files differ
diff --git a/util/qt3d/assetviewer/qtquick3d.ico b/util/qt3d/assetviewer/qtquick3d.ico
deleted file mode 100644
index c695ac72..00000000
--- a/util/qt3d/assetviewer/qtquick3d.ico
+++ /dev/null
Binary files differ
diff --git a/util/qt3d/assetviewer/qtquick3d.png b/util/qt3d/assetviewer/qtquick3d.png
deleted file mode 100644
index 8351083e..00000000
--- a/util/qt3d/assetviewer/qtquick3d.png
+++ /dev/null
Binary files differ
diff --git a/util/qt3d/assetviewer/quickfile.cpp b/util/qt3d/assetviewer/quickfile.cpp
deleted file mode 100644
index 3fead170..00000000
--- a/util/qt3d/assetviewer/quickfile.cpp
+++ /dev/null
@@ -1,163 +0,0 @@
-#include "quickfile.h"
-#include <QFileDialog>
-#include <QUrl>
- #include <QMessageBox>
-
-/*!
- \qmlclass QuickFile QuickFile
- \brief QuickFile is a quick-and-dirty file handling object that supports file-io that QML/Javascript doesn't.
- \inherits QObject
-
- The QuickFile element is part of the \c{ModelTweak} namespace,
- so the following must appear at the top of any QML file that
- references it:
-
- \code
- import ModelTweak 1.0
- \endcode
-
- \sa QObject
-*/
-
-/*!
- \internal
-*/
-QuickFile::QuickFile(QObject *parent) :
- QObject(parent)
-{
-}
-
-/*!
- Prompts for a location and filename to save the qml \c{QuickFile::data} generated by ModelTweaker.
- Returns an error message if the file was unsuccessfully saved,
- or an empty string if the save was successful/cancelled.
-*/
-QString QuickFile::save() const
-{
- QString filename = QFileDialog::getSaveFileName(0, tr("Save QML File"), "",tr("Files (*.qml)"));
-
- //If cancel button pressed (ie. filename empty), we can just drop out immediately
- if (filename.isEmpty()) {
- return QString();
- }
-
- // FIXME: ensure fileName is appropriate as a qml Component
- if (!filename.endsWith(".qml"))
- filename.append(".qml");
-
- QDir outputDir = QFileInfo(filename).absoluteDir();
-
- QString modelFilename = QUrl(_filename).toLocalFile();
- QString modelFN = QFileInfo(modelFilename).fileName();
-
- QString dstModelLocation = outputDir.path() + QDir::separator() + modelFN;
- if (dstModelLocation.compare(modelFilename,Qt::CaseInsensitive) != 0) {
- // src and dst model paths are different.
- // Copy model file over.
- qDebug("Attempting to copy:");
- qDebug(" from: %s",modelFilename.toAscii().constData());
- qDebug(" to : %s",dstModelLocation.toAscii().constData());
- QFile dstModelFile(dstModelLocation);
- if (dstModelFile.exists()) {
- if (!dstModelFile.remove()) {
- qDebug(" failed to remove dst file!");
- }
- }
- QFile srcModelFile(modelFilename);
- if (srcModelFile.copy(dstModelLocation)) {
- qDebug(" Model was copied successfully.");
- } else {
- qDebug(" failed to copy model file !");
- }
- }
-
- QFile file(filename);
-
- qDebug("Attempting to write: %s", file.fileName().toAscii().constData());
-
- if (!file.open(QFile::WriteOnly))
- return file.errorString();
-
- QString dataToWrite = _data.arg(modelFN);
-
- file.write(dataToWrite.toUtf8());
-
- file.close();
-
- return QString();
-}
-
-/*!
- Save/Close dialog for unsaved changes to QML files. This is shown if the user
- closes the app without saving the modifications they have made.
-
- Returns an error message if the file was unsuccessfully saved,
- or an empty string if the save was successful/cancelled.
-*/
-QString QuickFile::promptSave() const
-{
- QMessageBox msgBox;
- msgBox.setText("The document has been modified.");
- msgBox.setInformativeText("Do you want to save your changes?");
- msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard);
- msgBox.setDefaultButton(QMessageBox::Save);
- int ret = msgBox.exec();
-
- if (ret==QMessageBox::Save) {
- return save();
- } else {
- return QString();
- }
-}
-
-/*!
- Prompts for a location to load a model file from and stores it into the the \c{QuickFile::filename}
- variable.
-*/
-void QuickFile::load()
-{
- QString qmlFilename = QFileDialog::getOpenFileName(0, _title, "", _filter);
- setFilename(qmlFilename);
-}
-
-
-QString QuickFile::filename() const {
- return _filename;
-}
-
-void QuickFile::setFilename(const QString filename) {
- if (_filename != filename)
- _filename = filename;
- emit filenameChanged(filename);
-}
-
-QString QuickFile::title() const {
- return _title;
-}
-
-void QuickFile::setTitle(const QString title) {
- if (_title != title)
- _title = title;
- emit titleChanged(title);
-}
-
-QString QuickFile::filter() const {
- return _filter;
-}
-
-void QuickFile::setFilter(const QString filter) {
- if (_filter != filter)
- _filter = filter;
- emit filterChanged(filter);
-}
-
-QString QuickFile::data() const {
- return _data;
-}
-
-void QuickFile::setData(const QString data) {
- if (_data != data)
- _data = data;
- emit dataChanged(data);
-}
-
diff --git a/util/qt3d/assetviewer/quickfile.h b/util/qt3d/assetviewer/quickfile.h
deleted file mode 100644
index 1c66c60b..00000000
--- a/util/qt3d/assetviewer/quickfile.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef QUICKFILE_H
-#define QUICKFILE_H
-
-#include <QObject>
-
-class QuickFile : public QObject
-{
- Q_OBJECT
-
- QString _filename;
- QString _title;
- QString _filter;
- QString _data;
-
- Q_PROPERTY(QString filename READ filename WRITE setFilename NOTIFY filenameChanged)
- Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)
- Q_PROPERTY(QString filter READ filter WRITE setFilter NOTIFY filterChanged)
- Q_PROPERTY(QString data READ data WRITE setData NOTIFY dataChanged)
-
-public:
- explicit QuickFile(QObject *parent = 0);
-
- QString filename() const;
- void setFilename(const QString filename);
-
- QString title() const;
- void setTitle(const QString title);
-
- QString filter() const;
- void setFilter(const QString filter);
-
- QString data() const;
- void setData(const QString data);
-
- Q_INVOKABLE QString save() const;
- Q_INVOKABLE void load();
- Q_INVOKABLE QString promptSave() const;
-
-signals:
- void filenameChanged(const QString newFilename);
- void titleChanged(const QString newTitle);
- void filterChanged(const QString newFilter);
- void dataChanged(const QString newData);
-};
-
-#endif // QUICKFILE_H