mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 09:48:44 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into newModelDialog-Fix
This commit is contained in:
commit
9e641e6efa
6 changed files with 216 additions and 254 deletions
|
@ -4,8 +4,8 @@ set(EXTERNAL_NAME serverless-content)
|
||||||
|
|
||||||
ExternalProject_Add(
|
ExternalProject_Add(
|
||||||
${EXTERNAL_NAME}
|
${EXTERNAL_NAME}
|
||||||
URL http://cdn.highfidelity.com/content-sets/serverless-tutorial-RC67-v3.zip
|
URL http://cdn.highfidelity.com/content-sets/serverless-tutorial-RC67-v4.zip
|
||||||
URL_MD5 327292eb87bc249cbb4d670d8a6ce746
|
URL_MD5 ba32aed18bfeaac4ccaf5ebb8ea3e804
|
||||||
CONFIGURE_COMMAND ""
|
CONFIGURE_COMMAND ""
|
||||||
BUILD_COMMAND ""
|
BUILD_COMMAND ""
|
||||||
INSTALL_COMMAND ""
|
INSTALL_COMMAND ""
|
||||||
|
|
|
@ -258,7 +258,9 @@ Item {
|
||||||
anchors.topMargin: 26;
|
anchors.topMargin: 26;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
anchors.leftMargin: 20;
|
anchors.leftMargin: 20;
|
||||||
width: paintedWidth;
|
anchors.right: parent.right;
|
||||||
|
anchors.rightMargin: 20;
|
||||||
|
elide: Text.ElideRight;
|
||||||
height: 30;
|
height: 30;
|
||||||
// Text size
|
// Text size
|
||||||
size: 22;
|
size: 22;
|
||||||
|
@ -844,7 +846,7 @@ Item {
|
||||||
property string selectedRecipientUserName;
|
property string selectedRecipientUserName;
|
||||||
property string selectedRecipientProfilePic;
|
property string selectedRecipientProfilePic;
|
||||||
|
|
||||||
visible: root.currentActiveView === "sendAssetStep";
|
visible: root.currentActiveView === "sendAssetStep" || paymentSuccess.visible || paymentFailure.visible;
|
||||||
anchors.fill: parent;
|
anchors.fill: parent;
|
||||||
anchors.topMargin: root.parentAppTitleBarHeight;
|
anchors.topMargin: root.parentAppTitleBarHeight;
|
||||||
|
|
||||||
|
@ -856,7 +858,9 @@ Item {
|
||||||
anchors.topMargin: 26;
|
anchors.topMargin: 26;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
anchors.leftMargin: 20;
|
anchors.leftMargin: 20;
|
||||||
width: paintedWidth;
|
anchors.right: parent.right;
|
||||||
|
anchors.rightMargin: 20;
|
||||||
|
elide: Text.ElideRight;
|
||||||
height: 30;
|
height: 30;
|
||||||
// Text size
|
// Text size
|
||||||
size: 22;
|
size: 22;
|
||||||
|
@ -907,7 +911,7 @@ Item {
|
||||||
// "CHANGE" button
|
// "CHANGE" button
|
||||||
HifiControlsUit.Button {
|
HifiControlsUit.Button {
|
||||||
id: changeButton;
|
id: changeButton;
|
||||||
color: root.assetName === "" ? hifi.buttons.none : hifi.buttons.noneBorderlessGray;
|
color: root.assetName === "" ? hifi.buttons.none : hifi.buttons.white;
|
||||||
colorScheme: hifi.colorSchemes.dark;
|
colorScheme: hifi.colorSchemes.dark;
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right;
|
||||||
anchors.verticalCenter: parent.verticalCenter;
|
anchors.verticalCenter: parent.verticalCenter;
|
||||||
|
@ -1238,7 +1242,7 @@ Item {
|
||||||
// Sending Asset Overlay START
|
// Sending Asset Overlay START
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: sendingAssetOverlay;
|
id: sendingAssetOverlay;
|
||||||
z: 998;
|
z: 999;
|
||||||
|
|
||||||
visible: root.isCurrentlySendingAsset;
|
visible: root.isCurrentlySendingAsset;
|
||||||
anchors.fill: parent;
|
anchors.fill: parent;
|
||||||
|
@ -1281,26 +1285,43 @@ Item {
|
||||||
// Payment Success BEGIN
|
// Payment Success BEGIN
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: paymentSuccess;
|
id: paymentSuccess;
|
||||||
|
z: 998;
|
||||||
|
|
||||||
visible: root.currentActiveView === "paymentSuccess";
|
visible: root.currentActiveView === "paymentSuccess";
|
||||||
anchors.fill: parent;
|
anchors.fill: parent;
|
||||||
color: Qt.rgba(0.0, 0.0, 0.0, 0.8);
|
color: Qt.rgba(0.0, 0.0, 0.0, 0.8);
|
||||||
|
|
||||||
|
// This object is always used in a popup or full-screen Wallet section.
|
||||||
|
// This MouseArea is used to prevent a user from being
|
||||||
|
// able to click on a button/mouseArea underneath the popup/section.
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent;
|
||||||
|
propagateComposedEvents: false;
|
||||||
|
hoverEnabled: true;
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.centerIn: parent;
|
anchors.top: parent.top;
|
||||||
width: parent.width - 30;
|
anchors.topMargin: root.assetName === "" ? 15 : 150;
|
||||||
height: parent.height - 30;
|
anchors.left: parent.left;
|
||||||
|
anchors.leftMargin: root.assetName === "" ? 15 : 50;
|
||||||
|
anchors.right: parent.right;
|
||||||
|
anchors.rightMargin: root.assetName === "" ? 15 : 50;
|
||||||
|
anchors.bottom: parent.bottom;
|
||||||
|
anchors.bottomMargin: root.assetName === "" ? 15 : 300;
|
||||||
color: "#FFFFFF";
|
color: "#FFFFFF";
|
||||||
|
|
||||||
RalewaySemiBold {
|
RalewaySemiBold {
|
||||||
id: paymentSentText;
|
id: paymentSentText;
|
||||||
text: root.assetName === "" ? "Payment Sent" : '"' + root.assetName + '"';
|
text: root.assetName === "" ? "Payment Sent" : "Gift Sent";
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.topMargin: 26;
|
anchors.topMargin: 26;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
anchors.leftMargin: 20;
|
anchors.leftMargin: 20;
|
||||||
width: paintedWidth;
|
anchors.right: parent.right;
|
||||||
|
anchors.rightMargin: 20;
|
||||||
|
elide: Text.ElideRight;
|
||||||
height: 30;
|
height: 30;
|
||||||
// Text size
|
// Text size
|
||||||
size: 22;
|
size: 22;
|
||||||
|
@ -1310,6 +1331,7 @@ Item {
|
||||||
|
|
||||||
HiFiGlyphs {
|
HiFiGlyphs {
|
||||||
id: closeGlyphButton_paymentSuccess;
|
id: closeGlyphButton_paymentSuccess;
|
||||||
|
visible: root.assetName === "";
|
||||||
text: hifi.glyphs.close;
|
text: hifi.glyphs.close;
|
||||||
color: hifi.colors.lightGrayText;
|
color: hifi.colors.lightGrayText;
|
||||||
size: 26;
|
size: 26;
|
||||||
|
@ -1375,6 +1397,48 @@ Item {
|
||||||
isDisplayingNearby: sendAssetStep.referrer === "nearby";
|
isDisplayingNearby: sendAssetStep.referrer === "nearby";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: giftContainer_paymentSuccess;
|
||||||
|
visible: root.assetName !== "";
|
||||||
|
anchors.top: sendToContainer_paymentSuccess.bottom;
|
||||||
|
anchors.topMargin: 16;
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.leftMargin: 20;
|
||||||
|
anchors.right: parent.right;
|
||||||
|
anchors.rightMargin: 20;
|
||||||
|
height: 80;
|
||||||
|
|
||||||
|
RalewaySemiBold {
|
||||||
|
id: gift_paymentSuccess;
|
||||||
|
text: "Gift:";
|
||||||
|
// Anchors
|
||||||
|
anchors.top: parent.top;
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.bottom: parent.bottom;
|
||||||
|
width: 90;
|
||||||
|
// Text size
|
||||||
|
size: 18;
|
||||||
|
// Style
|
||||||
|
color: hifi.colors.baseGray;
|
||||||
|
verticalAlignment: Text.AlignVCenter;
|
||||||
|
}
|
||||||
|
|
||||||
|
RalewaySemiBold {
|
||||||
|
text: root.assetName;
|
||||||
|
// Anchors
|
||||||
|
anchors.top: parent.top;
|
||||||
|
anchors.left: gift_paymentSuccess.right;
|
||||||
|
anchors.right: parent.right;
|
||||||
|
// Text size
|
||||||
|
size: 18;
|
||||||
|
// Style
|
||||||
|
elide: Text.ElideRight;
|
||||||
|
color: hifi.colors.baseGray;
|
||||||
|
verticalAlignment: Text.AlignVCenter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: amountContainer_paymentSuccess;
|
id: amountContainer_paymentSuccess;
|
||||||
|
@ -1433,6 +1497,7 @@ Item {
|
||||||
|
|
||||||
RalewaySemiBold {
|
RalewaySemiBold {
|
||||||
id: optionalMessage_paymentSuccess;
|
id: optionalMessage_paymentSuccess;
|
||||||
|
visible: root.assetName === "";
|
||||||
text: optionalMessage.text;
|
text: optionalMessage.text;
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: amountContainer_paymentSuccess.visible ? amountContainer_paymentSuccess.bottom : sendToContainer_paymentSuccess.bottom;
|
anchors.top: amountContainer_paymentSuccess.visible ? amountContainer_paymentSuccess.bottom : sendToContainer_paymentSuccess.bottom;
|
||||||
|
@ -1476,26 +1541,43 @@ Item {
|
||||||
// Payment Failure BEGIN
|
// Payment Failure BEGIN
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: paymentFailure;
|
id: paymentFailure;
|
||||||
|
z: 998;
|
||||||
|
|
||||||
visible: root.currentActiveView === "paymentFailure";
|
visible: root.currentActiveView === "paymentFailure";
|
||||||
anchors.fill: parent;
|
anchors.fill: parent;
|
||||||
color: Qt.rgba(0.0, 0.0, 0.0, 0.8);
|
color: Qt.rgba(0.0, 0.0, 0.0, 0.8);
|
||||||
|
|
||||||
|
// This object is always used in a popup or full-screen Wallet section.
|
||||||
|
// This MouseArea is used to prevent a user from being
|
||||||
|
// able to click on a button/mouseArea underneath the popup/section.
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent;
|
||||||
|
propagateComposedEvents: false;
|
||||||
|
hoverEnabled: true;
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.centerIn: parent;
|
anchors.top: parent.top;
|
||||||
width: parent.width - 30;
|
anchors.topMargin: root.assetName === "" ? 15 : 150;
|
||||||
height: parent.height - 30;
|
anchors.left: parent.left;
|
||||||
|
anchors.leftMargin: root.assetName === "" ? 15 : 50;
|
||||||
|
anchors.right: parent.right;
|
||||||
|
anchors.rightMargin: root.assetName === "" ? 15 : 50;
|
||||||
|
anchors.bottom: parent.bottom;
|
||||||
|
anchors.bottomMargin: root.assetName === "" ? 15 : 300;
|
||||||
color: "#FFFFFF";
|
color: "#FFFFFF";
|
||||||
|
|
||||||
RalewaySemiBold {
|
RalewaySemiBold {
|
||||||
id: paymentFailureText;
|
id: paymentFailureText;
|
||||||
text: root.assetName === "" ? "Payment Failed" : '"' + root.assetName + '"';
|
text: root.assetName === "" ? "Payment Failed" : "Failed";
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.topMargin: 26;
|
anchors.topMargin: 26;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
anchors.leftMargin: 20;
|
anchors.leftMargin: 20;
|
||||||
width: paintedWidth;
|
anchors.right: parent.right;
|
||||||
|
anchors.rightMargin: 20;
|
||||||
|
elide: Text.ElideRight;
|
||||||
height: 30;
|
height: 30;
|
||||||
// Text size
|
// Text size
|
||||||
size: 22;
|
size: 22;
|
||||||
|
@ -1505,6 +1587,7 @@ Item {
|
||||||
|
|
||||||
HiFiGlyphs {
|
HiFiGlyphs {
|
||||||
id: closeGlyphButton_paymentFailure;
|
id: closeGlyphButton_paymentFailure;
|
||||||
|
visible: root.assetName === "";
|
||||||
text: hifi.glyphs.close;
|
text: hifi.glyphs.close;
|
||||||
color: hifi.colors.lightGrayText;
|
color: hifi.colors.lightGrayText;
|
||||||
size: 26;
|
size: 26;
|
||||||
|
@ -1551,6 +1634,7 @@ Item {
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: sendToContainer_paymentFailure;
|
id: sendToContainer_paymentFailure;
|
||||||
|
visible: root.assetName === "";
|
||||||
anchors.top: paymentFailureDetailText.bottom;
|
anchors.top: paymentFailureDetailText.bottom;
|
||||||
anchors.topMargin: 8;
|
anchors.topMargin: 8;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
|
@ -1645,7 +1729,8 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
RalewaySemiBold {
|
RalewaySemiBold {
|
||||||
id: optionalMessage_paymentFailuire;
|
id: optionalMessage_paymentFailure;
|
||||||
|
visible: root.assetName === "";
|
||||||
text: optionalMessage.text;
|
text: optionalMessage.text;
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: amountContainer_paymentFailure.visible ? amountContainer_paymentFailure.bottom : sendToContainer_paymentFailure.bottom;
|
anchors.top: amountContainer_paymentFailure.visible ? amountContainer_paymentFailure.bottom : sendToContainer_paymentFailure.bottom;
|
||||||
|
@ -1663,14 +1748,15 @@ Item {
|
||||||
verticalAlignment: Text.AlignTop;
|
verticalAlignment: Text.AlignTop;
|
||||||
}
|
}
|
||||||
|
|
||||||
// "Close" button
|
// "Cancel" button
|
||||||
HifiControlsUit.Button {
|
HifiControlsUit.Button {
|
||||||
id: closeButton_paymentFailure;
|
id: closeButton_paymentFailure;
|
||||||
color: hifi.buttons.noneBorderless;
|
color: hifi.buttons.noneBorderless;
|
||||||
colorScheme: root.assetName === "" ? hifi.colorSchemes.dark : hifi.colorSchemes.light;
|
colorScheme: root.assetName === "" ? hifi.colorSchemes.dark : hifi.colorSchemes.light;
|
||||||
anchors.horizontalCenter: parent.horizontalCenter;
|
anchors.right: retryButton_paymentFailure.left;
|
||||||
|
anchors.rightMargin: 12;
|
||||||
anchors.bottom: parent.bottom;
|
anchors.bottom: parent.bottom;
|
||||||
anchors.bottomMargin: 80;
|
anchors.bottomMargin: root.assetName === "" ? 80 : 30;
|
||||||
height: 50;
|
height: 50;
|
||||||
width: 120;
|
width: 120;
|
||||||
text: "Cancel";
|
text: "Cancel";
|
||||||
|
@ -1691,7 +1777,7 @@ Item {
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right;
|
||||||
anchors.rightMargin: 12;
|
anchors.rightMargin: 12;
|
||||||
anchors.bottom: parent.bottom;
|
anchors.bottom: parent.bottom;
|
||||||
anchors.bottomMargin: 80;
|
anchors.bottomMargin: root.assetName === "" ? 80 : 30;
|
||||||
height: 50;
|
height: 50;
|
||||||
width: 120;
|
width: 120;
|
||||||
text: "Retry";
|
text: "Retry";
|
||||||
|
@ -1768,7 +1854,7 @@ Item {
|
||||||
switch (message.method) {
|
switch (message.method) {
|
||||||
case 'selectRecipient':
|
case 'selectRecipient':
|
||||||
if (message.isSelected) {
|
if (message.isSelected) {
|
||||||
chooseRecipientNearby.selectedRecipient = message.id[0];
|
chooseRecipientNearby.selectedRecipient = message.id;
|
||||||
sendAssetStep.selectedRecipientDisplayName = message.displayName;
|
sendAssetStep.selectedRecipientDisplayName = message.displayName;
|
||||||
sendAssetStep.selectedRecipientUserName = message.userName;
|
sendAssetStep.selectedRecipientUserName = message.userName;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -60,6 +60,10 @@ class MyAvatar : public Avatar {
|
||||||
* change the avatar's position within the domain, or manage the avatar's collisions with other objects.
|
* change the avatar's position within the domain, or manage the avatar's collisions with other objects.
|
||||||
*
|
*
|
||||||
* @namespace MyAvatar
|
* @namespace MyAvatar
|
||||||
|
*
|
||||||
|
* @hifi-interface
|
||||||
|
* @hifi-client-entity
|
||||||
|
*
|
||||||
* @property {Vec3} qmlPosition - A synonym for <code>position</code> for use by QML.
|
* @property {Vec3} qmlPosition - A synonym for <code>position</code> for use by QML.
|
||||||
* @property {boolean} shouldRenderLocally=true - If <code>true</code> then your avatar is rendered for you in Interface,
|
* @property {boolean} shouldRenderLocally=true - If <code>true</code> then your avatar is rendered for you in Interface,
|
||||||
* otherwise it is not rendered for you (but it is still rendered for other users).
|
* otherwise it is not rendered for you (but it is still rendered for other users).
|
||||||
|
|
|
@ -21,40 +21,16 @@
|
||||||
|
|
||||||
|
|
||||||
// BEGIN AVATAR SELECTOR LOGIC
|
// BEGIN AVATAR SELECTOR LOGIC
|
||||||
var UNSELECTED_TEXTURES = {
|
|
||||||
"idle-D": Script.resolvePath("./assets/models/Avatar-Overlay-v1.fbx/Avatar-Overlay-v1.fbm/avatar-overlay-idle.png"),
|
|
||||||
"idle-E": Script.resolvePath("./assets/models/Avatar-Overlay-v1.fbx/Avatar-Overlay-v1.fbm/avatar-overlay-idle.png")
|
|
||||||
};
|
|
||||||
var SELECTED_TEXTURES = {
|
|
||||||
"idle-D": Script.resolvePath("./assets/models/Avatar-Overlay-v1.fbx/Avatar-Overlay-v1.fbm/avatar-overlay-selected.png"),
|
|
||||||
"idle-E": Script.resolvePath("./assets/models/Avatar-Overlay-v1.fbx/Avatar-Overlay-v1.fbm/avatar-overlay-selected.png")
|
|
||||||
};
|
|
||||||
var HOVER_TEXTURES = {
|
|
||||||
"idle-D": Script.resolvePath("./assets/models/Avatar-Overlay-v1.fbx/Avatar-Overlay-v1.fbm/avatar-overlay-hover.png"),
|
|
||||||
"idle-E": Script.resolvePath("./assets/models/Avatar-Overlay-v1.fbx/Avatar-Overlay-v1.fbm/avatar-overlay-hover.png")
|
|
||||||
};
|
|
||||||
|
|
||||||
var UNSELECTED_COLOR = { red: 0x1F, green: 0xC6, blue: 0xA6 };
|
var UNSELECTED_COLOR = { red: 0x1F, green: 0xC6, blue: 0xA6 };
|
||||||
var SELECTED_COLOR = { red: 0xF3, green: 0x91, blue: 0x29 };
|
var SELECTED_COLOR = { red: 0xF3, green: 0x91, blue: 0x29 };
|
||||||
var HOVER_COLOR = { red: 0xD0, green: 0xD0, blue: 0xD0 };
|
var HOVER_COLOR = { red: 0xD0, green: 0xD0, blue: 0xD0 };
|
||||||
var conserveResources = true;
|
|
||||||
|
|
||||||
var overlays = {}; // Keeps track of all our extended overlay data objects, keyed by target identifier.
|
var overlays = {}; // Keeps track of all our extended overlay data objects, keyed by target identifier.
|
||||||
|
|
||||||
function ExtendedOverlay(key, type, properties, selected, hasModel) { // A wrapper around overlays to store the key it is associated with.
|
function ExtendedOverlay(key, type, properties) { // A wrapper around overlays to store the key it is associated with.
|
||||||
overlays[key] = this;
|
overlays[key] = this;
|
||||||
if (hasModel) {
|
|
||||||
var modelKey = key + "-m";
|
|
||||||
this.model = new ExtendedOverlay(modelKey, "model", {
|
|
||||||
url: Script.resolvePath("./assets/models/Avatar-Overlay-v1.fbx"),
|
|
||||||
textures: textures(selected),
|
|
||||||
ignoreRayIntersection: true
|
|
||||||
}, false, false);
|
|
||||||
} else {
|
|
||||||
this.model = undefined;
|
|
||||||
}
|
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.selected = selected || false; // not undefined
|
this.selected = false;
|
||||||
this.hovering = false;
|
this.hovering = false;
|
||||||
this.activeOverlay = Overlays.addOverlay(type, properties); // We could use different overlays for (un)selected...
|
this.activeOverlay = Overlays.addOverlay(type, properties); // We could use different overlays for (un)selected...
|
||||||
}
|
}
|
||||||
|
@ -76,10 +52,6 @@
|
||||||
}
|
}
|
||||||
return { red: scale(base.red), green: scale(base.green), blue: scale(base.blue) };
|
return { red: scale(base.red), green: scale(base.green), blue: scale(base.blue) };
|
||||||
}
|
}
|
||||||
|
|
||||||
function textures(selected, hovering) {
|
|
||||||
return hovering ? HOVER_TEXTURES : selected ? SELECTED_TEXTURES : UNSELECTED_TEXTURES;
|
|
||||||
}
|
|
||||||
// so we don't have to traverse the overlays to get the last one
|
// so we don't have to traverse the overlays to get the last one
|
||||||
var lastHoveringId = 0;
|
var lastHoveringId = 0;
|
||||||
ExtendedOverlay.prototype.hover = function (hovering) {
|
ExtendedOverlay.prototype.hover = function (hovering) {
|
||||||
|
@ -91,9 +63,6 @@
|
||||||
lastHoveringId = 0;
|
lastHoveringId = 0;
|
||||||
}
|
}
|
||||||
this.editOverlay({ color: color(this.selected, hovering) });
|
this.editOverlay({ color: color(this.selected, hovering) });
|
||||||
if (this.model) {
|
|
||||||
this.model.editOverlay({ textures: textures(this.selected, hovering) });
|
|
||||||
}
|
|
||||||
if (hovering) {
|
if (hovering) {
|
||||||
// un-hover the last hovering overlay
|
// un-hover the last hovering overlay
|
||||||
if (lastHoveringId && lastHoveringId !== this.key) {
|
if (lastHoveringId && lastHoveringId !== this.key) {
|
||||||
|
@ -108,15 +77,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.editOverlay({ color: color(selected, this.hovering) });
|
this.editOverlay({ color: color(selected, this.hovering) });
|
||||||
if (this.model) {
|
|
||||||
this.model.editOverlay({ textures: textures(selected) });
|
|
||||||
}
|
|
||||||
this.selected = selected;
|
this.selected = selected;
|
||||||
};
|
};
|
||||||
// Class methods:
|
// Class methods:
|
||||||
var selectedIds = [];
|
var selectedId = false;
|
||||||
ExtendedOverlay.isSelected = function (id) {
|
ExtendedOverlay.isSelected = function (id) {
|
||||||
return -1 !== selectedIds.indexOf(id);
|
return selectedId === id;
|
||||||
};
|
};
|
||||||
ExtendedOverlay.get = function (key) { // answer the extended overlay data object associated with the given avatar identifier
|
ExtendedOverlay.get = function (key) { // answer the extended overlay data object associated with the given avatar identifier
|
||||||
return overlays[key];
|
return overlays[key];
|
||||||
|
@ -153,51 +119,14 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
function HighlightedEntity(id, entityProperties) {
|
|
||||||
this.id = id;
|
|
||||||
this.overlay = Overlays.addOverlay('cube', {
|
|
||||||
position: entityProperties.position,
|
|
||||||
rotation: entityProperties.rotation,
|
|
||||||
dimensions: entityProperties.dimensions,
|
|
||||||
solid: false,
|
|
||||||
color: {
|
|
||||||
red: 0xF3,
|
|
||||||
green: 0x91,
|
|
||||||
blue: 0x29
|
|
||||||
},
|
|
||||||
ignoreRayIntersection: true,
|
|
||||||
drawInFront: false // Arguable. For now, let's not distract with mysterious wires around the scene.
|
|
||||||
});
|
|
||||||
HighlightedEntity.overlays.push(this);
|
|
||||||
}
|
|
||||||
HighlightedEntity.overlays = [];
|
|
||||||
HighlightedEntity.clearOverlays = function clearHighlightedEntities() {
|
|
||||||
HighlightedEntity.overlays.forEach(function (highlighted) {
|
|
||||||
Overlays.deleteOverlay(highlighted.overlay);
|
|
||||||
});
|
|
||||||
HighlightedEntity.overlays = [];
|
|
||||||
};
|
|
||||||
HighlightedEntity.updateOverlays = function updateHighlightedEntities() {
|
|
||||||
HighlightedEntity.overlays.forEach(function (highlighted) {
|
|
||||||
var properties = Entities.getEntityProperties(highlighted.id, ['position', 'rotation', 'dimensions']);
|
|
||||||
Overlays.editOverlay(highlighted.overlay, {
|
|
||||||
position: properties.position,
|
|
||||||
rotation: properties.rotation,
|
|
||||||
dimensions: properties.dimensions
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
function addAvatarNode(id) {
|
function addAvatarNode(id) {
|
||||||
var selected = ExtendedOverlay.isSelected(id);
|
|
||||||
return new ExtendedOverlay(id, "sphere", {
|
return new ExtendedOverlay(id, "sphere", {
|
||||||
drawInFront: true,
|
drawInFront: true,
|
||||||
solid: true,
|
solid: true,
|
||||||
alpha: 0.8,
|
alpha: 0.8,
|
||||||
color: color(selected, false),
|
color: color(false, false),
|
||||||
ignoreRayIntersection: false
|
ignoreRayIntersection: false
|
||||||
}, selected, !conserveResources);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var pingPong = true;
|
var pingPong = true;
|
||||||
|
@ -236,14 +165,6 @@
|
||||||
position: target,
|
position: target,
|
||||||
dimensions: 0.032 * distance
|
dimensions: 0.032 * distance
|
||||||
});
|
});
|
||||||
if (overlay.model) {
|
|
||||||
overlay.model.ping = pingPong;
|
|
||||||
overlay.model.editOverlay({
|
|
||||||
position: target,
|
|
||||||
scale: 0.2 * distance, // constant apparent size
|
|
||||||
rotation: Camera.orientation
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
pingPong = !pingPong;
|
pingPong = !pingPong;
|
||||||
ExtendedOverlay.some(function (overlay) { // Remove any that weren't updated. (User is gone.)
|
ExtendedOverlay.some(function (overlay) { // Remove any that weren't updated. (User is gone.)
|
||||||
|
@ -251,13 +172,10 @@
|
||||||
overlay.deleteOverlay();
|
overlay.deleteOverlay();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// We could re-populateNearbyUserList if anything added or removed, but not for now.
|
|
||||||
HighlightedEntity.updateOverlays();
|
|
||||||
}
|
}
|
||||||
function removeOverlays() {
|
function removeOverlays() {
|
||||||
selectedIds = [];
|
selectedId = false;
|
||||||
lastHoveringId = 0;
|
lastHoveringId = 0;
|
||||||
HighlightedEntity.clearOverlays();
|
|
||||||
ExtendedOverlay.some(function (overlay) {
|
ExtendedOverlay.some(function (overlay) {
|
||||||
overlay.deleteOverlay();
|
overlay.deleteOverlay();
|
||||||
});
|
});
|
||||||
|
@ -267,7 +185,7 @@
|
||||||
// Clicks.
|
// Clicks.
|
||||||
//
|
//
|
||||||
function usernameFromIDReply(id, username, machineFingerprint, isAdmin) {
|
function usernameFromIDReply(id, username, machineFingerprint, isAdmin) {
|
||||||
if (selectedIds[0] === id) {
|
if (selectedId === id) {
|
||||||
var message = {
|
var message = {
|
||||||
method: 'updateSelectedRecipientUsername',
|
method: 'updateSelectedRecipientUsername',
|
||||||
userName: username === "" ? "unknown username" : username
|
userName: username === "" ? "unknown username" : username
|
||||||
|
@ -279,13 +197,13 @@
|
||||||
ExtendedOverlay.applyPickRay(pickRay, function (overlay) {
|
ExtendedOverlay.applyPickRay(pickRay, function (overlay) {
|
||||||
var nextSelectedStatus = !overlay.selected;
|
var nextSelectedStatus = !overlay.selected;
|
||||||
var avatarId = overlay.key;
|
var avatarId = overlay.key;
|
||||||
selectedIds = nextSelectedStatus ? [avatarId] : [];
|
selectedId = nextSelectedStatus ? avatarId : false;
|
||||||
if (nextSelectedStatus) {
|
if (nextSelectedStatus) {
|
||||||
Users.requestUsernameFromID(avatarId);
|
Users.requestUsernameFromID(avatarId);
|
||||||
}
|
}
|
||||||
var message = {
|
var message = {
|
||||||
method: 'selectRecipient',
|
method: 'selectRecipient',
|
||||||
id: [avatarId],
|
id: avatarId,
|
||||||
isSelected: nextSelectedStatus,
|
isSelected: nextSelectedStatus,
|
||||||
displayName: '"' + AvatarList.getAvatar(avatarId).sessionDisplayName + '"',
|
displayName: '"' + AvatarList.getAvatar(avatarId).sessionDisplayName + '"',
|
||||||
userName: ''
|
userName: ''
|
||||||
|
@ -298,24 +216,6 @@
|
||||||
overlay.select(selected);
|
overlay.select(selected);
|
||||||
});
|
});
|
||||||
|
|
||||||
HighlightedEntity.clearOverlays();
|
|
||||||
if (selectedIds.length) {
|
|
||||||
Entities.findEntitiesInFrustum(Camera.frustum).forEach(function (id) {
|
|
||||||
// Because lastEditedBy is per session, the vast majority of entities won't match,
|
|
||||||
// so it would probably be worth reducing marshalling costs by asking for just we need.
|
|
||||||
// However, providing property name(s) is advisory and some additional properties are
|
|
||||||
// included anyway. As it turns out, asking for 'lastEditedBy' gives 'position', 'rotation',
|
|
||||||
// and 'dimensions', too, so we might as well make use of them instead of making a second
|
|
||||||
// getEntityProperties call.
|
|
||||||
// It would be nice if we could harden this against future changes by specifying all
|
|
||||||
// and only these four in an array, but see
|
|
||||||
// https://highfidelity.fogbugz.com/f/cases/2728/Entities-getEntityProperties-id-lastEditedBy-name-lastEditedBy-doesn-t-work
|
|
||||||
var properties = Entities.getEntityProperties(id, 'lastEditedBy');
|
|
||||||
if (ExtendedOverlay.isSelected(properties.lastEditedBy)) {
|
|
||||||
new HighlightedEntity(id, properties);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,40 +153,16 @@ var selectionDisplay = null; // for gridTool.js to ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
// BEGIN AVATAR SELECTOR LOGIC
|
// BEGIN AVATAR SELECTOR LOGIC
|
||||||
var UNSELECTED_TEXTURES = {
|
|
||||||
"idle-D": Script.resolvePath("./assets/models/Avatar-Overlay-v1.fbx/Avatar-Overlay-v1.fbm/avatar-overlay-idle.png"),
|
|
||||||
"idle-E": Script.resolvePath("./assets/models/Avatar-Overlay-v1.fbx/Avatar-Overlay-v1.fbm/avatar-overlay-idle.png")
|
|
||||||
};
|
|
||||||
var SELECTED_TEXTURES = {
|
|
||||||
"idle-D": Script.resolvePath("./assets/models/Avatar-Overlay-v1.fbx/Avatar-Overlay-v1.fbm/avatar-overlay-selected.png"),
|
|
||||||
"idle-E": Script.resolvePath("./assets/models/Avatar-Overlay-v1.fbx/Avatar-Overlay-v1.fbm/avatar-overlay-selected.png")
|
|
||||||
};
|
|
||||||
var HOVER_TEXTURES = {
|
|
||||||
"idle-D": Script.resolvePath("./assets/models/Avatar-Overlay-v1.fbx/Avatar-Overlay-v1.fbm/avatar-overlay-hover.png"),
|
|
||||||
"idle-E": Script.resolvePath("./assets/models/Avatar-Overlay-v1.fbx/Avatar-Overlay-v1.fbm/avatar-overlay-hover.png")
|
|
||||||
};
|
|
||||||
|
|
||||||
var UNSELECTED_COLOR = { red: 0x1F, green: 0xC6, blue: 0xA6 };
|
var UNSELECTED_COLOR = { red: 0x1F, green: 0xC6, blue: 0xA6 };
|
||||||
var SELECTED_COLOR = { red: 0xF3, green: 0x91, blue: 0x29 };
|
var SELECTED_COLOR = { red: 0xF3, green: 0x91, blue: 0x29 };
|
||||||
var HOVER_COLOR = { red: 0xD0, green: 0xD0, blue: 0xD0 };
|
var HOVER_COLOR = { red: 0xD0, green: 0xD0, blue: 0xD0 };
|
||||||
var conserveResources = true;
|
|
||||||
|
|
||||||
var overlays = {}; // Keeps track of all our extended overlay data objects, keyed by target identifier.
|
var overlays = {}; // Keeps track of all our extended overlay data objects, keyed by target identifier.
|
||||||
|
|
||||||
function ExtendedOverlay(key, type, properties, selected, hasModel) { // A wrapper around overlays to store the key it is associated with.
|
function ExtendedOverlay(key, type, properties) { // A wrapper around overlays to store the key it is associated with.
|
||||||
overlays[key] = this;
|
overlays[key] = this;
|
||||||
if (hasModel) {
|
|
||||||
var modelKey = key + "-m";
|
|
||||||
this.model = new ExtendedOverlay(modelKey, "model", {
|
|
||||||
url: Script.resolvePath("./assets/models/Avatar-Overlay-v1.fbx"),
|
|
||||||
textures: textures(selected),
|
|
||||||
ignoreRayIntersection: true
|
|
||||||
}, false, false);
|
|
||||||
} else {
|
|
||||||
this.model = undefined;
|
|
||||||
}
|
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.selected = selected || false; // not undefined
|
this.selected = false;
|
||||||
this.hovering = false;
|
this.hovering = false;
|
||||||
this.activeOverlay = Overlays.addOverlay(type, properties); // We could use different overlays for (un)selected...
|
this.activeOverlay = Overlays.addOverlay(type, properties); // We could use different overlays for (un)selected...
|
||||||
}
|
}
|
||||||
|
@ -208,10 +184,6 @@ var selectionDisplay = null; // for gridTool.js to ignore
|
||||||
}
|
}
|
||||||
return { red: scale(base.red), green: scale(base.green), blue: scale(base.blue) };
|
return { red: scale(base.red), green: scale(base.green), blue: scale(base.blue) };
|
||||||
}
|
}
|
||||||
|
|
||||||
function textures(selected, hovering) {
|
|
||||||
return hovering ? HOVER_TEXTURES : selected ? SELECTED_TEXTURES : UNSELECTED_TEXTURES;
|
|
||||||
}
|
|
||||||
// so we don't have to traverse the overlays to get the last one
|
// so we don't have to traverse the overlays to get the last one
|
||||||
var lastHoveringId = 0;
|
var lastHoveringId = 0;
|
||||||
ExtendedOverlay.prototype.hover = function (hovering) {
|
ExtendedOverlay.prototype.hover = function (hovering) {
|
||||||
|
@ -223,9 +195,6 @@ var selectionDisplay = null; // for gridTool.js to ignore
|
||||||
lastHoveringId = 0;
|
lastHoveringId = 0;
|
||||||
}
|
}
|
||||||
this.editOverlay({ color: color(this.selected, hovering) });
|
this.editOverlay({ color: color(this.selected, hovering) });
|
||||||
if (this.model) {
|
|
||||||
this.model.editOverlay({ textures: textures(this.selected, hovering) });
|
|
||||||
}
|
|
||||||
if (hovering) {
|
if (hovering) {
|
||||||
// un-hover the last hovering overlay
|
// un-hover the last hovering overlay
|
||||||
if (lastHoveringId && lastHoveringId !== this.key) {
|
if (lastHoveringId && lastHoveringId !== this.key) {
|
||||||
|
@ -240,15 +209,12 @@ var selectionDisplay = null; // for gridTool.js to ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
this.editOverlay({ color: color(selected, this.hovering) });
|
this.editOverlay({ color: color(selected, this.hovering) });
|
||||||
if (this.model) {
|
|
||||||
this.model.editOverlay({ textures: textures(selected) });
|
|
||||||
}
|
|
||||||
this.selected = selected;
|
this.selected = selected;
|
||||||
};
|
};
|
||||||
// Class methods:
|
// Class methods:
|
||||||
var selectedIds = [];
|
var selectedId = false;
|
||||||
ExtendedOverlay.isSelected = function (id) {
|
ExtendedOverlay.isSelected = function (id) {
|
||||||
return -1 !== selectedIds.indexOf(id);
|
return selectedId === id;
|
||||||
};
|
};
|
||||||
ExtendedOverlay.get = function (key) { // answer the extended overlay data object associated with the given avatar identifier
|
ExtendedOverlay.get = function (key) { // answer the extended overlay data object associated with the given avatar identifier
|
||||||
return overlays[key];
|
return overlays[key];
|
||||||
|
@ -285,51 +251,14 @@ var selectionDisplay = null; // for gridTool.js to ignore
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
function HighlightedEntity(id, entityProperties) {
|
|
||||||
this.id = id;
|
|
||||||
this.overlay = Overlays.addOverlay('cube', {
|
|
||||||
position: entityProperties.position,
|
|
||||||
rotation: entityProperties.rotation,
|
|
||||||
dimensions: entityProperties.dimensions,
|
|
||||||
solid: false,
|
|
||||||
color: {
|
|
||||||
red: 0xF3,
|
|
||||||
green: 0x91,
|
|
||||||
blue: 0x29
|
|
||||||
},
|
|
||||||
ignoreRayIntersection: true,
|
|
||||||
drawInFront: false // Arguable. For now, let's not distract with mysterious wires around the scene.
|
|
||||||
});
|
|
||||||
HighlightedEntity.overlays.push(this);
|
|
||||||
}
|
|
||||||
HighlightedEntity.overlays = [];
|
|
||||||
HighlightedEntity.clearOverlays = function clearHighlightedEntities() {
|
|
||||||
HighlightedEntity.overlays.forEach(function (highlighted) {
|
|
||||||
Overlays.deleteOverlay(highlighted.overlay);
|
|
||||||
});
|
|
||||||
HighlightedEntity.overlays = [];
|
|
||||||
};
|
|
||||||
HighlightedEntity.updateOverlays = function updateHighlightedEntities() {
|
|
||||||
HighlightedEntity.overlays.forEach(function (highlighted) {
|
|
||||||
var properties = Entities.getEntityProperties(highlighted.id, ['position', 'rotation', 'dimensions']);
|
|
||||||
Overlays.editOverlay(highlighted.overlay, {
|
|
||||||
position: properties.position,
|
|
||||||
rotation: properties.rotation,
|
|
||||||
dimensions: properties.dimensions
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
function addAvatarNode(id) {
|
function addAvatarNode(id) {
|
||||||
var selected = ExtendedOverlay.isSelected(id);
|
|
||||||
return new ExtendedOverlay(id, "sphere", {
|
return new ExtendedOverlay(id, "sphere", {
|
||||||
drawInFront: true,
|
drawInFront: true,
|
||||||
solid: true,
|
solid: true,
|
||||||
alpha: 0.8,
|
alpha: 0.8,
|
||||||
color: color(selected, false),
|
color: color(false, false),
|
||||||
ignoreRayIntersection: false
|
ignoreRayIntersection: false
|
||||||
}, selected, !conserveResources);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var pingPong = true;
|
var pingPong = true;
|
||||||
|
@ -368,14 +297,6 @@ var selectionDisplay = null; // for gridTool.js to ignore
|
||||||
position: target,
|
position: target,
|
||||||
dimensions: 0.032 * distance
|
dimensions: 0.032 * distance
|
||||||
});
|
});
|
||||||
if (overlay.model) {
|
|
||||||
overlay.model.ping = pingPong;
|
|
||||||
overlay.model.editOverlay({
|
|
||||||
position: target,
|
|
||||||
scale: 0.2 * distance, // constant apparent size
|
|
||||||
rotation: Camera.orientation
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
pingPong = !pingPong;
|
pingPong = !pingPong;
|
||||||
ExtendedOverlay.some(function (overlay) { // Remove any that weren't updated. (User is gone.)
|
ExtendedOverlay.some(function (overlay) { // Remove any that weren't updated. (User is gone.)
|
||||||
|
@ -383,13 +304,10 @@ var selectionDisplay = null; // for gridTool.js to ignore
|
||||||
overlay.deleteOverlay();
|
overlay.deleteOverlay();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// We could re-populateNearbyUserList if anything added or removed, but not for now.
|
|
||||||
HighlightedEntity.updateOverlays();
|
|
||||||
}
|
}
|
||||||
function removeOverlays() {
|
function removeOverlays() {
|
||||||
selectedIds = [];
|
selectedId = false;
|
||||||
lastHoveringId = 0;
|
lastHoveringId = 0;
|
||||||
HighlightedEntity.clearOverlays();
|
|
||||||
ExtendedOverlay.some(function (overlay) {
|
ExtendedOverlay.some(function (overlay) {
|
||||||
overlay.deleteOverlay();
|
overlay.deleteOverlay();
|
||||||
});
|
});
|
||||||
|
@ -399,7 +317,7 @@ var selectionDisplay = null; // for gridTool.js to ignore
|
||||||
// Clicks.
|
// Clicks.
|
||||||
//
|
//
|
||||||
function usernameFromIDReply(id, username, machineFingerprint, isAdmin) {
|
function usernameFromIDReply(id, username, machineFingerprint, isAdmin) {
|
||||||
if (selectedIds[0] === id) {
|
if (selectedId === id) {
|
||||||
var message = {
|
var message = {
|
||||||
method: 'updateSelectedRecipientUsername',
|
method: 'updateSelectedRecipientUsername',
|
||||||
userName: username === "" ? "unknown username" : username
|
userName: username === "" ? "unknown username" : username
|
||||||
|
@ -411,13 +329,13 @@ var selectionDisplay = null; // for gridTool.js to ignore
|
||||||
ExtendedOverlay.applyPickRay(pickRay, function (overlay) {
|
ExtendedOverlay.applyPickRay(pickRay, function (overlay) {
|
||||||
var nextSelectedStatus = !overlay.selected;
|
var nextSelectedStatus = !overlay.selected;
|
||||||
var avatarId = overlay.key;
|
var avatarId = overlay.key;
|
||||||
selectedIds = nextSelectedStatus ? [avatarId] : [];
|
selectedId = nextSelectedStatus ? avatarId : false;
|
||||||
if (nextSelectedStatus) {
|
if (nextSelectedStatus) {
|
||||||
Users.requestUsernameFromID(avatarId);
|
Users.requestUsernameFromID(avatarId);
|
||||||
}
|
}
|
||||||
var message = {
|
var message = {
|
||||||
method: 'selectRecipient',
|
method: 'selectRecipient',
|
||||||
id: [avatarId],
|
id: avatarId,
|
||||||
isSelected: nextSelectedStatus,
|
isSelected: nextSelectedStatus,
|
||||||
displayName: '"' + AvatarList.getAvatar(avatarId).sessionDisplayName + '"',
|
displayName: '"' + AvatarList.getAvatar(avatarId).sessionDisplayName + '"',
|
||||||
userName: ''
|
userName: ''
|
||||||
|
@ -430,24 +348,6 @@ var selectionDisplay = null; // for gridTool.js to ignore
|
||||||
overlay.select(selected);
|
overlay.select(selected);
|
||||||
});
|
});
|
||||||
|
|
||||||
HighlightedEntity.clearOverlays();
|
|
||||||
if (selectedIds.length) {
|
|
||||||
Entities.findEntitiesInFrustum(Camera.frustum).forEach(function (id) {
|
|
||||||
// Because lastEditedBy is per session, the vast majority of entities won't match,
|
|
||||||
// so it would probably be worth reducing marshalling costs by asking for just we need.
|
|
||||||
// However, providing property name(s) is advisory and some additional properties are
|
|
||||||
// included anyway. As it turns out, asking for 'lastEditedBy' gives 'position', 'rotation',
|
|
||||||
// and 'dimensions', too, so we might as well make use of them instead of making a second
|
|
||||||
// getEntityProperties call.
|
|
||||||
// It would be nice if we could harden this against future changes by specifying all
|
|
||||||
// and only these four in an array, but see
|
|
||||||
// https://highfidelity.fogbugz.com/f/cases/2728/Entities-getEntityProperties-id-lastEditedBy-name-lastEditedBy-doesn-t-work
|
|
||||||
var properties = Entities.getEntityProperties(id, 'lastEditedBy');
|
|
||||||
if (ExtendedOverlay.isSelected(properties.lastEditedBy)) {
|
|
||||||
new HighlightedEntity(id, properties);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,21 +9,25 @@ function endsWith(path, exts) {
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.handlers = {
|
exports.handlers = {
|
||||||
|
|
||||||
|
// This event is triggered before parsing has even started.
|
||||||
|
// We use this event to scan the C++ files for jsdoc comments
|
||||||
|
// and reformat them into a form digestable by jsdoc.
|
||||||
beforeParse: function(e) {
|
beforeParse: function(e) {
|
||||||
const pathTools = require('path');
|
var pathTools = require('path');
|
||||||
var rootFolder = pathTools.dirname(e.filename);
|
var rootFolder = pathTools.dirname(e.filename);
|
||||||
console.log("Scanning hifi source for jsdoc comments...");
|
console.log("Scanning hifi source for jsdoc comments...");
|
||||||
|
|
||||||
// directories to scan for jsdoc comments
|
// directories to scan for jsdoc comments
|
||||||
var dirList = [
|
var dirList = [
|
||||||
'../../interface/src',
|
'../../interface/src',
|
||||||
'../../interface/src/assets',
|
'../../interface/src/assets',
|
||||||
'../../interface/src/audio',
|
'../../interface/src/audio',
|
||||||
'../../interface/src/avatar',
|
'../../interface/src/avatar',
|
||||||
'../../interface/src/commerce',
|
'../../interface/src/commerce',
|
||||||
'../../interface/src/devices',
|
'../../interface/src/devices',
|
||||||
'../../interface/src/java',
|
'../../interface/src/java',
|
||||||
'../../interface/src/networking',
|
'../../interface/src/networking',
|
||||||
'../../interface/src/ui/',
|
'../../interface/src/ui/',
|
||||||
'../../interface/src/scripting',
|
'../../interface/src/scripting',
|
||||||
'../../interface/src/ui/overlays',
|
'../../interface/src/ui/overlays',
|
||||||
|
@ -50,25 +54,93 @@ exports.handlers = {
|
||||||
'../../libraries/trackers/src/trackers',
|
'../../libraries/trackers/src/trackers',
|
||||||
'../../libraries/ui/src/ui',
|
'../../libraries/ui/src/ui',
|
||||||
'../../plugins/oculus/src',
|
'../../plugins/oculus/src',
|
||||||
'../../plugins/openvr/src',
|
'../../plugins/openvr/src'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// only files with this extension will be searched for jsdoc comments.
|
||||||
var exts = ['.h', '.cpp'];
|
var exts = ['.h', '.cpp'];
|
||||||
|
|
||||||
const fs = require('fs');
|
var fs = require('fs');
|
||||||
dirList.forEach(function (dir) {
|
dirList.forEach(function (dir) {
|
||||||
var joinedDir = pathTools.join(rootFolder, dir);
|
var joinedDir = pathTools.join(rootFolder, dir);
|
||||||
var files = fs.readdirSync(joinedDir)
|
var files = fs.readdirSync(joinedDir);
|
||||||
files.forEach(function (file) {
|
files.forEach(function (file) {
|
||||||
var path = pathTools.join(joinedDir, file);
|
var path = pathTools.join(joinedDir, file);
|
||||||
if (fs.lstatSync(path).isFile() && endsWith(path, exts)) {
|
if (fs.lstatSync(path).isFile() && endsWith(path, exts)) {
|
||||||
|
// load entire file into a string
|
||||||
var data = fs.readFileSync(path, "utf8");
|
var data = fs.readFileSync(path, "utf8");
|
||||||
|
|
||||||
|
// this regex searches for blocks starting with /**jsdoc and end with */
|
||||||
var reg = /(\/\*\*jsdoc(.|[\r\n])*?\*\/)/gm;
|
var reg = /(\/\*\*jsdoc(.|[\r\n])*?\*\/)/gm;
|
||||||
var matches = data.match(reg);
|
var matches = data.match(reg);
|
||||||
if (matches) {
|
if (matches) {
|
||||||
e.source += matches.map(function (s) { return s.replace('/**jsdoc', '/**'); }).join('\n');
|
// add to source, but strip off c-comment asterisks
|
||||||
|
e.source += matches.map(function (s) {
|
||||||
|
return s.replace('/**jsdoc', '/**');
|
||||||
|
}).join('\n');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// This event is triggered when a new doclet has been created
|
||||||
|
// but before it is passed to the template for output
|
||||||
|
newDoclet: function (e) {
|
||||||
|
|
||||||
|
// we only care about hifi custom tags on namespace and class doclets
|
||||||
|
if (e.doclet.kind === "namespace" || e.doclet.kind === "class") {
|
||||||
|
var rows = [];
|
||||||
|
if (e.doclet.hifiInterface) {
|
||||||
|
rows.push("Interface Scripts");
|
||||||
|
}
|
||||||
|
if (e.doclet.hifiAssignmentClient) {
|
||||||
|
rows.push("Assignment Client Scripts");
|
||||||
|
}
|
||||||
|
if (e.doclet.hifiClientEntity) {
|
||||||
|
rows.push("Client Entity Scripts");
|
||||||
|
}
|
||||||
|
if (e.doclet.hifiServerEntity) {
|
||||||
|
rows.push("Server Entity Scripts");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Append an Available In: table at the end of the namespace description.
|
||||||
|
if (rows.length > 0) {
|
||||||
|
var table = "<br><br><table><td>Available In:<td>" + rows.join("<td>") + "</table>";
|
||||||
|
e.doclet.description = e.doclet.description + table;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Define custom hifi tags here
|
||||||
|
exports.defineTags = function (dictionary) {
|
||||||
|
|
||||||
|
// @hifi-interface
|
||||||
|
dictionary.defineTag("hifi-interface", {
|
||||||
|
onTagged: function (doclet, tag) {
|
||||||
|
doclet.hifiInterface = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// @hifi-assignment-client
|
||||||
|
dictionary.defineTag("hifi-assigment-client", {
|
||||||
|
onTagged: function (doclet, tag) {
|
||||||
|
doclet.hifiAssignmentClient = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// @hifi-client-entity
|
||||||
|
dictionary.defineTag("hifi-client-entity", {
|
||||||
|
onTagged: function (doclet, tag) {
|
||||||
|
doclet.hifiClientEntity = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// @hifi-server-entity
|
||||||
|
dictionary.defineTag("hifi-server-entity", {
|
||||||
|
onTagged: function (doclet, tag) {
|
||||||
|
doclet.hifiServerEntity = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in a new issue