Merge remote-tracking branch 'hifi/master' into android_ui_not_move_camera

This commit is contained in:
Cristian Luis Duarte 2018-03-28 16:47:21 -03:00
commit f0bcaa47c8
28 changed files with 472 additions and 407 deletions

View file

@ -39,6 +39,7 @@ set(BUILD_TOOLS_OPTION ON)
set(BUILD_INSTALLER_OPTION ON) set(BUILD_INSTALLER_OPTION ON)
set(GLES_OPTION OFF) set(GLES_OPTION OFF)
set(DISABLE_QML_OPTION OFF) set(DISABLE_QML_OPTION OFF)
set(DOWNLOAD_SERVERLESS_CONTENT_OPTION OFF)
if (ANDROID OR UWP) if (ANDROID OR UWP)
set(BUILD_SERVER_OPTION OFF) set(BUILD_SERVER_OPTION OFF)
@ -74,6 +75,11 @@ option(BUILD_INSTALLER "Build installer" ${BUILD_INSTALLER_OPTION})
option(USE_GLES "Use OpenGL ES" ${GLES_OPTION}) option(USE_GLES "Use OpenGL ES" ${GLES_OPTION})
option(DISABLE_QML "Disable QML" ${DISABLE_QML_OPTION}) option(DISABLE_QML "Disable QML" ${DISABLE_QML_OPTION})
option(DISABLE_KTX_CACHE "Disable KTX Cache" OFF) option(DISABLE_KTX_CACHE "Disable KTX Cache" OFF)
option(
DOWNLOAD_SERVERLESS_CONTENT
"Download and setup default serverless content beside Interface"
${DOWNLOAD_SERVERLESS_CONTENT_OPTION}
)
set(PLATFORM_QT_GL OpenGL) set(PLATFORM_QT_GL OpenGL)
@ -88,12 +94,13 @@ foreach(PLATFORM_QT_COMPONENT ${PLATFORM_QT_COMPONENTS})
list(APPEND PLATFORM_QT_LIBRARIES "Qt5::${PLATFORM_QT_COMPONENT}") list(APPEND PLATFORM_QT_LIBRARIES "Qt5::${PLATFORM_QT_COMPONENT}")
endforeach() endforeach()
MESSAGE(STATUS "Build server: " ${BUILD_SERVER}) MESSAGE(STATUS "Build server: " ${BUILD_SERVER})
MESSAGE(STATUS "Build client: " ${BUILD_CLIENT}) MESSAGE(STATUS "Build client: " ${BUILD_CLIENT})
MESSAGE(STATUS "Build tests: " ${BUILD_TESTS}) MESSAGE(STATUS "Build tests: " ${BUILD_TESTS})
MESSAGE(STATUS "Build tools: " ${BUILD_TOOLS}) MESSAGE(STATUS "Build tools: " ${BUILD_TOOLS})
MESSAGE(STATUS "Build installer: " ${BUILD_INSTALLER}) MESSAGE(STATUS "Build installer: " ${BUILD_INSTALLER})
MESSAGE(STATUS "GL ES: " ${USE_GLES}) MESSAGE(STATUS "GL ES: " ${USE_GLES})
MESSAGE(STATUS "DL serverless content: " ${DOWNLOAD_SERVERLESS_CONTENT})
if (DISABLE_QML) if (DISABLE_QML)
MESSAGE(STATUS "QML disabled!") MESSAGE(STATUS "QML disabled!")

View file

@ -0,0 +1,16 @@
include(ExternalProject)
set(EXTERNAL_NAME serverless-content)
ExternalProject_Add(
${EXTERNAL_NAME}
URL http://cdn.highfidelity.com/content-sets/serverless-tutorial-RC66.zip
URL_MD5 91edfde96e06efc847ca327ab97f4c74
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
LOG_DOWNLOAD 1
)
# Hide this external target (for IDE users)
set_target_properties(${EXTERNAL_NAME} PROPERTIES FOLDER "hidden/externals")

View file

@ -73,6 +73,11 @@ macro(SET_PACKAGING_PARAMETERS)
add_definitions(-DDEV_BUILD) add_definitions(-DDEV_BUILD)
endif () endif ()
if (DEPLOY_PACKAGE)
# for deployed packages always grab the serverless content
set(DOWNLOAD_SERVERLESS_CONTENT ON)
endif ()
if (APPLE) if (APPLE)
set(DMG_SUBFOLDER_NAME "${BUILD_ORGANIZATION}") set(DMG_SUBFOLDER_NAME "${BUILD_ORGANIZATION}")

View file

@ -43,7 +43,6 @@ endif()
list(APPEND GENERATE_QRC_DEPENDS ${RESOURCES_RCC}) list(APPEND GENERATE_QRC_DEPENDS ${RESOURCES_RCC})
add_custom_target(resources ALL DEPENDS ${GENERATE_QRC_DEPENDS}) add_custom_target(resources ALL DEPENDS ${GENERATE_QRC_DEPENDS})
# set a default root dir for each of our optional externals if it was not passed # set a default root dir for each of our optional externals if it was not passed
set(OPTIONAL_EXTERNALS "LeapMotion") set(OPTIONAL_EXTERNALS "LeapMotion")
@ -313,36 +312,41 @@ if (APPLE)
COMPONENT ${CLIENT_COMPONENT} COMPONENT ${CLIENT_COMPONENT}
) )
set(SCRIPTS_INSTALL_DIR "${INTERFACE_INSTALL_APP_PATH}/Contents/Resources") set(RESOURCES_INSTALL_DIR "${INTERFACE_INSTALL_APP_PATH}/Contents/Resources")
set(RESOURCES_DEV_DIR "$<TARGET_FILE_DIR:${TARGET_NAME}>/../Resources")
# copy script files beside the executable # copy script files beside the executable
add_custom_command(TARGET ${TARGET_NAME} POST_BUILD add_custom_command(TARGET ${TARGET_NAME} POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy_directory COMMAND "${CMAKE_COMMAND}" -E copy_directory
"${CMAKE_SOURCE_DIR}/scripts" "${CMAKE_SOURCE_DIR}/scripts"
"$<TARGET_FILE_DIR:${TARGET_NAME}>/../Resources/scripts" "${RESOURCES_DEV_DIR}/scripts"
) )
# call the fixup_interface macro to add required bundling commands for installation # call the fixup_interface macro to add required bundling commands for installation
fixup_interface() fixup_interface()
else() else()
set(RESOURCES_DEV_DIR "$<TARGET_FILE_DIR:${TARGET_NAME}>/resources")
# copy the resources files beside the executable # copy the resources files beside the executable
add_custom_command(TARGET ${TARGET_NAME} POST_BUILD add_custom_command(TARGET ${TARGET_NAME} POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy_if_different COMMAND "${CMAKE_COMMAND}" -E copy_if_different
"${RESOURCES_RCC}" "${RESOURCES_RCC}"
"$<TARGET_FILE_DIR:interface>" "$<TARGET_FILE_DIR:interface>"
# FIXME, the edit script code loads HTML from the scripts folder # FIXME, the edit script code loads HTML from the scripts folder
# which in turn relies on CSS that refers to the fonts. In theory # which in turn relies on CSS that refers to the fonts. In theory
# we should be able to modify the CSS to reference the QRC path to # we should be able to modify the CSS to reference the QRC path to
# the ttf files, but doing so generates a CORS policy violation, # the ttf files, but doing so generates a CORS policy violation,
# so we have to retain a copy of the fonts outside of the resources binary # so we have to retain a copy of the fonts outside of the resources binary
COMMAND "${CMAKE_COMMAND}" -E copy_directory COMMAND "${CMAKE_COMMAND}" -E copy_directory
"${PROJECT_SOURCE_DIR}/resources/fonts" "${PROJECT_SOURCE_DIR}/resources/fonts"
"$<TARGET_FILE_DIR:${TARGET_NAME}>/resources/fonts" "$<TARGET_FILE_DIR:${TARGET_NAME}>/resources/fonts"
COMMAND "${CMAKE_COMMAND}" -E copy_directory COMMAND "${CMAKE_COMMAND}" -E copy_directory
"${CMAKE_SOURCE_DIR}/scripts" "${CMAKE_SOURCE_DIR}/scripts"
"$<TARGET_FILE_DIR:${TARGET_NAME}>/scripts" "${RESOURCES_DEV_DIR}/scripts"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
"${PROJECT_SOURCE_DIR}/resources/serverless/tutorial.json"
"$<TARGET_FILE_DIR:${TARGET_NAME}>/resources/serverless/tutorial.json"
) )
# link target to external libraries # link target to external libraries
@ -359,7 +363,7 @@ else()
PATTERN "*.exp" EXCLUDE PATTERN "*.exp" EXCLUDE
) )
set(SCRIPTS_INSTALL_DIR "${INTERFACE_INSTALL_DIR}") set(RESOURCES_INSTALL_DIR "${INTERFACE_INSTALL_DIR}")
set(EXECUTABLE_COMPONENT ${CLIENT_COMPONENT}) set(EXECUTABLE_COMPONENT ${CLIENT_COMPONENT})
@ -367,16 +371,28 @@ else()
endif() endif()
endif() endif()
if (SCRIPTS_INSTALL_DIR) if (RESOURCES_INSTALL_DIR)
# setup install of scripts beside interface executable # setup install of scripts beside interface executable
install( install(
DIRECTORY "${CMAKE_SOURCE_DIR}/scripts/" DIRECTORY "${CMAKE_SOURCE_DIR}/scripts/"
DESTINATION ${SCRIPTS_INSTALL_DIR}/scripts DESTINATION ${RESOURCES_INSTALL_DIR}/scripts
COMPONENT ${CLIENT_COMPONENT} COMPONENT ${CLIENT_COMPONENT}
) )
endif() endif()
if (DOWNLOAD_SERVERLESS_CONTENT)
add_dependency_external_projects(serverless-content)
ExternalProject_Get_Property(serverless-content SOURCE_DIR)
# for dev builds, copy the serverless content to the resources folder
add_custom_command(TARGET ${TARGET_NAME} POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy_directory
"${SOURCE_DIR}"
"${RESOURCES_DEV_DIR}/serverless"
)
endif ()
if (WIN32) if (WIN32)
set(EXTRA_DEPLOY_OPTIONS "--qmldir \"${PROJECT_SOURCE_DIR}/resources/qml\"") set(EXTRA_DEPLOY_OPTIONS "--qmldir \"${PROJECT_SOURCE_DIR}/resources/qml\"")

View file

@ -1,15 +1,10 @@
{ {
"name": "Keyboard/Mouse to Actions", "name": "Keyboard/Mouse to Actions",
"channels": [ "channels": [
{ "from": "Keyboard.A", "when": "Keyboard.Shift", "to": "Actions.LATERAL_LEFT" },
{ "from": "Keyboard.D", "when": "Keyboard.Shift", "to": "Actions.LATERAL_RIGHT" },
{ "from": "Keyboard.A", "when": "Keyboard.RightMouseButton", "to": "Actions.LATERAL_LEFT" }, { "from": "Keyboard.A", "when": "Keyboard.RightMouseButton", "to": "Actions.LATERAL_LEFT" },
{ "from": "Keyboard.D", "when": "Keyboard.RightMouseButton", "to": "Actions.LATERAL_RIGHT" }, { "from": "Keyboard.D", "when": "Keyboard.RightMouseButton", "to": "Actions.LATERAL_RIGHT" },
{ "from": "Keyboard.E", "when": "Keyboard.Shift", "to": "Actions.BOOM_IN", "filters": [ { "type": "scale", "scale": 0.05 } ] }, { "from": "Keyboard.E", "to": "Actions.LATERAL_RIGHT" },
{ "from": "Keyboard.C", "when": "Keyboard.Shift", "to": "Actions.BOOM_OUT", "filters": [ { "type": "scale", "scale": 0.05 } ] }, { "from": "Keyboard.Q", "to": "Actions.LATERAL_LEFT" },
{ "from": "Keyboard.S", "when": "Keyboard.Shift", "to": "Actions.PITCH_DOWN" },
{ "from": "Keyboard.W", "when": "Keyboard.Shift", "to": "Actions.PITCH_UP" },
{ "comment" : "Mouse turn need to be small continuous increments", { "comment" : "Mouse turn need to be small continuous increments",
@ -44,9 +39,24 @@
] ]
}, },
{ "from": { "makeAxis" : [ { "from": { "makeAxis" : [
["Keyboard.A", "Keyboard.Left" ], ["Keyboard.Left" ],
["Keyboard.D", "Keyboard.Right"] ["Keyboard.Right"]
]
},
"when": ["Application.InHMD", "Application.SnapTurn", "!Keyboard.Shift"],
"to": "Actions.StepYaw",
"filters":
[
{ "type": "pulse", "interval": 0.5, "resetOnZero": true },
{ "type": "scale", "scale": 22.5 }
]
},
{ "from": { "makeAxis" : [
["Keyboard.A"],
["Keyboard.D"]
] ]
}, },
"when": [ "Application.InHMD", "Application.SnapTurn" ], "when": [ "Application.InHMD", "Application.SnapTurn" ],
@ -59,26 +69,39 @@
}, },
{ "from": { "makeAxis" : [ { "from": { "makeAxis" : [
["Keyboard.A", "Keyboard.Left", "Keyboard.TouchpadLeft"], ["Keyboard.Left"],
["Keyboard.D", "Keyboard.Right", "Keyboard.TouchpadRight"] ["Keyboard.Right"]
]
},
"when": ["Application.CameraFirstPerson", "!Keyboard.Shift"],
"to": "Actions.Yaw"
},
{ "from": { "makeAxis" : [
["Keyboard.Left"],
["Keyboard.Right"]
]
},
"when": ["Application.CameraThirdPerson", "!Keyboard.Shift"],
"to": "Actions.Yaw"
},
{ "from": { "makeAxis" : [
["Keyboard.A", "Keyboard.TouchpadLeft"],
["Keyboard.D", "Keyboard.TouchpadRight"]
] ]
}, },
"when": "Application.CameraFirstPerson", "when": "Application.CameraFirstPerson",
"to": "Actions.Yaw" "to": "Actions.Yaw"
}, },
{ "from": { "makeAxis" : [ { "from": { "makeAxis" : [
["Keyboard.A", "Keyboard.Left", "Keyboard.TouchpadLeft"], ["Keyboard.A", "Keyboard.TouchpadLeft"],
["Keyboard.D", "Keyboard.Right", "Keyboard.TouchpadRight"] ["Keyboard.D", "Keyboard.TouchpadRight"]
] ]
}, },
"when": "Application.CameraThirdPerson", "when": "Application.CameraThirdPerson",
"to": "Actions.Yaw" "to": "Actions.Yaw"
}, },
{ "from": { "makeAxis" : [ ["Keyboard.A"], ["Keyboard.D"] ] },
"when": "Application.CameraFSM",
"to": "Actions.Yaw"
},
{ "from": { "makeAxis" : ["Keyboard.MouseMoveLeft", "Keyboard.MouseMoveRight"] }, { "from": { "makeAxis" : ["Keyboard.MouseMoveLeft", "Keyboard.MouseMoveRight"] },
"when": "Keyboard.RightMouseButton", "when": "Keyboard.RightMouseButton",
"to": "Actions.Yaw", "to": "Actions.Yaw",
@ -90,14 +113,10 @@
{ "from": "Keyboard.W", "when": "!Keyboard.Control", "to": "Actions.LONGITUDINAL_FORWARD" }, { "from": "Keyboard.W", "when": "!Keyboard.Control", "to": "Actions.LONGITUDINAL_FORWARD" },
{ "from": "Keyboard.S", "when": "!Keyboard.Control", "to": "Actions.LONGITUDINAL_BACKWARD" }, { "from": "Keyboard.S", "when": "!Keyboard.Control", "to": "Actions.LONGITUDINAL_BACKWARD" },
{ "from": "Keyboard.C", "to": "Actions.VERTICAL_DOWN" }, { "from": "Keyboard.Shift", "when": ["!Keyboard.Left", "!Keyboard.Right"], "to": "Actions.SPRINT" },
{ "from": "Keyboard.E", "to": "Actions.VERTICAL_UP" }, { "from": "Keyboard.Control", "to": "Actions.VERTICAL_DOWN" },
{ "from": "Keyboard.Left", "when": "Keyboard.RightMouseButton", "to": "Actions.LATERAL_LEFT" },
{ "from": "Keyboard.Right", "when": "Keyboard.RightMouseButton", "to": "Actions.LATERAL_RIGHT" },
{ "from": "Keyboard.Left", "when": "Keyboard.Shift", "to": "Actions.LATERAL_LEFT" }, { "from": "Keyboard.Left", "when": "Keyboard.Shift", "to": "Actions.LATERAL_LEFT" },
{ "from": "Keyboard.Right", "when": "Keyboard.Shift", "to": "Actions.LATERAL_RIGHT" }, { "from": "Keyboard.Right", "when": "Keyboard.Shift", "to": "Actions.LATERAL_RIGHT" },
{ "from": "Keyboard.Down", "when": "Keyboard.Shift", "to": "Actions.PITCH_DOWN" },
{ "from": "Keyboard.Up", "when": "Keyboard.Shift", "to": "Actions.PITCH_UP" },
{ "from": "Keyboard.Up", "when": "Application.CameraFirstPerson", "to": "Actions.LONGITUDINAL_FORWARD" }, { "from": "Keyboard.Up", "when": "Application.CameraFirstPerson", "to": "Actions.LONGITUDINAL_FORWARD" },
{ "from": "Keyboard.Up", "when": "Application.CameraThirdPerson", "to": "Actions.LONGITUDINAL_FORWARD" }, { "from": "Keyboard.Up", "when": "Application.CameraThirdPerson", "to": "Actions.LONGITUDINAL_FORWARD" },
{ "from": "Keyboard.Down", "when": "Application.CameraFirstPerson", "to": "Actions.LONGITUDINAL_BACKWARD" }, { "from": "Keyboard.Down", "when": "Application.CameraFirstPerson", "to": "Actions.LONGITUDINAL_BACKWARD" },
@ -128,7 +147,7 @@
{ "from": "Keyboard.MouseWheelLeft", "to": "Actions.BOOM_OUT", "filters": [ { "type": "scale", "scale": 0.02 } ]}, { "from": "Keyboard.MouseWheelLeft", "to": "Actions.BOOM_OUT", "filters": [ { "type": "scale", "scale": 0.02 } ]},
{ "from": "Keyboard.MouseWheelRight", "to": "Actions.BOOM_IN", "filters": [ { "type": "scale", "scale": 0.02 } ]}, { "from": "Keyboard.MouseWheelRight", "to": "Actions.BOOM_IN", "filters": [ { "type": "scale", "scale": 0.02 } ]},
{ "from": "Keyboard.Space", "to": "Actions.SHIFT" }, { "from": "Keyboard.Space", "to": "Actions.VERTICAL_UP" },
{ "from": "Keyboard.R", "to": "Actions.ACTION1" }, { "from": "Keyboard.R", "to": "Actions.ACTION1" },
{ "from": "Keyboard.T", "to": "Actions.ACTION2" }, { "from": "Keyboard.T", "to": "Actions.ACTION2" },
{ "from": "Keyboard.Tab", "to": "Actions.ContextMenu" } { "from": "Keyboard.Tab", "to": "Actions.ContextMenu" }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 215 KiB

After

Width:  |  Height:  |  Size: 241 KiB

View file

@ -270,7 +270,9 @@ ModalWindow {
onTriggered: { onTriggered: {
root.result = null; root.result = null;
root.canceled(); root.canceled();
root.destroy(); // FIXME we are leaking memory to avoid a crash
// root.destroy();
visible = false;
} }
} }
@ -292,7 +294,9 @@ ModalWindow {
} }
root.result = JSON.stringify(result); root.result = JSON.stringify(result);
root.selected(root.result); root.selected(root.result);
root.destroy(); // FIXME we are leaking memory to avoid a crash
// root.destroy();
visible = false;
} }
} }
} }

View file

@ -169,7 +169,9 @@ ModalWindow {
shortcut: Qt.Key_Escape shortcut: Qt.Key_Escape
onTriggered: { onTriggered: {
root.canceled(); root.canceled();
root.destroy(); // FIXME we are leaking memory to avoid a crash
// root.destroy();
visible = false;
} }
} }
Action { Action {
@ -179,7 +181,9 @@ ModalWindow {
onTriggered: { onTriggered: {
root.result = items ? comboBox.currentText : textResult.text root.result = items ? comboBox.currentText : textResult.text
root.selected(root.result); root.selected(root.result);
root.destroy(); // FIXME we are leaking memory to avoid a crash
// root.destroy();
visible = false;
} }
} }
} }

View file

@ -24,6 +24,7 @@ Windows.ScrollingWindow {
objectName: "AssetServer" objectName: "AssetServer"
title: "Asset Browser" title: "Asset Browser"
resizable: true resizable: true
opacity: parent.opacity
destroyOnHidden: true destroyOnHidden: true
implicitWidth: 384; implicitHeight: 640 implicitWidth: 384; implicitHeight: 640
minSize: Qt.vector2d(200, 300) minSize: Qt.vector2d(200, 300)
@ -57,7 +58,7 @@ Windows.ScrollingWindow {
Component.onDestruction: { Component.onDestruction: {
assetMappingsModel.autoRefreshEnabled = false; assetMappingsModel.autoRefreshEnabled = false;
} }
function letterbox(headerGlyph, headerText, message) { function letterbox(headerGlyph, headerText, message) {
letterboxMessage.headerGlyph = headerGlyph; letterboxMessage.headerGlyph = headerGlyph;
letterboxMessage.headerText = headerText; letterboxMessage.headerText = headerText;
@ -144,7 +145,7 @@ Windows.ScrollingWindow {
function canAddToWorld(path) { function canAddToWorld(path) {
var supportedExtensions = [/\.fbx\b/i, /\.obj\b/i, /\.jpg\b/i, /\.png\b/i]; var supportedExtensions = [/\.fbx\b/i, /\.obj\b/i, /\.jpg\b/i, /\.png\b/i];
if (selectedItemCount > 1) { if (selectedItemCount > 1) {
return false; return false;
} }
@ -153,8 +154,8 @@ Windows.ScrollingWindow {
return total | new RegExp(current).test(path); return total | new RegExp(current).test(path);
}, false); }, false);
} }
function canRename() { function canRename() {
if (treeView.selection.hasSelection && selectedItemCount == 1) { if (treeView.selection.hasSelection && selectedItemCount == 1) {
return true; return true;
} else { } else {
@ -198,7 +199,7 @@ Windows.ScrollingWindow {
var SHAPE_TYPE_STATIC_MESH = 3; var SHAPE_TYPE_STATIC_MESH = 3;
var SHAPE_TYPE_BOX = 4; var SHAPE_TYPE_BOX = 4;
var SHAPE_TYPE_SPHERE = 5; var SHAPE_TYPE_SPHERE = 5;
var SHAPE_TYPES = []; var SHAPE_TYPES = [];
SHAPE_TYPES[SHAPE_TYPE_NONE] = "No Collision"; SHAPE_TYPES[SHAPE_TYPE_NONE] = "No Collision";
SHAPE_TYPES[SHAPE_TYPE_SIMPLE_HULL] = "Basic - Whole model"; SHAPE_TYPES[SHAPE_TYPE_SIMPLE_HULL] = "Basic - Whole model";
@ -206,7 +207,7 @@ Windows.ScrollingWindow {
SHAPE_TYPES[SHAPE_TYPE_STATIC_MESH] = "Exact - All polygons"; SHAPE_TYPES[SHAPE_TYPE_STATIC_MESH] = "Exact - All polygons";
SHAPE_TYPES[SHAPE_TYPE_BOX] = "Box"; SHAPE_TYPES[SHAPE_TYPE_BOX] = "Box";
SHAPE_TYPES[SHAPE_TYPE_SPHERE] = "Sphere"; SHAPE_TYPES[SHAPE_TYPE_SPHERE] = "Sphere";
var SHAPE_TYPE_DEFAULT = SHAPE_TYPE_SIMPLE_COMPOUND; var SHAPE_TYPE_DEFAULT = SHAPE_TYPE_SIMPLE_COMPOUND;
var DYNAMIC_DEFAULT = false; var DYNAMIC_DEFAULT = false;
var prompt = desktop.customInputDialog({ var prompt = desktop.customInputDialog({
@ -348,14 +349,14 @@ Windows.ScrollingWindow {
} }
function deleteFile(index) { function deleteFile(index) {
var paths = []; var paths = [];
if (!index) { if (!index) {
for (var i = 0; i < selectedItemCount; ++i) { for (var i = 0; i < selectedItemCount; ++i) {
index = treeView.selection.selectedIndexes[i]; index = treeView.selection.selectedIndexes[i];
paths[i] = assetProxyModel.data(index, 0x100); paths[i] = assetProxyModel.data(index, 0x100);
} }
} }
if (!paths) { if (!paths) {
return; return;
} }
@ -364,13 +365,13 @@ Windows.ScrollingWindow {
var items = selectedItemCount.toString(); var items = selectedItemCount.toString();
var isFolder = assetProxyModel.data(treeView.selection.currentIndex, 0x101); var isFolder = assetProxyModel.data(treeView.selection.currentIndex, 0x101);
var typeString = isFolder ? 'folder' : 'file'; var typeString = isFolder ? 'folder' : 'file';
if (selectedItemCount > 1) { if (selectedItemCount > 1) {
modalMessage = "You are about to delete " + items + " items \nDo you want to continue?"; modalMessage = "You are about to delete " + items + " items \nDo you want to continue?";
} else { } else {
modalMessage = "You are about to delete the following " + typeString + ":\n" + paths + "\nDo you want to continue?"; modalMessage = "You are about to delete the following " + typeString + ":\n" + paths + "\nDo you want to continue?";
} }
var object = desktop.messageBox({ var object = desktop.messageBox({
icon: hifi.icons.question, icon: hifi.icons.question,
buttons: OriginalDialogs.StandardButton.Yes + OriginalDialogs.StandardButton.No, buttons: OriginalDialogs.StandardButton.Yes + OriginalDialogs.StandardButton.No,
@ -475,11 +476,11 @@ Windows.ScrollingWindow {
}); });
} }
} }
Item { Item {
width: pane.contentWidth width: pane.contentWidth
height: pane.height height: pane.height
// The letterbox used for popup messages // The letterbox used for popup messages
LetterboxMessage { LetterboxMessage {
id: letterboxMessage; id: letterboxMessage;
@ -541,7 +542,7 @@ Windows.ScrollingWindow {
anchors.margins: hifi.dimensions.contentMargin.x + 2 // Extra for border anchors.margins: hifi.dimensions.contentMargin.x + 2 // Extra for border
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
treeModel: assetProxyModel treeModel: assetProxyModel
selectionMode: SelectionMode.ExtendedSelection selectionMode: SelectionMode.ExtendedSelection
headerVisible: true headerVisible: true
@ -561,9 +562,13 @@ Windows.ScrollingWindow {
id: bakedColumn id: bakedColumn
title: "Use Baked?" title: "Use Baked?"
role: "baked" role: "baked"
width: 100 width: 170
} }
onSortIndicatorOrderChanged: {
Assets.sortProxyModel(sortIndicatorColumn, sortIndicatorOrder);
}
itemDelegate: Loader { itemDelegate: Loader {
id: itemDelegateLoader id: itemDelegateLoader
@ -599,7 +604,7 @@ Windows.ScrollingWindow {
} }
sourceComponent: getComponent() sourceComponent: getComponent()
Component { Component {
id: labelComponent id: labelComponent
FiraSansSemiBold { FiraSansSemiBold {
@ -608,15 +613,15 @@ Windows.ScrollingWindow {
color: colorScheme == hifi.colorSchemes.light color: colorScheme == hifi.colorSchemes.light
? (styleData.selected ? hifi.colors.black : hifi.colors.baseGrayHighlight) ? (styleData.selected ? hifi.colors.black : hifi.colors.baseGrayHighlight)
: (styleData.selected ? hifi.colors.black : hifi.colors.lightGrayText) : (styleData.selected ? hifi.colors.black : hifi.colors.lightGrayText)
horizontalAlignment: styleData.column === 1 ? TextInput.AlignHCenter : TextInput.AlignLeft horizontalAlignment: styleData.column === 1 ? TextInput.AlignHCenter : TextInput.AlignLeft
elide: Text.ElideMiddle elide: Text.ElideMiddle
MouseArea { MouseArea {
id: mouseArea id: mouseArea
anchors.fill: parent anchors.fill: parent
acceptedButtons: Qt.NoButton acceptedButtons: Qt.NoButton
hoverEnabled: true hoverEnabled: true
@ -638,7 +643,7 @@ Windows.ScrollingWindow {
color: colorScheme == hifi.colorSchemes.light color: colorScheme == hifi.colorSchemes.light
? (styleData.selected ? hifi.colors.black : hifi.colors.baseGrayHighlight) ? (styleData.selected ? hifi.colors.black : hifi.colors.baseGrayHighlight)
: (styleData.selected ? hifi.colors.black : hifi.colors.lightGrayText) : (styleData.selected ? hifi.colors.black : hifi.colors.lightGrayText)
elide: Text.ElideRight elide: Text.ElideRight
horizontalAlignment: TextInput.AlignHCenter horizontalAlignment: TextInput.AlignHCenter
@ -725,7 +730,7 @@ Windows.ScrollingWindow {
size: hifi.fontSizes.tableText size: hifi.fontSizes.tableText
color: colorScheme == hifi.colorSchemes.light ? hifi.colors.black : hifi.colors.lightGrayText color: colorScheme == hifi.colorSchemes.light ? hifi.colors.black : hifi.colors.lightGrayText
} }
Timer { Timer {
id: showTimer id: showTimer
interval: 1000 interval: 1000
@ -744,7 +749,7 @@ Windows.ScrollingWindow {
treeLabelToolTip.visible = false; treeLabelToolTip.visible = false;
} }
}// End_OF( treeLabelToolTip ) }// End_OF( treeLabelToolTip )
MouseArea { MouseArea {
propagateComposedEvents: true propagateComposedEvents: true
anchors.fill: parent anchors.fill: parent
@ -802,7 +807,7 @@ Windows.ScrollingWindow {
anchors.left: treeView.left anchors.left: treeView.left
anchors.right: treeView.right anchors.right: treeView.right
anchors.bottom: uploadSection.top anchors.bottom: uploadSection.top
RalewayRegular { RalewayRegular {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@ -846,7 +851,7 @@ Windows.ScrollingWindow {
checked = Qt.binding(isChecked); checked = Qt.binding(isChecked);
} }
function isEnabled() { function isEnabled() {
if (!treeView.selection.hasSelection) { if (!treeView.selection.hasSelection) {
return false; return false;
@ -870,7 +875,7 @@ Windows.ScrollingWindow {
} }
} }
return true; return true;
} }
function isChecked() { function isChecked() {
if (!treeView.selection.hasSelection) { if (!treeView.selection.hasSelection) {
@ -878,10 +883,10 @@ Windows.ScrollingWindow {
} }
var status = assetProxyModel.data(treeView.selection.currentIndex, 0x105); var status = assetProxyModel.data(treeView.selection.currentIndex, 0x105);
return isEnabled() && status !== "Not Baked"; return isEnabled() && status !== "Not Baked";
} }
} }
Item { Item {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
width: infoGlyph.size; width: infoGlyph.size;
@ -905,7 +910,7 @@ Windows.ScrollingWindow {
"What is baking?", "What is baking?",
"Baking compresses and optimizes files for faster network transfer and display. We recommend you bake your content to reduce initial load times for your visitors."); "Baking compresses and optimizes files for faster network transfer and display. We recommend you bake your content to reduce initial load times for your visitors.");
} }
} }
}// End_OF( infoRow ) }// End_OF( infoRow )
HifiControls.ContentSection { HifiControls.ContentSection {

View file

@ -1160,14 +1160,14 @@ Rectangle {
function authSuccessStep() { function authSuccessStep() {
if (!root.debugCheckoutSuccess) { if (!root.debugCheckoutSuccess) {
root.activeView = "checkoutMain"; root.activeView = "checkoutMain";
} else {
root.activeView = "checkoutSuccess";
root.ownershipStatusReceived = false; root.ownershipStatusReceived = false;
Commerce.alreadyOwned(root.itemId); Commerce.alreadyOwned(root.itemId);
root.availableUpdatesReceived = false; root.availableUpdatesReceived = false;
Commerce.getAvailableUpdates(root.itemId); Commerce.getAvailableUpdates(root.itemId);
root.balanceReceived = false; root.balanceReceived = false;
Commerce.balance(); Commerce.balance();
} else {
root.activeView = "checkoutSuccess";
} }
} }

View file

@ -25,6 +25,7 @@ ScrollingWindow {
resizable: true resizable: true
destroyOnHidden: false destroyOnHidden: false
implicitWidth: 424 implicitWidth: 424
opacity: parent.opacity
implicitHeight: isHMD ? 695 : 728 implicitHeight: isHMD ? 695 : 728
minSize: Qt.vector2d(424, 300) minSize: Qt.vector2d(424, 300)

View file

@ -58,7 +58,7 @@ Rectangle {
Component.onDestruction: { Component.onDestruction: {
assetMappingsModel.autoRefreshEnabled = false; assetMappingsModel.autoRefreshEnabled = false;
} }
function letterbox(headerGlyph, headerText, message) { function letterbox(headerGlyph, headerText, message) {
letterboxMessage.headerGlyph = headerGlyph; letterboxMessage.headerGlyph = headerGlyph;
letterboxMessage.headerText = headerText; letterboxMessage.headerText = headerText;
@ -66,7 +66,7 @@ Rectangle {
letterboxMessage.visible = true; letterboxMessage.visible = true;
letterboxMessage.popupRadius = 0; letterboxMessage.popupRadius = 0;
} }
function errorMessageBox(message) { function errorMessageBox(message) {
return tabletRoot.messageBox({ return tabletRoot.messageBox({
icon: hifi.icons.warning, icon: hifi.icons.warning,
@ -145,7 +145,7 @@ Rectangle {
function canAddToWorld(path) { function canAddToWorld(path) {
var supportedExtensions = [/\.fbx\b/i, /\.obj\b/i, /\.jpg\b/i, /\.png\b/i]; var supportedExtensions = [/\.fbx\b/i, /\.obj\b/i, /\.jpg\b/i, /\.png\b/i];
if (selectedItemCount > 1) { if (selectedItemCount > 1) {
return false; return false;
} }
@ -154,8 +154,8 @@ Rectangle {
return total | new RegExp(current).test(path); return total | new RegExp(current).test(path);
}, false); }, false);
} }
function canRename() { function canRename() {
if (treeView.selection.hasSelection && selectedItemCount == 1) { if (treeView.selection.hasSelection && selectedItemCount == 1) {
return true; return true;
} else { } else {
@ -199,7 +199,7 @@ Rectangle {
var SHAPE_TYPE_STATIC_MESH = 3; var SHAPE_TYPE_STATIC_MESH = 3;
var SHAPE_TYPE_BOX = 4; var SHAPE_TYPE_BOX = 4;
var SHAPE_TYPE_SPHERE = 5; var SHAPE_TYPE_SPHERE = 5;
var SHAPE_TYPES = []; var SHAPE_TYPES = [];
SHAPE_TYPES[SHAPE_TYPE_NONE] = "No Collision"; SHAPE_TYPES[SHAPE_TYPE_NONE] = "No Collision";
SHAPE_TYPES[SHAPE_TYPE_SIMPLE_HULL] = "Basic - Whole model"; SHAPE_TYPES[SHAPE_TYPE_SIMPLE_HULL] = "Basic - Whole model";
@ -207,7 +207,7 @@ Rectangle {
SHAPE_TYPES[SHAPE_TYPE_STATIC_MESH] = "Exact - All polygons"; SHAPE_TYPES[SHAPE_TYPE_STATIC_MESH] = "Exact - All polygons";
SHAPE_TYPES[SHAPE_TYPE_BOX] = "Box"; SHAPE_TYPES[SHAPE_TYPE_BOX] = "Box";
SHAPE_TYPES[SHAPE_TYPE_SPHERE] = "Sphere"; SHAPE_TYPES[SHAPE_TYPE_SPHERE] = "Sphere";
var SHAPE_TYPE_DEFAULT = SHAPE_TYPE_SIMPLE_COMPOUND; var SHAPE_TYPE_DEFAULT = SHAPE_TYPE_SIMPLE_COMPOUND;
var DYNAMIC_DEFAULT = false; var DYNAMIC_DEFAULT = false;
var prompt = tabletRoot.customInputDialog({ var prompt = tabletRoot.customInputDialog({
@ -349,14 +349,14 @@ Rectangle {
} }
function deleteFile(index) { function deleteFile(index) {
var paths = []; var paths = [];
if (!index) { if (!index) {
for (var i = 0; i < selectedItemCount; ++i) { for (var i = 0; i < selectedItemCount; ++i) {
index = treeView.selection.selectedIndexes[i]; index = treeView.selection.selectedIndexes[i];
paths[i] = assetProxyModel.data(index, 0x100); paths[i] = assetProxyModel.data(index, 0x100);
} }
} }
if (!paths) { if (!paths) {
return; return;
} }
@ -365,7 +365,7 @@ Rectangle {
var items = selectedItemCount.toString(); var items = selectedItemCount.toString();
var isFolder = assetProxyModel.data(treeView.selection.currentIndex, 0x101); var isFolder = assetProxyModel.data(treeView.selection.currentIndex, 0x101);
var typeString = isFolder ? 'folder' : 'file'; var typeString = isFolder ? 'folder' : 'file';
if (selectedItemCount > 1) { if (selectedItemCount > 1) {
modalMessage = "You are about to delete " + items + " items \nDo you want to continue?"; modalMessage = "You are about to delete " + items + " items \nDo you want to continue?";
} else { } else {
@ -476,7 +476,7 @@ Rectangle {
}); });
} }
} }
// The letterbox used for popup messages // The letterbox used for popup messages
LetterboxMessage { LetterboxMessage {
id: letterboxMessage; id: letterboxMessage;
@ -540,7 +540,7 @@ Rectangle {
anchors.margins: hifi.dimensions.contentMargin.x + 2 // Extra for border anchors.margins: hifi.dimensions.contentMargin.x + 2 // Extra for border
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
treeModel: assetProxyModel treeModel: assetProxyModel
selectionMode: SelectionMode.ExtendedSelection selectionMode: SelectionMode.ExtendedSelection
headerVisible: true headerVisible: true
@ -560,9 +560,13 @@ Rectangle {
id: bakedColumn id: bakedColumn
title: "Use Baked?" title: "Use Baked?"
role: "baked" role: "baked"
width: 100 width: 170
} }
onSortIndicatorOrderChanged: {
Assets.sortProxyModel(sortIndicatorColumn, sortIndicatorOrder);
}
itemDelegate: Loader { itemDelegate: Loader {
id: itemDelegateLoader id: itemDelegateLoader
@ -598,7 +602,7 @@ Rectangle {
} }
sourceComponent: getComponent() sourceComponent: getComponent()
Component { Component {
id: labelComponent id: labelComponent
FiraSansSemiBold { FiraSansSemiBold {
@ -607,15 +611,15 @@ Rectangle {
color: colorScheme == hifi.colorSchemes.light color: colorScheme == hifi.colorSchemes.light
? (styleData.selected ? hifi.colors.black : hifi.colors.baseGrayHighlight) ? (styleData.selected ? hifi.colors.black : hifi.colors.baseGrayHighlight)
: (styleData.selected ? hifi.colors.black : hifi.colors.lightGrayText) : (styleData.selected ? hifi.colors.black : hifi.colors.lightGrayText)
horizontalAlignment: styleData.column === 1 ? TextInput.AlignHCenter : TextInput.AlignLeft horizontalAlignment: styleData.column === 1 ? TextInput.AlignHCenter : TextInput.AlignLeft
elide: Text.ElideMiddle elide: Text.ElideMiddle
MouseArea { MouseArea {
id: mouseArea id: mouseArea
anchors.fill: parent anchors.fill: parent
acceptedButtons: Qt.NoButton acceptedButtons: Qt.NoButton
hoverEnabled: true hoverEnabled: true
@ -637,7 +641,7 @@ Rectangle {
color: colorScheme == hifi.colorSchemes.light color: colorScheme == hifi.colorSchemes.light
? (styleData.selected ? hifi.colors.black : hifi.colors.baseGrayHighlight) ? (styleData.selected ? hifi.colors.black : hifi.colors.baseGrayHighlight)
: (styleData.selected ? hifi.colors.black : hifi.colors.lightGrayText) : (styleData.selected ? hifi.colors.black : hifi.colors.lightGrayText)
elide: Text.ElideRight elide: Text.ElideRight
horizontalAlignment: TextInput.AlignHCenter horizontalAlignment: TextInput.AlignHCenter
@ -724,7 +728,7 @@ Rectangle {
size: hifi.fontSizes.tableText size: hifi.fontSizes.tableText
color: colorScheme == hifi.colorSchemes.light ? hifi.colors.black : hifi.colors.lightGrayText color: colorScheme == hifi.colorSchemes.light ? hifi.colors.black : hifi.colors.lightGrayText
} }
Timer { Timer {
id: showTimer id: showTimer
interval: 1000 interval: 1000
@ -743,7 +747,7 @@ Rectangle {
treeLabelToolTip.visible = false; treeLabelToolTip.visible = false;
} }
}// End_OF( treeLabelToolTip ) }// End_OF( treeLabelToolTip )
MouseArea { MouseArea {
propagateComposedEvents: true propagateComposedEvents: true
anchors.fill: parent anchors.fill: parent
@ -801,7 +805,7 @@ Rectangle {
anchors.left: treeView.left anchors.left: treeView.left
anchors.right: treeView.right anchors.right: treeView.right
anchors.bottomMargin: hifi.dimensions.contentSpacing.y anchors.bottomMargin: hifi.dimensions.contentSpacing.y
RalewayRegular { RalewayRegular {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@ -845,7 +849,7 @@ Rectangle {
checked = Qt.binding(isChecked); checked = Qt.binding(isChecked);
} }
function isEnabled() { function isEnabled() {
if (!treeView.selection.hasSelection) { if (!treeView.selection.hasSelection) {
return false; return false;
@ -869,7 +873,7 @@ Rectangle {
} }
} }
return true; return true;
} }
function isChecked() { function isChecked() {
if (!treeView.selection.hasSelection) { if (!treeView.selection.hasSelection) {
@ -877,10 +881,10 @@ Rectangle {
} }
var status = assetProxyModel.data(treeView.selection.currentIndex, 0x105); var status = assetProxyModel.data(treeView.selection.currentIndex, 0x105);
return isEnabled() && status !== "Not Baked"; return isEnabled() && status !== "Not Baked";
} }
} }
Item { Item {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
width: infoGlyph.size; width: infoGlyph.size;
@ -904,7 +908,7 @@ Rectangle {
"What is baking?", "What is baking?",
"Baking compresses and optimizes files for faster network transfer and display. We recommend you bake your content to reduce initial load times for your visitors."); "Baking compresses and optimizes files for faster network transfer and display. We recommend you bake your content to reduce initial load times for your visitors.");
} }
} }
}// End_OF( infoRow ) }// End_OF( infoRow )
HifiControls.TabletContentSection { HifiControls.TabletContentSection {

View file

@ -113,7 +113,6 @@ StackView {
id: addressBarDialog id: addressBarDialog
property bool keyboardEnabled: false property bool keyboardEnabled: false
property bool keyboardRaised: false
property bool punctuationMode: false property bool punctuationMode: false
width: parent.width width: parent.width
@ -401,11 +400,10 @@ StackView {
addressLine.text = ""; addressLine.text = "";
} }
} }
HifiControls.Keyboard { HifiControls.Keyboard {
id: keyboard id: keyboard
raised: parent.keyboardEnabled && parent.keyboardRaised raised: parent.keyboardEnabled
numeric: parent.punctuationMode numeric: parent.punctuationMode
anchors { anchors {
bottom: parent.bottom bottom: parent.bottom
@ -413,7 +411,7 @@ StackView {
right: parent.right right: parent.right
} }
} }
} }
function updateLocationText(enteringAddress) { function updateLocationText(enteringAddress) {

View file

@ -0,0 +1,18 @@
{
"Entities": [
{
"type": "Box",
"dimensions": {
"x": 20,
"y": 1,
"z": 20
},
"position" : {
"x": 0,
"y": -12,
"z": 0
}
}
],
"Version": 84
}

View file

@ -353,7 +353,7 @@ static const QString WEB_VIEW_TAG = "noDownload=true";
static const QString ZIP_EXTENSION = ".zip"; static const QString ZIP_EXTENSION = ".zip";
static const QString CONTENT_ZIP_EXTENSION = ".content.zip"; static const QString CONTENT_ZIP_EXTENSION = ".content.zip";
static const float MIRROR_FULLSCREEN_DISTANCE = 0.389f; static const float MIRROR_FULLSCREEN_DISTANCE = 0.789f;
static const quint64 TOO_LONG_SINCE_LAST_SEND_DOWNSTREAM_AUDIO_STATS = 1 * USECS_PER_SECOND; static const quint64 TOO_LONG_SINCE_LAST_SEND_DOWNSTREAM_AUDIO_STATS = 1 * USECS_PER_SECOND;
@ -941,7 +941,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
_constrainToolbarPosition("toolbar/constrainToolbarToCenterX", true), _constrainToolbarPosition("toolbar/constrainToolbarToCenterX", true),
_preferredCursor("preferredCursor", DEFAULT_CURSOR_NAME), _preferredCursor("preferredCursor", DEFAULT_CURSOR_NAME),
_scaleMirror(1.0f), _scaleMirror(1.0f),
_rotateMirror(0.0f), _mirrorYawOffset(0.0f),
_raiseMirror(0.0f), _raiseMirror(0.0f),
_enableProcessOctreeThread(true), _enableProcessOctreeThread(true),
_lastNackTime(usecTimestampNow()), _lastNackTime(usecTimestampNow()),
@ -959,8 +959,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
setProperty(hifi::properties::STEAM, (steamClient && steamClient->isRunning())); setProperty(hifi::properties::STEAM, (steamClient && steamClient->isRunning()));
setProperty(hifi::properties::CRASHED, _previousSessionCrashed); setProperty(hifi::properties::CRASHED, _previousSessionCrashed);
_entityClipboard->setIsServerlessMode(true);
{ {
const QString TEST_SCRIPT = "--testScript"; const QString TEST_SCRIPT = "--testScript";
const QString TRACE_FILE = "--traceFile"; const QString TRACE_FILE = "--traceFile";
@ -2813,8 +2811,9 @@ void Application::updateCamera(RenderArgs& renderArgs, float deltaTime) {
} }
else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) { else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
_thirdPersonHMDCameraBoomValid= false; _thirdPersonHMDCameraBoomValid= false;
if (isHMDMode()) { if (isHMDMode()) {
auto mirrorBodyOrientation = myAvatar->getWorldOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f)); auto mirrorBodyOrientation = myAvatar->getWorldOrientation() * glm::quat(glm::vec3(0.0f, PI + _mirrorYawOffset, 0.0f));
glm::quat hmdRotation = extractRotation(myAvatar->getHMDSensorMatrix()); glm::quat hmdRotation = extractRotation(myAvatar->getHMDSensorMatrix());
// Mirror HMD yaw and roll // Mirror HMD yaw and roll
@ -2837,12 +2836,15 @@ void Application::updateCamera(RenderArgs& renderArgs, float deltaTime) {
+ mirrorBodyOrientation * hmdOffset); + mirrorBodyOrientation * hmdOffset);
} }
else { else {
_myCamera.setOrientation(myAvatar->getWorldOrientation() auto userInputMapper = DependencyManager::get<UserInputMapper>();
* glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f))); const float YAW_SPEED = TWO_PI / 5.0f;
float deltaYaw = userInputMapper->getActionState(controller::Action::YAW) * YAW_SPEED * deltaTime;
_mirrorYawOffset += deltaYaw;
_myCamera.setOrientation(myAvatar->getWorldOrientation() * glm::quat(glm::vec3(0.0f, PI + _mirrorYawOffset, 0.0f)));
_myCamera.setPosition(myAvatar->getDefaultEyePosition() _myCamera.setPosition(myAvatar->getDefaultEyePosition()
+ glm::vec3(0, _raiseMirror * myAvatar->getModelScale(), 0) + glm::vec3(0, _raiseMirror * myAvatar->getModelScale(), 0)
+ (myAvatar->getWorldOrientation() * glm::quat(glm::vec3(0.0f, _rotateMirror, 0.0f))) * + (myAvatar->getWorldOrientation() * glm::quat(glm::vec3(0.0f, _mirrorYawOffset, 0.0f))) *
glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_FULLSCREEN_DISTANCE * _scaleMirror); glm::vec3(0.0f, 0.0f, -1.0f) * myAvatar->getBoomLength() * _scaleMirror);
} }
renderArgs._renderMode = RenderArgs::MIRROR_RENDER_MODE; renderArgs._renderMode = RenderArgs::MIRROR_RENDER_MODE;
} }
@ -3400,8 +3402,6 @@ void Application::keyPressEvent(QKeyEvent* event) {
} else { } else {
setFullscreen(nullptr); setFullscreen(nullptr);
} }
} else {
Menu::getInstance()->triggerOption(MenuOption::AddressBar);
} }
break; break;
@ -3463,13 +3463,6 @@ void Application::keyPressEvent(QKeyEvent* event) {
} }
break; break;
case Qt::Key_F: {
if (isOption) {
_physicsEngine->dumpNextStats();
}
break;
}
case Qt::Key_Asterisk: case Qt::Key_Asterisk:
Menu::getInstance()->triggerOption(MenuOption::DefaultSkybox); Menu::getInstance()->triggerOption(MenuOption::DefaultSkybox);
break; break;
@ -3489,22 +3482,25 @@ void Application::keyPressEvent(QKeyEvent* event) {
case Qt::Key_S: case Qt::Key_S:
if (isShifted && isMeta && !isOption) { if (isShifted && isMeta && !isOption) {
Menu::getInstance()->triggerOption(MenuOption::SuppressShortTimings); Menu::getInstance()->triggerOption(MenuOption::SuppressShortTimings);
} else if (!isOption && !isShifted && isMeta) {
AudioInjectorOptions options;
options.localOnly = true;
options.stereo = true;
if (_snapshotSoundInjector) {
_snapshotSoundInjector->setOptions(options);
_snapshotSoundInjector->restart();
} else {
QByteArray samples = _snapshotSound->getByteArray();
_snapshotSoundInjector = AudioInjector::playSound(samples, options);
}
takeSnapshot(true);
} }
break; break;
case Qt::Key_P: {
AudioInjectorOptions options;
options.localOnly = true;
options.stereo = true;
if (_snapshotSoundInjector) {
_snapshotSoundInjector->setOptions(options);
_snapshotSoundInjector->restart();
} else {
QByteArray samples = _snapshotSound->getByteArray();
_snapshotSoundInjector = AudioInjector::playSound(samples, options);
}
takeSnapshot(true);
break;
}
case Qt::Key_Apostrophe: { case Qt::Key_Apostrophe: {
if (isMeta) { if (isMeta) {
auto cursor = Cursor::Manager::instance().getCursor(); auto cursor = Cursor::Manager::instance().getCursor();
@ -3528,38 +3524,6 @@ void Application::keyPressEvent(QKeyEvent* event) {
Menu::getInstance()->triggerOption(MenuOption::Chat); Menu::getInstance()->triggerOption(MenuOption::Chat);
break; break;
case Qt::Key_Up:
if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
if (!isShifted) {
_scaleMirror *= 0.95f;
} else {
_raiseMirror += 0.05f;
}
}
break;
case Qt::Key_Down:
if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
if (!isShifted) {
_scaleMirror *= 1.05f;
} else {
_raiseMirror -= 0.05f;
}
}
break;
case Qt::Key_Left:
if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
_rotateMirror += PI / 20.0f;
}
break;
case Qt::Key_Right:
if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
_rotateMirror -= PI / 20.0f;
}
break;
#if 0 #if 0
case Qt::Key_I: case Qt::Key_I:
if (isShifted) { if (isShifted) {
@ -4929,8 +4893,10 @@ void Application::cameraMenuChanged() {
auto menu = Menu::getInstance(); auto menu = Menu::getInstance();
if (menu->isOptionChecked(MenuOption::FullscreenMirror)) { if (menu->isOptionChecked(MenuOption::FullscreenMirror)) {
if (!isHMDMode() && _myCamera.getMode() != CAMERA_MODE_MIRROR) { if (!isHMDMode() && _myCamera.getMode() != CAMERA_MODE_MIRROR) {
_mirrorYawOffset = 0.0f;
_myCamera.setMode(CAMERA_MODE_MIRROR); _myCamera.setMode(CAMERA_MODE_MIRROR);
getMyAvatar()->reset(false, false, false); // to reset any active MyAvatar::FollowHelpers getMyAvatar()->reset(false, false, false); // to reset any active MyAvatar::FollowHelpers
getMyAvatar()->setBoomLength(MyAvatar::ZOOM_DEFAULT);
} }
} else if (menu->isOptionChecked(MenuOption::FirstPerson)) { } else if (menu->isOptionChecked(MenuOption::FirstPerson)) {
if (_myCamera.getMode() != CAMERA_MODE_FIRST_PERSON) { if (_myCamera.getMode() != CAMERA_MODE_FIRST_PERSON) {
@ -5210,7 +5176,7 @@ void Application::update(float deltaTime) {
// FIXME can we drop drive keys and just have the avatar read the action states directly? // FIXME can we drop drive keys and just have the avatar read the action states directly?
myAvatar->clearDriveKeys(); myAvatar->clearDriveKeys();
if (_myCamera.getMode() != CAMERA_MODE_INDEPENDENT) { if (_myCamera.getMode() != CAMERA_MODE_INDEPENDENT) {
if (!_controllerScriptingInterface->areActionsCaptured()) { if (!_controllerScriptingInterface->areActionsCaptured() && _myCamera.getMode() != CAMERA_MODE_MIRROR) {
myAvatar->setDriveKey(MyAvatar::TRANSLATE_Z, -1.0f * userInputMapper->getActionState(controller::Action::TRANSLATE_Z)); myAvatar->setDriveKey(MyAvatar::TRANSLATE_Z, -1.0f * userInputMapper->getActionState(controller::Action::TRANSLATE_Z));
myAvatar->setDriveKey(MyAvatar::TRANSLATE_Y, userInputMapper->getActionState(controller::Action::TRANSLATE_Y)); myAvatar->setDriveKey(MyAvatar::TRANSLATE_Y, userInputMapper->getActionState(controller::Action::TRANSLATE_Y));
myAvatar->setDriveKey(MyAvatar::TRANSLATE_X, userInputMapper->getActionState(controller::Action::TRANSLATE_X)); myAvatar->setDriveKey(MyAvatar::TRANSLATE_X, userInputMapper->getActionState(controller::Action::TRANSLATE_X));
@ -5223,6 +5189,7 @@ void Application::update(float deltaTime) {
myAvatar->setDriveKey(MyAvatar::ZOOM, userInputMapper->getActionState(controller::Action::TRANSLATE_CAMERA_Z)); myAvatar->setDriveKey(MyAvatar::ZOOM, userInputMapper->getActionState(controller::Action::TRANSLATE_CAMERA_Z));
} }
myAvatar->setSprintMode((bool)userInputMapper->getActionState(controller::Action::SPRINT));
static const std::vector<controller::Action> avatarControllerActions = { static const std::vector<controller::Action> avatarControllerActions = {
controller::Action::LEFT_HAND, controller::Action::LEFT_HAND,
controller::Action::RIGHT_HAND, controller::Action::RIGHT_HAND,

View file

@ -575,7 +575,7 @@ private:
Setting::Handle<QString> _preferredCursor; Setting::Handle<QString> _preferredCursor;
float _scaleMirror; float _scaleMirror;
float _rotateMirror; float _mirrorYawOffset;
float _raiseMirror; float _raiseMirror;
QSet<int> _keysPressed; QSet<int> _keysPressed;

View file

@ -229,21 +229,21 @@ Menu::Menu() {
// View > First Person // View > First Person
auto firstPersonAction = cameraModeGroup->addAction(addCheckableActionToQMenuAndActionHash( auto firstPersonAction = cameraModeGroup->addAction(addCheckableActionToQMenuAndActionHash(
viewMenu, MenuOption::FirstPerson, Qt::CTRL | Qt::Key_F, viewMenu, MenuOption::FirstPerson, Qt::Key_1,
true, qApp, SLOT(cameraMenuChanged()))); true, qApp, SLOT(cameraMenuChanged())));
firstPersonAction->setProperty(EXCLUSION_GROUP_KEY, QVariant::fromValue(cameraModeGroup)); firstPersonAction->setProperty(EXCLUSION_GROUP_KEY, QVariant::fromValue(cameraModeGroup));
// View > Third Person // View > Third Person
auto thirdPersonAction = cameraModeGroup->addAction(addCheckableActionToQMenuAndActionHash( auto thirdPersonAction = cameraModeGroup->addAction(addCheckableActionToQMenuAndActionHash(
viewMenu, MenuOption::ThirdPerson, Qt::CTRL | Qt::Key_G, viewMenu, MenuOption::ThirdPerson, Qt::Key_3,
false, qApp, SLOT(cameraMenuChanged()))); false, qApp, SLOT(cameraMenuChanged())));
thirdPersonAction->setProperty(EXCLUSION_GROUP_KEY, QVariant::fromValue(cameraModeGroup)); thirdPersonAction->setProperty(EXCLUSION_GROUP_KEY, QVariant::fromValue(cameraModeGroup));
// View > Mirror // View > Mirror
auto viewMirrorAction = cameraModeGroup->addAction(addCheckableActionToQMenuAndActionHash( auto viewMirrorAction = cameraModeGroup->addAction(addCheckableActionToQMenuAndActionHash(
viewMenu, MenuOption::FullscreenMirror, Qt::CTRL | Qt::Key_H, viewMenu, MenuOption::FullscreenMirror, Qt::Key_2,
false, qApp, SLOT(cameraMenuChanged()))); false, qApp, SLOT(cameraMenuChanged())));
viewMirrorAction->setProperty(EXCLUSION_GROUP_KEY, QVariant::fromValue(cameraModeGroup)); viewMirrorAction->setProperty(EXCLUSION_GROUP_KEY, QVariant::fromValue(cameraModeGroup));

View file

@ -2186,7 +2186,6 @@ void MyAvatar::updateActionMotor(float deltaTime) {
glm::vec3 direction = forward + right; glm::vec3 direction = forward + right;
if (state == CharacterController::State::Hover || if (state == CharacterController::State::Hover ||
_characterController.computeCollisionGroup() == BULLET_COLLISION_GROUP_COLLISIONLESS) { _characterController.computeCollisionGroup() == BULLET_COLLISION_GROUP_COLLISIONLESS) {
// we can fly --> support vertical motion
glm::vec3 up = (getDriveKey(TRANSLATE_Y)) * IDENTITY_UP; glm::vec3 up = (getDriveKey(TRANSLATE_Y)) * IDENTITY_UP;
direction += up; direction += up;
} }
@ -2204,10 +2203,11 @@ void MyAvatar::updateActionMotor(float deltaTime) {
if (state == CharacterController::State::Hover) { if (state == CharacterController::State::Hover) {
// we're flying --> complex acceleration curve that builds on top of current motor speed and caps at some max speed // we're flying --> complex acceleration curve that builds on top of current motor speed and caps at some max speed
float motorSpeed = glm::length(_actionMotorVelocity); float motorSpeed = glm::length(_actionMotorVelocity);
float finalMaxMotorSpeed = getSensorToWorldScale() * DEFAULT_AVATAR_MAX_FLYING_SPEED; float finalMaxMotorSpeed = getSensorToWorldScale() * DEFAULT_AVATAR_MAX_FLYING_SPEED * _walkSpeedScalar;
float speedGrowthTimescale = 2.0f; float speedGrowthTimescale = 2.0f;
float speedIncreaseFactor = 1.8f; float speedIncreaseFactor = 1.8f * _walkSpeedScalar;
motorSpeed *= 1.0f + glm::clamp(deltaTime / speedGrowthTimescale, 0.0f, 1.0f) * speedIncreaseFactor; motorSpeed *= 1.0f + glm::clamp(deltaTime / speedGrowthTimescale, 0.0f, 1.0f) * speedIncreaseFactor;
const float maxBoostSpeed = getSensorToWorldScale() * MAX_BOOST_SPEED; const float maxBoostSpeed = getSensorToWorldScale() * MAX_BOOST_SPEED;
@ -2223,7 +2223,7 @@ void MyAvatar::updateActionMotor(float deltaTime) {
_actionMotorVelocity = motorSpeed * direction; _actionMotorVelocity = motorSpeed * direction;
} else { } else {
// we're interacting with a floor --> simple horizontal speed and exponential decay // we're interacting with a floor --> simple horizontal speed and exponential decay
_actionMotorVelocity = getSensorToWorldScale() * _walkSpeed.get() * direction; _actionMotorVelocity = getSensorToWorldScale() * (_walkSpeed.get() * _walkSpeedScalar) * direction;
} }
float boomChange = getDriveKey(ZOOM); float boomChange = getDriveKey(ZOOM);
@ -2816,7 +2816,11 @@ float MyAvatar::getUserEyeHeight() const {
} }
float MyAvatar::getWalkSpeed() const { float MyAvatar::getWalkSpeed() const {
return _walkSpeed.get(); return _walkSpeed.get() * _walkSpeedScalar;
}
void MyAvatar::setSprintMode(bool sprint) {
_walkSpeedScalar = sprint ? AVATAR_SPRINT_SPEED_SCALAR : AVATAR_WALK_SPEED_SCALAR;
} }
void MyAvatar::setWalkSpeed(float value) { void MyAvatar::setWalkSpeed(float value) {

View file

@ -395,6 +395,7 @@ public:
// Set what driving keys are being pressed to control thrust levels // Set what driving keys are being pressed to control thrust levels
void clearDriveKeys(); void clearDriveKeys();
void setDriveKey(DriveKeys key, float val); void setDriveKey(DriveKeys key, float val);
void setSprintMode(bool sprint);
float getDriveKey(DriveKeys key) const; float getDriveKey(DriveKeys key) const;
Q_INVOKABLE float getRawDriveKey(DriveKeys key) const; Q_INVOKABLE float getRawDriveKey(DriveKeys key) const;
void relayDriveKeysToCharacterController(); void relayDriveKeysToCharacterController();
@ -836,7 +837,8 @@ private:
std::map<controller::Action, controller::Pose> _controllerPoseMap; std::map<controller::Action, controller::Pose> _controllerPoseMap;
mutable std::mutex _controllerPoseMapMutex; mutable std::mutex _controllerPoseMapMutex;
bool _hmdLeanRecenterEnabled = true; bool _hmdLeanRecenterEnabled { true };
bool _sprint { false };
AnimPose _prePhysicsRoomPose; AnimPose _prePhysicsRoomPose;
std::mutex _holdActionsMutex; std::mutex _holdActionsMutex;
std::vector<AvatarActionHold*> _holdActions; std::vector<AvatarActionHold*> _holdActions;
@ -866,6 +868,7 @@ private:
// max unscaled forward movement speed // max unscaled forward movement speed
ThreadSafeValueCache<float> _walkSpeed { DEFAULT_AVATAR_MAX_WALKING_SPEED }; ThreadSafeValueCache<float> _walkSpeed { DEFAULT_AVATAR_MAX_WALKING_SPEED };
float _walkSpeedScalar { AVATAR_WALK_SPEED_SCALAR };
}; };
QScriptValue audioListenModeToScriptValue(QScriptEngine* engine, const AudioListenerMode& audioListenerMode); QScriptValue audioListenModeToScriptValue(QScriptEngine* engine, const AudioListenerMode& audioListenerMode);

View file

@ -152,6 +152,10 @@ void AssetMappingsScriptingInterface::deleteMappings(QStringList paths, QJSValue
request->start(); request->start();
} }
void AssetMappingsScriptingInterface::sortProxyModel(int column, Qt::SortOrder order) {
_proxyModel.sort(column, order);
}
void AssetMappingsScriptingInterface::getAllMappings(QJSValue callback) { void AssetMappingsScriptingInterface::getAllMappings(QJSValue callback) {
auto assetClient = DependencyManager::get<AssetClient>(); auto assetClient = DependencyManager::get<AssetClient>();
auto request = assetClient->createGetAllMappingsRequest(); auto request = assetClient->createGetAllMappingsRequest();
@ -287,7 +291,7 @@ void AssetMappingModel::refresh() {
item->setData(parts[i], Qt::UserRole + 2); item->setData(parts[i], Qt::UserRole + 2);
item->setData("atp:" + fullPath, Qt::UserRole + 3); item->setData("atp:" + fullPath, Qt::UserRole + 3);
item->setData(fullPath, Qt::UserRole + 4); item->setData(fullPath, Qt::UserRole + 4);
if (lastItem) { if (lastItem) {
lastItem->appendRow(item); lastItem->appendRow(item);
} else { } else {

View file

@ -82,6 +82,7 @@ public:
Q_INVOKABLE void getAllMappings(QJSValue callback = QJSValue()); Q_INVOKABLE void getAllMappings(QJSValue callback = QJSValue());
Q_INVOKABLE void renameMapping(QString oldPath, QString newPath, QJSValue callback = QJSValue()); Q_INVOKABLE void renameMapping(QString oldPath, QString newPath, QJSValue callback = QJSValue());
Q_INVOKABLE void setBakingEnabled(QStringList paths, bool enabled, QJSValue callback = QJSValue()); Q_INVOKABLE void setBakingEnabled(QStringList paths, bool enabled, QJSValue callback = QJSValue());
Q_INVOKABLE void sortProxyModel(int column, Qt::SortOrder order = Qt::AscendingOrder);
protected: protected:
QSet<AssetRequest*> _pendingRequests; QSet<AssetRequest*> _pendingRequests;

View file

@ -183,6 +183,7 @@ namespace controller {
makeButtonPair(Action::ACTION2, "ACTION2"), makeButtonPair(Action::ACTION2, "ACTION2"),
makeButtonPair(Action::CONTEXT_MENU, "CONTEXT_MENU"), makeButtonPair(Action::CONTEXT_MENU, "CONTEXT_MENU"),
makeButtonPair(Action::TOGGLE_MUTE, "TOGGLE_MUTE"), makeButtonPair(Action::TOGGLE_MUTE, "TOGGLE_MUTE"),
makeButtonPair(Action::SPRINT, "SPRINT")
}; };
return availableInputs; return availableInputs;
} }

View file

@ -174,6 +174,7 @@ enum class Action {
TRACKED_OBJECT_13, TRACKED_OBJECT_13,
TRACKED_OBJECT_14, TRACKED_OBJECT_14,
TRACKED_OBJECT_15, TRACKED_OBJECT_15,
SPRINT,
NUM_ACTIONS NUM_ACTIONS
}; };

View file

@ -30,12 +30,7 @@
#include "UserActivityLogger.h" #include "UserActivityLogger.h"
#include "udt/PacketHeaders.h" #include "udt/PacketHeaders.h"
#if USE_STABLE_GLOBAL_SERVICES const QString DEFAULT_HIFI_ADDRESS = "file:///~/serverless/tutorial.json";
const QString DEFAULT_HIFI_ADDRESS = "hifi://welcome/hello";
#else
const QString DEFAULT_HIFI_ADDRESS = "hifi://dev-welcome/hello";
#endif
const QString ADDRESS_MANAGER_SETTINGS_GROUP = "AddressManager"; const QString ADDRESS_MANAGER_SETTINGS_GROUP = "AddressManager";
const QString SETTINGS_CURRENT_ADDRESS_KEY = "address"; const QString SETTINGS_CURRENT_ADDRESS_KEY = "address";

View file

@ -59,5 +59,7 @@ static const float MIN_AVATAR_SCALE = 0.005f;
static const float MAX_AVATAR_HEIGHT = 1000.0f * DEFAULT_AVATAR_HEIGHT; // meters static const float MAX_AVATAR_HEIGHT = 1000.0f * DEFAULT_AVATAR_HEIGHT; // meters
static const float MIN_AVATAR_HEIGHT = 0.005f * DEFAULT_AVATAR_HEIGHT; // meters static const float MIN_AVATAR_HEIGHT = 0.005f * DEFAULT_AVATAR_HEIGHT; // meters
static const float AVATAR_WALK_SPEED_SCALAR = 1.0f;
static const float AVATAR_SPRINT_SPEED_SCALAR = 3.0f;
#endif // hifi_AvatarConstants_h #endif // hifi_AvatarConstants_h

View file

@ -26,14 +26,14 @@ var RADIUS_RATE = 1.0 / 100.0;
var PAN_RATE = 250.0; var PAN_RATE = 250.0;
var Y_AXIS = { var Y_AXIS = {
x: 0, x: 0,
y: 1, y: 1,
z: 0 z: 0
}; };
var X_AXIS = { var X_AXIS = {
x: 1, x: 1,
y: 0, y: 0,
z: 0 z: 0
}; };
var LOOK_AT_TIME = 500; var LOOK_AT_TIME = 500;
@ -56,21 +56,20 @@ var mode = noMode;
var mouseLastX = 0; var mouseLastX = 0;
var mouseLastY = 0; var mouseLastY = 0;
var center = { var center = {
x: 0, x: 0,
y: 0, y: 0,
z: 0 z: 0
}; };
var position = { var position = {
x: 0, x: 0,
y: 0, y: 0,
z: 0 z: 0
}; };
var vector = { var vector = {
x: 0, x: 0,
y: 0, y: 0,
z: 0 z: 0
}; };
var radius = 0.0; var radius = 0.0;
var azimuth = 0.0; var azimuth = 0.0;
@ -83,258 +82,248 @@ var rotatingTowardsTarget = false;
var targetCamOrientation; var targetCamOrientation;
var oldPosition, oldOrientation; var oldPosition, oldOrientation;
function orientationOf(vector) { function orientationOf(vector) {
var direction, var direction,
yaw, yaw,
pitch; pitch;
direction = Vec3.normalize(vector); direction = Vec3.normalize(vector);
yaw = Quat.angleAxis(Math.atan2(direction.x, direction.z) * RAD_TO_DEG, Y_AXIS); yaw = Quat.angleAxis(Math.atan2(direction.x, direction.z) * RAD_TO_DEG, Y_AXIS);
pitch = Quat.angleAxis(Math.asin(-direction.y) * RAD_TO_DEG, X_AXIS); pitch = Quat.angleAxis(Math.asin(-direction.y) * RAD_TO_DEG, X_AXIS);
return Quat.multiply(yaw, pitch); return Quat.multiply(yaw, pitch);
} }
function handleRadialMode(dx, dy) { function handleRadialMode(dx, dy) {
azimuth += dx / AZIMUTH_RATE; azimuth += dx / AZIMUTH_RATE;
radius += radius * dy * RADIUS_RATE; radius += radius * dy * RADIUS_RATE;
if (radius < 1) { if (radius < 1) {
radius = 1; radius = 1;
} }
vector = { vector = {
x: (Math.cos(altitude) * Math.cos(azimuth)) * radius, x: (Math.cos(altitude) * Math.cos(azimuth)) * radius,
y: Math.sin(altitude) * radius, y: Math.sin(altitude) * radius,
z: (Math.cos(altitude) * Math.sin(azimuth)) * radius z: (Math.cos(altitude) * Math.sin(azimuth)) * radius
}; };
position = Vec3.sum(center, vector); position = Vec3.sum(center, vector);
Camera.setPosition(position); Camera.setPosition(position);
Camera.setOrientation(orientationOf(vector)); Camera.setOrientation(orientationOf(vector));
} }
function handleOrbitMode(dx, dy) { function handleOrbitMode(dx, dy) {
azimuth += dx / AZIMUTH_RATE; azimuth += dx / AZIMUTH_RATE;
altitude += dy / ALTITUDE_RATE; altitude += dy / ALTITUDE_RATE;
if (altitude > PI / 2.0) { if (altitude > PI / 2.0) {
altitude = PI / 2.0; altitude = PI / 2.0;
} }
if (altitude < -PI / 2.0) { if (altitude < -PI / 2.0) {
altitude = -PI / 2.0; altitude = -PI / 2.0;
} }
vector = { vector = {
x: (Math.cos(altitude) * Math.cos(azimuth)) * radius, x: (Math.cos(altitude) * Math.cos(azimuth)) * radius,
y: Math.sin(altitude) * radius, y: Math.sin(altitude) * radius,
z: (Math.cos(altitude) * Math.sin(azimuth)) * radius z: (Math.cos(altitude) * Math.sin(azimuth)) * radius
}; };
position = Vec3.sum(center, vector); position = Vec3.sum(center, vector);
Camera.setPosition(position); Camera.setPosition(position);
Camera.setOrientation(orientationOf(vector)); Camera.setOrientation(orientationOf(vector));
} }
function handlePanMode(dx, dy) { function handlePanMode(dx, dy) {
var up = Quat.getUp(Camera.getOrientation()); var up = Quat.getUp(Camera.getOrientation());
var right = Quat.getRight(Camera.getOrientation()); var right = Quat.getRight(Camera.getOrientation());
var distance = Vec3.length(vector); var distance = Vec3.length(vector);
var dv = Vec3.sum(Vec3.multiply(up, distance * dy / PAN_RATE), Vec3.multiply(right, -distance * dx / PAN_RATE)); var dv = Vec3.sum(Vec3.multiply(up, distance * dy / PAN_RATE), Vec3.multiply(right, -distance * dx / PAN_RATE));
center = Vec3.sum(center, dv); center = Vec3.sum(center, dv);
position = Vec3.sum(position, dv); position = Vec3.sum(position, dv);
Camera.setPosition(position); Camera.setPosition(position);
Camera.setOrientation(orientationOf(vector)); Camera.setOrientation(orientationOf(vector));
} }
function saveCameraState() { function saveCameraState() {
oldMode = Camera.mode; oldMode = Camera.mode;
oldPosition = Camera.getPosition(); oldPosition = Camera.getPosition();
oldOrientation = Camera.getOrientation(); oldOrientation = Camera.getOrientation();
Camera.mode = "independent"; Camera.mode = "independent";
Camera.setPosition(oldPosition); Camera.setPosition(oldPosition);
} }
function restoreCameraState() { function restoreCameraState() {
Camera.mode = oldMode; Camera.mode = oldMode;
Camera.setPosition(oldPosition); Camera.setPosition(oldPosition);
Camera.setOrientation(oldOrientation); Camera.setOrientation(oldOrientation);
} }
function handleModes() { function handleModes() {
var newMode = (mode == noMode) ? noMode : detachedMode; var newMode = (mode == noMode) ? noMode : detachedMode;
if (alt) { if (alt) {
if (control) { if (control) {
if (shift) { if (shift) {
newMode = panningMode; newMode = panningMode;
} else { } else {
newMode = orbitMode; newMode = orbitMode;
} }
} else { } else {
newMode = radialMode; newMode = radialMode;
}
} }
}
// if entering detachMode // if entering detachMode
if (newMode == detachedMode && mode != detachedMode) { if (newMode == detachedMode && mode != detachedMode) {
avatarPosition = MyAvatar.position; avatarPosition = MyAvatar.position;
avatarOrientation = MyAvatar.orientation; avatarOrientation = MyAvatar.orientation;
} }
// if leaving detachMode // if leaving detachMode
if (mode == detachedMode && newMode == detachedMode && if (mode == detachedMode && newMode == detachedMode &&
(avatarPosition.x != MyAvatar.position.x || (avatarPosition.x != MyAvatar.position.x ||
avatarPosition.y != MyAvatar.position.y || avatarPosition.y != MyAvatar.position.y ||
avatarPosition.z != MyAvatar.position.z || avatarPosition.z != MyAvatar.position.z ||
avatarOrientation.x != MyAvatar.orientation.x || avatarOrientation.x != MyAvatar.orientation.x ||
avatarOrientation.y != MyAvatar.orientation.y || avatarOrientation.y != MyAvatar.orientation.y ||
avatarOrientation.z != MyAvatar.orientation.z || avatarOrientation.z != MyAvatar.orientation.z ||
avatarOrientation.w != MyAvatar.orientation.w)) { avatarOrientation.w != MyAvatar.orientation.w)) {
newMode = noMode; newMode = noMode;
} }
if (mode == noMode && newMode != noMode && Camera.mode == "independent") { if (mode == noMode && newMode != noMode && Camera.mode == "independent") {
newMode = noMode; newMode = noMode;
} }
// if leaving noMode // if leaving noMode
if (mode == noMode && newMode != noMode) { if (mode == noMode && newMode != noMode) {
saveCameraState(); saveCameraState();
} }
// if entering noMode // if entering noMode
if (newMode == noMode && mode != noMode) { if (newMode == noMode && mode != noMode) {
restoreCameraState(); restoreCameraState();
} }
mode = newMode; mode = newMode;
} }
function keyPressEvent(event) { function keyPressEvent(event) {
var changed = false; var changed = false;
if (event.text == "ALT") { if (event.text == "ALT") {
alt = true; alt = true;
changed = true; changed = true;
} }
if (event.text == "CONTROL") { if (event.text == "CONTROL") {
control = true; control = true;
changed = true; changed = true;
} }
if (event.text == "SHIFT") { if (event.text == "SHIFT") {
shift = true; shift = true;
changed = true; changed = true;
} }
if (changed) { if (changed) {
handleModes(); handleModes();
} }
} }
function keyReleaseEvent(event) { function keyReleaseEvent(event) {
var changed = false; var changed = false;
if (event.text == "ALT") { if (event.text == "ALT") {
alt = false; alt = false;
changed = true; changed = true;
mode = noMode; mode = noMode;
restoreCameraState(); restoreCameraState();
} }
if (event.text == "CONTROL") { if (event.text == "CONTROL") {
control = false; control = false;
changed = true; changed = true;
} }
if (event.text == "SHIFT") { if (event.text == "SHIFT") {
shift = false; shift = false;
changed = true; changed = true;
}
if (changed) {
handleModes();
}
}
function mousePressEvent(event) {
if (alt && !isActive) {
mouseLastX = event.x;
mouseLastY = event.y;
// Compute trajectories related values
var pickRay = Camera.computePickRay(mouseLastX, mouseLastY);
var modelIntersection = Entities.findRayIntersection(pickRay, true);
position = Camera.getPosition();
var avatarTarget = MyAvatar.getTargetAvatarPosition();
var distance = -1;
var string;
if (modelIntersection.intersects && modelIntersection.accurate) {
distance = modelIntersection.distance;
center = modelIntersection.intersection;
string = "Inspecting model";
//We've selected our target, now orbit towards it automatically
rotatingTowardsTarget = true;
//calculate our target cam rotation
Script.setTimeout(function() {
rotatingTowardsTarget = false;
}, LOOK_AT_TIME);
vector = Vec3.subtract(position, center);
targetCamOrientation = orientationOf(vector);
radius = Vec3.length(vector);
azimuth = Math.atan2(vector.z, vector.x);
altitude = Math.asin(vector.y / Vec3.length(vector));
isActive = true;
} }
} if (changed) {
handleModes();
}
}
function mousePressEvent(event) {
if (alt && !isActive) {
mouseLastX = event.x;
mouseLastY = event.y;
// Compute trajectories related values
var pickRay = Camera.computePickRay(mouseLastX, mouseLastY);
var modelIntersection = Entities.findRayIntersection(pickRay, true);
var avatarIntersection = AvatarList.findRayIntersection(pickRay);
position = Camera.getPosition();
if (avatarIntersection.intersects || (modelIntersection.intersects && modelIntersection.accurate)) {
if (avatarIntersection.intersects) {
center = avatarIntersection.intersection;
} else {
center = modelIntersection.intersection;
}
// We've selected our target, now orbit towards it automatically
rotatingTowardsTarget = true;
// calculate our target cam rotation
Script.setTimeout(function () {
rotatingTowardsTarget = false;
}, LOOK_AT_TIME);
vector = Vec3.subtract(position, center);
targetCamOrientation = orientationOf(vector);
radius = Vec3.length(vector);
azimuth = Math.atan2(vector.z, vector.x);
altitude = Math.asin(vector.y / Vec3.length(vector));
isActive = true;
}
}
} }
function mouseReleaseEvent(event) { function mouseReleaseEvent(event) {
if (isActive) { if (isActive) {
isActive = false; isActive = false;
} }
} }
function mouseMoveEvent(event) { function mouseMoveEvent(event) {
if (isActive && mode != noMode && !rotatingTowardsTarget) { if (isActive && mode != noMode && !rotatingTowardsTarget) {
if (mode == radialMode) { if (mode == radialMode) {
handleRadialMode(event.x - mouseLastX, event.y - mouseLastY); handleRadialMode(event.x - mouseLastX, event.y - mouseLastY);
}
if (mode == orbitMode) {
handleOrbitMode(event.x - mouseLastX, event.y - mouseLastY);
}
if (mode == panningMode) {
handlePanMode(event.x - mouseLastX, event.y - mouseLastY);
}
} }
if (mode == orbitMode) { mouseLastX = event.x;
handleOrbitMode(event.x - mouseLastX, event.y - mouseLastY); mouseLastY = event.y;
}
if (mode == panningMode) {
handlePanMode(event.x - mouseLastX, event.y - mouseLastY);
}
}
mouseLastX = event.x;
mouseLastY = event.y;
} }
function update() { function update() {
handleModes(); handleModes();
if (rotatingTowardsTarget) { if (rotatingTowardsTarget) {
rotateTowardsTarget(); rotateTowardsTarget();
} }
} }
function rotateTowardsTarget() { function rotateTowardsTarget() {
var newOrientation = Quat.mix(Camera.getOrientation(), targetCamOrientation, .1); var newOrientation = Quat.mix(Camera.getOrientation(), targetCamOrientation, 0.1);
Camera.setOrientation(newOrientation); Camera.setOrientation(newOrientation);
} }
function scriptEnding() { function scriptEnding() {
if (mode != noMode) { if (mode != noMode) {
restoreCameraState(); restoreCameraState();
} }
} }
Controller.keyPressEvent.connect(keyPressEvent); Controller.keyPressEvent.connect(keyPressEvent);
@ -345,4 +334,4 @@ Controller.mouseReleaseEvent.connect(mouseReleaseEvent);
Controller.mouseMoveEvent.connect(mouseMoveEvent); Controller.mouseMoveEvent.connect(mouseMoveEvent);
Script.update.connect(update); Script.update.connect(update);
Script.scriptEnding.connect(scriptEnding); Script.scriptEnding.connect(scriptEnding);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View file

@ -24,8 +24,9 @@ var OVERLAY_HEIGHT = 1080;
var OVERLAY_DATA = { var OVERLAY_DATA = {
width: OVERLAY_WIDTH, width: OVERLAY_WIDTH,
height: OVERLAY_HEIGHT, height: OVERLAY_HEIGHT,
imageURL: "http://hifi-content.s3.amazonaws.com/alan/production/images/images/Overlay-Viz-blank.png", imageURL: Script.resolvePath("assets/images/Overlay-Viz-blank.png"),
color: {red: 255, green: 255, blue: 255}, emissive: true,
drawInFront: true,
alpha: 1 alpha: 1
}; };
var AVATAR_MOVE_FOR_ACTIVE_DISTANCE = 0.8; // meters -- no longer away if avatar moves this far while away var AVATAR_MOVE_FOR_ACTIVE_DISTANCE = 0.8; // meters -- no longer away if avatar moves this far while away
@ -37,7 +38,7 @@ var OVERLAY_DATA_HMD = {
localRotation: {x: 0, y: 0, z: 0, w: 1}, localRotation: {x: 0, y: 0, z: 0, w: 1},
width: OVERLAY_WIDTH, width: OVERLAY_WIDTH,
height: OVERLAY_HEIGHT, height: OVERLAY_HEIGHT,
url: "http://hifi-content.s3.amazonaws.com/alan/production/images/images/Overlay-Viz-blank.png", url: Script.resolvePath("assets/images/Overlay-Viz-blank.png"),
color: {red: 255, green: 255, blue: 255}, color: {red: 255, green: 255, blue: 255},
alpha: 1, alpha: 1,
scale: 2 * MyAvatar.sensorToWorldScale, scale: 2 * MyAvatar.sensorToWorldScale,