diff --git a/scripts/developer/utilities/render/debugHighlight.js b/scripts/developer/utilities/render/debugHighlight.js deleted file mode 100644 index c647c601b9..0000000000 --- a/scripts/developer/utilities/render/debugHighlight.js +++ /dev/null @@ -1,265 +0,0 @@ -// -// debugHighlight.js -// developer/utilities/render -// -// Olivier Prat, created on 08/08/2017. -// Copyright 2017 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -"use strict"; - -// -// Luci.js -// tablet-engine app -// -// Copyright 2017 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -(function() { - var TABLET_BUTTON_NAME = "Highlight"; - var QMLAPP_URL = Script.resolvePath("./highlight.qml"); - var ICON_URL = Script.resolvePath("../../../system/assets/images/luci-i.svg"); - var ACTIVE_ICON_URL = Script.resolvePath("../../../system/assets/images/luci-a.svg"); - - - var onLuciScreen = false; - - function onClicked() { - if (onLuciScreen) { - tablet.gotoHomeScreen(); - } else { - tablet.loadQMLSource(QMLAPP_URL); - } - } - - var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); - var button = tablet.addButton({ - text: TABLET_BUTTON_NAME, - icon: ICON_URL, - activeIcon: ACTIVE_ICON_URL, - sortOrder: 1 - }); - - var hasEventBridge = false; - - function wireEventBridge(on) { - if (!tablet) { - print("Warning in wireEventBridge(): 'tablet' undefined!"); - return; - } - if (on) { - if (!hasEventBridge) { - tablet.fromQml.connect(fromQml); - hasEventBridge = true; - } - } else { - if (hasEventBridge) { - tablet.fromQml.disconnect(fromQml); - hasEventBridge = false; - } - } - } - - function onScreenChanged(type, url) { - if (url === QMLAPP_URL) { - onLuciScreen = true; - } else { - onLuciScreen = false; - } - - button.editProperties({isActive: onLuciScreen}); - wireEventBridge(onLuciScreen); - } - - function fromQml(message) { - } - - button.clicked.connect(onClicked); - tablet.screenChanged.connect(onScreenChanged); - - var moveDebugCursor = false; - Controller.mousePressEvent.connect(function (e) { - if (e.isMiddleButton) { - moveDebugCursor = true; - setDebugCursor(e.x, e.y); - } - }); - Controller.mouseReleaseEvent.connect(function() { moveDebugCursor = false; }); - Controller.mouseMoveEvent.connect(function (e) { if (moveDebugCursor) setDebugCursor(e.x, e.y); }); - - - Script.scriptEnding.connect(function () { - if (onLuciScreen) { - tablet.gotoHomeScreen(); - } - button.clicked.disconnect(onClicked); - tablet.screenChanged.disconnect(onScreenChanged); - tablet.removeButton(button); - }); - - function setDebugCursor(x, y) { - nx = (x / Window.innerWidth); - ny = 1.0 - ((y) / (Window.innerHeight - 32)); - - Render.getConfig("RenderMainView").getConfig("Antialiasing").debugCursorTexcoord = { x: nx, y: ny }; - } - -}()); - - - -// Set up the qml ui -var qml = Script.resolvePath('highlight.qml'); -var window = new OverlayWindow({ - title: 'Highlight', - source: qml, - width: 400, - height: 400, -}); -window.closed.connect(function() { Script.stop(); }); - -"use strict"; - -// Created by Sam Gondelman on 9/7/2017 -// Copyright 2017 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html - -(function() { // BEGIN LOCAL_SCOPE - -var END_DIMENSIONS = { - x: 0.15, - y: 0.15, - z: 0.15 -}; -var COLOR = {red: 97, green: 247, blue: 255}; -var end = { - type: "sphere", - dimensions: END_DIMENSIONS, - color: COLOR, - ignoreRayIntersection: true, - alpha: 1.0, - visible: true -} - -var COLOR2 = {red: 247, green: 97, blue: 255}; -var end2 = { - type: "sphere", - dimensions: END_DIMENSIONS, - color: COLOR2, - ignoreRayIntersection: true, - alpha: 1.0, - visible: true -} - -var highlightGroupIndex = 0 -var isSelectionAddEnabled = false -var isSelectionEnabled = false -var renderStates = [{name: "test", end: end}]; -var defaultRenderStates = [{name: "test", distance: 20.0, end: end2}]; -var time = 0 - -var ray = LaserPointers.createLaserPointer({ - joint: "Mouse", - filter: RayPick.PICK_ENTITIES | RayPick.PICK_OVERLAYS | RayPick.PICK_AVATARS | RayPick.PICK_INVISIBLE | RayPick.PICK_NONCOLLIDABLE, - renderStates: renderStates, - defaultRenderStates: defaultRenderStates, - enabled: false -}); - -function getSelectionName() { - var selectionName = "contextOverlayHighlightList" - - if (highlightGroupIndex>0) { - selectionName += highlightGroupIndex - } - return selectionName -} - -function fromQml(message) { - tokens = message.split(' ') - print("Received '"+message+"' from hightlight.qml") - if (tokens[0]=="highlight") { - highlightGroupIndex = parseInt(tokens[1]) - print("Switching to highlight group "+highlightGroupIndex) - } else if (tokens[0]=="pick") { - isSelectionEnabled = tokens[1]=='true' - print("Ray picking set to "+isSelectionEnabled.toString()) - if (isSelectionEnabled) { - LaserPointers.enableLaserPointer(ray) - } else { - LaserPointers.disableLaserPointer(ray) - } - time = 0 - } else if (tokens[0]=="add") { - isSelectionAddEnabled = tokens[1]=='true' - print("Add to selection set to "+isSelectionAddEnabled.toString()) - if (!isSelectionAddEnabled) { - Selection.clearSelectedItemsList(getSelectionName()) - } - } -} - -window.fromQml.connect(fromQml); - -function cleanup() { - LaserPointers.removeLaserPointer(ray); -} -Script.scriptEnding.connect(cleanup); - -var prevID = 0 -var prevType = "" -var selectedID = 0 -var selectedType = "" -function update(deltaTime) { - - // you have to do this repeatedly because there's a bug but I'll fix it - LaserPointers.setRenderState(ray, "test"); - - var result = LaserPointers.getPrevRayPickResult(ray); - var selectionName = getSelectionName() - - if (isSelectionEnabled && result.type != RayPick.INTERSECTED_NONE) { - time += deltaTime - if (result.objectID != prevID) { - var typeName = "" - if (result.type == RayPick.INTERSECTED_ENTITY) { - typeName = "entity" - } else if (result.type == RayPick.INTERSECTED_OVERLAY) { - typeName = "overlay" - } else if (result.type == RayPick.INTERSECTED_AVATAR) { - typeName = "avatar" - } - - prevID = result.objectID; - prevType = typeName; - time = 0 - } else if (time>1.0 && prevID!=selectedID) { - if (prevID != 0 && !isSelectionAddEnabled) { - Selection.removeFromSelectedItemsList(selectionName, selectedType, selectedID) - } - selectedID = prevID - selectedType = prevType - Selection.addToSelectedItemsList(selectionName, selectedType, selectedID) - print("HIGHLIGHT " + highlightGroupIndex + " picked type: " + result.type + ", id: " + result.objectID); - } - } else { - if (prevID != 0 && !isSelectionAddEnabled) { - Selection.removeFromSelectedItemsList(selectionName, prevType, prevID) - } - prevID = 0 - selectedID = 0 - time = 0 - } -} - -Script.update.connect(update); - -}()); // END LOCAL_SCOPE \ No newline at end of file diff --git a/scripts/developer/utilities/render/highlight.qml b/scripts/developer/utilities/render/highlight.qml deleted file mode 100644 index 6be74fcf40..0000000000 --- a/scripts/developer/utilities/render/highlight.qml +++ /dev/null @@ -1,177 +0,0 @@ -// -// highlight.qml -// developer/utilities/render -// -// Olivier Prat, created on 08/08/2017. -// Copyright 2017 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or https://www.apache.org/licenses/LICENSE-2.0.html -// -import QtQuick 2.7 -import QtQuick.Controls 1.4 -import QtQuick.Layouts 1.3 - -import "qrc:///qml/styles-uit" -import "qrc:///qml/controls-uit" as HifiControls -import "configSlider" - -Rectangle { - id: root - HifiConstants { id: hifi;} - color: hifi.colors.baseGray; - anchors.margins: hifi.dimensions.contentMargin.x - - property var debugConfig: Render.getConfig("RenderMainView.HighlightDebug") - property var highlightConfig: Render.getConfig("UpdateScene.HighlightStageSetup") - - signal sendToScript(var message); - - Column { - id: col - spacing: 10 - anchors.left: parent.left - anchors.right: parent.right - anchors.margins: hifi.dimensions.contentMargin.x - - Row { - spacing: 10 - anchors.left: parent.left - anchors.right: parent.right - - HifiControls.CheckBox { - id: debug - text: "View Mask" - checked: root.debugConfig["viewMask"] - onCheckedChanged: { - root.debugConfig["viewMask"] = checked; - } - } - HifiControls.CheckBox { - text: "Hover select" - checked: false - onCheckedChanged: { - sendToScript("pick "+checked.toString()) - } - } - HifiControls.CheckBox { - text: "Add to selection" - checked: false - onCheckedChanged: { - sendToScript("add "+checked.toString()) - } - } - } - - HifiControls.ComboBox { - id: box - width: 350 - z: 999 - editable: true - colorScheme: hifi.colorSchemes.dark - model: [ - "contextOverlayHighlightList", - "highlightList1", - "highlightList2", - "highlightList3", - "highlightList4"] - label: "" - - Timer { - id: postpone - interval: 100; running: false; repeat: false - onTriggered: { paramWidgetLoader.sourceComponent = paramWidgets } - } - onCurrentIndexChanged: { - root.highlightConfig["selectionName"] = model[currentIndex]; - sendToScript("highlight "+currentIndex) - // This is a hack to be sure the widgets below properly reflect the change of category: delete the Component - // by setting the loader source to Null and then recreate it 100ms later - paramWidgetLoader.sourceComponent = undefined; - postpone.interval = 100 - postpone.start() - } - } - - Loader { - id: paramWidgetLoader - sourceComponent: paramWidgets - width: 350 - } - - Component { - id: paramWidgets - - Column { - spacing: 10 - anchors.margins: hifi.dimensions.contentMargin.x - - HifiControls.Label { - text: "Outline" - } - Column { - spacing: 10 - anchors.left: parent.left - anchors.right: parent.right - HifiControls.CheckBox { - text: "Smooth" - checked: root.highlightConfig["isOutlineSmooth"] - onCheckedChanged: { - root.highlightConfig["isOutlineSmooth"] = checked; - } - } - Repeater { - model: ["Width:outlineWidth:5.0:0.0", - "Intensity:outlineIntensity:1.0:0.0" - ] - ConfigSlider { - label: qsTr(modelData.split(":")[0]) - integral: false - config: root.highlightConfig - property: modelData.split(":")[1] - max: modelData.split(":")[2] - min: modelData.split(":")[3] - } - } - } - - Separator {} - HifiControls.Label { - text: "Color" - } - Repeater { - model: ["Red:colorR:1.0:0.0", - "Green:colorG:1.0:0.0", - "Blue:colorB:1.0:0.0" - ] - ConfigSlider { - label: qsTr(modelData.split(":")[0]) - integral: false - config: root.highlightConfig - property: modelData.split(":")[1] - max: modelData.split(":")[2] - min: modelData.split(":")[3] - } - } - - Separator {} - HifiControls.Label { - text: "Fill Opacity" - } - Repeater { - model: ["Unoccluded:unoccludedFillOpacity:1.0:0.0", - "Occluded:occludedFillOpacity:1.0:0.0" - ] - ConfigSlider { - label: qsTr(modelData.split(":")[0]) - integral: false - config: root.highlightConfig - property: modelData.split(":")[1] - max: modelData.split(":")[2] - min: modelData.split(":")[3] - } - } - } - } - } -}