+
+Q_LOGGING_CATEGORY(crash_handler, "vircadia.crash_handler")
+
bool startCrashHandler(std::string appPath) {
- qDebug() << "No crash handler available.";
+ qCWarning(crash_handler) << "No crash handler available.";
return false;
}
diff --git a/interface/src/avatar/AvatarDoctor.cpp b/interface/src/avatar/AvatarDoctor.cpp
index d84383cf4f..e3a5a68621 100644
--- a/interface/src/avatar/AvatarDoctor.cpp
+++ b/interface/src/avatar/AvatarDoctor.cpp
@@ -1,9 +1,9 @@
//
// AvatarDoctor.cpp
//
-//
// Created by Thijs Wenker on 2/12/2019.
// Copyright 2019 High Fidelity, Inc.
+// Copyright 2021 Vircadia contributors.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@@ -55,7 +55,7 @@ static QStringList HAND_MAPPING_SUFFIXES = {
"HandThumb1",
};
-const QUrl PACKAGE_AVATAR_DOCS_BASE_URL = QUrl("https://docs.vircadia.dev/create/avatars/package-avatar.html");
+const QUrl PACKAGE_AVATAR_DOCS_BASE_URL = QUrl("https://docs.vircadia.com/create/avatars/package-avatar.html");
AvatarDoctor::AvatarDoctor(const QUrl& avatarFSTFileUrl) :
_avatarFSTFileUrl(avatarFSTFileUrl) {
@@ -71,7 +71,7 @@ void AvatarDoctor::startDiagnosing() {
return;
}
_isDiagnosing = true;
-
+
_errors.clear();
_externalTextureCount = 0;
@@ -107,7 +107,7 @@ void AvatarDoctor::startDiagnosing() {
if (avatarModel.joints.length() > NETWORKED_JOINTS_LIMIT) {
addError(tr( "Avatar has over %n bones.", "", NETWORKED_JOINTS_LIMIT), "maximum-bone-limit");
}
- // Avatar does not have Hips bone mapped
+ // Avatar does not have Hips bone mapped
if (!jointNames.contains("Hips")) {
addError("Hips are not mapped.", "hips-not-mapped");
}
@@ -236,7 +236,7 @@ void AvatarDoctor::startDiagnosing() {
for (const auto& jointVariant: jointNameMappings.values()) {
jointValues << jointVariant.toString();
}
-
+
const auto& uniqueJointValues = jointValues.toSet();
for (const auto& jointName: uniqueJointValues) {
if (jointValues.count(jointName) > 1) {
@@ -279,7 +279,7 @@ void AvatarDoctor::startDiagnosing() {
} else {
connect(materialMappingResource.data(), &NetworkTexture::finished, this,
[materialMappingHandled](bool success) mutable {
-
+
materialMappingHandled();
});
}
@@ -302,7 +302,7 @@ void AvatarDoctor::startDiagnosing() {
} else {
addError("Model file cannot be opened", "missing-file");
emit complete(getErrors());
- }
+ }
}
void AvatarDoctor::diagnoseTextures() {
diff --git a/interface/src/avatar/MyAvatar.h b/interface/src/avatar/MyAvatar.h
index cd9f929a62..3fceae534f 100644
--- a/interface/src/avatar/MyAvatar.h
+++ b/interface/src/avatar/MyAvatar.h
@@ -4,6 +4,7 @@
//
// Created by Mark Peng on 8/16/13.
// Copyright 2012 High Fidelity, Inc.
+// Copyright 2021 Vircadia contributors.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@@ -47,11 +48,11 @@ class DetailedMotionState;
* Value | Name | Description |
*
*
- * 0 | Default | Your walking speed is constant; it doesn't change depending on how far
+ * |
0 | Default | Your walking speed is constant; it doesn't change depending on how far
* forward you push your controller's joystick. Fully pushing your joystick forward makes your avatar run. |
- * 1 | Analog | Your walking speed changes in steps based on how far forward you push your
+ * |
1 | Analog | Your walking speed changes in steps based on how far forward you push your
* controller's joystick. Fully pushing your joystick forward makes your avatar run. |
- * 2 | AnalogPlus | Your walking speed changes proportionally to how far forward you push
+ * |
2 | AnalogPlus | Your walking speed changes proportionally to how far forward you push
* your controller's joystick. Fully pushing your joystick forward makes your avatar run. |
*
*
@@ -154,11 +155,11 @@ class MyAvatar : public Avatar {
* Note: This property will automatically be set to true
if the controller system has
* valid facial blend shape actions.
* @property {boolean} hasProceduralBlinkFaceMovement=true - true
if avatars blink automatically by animating
- * facial blend shapes, false
if automatic blinking is disabled. Set to false
to fully control
+ * facial blend shapes, false
if automatic blinking is disabled. Set to false
to fully control
* the blink facial blend shapes via the {@link MyAvatar.setBlendshape} method.
* @property {boolean} hasProceduralEyeFaceMovement=true - true
if the facial blend shapes for an avatar's eyes
* adjust automatically as the eyes move, false
if this automatic movement is disabled. Set this property
- * to true
to prevent the iris from being obscured by the upper or lower lids. Set to false
to
+ * to true
to prevent the iris from being obscured by the upper or lower lids. Set to false
to
* fully control the eye blend shapes via the {@link MyAvatar.setBlendshape} method.
* @property {boolean} hasAudioEnabledFaceMovement=true - true
if the avatar's mouth blend shapes animate
* automatically based on detected microphone input, false
if this automatic movement is disabled. Set
@@ -175,16 +176,16 @@ class MyAvatar : public Avatar {
* @property {boolean} shouldRenderLocally=true - If true
then your avatar is rendered for you in Interface,
* otherwise it is not rendered for you (but it is still rendered for other users).
* @property {Vec3} motorVelocity=Vec3.ZERO - The target velocity of your avatar to be achieved by a scripted motor.
- * @property {number} motorTimescale=1000000 - The timescale for the scripted motor to achieve the target
+ * @property {number} motorTimescale=1000000 - The timescale for the scripted motor to achieve the target
* motorVelocity
avatar velocity. Smaller values result in higher acceleration.
- * @property {string} motorReferenceFrame="camera" - Reference frame of the motorVelocity
. Must be one of the
+ * @property {string} motorReferenceFrame="camera" - Reference frame of the motorVelocity
. Must be one of the
* following: "camera"
, "avatar"
, and "world"
.
- * @property {string} motorMode="simple" - The Type of scripted motor behavior: "simple"
to use the
+ * @property {string} motorMode="simple" - The Type of scripted motor behavior: "simple"
to use the
* motorTimescale
time scale; "dynamic"
to use character controller timescales.
- * @property {string} collisionSoundURL="Body_Hits_Impact.wav" - The sound that's played when the avatar experiences a
- * collision. It can be a mono or stereo 16-bit WAV file running at either 24kHz or 48kHz. The latter is down-sampled
+ * @property {string} collisionSoundURL="Body_Hits_Impact.wav" - The sound that's played when the avatar experiences a
+ * collision. It can be a mono or stereo 16-bit WAV file running at either 24kHz or 48kHz. The latter is down-sampled
* by the audio mixer, so all audio effectively plays back at a 24khz. 48kHz RAW files are also supported.
- * @property {number} audioListenerMode=0 - Specifies the listening position when hearing spatialized audio. Must be one
+ * @property {number} audioListenerMode=0 - Specifies the listening position when hearing spatialized audio. Must be one
* of the following property values:
*
* MyAvatar.audioListenerModeHead
@@ -193,93 +194,93 @@ class MyAvatar : public Avatar {
*
* @property {number} audioListenerModeHead=0 - The audio listening position is at the avatar's head. Read-only.
* @property {number} audioListenerModeCamera=1 - The audio listening position is at the camera. Read-only.
- * @property {number} audioListenerModeCustom=2 - The audio listening position is at a the position specified by set by the
+ * @property {number} audioListenerModeCustom=2 - The audio listening position is at a the position specified by set by the
* customListenPosition
and customListenOrientation
property values. Read-only.
* @property {Vec3} customListenPosition=Vec3.ZERO - The listening position used when the audioListenerMode
* property value is audioListenerModeCustom
.
* @property {Quat} customListenOrientation=Quat.IDENTITY - The listening orientation used when the
* audioListenerMode
property value is audioListenerModeCustom
.
- * @property {number} rotationRecenterFilterLength - Configures how quickly the avatar root rotates to recenter its facing
- * direction to match that of the user's torso based on head and hands orientation. A smaller value makes the
+ * @property {number} rotationRecenterFilterLength - Configures how quickly the avatar root rotates to recenter its facing
+ * direction to match that of the user's torso based on head and hands orientation. A smaller value makes the
* recentering happen more quickly. The minimum value is 0.01
.
- * @property {number} rotationThreshold - The angle in radians that the user's torso facing direction (based on head and
+ * @property {number} rotationThreshold - The angle in radians that the user's torso facing direction (based on head and
* hands orientation) can differ from that of the avatar before the avatar's root is rotated to match the user's torso.
- * @property {boolean} enableStepResetRotation - If true
then after the user's avatar takes a step, the
- * avatar's root immediately rotates to recenter its facing direction to match that of the user's torso based on head
+ * @property {boolean} enableStepResetRotation - If true
then after the user's avatar takes a step, the
+ * avatar's root immediately rotates to recenter its facing direction to match that of the user's torso based on head
* and hands orientation.
- * @property {boolean} enableDrawAverageFacing - If true
, debug graphics are drawn that show the average
- * facing direction of the user's torso (based on head and hands orientation). This can be useful if you want to try
+ * @property {boolean} enableDrawAverageFacing - If true
, debug graphics are drawn that show the average
+ * facing direction of the user's torso (based on head and hands orientation). This can be useful if you want to try
* out different filter lengths and thresholds.
*
- * @property {Vec3} leftHandPosition - The position of the left hand in avatar coordinates if it's being positioned by
+ * @property {Vec3} leftHandPosition - The position of the left hand in avatar coordinates if it's being positioned by
* controllers, otherwise {@link Vec3(0)|Vec3.ZERO}. Read-only.
* @property {Vec3} rightHandPosition - The position of the right hand in avatar coordinates if it's being positioned by
* controllers, otherwise {@link Vec3(0)|Vec3.ZERO}. Read-only.
- * @property {Vec3} leftHandTipPosition - The position 0.3m in front of the left hand's position, in the direction along the
- * palm, in avatar coordinates. If the hand isn't being positioned by a controller, the value is
+ * @property {Vec3} leftHandTipPosition - The position 0.3m in front of the left hand's position, in the direction along the
+ * palm, in avatar coordinates. If the hand isn't being positioned by a controller, the value is
* {@link Vec3(0)|Vec3.ZERO}. Read-only.
- * @property {Vec3} rightHandTipPosition - The position 0.3m in front of the right hand's position, in the direction along
- * the palm, in avatar coordinates. If the hand isn't being positioned by a controller, the value is
+ * @property {Vec3} rightHandTipPosition - The position 0.3m in front of the right hand's position, in the direction along
+ * the palm, in avatar coordinates. If the hand isn't being positioned by a controller, the value is
* {@link Vec3(0)|Vec3.ZERO}. Read-only.
*
- * @property {Pose} leftHandPose - The left hand's pose as determined by the hand controllers, relative to the avatar.
+ * @property {Pose} leftHandPose - The left hand's pose as determined by the hand controllers, relative to the avatar.
* Read-only.
* @property {Pose} rightHandPose - The right hand's pose as determined by the hand controllers, relative to the avatar.
* Read-only.
- * @property {Pose} leftHandTipPose - The left hand's pose as determined by the hand controllers, relative to the avatar,
+ * @property {Pose} leftHandTipPose - The left hand's pose as determined by the hand controllers, relative to the avatar,
* with the position adjusted by 0.3m along the direction of the palm. Read-only.
- * @property {Pose} rightHandTipPose - The right hand's pose as determined by the hand controllers, relative to the avatar,
+ * @property {Pose} rightHandTipPose - The right hand's pose as determined by the hand controllers, relative to the avatar,
* with the position adjusted by 0.3m along the direction of the palm. Read-only.
*
* @property {number} energy - Deprecated: This property will be removed.
- * @property {boolean} isAway - true
if your avatar is away (i.e., inactive), false
if it is
+ * @property {boolean} isAway - true
if your avatar is away (i.e., inactive), false
if it is
* active.
*
* @property {boolean} centerOfGravityModelEnabled=true - true
if the avatar hips are placed according to
* the center of gravity model that balances the center of gravity over the base of support of the feet. Set the
* value to false
for default behavior where the hips are positioned under the head.
- * @property {boolean} hmdLeanRecenterEnabled=true - true
IF the avatar is re-centered to be under the
- * head's position. In room-scale VR, this behavior is what causes your avatar to follow your HMD as you walk around
+ * @property {boolean} hmdLeanRecenterEnabled=true - true
IF the avatar is re-centered to be under the
+ * head's position. In room-scale VR, this behavior is what causes your avatar to follow your HMD as you walk around
* the room. Setting the value false
is useful if you want to pin the avatar to a fixed position.
- * @property {boolean} collisionsEnabled - Set to true
to enable the avatar to collide with the environment,
- * false
to disable collisions with the environment. May return true
even though the value
+ * @property {boolean} collisionsEnabled - Set to true
to enable the avatar to collide with the environment,
+ * false
to disable collisions with the environment. May return true
even though the value
* was set false
because the zone may disallow collisionless avatars.
- * @property {boolean} otherAvatarsCollisionsEnabled - Set to true
to enable the avatar to collide with other
+ * @property {boolean} otherAvatarsCollisionsEnabled - Set to true
to enable the avatar to collide with other
* avatars, false
to disable collisions with other avatars.
* @property {boolean} characterControllerEnabled - Synonym of collisionsEnabled
.
- * Deprecated: This property is deprecated and will be removed. Use collisionsEnabled
+ *
Deprecated: This property is deprecated and will be removed. Use collisionsEnabled
* instead.
- * @property {boolean} useAdvancedMovementControls - Returns and sets the value of the Interface setting, Settings >
+ * @property {boolean} useAdvancedMovementControls - Returns and sets the value of the Interface setting, Settings >
* Controls > Walking. Note: Setting the value has no effect unless Interface is restarted.
- * @property {boolean} showPlayArea - Returns and sets the value of the Interface setting, Settings > Controls > Show room
+ * @property {boolean} showPlayArea - Returns and sets the value of the Interface setting, Settings > Controls > Show room
* boundaries while teleporting.
* Note: Setting the value has no effect unless Interface is restarted.
*
* @property {number} yawSpeed=75 - The mouse X sensitivity value in Settings > General. Read-only.
* @property {number} pitchSpeed=50 - The mouse Y sensitivity value in Settings > General. Read-only.
*
- * @property {boolean} hmdRollControlEnabled=true - If true
, the roll angle of your HMD turns your avatar
+ * @property {boolean} hmdRollControlEnabled=true - If true
, the roll angle of your HMD turns your avatar
* while flying.
- * @property {number} hmdRollControlDeadZone=8 - The amount of HMD roll, in degrees, required before your avatar turns if
+ * @property {number} hmdRollControlDeadZone=8 - The amount of HMD roll, in degrees, required before your avatar turns if
* hmdRollControlEnabled
is enabled.
- * @property {number} hmdRollControlRate If MyAvatar.hmdRollControlEnabled
is true, this value determines the
+ * @property {number} hmdRollControlRate If MyAvatar.hmdRollControlEnabled
is true, this value determines the
* maximum turn rate of your avatar when rolling your HMD in degrees per second.
*
* @property {number} userHeight=1.75 - The height of the user in sensor space.
* @property {number} userEyeHeight=1.65 - The estimated height of the user's eyes in sensor space. Read-only.
*
- * @property {Uuid} SELF_ID - UUID representing "my avatar". Only use for local-only entities in situations
- * where MyAvatar.sessionUUID is not available (e.g., if not connected to a domain). Note: Likely to be deprecated.
+ * @property {Uuid} SELF_ID - UUID representing "my avatar". Only use for local-only entities in situations
+ * where MyAvatar.sessionUUID is not available (e.g., if not connected to a domain). Note: Likely to be deprecated.
* Read-only.
*
- * @property {number} walkSpeed - The walk speed of your avatar for the current control scheme (see
+ * @property {number} walkSpeed - The walk speed of your avatar for the current control scheme (see
* {@link MyAvatar.getControlScheme|getControlScheme}).
- * @property {number} walkBackwardSpeed - The walk backward speed of your avatar for the current control scheme (see
+ * @property {number} walkBackwardSpeed - The walk backward speed of your avatar for the current control scheme (see
* {@link MyAvatar.getControlScheme|getControlScheme}).
- * @property {number} sprintSpeed - The sprint (run) speed of your avatar for the current control scheme (see
+ * @property {number} sprintSpeed - The sprint (run) speed of your avatar for the current control scheme (see
* {@link MyAvatar.getControlScheme|getControlScheme}).
* @property {number} analogPlusWalkSpeed - The walk speed of your avatar for the "AnalogPlus" control scheme.
- * Warning: Setting this value also sets the value of analogPlusSprintSpeed
to twice
+ *
Warning: Setting this value also sets the value of analogPlusSprintSpeed
to twice
* the value.
* @property {number} analogPlusSprintSpeed - The sprint (run) speed of your avatar for the "AnalogPlus" control scheme.
* @property {MyAvatar.SitStandModelType} userRecenterModel - Controls avatar leaning and recentering behavior.
@@ -289,11 +290,11 @@ class MyAvatar : public Avatar {
* is allowed to stand, lean or recenter its footing, depending on user preferences.
* The property value automatically updates as the user sits or stands. Setting the property value overrides the current
* sitting / standing state, which is updated when the user next sits or stands.
- * @property {boolean} isSitStandStateLocked - true
to lock the avatar sitting/standing state, i.e., use this
+ * @property {boolean} isSitStandStateLocked - true
to lock the avatar sitting/standing state, i.e., use this
* to disable automatically changing state.
- * Deprecated: This property is deprecated and will be removed.
+ *
Deprecated: This property is deprecated and will be removed.
* See also: getUserRecenterModel
and setUserRecenterModel
.
- * @property {boolean} allowTeleporting - true
if teleporting is enabled in the Interface settings,
+ * @property {boolean} allowTeleporting - true
if teleporting is enabled in the Interface settings,
* false
if it isn't. Read-only.
*
* @borrows Avatar.getDomainMinScale as getDomainMinScale
@@ -435,7 +436,7 @@ class MyAvatar : public Avatar {
public:
/*@jsdoc
- * The DriveKeys
API provides constant numeric values that represent different logical keys that drive your
+ * The DriveKeys
API provides constant numeric values that represent different logical keys that drive your
* avatar and camera.
*
* @namespace DriveKeys
@@ -444,27 +445,27 @@ public:
* @hifi-client-entity
* @hifi-avatar
*
- * @property {number} TRANSLATE_X - Move the user's avatar in the direction of its x-axis, if the camera isn't in
+ * @property {number} TRANSLATE_X - Move the user's avatar in the direction of its x-axis, if the camera isn't in
* independent or mirror modes.
- * @property {number} TRANSLATE_Y - Move the user's avatar in the direction of its y-axis, if the camera isn't in
+ * @property {number} TRANSLATE_Y - Move the user's avatar in the direction of its y-axis, if the camera isn't in
* independent or mirror modes.
- * @property {number} TRANSLATE_Z - Move the user's avatar in the direction of its z-axis, if the camera isn't in
+ * @property {number} TRANSLATE_Z - Move the user's avatar in the direction of its z-axis, if the camera isn't in
* independent or mirror modes.
- * @property {number} YAW - Rotate the user's avatar about its y-axis at a rate proportional to the control value, if the
+ * @property {number} YAW - Rotate the user's avatar about its y-axis at a rate proportional to the control value, if the
* camera isn't in independent or mirror modes.
* @property {number} STEP_TRANSLATE_X - No action.
* @property {number} STEP_TRANSLATE_Y - No action.
* @property {number} STEP_TRANSLATE_Z - No action.
- * @property {number} STEP_YAW - Rotate the user's avatar about its y-axis in a step increment, if the camera isn't in
+ * @property {number} STEP_YAW - Rotate the user's avatar about its y-axis in a step increment, if the camera isn't in
* independent or mirror modes.
- * @property {number} PITCH - Rotate the user's avatar head and attached camera about its negative x-axis (i.e., positive
- * values pitch down) at a rate proportional to the control value, if the camera isn't in HMD, independent, or mirror
+ * @property {number} PITCH - Rotate the user's avatar head and attached camera about its negative x-axis (i.e., positive
+ * values pitch down) at a rate proportional to the control value, if the camera isn't in HMD, independent, or mirror
* modes.
* @property {number} ZOOM - Zoom the camera in or out.
- * @property {number} DELTA_YAW - Rotate the user's avatar about its y-axis by an amount proportional to the control value,
+ * @property {number} DELTA_YAW - Rotate the user's avatar about its y-axis by an amount proportional to the control value,
* if the camera isn't in independent or mirror modes.
- * @property {number} DELTA_PITCH - Rotate the user's avatar head and attached camera about its negative x-axis (i.e.,
- * positive values pitch down) by an amount proportional to the control value, if the camera isn't in HMD, independent,
+ * @property {number} DELTA_PITCH - Rotate the user's avatar head and attached camera about its negative x-axis (i.e.,
+ * positive values pitch down) by an amount proportional to the control value, if the camera isn't in HMD, independent,
* or mirror modes.
*/
@@ -475,27 +476,27 @@ public:
* Value | Description |
*
*
- * {@link DriveKeys|DriveKeys.TRANSLATE_X} | Move the user's avatar in the direction of its
+ * |
{@link DriveKeys|DriveKeys.TRANSLATE_X} | Move the user's avatar in the direction of its
* x-axis, if the camera isn't in independent or mirror modes. |
- * {@link DriveKeys|DriveKeys.TRANSLATE_Y} | Move the user's avatar in the direction of its
+ * |
{@link DriveKeys|DriveKeys.TRANSLATE_Y} | Move the user's avatar in the direction of its
* -axis, if the camera isn't in independent or mirror modes. |
- * {@link DriveKeys|DriveKeys.TRANSLATE_Z} | Move the user's avatar in the direction of its
+ * |
{@link DriveKeys|DriveKeys.TRANSLATE_Z} | Move the user's avatar in the direction of its
* z-axis, if the camera isn't in independent or mirror modes. |
- * {@link DriveKeys|DriveKeys.YAW} | Rotate the user's avatar about its y-axis at a rate
+ * |
{@link DriveKeys|DriveKeys.YAW} | Rotate the user's avatar about its y-axis at a rate
* proportional to the control value, if the camera isn't in independent or mirror modes. |
* {@link DriveKeys|DriveKeys.STEP_TRANSLATE_X} | No action. |
* {@link DriveKeys|DriveKeys.STEP_TRANSLATE_Y} | No action. |
* {@link DriveKeys|DriveKeys.STEP_TRANSLATE_Z} | No action. |
- * {@link DriveKeys|DriveKeys.STEP_YAW} | Rotate the user's avatar about its y-axis in a
+ * |
{@link DriveKeys|DriveKeys.STEP_YAW} | Rotate the user's avatar about its y-axis in a
* step increment, if the camera isn't in independent or mirror modes. |
- * {@link DriveKeys|DriveKeys.PITCH} | Rotate the user's avatar head and attached camera
- * about its negative x-axis (i.e., positive values pitch down) at a rate proportional to the control value, if the
+ * |
{@link DriveKeys|DriveKeys.PITCH} | Rotate the user's avatar head and attached camera
+ * about its negative x-axis (i.e., positive values pitch down) at a rate proportional to the control value, if the
* camera isn't in HMD, independent, or mirror modes. |
* {@link DriveKeys|DriveKeys.ZOOM} | Zoom the camera in or out. |
- * {@link DriveKeys|DriveKeys.DELTA_YAW} | Rotate the user's avatar about its y-axis by an
+ * |
{@link DriveKeys|DriveKeys.DELTA_YAW} | Rotate the user's avatar about its y-axis by an
* amount proportional to the control value, if the camera isn't in independent or mirror modes. |
- * {@link DriveKeys|DriveKeys.DELTA_PITCH} | Rotate the user's avatar head and attached
- * camera about its negative x-axis (i.e., positive values pitch down) by an amount proportional to the control
+ * |
{@link DriveKeys|DriveKeys.DELTA_PITCH} | Rotate the user's avatar head and attached
+ * camera about its negative x-axis (i.e., positive values pitch down) by an amount proportional to the control
* value, if the camera isn't in HMD, independent, or mirror modes. |
*
*
@@ -526,16 +527,16 @@ public:
* Value | Name | Description |
*
*
- * 0 | ForceSit | Assumes the user is seated in the real world. Disables avatar
+ * |
0 | ForceSit | Assumes the user is seated in the real world. Disables avatar
* leaning regardless of what the avatar is doing in the virtual world (i.e., avatar always recenters). |
- * 1 | ForceStand | Assumes the user is standing in the real world. Enables avatar
- * leaning regardless of what the avatar is doing in the virtual world (i.e., avatar leans, then if leans too far it
+ * |
1 | ForceStand | Assumes the user is standing in the real world. Enables avatar
+ * leaning regardless of what the avatar is doing in the virtual world (i.e., avatar leans, then if leans too far it
* recenters). |
- * 2 | Auto | Interface detects when the user is standing or seated in the real world.
- * Avatar leaning is disabled when the user is sitting (i.e., avatar always recenters), and avatar leaning is enabled
+ * |
2 | Auto | Interface detects when the user is standing or seated in the real world.
+ * Avatar leaning is disabled when the user is sitting (i.e., avatar always recenters), and avatar leaning is enabled
* when the user is standing (i.e., avatar leans, then if leans too far it recenters). |
- * 3 | DisableHMDLean | Both avatar leaning and recentering are disabled regardless of
- * what the user is doing in the real world and no matter what their avatar is doing in the virtual world. Enables
+ * |
3 | DisableHMDLean | Both avatar leaning and recentering are disabled regardless of
+ * what the user is doing in the real world and no matter what their avatar is doing in the virtual world. Enables
* the avatar to sit on the floor when the user sits on the floor.
* Note: Experimental. |
*
@@ -597,7 +598,7 @@ public:
Q_INVOKABLE void resetSensorsAndBody();
/*@jsdoc
- * Moves and orients the avatar, such that it is directly underneath the HMD, with toes pointed forward in the direction of
+ * Moves and orients the avatar, such that it is directly underneath the HMD, with toes pointed forward in the direction of
* the HMD.
* @function MyAvatar.centerBody
*/
@@ -606,7 +607,7 @@ public:
/*@jsdoc
* Clears inverse kinematics joint limit history.
- * The internal inverse-kinematics system maintains a record of which joints are "locked". Sometimes it is useful to
+ *
The internal inverse-kinematics system maintains a record of which joints are "locked". Sometimes it is useful to
* forget this history to prevent contorted joints, e.g., after finishing with an override animation.
* @function MyAvatar.clearIKJointLimitHistory
*/
@@ -657,7 +658,7 @@ public:
/*@jsdoc
* Gets the position in world coordinates of the point directly between your avatar's eyes assuming your avatar was in its
- * default pose. This is a reference position; it does not change as your avatar's head moves relative to the avatar
+ * default pose. This is a reference position; it does not change as your avatar's head moves relative to the avatar
* position.
* @function MyAvatar.getDefaultEyePosition
* @returns {Vec3} Default position between your avatar's eyes in world coordinates.
@@ -672,17 +673,17 @@ public:
/*@jsdoc
* Overrides the default avatar animations.
* The avatar animation system includes a set of default animations along with rules for how those animations are blended
- * together with procedural data (such as look at vectors, hand sensors etc.). overrideAnimation()
is used to
- * completely override all motion from the default animation system (including inverse kinematics for hand and head
- * controllers) and play a set of specified animations. To end these animations and restore the default animations, use
+ * together with procedural data (such as look at vectors, hand sensors etc.). overrideAnimation()
is used to
+ * completely override all motion from the default animation system (including inverse kinematics for hand and head
+ * controllers) and play a set of specified animations. To end these animations and restore the default animations, use
* {@link MyAvatar.restoreAnimation}.
- * Note: When using pre-built animation data, it's critical that the joint orientation of the source animation and target
- * rig are equivalent, since the animation data applies absolute values onto the joints. If the orientations are different,
- * the avatar will move in unpredictable ways. For more information about avatar joint orientation standards, see
- * Avatar Standards.
+ * Note: When using pre-built animation data, it's critical that the joint orientation of the source animation and target
+ * rig are equivalent, since the animation data applies absolute values onto the joints. If the orientations are different,
+ * the avatar will move in unpredictable ways. For more information about avatar joint orientation standards, see
+ * Avatar Standards.
* @function MyAvatar.overrideAnimation
- * @param {string} url - The URL to the animation file. Animation files may be in glTF or FBX format, but only need to
- * contain the avatar skeleton and animation data. glTF models may be in JSON or binary format (".gltf" or ".glb" URLs
+ * @param {string} url - The URL to the animation file. Animation files may be in glTF or FBX format, but only need to
+ * contain the avatar skeleton and animation data. glTF models may be in JSON or binary format (".gltf" or ".glb" URLs
* respectively).
* Warning: glTF animations currently do not always animate correctly.
* @param {number} fps - The frames per second (FPS) rate for the animation playback. 30 FPS is normal speed.
@@ -704,8 +705,8 @@ public:
* Use {@link MyAvatar.restoreHandAnimation} to restore the default poses.
* @function MyAvatar.overrideHandAnimation
* @param isLeft {boolean} true
to override the left hand, false
to override the right hand.
- * @param {string} url - The URL of the animation file. Animation files need to be in glTF or FBX format, but only need to
- * contain the avatar skeleton and animation data. glTF models may be in JSON or binary format (".gltf" or ".glb" URLs
+ * @param {string} url - The URL of the animation file. Animation files need to be in glTF or FBX format, but only need to
+ * contain the avatar skeleton and animation data. glTF models may be in JSON or binary format (".gltf" or ".glb" URLs
* respectively).
* Warning: glTF animations currently do not always animate correctly.
* @param {number} fps - The frames per second (FPS) rate for the animation playback. 30 FPS is normal speed.
@@ -723,10 +724,10 @@ public:
/*@jsdoc
* Restores the default animations.
- * The avatar animation system includes a set of default animations along with rules for how those animations are blended
- * together with procedural data (such as look at vectors, hand sensors etc.). Playing your own custom animations will
- * override the default animations. restoreAnimation()
is used to restore all motion from the default
- * animation system including inverse kinematics for hand and head controllers. If you aren't currently playing an override
+ *
The avatar animation system includes a set of default animations along with rules for how those animations are blended
+ * together with procedural data (such as look at vectors, hand sensors etc.). Playing your own custom animations will
+ * override the default animations. restoreAnimation()
is used to restore all motion from the default
+ * animation system including inverse kinematics for hand and head controllers. If you aren't currently playing an override
* animation, this function has no effect.
* @function MyAvatar.restoreAnimation
* @example Play a clapping animation on your avatar for three seconds.
@@ -757,10 +758,10 @@ public:
/*@jsdoc
* Gets the current animation roles.
- * Each avatar has an avatar-animation.json file that defines which animations are used and how they are blended together
- * with procedural data (such as look at vectors, hand sensors etc.). Each animation specified in the avatar-animation.json
- * file is known as an animation role. Animation roles map to easily understandable actions that the avatar can perform,
- * such as "idleStand"
, "idleTalk"
, or "walkFwd"
. getAnimationRoles()
+ *
Each avatar has an avatar-animation.json file that defines which animations are used and how they are blended together
+ * with procedural data (such as look at vectors, hand sensors etc.). Each animation specified in the avatar-animation.json
+ * file is known as an animation role. Animation roles map to easily understandable actions that the avatar can perform,
+ * such as "idleStand"
, "idleTalk"
, or "walkFwd"
. getAnimationRoles()
* is used get the list of animation roles defined in the avatar-animation.json.
* @function MyAvatar.getAnimationRoles
* @returns {string[]} Array of role strings.
@@ -775,23 +776,23 @@ public:
/*@jsdoc
* Overrides a specific animation role.
- * Each avatar has an avatar-animation.json file that defines a set of animation roles. Animation roles map to easily
- * understandable actions that the avatar can perform, such as "idleStand"
, "idleTalk"
, or
+ *
Each avatar has an avatar-animation.json file that defines a set of animation roles. Animation roles map to easily
+ * understandable actions that the avatar can perform, such as "idleStand"
, "idleTalk"
, or
* "walkFwd"
. To get the full list of roles, use {@ link MyAvatar.getAnimationRoles}.
- * For each role, the avatar-animation.json defines when the animation is used, the animation clip (glTF or FBX) used, and
+ * For each role, the avatar-animation.json defines when the animation is used, the animation clip (glTF or FBX) used, and
* how animations are blended together with procedural data (such as look at vectors, hand sensors etc.).
- * overrideRoleAnimation()
is used to change the animation clip (glTF or FBX) associated with a specified
+ * overrideRoleAnimation()
is used to change the animation clip (glTF or FBX) associated with a specified
* animation role. To end the role animation and restore the default, use {@link MyAvatar.restoreRoleAnimation}.
- * Note: Hand roles only affect the hand. Other "main" roles, like "idleStand", "idleTalk", and "takeoffStand", are full
+ *
Note: Hand roles only affect the hand. Other "main" roles, like "idleStand", "idleTalk", and "takeoffStand", are full
* body.
* Note: When using pre-built animation data, it's critical that the joint orientation of the source animation and target
* rig are equivalent, since the animation data applies absolute values onto the joints. If the orientations are different,
- * the avatar will move in unpredictable ways. For more information about avatar joint orientation standards, see
- * Avatar Standards.
+ * the avatar will move in unpredictable ways. For more information about avatar joint orientation standards, see
+ * Avatar Standards.
* @function MyAvatar.overrideRoleAnimation
* @param {string} role - The animation role to override
- * @param {string} url - The URL to the animation file. Animation files need to be in glTF or FBX format, but only need to
- * contain the avatar skeleton and animation data. glTF models may be in JSON or binary format (".gltf" or ".glb" URLs
+ * @param {string} url - The URL to the animation file. Animation files need to be in glTF or FBX format, but only need to
+ * contain the avatar skeleton and animation data. glTF models may be in JSON or binary format (".gltf" or ".glb" URLs
* respectively).
*
Warning: glTF animations currently do not always animate correctly.
* @param {number} fps - The frames per second (FPS) rate for the animation playback. 30 FPS is normal speed.
@@ -815,13 +816,13 @@ public:
/*@jsdoc
* Restores a default role animation.
- * Each avatar has an avatar-animation.json file that defines a set of animation roles. Animation roles map to easily
- * understandable actions that the avatar can perform, such as "idleStand"
, "idleTalk"
, or
+ *
Each avatar has an avatar-animation.json file that defines a set of animation roles. Animation roles map to easily
+ * understandable actions that the avatar can perform, such as "idleStand"
, "idleTalk"
, or
* "walkFwd"
. To get the full list of roles, use {@link MyAvatar.getAnimationRoles}. For each role,
- * the avatar-animation.json defines when the animation is used, the animation clip (glTF or FBX) used, and how animations
- * are blended together with procedural data (such as look-at vectors, hand sensors etc.). You can change the animation
+ * the avatar-animation.json defines when the animation is used, the animation clip (glTF or FBX) used, and how animations
+ * are blended together with procedural data (such as look-at vectors, hand sensors etc.). You can change the animation
* clip (glTF or FBX) associated with a specified animation role using {@link MyAvatar.overrideRoleAnimation}.
- * restoreRoleAnimation()
is used to restore a specified animation role's default animation clip. If you have
+ * restoreRoleAnimation()
is used to restore a specified animation role's default animation clip. If you have
* not specified an override animation for the specified role, this function has no effect.
* @function MyAvatar.restoreRoleAnimation
* @param role {string} The animation role clip to restore.
@@ -838,31 +839,31 @@ public:
// a handler must not remove properties from animStateDictionaryIn, nor change property values that it does not intend to change.
// It is not specified in what order multiple handlers are called.
/*@jsdoc
- * Adds an animation state handler function that is invoked just before each animation graph update. More than one
- * animation state handler function may be added by calling addAnimationStateHandler
multiple times. It is not
+ * Adds an animation state handler function that is invoked just before each animation graph update. More than one
+ * animation state handler function may be added by calling addAnimationStateHandler
multiple times. It is not
* specified in what order multiple handlers are called.
*
The animation state handler function is called with an {@link MyAvatar.AnimStateDictionary|AnimStateDictionary}
- * "animStateDictionaryIn
" parameter and is expected to return an
- * {@link MyAvatar.AnimStateDictionary|AnimStateDictionary} "animStateDictionaryOut
" object. The
- * animStateDictionaryOut
object can be the same object as animStateDictionaryIn
, or it can be a
- * different object. The animStateDictionaryIn
may be shared among multiple handlers and thus may contain
+ * "animStateDictionaryIn
" parameter and is expected to return an
+ * {@link MyAvatar.AnimStateDictionary|AnimStateDictionary} "animStateDictionaryOut
" object. The
+ * animStateDictionaryOut
object can be the same object as animStateDictionaryIn
, or it can be a
+ * different object. The animStateDictionaryIn
may be shared among multiple handlers and thus may contain
* additional properties specified when adding the different handlers.
- * A handler may change a value from animStateDictionaryIn
or add different values in the
- * animStateDictionaryOut
returned. Any property values set in animStateDictionaryOut
will
+ *
A handler may change a value from animStateDictionaryIn
or add different values in the
+ * animStateDictionaryOut
returned. Any property values set in animStateDictionaryOut
will
* override those of the internal animation machinery.
* @function MyAvatar.addAnimationStateHandler
* @param {function} handler - The animation state handler function to add.
- * @param {Array|null} propertiesList - The list of {@link MyAvatar.AnimStateDictionary|AnimStateDictionary}
- * properties that should be included in the parameter that the handler function is called with. If null
+ * @param {Array|null} propertiesList - The list of {@link MyAvatar.AnimStateDictionary|AnimStateDictionary}
+ * properties that should be included in the parameter that the handler function is called with. If null
* then all properties are included in the call parameter.
* @returns {number} The ID of the animation state handler function if successfully added, undefined
if not.
* @example Log all the animation state dictionary parameters for a short while.
* function animStateHandler(dictionary) {
* print("Anim state dictionary: " + JSON.stringify(dictionary));
* }
- *
+ *
* var handler = MyAvatar.addAnimationStateHandler(animStateHandler, null);
- *
+ *
* Script.setTimeout(function () {
* MyAvatar.removeAnimationStateHandler(handler);
* }, 100);
@@ -881,7 +882,7 @@ public:
/*@jsdoc
* Gets whether you do snap turns in HMD mode.
* @function MyAvatar.getSnapTurn
- * @returns {boolean} true
if you do snap turns in HMD mode; false
if you do smooth turns in HMD
+ * @returns {boolean} true
if you do snap turns in HMD mode; false
if you do smooth turns in HMD
* mode.
*/
Q_INVOKABLE bool getSnapTurn() const { return _useSnapTurn; }
@@ -906,11 +907,11 @@ public:
* @param {MyAvatar.LocomotionControlsMode} controlScheme - The control scheme to use.
*/
Q_INVOKABLE void setControlScheme(int index) { _controlSchemeIndex = (index >= 0 && index <= 2) ? index : 0; }
-
+
/*@jsdoc
* Gets whether your avatar hovers when its feet are not on the ground.
* @function MyAvatar.hoverWhenUnsupported
- * @returns {boolean} true
if your avatar hovers when its feet are not on the ground, false
if it
+ * @returns {boolean} true
if your avatar hovers when its feet are not on the ground, false
if it
* falls.
*/
// FIXME: Should be named, getHoverWhenUnsupported().
@@ -919,7 +920,7 @@ public:
/*@jsdoc
* Sets whether your avatar hovers when its feet are not on the ground.
* @function MyAvatar.setHoverWhenUnsupported
- * @param {boolean} hover - true
if your avatar hovers when its feet are not on the ground, false
+ * @param {boolean} hover - true
if your avatar hovers when its feet are not on the ground, false
* if it falls.
*/
Q_INVOKABLE void setHoverWhenUnsupported(bool on) { _hoverWhenUnsupported = on; }
@@ -927,7 +928,7 @@ public:
/*@jsdoc
* Sets the avatar's dominant hand.
* @function MyAvatar.setDominantHand
- * @param {string} hand - The dominant hand: "left"
for the left hand or "right"
for the right
+ * @param {string} hand - The dominant hand: "left"
for the left hand or "right"
for the right
* hand. Any other value has no effect.
*/
Q_INVOKABLE void setDominantHand(const QString& hand);
@@ -956,7 +957,7 @@ public:
/*@jsdoc
* Sets the HMD alignment relative to your avatar.
* @function MyAvatar.setHmdAvatarAlignmentType
- * @param {string} type - "head"
to align your head and your avatar's head, "eyes"
to align your
+ * @param {string} type - "head"
to align your head and your avatar's head, "eyes"
to align your
* eyes and your avatar's eyes.
*/
Q_INVOKABLE void setHmdAvatarAlignmentType(const QString& type);
@@ -964,7 +965,7 @@ public:
/*@jsdoc
* Gets the HMD alignment relative to your avatar.
* @function MyAvatar.getHmdAvatarAlignmentType
- * @returns {string} "head"
if aligning your head and your avatar's head, "eyes"
if aligning your
+ * @returns {string} "head"
if aligning your head and your avatar's head, "eyes"
if aligning your
* eyes and your avatar's eyes.
*/
Q_INVOKABLE QString getHmdAvatarAlignmentType() const;
@@ -972,7 +973,7 @@ public:
/*@jsdoc
* Sets whether the avatar's hips are balanced over the feet or positioned under the head.
* @function MyAvatar.setCenterOfGravityModelEnabled
- * @param {boolean} enabled - true
to balance the hips over the feet, false
to position the hips
+ * @param {boolean} enabled - true
to balance the hips over the feet, false
to position the hips
* under the head.
*/
Q_INVOKABLE void setCenterOfGravityModelEnabled(bool value) { _centerOfGravityModelEnabled = value; }
@@ -980,17 +981,17 @@ public:
/*@jsdoc
* Gets whether the avatar hips are being balanced over the feet or placed under the head.
* @function MyAvatar.getCenterOfGravityModelEnabled
- * @returns {boolean} true
if the hips are being balanced over the feet, false
if the hips are
+ * @returns {boolean} true
if the hips are being balanced over the feet, false
if the hips are
* being positioned under the head.
*/
Q_INVOKABLE bool getCenterOfGravityModelEnabled() const { return _centerOfGravityModelEnabled; }
/*@jsdoc
- * Sets whether the avatar's position updates to recenter the avatar under the head. In room-scale VR, recentering
- * causes your avatar to follow your HMD as you walk around the room. Disabling recentering is useful if you want to pin
+ * Sets whether the avatar's position updates to recenter the avatar under the head. In room-scale VR, recentering
+ * causes your avatar to follow your HMD as you walk around the room. Disabling recentering is useful if you want to pin
* the avatar to a fixed position.
* @function MyAvatar.setHMDLeanRecenterEnabled
- * @param {boolean} enabled - true
to recenter the avatar under the head as it moves, false
to
+ * @param {boolean} enabled - true
to recenter the avatar under the head as it moves, false
to
* disable recentering.
*/
Q_INVOKABLE void setHMDLeanRecenterEnabled(bool value) { _hmdLeanRecenterEnabled = value; }
@@ -1004,9 +1005,9 @@ public:
Q_INVOKABLE bool getHMDLeanRecenterEnabled() const { return _hmdLeanRecenterEnabled; }
/*@jsdoc
- * Requests that the hand touch effect is disabled for your avatar. Any resulting change in the status of the hand touch
+ * Requests that the hand touch effect is disabled for your avatar. Any resulting change in the status of the hand touch
* effect will be signaled by {@link MyAvatar.shouldDisableHandTouchChanged}.
- * The hand touch effect makes the avatar's fingers adapt to the shape of any object grabbed, creating the effect that
+ *
The hand touch effect makes the avatar's fingers adapt to the shape of any object grabbed, creating the effect that
* it is really touching that object.
* @function MyAvatar.requestEnableHandTouch
*/
@@ -1081,7 +1082,7 @@ public:
Q_INVOKABLE float getRawDriveKey(DriveKeys key) const;
void relayDriveKeysToCharacterController();
-
+
/*@jsdoc
* Disables the action associated with a drive key.
* @function MyAvatar.disableDriveKey
@@ -1097,7 +1098,7 @@ public:
Q_INVOKABLE void disableDriveKey(DriveKeys key);
/*@jsdoc
- * Enables the action associated with a drive key. The action may have been disabled with
+ * Enables the action associated with a drive key. The action may have been disabled with
* {@link MyAvatar.disableDriveKey|disableDriveKey}.
* @function MyAvatar.enableDriveKey
* @param {DriveKey} key - The drive key to enable.
@@ -1114,14 +1115,14 @@ public:
/*@jsdoc
- * Recenter the avatar in the vertical direction, if {@link MyAvatar|MyAvatar.hmdLeanRecenterEnabled}
is
+ * Recenter the avatar in the vertical direction, if {@link MyAvatar|MyAvatar.hmdLeanRecenterEnabled}
is
* false
.
* @function MyAvatar.triggerVerticalRecenter
*/
Q_INVOKABLE void triggerVerticalRecenter();
/*@jsdoc
- * Recenter the avatar in the horizontal direction, if {@link MyAvatar|MyAvatar.hmdLeanRecenterEnabled}
is
+ * Recenter the avatar in the horizontal direction, if {@link MyAvatar|MyAvatar.hmdLeanRecenterEnabled}
is
* false
.
* @function MyAvatar.triggerHorizontalRecenter
*/
@@ -1136,7 +1137,7 @@ public:
/*@jsdoc
* Gets whether the avatar is configured to keep its center of gravity under its head.
* @function MyAvatar.isRecenteringHorizontally
- * @returns {boolean} true
if the avatar is keeping its center of gravity under its head position,
+ * @returns {boolean} true
if the avatar is keeping its center of gravity under its head position,
* false
if not.
*/
Q_INVOKABLE bool isRecenteringHorizontally() const;
@@ -1176,7 +1177,7 @@ public:
Q_INVOKABLE float getHeadFinalPitch() const { return getHead()->getFinalPitch(); }
/*@jsdoc
- * If a face tracker is connected and being used, gets the estimated pitch of the user's head scaled. This is scale such
+ * If a face tracker is connected and being used, gets the estimated pitch of the user's head scaled. This is scale such
* that the avatar looks at the edge of the view frustum when the user looks at the edge of their screen.
* @function MyAvatar.getHeadDeltaPitch
* @returns {number} The pitch that the avatar's head should be if a face tracker is connected and being used, otherwise
@@ -1201,7 +1202,7 @@ public:
* @example Report the position of the avatar you're currently looking at.
* print(JSON.stringify(MyAvatar.getTargetAvatarPosition()));
*/
- // FIXME: If not looking at an avatar, the most recently looked-at position is returned. This should be fixed to return
+ // FIXME: If not looking at an avatar, the most recently looked-at position is returned. This should be fixed to return
// undefined or {NaN, NaN, NaN} or similar.
Q_INVOKABLE glm::vec3 getTargetAvatarPosition() const { return _targetAvatarPosition; }
@@ -1210,18 +1211,18 @@ public:
* @function MyAvatar.getTargetAvatar
* @returns {ScriptAvatar} Information on the avatar being looked at, null
if no avatar is being looked at.
*/
- // FIXME: The return type doesn't have a conversion to a script value so the function always returns undefined in
+ // FIXME: The return type doesn't have a conversion to a script value so the function always returns undefined in
// JavaScript. Note: When fixed, JSDoc is needed for the return type.
Q_INVOKABLE ScriptAvatarData* getTargetAvatar() const;
/*@jsdoc
- * Gets the position of the avatar's left hand, relative to the avatar, as positioned by a hand controller (e.g., Oculus
+ * Gets the position of the avatar's left hand, relative to the avatar, as positioned by a hand controller (e.g., Oculus
* Touch or Vive).
- * Note: The Leap Motion isn't part of the hand controller input system. (Instead, it manipulates the avatar's joints
+ *
Note: The Leap Motion isn't part of the hand controller input system. (Instead, it manipulates the avatar's joints
* for hand animation.)
* @function MyAvatar.getLeftHandPosition
- * @returns {Vec3} The position of the left hand in avatar coordinates if positioned by a hand controller, otherwise
+ * @returns {Vec3} The position of the left hand in avatar coordinates if positioned by a hand controller, otherwise
* {@link Vec3(0)|Vec3.ZERO}
.
* @example Report the position of your left hand relative to your avatar.
* print(JSON.stringify(MyAvatar.getLeftHandPosition()));
@@ -1229,12 +1230,12 @@ public:
Q_INVOKABLE glm::vec3 getLeftHandPosition() const;
/*@jsdoc
- * Gets the position of the avatar's right hand, relative to the avatar, as positioned by a hand controller (e.g., Oculus
+ * Gets the position of the avatar's right hand, relative to the avatar, as positioned by a hand controller (e.g., Oculus
* Touch or Vive).
- * Note: The Leap Motion isn't part of the hand controller input system. (Instead, it manipulates the avatar's joints
+ *
Note: The Leap Motion isn't part of the hand controller input system. (Instead, it manipulates the avatar's joints
* for hand animation.)
* @function MyAvatar.getRightHandPosition
- * @returns {Vec3} The position of the right hand in avatar coordinates if positioned by a hand controller, otherwise
+ * @returns {Vec3} The position of the right hand in avatar coordinates if positioned by a hand controller, otherwise
* {@link Vec3(0)|Vec3.ZERO}
.
* @example Report the position of your right hand relative to your avatar.
* print(JSON.stringify(MyAvatar.getLeftHandPosition()));
@@ -1242,10 +1243,10 @@ public:
Q_INVOKABLE glm::vec3 getRightHandPosition() const;
/*@jsdoc
- * Gets the position 0.3m in front of the left hand's position in the direction along the palm, in avatar coordinates, as
+ * Gets the position 0.3m in front of the left hand's position in the direction along the palm, in avatar coordinates, as
* positioned by a hand controller.
* @function MyAvatar.getLeftHandTipPosition
- * @returns {Vec3} The position 0.3m in front of the left hand's position in the direction along the palm, in avatar
+ * @returns {Vec3} The position 0.3m in front of the left hand's position in the direction along the palm, in avatar
* coordinates. If the hand isn't being positioned by a controller, {@link Vec3(0)|Vec3.ZERO}
is returned.
*/
Q_INVOKABLE glm::vec3 getLeftHandTipPosition() const;
@@ -1254,17 +1255,17 @@ public:
* Gets the position 0.3m in front of the right hand's position in the direction along the palm, in avatar coordinates, as
* positioned by a hand controller.
* @function MyAvatar.getRightHandTipPosition
- * @returns {Vec3} The position 0.3m in front of the right hand's position in the direction along the palm, in avatar
+ * @returns {Vec3} The position 0.3m in front of the right hand's position in the direction along the palm, in avatar
* coordinates. If the hand isn't being positioned by a controller, {@link Vec3(0)|Vec3.ZERO}
is returned.
*/
Q_INVOKABLE glm::vec3 getRightHandTipPosition() const;
/*@jsdoc
- * Gets the pose (position, rotation, velocity, and angular velocity) of the avatar's left hand as positioned by a
+ * Gets the pose (position, rotation, velocity, and angular velocity) of the avatar's left hand as positioned by a
* hand controller (e.g., Oculus Touch or Vive).
- * Note: The Leap Motion isn't part of the hand controller input system. (Instead, it manipulates the avatar's joints
- * for hand animation.) If you are using the Leap Motion, the return value's valid
property will be
+ *
Note: The Leap Motion isn't part of the hand controller input system. (Instead, it manipulates the avatar's joints
+ * for hand animation.) If you are using the Leap Motion, the return value's valid
property will be
* false
and any pose values returned will not be meaningful.
* @function MyAvatar.getLeftHandPose
* @returns {Pose} The pose of the avatar's left hand, relative to the avatar, as positioned by a hand controller.
@@ -1274,26 +1275,26 @@ public:
Q_INVOKABLE controller::Pose getLeftHandPose() const;
/*@jsdoc
- * Gets the pose (position, rotation, velocity, and angular velocity) of the avatar's left hand as positioned by a
+ * Gets the pose (position, rotation, velocity, and angular velocity) of the avatar's left hand as positioned by a
* hand controller (e.g., Oculus Touch or Vive).
- * Note: The Leap Motion isn't part of the hand controller input system. (Instead, it manipulates the avatar's joints
- * for hand animation.) If you are using the Leap Motion, the return value's valid
property will be
+ *
Note: The Leap Motion isn't part of the hand controller input system. (Instead, it manipulates the avatar's joints
+ * for hand animation.) If you are using the Leap Motion, the return value's valid
property will be
* false
and any pose values returned will not be meaningful.
* @function MyAvatar.getRightHandPose
- * @returns {Pose} The pose of the avatar's right hand, relative to the avatar, as positioned by a hand controller.
+ * @returns {Pose} The pose of the avatar's right hand, relative to the avatar, as positioned by a hand controller.
* @example Report the pose of your avatar's right hand.
* print(JSON.stringify(MyAvatar.getRightHandPose()));
*/
Q_INVOKABLE controller::Pose getRightHandPose() const;
/*@jsdoc
- * Gets the pose (position, rotation, velocity, and angular velocity) of the avatar's left hand, relative to the avatar, as
+ * Gets the pose (position, rotation, velocity, and angular velocity) of the avatar's left hand, relative to the avatar, as
* positioned by a hand controller (e.g., Oculus Touch or Vive), and translated 0.3m along the palm.
* Note: Leap Motion isn't part of the hand controller input system. (Instead, it manipulates the avatar's joints
* for hand animation.) If you are using Leap Motion, the return value's valid
property will be
* false
and any pose values returned will not be meaningful.
* @function MyAvatar.getLeftHandTipPose
- * @returns {Pose} The pose of the avatar's left hand, relative to the avatar, as positioned by a hand controller, and
+ * @returns {Pose} The pose of the avatar's left hand, relative to the avatar, as positioned by a hand controller, and
* translated 0.3m along the palm.
*/
Q_INVOKABLE controller::Pose getLeftHandTipPose() const;
@@ -1466,34 +1467,34 @@ public:
/*@jsdoc
* Checks whether your avatar is in the air.
* @function MyAvatar.isInAir
- * @returns {boolean} true
if your avatar is taking off, flying, or falling, otherwise false
+ * @returns {boolean} true
if your avatar is taking off, flying, or falling, otherwise false
* because your avatar is on the ground.
*/
Q_INVOKABLE bool isInAir();
/*@jsdoc
- * Sets your preference for flying in your current desktop or HMD display mode. Note that your ability to fly also depends
+ * Sets your preference for flying in your current desktop or HMD display mode. Note that your ability to fly also depends
* on whether the domain you're in allows you to fly.
* @function MyAvatar.setFlyingEnabled
- * @param {boolean} enabled - Set true
if you want to enable flying in your current desktop or HMD display
+ * @param {boolean} enabled - Set true
if you want to enable flying in your current desktop or HMD display
* mode, otherwise set false
.
*/
Q_INVOKABLE void setFlyingEnabled(bool enabled);
/*@jsdoc
- * Gets your preference for flying in your current desktop or HMD display mode. Note that your ability to fly also depends
+ * Gets your preference for flying in your current desktop or HMD display mode. Note that your ability to fly also depends
* on whether the domain you're in allows you to fly.
* @function MyAvatar.getFlyingEnabled
- * @returns {boolean} true
if your preference is to enable flying in your current desktop or HMD display mode,
+ * @returns {boolean} true
if your preference is to enable flying in your current desktop or HMD display mode,
* otherwise false
.
*/
Q_INVOKABLE bool getFlyingEnabled();
/*@jsdoc
- * Sets your preference for flying in desktop display mode. Note that your ability to fly also depends on whether the domain
+ * Sets your preference for flying in desktop display mode. Note that your ability to fly also depends on whether the domain
* you're in allows you to fly.
* @function MyAvatar.setFlyingDesktopPref
- * @param {boolean} enabled - Set true
if you want to enable flying in desktop display mode, otherwise set
+ * @param {boolean} enabled - Set true
if you want to enable flying in desktop display mode, otherwise set
* false
.
*/
Q_INVOKABLE void setFlyingDesktopPref(bool enabled);
@@ -1502,7 +1503,7 @@ public:
* Gets your preference for flying in desktop display mode. Note that your ability to fly also depends on whether the domain
* you're in allows you to fly.
* @function MyAvatar.getFlyingDesktopPref
- * @returns {boolean} true
if your preference is to enable flying in desktop display mode, otherwise
+ * @returns {boolean} true
if your preference is to enable flying in desktop display mode, otherwise
* false
.
*/
Q_INVOKABLE bool getFlyingDesktopPref();
@@ -1624,8 +1625,8 @@ public:
Q_INVOKABLE float getAvatarScale() const;
/*@jsdoc
- * Sets the target scale of the avatar. The target scale is the desired scale of the avatar without any restrictions on
- * permissible scale values imposed by the domain.
+ * Sets the target scale of the avatar. The target scale is the desired scale of the avatar without any restrictions on
+ * permissible scale values imposed by the domain.
* @function MyAvatar.setAvatarScale
* @param {number} scale - The target scale for the avatar, range 0.005
– 1000.0
.
*/
@@ -1633,11 +1634,11 @@ public:
/*@jsdoc
* Sets whether the avatar should collide with entities.
- * Note: A false
value won't disable collisions if the avatar is in a zone that disallows
- * collisionless avatars. However, the false
value will be set so that collisions are disabled as soon as the
+ *
Note: A false
value won't disable collisions if the avatar is in a zone that disallows
+ * collisionless avatars. However, the false
value will be set so that collisions are disabled as soon as the
* avatar moves to a position where collisionless avatars are allowed.
* @function MyAvatar.setCollisionsEnabled
- * @param {boolean} enabled - true
to enable the avatar to collide with entities, false
to
+ * @param {boolean} enabled - true
to enable the avatar to collide with entities, false
to
* disable.
*/
Q_INVOKABLE void setCollisionsEnabled(bool enabled);
@@ -1653,7 +1654,7 @@ public:
/*@jsdoc
* Sets whether the avatar should collide with other avatars.
* @function MyAvatar.setOtherAvatarsCollisionsEnabled
- * @param {boolean} enabled - true
to enable the avatar to collide with other avatars, false
+ * @param {boolean} enabled - true
to enable the avatar to collide with other avatars, false
* to disable.
*/
Q_INVOKABLE void setOtherAvatarsCollisionsEnabled(bool enabled);
@@ -1667,7 +1668,7 @@ public:
/*@jsdoc
* Gets the avatar's collision capsule: a cylinder with hemispherical ends that approximates the extents or the avatar.
- *
Warning: The values returned are in world coordinates but aren't necessarily up to date with the
+ *
Warning: The values returned are in world coordinates but aren't necessarily up to date with the
* avatar's current position.
* @function MyAvatar.getCollisionCapsule
* @returns {MyAvatar.CollisionCapsule} The avatar's collision capsule.
@@ -1746,21 +1747,21 @@ public:
glm::mat4 deriveBodyUsingCgModel();
/*@jsdoc
- * Tests whether a vector is pointing in the general direction of the avatar's "up" direction (i.e., dot product of vectors
+ * Tests whether a vector is pointing in the general direction of the avatar's "up" direction (i.e., dot product of vectors
* is > 0
).
* @function MyAvatar.isUp
* @param {Vec3} direction - The vector to test.
- * @returns {boolean} true
if the direction vector is pointing generally in the direction of the avatar's "up"
+ * @returns {boolean} true
if the direction vector is pointing generally in the direction of the avatar's "up"
* direction.
*/
Q_INVOKABLE bool isUp(const glm::vec3& direction) { return glm::dot(direction, _worldUpDirection) > 0.0f; }; // true iff direction points up wrt avatar's definition of up.
/*@jsdoc
- * Tests whether a vector is pointing in the general direction of the avatar's "down" direction (i.e., dot product of
+ * Tests whether a vector is pointing in the general direction of the avatar's "down" direction (i.e., dot product of
* vectors is < 0
).
* @function MyAvatar.isDown
* @param {Vec3} direction - The vector to test.
- * @returns {boolean} true
if the direction vector is pointing generally in the direction of the avatar's
+ * @returns {boolean} true
if the direction vector is pointing generally in the direction of the avatar's
* "down" direction.
*/
Q_INVOKABLE bool isDown(const glm::vec3& direction) { return glm::dot(direction, _worldUpDirection) < 0.0f; };
@@ -1844,7 +1845,7 @@ public:
/*@jsdoc
* Forces the avatar's eyes to look at a specified location. Once this method is called, API calls
- * full control of the eyes for a limited time. If this method is not called for 2 seconds,
+ * full control of the eyes for a limited time. If this method is not called for 2 seconds,
* the engine regains control of the eyes.
* @function MyAvatar.setEyesLookAt
* @param {Vec3} lookAtTarget - The target point in world coordinates.
@@ -1865,7 +1866,7 @@ public:
Q_INVOKABLE void releaseEyesLookAtControl();
/*@jsdoc
- * Sets the point-at target for the "point"
reaction that may be started with {@link MyAvatar.beginReaction}.
+ * Sets the point-at target for the "point"
reaction that may be started with {@link MyAvatar.beginReaction}.
* The point-at target is set only if it is in front of the avatar.
* Note: The "point"
reaction should be started before calling this method.
* @function MyAvatar.setPointAt
@@ -1946,20 +1947,20 @@ public:
* @comment Uses the base class's JSDoc.
*/
int sendAvatarDataPacket(bool sendAll = false) override;
-
+
void addAvatarHandsToFlow(const std::shared_ptr& otherAvatar);
/*@jsdoc
- * Enables and disables flow simulation of physics on the avatar's hair, clothes, and body parts. See
- * {@link https://docs.vircadia.dev/create/avatars/add-flow.html|Add Flow to Your Avatar} for more
+ * Enables and disables flow simulation of physics on the avatar's hair, clothes, and body parts. See
+ * {@link https://docs.vircadia.com/create/avatars/add-flow.html|Add Flow to Your Avatar} for more
* information.
* @function MyAvatar.useFlow
* @param {boolean} isActive - true
if flow simulation is enabled on the joint, false
if it isn't.
- * @param {boolean} isCollidable - true
to enable collisions in the flow simulation, false
to
+ * @param {boolean} isCollidable - true
to enable collisions in the flow simulation, false
to
* disable.
- * @param {Object} [physicsConfig] - Physics configurations for particular entity
+ * @param {Object} [physicsConfig] - Physics configurations for particular entity
* and avatar joints.
- * @param {Object} [collisionsConfig] - Collision configurations for particular
+ * @param {Object} [collisionsConfig] - Collision configurations for particular
* entity and avatar joints.
*/
Q_INVOKABLE void useFlow(bool isActive, bool isCollidable, const QVariantMap& physicsConfig = QVariantMap(), const QVariantMap& collisionsConfig = QVariantMap());
@@ -2078,7 +2079,7 @@ public slots:
void setGravity(float gravity);
/*@jsdoc
- * Sets the amount of gravity applied to the avatar in the y-axis direction. (Negative values are downward.) The default
+ * Sets the amount of gravity applied to the avatar in the y-axis direction. (Negative values are downward.) The default
* value is -5
m/s2.
* @function MyAvatar.getGravity
* @returns {number} The amount of gravity currently applied to the avatar, in m/s2.
@@ -2086,7 +2087,7 @@ public slots:
float getGravity();
/*@jsdoc
- * Moves the avatar to a new position and/or orientation in the domain, with safe landing, while taking into account avatar
+ * Moves the avatar to a new position and/or orientation in the domain, with safe landing, while taking into account avatar
* leg length.
* @function MyAvatar.goToFeetLocation
* @param {Vec3} position - The new position for the avatar, in world coordinates.
@@ -2095,7 +2096,7 @@ public slots:
* @param {boolean} [shouldFaceLocation=false] - Set to true
to position the avatar a short distance away from
* the new position and orientate the avatar to face the position.
*/
- void goToFeetLocation(const glm::vec3& newPosition, bool hasOrientation = false,
+ void goToFeetLocation(const glm::vec3& newPosition, bool hasOrientation = false,
const glm::quat& newOrientation = glm::quat(), bool shouldFaceLocation = false);
/*@jsdoc
@@ -2104,7 +2105,7 @@ public slots:
* @param {Vec3} position - The new position for the avatar, in world coordinates.
* @param {boolean} [hasOrientation=false] - Set to true
to set the orientation of the avatar.
* @param {Quat} [orientation=Quat.IDENTITY] - The new orientation for the avatar.
- * @param {boolean} [shouldFaceLocation=false] - Set to true
to position the avatar a short distance away from
+ * @param {boolean} [shouldFaceLocation=false] - Set to true
to position the avatar a short distance away from
* the new position and orientate the avatar to face the position.
* @param {boolean} [withSafeLanding=true] - Set to false
to disable safe landing when teleporting.
*/
@@ -2152,7 +2153,7 @@ public slots:
* Adds a thrust to your avatar's current thrust to be applied for a short while.
* @function MyAvatar.addThrust
* @param {Vec3} thrust - The thrust direction and magnitude.
- * @deprecated This function is deprecated and will be removed. Use {@link MyAvatar|MyAvatar.motorVelocity} and related
+ * @deprecated This function is deprecated and will be removed. Use {@link MyAvatar|MyAvatar.motorVelocity} and related
* properties instead.
*/
// Set/Get update the thrust that will move the avatar around
@@ -2162,7 +2163,7 @@ public slots:
* Gets the thrust currently being applied to your avatar.
* @function MyAvatar.getThrust
* @returns {Vec3} The thrust currently being applied to your avatar.
- * @deprecated This function is deprecated and will be removed. Use {@link MyAvatar|MyAvatar.motorVelocity} and related
+ * @deprecated This function is deprecated and will be removed. Use {@link MyAvatar|MyAvatar.motorVelocity} and related
* properties instead.
*/
glm::vec3 getThrust() { return _thrust; };
@@ -2171,14 +2172,14 @@ public slots:
* Sets the thrust to be applied to your avatar for a short while.
* @function MyAvatar.setThrust
* @param {Vec3} thrust - The thrust direction and magnitude.
- * @deprecated This function is deprecated and will be removed. Use {@link MyAvatar|MyAvatar.motorVelocity} and related
+ * @deprecated This function is deprecated and will be removed. Use {@link MyAvatar|MyAvatar.motorVelocity} and related
* properties instead.
*/
void setThrust(glm::vec3 newThrust) { _thrust = newThrust; }
/*@jsdoc
- * Updates avatar motion behavior from the Developer > Avatar > Enable Default Motor Control and Enable Scripted
+ * Updates avatar motion behavior from the Developer > Avatar > Enable Default Motor Control and Enable Scripted
* Motor Control menu items.
* @function MyAvatar.updateMotionBehaviorFromMenu
*/
@@ -2192,8 +2193,8 @@ public slots:
void setToggleHips(bool followHead);
/*@jsdoc
- * Displays the base of support area debug graphics if in HMD mode. If your head goes outside this area your avatar's hips
- * are moved to counterbalance your avatar, and if your head moves too far then your avatar's position is moved (i.e., a
+ * Displays the base of support area debug graphics if in HMD mode. If your head goes outside this area your avatar's hips
+ * are moved to counterbalance your avatar, and if your head moves too far then your avatar's position is moved (i.e., a
* step happens).
* @function MyAvatar.setEnableDebugDrawBaseOfSupport
* @param {boolean} enabled - true
to show the debug graphics, false
to hide.
@@ -2208,7 +2209,7 @@ public slots:
void setEnableDebugDrawDefaultPose(bool isEnabled);
/*@jsdoc
- * Displays animation debug graphics. By default, the animation poses used for rendering are displayed. However,
+ * Displays animation debug graphics. By default, the animation poses used for rendering are displayed. However,
* {@link MyAvatar.setDebugDrawAnimPoseName} can be used to set a specific animation node to display.
* @function MyAvatar.setEnableDebugDrawAnimPose
* @param {boolean} enabled - true
to show the debug graphics, false
to hide.
@@ -2216,10 +2217,10 @@ public slots:
void setEnableDebugDrawAnimPose(bool isEnabled);
/*@jsdoc
- * Sets the animation node to display when animation debug graphics are enabled with
+ * Sets the animation node to display when animation debug graphics are enabled with
* {@link MyAvatar.setEnableDebugDrawAnimPose}.
* @function MyAvatar.setDebugDrawAnimPoseName
- * @param {string} poseName - The name of the animation node to display debug graphics for. Use ""
to reset to
+ * @param {string} poseName - The name of the animation node to display debug graphics for. Use ""
to reset to
* default.
*/
void setDebugDrawAnimPoseName(QString poseName);
@@ -2314,17 +2315,17 @@ public slots:
/*@jsdoc
* Gets the URL of the override animation graph.
- * See {@link https://docs.vircadia.dev/create/avatars/custom-animations.html|Custom Avatar Animations} for
+ *
See {@link https://docs.vircadia.com/create/avatars/custom-animations.html|Custom Avatar Animations} for
* information on animation graphs.
* @function MyAvatar.getAnimGraphOverrideUrl
- * @returns {string} The URL of the override animation graph JSON file. ""
if there is no override animation
+ * @returns {string} The URL of the override animation graph JSON file. ""
if there is no override animation
* graph.
*/
QUrl getAnimGraphOverrideUrl() const; // thread-safe
/*@jsdoc
* Sets the animation graph to use in preference to the default animation graph.
- * See {@link https://docs.vircadia.dev/create/avatars/custom-animations.html|Custom Avatar Animations} for
+ *
See {@link https://docs.vircadia.com/create/avatars/custom-animations.html|Custom Avatar Animations} for
* information on animation graphs.
* @function MyAvatar.setAnimGraphOverrideUrl
* @param {string} url - The URL of the animation graph JSON file to use. Set to ""
to clear an override.
@@ -2333,7 +2334,7 @@ public slots:
/*@jsdoc
* Gets the URL of animation graph (i.e., the avatar animation JSON) that's currently being used for avatar animations.
- * See {@link https://docs.vircadia.dev/create/avatars/custom-animations.html|Custom Avatar Animations} for
+ *
See {@link https://docs.vircadia.com/create/avatars/custom-animations.html|Custom Avatar Animations} for
* information on animation graphs.
* @function MyAvatar.getAnimGraphUrl
* @returns {string} The URL of the current animation graph JSON file.
@@ -2344,7 +2345,7 @@ public slots:
/*@jsdoc
* Sets the current animation graph (i.e., the avatar animation JSON) to use for avatar animations and makes it the default.
- * See {@link https://docs.vircadia.dev/create/avatars/custom-animations.html|Custom Avatar Animations} for
+ *
See {@link https://docs.vircadia.com/create/avatars/custom-animations.html|Custom Avatar Animations} for
* information on animation graphs.
* @function MyAvatar.setAnimGraphUrl
* @param {string} url - The URL of the animation graph JSON file to use.
@@ -2360,7 +2361,7 @@ public slots:
glm::vec3 getPositionForAudio();
/*@jsdoc
- * Gets the orientation of your listening position for spatialized audio. The orientation depends on the value of the
+ * Gets the orientation of your listening position for spatialized audio. The orientation depends on the value of the
* {@link Myavatar|audioListenerMode} property.
* @function MyAvatar.getOrientationForAudio
* @returns {Quat} The orientation of your listening position.
@@ -2386,7 +2387,7 @@ public slots:
/*@jsdoc
- * Gets the list of reactions names that can be enabled using {@link MyAvatar.beginReaction} and
+ * Gets the list of reactions names that can be enabled using {@link MyAvatar.beginReaction} and
* {@link MyAvatar.endReaction}.
* See also: {@link MyAvatar.getTriggerReactions}.
* @function MyAvatar.getBeginEndReactions
@@ -2407,7 +2408,7 @@ public slots:
bool triggerReaction(QString reactionName);
/*@jsdoc
- * Starts playing a reaction on the avatar. The reaction will continue to play until stopped using
+ * Starts playing a reaction on the avatar. The reaction will continue to play until stopped using
* {@link MyAvatar.endReaction} or superseded by another reaction.
*
Only reactions returned by {@link MyAvatar.getBeginEndReactions} are available.
* @function MyAvatar.beginReaction
@@ -2429,7 +2430,7 @@ signals:
/*@jsdoc
* Triggered when the {@link MyAvatar|audioListenerMode} property value changes.
* @function MyAvatar.audioListenerModeChanged
- * @returns {Signal}
+ * @returns {Signal}
*/
void audioListenerModeChanged();
@@ -2437,7 +2438,7 @@ signals:
* Triggered when the walk speed set for the "AnalogPlus" control scheme changes.
* @function MyAvatar.analogPlusWalkSpeedChanged
* @param {number} speed - The new walk speed set for the "AnalogPlus" control scheme.
- * @returns {Signal}
+ * @returns {Signal}
*/
void analogPlusWalkSpeedChanged(float value);
@@ -2445,31 +2446,31 @@ signals:
* Triggered when the sprint (run) speed set for the "AnalogPlus" control scheme changes.
* @function MyAvatar.analogPlusSprintSpeedChanged
* @param {number} speed - The new sprint speed set for the "AnalogPlus" control scheme.
- * @returns {Signal}
+ * @returns {Signal}
*/
void analogPlusSprintSpeedChanged(float value);
/*@jsdoc
- * Triggered when the sprint (run) speed set for the current control scheme (see
+ * Triggered when the sprint (run) speed set for the current control scheme (see
* {@link MyAvatar.getControlScheme|getControlScheme}) changes.
* @function MyAvatar.sprintSpeedChanged
* @param {number} speed -The new sprint speed set for the current control scheme.
- * @returns {Signal}
+ * @returns {Signal}
*/
void sprintSpeedChanged(float value);
/*@jsdoc
- * Triggered when the walk backward speed set for the current control scheme (see
+ * Triggered when the walk backward speed set for the current control scheme (see
* {@link MyAvatar.getControlScheme|getControlScheme}) changes.
* @function MyAvatar.walkBackwardSpeedChanged
* @param {number} speed - The new walk backward speed set for the current control scheme.
- * @returns {Signal}
+ * @returns {Signal}
*/
void walkBackwardSpeedChanged(float value);
/*@jsdoc
* @function MyAvatar.transformChanged
- * @returns {Signal}
+ * @returns {Signal}
* @deprecated This signal is deprecated and will be removed.
*/
void transformChanged();
@@ -2478,7 +2479,7 @@ signals:
* Triggered when the {@link MyAvatar|collisionSoundURL} property value changes.
* @function MyAvatar.newCollisionSoundURL
* @param {string} url - The URL of the new collision sound.
- * @returns {Signal}
+ * @returns {Signal}
*/
void newCollisionSoundURL(const QUrl& url);
@@ -2497,7 +2498,7 @@ signals:
/*@jsdoc
* Triggered when collisions with the environment are enabled or disabled.
* @function MyAvatar.collisionsEnabledChanged
- * @param {boolean} enabled - true
if collisions with the environment are enabled, false
if
+ * @param {boolean} enabled - true
if collisions with the environment are enabled, false
if
* they're not.
* @returns {Signal}
*/
@@ -2506,7 +2507,7 @@ signals:
/*@jsdoc
* Triggered when collisions with other avatars are enabled or disabled.
* @function MyAvatar.otherAvatarsCollisionsEnabledChanged
- * @param {boolean} enabled - true
if collisions with other avatars are enabled, false
if they're
+ * @param {boolean} enabled - true
if collisions with other avatars are enabled, false
if they're
* not.
* @returns {Signal}
*/
@@ -2526,7 +2527,7 @@ signals:
/*@jsdoc
* @function MyAvatar.energyChanged
* @param {number} energy - Avatar energy.
- * @returns {Signal}
+ * @returns {Signal}
* @deprecated This signal is deprecated and will be removed.
*/
void energyChanged(float newEnergy);
@@ -2534,7 +2535,7 @@ signals:
/*@jsdoc
* Triggered when the avatar has been moved to a new position by one of the MyAvatar "goTo" functions.
* @function MyAvatar.positionGoneTo
- * @returns {Signal}
+ * @returns {Signal}
*/
// FIXME: Better name would be goneToLocation().
void positionGoneTo();
@@ -2556,7 +2557,7 @@ signals:
/*@jsdoc
* Triggered when your avatar changes from being active to being away.
* @function MyAvatar.wentAway
- * @returns {Signal}
+ * @returns {Signal}
* @example Report when your avatar goes away.
* MyAvatar.wentAway.connect(function () {
* print("My avatar went away");
@@ -2568,7 +2569,7 @@ signals:
/*@jsdoc
* Triggered when your avatar changes from being away to being active.
* @function MyAvatar.wentActive
- * @returns {Signal}
+ * @returns {Signal}
*/
void wentActive();
@@ -2576,7 +2577,7 @@ signals:
* Triggered when the avatar's model (i.e., {@link MyAvatar|skeletonModelURL} property value) is changed.
* Synonym of {@link MyAvatar.skeletonModelURLChanged|skeletonModelURLChanged}.
* @function MyAvatar.skeletonChanged
- * @returns {Signal}
+ * @returns {Signal}
*/
void skeletonChanged();
@@ -2584,14 +2585,14 @@ signals:
* Triggered when the avatar's dominant hand changes.
* @function MyAvatar.dominantHandChanged
* @param {string} hand - The dominant hand: "left"
for the left hand, "right"
for the right hand.
- * @returns {Signal}
+ * @returns {Signal}
*/
void dominantHandChanged(const QString& hand);
/*@jsdoc
* Triggered when the HMD alignment for your avatar changes.
* @function MyAvatar.hmdAvatarAlignmentTypeChanged
- * @param {string} type - "head"
if aligning your head and your avatar's head, "eyes"
if aligning
+ * @param {string} type - "head"
if aligning your head and your avatar's head, "eyes"
if aligning
* your eyes and your avatar's eyes.
* @returns {Signal}
*/
@@ -2600,27 +2601,27 @@ signals:
/*@jsdoc
* Triggered when the avatar's sensorToWorldScale
property value changes.
* @function MyAvatar.sensorToWorldScaleChanged
- * @param {number} scale - The scale that transforms dimensions in the user's real world to the avatar's size in the virtual
+ * @param {number} scale - The scale that transforms dimensions in the user's real world to the avatar's size in the virtual
* world.
- * @returns {Signal}
+ * @returns {Signal}
*/
void sensorToWorldScaleChanged(float sensorToWorldScale);
/*@jsdoc
- * Triggered when the a model is attached to or detached from one of the avatar's joints using one of
- * {@link MyAvatar.attach|attach}, {@link MyAvatar.detachOne|detachOne}, {@link MyAvatar.detachAll|detachAll}, or
+ * Triggered when the a model is attached to or detached from one of the avatar's joints using one of
+ * {@link MyAvatar.attach|attach}, {@link MyAvatar.detachOne|detachOne}, {@link MyAvatar.detachAll|detachAll}, or
* {@link MyAvatar.setAttachmentData|setAttachmentData}.
* @function MyAvatar.attachmentsChanged
- * @returns {Signal}
+ * @returns {Signal}
* @deprecated This signal is deprecated and will be removed. Use avatar entities instead.
*/
void attachmentsChanged();
/*@jsdoc
- * Triggered when the avatar's size changes. This can be due to the user changing the size of their avatar or the domain
+ * Triggered when the avatar's size changes. This can be due to the user changing the size of their avatar or the domain
* limiting the size of their avatar.
* @function MyAvatar.scaleChanged
- * @returns {Signal}
+ * @returns {Signal}
*/
void scaleChanged();
@@ -2629,7 +2630,7 @@ signals:
* The hand touch effect makes the avatar's fingers adapt to the shape of any object grabbed, creating the effect that
* it is really touching that object.
* @function MyAvatar.shouldDisableHandTouchChanged
- * @param {boolean} disabled - true
if the hand touch effect is disabled for the avatar,
+ * @param {boolean} disabled - true
if the hand touch effect is disabled for the avatar,
* false
if it isn't disabled.
* @returns {Signal}
*/
@@ -2703,7 +2704,7 @@ private:
virtual void detachOne(const QString& modelURL, const QString& jointName = QString()) override;
virtual void detachAll(const QString& modelURL, const QString& jointName = QString()) override;
-
+
// Attachments/Avatar Entity
void attachmentDataToEntityProperties(const AttachmentData& data, EntityItemProperties& properties);
AttachmentData entityPropertiesToAttachmentData(const EntityItemProperties& properties) const;
diff --git a/interface/src/main.cpp b/interface/src/main.cpp
index d190e3f3da..4e338a629b 100644
--- a/interface/src/main.cpp
+++ b/interface/src/main.cpp
@@ -265,7 +265,7 @@ int main(int argc, const char* argv[]) {
if (socket.waitForConnected(LOCAL_SERVER_TIMEOUT_MS)) {
if (parser.isSet(urlOption)) {
QUrl url = QUrl(parser.value(urlOption));
- if (url.isValid() && (url.scheme() == URL_SCHEME_HIFI || url.scheme() == URL_SCHEME_HIFIAPP
+ if (url.isValid() && (url.scheme() == URL_SCHEME_VIRCADIA || url.scheme() == URL_SCHEME_VIRCADIAAPP
|| url.scheme() == HIFI_URL_SCHEME_HTTP || url.scheme() == HIFI_URL_SCHEME_HTTPS
|| url.scheme() == HIFI_URL_SCHEME_FILE)) {
qDebug() << "Writing URL to local socket";
diff --git a/interface/src/scripting/WindowScriptingInterface.cpp b/interface/src/scripting/WindowScriptingInterface.cpp
index c8714e2a8f..e594ecd536 100644
--- a/interface/src/scripting/WindowScriptingInterface.cpp
+++ b/interface/src/scripting/WindowScriptingInterface.cpp
@@ -139,9 +139,9 @@ void WindowScriptingInterface::disconnectedFromDomain() {
void WindowScriptingInterface::openUrl(const QUrl& url) {
if (!url.isEmpty()) {
auto scheme = url.scheme();
- if (scheme == URL_SCHEME_HIFI) {
+ if (scheme == URL_SCHEME_VIRCADIA) {
DependencyManager::get()->handleLookupString(url.toString());
- } else if (scheme == URL_SCHEME_HIFIAPP) {
+ } else if (scheme == URL_SCHEME_VIRCADIAAPP) {
DependencyManager::get()->openSystemApp(url.path());
} else {
#if defined(Q_OS_ANDROID)
diff --git a/libraries/audio-client/src/AudioClient.h b/libraries/audio-client/src/AudioClient.h
index a5de9bd4ca..5e753fbef8 100644
--- a/libraries/audio-client/src/AudioClient.h
+++ b/libraries/audio-client/src/AudioClient.h
@@ -4,6 +4,7 @@
//
// Created by Stephen Birarda on 1/22/13.
// Copyright 2013 High Fidelity, Inc.
+// Copyright 2021 Vircadia contributors.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@@ -33,7 +34,7 @@
#include
#include
-#include
+#include
#include
#include
#include
diff --git a/libraries/avatars-renderer/src/avatars-renderer/Avatar.h b/libraries/avatars-renderer/src/avatars-renderer/Avatar.h
index 3f5faccb3b..fa5a5cff67 100644
--- a/libraries/avatars-renderer/src/avatars-renderer/Avatar.h
+++ b/libraries/avatars-renderer/src/avatars-renderer/Avatar.h
@@ -3,6 +3,7 @@
// interface/src/avatar
//
// Copyright 2012 High Fidelity, Inc.
+// Copyright 2021 Vircadia contributors.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@@ -207,7 +208,7 @@ public:
/*@jsdoc
* Gets the default rotation of a joint (in the current avatar) relative to its parent.
* For information on the joint hierarchy used, see
- * Avatar Standards.
+ * Avatar Standards.
* @function MyAvatar.getDefaultJointRotation
* @param {number} index - The joint index.
* @returns {Quat} The default rotation of the joint if the joint index is valid, otherwise {@link Quat(0)|Quat.IDENTITY}.
@@ -218,10 +219,10 @@ public:
* Gets the default translation of a joint (in the current avatar) relative to its parent, in model coordinates.
* Warning: These coordinates are not necessarily in meters.
* For information on the joint hierarchy used, see
- * Avatar Standards.
+ * Avatar Standards.
* @function MyAvatar.getDefaultJointTranslation
* @param {number} index - The joint index.
- * @returns {Vec3} The default translation of the joint (in model coordinates) if the joint index is valid, otherwise
+ * @returns {Vec3} The default translation of the joint (in model coordinates) if the joint index is valid, otherwise
* {@link Vec3(0)|Vec3.ZERO}.
*/
Q_INVOKABLE virtual glm::vec3 getDefaultJointTranslation(int index) const;
@@ -283,7 +284,7 @@ public:
// world-space to avatar-space rigconversion functions
/*@jsdoc
- * Transforms a position in world coordinates to a position in a joint's coordinates, or avatar coordinates if no joint is
+ * Transforms a position in world coordinates to a position in a joint's coordinates, or avatar coordinates if no joint is
* specified.
* @function MyAvatar.worldToJointPoint
* @param {Vec3} position - The position in world coordinates.
@@ -293,7 +294,7 @@ public:
Q_INVOKABLE glm::vec3 worldToJointPoint(const glm::vec3& position, const int jointIndex = -1) const;
/*@jsdoc
- * Transforms a direction in world coordinates to a direction in a joint's coordinates, or avatar coordinates if no joint
+ * Transforms a direction in world coordinates to a direction in a joint's coordinates, or avatar coordinates if no joint
* is specified.
* @function MyAvatar.worldToJointDirection
* @param {Vec3} direction - The direction in world coordinates.
@@ -303,7 +304,7 @@ public:
Q_INVOKABLE glm::vec3 worldToJointDirection(const glm::vec3& direction, const int jointIndex = -1) const;
/*@jsdoc
- * Transforms a rotation in world coordinates to a rotation in a joint's coordinates, or avatar coordinates if no joint is
+ * Transforms a rotation in world coordinates to a rotation in a joint's coordinates, or avatar coordinates if no joint is
* specified.
* @function MyAvatar.worldToJointRotation
* @param {Quat} rotation - The rotation in world coordinates.
@@ -313,7 +314,7 @@ public:
Q_INVOKABLE glm::quat worldToJointRotation(const glm::quat& rotation, const int jointIndex = -1) const;
/*@jsdoc
- * Transforms a position in a joint's coordinates, or avatar coordinates if no joint is specified, to a position in world
+ * Transforms a position in a joint's coordinates, or avatar coordinates if no joint is specified, to a position in world
* coordinates.
* @function MyAvatar.jointToWorldPoint
* @param {Vec3} position - The position in joint coordinates, or avatar coordinates if no joint is specified.
@@ -323,7 +324,7 @@ public:
Q_INVOKABLE glm::vec3 jointToWorldPoint(const glm::vec3& position, const int jointIndex = -1) const;
/*@jsdoc
- * Transforms a direction in a joint's coordinates, or avatar coordinates if no joint is specified, to a direction in world
+ * Transforms a direction in a joint's coordinates, or avatar coordinates if no joint is specified, to a direction in world
* coordinates.
* @function MyAvatar.jointToWorldDirection
* @param {Vec3} direction - The direction in joint coordinates, or avatar coordinates if no joint is specified.
@@ -333,7 +334,7 @@ public:
Q_INVOKABLE glm::vec3 jointToWorldDirection(const glm::vec3& direction, const int jointIndex = -1) const;
/*@jsdoc
- * Transforms a rotation in a joint's coordinates, or avatar coordinates if no joint is specified, to a rotation in world
+ * Transforms a rotation in a joint's coordinates, or avatar coordinates if no joint is specified, to a rotation in world
* coordinates.
* @function MyAvatar.jointToWorldRotation
* @param {Quat} rotation - The rotation in joint coordinates, or avatar coordinates if no joint is specified.
@@ -351,7 +352,7 @@ public:
virtual int parseDataFromBuffer(const QByteArray& buffer) override;
/*@jsdoc
- * Sets the offset applied to the current avatar. The offset adjusts the position that the avatar is rendered. For example,
+ * Sets the offset applied to the current avatar. The offset adjusts the position that the avatar is rendered. For example,
* with an offset of { x: 0, y: 0.1, z: 0 }
, your avatar will appear to be raised off the ground slightly.
* @function MyAvatar.setSkeletonOffset
* @param {Vec3} offset - The skeleton offset to set.
@@ -367,7 +368,7 @@ public:
Q_INVOKABLE void setSkeletonOffset(const glm::vec3& offset);
/*@jsdoc
- * Gets the offset applied to the current avatar. The offset adjusts the position that the avatar is rendered. For example,
+ * Gets the offset applied to the current avatar. The offset adjusts the position that the avatar is rendered. For example,
* with an offset of { x: 0, y: 0.1, z: 0 }
, your avatar will appear to be raised off the ground slightly.
* @function MyAvatar.getSkeletonOffset
* @returns {Vec3} The current skeleton offset.
@@ -452,7 +453,7 @@ public:
/*@jsdoc
* Sets the ID of the entity or avatar that the avatar is parented to.
* @function MyAvatar.setParentID
- * @param {Uuid} parentID - The ID of the entity or avatar that the avatar should be parented to. Set to
+ * @param {Uuid} parentID - The ID of the entity or avatar that the avatar should be parented to. Set to
* {@link Uuid(0)|Uuid.NULL} to unparent.
*/
// This calls through to the SpatiallyNestable versions, but is here to expose these to JavaScript.
@@ -461,17 +462,17 @@ public:
/*@jsdoc
* Gets the joint of the entity or avatar that the avatar is parented to.
* @function MyAvatar.getParentJointIndex
- * @returns {number} The joint of the entity or avatar that the avatar is parented to. 65535
or
+ * @returns {number} The joint of the entity or avatar that the avatar is parented to. 65535
or
* -1
if parented to the entity or avatar's position and orientation rather than a joint.
*/
// This calls through to the SpatiallyNestable versions, but is here to expose these to JavaScript.
Q_INVOKABLE virtual quint16 getParentJointIndex() const override { return SpatiallyNestable::getParentJointIndex(); }
/*@jsdoc
- * Sets the joint of the entity or avatar that the avatar is parented to.
+ * Sets the joint of the entity or avatar that the avatar is parented to.
* @function MyAvatar.setParentJointIndex
* @param {number} parentJointIndex - The joint of the entity or avatar that the avatar should be parented to. Use
- * 65535
or -1
to parent to the entity or avatar's position and orientation rather than a
+ * 65535
or -1
to parent to the entity or avatar's position and orientation rather than a
* joint.
*/
// This calls through to the SpatiallyNestable versions, but is here to expose these to JavaScript.
@@ -557,7 +558,7 @@ public:
signals:
/*@jsdoc
- * Triggered when the avatar's target scale is changed. The target scale is the desired scale of the avatar without any
+ * Triggered when the avatar's target scale is changed. The target scale is the desired scale of the avatar without any
* restrictions on permissible scale values imposed by the domain.
* @function MyAvatar.targetScaleChanged
* @param {number} targetScale - The avatar's target scale.
@@ -758,7 +759,7 @@ protected:
static void metaBlendshapeOperator(render::ItemID renderItemID, int blendshapeNumber, const QVector& blendshapeOffsets,
const QVector& blendedMeshSizes, const render::ItemIDs& subItemIDs);
-
+
std::vector _multiSphereShapes;
AABox _fitBoundingBox;
void clearAvatarGrabData(const QUuid& grabID) override;
diff --git a/libraries/avatars-renderer/src/avatars-renderer/ScriptAvatar.h b/libraries/avatars-renderer/src/avatars-renderer/ScriptAvatar.h
index f434498204..aac8236eda 100644
--- a/libraries/avatars-renderer/src/avatars-renderer/ScriptAvatar.h
+++ b/libraries/avatars-renderer/src/avatars-renderer/ScriptAvatar.h
@@ -4,6 +4,7 @@
//
// Created by Stephen Birarda on 4/10/17.
// Copyright 2017 High Fidelity, Inc.
+// Copyright 2021 Vircadia contributors.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@@ -87,10 +88,10 @@ public slots:
/*@jsdoc
* Gets the default rotation of a joint in the avatar relative to its parent.
* For information on the joint hierarchy used, see
- * Avatar Standards.
+ * Avatar Standards.
* @function ScriptAvatar.getDefaultJointRotation
* @param {number} index - The joint index.
- * @returns {Quat} The default rotation of the joint if avatar data are available and the joint index is valid, otherwise
+ * @returns {Quat} The default rotation of the joint if avatar data are available and the joint index is valid, otherwise
* {@link Quat(0)|Quat.IDENTITY}.
*/
glm::quat getDefaultJointRotation(int index) const;
@@ -99,10 +100,10 @@ public slots:
* Gets the default translation of a joint in the avatar relative to its parent, in model coordinates.
* Warning: These coordinates are not necessarily in meters.
* For information on the joint hierarchy used, see
- * Avatar Standards.
+ * Avatar Standards.
* @function ScriptAvatar.getDefaultJointTranslation
* @param {number} index - The joint index.
- * @returns {Vec3} The default translation of the joint (in model coordinates) if avatar data are available and the joint
+ * @returns {Vec3} The default translation of the joint (in model coordinates) if avatar data are available and the joint
* index is valid, otherwise {@link Vec3(0)|Vec3.ZERO}.
*/
glm::vec3 getDefaultJointTranslation(int index) const;
@@ -120,7 +121,7 @@ public slots:
* Gets the position of a joint in the avatar.
* @function ScriptAvatar.getJointPosition
* @param {number} index - The index of the joint.
- * @returns {Vec3} The position of the joint in world coordinates, or {@link Vec3(0)|Vec3.ZERO} if avatar data aren't
+ * @returns {Vec3} The position of the joint in world coordinates, or {@link Vec3(0)|Vec3.ZERO} if avatar data aren't
* available.
*/
glm::vec3 getJointPosition(int index) const;
@@ -154,7 +155,7 @@ public slots:
/*@jsdoc
* Gets the ID of the entity or avatar that the avatar is parented to.
* @function ScriptAvatar.getParentID
- * @returns {Uuid} The ID of the entity or avatar that the avatar is parented to. {@link Uuid(0)|Uuid.NULL} if not parented
+ * @returns {Uuid} The ID of the entity or avatar that the avatar is parented to. {@link Uuid(0)|Uuid.NULL} if not parented
* or avatar data aren't available.
*/
QUuid getParentID() const;
@@ -163,7 +164,7 @@ public slots:
* Gets the joint of the entity or avatar that the avatar is parented to.
* @function ScriptAvatar.getParentJointIndex
* @returns {number} The joint of the entity or avatar that the avatar is parented to. 65535
or
- * -1
if parented to the entity or avatar's position and orientation rather than a joint, or avatar data
+ * -1
if parented to the entity or avatar's position and orientation rather than a joint, or avatar data
* aren't available.
*/
quint16 getParentJointIndex() const;
@@ -189,7 +190,7 @@ public slots:
/*@jsdoc
* Gets the position of the left palm in world coordinates.
* @function ScriptAvatar.getLeftPalmPosition
- * @returns {Vec3} The position of the left palm in world coordinates, or {@link Vec3(0)|Vec3.ZERO} if avatar data aren't
+ * @returns {Vec3} The position of the left palm in world coordinates, or {@link Vec3(0)|Vec3.ZERO} if avatar data aren't
* available.
*/
glm::vec3 getLeftPalmPosition() const;
@@ -197,7 +198,7 @@ public slots:
/*@jsdoc
* Gets the rotation of the left palm in world coordinates.
* @function ScriptAvatar.getLeftPalmRotation
- * @returns {Quat} The rotation of the left palm in world coordinates, or {@link Quat(0)|Quat.IDENTITY} if the avatar data
+ * @returns {Quat} The rotation of the left palm in world coordinates, or {@link Quat(0)|Quat.IDENTITY} if the avatar data
* aren't available.
*/
glm::quat getLeftPalmRotation() const;
diff --git a/libraries/avatars/src/AvatarData.h b/libraries/avatars/src/AvatarData.h
index ff00f9d68b..e17ba8f09d 100755
--- a/libraries/avatars/src/AvatarData.h
+++ b/libraries/avatars/src/AvatarData.h
@@ -4,6 +4,7 @@
//
// Created by Stephen Birarda on 4/9/13.
// Copyright 2013 High Fidelity, Inc.
+// Copyright 2021 Vircadia contributors.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@@ -530,23 +531,23 @@ class AvatarData : public QObject, public SpatiallyNestable {
* avatar. Read-only.
* @property {number} sensorToWorldScale - The scale that transforms dimensions in the user's real world to the avatar's
* size in the virtual world. Read-only.
- * @property {boolean} hasPriority - true
if the avatar is in a "hero" zone, false
if it isn't.
+ * @property {boolean} hasPriority - true
if the avatar is in a "hero" zone, false
if it isn't.
* Read-only.
- * @property {boolean} hasScriptedBlendshapes=false - true
if blend shapes are controlled by scripted actions,
- * otherwise false
. Set this to true
before using the {@link Avatar.setBlendshape} method,
+ * @property {boolean} hasScriptedBlendshapes=false - true
if blend shapes are controlled by scripted actions,
+ * otherwise false
. Set this to true
before using the {@link Avatar.setBlendshape} method,
* and set back to false
after you no longer want scripted control over the blend shapes.
- * Note: This property will automatically be set to true
if the controller system has
+ *
Note: This property will automatically be set to true
if the controller system has
* valid facial blend shape actions.
- * @property {boolean} hasProceduralBlinkFaceMovement=true - true
if avatars blink automatically by animating
- * facial blend shapes, false
if automatic blinking is disabled. Set to false
to fully control
+ * @property {boolean} hasProceduralBlinkFaceMovement=true - true
if avatars blink automatically by animating
+ * facial blend shapes, false
if automatic blinking is disabled. Set to false
to fully control
* the blink facial blend shapes via the {@link Avatar.setBlendshape} method.
- * @property {boolean} hasProceduralEyeFaceMovement=true - true
if the facial blend shapes for an avatar's eyes
- * adjust automatically as the eyes move, false
if this automatic movement is disabled. Set this property
+ * @property {boolean} hasProceduralEyeFaceMovement=true - true
if the facial blend shapes for an avatar's eyes
+ * adjust automatically as the eyes move, false
if this automatic movement is disabled. Set this property
* to true
to prevent the iris from being obscured by the upper or lower lids. Set to false
to
* fully control the eye blend shapes via the {@link Avatar.setBlendshape} method.
- * @property {boolean} hasAudioEnabledFaceMovement=true - true
if the avatar's mouth blend shapes animate
- * automatically based on detected microphone input, false
if this automatic movement is disabled. Set
- * this property to false
to fully control the mouth facial blend shapes via the
+ * @property {boolean} hasAudioEnabledFaceMovement=true - true
if the avatar's mouth blend shapes animate
+ * automatically based on detected microphone input, false
if this automatic movement is disabled. Set
+ * this property to false
to fully control the mouth facial blend shapes via the
* {@link Avatar.setBlendshape} method.
*/
Q_PROPERTY(glm::vec3 position READ getWorldPosition WRITE setPositionViaScript)
@@ -758,7 +759,7 @@ public:
void setDomainMaximumHeight(float domainMaximumHeight);
/*@jsdoc
- * Sets the pointing state of the hands to control where the laser emanates from. If the right index finger is pointing, the
+ * Sets the pointing state of the hands to control where the laser emanates from. If the right index finger is pointing, the
* laser emanates from the tip of that finger, otherwise it emanates from the palm.
* @function Avatar.setHandState
* @param {HandState} state - The pointing state of the hand.
@@ -787,9 +788,9 @@ public:
* Sets a specific joint's rotation and position relative to its parent, in model coordinates.
* Warning: These coordinates are not necessarily in meters.
* Setting joint data completely overrides/replaces all motion from the default animation system including inverse
- * kinematics, but just for the specified joint. So for example, if you were to procedurally manipulate the finger joints,
- * the avatar's hand and head would still do inverse kinematics properly. However, as soon as you start to manipulate
- * joints in the inverse kinematics chain, the inverse kinematics might not function as you expect. For example, if you set
+ * kinematics, but just for the specified joint. So for example, if you were to procedurally manipulate the finger joints,
+ * the avatar's hand and head would still do inverse kinematics properly. However, as soon as you start to manipulate
+ * joints in the inverse kinematics chain, the inverse kinematics might not function as you expect. For example, if you set
* the rotation of the elbow, the hand inverse kinematics position won't end up in the right place.
* @function Avatar.setJointData
* @param {number} index - The index of the joint.
@@ -816,10 +817,10 @@ public:
/*@jsdoc
* Sets a specific joint's rotation relative to its parent.
- * Setting joint data completely overrides/replaces all motion from the default animation system including inverse
- * kinematics, but just for the specified joint. So for example, if you were to procedurally manipulate the finger joints,
- * the avatar's hand and head would still do inverse kinematics properly. However, as soon as you start to manipulate
- * joints in the inverse kinematics chain, the inverse kinematics might not function as you expect. For example, if you set
+ *
Setting joint data completely overrides/replaces all motion from the default animation system including inverse
+ * kinematics, but just for the specified joint. So for example, if you were to procedurally manipulate the finger joints,
+ * the avatar's hand and head would still do inverse kinematics properly. However, as soon as you start to manipulate
+ * joints in the inverse kinematics chain, the inverse kinematics might not function as you expect. For example, if you set
* the rotation of the elbow, the hand inverse kinematics position won't end up in the right place.
* @function Avatar.setJointRotation
* @param {number} index - The index of the joint.
@@ -831,9 +832,9 @@ public:
* Sets a specific joint's translation relative to its parent, in model coordinates.
* Warning: These coordinates are not necessarily in meters.
* Setting joint data completely overrides/replaces all motion from the default animation system including inverse
- * kinematics, but just for the specified joint. So for example, if you were to procedurally manipulate the finger joints,
- * the avatar's hand and head would still do inverse kinematics properly. However, as soon as you start to manipulate
- * joints in the inverse kinematics chain, the inverse kinematics might not function as you expect. For example, if you set
+ * kinematics, but just for the specified joint. So for example, if you were to procedurally manipulate the finger joints,
+ * the avatar's hand and head would still do inverse kinematics properly. However, as soon as you start to manipulate
+ * joints in the inverse kinematics chain, the inverse kinematics might not function as you expect. For example, if you set
* the rotation of the elbow, the hand inverse kinematics position won't end up in the right place.
* @function Avatar.setJointTranslation
* @param {number} index - The index of the joint.
@@ -842,7 +843,7 @@ public:
Q_INVOKABLE virtual void setJointTranslation(int index, const glm::vec3& translation);
/*@jsdoc
- * Clears joint translations and rotations set by script for a specific joint. This restores all motion from the default
+ * Clears joint translations and rotations set by script for a specific joint. This restores all motion from the default
* animation system including inverse kinematics for that joint.
* Note: This is slightly faster than the function variation that specifies the joint name.
* @function Avatar.clearJointData
@@ -859,8 +860,8 @@ public:
Q_INVOKABLE bool isJointDataValid(int index) const;
/*@jsdoc
- * Gets the rotation of a joint relative to its parent. For information on the joint hierarchy used, see
- * Avatar Standards.
+ * Gets the rotation of a joint relative to its parent. For information on the joint hierarchy used, see
+ * Avatar Standards.
* @function Avatar.getJointRotation
* @param {number} index - The index of the joint.
* @returns {Quat} The rotation of the joint relative to its parent.
@@ -870,8 +871,8 @@ public:
/*@jsdoc
* Gets the translation of a joint relative to its parent, in model coordinates.
* Warning: These coordinates are not necessarily in meters.
- * For information on the joint hierarchy used, see
- * Avatar Standards.
+ * For information on the joint hierarchy used, see
+ * Avatar Standards.
* @function Avatar.getJointTranslation
* @param {number} index - The index of the joint.
* @returns {Vec3} The translation of the joint relative to its parent, in model coordinates.
@@ -882,9 +883,9 @@ public:
* Sets a specific joint's rotation and position relative to its parent, in model coordinates.
* Warning: These coordinates are not necessarily in meters.
* Setting joint data completely overrides/replaces all motion from the default animation system including inverse
- * kinematics, but just for the specified joint. So for example, if you were to procedurally manipulate the finger joints,
- * the avatar's hand and head would still do inverse kinematics properly. However, as soon as you start to manipulate
- * joints in the inverse kinematics chain, the inverse kinematics might not function as you expect. For example, if you set
+ * kinematics, but just for the specified joint. So for example, if you were to procedurally manipulate the finger joints,
+ * the avatar's hand and head would still do inverse kinematics properly. However, as soon as you start to manipulate
+ * joints in the inverse kinematics chain, the inverse kinematics might not function as you expect. For example, if you set
* the rotation of the elbow, the hand inverse kinematics position won't end up in the right place.
* @function Avatar.setJointData
* @param {string} name - The name of the joint.
@@ -895,10 +896,10 @@ public:
/*@jsdoc
* Sets a specific joint's rotation relative to its parent.
- * Setting joint data completely overrides/replaces all motion from the default animation system including inverse
- * kinematics, but just for the specified joint. So for example, if you were to procedurally manipulate the finger joints,
- * the avatar's hand and head would still do inverse kinematics properly. However, as soon as you start to manipulate
- * joints in the inverse kinematics chain, the inverse kinematics might not function as you expect. For example, if you set
+ *
Setting joint data completely overrides/replaces all motion from the default animation system including inverse
+ * kinematics, but just for the specified joint. So for example, if you were to procedurally manipulate the finger joints,
+ * the avatar's hand and head would still do inverse kinematics properly. However, as soon as you start to manipulate
+ * joints in the inverse kinematics chain, the inverse kinematics might not function as you expect. For example, if you set
* the rotation of the elbow, the hand inverse kinematics position won't end up in the right place.
* @function Avatar.setJointRotation
* @param {string} name - The name of the joint.
@@ -930,19 +931,19 @@ public:
* Sets a specific joint's translation relative to its parent, in model coordinates.
* Warning: These coordinates are not necessarily in meters.
* Setting joint data completely overrides/replaces all motion from the default animation system including inverse
- * kinematics, but just for the specified joint. So for example, if you were to procedurally manipulate the finger joints,
- * the avatar's hand and head would still do inverse kinematics properly. However, as soon as you start to manipulate
- * joints in the inverse kinematics chain, the inverse kinematics might not function as you expect. For example, if you set
+ * kinematics, but just for the specified joint. So for example, if you were to procedurally manipulate the finger joints,
+ * the avatar's hand and head would still do inverse kinematics properly. However, as soon as you start to manipulate
+ * joints in the inverse kinematics chain, the inverse kinematics might not function as you expect. For example, if you set
* the rotation of the elbow, the hand inverse kinematics position won't end up in the right place.
* @function Avatar.setJointTranslation
* @param {string} name - The name of the joint.
* @param {Vec3} translation - The translation of the joint relative to its parent, in model coordinates.
- * @example Stretch your avatar's neck. Depending on the avatar you are using, you will either see a gap between
+ * @example Stretch your avatar's neck. Depending on the avatar you are using, you will either see a gap between
* the head and body or you will see the neck stretched.
*
* // Stretch your avatar's neck.
* MyAvatar.setJointTranslation("Neck", Vec3.multiply(2, MyAvatar.getJointTranslation("Neck")));
- *
+ *
* // Restore your avatar's neck after 5s.
* Script.setTimeout(function () {
* MyAvatar.clearJointData("Neck");
@@ -953,7 +954,7 @@ public:
Q_INVOKABLE virtual void setJointTranslation(const QString& name, const glm::vec3& translation);
/*@jsdoc
- * Clears joint translations and rotations set by script for a specific joint. This restores all motion from the default
+ * Clears joint translations and rotations set by script for a specific joint. This restores all motion from the default
* animation system including inverse kinematics for that joint.
* Note: This is slightly slower than the function variation that specifies the joint index.
* @function Avatar.clearJointData
@@ -980,8 +981,8 @@ public:
Q_INVOKABLE virtual bool isJointDataValid(const QString& name) const;
/*@jsdoc
- * Gets the rotation of a joint relative to its parent. For information on the joint hierarchy used, see
- * Avatar Standards.
+ * Gets the rotation of a joint relative to its parent. For information on the joint hierarchy used, see
+ * Avatar Standards.
* @function Avatar.getJointRotation
* @param {string} name - The name of the joint.
* @returns {Quat} The rotation of the joint relative to its parent.
@@ -996,7 +997,7 @@ public:
* Gets the translation of a joint relative to its parent, in model coordinates.
* Warning: These coordinates are not necessarily in meters.
* For information on the joint hierarchy used, see
- * Avatar Standards.
+ * Avatar Standards.
* @function Avatar.getJointTranslation
* @param {number} name - The name of the joint.
* @returns {Vec3} The translation of the joint relative to its parent, in model coordinates.
@@ -1010,7 +1011,7 @@ public:
/*@jsdoc
* Gets the rotations of all joints in the current avatar. Each joint's rotation is relative to its parent joint.
* @function Avatar.getJointRotations
- * @returns {Quat[]} The rotations of all joints relative to each's parent. The values are in the same order as the array
+ * @returns {Quat[]} The rotations of all joints relative to each's parent. The values are in the same order as the array
* returned by {@link MyAvatar.getJointNames}, or {@link Avatar.getJointNames} if using the Avatar
API.
* @example Report the rotations of all your avatar's joints.
* print(JSON.stringify(MyAvatar.getJointRotations()));
@@ -1024,8 +1025,8 @@ public:
* model coordinates.
* Warning: These coordinates are not necessarily in meters.
* @function Avatar.getJointTranslations
- * @returns {Vec3[]} The translations of all joints relative to each's parent, in model coordinates. The values are in the
- * same order as the array returned by {@link MyAvatar.getJointNames}, or {@link Avatar.getJointNames} if using the
+ * @returns {Vec3[]} The translations of all joints relative to each's parent, in model coordinates. The values are in the
+ * same order as the array returned by {@link MyAvatar.getJointNames}, or {@link Avatar.getJointNames} if using the
* Avatar
API.
*/
Q_INVOKABLE virtual QVector getJointTranslations() const;
@@ -1038,7 +1039,7 @@ public:
* joints in the inverse kinematics chain, the inverse kinematics might not function as you expect. For example, if you set
* the rotation of the elbow, the hand inverse kinematics position won't end up in the right place.
* @function Avatar.setJointRotations
- * @param {Quat[]} jointRotations - The rotations for all joints in the avatar. The values are in the same order as the
+ * @param {Quat[]} jointRotations - The rotations for all joints in the avatar. The values are in the same order as the
* array returned by {@link MyAvatar.getJointNames}, or {@link Avatar.getJointNames} if using the Avatar
API.
* @example Set your avatar to its default T-pose then rotate its right arm.
*
@@ -1051,7 +1052,7 @@ public:
* }
*
* // Get all join rotations.
- * var jointRotations = MyAvatar.getJointRotations();
+ * var jointRotations = MyAvatar.getJointRotations();
*
* // Update the rotation of the right arm in the array.
* jointRotations[MyAvatar.getJointIndex("RightArm")] = { x: 0.47, y: 0.22, z: -0.02, w: 0.87 };
@@ -1067,9 +1068,9 @@ public:
* // Note: If using from the Avatar API, replace all occurrences of "MyAvatar" with "Avatar".
*/
Q_INVOKABLE virtual void setJointRotations(const QVector& jointRotations);
-
+
/*@jsdoc
- * Sets the translations of all joints in the current avatar. Each joint's translation is relative to its parent joint, in
+ * Sets the translations of all joints in the current avatar. Each joint's translation is relative to its parent joint, in
* model coordinates.
* Warning: These coordinates are not necessarily in meters.
* Setting joint data completely overrides/replaces all motion from the default animation system including inverse
@@ -1078,14 +1079,14 @@ public:
* joints in the inverse kinematics chain, the inverse kinematics might not function as you expect. For example, if you set
* the rotation of the elbow, the hand inverse kinematics position won't end up in the right place.
* @function Avatar.setJointTranslations
- * @param {Vec3[]} translations - The translations for all joints in the avatar, in model coordinates. The values are in
- * the same order as the array returned by {@link MyAvatar.getJointNames}, or {@link Avatar.getJointNames} if using the
+ * @param {Vec3[]} translations - The translations for all joints in the avatar, in model coordinates. The values are in
+ * the same order as the array returned by {@link MyAvatar.getJointNames}, or {@link Avatar.getJointNames} if using the
* Avatar
API.
*/
Q_INVOKABLE virtual void setJointTranslations(const QVector& jointTranslations);
/*@jsdoc
- * Clears all joint translations and rotations that have been set by script. This restores all motion from the default
+ * Clears all joint translations and rotations that have been set by script. This restores all motion from the default
* animation system including inverse kinematics for all joints.
* @function Avatar.clearJointsData
* @example Set your avatar to it's default T-pose for a while.
@@ -1107,7 +1108,7 @@ public:
Q_INVOKABLE virtual void clearJointsData();
/*@jsdoc
- * Gets the joint index for a named joint. The joint index value is the position of the joint in the array returned by
+ * Gets the joint index for a named joint. The joint index value is the position of the joint in the array returned by
* {@link MyAvatar.getJointNames}, or {@link Avatar.getJointNames} if using the Avatar
API.
* @function Avatar.getJointIndex
* @param {string} name - The name of the joint.
@@ -1133,12 +1134,12 @@ public:
/*@jsdoc
- * Sets the value of a blend shape to animate your avatar's face. In order for other users to see the resulting animations
- * on your avatar's face, set hasScriptedBlendshapes
to true
. When you are done using this API,
- * set hasScriptedBlendshapes
back to false
when the animation is complete.
+ * Sets the value of a blend shape to animate your avatar's face. In order for other users to see the resulting animations
+ * on your avatar's face, set hasScriptedBlendshapes
to true
. When you are done using this API,
+ * set hasScriptedBlendshapes
back to false
when the animation is complete.
* @function Avatar.setBlendshape
- * @param {string} name - The name of the blendshape, per the
- * {@link https://docs.vircadia.dev/create/avatars/avatar-standards.html#blendshapes Avatar Standards}.
+ * @param {string} name - The name of the blendshape, per the
+ * {@link https://docs.vircadia.com/create/avatars/avatar-standards.html#blendshapes Avatar Standards}.
* @param {number} value - A value between 0.0
and 1.0
.
* @example Open your avatar's mouth wide.
* MyAvatar.hasScriptedBlendshapes = true;
@@ -1160,7 +1161,7 @@ public:
/*@jsdoc
* Sets all models currently attached to your avatar. For example, if you retrieve attachment data using
- * {@link MyAvatar.getAttachmentsVariant} or {@link Avatar.getAttachmentsVariant}, make changes to it, and then want to
+ * {@link MyAvatar.getAttachmentsVariant} or {@link Avatar.getAttachmentsVariant}, make changes to it, and then want to
* update your avatar's attachments per the changed data.
* @function Avatar.setAttachmentsVariant
* @param {AttachmentData[]} variant - The attachment data defining the models to have attached to your avatar.
@@ -1186,7 +1187,7 @@ public:
* @deprecated This function is deprecated and will be removed.
*/
Q_INVOKABLE virtual void clearAvatarEntity(const QUuid& entityID, bool requiresRemovalFromTree = true);
-
+
// FIXME: Rename to clearAvatarEntity() once the API call is removed.
virtual void clearAvatarEntityInternal(const QUuid& entityID);
@@ -1195,12 +1196,12 @@ public:
QList getAvatarEntityIDs() const;
/*@jsdoc
- * Enables blend shapes set using {@link Avatar.setBlendshape} or {@link MyAvatar.setBlendshape} to be transmitted to other
+ * Enables blend shapes set using {@link Avatar.setBlendshape} or {@link MyAvatar.setBlendshape} to be transmitted to other
* users so that they can see the animation of your avatar's face.
- * Deprecated: This method is deprecated and will be removed. Use the
+ *
Deprecated: This method is deprecated and will be removed. Use the
* Avatar.hasScriptedBlendshapes
or MyAvatar.hasScriptedBlendshapes
property instead.
* @function Avatar.setForceFaceTrackerConnected
- * @param {boolean} connected - true
to enable blend shape changes to be transmitted to other users,
+ * @param {boolean} connected - true
to enable blend shape changes to be transmitted to other users,
* false
to disable.
*/
Q_INVOKABLE void setForceFaceTrackerConnected(bool connected) { setHasScriptedBlendshapes(connected); }
@@ -1274,7 +1275,7 @@ public:
/*@jsdoc
* Sets all models currently attached to your avatar. For example, if you retrieve attachment data using
- * {@link MyAvatar.getAttachmentData} or {@link Avatar.getAttachmentData}, make changes to it, and then want to update your avatar's attachments per the
+ * {@link MyAvatar.getAttachmentData} or {@link Avatar.getAttachmentData}, make changes to it, and then want to update your avatar's attachments per the
* changed data. You can also remove all attachments by using setting attachmentData
to null
.
* @function Avatar.setAttachmentData
* @param {AttachmentData[]} attachmentData - The attachment data defining the models to have attached to your avatar. Use
@@ -1300,19 +1301,19 @@ public:
* Attaches a model to your avatar. For example, you can give your avatar a hat to wear, a guitar to hold, or a surfboard to
* stand on.
* @function Avatar.attach
- * @param {string} modelURL - The URL of the glTF, FBX, or OBJ model to attach. glTF models may be in JSON or binary format
+ * @param {string} modelURL - The URL of the glTF, FBX, or OBJ model to attach. glTF models may be in JSON or binary format
* (".gltf" or ".glb" URLs respectively).
- * @param {string} [jointName=""] - The name of the avatar joint (see {@link MyAvatar.getJointNames} or
+ * @param {string} [jointName=""] - The name of the avatar joint (see {@link MyAvatar.getJointNames} or
* {@link Avatar.getJointNames}) to attach the model to.
* @param {Vec3} [translation=Vec3.ZERO] - The offset to apply to the model relative to the joint position.
* @param {Quat} [rotation=Quat.IDENTITY] - The rotation to apply to the model relative to the joint orientation.
* @param {number} [scale=1.0] - The scale to apply to the model.
- * @param {boolean} [isSoft=false] - If the model has a skeleton, set this to true
so that the bones of the
- * attached model's skeleton are rotated to fit the avatar's current pose. isSoft
is used, for example,
+ * @param {boolean} [isSoft=false] - If the model has a skeleton, set this to true
so that the bones of the
+ * attached model's skeleton are rotated to fit the avatar's current pose. isSoft
is used, for example,
* to have clothing that moves with the avatar.
- * If true
, the translation
, rotation
, and scale
parameters are
+ *
If true
, the translation
, rotation
, and scale
parameters are
* ignored.
- * @param {boolean} [allowDuplicates=false] - If true
then more than one copy of any particular model may be
+ * @param {boolean} [allowDuplicates=false] - If true
then more than one copy of any particular model may be
* attached to the same joint; if false
then the same model cannot be attached to the same joint.
* @param {boolean} [useSaved=true] - Not used.
* @deprecated This function is deprecated and will be removed. Use avatar entities instead.
@@ -1344,7 +1345,7 @@ public:
* Detaches the most recently attached instance of a particular model from either a specific joint or any joint.
* @function Avatar.detachOne
* @param {string} modelURL - The URL of the model to detach.
- * @param {string} [jointName=""] - The name of the joint to detach the model from. If ""
, then the most
+ * @param {string} [jointName=""] - The name of the joint to detach the model from. If ""
, then the most
* recently attached model is removed from which ever joint it was attached to.
* @deprecated This function is deprecated and will be removed. Use avatar entities instead.
*/
@@ -1354,7 +1355,7 @@ public:
* Detaches all instances of a particular model from either a specific joint or all joints.
* @function Avatar.detachAll
* @param {string} modelURL - The URL of the model to detach.
- * @param {string} [jointName=""] - The name of the joint to detach the model from. If ""
, then the model is
+ * @param {string} [jointName=""] - The name of the joint to detach the model from. If ""
, then the model is
* detached from all joints.
* @deprecated This function is deprecated and will be removed. Use avatar entities instead.
*/
@@ -1414,7 +1415,7 @@ public:
/*@jsdoc
* Gets the transform from the user's real world to the avatar's size, orientation, and position in the virtual world.
* @function Avatar.getSensorToWorldMatrix
- * @returns {Mat4} The scale, rotation, and translation transform from the user's real world to the avatar's size,
+ * @returns {Mat4} The scale, rotation, and translation transform from the user's real world to the avatar's size,
* orientation, and position in the virtual world.
* @example Report the sensor to world matrix.
* var sensorToWorldMatrix = MyAvatar.getSensorToWorldMatrix();
@@ -1431,7 +1432,7 @@ public:
/*@jsdoc
* Gets the scale that transforms dimensions in the user's real world to the avatar's size in the virtual world.
* @function Avatar.getSensorToWorldScale
- * @returns {number} The scale that transforms dimensions in the user's real world to the avatar's size in the virtual
+ * @returns {number} The scale that transforms dimensions in the user's real world to the avatar's size in the virtual
* world.
*/
// thread safe
@@ -1661,7 +1662,7 @@ public slots:
virtual bool setAbsoluteJointTranslationInObjectFrame(int index, const glm::vec3& translation) override { return false; }
/*@jsdoc
- * Gets the target scale of the avatar without any restrictions on permissible values imposed by the domain. In contrast, the
+ * Gets the target scale of the avatar without any restrictions on permissible values imposed by the domain. In contrast, the
* scale
property's value may be limited by the domain's settings.
* @function Avatar.getTargetScale
* @returns {number} The target scale of the avatar.
@@ -1703,7 +1704,7 @@ protected:
void unpackSkeletonModelURL(const QByteArray& data);
void unpackSkeletonData(const QByteArray& data);
-
+
// isReplicated will be true on downstream Avatar Mixers and their clients, but false on the upstream "master"
// Audio Mixer that the replicated avatar is connected to.
bool _isReplicated{ false };
diff --git a/libraries/avatars/src/ScriptAvatarData.h b/libraries/avatars/src/ScriptAvatarData.h
index a9deb81a27..3982c32b29 100644
--- a/libraries/avatars/src/ScriptAvatarData.h
+++ b/libraries/avatars/src/ScriptAvatarData.h
@@ -4,6 +4,7 @@
//
// Created by Zach Fox on 2017-04-10.
// Copyright 2017 High Fidelity, Inc.
+// Copyright 2021 Vircadia contributors.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@@ -117,10 +118,10 @@ public:
/*@jsdoc
* Gets the rotation of a joint relative to its parent. For information on the joint hierarchy used, see
- * Avatar Standards.
+ * Avatar Standards.
* @function ScriptAvatar.getJointRotation
* @param {number} index - The index of the joint.
- * @returns {Quat} The rotation of the joint relative to its parent, or {@link Quat(0)|Quat.IDENTITY} if the avatar data
+ * @returns {Quat} The rotation of the joint relative to its parent, or {@link Quat(0)|Quat.IDENTITY} if the avatar data
* aren't available.
*/
Q_INVOKABLE glm::quat getJointRotation(int index) const;
@@ -129,20 +130,20 @@ public:
* Gets the translation of a joint relative to its parent, in model coordinates.
* Warning: These coordinates are not necessarily in meters.
* For information on the joint hierarchy used, see
- * Avatar Standards.
+ * Avatar Standards.
* @function ScriptAvatar.getJointTranslation
* @param {number} index - The index of the joint.
- * @returns {Vec3} The translation of the joint relative to its parent, in model coordinates, or {@link Vec3(0)|Vec3.ZERO}
+ * @returns {Vec3} The translation of the joint relative to its parent, in model coordinates, or {@link Vec3(0)|Vec3.ZERO}
* if the avatar data aren't available.
*/
Q_INVOKABLE glm::vec3 getJointTranslation(int index) const;
/*@jsdoc
* Gets the rotation of a joint relative to its parent. For information on the joint hierarchy used, see
- * Avatar Standards.
+ * Avatar Standards.
* @function ScriptAvatar.getJointRotation
* @param {string} name - The name of the joint.
- * @returns {Quat} The rotation of the joint relative to its parent, or {@link Quat(0)|Quat.IDENTITY} if the avatar data
+ * @returns {Quat} The rotation of the joint relative to its parent, or {@link Quat(0)|Quat.IDENTITY} if the avatar data
* aren't available.
*/
Q_INVOKABLE glm::quat getJointRotation(const QString& name) const;
@@ -151,10 +152,10 @@ public:
* Gets the translation of a joint relative to its parent, in model coordinates.
* Warning: These coordinates are not necessarily in meters.
* For information on the joint hierarchy used, see
- * Avatar Standards.
+ * Avatar Standards.
* @function ScriptAvatar.getJointTranslation
* @param {number} name - The name of the joint.
- * @returns {Vec3} The translation of the joint relative to its parent, in model coordinates, or {@link Vec3(0)|Vec3.ZERO}
+ * @returns {Vec3} The translation of the joint relative to its parent, in model coordinates, or {@link Vec3(0)|Vec3.ZERO}
* if the avatar data aren't available.
*/
Q_INVOKABLE glm::vec3 getJointTranslation(const QString& name) const;
@@ -162,7 +163,7 @@ public:
/*@jsdoc
* Gets the rotations of all joints in the avatar. Each joint's rotation is relative to its parent joint.
* @function ScriptAvatar.getJointRotations
- * @returns {Quat[]} The rotations of all joints relative to each's parent, or []
if the avatar data aren't
+ * @returns {Quat[]} The rotations of all joints relative to each's parent, or []
if the avatar data aren't
* available. The values are in the same order as the array returned by {@link ScriptAvatar.getJointNames}.
*/
Q_INVOKABLE QVector getJointRotations() const;
@@ -172,8 +173,8 @@ public:
* model coordinates.
* Warning: These coordinates are not necessarily in meters.
* @function ScriptAvatar.getJointTranslations
- * @returns {Vec3[]} The translations of all joints relative to each's parent, in model coordinates, or []
if
- * the avatar data aren't available. The values are in the same order as the array returned by
+ * @returns {Vec3[]} The translations of all joints relative to each's parent, in model coordinates, or []
if
+ * the avatar data aren't available. The values are in the same order as the array returned by
* {@link ScriptAvatar.getJointNames}.
*/
Q_INVOKABLE QVector getJointTranslations() const;
@@ -182,7 +183,7 @@ public:
* Checks that the data for a joint are valid.
* @function ScriptAvatar.isJointDataValid
* @param {number} index - The index of the joint.
- * @returns {boolean} true
if the joint data are valid, false
if not or the avatar data aren't
+ * @returns {boolean} true
if the joint data are valid, false
if not or the avatar data aren't
* available.
*/
Q_INVOKABLE bool isJointDataValid(const QString& name) const;
@@ -206,7 +207,7 @@ public:
/*@jsdoc
* Gets information about the models currently attached to the avatar.
* @function ScriptAvatar.getAttachmentData
- * @returns {AttachmentData[]} Information about all models attached to the avatar, or []
if the avatar data
+ * @returns {AttachmentData[]} Information about all models attached to the avatar, or []
if the avatar data
* aren't available.
* @deprecated This function is deprecated and will be removed. Use avatar entities instead.
*/
@@ -228,7 +229,7 @@ public:
glm::mat4 getSensorToWorldMatrix() const;
glm::mat4 getControllerLeftHandMatrix() const;
glm::mat4 getControllerRightHandMatrix() const;
-
+
bool getHasPriority() const;
signals:
@@ -268,7 +269,7 @@ public slots:
* Gets the rotation of a joint relative to the avatar.
* @function ScriptAvatar.getAbsoluteJointRotationInObjectFrame
* @param {number} index - The index of the joint.
- * @returns {Quat} The rotation of the joint relative to the avatar, or {@link Quat(0)|Quat.IDENTITY} if the avatar data
+ * @returns {Quat} The rotation of the joint relative to the avatar, or {@link Quat(0)|Quat.IDENTITY} if the avatar data
* aren't available.
*/
glm::quat getAbsoluteJointRotationInObjectFrame(int index) const;
@@ -277,7 +278,7 @@ public slots:
* Gets the translation of a joint relative to the avatar.
* @function ScriptAvatar.getAbsoluteJointTranslationInObjectFrame
* @param {number} index - The index of the joint.
- * @returns {Vec3} The translation of the joint relative to the avatar, or {@link Vec3(0)|Vec3.ZERO} if the avatar data
+ * @returns {Vec3} The translation of the joint relative to the avatar, or {@link Vec3(0)|Vec3.ZERO} if the avatar data
* aren't available.
*/
glm::vec3 getAbsoluteJointTranslationInObjectFrame(int index) const;
diff --git a/libraries/controllers/src/controllers/UserInputMapper.cpp b/libraries/controllers/src/controllers/UserInputMapper.cpp
index 6333792b3f..6a46dea7d9 100755
--- a/libraries/controllers/src/controllers/UserInputMapper.cpp
+++ b/libraries/controllers/src/controllers/UserInputMapper.cpp
@@ -738,7 +738,7 @@ Mapping::Pointer UserInputMapper::newMapping(const QString& mappingName) {
// if (request->getResult() == ResourceRequest::Success) {
// result = parseMapping(QString(request->getData()));
// } else {
-// qCWarning(controllers) << "Failed to load mapping url <" << jsonUrl << ">" << endl;
+// qCWarning(controllers) << "Failed to load mapping url <" << jsonUrl << ">" << Qt::endl;
// }
// request->deleteLater();
// }
@@ -1177,13 +1177,13 @@ Mapping::Pointer UserInputMapper::parseMapping(const QString& json) {
if (doc.isNull()) {
qCDebug(controllers) << "Invalid JSON...\n";
qCDebug(controllers) << error.errorString();
- qCDebug(controllers) << "JSON was:\n" << json << endl;
+ qCDebug(controllers) << "JSON was:\n" << json << Qt::endl;
return Mapping::Pointer();
}
if (!doc.isObject()) {
- qWarning() << "Mapping json Document is not an object" << endl;
- qCDebug(controllers) << "JSON was:\n" << json << endl;
+ qWarning() << "Mapping json Document is not an object" << Qt::endl;
+ qCDebug(controllers) << "JSON was:\n" << json << Qt::endl;
return Mapping::Pointer();
}
return parseMapping(doc.object());
diff --git a/libraries/entities-renderer/src/RenderableEntityItem.cpp b/libraries/entities-renderer/src/RenderableEntityItem.cpp
index b7cfcde224..212baa6634 100644
--- a/libraries/entities-renderer/src/RenderableEntityItem.cpp
+++ b/libraries/entities-renderer/src/RenderableEntityItem.cpp
@@ -495,6 +495,15 @@ void EntityRenderer::removeMaterial(graphics::MaterialPointer material, const st
emit requestRenderUpdate();
}
+graphics::MaterialPointer EntityRenderer::getTopMaterial() {
+ std::lock_guard lock(_materialsLock);
+ auto materials = _materials.find("0");
+ if (materials != _materials.end()) {
+ return materials->second.top().material;
+ }
+ return nullptr;
+}
+
EntityRenderer::Pipeline EntityRenderer::getPipelineType(const graphics::MultiMaterial& materials) {
if (materials.top().material && materials.top().material->isProcedural() && materials.top().material->isReady()) {
return Pipeline::PROCEDURAL;
@@ -626,6 +635,7 @@ void EntityRenderer::updateShapeKeyBuilderFromMaterials(ShapeKey::Builder& build
{
std::lock_guard lock(_materialsLock);
materials = _materials.find("0");
+
if (materials != _materials.end()) {
if (materials->second.shouldUpdate()) {
RenderPipelines::updateMultiMaterial(materials->second);
@@ -653,7 +663,6 @@ void EntityRenderer::updateShapeKeyBuilderFromMaterials(ShapeKey::Builder& build
auto pipelineType = getPipelineType(materials->second);
if (pipelineType == Pipeline::MATERIAL) {
builder.withMaterial();
-
if (drawMaterialKey.isNormalMap()) {
builder.withTangents();
}
diff --git a/libraries/entities-renderer/src/RenderableEntityItem.h b/libraries/entities-renderer/src/RenderableEntityItem.h
index 2731fe6a50..3caeef0713 100644
--- a/libraries/entities-renderer/src/RenderableEntityItem.h
+++ b/libraries/entities-renderer/src/RenderableEntityItem.h
@@ -62,7 +62,9 @@ public:
};
virtual void addMaterial(graphics::MaterialLayer material, const std::string& parentMaterialName);
virtual void removeMaterial(graphics::MaterialPointer material, const std::string& parentMaterialName);
+ virtual graphics::MaterialPointer getTopMaterial();
static Pipeline getPipelineType(const graphics::MultiMaterial& materials);
+ virtual gpu::TexturePointer getTexture() { return nullptr; }
virtual scriptable::ScriptableModelBase getScriptableModel() override { return scriptable::ScriptableModelBase(); }
diff --git a/libraries/entities-renderer/src/RenderableImageEntityItem.cpp b/libraries/entities-renderer/src/RenderableImageEntityItem.cpp
index 3fa2174114..9592a3e57f 100644
--- a/libraries/entities-renderer/src/RenderableImageEntityItem.cpp
+++ b/libraries/entities-renderer/src/RenderableImageEntityItem.cpp
@@ -198,10 +198,8 @@ void ImageEntityRenderer::doRender(RenderArgs* args) {
procedural->prepare(*batch, transform.getTranslation(), transform.getScale(), transform.getRotation(), _created, ProceduralProgramKey(transparent));
} else if (pipelineType == Pipeline::SIMPLE) {
batch->setResourceTexture(0, _texture->getGPUTexture());
- } else {
- if (RenderPipelines::bindMaterials(materials, *batch, args->_renderMode, args->_enableTexturing)) {
- args->_details._materialSwitches++;
- }
+ } else if (RenderPipelines::bindMaterials(materials, *batch, args->_renderMode, args->_enableTexturing)) {
+ args->_details._materialSwitches++;
}
DependencyManager::get()->renderQuad(
diff --git a/libraries/entities-renderer/src/RenderableImageEntityItem.h b/libraries/entities-renderer/src/RenderableImageEntityItem.h
index ff82dc157a..cc923daf4b 100644
--- a/libraries/entities-renderer/src/RenderableImageEntityItem.h
+++ b/libraries/entities-renderer/src/RenderableImageEntityItem.h
@@ -24,6 +24,8 @@ public:
ImageEntityRenderer(const EntityItemPointer& entity);
~ImageEntityRenderer();
+ gpu::TexturePointer getTexture() override { return _texture ? _texture->getGPUTexture() : nullptr; }
+
protected:
Item::Bound getBound(RenderArgs* args) override;
ShapeKey getShapeKey() override;
diff --git a/libraries/entities-renderer/src/RenderableMaterialEntityItem.cpp b/libraries/entities-renderer/src/RenderableMaterialEntityItem.cpp
index 8f8a2076f8..b8f829f4ba 100644
--- a/libraries/entities-renderer/src/RenderableMaterialEntityItem.cpp
+++ b/libraries/entities-renderer/src/RenderableMaterialEntityItem.cpp
@@ -79,26 +79,42 @@ void MaterialEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPo
}
}
+ bool usingMaterialData = _materialURL.startsWith("materialData");
+ bool usingEntityID = _materialURL.startsWith("{");
+ bool materialDataChanged = false;
bool urlChanged = false;
std::string newCurrentMaterialName = _currentMaterialName;
+ QString targetEntityID = _materialURL;
{
QString materialURL = entity->getMaterialURL();
if (materialURL != _materialURL) {
_materialURL = materialURL;
+ usingMaterialData = _materialURL.startsWith("materialData");
+ usingEntityID = _materialURL.startsWith("{");
+ targetEntityID = _materialURL;
if (_materialURL.contains("#")) {
auto split = _materialURL.split("#");
newCurrentMaterialName = split.last().toStdString();
+ if (usingEntityID) {
+ targetEntityID = split.first();
+ }
} else if (_materialURL.contains("?")) {
qDebug() << "DEPRECATED: Use # instead of ? for material URLS:" << _materialURL;
auto split = _materialURL.split("?");
newCurrentMaterialName = split.last().toStdString();
+ if (usingEntityID) {
+ targetEntityID = split.first();
+ }
+ }
+
+ if (usingMaterialData) {
+ materialDataChanged = true;
+ } else {
+ urlChanged = true;
}
- urlChanged = true;
}
}
- bool usingMaterialData = _materialURL.startsWith("materialData");
- bool materialDataChanged = false;
QUuid oldParentID = _parentID;
QString oldParentMaterialName = _parentMaterialName;
{
@@ -135,7 +151,7 @@ void MaterialEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPo
}
}
- if (urlChanged && !usingMaterialData) {
+ if (urlChanged && !usingMaterialData && !usingEntityID) {
_networkMaterial = DependencyManager::get()->getMaterial(_materialURL);
auto onMaterialRequestFinished = [this, entity, oldParentID, oldParentMaterialName, newCurrentMaterialName](bool success) {
deleteMaterial(oldParentID, oldParentMaterialName);
@@ -159,6 +175,13 @@ void MaterialEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPo
});
}
}
+ } else if (urlChanged && usingEntityID) {
+ deleteMaterial(oldParentID, oldParentMaterialName);
+ _texturesLoaded = true;
+ _parsedMaterials = NetworkMaterialResource::parseMaterialForUUID(QJsonValue(targetEntityID));
+ // Since our material changed, the current name might not be valid anymore, so we need to update
+ setCurrentMaterialName(newCurrentMaterialName);
+ applyMaterial(entity);
} else if (materialDataChanged && usingMaterialData) {
deleteMaterial(oldParentID, oldParentMaterialName);
_texturesLoaded = false;
@@ -167,6 +190,10 @@ void MaterialEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPo
setCurrentMaterialName(newCurrentMaterialName);
applyMaterial(entity);
} else {
+ if (newCurrentMaterialName != _currentMaterialName) {
+ setCurrentMaterialName(newCurrentMaterialName);
+ }
+
if (deleteNeeded) {
deleteMaterial(oldParentID, oldParentMaterialName);
}
diff --git a/libraries/entities-renderer/src/RenderableMaterialEntityItem.h b/libraries/entities-renderer/src/RenderableMaterialEntityItem.h
index 340d169f29..25403e8a2b 100644
--- a/libraries/entities-renderer/src/RenderableMaterialEntityItem.h
+++ b/libraries/entities-renderer/src/RenderableMaterialEntityItem.h
@@ -26,6 +26,8 @@ public:
MaterialEntityRenderer(const EntityItemPointer& entity) : Parent(entity) {}
~MaterialEntityRenderer() { deleteMaterial(_parentID, _parentMaterialName); }
+ graphics::MaterialPointer getTopMaterial() override { return getMaterial(); }
+
private:
virtual void doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) override;
virtual void doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) override;
diff --git a/libraries/entities-renderer/src/RenderableWebEntityItem.cpp b/libraries/entities-renderer/src/RenderableWebEntityItem.cpp
index 7932a19110..6e436a0dcd 100644
--- a/libraries/entities-renderer/src/RenderableWebEntityItem.cpp
+++ b/libraries/entities-renderer/src/RenderableWebEntityItem.cpp
@@ -274,6 +274,7 @@ void WebEntityRenderer::doRender(RenderArgs* args) {
// Try to update the texture
OffscreenQmlSurface::TextureAndFence newTextureAndFence;
+ QSize windowSize;
bool newTextureAvailable = false;
if (!resultWithReadLock([&] {
if (!_webSurface) {
@@ -281,6 +282,7 @@ void WebEntityRenderer::doRender(RenderArgs* args) {
}
newTextureAvailable = _webSurface->fetchTexture(newTextureAndFence);
+ windowSize = _webSurface->size();
return true;
})) {
return;
@@ -288,6 +290,8 @@ void WebEntityRenderer::doRender(RenderArgs* args) {
if (newTextureAvailable) {
_texture->setExternalTexture(newTextureAndFence.first, newTextureAndFence.second);
+ _texture->setSize(windowSize.width(), windowSize.height());
+ _texture->setOriginalSize(windowSize.width(), windowSize.height());
}
static const glm::vec2 texMin(0.0f), texMax(1.0f), topLeft(-0.5f), bottomRight(0.5f);
diff --git a/libraries/entities-renderer/src/RenderableWebEntityItem.h b/libraries/entities-renderer/src/RenderableWebEntityItem.h
index 1ac415e5e5..fb04e08ec7 100644
--- a/libraries/entities-renderer/src/RenderableWebEntityItem.h
+++ b/libraries/entities-renderer/src/RenderableWebEntityItem.h
@@ -55,6 +55,8 @@ public:
virtual void setProxyWindow(QWindow* proxyWindow) override;
virtual QObject* getEventHandler() override;
+ gpu::TexturePointer getTexture() override { return _texture; }
+
protected:
virtual bool needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const override;
virtual void doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) override;
diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp
index 425cfe9439..945804a0fc 100644
--- a/libraries/entities/src/EntityItemProperties.cpp
+++ b/libraries/entities/src/EntityItemProperties.cpp
@@ -951,10 +951,11 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
*
* @typedef {object} Entities.EntityProperties-Material
* @property {Vec3} dimensions=0.1,0.1,0.1 - Used when materialMappingMode == "projected"
.
- * @property {string} materialURL="" - URL to a {@link Entities.MaterialResource|MaterialResource}. If you append
- * "#name"
to the URL, the material with that name in the {@link Entities.MaterialResource|MaterialResource}
- * will be applied to the entity. Alternatively, set the property value to "materialData"
to use the
- * materialData
property for the {@link Entities.MaterialResource|MaterialResource} values.
+ * @property {string} materialURL="" - URL to a {@link Entities.MaterialResource|MaterialResource}. Alternatively, set the
+ * property value to "materialData"
to use the materialData
property for the
+ * {@link Entities.MaterialResource|MaterialResource} values. If you append "#name"
to the URL, the material
+ * with that name will be applied to the entity. You can also use the ID of another Material entity as the URL, in which
+ * case this material will act as a copy of that material, with its own unique material transform, priority, etc.
* @property {string} materialData="" - Used to store {@link Entities.MaterialResource|MaterialResource} data as a JSON string.
* You can use JSON.parse()
to parse the string into a JavaScript object which you can manipulate the
* properties of, and use JSON.stringify()
to convert the object into a string to put in the property.
@@ -1379,7 +1380,8 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
/*@jsdoc
* The "Web"
{@link Entities.EntityType|EntityType} displays a browsable web page. Each user views their own copy
* of the web page: if one user navigates to another page on the entity, other users do not see the change; if a video is being
- * played, users don't see it in sync. It has properties in addition to the common
+ * played, users don't see it in sync. Internally, a Web entity is rendered as a non-repeating, upside down texture, so additional
+ * transformations may be necessary if you reference a Web entity texture by UUID. It has properties in addition to the common
* {@link Entities.EntityProperties|EntityProperties}.
*
* @typedef {object} Entities.EntityProperties-Web
diff --git a/libraries/entities/src/EntityTree.cpp b/libraries/entities/src/EntityTree.cpp
index eeb42626c2..63d8842a91 100644
--- a/libraries/entities/src/EntityTree.cpp
+++ b/libraries/entities/src/EntityTree.cpp
@@ -2751,6 +2751,47 @@ QVector EntityTree::sendEntities(EntityEditPacketSender* packetSen
return map.values().toVector();
}
+QJsonValue replaceEntityIDsInJSONHelper(const QJsonValue& jsonValue, std::function getMapped) {
+ if (jsonValue.isString()) {
+ QString stringValue = jsonValue.toString();
+ QUuid oldID = stringValue;
+ if (!oldID.isNull()) {
+ return QJsonValue(getMapped(oldID).toString());
+ }
+ return stringValue;
+ } else if (jsonValue.isArray()) {
+ QJsonArray jsonArray = jsonValue.toArray();
+ for (int i = 0; i < jsonArray.count(); i++) {
+ jsonArray[i] = replaceEntityIDsInJSONHelper(jsonArray[i], getMapped);
+ }
+ return jsonArray;
+ } else if (jsonValue.isObject()) {
+ QJsonObject jsonObject = jsonValue.toObject();
+ auto keys = jsonObject.keys();
+ for (auto& key : keys) {
+ auto value = jsonObject.value(key);
+ jsonObject[key] = replaceEntityIDsInJSONHelper(value, getMapped);
+ }
+ return jsonObject;
+ } else {
+ return jsonValue;
+ }
+}
+
+QString replaceEntityIDsInJSON(const QString& json, std::function getMapped) {
+ QJsonDocument document = QJsonDocument::fromJson(json.toUtf8());
+ if (!document.isNull() && document.isObject()) {
+ QJsonObject jsonObject = document.object();
+ auto keys = jsonObject.keys();
+ for (auto& key : keys) {
+ auto value = jsonObject.value(key);
+ jsonObject[key] = replaceEntityIDsInJSONHelper(value, getMapped);
+ }
+ document = QJsonDocument(jsonObject);
+ }
+ return document.toJson();
+}
+
bool EntityTree::sendEntitiesOperation(const OctreeElementPointer& element, void* extraData) {
SendEntitiesOperationArgs* args = static_cast(extraData);
EntityTreeElementPointer entityTreeElement = std::static_pointer_cast(element);
@@ -2819,6 +2860,61 @@ bool EntityTree::sendEntitiesOperation(const OctreeElementPointer& element, void
QByteArray actionData = properties.getActionData();
properties.setActionData(remapActionDataIDs(actionData, *args->map));
+ {
+ QString materialURL = properties.getMaterialURL();
+ QString uuidString = materialURL;
+ QString materialName = "";
+
+ if (materialURL.contains("?")) {
+ QStringList split = materialURL.split("?");
+ uuidString = split[0];
+ if (split.length() > 1) {
+ materialName = split[1];
+ }
+ } else if (materialURL.contains("#")) {
+ QStringList split = materialURL.split("#");
+ uuidString = split[0];
+ if (split.length() > 1) {
+ materialName = split[1];
+ }
+ }
+
+ QUuid oldID = uuidString;
+ if (!oldID.isNull()) {
+ uuidString = getMapped(oldID).toString();
+ }
+ QUuid oldMaterialName = materialName;
+ if (!oldMaterialName.isNull()) {
+ materialName = getMapped(oldMaterialName).toString();
+ }
+
+ if (!materialName.isEmpty()) {
+ properties.setMaterialURL(uuidString + "?" + materialName);
+ } else {
+ properties.setMaterialURL(uuidString);
+ }
+ }
+
+ QString imageURL = properties.getImageURL();
+ if (imageURL.startsWith("{")) {
+ QUuid oldID = imageURL;
+ if (!oldID.isNull()) {
+ properties.setImageURL(getMapped(oldID).toString());
+ }
+ }
+
+ QString materialData = properties.getMaterialData();
+ if (!materialData.isEmpty()) {
+ materialData = replaceEntityIDsInJSON(materialData, getMapped);
+ properties.setMaterialData(materialData);
+ }
+
+ QString userData = properties.getUserData();
+ if (!userData.isEmpty()) {
+ userData = replaceEntityIDsInJSON(userData, getMapped);
+ properties.setUserData(userData);
+ }
+
// set creation time to "now" for imported entities
properties.setCreated(usecTimestampNow());
diff --git a/libraries/gpu/src/gpu/Texture.cpp b/libraries/gpu/src/gpu/Texture.cpp
index 1edd7d33cf..48159c5da5 100755
--- a/libraries/gpu/src/gpu/Texture.cpp
+++ b/libraries/gpu/src/gpu/Texture.cpp
@@ -322,6 +322,16 @@ bool Texture::isDepthStencilRenderTarget() const {
return (_texelFormat.getSemantic() == gpu::DEPTH) || (_texelFormat.getSemantic() == gpu::DEPTH_STENCIL);
}
+void Texture::setSize(int width, int height) {
+ _width = width;
+ _height = height;
+}
+
+void Texture::setOriginalSize(int width, int height) {
+ _originalWidth = width;
+ _originalHeight = height;
+}
+
uint16 Texture::evalDimMaxNumMips(uint16 size) {
double largerDim = size;
double val = log(largerDim)/log(2.0);
@@ -887,16 +897,34 @@ void SphericalHarmonics::evalFromTexture(const Texture& texture, gpu::BackendTar
// TextureSource
-void TextureSource::resetTexture(gpu::TexturePointer texture) {
+const gpu::TexturePointer TextureSource::getGPUTexture() const {
+ if (_gpuTextureOperator && !_locked) {
+ _locked = true;
+ auto gpuTexture = _gpuTextureOperator();
+ _locked = false;
+ return gpuTexture;
+ }
+ return _gpuTexture;
+}
+
+void TextureSource::resetTexture(const gpu::TexturePointer& texture) {
_gpuTexture = texture;
+ _gpuTextureOperator = nullptr;
+}
+
+void TextureSource::resetTextureOperator(const std::function& textureOperator) {
+ _gpuTexture = nullptr;
+ _gpuTextureOperator = textureOperator;
}
bool TextureSource::isDefined() const {
- if (_gpuTexture) {
- return _gpuTexture->isDefined();
- } else {
- return false;
+ if (_gpuTextureOperator && !_locked) {
+ _locked = true;
+ auto gpuTexture = _gpuTextureOperator();
+ _locked = false;
+ return gpuTexture && gpuTexture->isDefined();
}
+ return _gpuTexture && _gpuTexture->isDefined();
}
bool Texture::setMinMip(uint16 newMinMip) {
@@ -930,6 +958,7 @@ void Texture::setExternalTexture(uint32 externalId, void* externalFence) {
Lock lock(_externalMutex);
assert(_externalRecycler);
_externalUpdates.push_back({ externalId, externalFence });
+ _defined = true;
}
Texture::ExternalUpdates Texture::getUpdates() const {
diff --git a/libraries/gpu/src/gpu/Texture.h b/libraries/gpu/src/gpu/Texture.h
index a525cda1ab..a0cfc60b6e 100755
--- a/libraries/gpu/src/gpu/Texture.h
+++ b/libraries/gpu/src/gpu/Texture.h
@@ -417,11 +417,16 @@ public:
Element getTexelFormat() const { return _texelFormat; }
+ void setSize(int width, int height);
Vec3u getDimensions() const { return Vec3u(_width, _height, _depth); }
uint16 getWidth() const { return _width; }
uint16 getHeight() const { return _height; }
uint16 getDepth() const { return _depth; }
+ void setOriginalSize(int width, int height);
+ int getOriginalWidth() const { return _originalWidth; }
+ int getOriginalHeight() const { return _originalHeight; }
+
// The number of faces is mostly used for cube map, and maybe for stereo ? otherwise it's 1
// For cube maps, this means the pixels of the different faces are supposed to be packed back to back in a mip
// as if the height was NUM_FACES time bigger.
@@ -615,6 +620,8 @@ protected:
uint16 _width { 1 };
uint16 _height { 1 };
uint16 _depth { 1 };
+ int _originalWidth { 0 };
+ int _originalHeight { 0 };
uint16 _numSamples { 1 };
@@ -676,9 +683,10 @@ public:
_element(element)
{};
- TextureView(const TexturePointer& texture, uint16 subresource) :
+ TextureView(const TexturePointer& texture, uint16 subresource, std::function textureOperator = nullptr) :
_texture(texture),
- _subresource(subresource)
+ _subresource(subresource),
+ _textureOperator(textureOperator)
{};
~TextureView() {}
@@ -689,6 +697,12 @@ public:
bool operator !() const { return (!_texture); }
bool isValid() const { return bool(_texture); }
+
+ bool isReference() const { return (bool)_textureOperator; }
+ std::function getTextureOperator() const { return _textureOperator; }
+
+private:
+ std::function _textureOperator { nullptr };
};
typedef std::vector TextureViews;
@@ -700,16 +714,20 @@ public:
void setUrl(const QUrl& url) { _imageUrl = url; }
const QUrl& getUrl() const { return _imageUrl; }
- const gpu::TexturePointer getGPUTexture() const { return _gpuTexture; }
+ const gpu::TexturePointer getGPUTexture() const;
void setType(int type) { _type = type; }
int getType() const { return _type; }
- void resetTexture(gpu::TexturePointer texture);
+ void resetTexture(const gpu::TexturePointer& texture);
+ void resetTextureOperator(const std::function& textureOperator);
bool isDefined() const;
+ std::function getTextureOperator() const { return _gpuTextureOperator; }
protected:
gpu::TexturePointer _gpuTexture;
+ std::function _gpuTextureOperator { nullptr };
+ mutable bool _locked { false };
QUrl _imageUrl;
int _type { 0 };
};
diff --git a/libraries/graphics/src/graphics/Material.cpp b/libraries/graphics/src/graphics/Material.cpp
index 41cd319595..836487de14 100755
--- a/libraries/graphics/src/graphics/Material.cpp
+++ b/libraries/graphics/src/graphics/Material.cpp
@@ -281,4 +281,33 @@ void MultiMaterial::calculateMaterialInfo() const {
}
_hasCalculatedTextureInfo = allTextures;
}
-}
\ No newline at end of file
+}
+
+void MultiMaterial::resetReferenceTexturesAndMaterials() {
+ _referenceTextures.clear();
+ _referenceMaterials.clear();
+}
+
+void MultiMaterial::addReferenceTexture(const std::function& textureOperator) {
+ _referenceTextures.emplace_back(textureOperator, textureOperator());
+}
+
+void MultiMaterial::addReferenceMaterial(const std::function& materialOperator) {
+ _referenceMaterials.emplace_back(materialOperator, materialOperator());
+}
+
+bool MultiMaterial::anyReferenceMaterialsOrTexturesChanged() const {
+ for (auto textureOperatorPair : _referenceTextures) {
+ if (textureOperatorPair.first() != textureOperatorPair.second) {
+ return true;
+ }
+ }
+
+ for (auto materialOperatorPair : _referenceMaterials) {
+ if (materialOperatorPair.first() != materialOperatorPair.second) {
+ return true;
+ }
+ }
+
+ return false;
+}
diff --git a/libraries/graphics/src/graphics/Material.h b/libraries/graphics/src/graphics/Material.h
index 7a411e5b2c..2eb4e0cbe1 100755
--- a/libraries/graphics/src/graphics/Material.h
+++ b/libraries/graphics/src/graphics/Material.h
@@ -341,57 +341,57 @@ public:
virtual ~Material() = default;
Material& operator= (const Material& material);
- const MaterialKey& getKey() const { return _key; }
+ virtual MaterialKey getKey() const { return _key; }
static const float DEFAULT_EMISSIVE;
void setEmissive(const glm::vec3& emissive, bool isSRGB = true);
- glm::vec3 getEmissive(bool SRGB = true) const { return (SRGB ? ColorUtils::tosRGBVec3(_emissive) : _emissive); }
+ virtual glm::vec3 getEmissive(bool SRGB = true) const { return (SRGB ? ColorUtils::tosRGBVec3(_emissive) : _emissive); }
static const float DEFAULT_OPACITY;
void setOpacity(float opacity);
- float getOpacity() const { return _opacity; }
+ virtual float getOpacity() const { return _opacity; }
static const MaterialKey::OpacityMapMode DEFAULT_OPACITY_MAP_MODE;
void setOpacityMapMode(MaterialKey::OpacityMapMode opacityMapMode);
- MaterialKey::OpacityMapMode getOpacityMapMode() const;
+ virtual MaterialKey::OpacityMapMode getOpacityMapMode() const;
static const float DEFAULT_OPACITY_CUTOFF;
void setOpacityCutoff(float opacityCutoff);
- float getOpacityCutoff() const { return _opacityCutoff; }
+ virtual float getOpacityCutoff() const { return _opacityCutoff; }
static const MaterialKey::CullFaceMode DEFAULT_CULL_FACE_MODE;
void setCullFaceMode(MaterialKey::CullFaceMode cullFaceMode) { _cullFaceMode = cullFaceMode; }
- MaterialKey::CullFaceMode getCullFaceMode() const { return _cullFaceMode; }
+ virtual MaterialKey::CullFaceMode getCullFaceMode() const { return _cullFaceMode; }
void setUnlit(bool value);
- bool isUnlit() const { return _key.isUnlit(); }
+ virtual bool isUnlit() const { return _key.isUnlit(); }
static const float DEFAULT_ALBEDO;
void setAlbedo(const glm::vec3& albedo, bool isSRGB = true);
- glm::vec3 getAlbedo(bool SRGB = true) const { return (SRGB ? ColorUtils::tosRGBVec3(_albedo) : _albedo); }
+ virtual glm::vec3 getAlbedo(bool SRGB = true) const { return (SRGB ? ColorUtils::tosRGBVec3(_albedo) : _albedo); }
static const float DEFAULT_METALLIC;
void setMetallic(float metallic);
- float getMetallic() const { return _metallic; }
+ virtual float getMetallic() const { return _metallic; }
static const float DEFAULT_ROUGHNESS;
void setRoughness(float roughness);
- float getRoughness() const { return _roughness; }
+ virtual float getRoughness() const { return _roughness; }
static const float DEFAULT_SCATTERING;
void setScattering(float scattering);
- float getScattering() const { return _scattering; }
+ virtual float getScattering() const { return _scattering; }
// The texture map to channel association
static const int NUM_TEXCOORD_TRANSFORMS { 2 };
void setTextureMap(MapChannel channel, const TextureMapPointer& textureMap);
- const TextureMaps& getTextureMaps() const { return _textureMaps; } // FIXME - not thread safe...
+ virtual TextureMaps getTextureMaps() const { return _textureMaps; } // FIXME - not thread safe...
const TextureMapPointer getTextureMap(MapChannel channel) const;
// Albedo maps cannot have opacity detected until they are loaded
// This method allows const changing of the key/schemaBuffer without touching the map
// return true if the opacity changed, flase otherwise
- bool resetOpacityMap() const;
+ virtual bool resetOpacityMap() const;
// conversion from legacy material properties to PBR equivalent
static float shininessToRoughness(float shininess) { return 1.0f - shininess / 100.0f; }
@@ -404,12 +404,12 @@ public:
const std::string& getModel() const { return _model; }
void setModel(const std::string& model) { _model = model; }
- glm::mat4 getTexCoordTransform(uint i) const { return _texcoordTransforms[i]; }
+ virtual glm::mat4 getTexCoordTransform(uint i) const { return _texcoordTransforms[i]; }
void setTexCoordTransform(uint i, const glm::mat4& mat4) { _texcoordTransforms[i] = mat4; }
- glm::vec2 getLightmapParams() const { return _lightmapParams; }
- glm::vec2 getMaterialParams() const { return _materialParams; }
+ virtual glm::vec2 getLightmapParams() const { return _lightmapParams; }
+ virtual glm::vec2 getMaterialParams() const { return _materialParams; }
- bool getDefaultFallthrough() const { return _defaultFallthrough; }
+ virtual bool getDefaultFallthrough() const { return _defaultFallthrough; }
void setDefaultFallthrough(bool defaultFallthrough) { _defaultFallthrough = defaultFallthrough; }
enum ExtraFlagBit {
@@ -430,6 +430,8 @@ public:
virtual bool isReady() const { return true; }
virtual QString getProceduralString() const { return QString(); }
+ virtual bool isReference() const { return false; }
+
static const std::string HIFI_PBR;
static const std::string HIFI_SHADER_SIMPLE;
@@ -547,12 +549,16 @@ public:
void setTexturesLoading(bool value) { _texturesLoading = value; }
void setInitialized() { _initialized = true; }
- bool shouldUpdate() const { return !_initialized || _needsUpdate || _texturesLoading; }
+ bool shouldUpdate() const { return !_initialized || _needsUpdate || _texturesLoading || anyReferenceMaterialsOrTexturesChanged(); }
int getTextureCount() const { calculateMaterialInfo(); return _textureCount; }
size_t getTextureSize() const { calculateMaterialInfo(); return _textureSize; }
bool hasTextureInfo() const { return _hasCalculatedTextureInfo; }
+ void resetReferenceTexturesAndMaterials();
+ void addReferenceTexture(const std::function& textureOperator);
+ void addReferenceMaterial(const std::function& materialOperator);
+
private:
gpu::BufferView _schemaBuffer;
graphics::MaterialKey::CullFaceMode _cullFaceMode { graphics::Material::DEFAULT_CULL_FACE_MODE };
@@ -565,6 +571,11 @@ private:
mutable int _textureCount { 0 };
mutable bool _hasCalculatedTextureInfo { false };
void calculateMaterialInfo() const;
+
+ bool anyReferenceMaterialsOrTexturesChanged() const;
+
+ std::vector, gpu::TexturePointer>> _referenceTextures;
+ std::vector, graphics::MaterialPointer>> _referenceMaterials;
};
};
diff --git a/libraries/graphics/src/graphics/TextureMap.cpp b/libraries/graphics/src/graphics/TextureMap.cpp
index e2f24d68ff..0590203907 100755
--- a/libraries/graphics/src/graphics/TextureMap.cpp
+++ b/libraries/graphics/src/graphics/TextureMap.cpp
@@ -18,16 +18,12 @@ void TextureMap::setTextureSource(TextureSourcePointer& textureSource) {
}
bool TextureMap::isDefined() const {
- if (_textureSource) {
- return _textureSource->isDefined();
- } else {
- return false;
- }
+ return _textureSource && _textureSource->isDefined();
}
gpu::TextureView TextureMap::getTextureView() const {
if (_textureSource) {
- return gpu::TextureView(_textureSource->getGPUTexture(), 0);
+ return gpu::TextureView(_textureSource->getGPUTexture(), 0, _textureSource->getTextureOperator());
} else {
return gpu::TextureView();
}
diff --git a/libraries/image/src/image/TextureProcessing.h b/libraries/image/src/image/TextureProcessing.h
index ff81e98a77..7bf249ebda 100644
--- a/libraries/image/src/image/TextureProcessing.h
+++ b/libraries/image/src/image/TextureProcessing.h
@@ -4,6 +4,7 @@
//
// Created by Clement Brisset on 4/5/2017.
// Copyright 2017 High Fidelity, Inc.
+// Copyright 2021 Vircadia contributors.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@@ -23,7 +24,7 @@ namespace image {
std::function getHDRPackingFunction();
std::function getHDRUnpackingFunction();
- void convertToFloatFromPacked(const unsigned char* source, int width, int height, size_t srcLineByteStride, gpu::Element sourceFormat,
+ void convertToFloatFromPacked(const unsigned char* source, int width, int height, size_t srcLineByteStride, gpu::Element sourceFormat,
glm::vec4* output, size_t outputLinePixelStride);
void convertToPackedFromFloat(unsigned char* output, int width, int height, size_t outputLineByteStride, gpu::Element outputFormat,
const glm::vec4* source, size_t srcLinePixelStride);
@@ -32,8 +33,8 @@ namespace TextureUsage {
/*@jsdoc
* Describes the type of texture.
- * See also: {@link Material} and
- * {@link https://docs.vircadia.dev/create/3d-models/pbr-materials-guide.html|PBR Materials Guide}.
+ * See also: {@link Material} and
+ * {@link https://docs.vircadia.com/create/3d-models/pbr-materials-guide.html|PBR Materials Guide}.
*
*
* Value | Name | Description |
@@ -102,7 +103,7 @@ gpu::TexturePointer createCubeTextureFromImage(Image&& image, const std::string&
gpu::TexturePointer createAmbientCubeTextureAndIrradianceFromImage(Image&& image, const std::string& srcImageName,
bool compress, gpu::BackendTarget target, const std::atomic& abortProcessing);
gpu::TexturePointer createLightmapTextureFromImage(Image&& image, const std::string& srcImageName,
- bool compress, gpu::BackendTarget target, const std::atomic& abortProcessing);
+ bool compress, gpu::BackendTarget target, const std::atomic& abortProcessing);
gpu::TexturePointer process2DTextureColorFromImage(Image&& srcImage, const std::string& srcImageName, bool compress,
gpu::BackendTarget target, bool isStrict, const std::atomic& abortProcessing);
gpu::TexturePointer process2DTextureNormalMapFromImage(Image&& srcImage, const std::string& srcImageName, bool compress,
diff --git a/libraries/material-networking/src/material-networking/TextureCache.cpp b/libraries/material-networking/src/material-networking/TextureCache.cpp
index 92e5e0873c..0307e38cc9 100644
--- a/libraries/material-networking/src/material-networking/TextureCache.cpp
+++ b/libraries/material-networking/src/material-networking/TextureCache.cpp
@@ -98,6 +98,8 @@ static const QUrl HMD_PREVIEW_FRAME_URL("resource://hmdPreviewFrame");
static const float SKYBOX_LOAD_PRIORITY { 10.0f }; // Make sure skybox loads first
static const float HIGH_MIPS_LOAD_PRIORITY { 9.0f }; // Make sure high mips loads after skybox but before models
+std::function Texture::_unboundTextureForUUIDOperator { nullptr };
+
TextureCache::TextureCache() {
_ktxCache->initialize();
#if defined(DISABLE_KTX_CACHE)
@@ -252,6 +254,10 @@ NetworkTexturePointer TextureCache::getTexture(const QUrl& url, image::TextureUs
if (url.scheme() == RESOURCE_SCHEME) {
return getResourceTexture(url);
}
+ QString decodedURL = QUrl::fromPercentEncoding(url.toEncoded());
+ if (decodedURL.startsWith("{")) {
+ return getTextureByUUID(decodedURL);
+ }
auto modifiedUrl = url;
if (type == image::TextureUsage::SKY_TEXTURE) {
QUrlQuery query { url.query() };
@@ -385,8 +391,6 @@ NetworkTexture::NetworkTexture(const NetworkTexture& other) :
_type(other._type),
_sourceChannel(other._sourceChannel),
_currentlyLoadingResourceType(other._currentlyLoadingResourceType),
- _originalWidth(other._originalWidth),
- _originalHeight(other._originalHeight),
_width(other._width),
_height(other._height),
_maxNumPixels(other._maxNumPixels),
@@ -462,13 +466,12 @@ void NetworkTexture::setExtra(void* extra) {
void NetworkTexture::setImage(gpu::TexturePointer texture, int originalWidth,
int originalHeight) {
- _originalWidth = originalWidth;
- _originalHeight = originalHeight;
// Passing ownership
_textureSource->resetTexture(texture);
if (texture) {
+ texture->setOriginalSize(originalWidth, originalHeight);
_width = texture->getWidth();
_height = texture->getHeight();
setSize(texture->getStoredSize());
@@ -481,6 +484,12 @@ void NetworkTexture::setImage(gpu::TexturePointer texture, int originalWidth,
emit networkTextureCreated(qWeakPointerCast (_self));
}
+void NetworkTexture::setImageOperator(std::function textureOperator) {
+ _textureSource->resetTextureOperator(textureOperator);
+ finishedLoading((bool)textureOperator);
+ emit networkTextureCreated(qWeakPointerCast (_self));
+}
+
gpu::TexturePointer NetworkTexture::getFallbackTexture() const {
return getFallbackTextureForType(_type);
}
@@ -1312,7 +1321,6 @@ void ImageReader::read() {
}
NetworkTexturePointer TextureCache::getResourceTexture(const QUrl& resourceTextureUrl) {
- gpu::TexturePointer texture;
if (resourceTextureUrl == SPECTATOR_CAMERA_FRAME_URL) {
if (!_spectatorCameraNetworkTexture) {
_spectatorCameraNetworkTexture.reset(new NetworkTexture(resourceTextureUrl, true));
@@ -1329,6 +1337,7 @@ NetworkTexturePointer TextureCache::getResourceTexture(const QUrl& resourceTextu
_hmdPreviewNetworkTexture.reset(new NetworkTexture(resourceTextureUrl, true));
}
if (_hmdPreviewFramebuffer) {
+ gpu::TexturePointer texture;
texture = _hmdPreviewFramebuffer->getRenderBuffer(0);
if (texture) {
texture->setSource(HMD_PREVIEW_FRAME_URL.toString().toStdString());
@@ -1375,3 +1384,27 @@ void TextureCache::updateSpectatorCameraNetworkTexture() {
}
}
}
+
+NetworkTexturePointer TextureCache::getTextureByUUID(const QString& uuid) {
+ QUuid quuid = QUuid(uuid);
+ if (!quuid.isNull()) {
+ // We mark this as a resource texture because it's just a reference to another texture. The source
+ // texture will be marked properly
+ NetworkTexturePointer toReturn = NetworkTexturePointer(new NetworkTexture(uuid, true));
+ toReturn->setImageOperator(Texture::getTextureForUUIDOperator(uuid));
+ return toReturn;
+ }
+ return NetworkTexturePointer();
+}
+
+std::function Texture::getTextureForUUIDOperator(const QUuid& uuid) {
+ if (_unboundTextureForUUIDOperator) {
+ return std::bind(_unboundTextureForUUIDOperator, uuid);
+ }
+ return nullptr;
+}
+
+
+void Texture::setUnboundTextureForUUIDOperator(std::function textureForUUIDOperator) {
+ _unboundTextureForUUIDOperator = textureForUUIDOperator;
+}
diff --git a/libraries/material-networking/src/material-networking/TextureCache.h b/libraries/material-networking/src/material-networking/TextureCache.h
index aab458e184..c0633c2f9b 100644
--- a/libraries/material-networking/src/material-networking/TextureCache.h
+++ b/libraries/material-networking/src/material-networking/TextureCache.h
@@ -39,6 +39,12 @@ class Texture {
public:
gpu::TexturePointer getGPUTexture() const { return _textureSource->getGPUTexture(); }
gpu::TextureSourcePointer _textureSource;
+
+ static std::function getTextureForUUIDOperator(const QUuid& uuid);
+ static void setUnboundTextureForUUIDOperator(std::function textureForUUIDOperator);
+
+private:
+ static std::function _unboundTextureForUUIDOperator;
};
/// A texture loaded from the network.
@@ -52,10 +58,10 @@ public:
QString getType() const override { return "NetworkTexture"; }
- int getOriginalWidth() const { return _originalWidth; }
- int getOriginalHeight() const { return _originalHeight; }
- int getWidth() const { return _width; }
- int getHeight() const { return _height; }
+ int getOriginalWidth() const { return _textureSource->getGPUTexture() ? _textureSource->getGPUTexture()->getOriginalWidth() : 0; }
+ int getOriginalHeight() const { return _textureSource->getGPUTexture() ? _textureSource->getGPUTexture()->getOriginalHeight() : 0; }
+ int getWidth() const { return _textureSource->getGPUTexture() ? _textureSource->getGPUTexture()->getWidth() : 0; }
+ int getHeight() const { return _textureSource->getGPUTexture() ? _textureSource->getGPUTexture()->getHeight() : 0; }
image::TextureUsage::Type getTextureType() const { return _type; }
gpu::TexturePointer getFallbackTexture() const;
@@ -86,6 +92,7 @@ protected:
Q_INVOKABLE void loadTextureContent(const QByteArray& content);
Q_INVOKABLE void setImage(gpu::TexturePointer texture, int originalWidth, int originalHeight);
+ void setImageOperator(std::function textureOperator);
Q_INVOKABLE void startRequestForNextMipLevel();
@@ -136,8 +143,6 @@ private:
// mip offsets to change.
ktx::KTXDescriptorPointer _originalKtxDescriptor;
- int _originalWidth { 0 };
- int _originalHeight { 0 };
int _width { 0 };
int _height { 0 };
int _maxNumPixels { ABSOLUTE_MAX_TEXTURE_NUM_PIXELS };
@@ -192,6 +197,8 @@ public:
const gpu::FramebufferPointer& getSpectatorCameraFramebuffer(int width, int height);
void updateSpectatorCameraNetworkTexture();
+ NetworkTexturePointer getTextureByUUID(const QString& uuid);
+
static const int DEFAULT_SPECTATOR_CAM_WIDTH { 2048 };
static const int DEFAULT_SPECTATOR_CAM_HEIGHT { 1024 };
diff --git a/libraries/midi/src/Midi.h b/libraries/midi/src/Midi.h
index c81aa4f04b..aca573f5ce 100644
--- a/libraries/midi/src/Midi.h
+++ b/libraries/midi/src/Midi.h
@@ -5,6 +5,7 @@
// Created by Burt Sloane
// Modified by Bruce Brown
// Copyright 2015 High Fidelity, Inc.
+// Copyright 2021 Vircadia contributors.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@@ -21,9 +22,9 @@
#include
/*@jsdoc
- * The Midi
API provides the ability to connect Interface with musical instruments and other external or virtual
- * devices via the MIDI protocol. For further information and examples, see the tutorial:
- * Use MIDI to Control Your Environment.
+ * The Midi
API provides the ability to connect Interface with musical instruments and other external or virtual
+ * devices via the MIDI protocol. For further information and examples, see the tutorial:
+ * Use MIDI to Control Your Environment.
*
* Note: Only works on Windows.
*
@@ -43,7 +44,7 @@ public:
void midiHardwareChange(); // relay hardware change to Javascript
void sendRawMessage(int device, int raw); // relay midi message to MIDI outputs
void sendNote(int status, int note, int velocity); // relay a note to MIDI outputs
- void sendMessage(int device, int channel, int type, int note, int velocity); // relay a message to MIDI outputs
+ void sendMessage(int device, int channel, int type, int note, int velocity); // relay a message to MIDI outputs
static void USBchanged();
private:
@@ -150,7 +151,7 @@ public slots:
/*@jsdoc
* Enables or disables repeating all incoming notes to all outputs. (Default is disabled.)
* @function Midi.thruModeEnable
- * @param {boolean} enable - true
to enable repeating all incoming notes to all output, false
to
+ * @param {boolean} enable - true
to enable repeating all incoming notes to all output, false
to
* disable.
*/
Q_INVOKABLE void thruModeEnable(bool enable);
@@ -159,11 +160,11 @@ public slots:
/*@jsdoc
* Enables or disables broadcasts to all unblocked devices.
* @function Midi.broadcastEnable
- * @param {boolean} enable - true
to have "send" functions broadcast to all devices, false
to
+ * @param {boolean} enable - true
to have "send" functions broadcast to all devices, false
to
* have them send to specific output devices.
*/
Q_INVOKABLE void broadcastEnable(bool enable);
-
+
/// filter by event types
diff --git a/libraries/networking/src/AddressManager.cpp b/libraries/networking/src/AddressManager.cpp
index f0fa1365c4..96d72cabaf 100644
--- a/libraries/networking/src/AddressManager.cpp
+++ b/libraries/networking/src/AddressManager.cpp
@@ -39,7 +39,7 @@ const QString SETTINGS_CURRENT_ADDRESS_KEY = "address";
const QString DEFAULT_VIRCADIA_ADDRESS = (!BuildInfo::PRELOADED_STARTUP_LOCATION.isEmpty())
? BuildInfo::PRELOADED_STARTUP_LOCATION
: NetworkingConstants::DEFAULT_VIRCADIA_ADDRESS;
-const QString DEFAULT_HOME_ADDRESS = (!BuildInfo::PRELOADED_STARTUP_LOCATION.isEmpty())
+const QString DEFAULT_HOME_ADDRESS = (!BuildInfo::PRELOADED_STARTUP_LOCATION.isEmpty())
? BuildInfo::PRELOADED_STARTUP_LOCATION
: NetworkingConstants::DEFAULT_VIRCADIA_ADDRESS;
@@ -56,7 +56,7 @@ QString AddressManager::getProtocol() const {
QUrl AddressManager::currentAddress(bool domainOnly) const {
QUrl hifiURL = _domainURL;
- if (!domainOnly && hifiURL.scheme() == URL_SCHEME_HIFI) {
+ if (!domainOnly && hifiURL.scheme() == URL_SCHEME_VIRCADIA) {
hifiURL.setPath(currentPath());
}
@@ -65,7 +65,7 @@ QUrl AddressManager::currentAddress(bool domainOnly) const {
QUrl AddressManager::currentFacingAddress() const {
auto hifiURL = currentAddress();
- if (hifiURL.scheme() == URL_SCHEME_HIFI) {
+ if (hifiURL.scheme() == URL_SCHEME_VIRCADIA) {
hifiURL.setPath(currentFacingPath());
}
@@ -77,7 +77,7 @@ QUrl AddressManager::currentShareableAddress(bool domainOnly) const {
// if we have a shareable place name use that instead of whatever the current host is
QUrl hifiURL;
- hifiURL.setScheme(URL_SCHEME_HIFI);
+ hifiURL.setScheme(URL_SCHEME_VIRCADIA);
hifiURL.setHost(_shareablePlaceName);
if (!domainOnly) {
@@ -94,7 +94,7 @@ QUrl AddressManager::currentPublicAddress(bool domainOnly) const {
// return an address that can be used by others to visit this client's current location. If
// in a serverless domain (which can't be visited) return an empty URL.
QUrl shareableAddress = currentShareableAddress(domainOnly);
- if (shareableAddress.scheme() != URL_SCHEME_HIFI) {
+ if (shareableAddress.scheme() != URL_SCHEME_VIRCADIA) {
return QUrl(); // file: urls aren't public
}
return shareableAddress;
@@ -103,7 +103,7 @@ QUrl AddressManager::currentPublicAddress(bool domainOnly) const {
QUrl AddressManager::currentFacingShareableAddress() const {
auto hifiURL = currentShareableAddress();
- if (hifiURL.scheme() == URL_SCHEME_HIFI) {
+ if (hifiURL.scheme() == URL_SCHEME_VIRCADIA) {
hifiURL.setPath(currentFacingPath());
}
@@ -114,7 +114,7 @@ QUrl AddressManager::currentFacingPublicAddress() const {
// return an address that can be used by others to visit this client's current location. If
// in a serverless domain (which can't be visited) return an empty URL.
QUrl shareableAddress = currentFacingShareableAddress();
- if (shareableAddress.scheme() != URL_SCHEME_HIFI) {
+ if (shareableAddress.scheme() != URL_SCHEME_VIRCADIA) {
return QUrl(); // file: urls aren't public
}
return shareableAddress;
@@ -165,7 +165,7 @@ void AddressManager::storeCurrentAddress() {
if (url.scheme() == HIFI_URL_SCHEME_FILE ||
url.scheme() == HIFI_URL_SCHEME_HTTP || url.scheme() == HIFI_URL_SCHEME_HTTPS ||
- (url.scheme() == URL_SCHEME_HIFI && !url.host().isEmpty())) {
+ (url.scheme() == URL_SCHEME_VIRCADIA && !url.host().isEmpty())) {
// TODO -- once Octree::readFromURL no-longer takes over the main event-loop, serverless-domain urls can
// be loaded over http(s)
// url.scheme() == HIFI_URL_SCHEME_HTTP ||
@@ -242,7 +242,7 @@ const JSONCallbackParameters& AddressManager::apiCallbackParameters() {
return callbackParams;
}
-bool AddressManager::handleUrl(const QUrl& lookupUrlIn, LookupTrigger trigger) {
+bool AddressManager::handleUrl(const QUrl& lookupUrlIn, LookupTrigger trigger, const QString& lookupUrlInString) {
static QString URL_TYPE_USER = "user";
static QString URL_TYPE_DOMAIN_ID = "domain_id";
static QString URL_TYPE_PLACE = "place";
@@ -258,24 +258,32 @@ bool AddressManager::handleUrl(const QUrl& lookupUrlIn, LookupTrigger trigger) {
if (lookupUrl.scheme().isEmpty() && !lookupUrl.path().startsWith("/")) {
// 'urls' without schemes are taken as domain names, as opposed to
// simply a path portion of a url, so we need to set the scheme
- lookupUrl.setScheme(URL_SCHEME_HIFI);
+ lookupUrl.setScheme(URL_SCHEME_VIRCADIA);
}
static const QRegExp PORT_REGEX = QRegExp("\\d{1,5}(\\/.*)?");
if(!lookupUrl.scheme().isEmpty() && lookupUrl.host().isEmpty() && PORT_REGEX.exactMatch(lookupUrl.path())) {
// this is in the form somewhere:, convert it to hifi://somewhere:
- lookupUrl = QUrl(URL_SCHEME_HIFI + "://" + lookupUrl.toString());
+ lookupUrl = QUrl(URL_SCHEME_VIRCADIA + "://" + lookupUrl.toString());
}
// it should be noted that url's in the form
// somewhere: are not valid, as that
// would indicate that the scheme is 'somewhere'
// use hifi://somewhere: instead
- if (lookupUrl.scheme() == URL_SCHEME_HIFI) {
+ if (lookupUrl.scheme() == URL_SCHEME_VIRCADIA || lookupUrlInString.startsWith(URL_SCHEME_VIRCADIA + "://")) {
+ QString lookupUrlString;
+
+ if (lookupUrlInString.startsWith(URL_SCHEME_VIRCADIA + "://")) {
+ lookupUrlString = lookupUrlInString;
+ } else {
+ lookupUrlString = lookupUrl.toString(QUrl::FullyEncoded);
+ }
+
if (lookupUrl.host().isEmpty()) {
// this was in the form hifi:/somewhere or hifi:somewhere. Fix it by making it hifi://somewhere
- static const QRegExp HIFI_SCHEME_REGEX = QRegExp(URL_SCHEME_HIFI + ":\\/{0,2}", Qt::CaseInsensitive);
- lookupUrl = QUrl(lookupUrl.toString().replace(HIFI_SCHEME_REGEX, URL_SCHEME_HIFI + "://"));
+ static const QRegExp HIFI_SCHEME_REGEX = QRegExp(URL_SCHEME_VIRCADIA + ":\\/{0,2}", Qt::CaseInsensitive);
+ lookupUrl = QUrl(lookupUrl.toString().replace(HIFI_SCHEME_REGEX, URL_SCHEME_VIRCADIA + "://"));
}
DependencyManager::get()->flagTimeForConnectionStep(LimitedNodeList::ConnectionStep::LookupAddress);
@@ -340,6 +348,8 @@ bool AddressManager::handleUrl(const QUrl& lookupUrlIn, LookupTrigger trigger) {
// try to look up the domain ID on the metaverse API
attemptDomainIDLookup(lookupUrl.host(), lookupUrl.path(), trigger);
} else {
+ // wasn't an address - lookup the place name
+ // we may have a path that defines a relative viewpoint - pass that through the lookup so we can go to it after
UserActivityLogger::getInstance().wentTo(trigger, URL_TYPE_PLACE, lookupUrl.toString());
// save the last visited domain URL.
@@ -348,10 +358,26 @@ bool AddressManager::handleUrl(const QUrl& lookupUrlIn, LookupTrigger trigger) {
// store this place name as the previous lookup in case we fail to connect and want to refresh API info
_previousAPILookup = lookupUrl;
- // wasn't an address - lookup the place name
- // we may have a path that defines a relative viewpoint - pass that through the lookup so we can go to it after
- if (!lookupUrl.host().isNull() && !lookupUrl.host().isEmpty()) {
- attemptPlaceNameLookup(lookupUrl.host(), lookupUrl.path(), trigger);
+ // Let's convert this to a QString for processing in case there are spaces in it.
+ if (lookupUrlString.contains(URL_SCHEME_VIRCADIA + "://", Qt::CaseInsensitive)) {
+ lookupUrlString = lookupUrlString.replace((URL_SCHEME_VIRCADIA + "://"), "");
+ } else if (lookupUrlString.contains(URL_SCHEME_VIRCADIA + ":/", Qt::CaseInsensitive)) {
+ lookupUrlString = lookupUrlString.replace((URL_SCHEME_VIRCADIA + ":/"), "");
+ } else if (lookupUrlString.contains(URL_SCHEME_VIRCADIA + ":", Qt::CaseInsensitive)) {
+ lookupUrlString = lookupUrlString.replace((URL_SCHEME_VIRCADIA + ":"), "");
+ }
+
+ // Get the path and then strip it out.
+ QString lookupUrlStringPath;
+
+ int index = lookupUrlString.indexOf('/');
+ if (index != -1) {
+ lookupUrlStringPath = lookupUrlString.mid(index);
+ lookupUrlString.replace(lookupUrlStringPath, "");
+ }
+
+ if (!lookupUrlString.isEmpty()) {
+ attemptPlaceNameLookup(lookupUrlString, lookupUrlStringPath, trigger);
}
}
}
@@ -371,7 +397,7 @@ bool AddressManager::handleUrl(const QUrl& lookupUrlIn, LookupTrigger trigger) {
return true;
} else if (lookupUrl.scheme() == HIFI_URL_SCHEME_FILE || lookupUrl.scheme() == HIFI_URL_SCHEME_HTTPS
|| lookupUrl.scheme() == HIFI_URL_SCHEME_HTTP) {
-
+
// Save the last visited domain URL.
_lastVisitedURL = lookupUrl;
@@ -412,13 +438,13 @@ bool isPossiblePlaceName(QString possiblePlaceName) {
}
void AddressManager::handleLookupString(const QString& lookupString, bool fromSuggestions) {
+ QString trimmedString = lookupString.trimmed();
- QString sanitizedString = lookupString.trimmed();
- if (!sanitizedString.isEmpty()) {
+ if (!trimmedString.isEmpty()) {
resetConfirmConnectWithoutAvatarEntities();
// make this a valid hifi URL and handle it off to handleUrl
- handleUrl(sanitizedString, fromSuggestions ? Suggestions : UserInput);
+ handleUrl(trimmedString, fromSuggestions ? Suggestions : UserInput, trimmedString);
}
}
@@ -494,7 +520,7 @@ void AddressManager::goToAddressFromObject(const QVariantMap& dataObject, const
qCDebug(networking) << "Possible domain change required to connect to" << domainHostname
<< "on" << domainPort;
QUrl domainURL;
- domainURL.setScheme(URL_SCHEME_HIFI);
+ domainURL.setScheme(URL_SCHEME_VIRCADIA);
domainURL.setHost(domainHostname);
if (domainPort > 0) {
domainURL.setPort(domainPort);
@@ -606,8 +632,6 @@ void AddressManager::handleAPIError(QNetworkReply* errorReply) {
void AddressManager::attemptPlaceNameLookup(const QString& lookupString, const QString& overridePath, LookupTrigger trigger) {
// assume this is a place name and see if we can get any info on it
- QString placeName = QUrl::toPercentEncoding(lookupString);
-
QVariantMap requestParams;
// if the user asked for a specific path with this lookup then keep it with the request so we can use it later
@@ -618,7 +642,7 @@ void AddressManager::attemptPlaceNameLookup(const QString& lookupString, const Q
// remember how this lookup was triggered for history storage handling later
requestParams.insert(LOOKUP_TRIGGER_KEY, static_cast(trigger));
- DependencyManager::get()->sendRequest(GET_PLACE.arg(placeName),
+ DependencyManager::get()->sendRequest(GET_PLACE.arg(lookupString),
AccountManagerAuth::None,
QNetworkAccessManager::GetOperation,
apiCallbackParameters(),
@@ -667,7 +691,7 @@ bool AddressManager::handleNetworkAddress(const QString& lookupString, LookupTri
emit lookupResultsFinished();
QUrl domainURL;
- domainURL.setScheme(URL_SCHEME_HIFI);
+ domainURL.setScheme(URL_SCHEME_VIRCADIA);
domainURL.setHost(domainIPString);
if (domainPort > 0) {
domainURL.setPort(domainPort);
@@ -690,7 +714,7 @@ bool AddressManager::handleNetworkAddress(const QString& lookupString, LookupTri
emit lookupResultsFinished();
QUrl domainURL;
- domainURL.setScheme(URL_SCHEME_HIFI);
+ domainURL.setScheme(URL_SCHEME_VIRCADIA);
domainURL.setHost(domainHostname);
if (domainPort > 0) {
domainURL.setPort(domainPort);
@@ -823,7 +847,7 @@ bool AddressManager::setHost(const QString& host, LookupTrigger trigger, quint16
addCurrentAddressToHistory(trigger);
_domainURL = QUrl();
- _domainURL.setScheme(URL_SCHEME_HIFI);
+ _domainURL.setScheme(URL_SCHEME_VIRCADIA);
_domainURL.setHost(host);
if (port > 0) {
_domainURL.setPort(port);
@@ -860,7 +884,7 @@ bool AddressManager::setDomainInfo(const QUrl& domainURL, LookupTrigger trigger)
// clear any current place information
_rootPlaceID = QUuid();
- if (_domainURL.scheme() == URL_SCHEME_HIFI) {
+ if (_domainURL.scheme() == URL_SCHEME_VIRCADIA) {
qCDebug(networking) << "Possible domain change required to connect to domain at" << hostname << "on" << port;
} else {
qCDebug(networking) << "Possible domain change required to serverless domain: " << domainURL.toString();
diff --git a/libraries/networking/src/AddressManager.h b/libraries/networking/src/AddressManager.h
index e8793edc1d..0a8f4591ad 100644
--- a/libraries/networking/src/AddressManager.h
+++ b/libraries/networking/src/AddressManager.h
@@ -4,6 +4,7 @@
//
// Created by Stephen Birarda on 2014-09-10.
// Copyright 2014 High Fidelity, Inc.
+// Copyright 2021 Vircadia contributors.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@@ -35,7 +36,7 @@ const QString GET_PLACE = "/api/v1/places/%1";
* The location
API provides facilities related to your current location in the metaverse.
*
* Getter/Setter
- * You can get and set your current metaverse address by directly reading a string value from and writing a string value to
+ *
You can get and set your current metaverse address by directly reading a string value from and writing a string value to
* the location
object. This is an alternative to using the location.href
property or other object
* functions.
*
@@ -53,12 +54,12 @@ const QString GET_PLACE = "/api/v1/places/%1";
* localhost
, or an IP address). Is blank if you're in a serverless domain.
* Read-only.
* @property {string} href - Your current metaverse address (e.g., "hifi://domainname/15,-10,26/0,0,0,1"
)
- * regardless of whether or not you're connected to the domain. Starts with "file:///"
if you're in a
+ * regardless of whether or not you're connected to the domain. Starts with "file:///"
if you're in a
* serverless domain.
* Read-only.
* @property {boolean} isConnected - true
if you're connected to the domain in your current href
* metaverse address, otherwise false
.
- * @property {string} pathname - The location and orientation in your current href
metaverse address
+ * @property {string} pathname - The location and orientation in your current href
metaverse address
* (e.g., "/15,-10,26/0,0,0,1"
).
* Read-only.
* @property {string} placename - The place name in your current href
metaverse address
@@ -77,7 +78,7 @@ const QString GET_PLACE = "/api/v1/places/%1";
* @hifi-client-entity
* @hifi-avatar
*
- * @deprecated This API is deprecated and will be removed. Use the {@link location} or {@link Window|Window.location} APIs
+ * @deprecated This API is deprecated and will be removed. Use the {@link location} or {@link Window|Window.location} APIs
* instead.
*
* @property {Uuid} domainID - A UUID uniquely identifying the domain you're visiting. Is {@link Uuid(0)|Uuid.NULL} if you're not
@@ -248,17 +249,17 @@ public slots:
/*@jsdoc
* Takes you to a specified metaverse address.
* @function location.handleLookupString
- * @param {string} address - The address to go to: a "hifi://"
address, an IP address (e.g.,
- * "127.0.0.1"
or "localhost"
), a file:///
address, a domain name, a named path
- * on a domain (starts with "/"
), a position or position and orientation, or a user (starts with
+ * @param {string} address - The address to go to: a "hifi://"
address, an IP address (e.g.,
+ * "127.0.0.1"
or "localhost"
), a file:///
address, a domain name, a named path
+ * on a domain (starts with "/"
), a position or position and orientation, or a user (starts with
* "@"
).
- * @param {boolean} [fromSuggestions=false] - Set to true
if the address is obtained from the "Goto" dialog.
- * Helps ensure that user's location history is correctly maintained.
+ * @param {boolean} [fromSuggestions=false] - Set to true
if the address is obtained from the "Explore" app.
+ * Helps ensure that the user's location history is correctly maintained.
*/
void handleLookupString(const QString& lookupString, bool fromSuggestions = false);
/*@jsdoc
- * Takes you to a position and orientation resulting from a lookup for a named path in the domain (set in the domain
+ * Takes you to a position and orientation resulting from a lookup for a named path in the domain (set in the domain
* server's settings).
* @function location.goToViewpointForPath
* @param {string} path - The position and orientation corresponding to the named path.
@@ -292,7 +293,7 @@ public slots:
* location history is correctly maintained.
*/
void goToLocalSandbox(QString path = "", LookupTrigger trigger = LookupTrigger::StartupFromSettings) {
- handleUrl(SANDBOX_HIFI_ADDRESS + path, trigger);
+ handleUrl(SANDBOX_HIFI_ADDRESS + path, trigger);
}
/*@jsdoc
@@ -307,7 +308,7 @@ public slots:
* Takes you to the specified user's location.
* @function location.goToUser
* @param {string} username - The user's username.
- * @param {boolean} [matchOrientation=true] - If true
then go to a location just in front of the user and turn
+ * @param {boolean} [matchOrientation=true] - If true
then go to a location just in front of the user and turn
* to face them, otherwise go to the user's exact location and orientation.
*/
void goToUser(const QString& username, bool shouldMatchOrientation = true);
@@ -348,7 +349,7 @@ public slots:
void copyAddress();
/*@jsdoc
- * Copies your current metaverse location and orientation (i.e., location.pathname
property value) to the OS
+ * Copies your current metaverse location and orientation (i.e., location.pathname
property value) to the OS
* clipboard.
* @function location.copyPath
*/
@@ -374,7 +375,7 @@ signals:
void lookupResultsFinished();
/*@jsdoc
- * Triggered when looking up the details of a metaverse user or location to go to has completed and the domain or user is
+ * Triggered when looking up the details of a metaverse user or location to go to has completed and the domain or user is
* offline.
* @function location.lookupResultIsOffline
* @returns {Signal}
@@ -390,10 +391,10 @@ signals:
void lookupResultIsNotFound();
/*@jsdoc
- * Triggered when a request is made to go to an IP address.
+ * Triggered when a request is made to go to a URL or IP address.
* @function location.possibleDomainChangeRequired
- * @param {Url} domainURL - URL for domain
- * @param {Uuid} domainID - The UUID of the domain to go to.
+ * @param {string} domainURL - The URL of the domain.
+ * @param {Uuid} domainID - The UUID of the domain to go to. May be {@link Uuid|Uuid.NULL} if not yet known.
* @returns {Signal}
*/
// No example because this function isn't typically used in scripts.
@@ -415,9 +416,9 @@ signals:
* @function location.locationChangeRequired
* @param {Vec3} position - The position to go to.
* @param {boolean} hasOrientationChange - If true
then a new orientation
has been requested.
- * @param {Quat} orientation - The orientation to change to. Is {@link Quat(0)|Quat.IDENTITY} if
+ * @param {Quat} orientation - The orientation to change to. Is {@link Quat(0)|Quat.IDENTITY} if
* hasOrientationChange
is false
.
- * @param {boolean} shouldFaceLocation - If true
then the request is to go to a position near that specified
+ * @param {boolean} shouldFaceLocation - If true
then the request is to go to a position near that specified
* and orient your avatar to face it. For example when you visit someone from the "People" dialog.
* @returns {Signal}
* @example Report location change requests.
@@ -468,7 +469,7 @@ signals:
* Triggered when there's a change in whether or not there's a previous location that can be navigated to using
* {@link location.goBack|goBack}. (Reflects changes in the state of the "Goto" dialog's back arrow.)
* @function location.goBackPossible
- * @param {boolean} isPossible - true
if there's a previous location to navigate to, otherwise
+ * @param {boolean} isPossible - true
if there's a previous location to navigate to, otherwise
* false
.
* @returns {Signal}
* @example Report when ability to navigate back changes.
@@ -511,7 +512,7 @@ private:
const JSONCallbackParameters& apiCallbackParameters();
- bool handleUrl(const QUrl& lookupUrl, LookupTrigger trigger = UserInput);
+ bool handleUrl(const QUrl& lookupUrl, LookupTrigger trigger = UserInput, const QString& lookupUrlInString = "");
bool handleNetworkAddress(const QString& lookupString, LookupTrigger trigger, bool& hostChanged);
void handlePath(const QString& path, LookupTrigger trigger, bool wasPathOnly = false);
diff --git a/libraries/networking/src/DomainHandler.cpp b/libraries/networking/src/DomainHandler.cpp
index 5a1d8fb4a0..4ba5565a74 100644
--- a/libraries/networking/src/DomainHandler.cpp
+++ b/libraries/networking/src/DomainHandler.cpp
@@ -26,7 +26,7 @@
#include "AddressManager.h"
#include "Assignment.h"
#include "DomainAccountManager.h"
-#include "HifiSockAddr.h"
+#include "SockAddr.h"
#include "NodeList.h"
#include "udt/Packet.h"
#include "udt/PacketHeaders.h"
@@ -37,7 +37,7 @@
DomainHandler::DomainHandler(QObject* parent) :
QObject(parent),
- _sockAddr(HifiSockAddr(QHostAddress::Null, DEFAULT_DOMAIN_SERVER_PORT)),
+ _sockAddr(SockAddr(QHostAddress::Null, DEFAULT_DOMAIN_SERVER_PORT)),
_icePeer(this),
_settingsTimer(this),
_apiRefreshTimer(this)
@@ -133,7 +133,7 @@ void DomainHandler::hardReset(QString reason) {
qCDebug(networking) << "Hard reset in NodeList DomainHandler.";
_pendingDomainID = QUuid();
- _iceServerSockAddr = HifiSockAddr();
+ _iceServerSockAddr = SockAddr();
_sockAddr.clear();
_domainURL = QUrl();
@@ -170,7 +170,7 @@ void DomainHandler::setErrorDomainURL(const QUrl& url) {
return;
}
-void DomainHandler::setSockAddr(const HifiSockAddr& sockAddr, const QString& hostname) {
+void DomainHandler::setSockAddr(const SockAddr& sockAddr, const QString& hostname) {
if (_sockAddr != sockAddr) {
// we should reset on a sockAddr change
hardReset("Changing domain sockAddr");
@@ -184,7 +184,7 @@ void DomainHandler::setSockAddr(const HifiSockAddr& sockAddr, const QString& hos
// some callers may pass a hostname, this is not to be used for lookup but for DTLS certificate verification
_domainURL = QUrl();
- _domainURL.setScheme(URL_SCHEME_HIFI);
+ _domainURL.setScheme(URL_SCHEME_VIRCADIA);
_domainURL.setHost(hostname);
_domainURL.setPort(_sockAddr.getPort());
}
@@ -199,7 +199,7 @@ void DomainHandler::setUUID(const QUuid& uuid) {
void DomainHandler::setURLAndID(QUrl domainURL, QUuid domainID) {
_pendingDomainID = domainID;
- if (domainURL.scheme() != URL_SCHEME_HIFI) {
+ if (domainURL.scheme() != URL_SCHEME_VIRCADIA) {
_sockAddr.clear();
// if this is a file URL we need to see if it has a ~ for us to expand
@@ -215,7 +215,7 @@ void DomainHandler::setURLAndID(QUrl domainURL, QUuid domainID) {
// if it's in the error state, reset and try again.
if (_domainURL != domainURL
- || (_sockAddr.getPort() != domainPort && domainURL.scheme() == URL_SCHEME_HIFI)
+ || (_sockAddr.getPort() != domainPort && domainURL.scheme() == URL_SCHEME_VIRCADIA)
|| isServerless() // For reloading content in serverless domain.
|| _isInErrorState) {
// re-set the domain info so that auth information is reloaded
@@ -230,7 +230,7 @@ void DomainHandler::setURLAndID(QUrl domainURL, QUuid domainID) {
qCDebug(networking) << "Updated domain hostname to" << domainURL.host();
if (!domainURL.host().isEmpty()) {
- if (domainURL.scheme() == URL_SCHEME_HIFI) {
+ if (domainURL.scheme() == URL_SCHEME_VIRCADIA) {
// re-set the sock addr to null and fire off a lookup of the IP address for this domain-server's hostname
qCDebug(networking, "Looking up DS hostname %s.", domainURL.host().toLocal8Bit().constData());
QHostInfo::lookupHost(domainURL.host(), this, SLOT(completedHostnameLookup(const QHostInfo&)));
@@ -280,9 +280,9 @@ void DomainHandler::setIceServerHostnameAndID(const QString& iceServerHostname,
_pendingDomainID = id;
- HifiSockAddr* replaceableSockAddr = &_iceServerSockAddr;
- replaceableSockAddr->~HifiSockAddr();
- replaceableSockAddr = new (replaceableSockAddr) HifiSockAddr(iceServerHostname, ICE_SERVER_DEFAULT_PORT);
+ SockAddr* replaceableSockAddr = &_iceServerSockAddr;
+ replaceableSockAddr->~SockAddr();
+ replaceableSockAddr = new (replaceableSockAddr) SockAddr(iceServerHostname, ICE_SERVER_DEFAULT_PORT);
_iceServerSockAddr.setObjectName("IceServer");
auto nodeList = DependencyManager::get();
@@ -291,7 +291,7 @@ void DomainHandler::setIceServerHostnameAndID(const QString& iceServerHostname,
if (_iceServerSockAddr.getAddress().isNull()) {
// connect to lookup completed for ice-server socket so we can request a heartbeat once hostname is looked up
- connect(&_iceServerSockAddr, &HifiSockAddr::lookupCompleted, this, &DomainHandler::completedIceServerHostnameLookup);
+ connect(&_iceServerSockAddr, &SockAddr::lookupCompleted, this, &DomainHandler::completedIceServerHostnameLookup);
} else {
completedIceServerHostnameLookup();
}
@@ -303,7 +303,7 @@ void DomainHandler::setIceServerHostnameAndID(const QString& iceServerHostname,
void DomainHandler::activateICELocalSocket() {
DependencyManager::get()->flagTimeForConnectionStep(LimitedNodeList::ConnectionStep::SetDomainSocket);
_sockAddr = _icePeer.getLocalSocket();
- _domainURL.setScheme(URL_SCHEME_HIFI);
+ _domainURL.setScheme(URL_SCHEME_VIRCADIA);
_domainURL.setHost(_sockAddr.getAddress().toString());
emit domainURLChanged(_domainURL);
emit completedSocketDiscovery();
@@ -312,7 +312,7 @@ void DomainHandler::activateICELocalSocket() {
void DomainHandler::activateICEPublicSocket() {
DependencyManager::get()->flagTimeForConnectionStep(LimitedNodeList::ConnectionStep::SetDomainSocket);
_sockAddr = _icePeer.getPublicSocket();
- _domainURL.setScheme(URL_SCHEME_HIFI);
+ _domainURL.setScheme(URL_SCHEME_VIRCADIA);
_domainURL.setHost(_sockAddr.getAddress().toString());
emit domainURLChanged(_domainURL);
emit completedSocketDiscovery();
@@ -369,7 +369,7 @@ void DomainHandler::setIsConnected(bool isConnected) {
// FIXME: Reinstate the requestDomainSettings() call here in version 2021.2.0 instead of having it in
// NodeList::processDomainServerList().
/*
- if (_domainURL.scheme() == URL_SCHEME_HIFI && !_domainURL.host().isEmpty()) {
+ if (_domainURL.scheme() == URL_SCHEME_VIRCADIA && !_domainURL.host().isEmpty()) {
// we've connected to new domain - time to ask it for global settings
requestDomainSettings();
}
@@ -458,7 +458,7 @@ void DomainHandler::processSettingsPacketList(QSharedPointer pa
}
void DomainHandler::processICEPingReplyPacket(QSharedPointer message) {
- const HifiSockAddr& senderSockAddr = message->getSenderSockAddr();
+ const SockAddr& senderSockAddr = message->getSenderSockAddr();
qCDebug(networking_ice) << "Received reply from domain-server on" << senderSockAddr;
if (getIP().isNull()) {
diff --git a/libraries/networking/src/DomainHandler.h b/libraries/networking/src/DomainHandler.h
index a56d3162bd..7553168b09 100644
--- a/libraries/networking/src/DomainHandler.h
+++ b/libraries/networking/src/DomainHandler.h
@@ -25,7 +25,7 @@
#include
#include
-#include "HifiSockAddr.h"
+#include "SockAddr.h"
#include "NetworkPeer.h"
#include "NLPacket.h"
#include "NLPacketList.h"
@@ -109,8 +109,8 @@ public:
const QHostAddress& getIP() const { return _sockAddr.getAddress(); }
void setIPToLocalhost() { _sockAddr.setAddress(QHostAddress(QHostAddress::LocalHost)); }
- const HifiSockAddr& getSockAddr() const { return _sockAddr; }
- void setSockAddr(const HifiSockAddr& sockAddr, const QString& hostname);
+ const SockAddr& getSockAddr() const { return _sockAddr; }
+ void setSockAddr(const SockAddr& sockAddr, const QString& hostname);
unsigned short getPort() const { return _sockAddr.getPort(); }
void setPort(quint16 port) { _sockAddr.setPort(port); }
@@ -126,7 +126,7 @@ public:
const QUuid& getICEClientID() const { return _iceClientID; }
bool requiresICE() const { return !_iceServerSockAddr.isNull(); }
- const HifiSockAddr& getICEServerSockAddr() const { return _iceServerSockAddr; }
+ const SockAddr& getICEServerSockAddr() const { return _iceServerSockAddr; }
NetworkPeer& getICEPeer() { return _icePeer; }
void activateICELocalSocket();
void activateICEPublicSocket();
@@ -137,7 +137,7 @@ public:
void setCanConnectWithoutAvatarEntities(bool canConnect);
bool canConnectWithoutAvatarEntities();
- bool isServerless() const { return _domainURL.scheme() != URL_SCHEME_HIFI; }
+ bool isServerless() const { return _domainURL.scheme() != URL_SCHEME_VIRCADIA; }
bool getInterstitialModeEnabled() const;
void setInterstitialModeEnabled(bool enableInterstitialMode);
@@ -288,12 +288,12 @@ private:
Node::LocalID _localID;
QUrl _domainURL;
QUrl _errorDomainURL;
- HifiSockAddr _sockAddr;
+ SockAddr _sockAddr;
QUuid _assignmentUUID;
QUuid _connectionToken;
QUuid _pendingDomainID; // ID of domain being connected to, via ICE or direct connection
QUuid _iceClientID;
- HifiSockAddr _iceServerSockAddr;
+ SockAddr _iceServerSockAddr;
NetworkPeer _icePeer;
bool _isConnected { false };
bool _haveAskedConnectWithoutAvatarEntities { false };
diff --git a/libraries/networking/src/LimitedNodeList.cpp b/libraries/networking/src/LimitedNodeList.cpp
index 653611ae8c..65e391d467 100644
--- a/libraries/networking/src/LimitedNodeList.cpp
+++ b/libraries/networking/src/LimitedNodeList.cpp
@@ -4,6 +4,7 @@
//
// Created by Stephen Birarda on 2/15/13.
// Copyright 2013 High Fidelity, Inc.
+// Copyright 2021 Vircadia contributors.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@@ -33,7 +34,7 @@
#include "AccountManager.h"
#include "AssetClient.h"
#include "Assignment.h"
-#include "HifiSockAddr.h"
+#include "SockAddr.h"
#include "NetworkLogging.h"
#include "udt/Packet.h"
#include "HMACAuth.h"
@@ -103,7 +104,7 @@ LimitedNodeList::LimitedNodeList(int socketListenPort, int dtlsListenPort) :
_nodeSocket.setMessageHandler([this](std::unique_ptr packet) {
_packetReceiver->handleVerifiedMessagePacket(std::move(packet));
});
- _nodeSocket.setMessageFailureHandler([this](HifiSockAddr from,
+ _nodeSocket.setMessageFailureHandler([this](SockAddr from,
udt::Packet::MessageNumber messageNumber) {
_packetReceiver->handleMessageFailure(from, messageNumber);
});
@@ -120,7 +121,7 @@ LimitedNodeList::LimitedNodeList(int socketListenPort, int dtlsListenPort) :
if (_stunSockAddr.getAddress().isNull()) {
// we don't know the stun server socket yet, add it to unfiltered once known
- connect(&_stunSockAddr, &HifiSockAddr::lookupCompleted, this, &LimitedNodeList::addSTUNHandlerToUnfiltered);
+ connect(&_stunSockAddr, &SockAddr::lookupCompleted, this, &LimitedNodeList::addSTUNHandlerToUnfiltered);
} else {
// we know the stun server socket, add it to unfiltered now
addSTUNHandlerToUnfiltered();
@@ -248,11 +249,11 @@ bool LimitedNodeList::packetVersionMatch(const udt::Packet& packet) {
if (headerVersion != versionForPacketType(headerType)) {
static QMultiHash sourcedVersionDebugSuppressMap;
- static QMultiHash versionDebugSuppressMap;
+ static QMultiHash versionDebugSuppressMap;
bool hasBeenOutput = false;
QString senderString;
- const HifiSockAddr& senderSockAddr = packet.getSenderSockAddr();
+ const SockAddr& senderSockAddr = packet.getSenderSockAddr();
QUuid sourceID;
if (PacketTypeEnum::getNonSourcedPackets().contains(headerType)) {
@@ -413,7 +414,7 @@ qint64 LimitedNodeList::sendUnreliablePacket(const NLPacket& packet, const Node&
return sendUnreliablePacket(packet, *destinationNode.getActiveSocket(), destinationNode.getAuthenticateHash());
}
-qint64 LimitedNodeList::sendUnreliablePacket(const NLPacket& packet, const HifiSockAddr& sockAddr,
+qint64 LimitedNodeList::sendUnreliablePacket(const NLPacket& packet, const SockAddr& sockAddr,
HMACAuth* hmacAuth) {
Q_ASSERT(!packet.isPartOfMessage());
Q_ASSERT_X(!packet.isReliable(), "LimitedNodeList::sendUnreliablePacket",
@@ -446,7 +447,7 @@ qint64 LimitedNodeList::sendPacket(std::unique_ptr packet, const Node&
}
}
-qint64 LimitedNodeList::sendPacket(std::unique_ptr packet, const HifiSockAddr& sockAddr,
+qint64 LimitedNodeList::sendPacket(std::unique_ptr packet, const SockAddr& sockAddr,
HMACAuth* hmacAuth) {
Q_ASSERT(!packet->isPartOfMessage());
if (packet->isReliable()) {
@@ -497,7 +498,7 @@ qint64 LimitedNodeList::sendUnreliableUnorderedPacketList(NLPacketList& packetLi
}
}
-qint64 LimitedNodeList::sendUnreliableUnorderedPacketList(NLPacketList& packetList, const HifiSockAddr& sockAddr,
+qint64 LimitedNodeList::sendUnreliableUnorderedPacketList(NLPacketList& packetList, const SockAddr& sockAddr,
HMACAuth* hmacAuth) {
qint64 bytesSent = 0;
@@ -511,7 +512,7 @@ qint64 LimitedNodeList::sendUnreliableUnorderedPacketList(NLPacketList& packetLi
return bytesSent;
}
-qint64 LimitedNodeList::sendPacketList(std::unique_ptr packetList, const HifiSockAddr& sockAddr) {
+qint64 LimitedNodeList::sendPacketList(std::unique_ptr packetList, const SockAddr& sockAddr) {
// close the last packet in the list
packetList->closeCurrentPacket();
@@ -543,7 +544,7 @@ qint64 LimitedNodeList::sendPacketList(std::unique_ptr packetList,
}
qint64 LimitedNodeList::sendPacket(std::unique_ptr packet, const Node& destinationNode,
- const HifiSockAddr& overridenSockAddr) {
+ const SockAddr& overridenSockAddr) {
if (overridenSockAddr.isNull() && !destinationNode.getActiveSocket()) {
qCDebug(networking) << "LimitedNodeList::sendPacket called without active socket for node"
<< destinationNode.getUUID() << ". Not sending.";
@@ -675,7 +676,7 @@ void LimitedNodeList::handleNodeKill(const SharedNodePointer& node, ConnectionID
}
SharedNodePointer LimitedNodeList::addOrUpdateNode(const QUuid& uuid, NodeType_t nodeType,
- const HifiSockAddr& publicSocket, const HifiSockAddr& localSocket,
+ const SockAddr& publicSocket, const SockAddr& localSocket,
Node::LocalID localID, bool isReplicated, bool isUpstream,
const QUuid& connectionSecret, const NodePermissions& permissions) {
auto matchingNode = nodeWithUUID(uuid);
@@ -1105,7 +1106,7 @@ void LimitedNodeList::processSTUNResponse(std::unique_ptr packe
_publicSockAddr.getAddress().toString().toLocal8Bit().constData(),
_publicSockAddr.getPort());
- _publicSockAddr = HifiSockAddr(newPublicAddress, newPublicPort);
+ _publicSockAddr = SockAddr(newPublicAddress, newPublicPort);
if (!_hasCompletedInitialSTUN) {
// if we're here we have definitely completed our initial STUN sequence
@@ -1133,10 +1134,10 @@ void LimitedNodeList::startSTUNPublicSocketUpdate() {
if (_stunSockAddr.getAddress().isNull()) {
// if we fail to lookup the socket then timeout the STUN address lookup
- connect(&_stunSockAddr, &HifiSockAddr::lookupFailed, this, &LimitedNodeList::possiblyTimeoutSTUNAddressLookup);
+ connect(&_stunSockAddr, &SockAddr::lookupFailed, this, &LimitedNodeList::possiblyTimeoutSTUNAddressLookup);
// immediately send a STUN request once we know the socket
- connect(&_stunSockAddr, &HifiSockAddr::lookupCompleted, this, &LimitedNodeList::sendSTUNRequest);
+ connect(&_stunSockAddr, &SockAddr::lookupCompleted, this, &LimitedNodeList::sendSTUNRequest);
// start the initial STUN timer once we know the socket
connect(&_stunSockAddr, SIGNAL(lookupCompleted()), _initialSTUNTimer, SLOT(start()));
@@ -1186,7 +1187,7 @@ void LimitedNodeList::stopInitialSTUNUpdate(bool success) {
qCDebug(networking) << "LimitedNodeList public socket will be set with local port and null QHostAddress.";
// reset the public address and port to a null address
- _publicSockAddr = HifiSockAddr(QHostAddress(), _nodeSocket.localPort());
+ _publicSockAddr = SockAddr(QHostAddress(), _nodeSocket.localPort());
// we have changed the publicSockAddr, so emit our signal
emit publicSockAddrChanged(_publicSockAddr);
@@ -1213,7 +1214,7 @@ void LimitedNodeList::stopInitialSTUNUpdate(bool success) {
void LimitedNodeList::updateLocalSocket() {
// when update is called, if the local socket is empty then start with the guessed local socket
if (_localSockAddr.isNull()) {
- setLocalSocket(HifiSockAddr { getGuessedLocalAddress(), _nodeSocket.localPort() });
+ setLocalSocket(SockAddr { getGuessedLocalAddress(), _nodeSocket.localPort() });
}
// attempt to use Google's DNS to confirm that local IP
@@ -1237,7 +1238,7 @@ void LimitedNodeList::connectedForLocalSocketTest() {
auto localHostAddress = localIPTestSocket->localAddress();
if (localHostAddress.protocol() == QAbstractSocket::IPv4Protocol) {
- setLocalSocket(HifiSockAddr { localHostAddress, _nodeSocket.localPort() });
+ setLocalSocket(SockAddr { localHostAddress, _nodeSocket.localPort() });
_hasTCPCheckedLocalSocket = true;
}
@@ -1253,7 +1254,7 @@ void LimitedNodeList::errorTestingLocalSocket() {
// error connecting to the test socket - if we've never set our local socket using this test socket
// then use our possibly updated guessed local address as fallback
if (!_hasTCPCheckedLocalSocket) {
- setLocalSocket(HifiSockAddr { getGuessedLocalAddress(), _nodeSocket.localPort() });
+ setLocalSocket(SockAddr { getGuessedLocalAddress(), _nodeSocket.localPort() });
qCCritical(networking) << "PAGE: Can't connect to Google DNS service via TCP, falling back to guessed local address"
<< getLocalSockAddr();
}
@@ -1262,7 +1263,7 @@ void LimitedNodeList::errorTestingLocalSocket() {
}
}
-void LimitedNodeList::setLocalSocket(const HifiSockAddr& sockAddr) {
+void LimitedNodeList::setLocalSocket(const SockAddr& sockAddr) {
if (sockAddr.getAddress() != _localSockAddr.getAddress()) {
if (_localSockAddr.isNull()) {
@@ -1283,12 +1284,12 @@ void LimitedNodeList::setLocalSocket(const HifiSockAddr& sockAddr) {
}
}
-void LimitedNodeList::sendPeerQueryToIceServer(const HifiSockAddr& iceServerSockAddr, const QUuid& clientID,
+void LimitedNodeList::sendPeerQueryToIceServer(const SockAddr& iceServerSockAddr, const QUuid& clientID,
const QUuid& peerID) {
sendPacketToIceServer(PacketType::ICEServerQuery, iceServerSockAddr, clientID, peerID);
}
-SharedNodePointer LimitedNodeList::findNodeWithAddr(const HifiSockAddr& addr) {
+SharedNodePointer LimitedNodeList::findNodeWithAddr(const SockAddr& addr) {
QReadLocker locker(&_nodeMutex);
auto it = std::find_if(std::begin(_nodeHash), std::end(_nodeHash), [&addr](const UUIDNodePair& pair) {
return pair.second->getPublicSocket() == addr
@@ -1298,7 +1299,7 @@ SharedNodePointer LimitedNodeList::findNodeWithAddr(const HifiSockAddr& addr) {
return (it != std::end(_nodeHash)) ? it->second : SharedNodePointer();
}
-bool LimitedNodeList::sockAddrBelongsToNode(const HifiSockAddr& sockAddr) {
+bool LimitedNodeList::sockAddrBelongsToNode(const SockAddr& sockAddr) {
QReadLocker locker(&_nodeMutex);
auto it = std::find_if(std::begin(_nodeHash), std::end(_nodeHash), [&sockAddr](const UUIDNodePair& pair) {
return pair.second->getPublicSocket() == sockAddr
@@ -1308,7 +1309,7 @@ bool LimitedNodeList::sockAddrBelongsToNode(const HifiSockAddr& sockAddr) {
return it != std::end(_nodeHash);
}
-void LimitedNodeList::sendPacketToIceServer(PacketType packetType, const HifiSockAddr& iceServerSockAddr,
+void LimitedNodeList::sendPacketToIceServer(PacketType packetType, const SockAddr& iceServerSockAddr,
const QUuid& clientID, const QUuid& peerID) {
auto icePacket = NLPacket::create(packetType);
@@ -1400,7 +1401,7 @@ void LimitedNodeList::flagTimeForConnectionStep(ConnectionStep connectionStep, q
}
}
-void LimitedNodeList::clientConnectionToSockAddrReset(const HifiSockAddr& sockAddr) {
+void LimitedNodeList::clientConnectionToSockAddrReset(const SockAddr& sockAddr) {
// for certain reliable channels higher level classes may need to know if the udt::Connection has been reset
auto matchingNode = findNodeWithAddr(sockAddr);
diff --git a/libraries/networking/src/LimitedNodeList.h b/libraries/networking/src/LimitedNodeList.h
index 189f3e1b08..47b333220b 100644
--- a/libraries/networking/src/LimitedNodeList.h
+++ b/libraries/networking/src/LimitedNodeList.h
@@ -145,26 +145,26 @@ public:
virtual bool isDomainServer() const { return true; }
virtual QUuid getDomainUUID() const { assert(false); return QUuid(); }
virtual Node::LocalID getDomainLocalID() const { assert(false); return Node::NULL_LOCAL_ID; }
- virtual HifiSockAddr getDomainSockAddr() const { assert(false); return HifiSockAddr(); }
+ virtual SockAddr getDomainSockAddr() const { assert(false); return SockAddr(); }
// use sendUnreliablePacket to send an unreliable packet (that you do not need to move)
// either to a node (via its active socket) or to a manual sockaddr
qint64 sendUnreliablePacket(const NLPacket& packet, const Node& destinationNode);
- qint64 sendUnreliablePacket(const NLPacket& packet, const HifiSockAddr& sockAddr, HMACAuth* hmacAuth = nullptr);
+ qint64 sendUnreliablePacket(const NLPacket& packet, const SockAddr& sockAddr, HMACAuth* hmacAuth = nullptr);
// use sendPacket to send a moved unreliable or reliable NL packet to a node's active socket or manual sockaddr
qint64 sendPacket(std::unique_ptr packet, const Node& destinationNode);
- qint64 sendPacket(std::unique_ptr packet, const HifiSockAddr& sockAddr, HMACAuth* hmacAuth = nullptr);
+ qint64 sendPacket(std::unique_ptr packet, const SockAddr& sockAddr, HMACAuth* hmacAuth = nullptr);
// use sendUnreliableUnorderedPacketList to unreliably send separate packets from the packet list
// either to a node's active socket or to a manual sockaddr
qint64 sendUnreliableUnorderedPacketList(NLPacketList& packetList, const Node& destinationNode);
- qint64 sendUnreliableUnorderedPacketList(NLPacketList& packetList, const HifiSockAddr& sockAddr,
+ qint64 sendUnreliableUnorderedPacketList(NLPacketList& packetList, const SockAddr& sockAddr,
HMACAuth* hmacAuth = nullptr);
// use sendPacketList to send reliable packet lists (ordered or unordered) to a node's active socket
// or to a manual sock addr
- qint64 sendPacketList(std::unique_ptr packetList, const HifiSockAddr& sockAddr);
+ qint64 sendPacketList(std::unique_ptr packetList, const SockAddr& sockAddr);
qint64 sendPacketList(std::unique_ptr packetList, const Node& destinationNode);
std::function linkedDataCreateCallback;
@@ -175,7 +175,7 @@ public:
SharedNodePointer nodeWithLocalID(Node::LocalID localID) const;
SharedNodePointer addOrUpdateNode(const QUuid& uuid, NodeType_t nodeType,
- const HifiSockAddr& publicSocket, const HifiSockAddr& localSocket,
+ const SockAddr& publicSocket, const SockAddr& localSocket,
Node::LocalID localID = Node::NULL_LOCAL_ID, bool isReplicated = false,
bool isUpstream = false, const QUuid& connectionSecret = QUuid(),
const NodePermissions& permissions = DEFAULT_AGENT_PERMISSIONS);
@@ -183,9 +183,9 @@ public:
static bool parseSTUNResponse(udt::BasePacket* packet, QHostAddress& newPublicAddress, uint16_t& newPublicPort);
bool hasCompletedInitialSTUN() const { return _hasCompletedInitialSTUN; }
- const HifiSockAddr& getLocalSockAddr() const { return _localSockAddr; }
- const HifiSockAddr& getPublicSockAddr() const { return _publicSockAddr; }
- const HifiSockAddr& getSTUNSockAddr() const { return _stunSockAddr; }
+ const SockAddr& getLocalSockAddr() const { return _localSockAddr; }
+ const SockAddr& getPublicSockAddr() const { return _publicSockAddr; }
+ const SockAddr& getSTUNSockAddr() const { return _stunSockAddr; }
void processKillNode(ReceivedMessage& message);
@@ -201,9 +201,9 @@ public:
static std::unique_ptr constructICEPingPacket(PingType_t pingType, const QUuid& iceID);
static std::unique_ptr constructICEPingReplyPacket(ReceivedMessage& message, const QUuid& iceID);
- void sendPeerQueryToIceServer(const HifiSockAddr& iceServerSockAddr, const QUuid& clientID, const QUuid& peerID);
+ void sendPeerQueryToIceServer(const SockAddr& iceServerSockAddr, const QUuid& clientID, const QUuid& peerID);
- SharedNodePointer findNodeWithAddr(const HifiSockAddr& addr);
+ SharedNodePointer findNodeWithAddr(const SockAddr& addr);
using value_type = SharedNodePointer;
using const_iterator = std::vector::const_iterator;
@@ -369,7 +369,7 @@ private slots:
signals:
// QUuid might be zero for non-sourced packet types.
- void packetVersionMismatch(PacketType type, const HifiSockAddr& senderSockAddr, const QUuid& senderUUID);
+ void packetVersionMismatch(PacketType type, const SockAddr& senderSockAddr, const QUuid& senderUUID);
void uuidChanged(const QUuid& ownerUUID, const QUuid& oldUUID);
void nodeAdded(SharedNodePointer);
@@ -379,8 +379,8 @@ signals:
void clientConnectionToNodeReset(SharedNodePointer);
- void localSockAddrChanged(const HifiSockAddr& localSockAddr);
- void publicSockAddrChanged(const HifiSockAddr& publicSockAddr);
+ void localSockAddrChanged(const SockAddr& localSockAddr);
+ void publicSockAddrChanged(const SockAddr& publicSockAddr);
void isAllowedEditorChanged(bool isAllowedEditor);
void canRezChanged(bool canRez);
@@ -397,7 +397,7 @@ protected slots:
void connectedForLocalSocketTest();
void errorTestingLocalSocket();
- void clientConnectionToSockAddrReset(const HifiSockAddr& sockAddr);
+ void clientConnectionToSockAddrReset(const SockAddr& sockAddr);
void processDelayedAdds();
@@ -405,8 +405,8 @@ protected:
struct NewNodeInfo {
qint8 type;
QUuid uuid;
- HifiSockAddr publicSocket;
- HifiSockAddr localSocket;
+ SockAddr publicSocket;
+ SockAddr localSocket;
NodePermissions permissions;
bool isReplicated;
Node::LocalID sessionLocalID;
@@ -418,10 +418,10 @@ protected:
void operator=(LimitedNodeList const&) = delete; // Don't implement, needed to avoid copies of singleton
qint64 sendPacket(std::unique_ptr packet, const Node& destinationNode,
- const HifiSockAddr& overridenSockAddr);
+ const SockAddr& overridenSockAddr);
void fillPacketHeader(const NLPacket& packet, HMACAuth* hmacAuth = nullptr);
- void setLocalSocket(const HifiSockAddr& sockAddr);
+ void setLocalSocket(const SockAddr& sockAddr);
bool packetSourceAndHashMatchAndTrackBandwidth(const udt::Packet& packet, Node* sourceNode = nullptr);
void processSTUNResponse(std::unique_ptr packet);
@@ -430,10 +430,10 @@ protected:
void stopInitialSTUNUpdate(bool success);
- void sendPacketToIceServer(PacketType packetType, const HifiSockAddr& iceServerSockAddr, const QUuid& clientID,
+ void sendPacketToIceServer(PacketType packetType, const SockAddr& iceServerSockAddr, const QUuid& clientID,
const QUuid& peerRequestID = QUuid());
- bool sockAddrBelongsToNode(const HifiSockAddr& sockAddr);
+ bool sockAddrBelongsToNode(const SockAddr& sockAddr);
void addNewNode(NewNodeInfo info);
void delayNodeAdd(NewNodeInfo info);
@@ -444,9 +444,9 @@ protected:
mutable QReadWriteLock _nodeMutex { QReadWriteLock::Recursive };
udt::Socket _nodeSocket;
QUdpSocket* _dtlsSocket { nullptr };
- HifiSockAddr _localSockAddr;
- HifiSockAddr _publicSockAddr;
- HifiSockAddr _stunSockAddr { STUN_SERVER_HOSTNAME, STUN_SERVER_PORT };
+ SockAddr _localSockAddr;
+ SockAddr _publicSockAddr;
+ SockAddr _stunSockAddr { STUN_SERVER_HOSTNAME, STUN_SERVER_PORT };
bool _hasTCPCheckedLocalSocket { false };
bool _useAuthentication { true };
diff --git a/libraries/networking/src/NLPacket.cpp b/libraries/networking/src/NLPacket.cpp
index 620e60945b..8463dab792 100644
--- a/libraries/networking/src/NLPacket.cpp
+++ b/libraries/networking/src/NLPacket.cpp
@@ -4,6 +4,7 @@
//
// Created by Clement on 7/6/15.
// Copyright 2015 High Fidelity, Inc.
+// Copyright 2021 Vircadia contributors.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@@ -35,7 +36,7 @@ std::unique_ptr NLPacket::create(PacketType type, qint64 size, bool is
}
std::unique_ptr NLPacket::fromReceivedPacket(std::unique_ptr data, qint64 size,
- const HifiSockAddr& senderSockAddr) {
+ const SockAddr& senderSockAddr) {
// Fail with null data
Q_ASSERT(data);
@@ -89,7 +90,7 @@ NLPacket::NLPacket(const NLPacket& other) : Packet(other) {
_sourceID = other._sourceID;
}
-NLPacket::NLPacket(std::unique_ptr data, qint64 size, const HifiSockAddr& senderSockAddr) :
+NLPacket::NLPacket(std::unique_ptr data, qint64 size, const SockAddr& senderSockAddr) :
Packet(std::move(data), size, senderSockAddr)
{
// sanity check before we decrease the payloadSize with the payloadCapacity
diff --git a/libraries/networking/src/NLPacket.h b/libraries/networking/src/NLPacket.h
index 4103f2068e..b2a174a540 100644
--- a/libraries/networking/src/NLPacket.h
+++ b/libraries/networking/src/NLPacket.h
@@ -4,6 +4,7 @@
//
// Created by Clement on 7/6/15.
// Copyright 2015 High Fidelity, Inc.
+// Copyright 2021 Vircadia contributors.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@@ -52,7 +53,7 @@ public:
bool isReliable = false, bool isPartOfMessage = false, PacketVersion version = 0);
static std::unique_ptr fromReceivedPacket(std::unique_ptr data, qint64 size,
- const HifiSockAddr& senderSockAddr);
+ const SockAddr& senderSockAddr);
static std::unique_ptr fromBase(std::unique_ptr packet);
@@ -87,7 +88,7 @@ public:
protected:
NLPacket(PacketType type, qint64 size = -1, bool forceReliable = false, bool isPartOfMessage = false, PacketVersion version = 0);
- NLPacket(std::unique_ptr data, qint64 size, const HifiSockAddr& senderSockAddr);
+ NLPacket(std::unique_ptr data, qint64 size, const SockAddr& senderSockAddr);
NLPacket(const NLPacket& other);
NLPacket(NLPacket&& other);
diff --git a/libraries/networking/src/NetworkPeer.cpp b/libraries/networking/src/NetworkPeer.cpp
index b7807bc62d..e76b8c31a6 100644
--- a/libraries/networking/src/NetworkPeer.cpp
+++ b/libraries/networking/src/NetworkPeer.cpp
@@ -4,6 +4,7 @@
//
// Created by Stephen Birarda on 2014-10-02.
// Copyright 2014 High Fidelity, Inc.
+// Copyright 2021 Vircadia contributors.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@@ -37,7 +38,7 @@ NetworkPeer::NetworkPeer(QObject* parent) :
_lastHeardMicrostamp = usecTimestampNow();
}
-NetworkPeer::NetworkPeer(const QUuid& uuid, const HifiSockAddr& publicSocket, const HifiSockAddr& localSocket, QObject* parent) :
+NetworkPeer::NetworkPeer(const QUuid& uuid, const SockAddr& publicSocket, const SockAddr& localSocket, QObject* parent) :
QObject(parent),
_uuid(uuid),
_publicSocket(publicSocket),
@@ -50,7 +51,7 @@ NetworkPeer::NetworkPeer(const QUuid& uuid, const HifiSockAddr& publicSocket, co
_lastHeardMicrostamp = usecTimestampNow();
}
-void NetworkPeer::setPublicSocket(const HifiSockAddr& publicSocket) {
+void NetworkPeer::setPublicSocket(const SockAddr& publicSocket) {
if (publicSocket != _publicSocket) {
if (_activeSocket == &_publicSocket) {
// if the active socket was the public socket then reset it to NULL
@@ -70,7 +71,7 @@ void NetworkPeer::setPublicSocket(const HifiSockAddr& publicSocket) {
}
}
-void NetworkPeer::setLocalSocket(const HifiSockAddr& localSocket) {
+void NetworkPeer::setLocalSocket(const SockAddr& localSocket) {
if (localSocket != _localSocket) {
if (_activeSocket == &_localSocket) {
// if the active socket was the local socket then reset it to NULL
@@ -90,7 +91,7 @@ void NetworkPeer::setLocalSocket(const HifiSockAddr& localSocket) {
}
}
-void NetworkPeer::setSymmetricSocket(const HifiSockAddr& symmetricSocket) {
+void NetworkPeer::setSymmetricSocket(const SockAddr& symmetricSocket) {
if (symmetricSocket != _symmetricSocket) {
if (_activeSocket == &_symmetricSocket) {
// if the active socket was the symmetric socket then reset it to NULL
@@ -110,7 +111,7 @@ void NetworkPeer::setSymmetricSocket(const HifiSockAddr& symmetricSocket) {
}
}
-void NetworkPeer::setActiveSocket(HifiSockAddr* discoveredSocket) {
+void NetworkPeer::setActiveSocket(SockAddr* discoveredSocket) {
_activeSocket = discoveredSocket;
// we have an active socket, stop our ping timer
@@ -145,7 +146,7 @@ void NetworkPeer::activateSymmetricSocket() {
}
}
-void NetworkPeer::activateMatchingOrNewSymmetricSocket(const HifiSockAddr& matchableSockAddr) {
+void NetworkPeer::activateMatchingOrNewSymmetricSocket(const SockAddr& matchableSockAddr) {
if (matchableSockAddr == _publicSocket) {
activatePublicSocket();
} else if (matchableSockAddr == _localSocket) {
diff --git a/libraries/networking/src/NetworkPeer.h b/libraries/networking/src/NetworkPeer.h
index 4c08c97d3c..a3012087af 100644
--- a/libraries/networking/src/NetworkPeer.h
+++ b/libraries/networking/src/NetworkPeer.h
@@ -4,6 +4,7 @@
//
// Created by Stephen Birarda on 2014-10-02.
// Copyright 2014 High Fidelity, Inc.
+// Copyright 2021 Vircadia contributors.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@@ -18,7 +19,7 @@
#include
#include
-#include "HifiSockAddr.h"
+#include "SockAddr.h"
#include "UUID.h"
const QString ICE_SERVER_HOSTNAME = "localhost";
@@ -32,7 +33,7 @@ class NetworkPeer : public QObject {
Q_OBJECT
public:
NetworkPeer(QObject* parent = 0);
- NetworkPeer(const QUuid& uuid, const HifiSockAddr& publicSocket, const HifiSockAddr& localSocket, QObject* parent = 0);
+ NetworkPeer(const QUuid& uuid, const SockAddr& publicSocket, const SockAddr& localSocket, QObject* parent = 0);
bool isNull() const { return _uuid.isNull(); }
bool hasSockets() const { return !_localSocket.isNull() && !_publicSocket.isNull(); }
@@ -49,21 +50,21 @@ public:
void softReset();
void reset();
- const HifiSockAddr& getPublicSocket() const { return _publicSocket; }
- const HifiSockAddr& getLocalSocket() const { return _localSocket; }
- const HifiSockAddr& getSymmetricSocket() const { return _symmetricSocket; }
+ const SockAddr& getPublicSocket() const { return _publicSocket; }
+ const SockAddr& getLocalSocket() const { return _localSocket; }
+ const SockAddr& getSymmetricSocket() const { return _symmetricSocket; }
- void setPublicSocket(const HifiSockAddr& publicSocket);
- void setLocalSocket(const HifiSockAddr& localSocket);
- void setSymmetricSocket(const HifiSockAddr& symmetricSocket);
+ void setPublicSocket(const SockAddr& publicSocket);
+ void setLocalSocket(const SockAddr& localSocket);
+ void setSymmetricSocket(const SockAddr& symmetricSocket);
- const HifiSockAddr* getActiveSocket() const { return _activeSocket; }
+ const SockAddr* getActiveSocket() const { return _activeSocket; }
void activatePublicSocket();
void activateLocalSocket();
void activateSymmetricSocket();
- void activateMatchingOrNewSymmetricSocket(const HifiSockAddr& matchableSockAddr);
+ void activateMatchingOrNewSymmetricSocket(const SockAddr& matchableSockAddr);
quint64 getWakeTimestamp() const { return _wakeTimestamp; }
void setWakeTimestamp(quint64 wakeTimestamp) { _wakeTimestamp = wakeTimestamp; }
@@ -93,19 +94,19 @@ public slots:
signals:
void pingTimerTimeout();
- void socketActivated(const HifiSockAddr& sockAddr);
- void socketUpdated(HifiSockAddr previousAddress, HifiSockAddr currentAddress);
+ void socketActivated(const SockAddr& sockAddr);
+ void socketUpdated(SockAddr previousAddress, SockAddr currentAddress);
protected:
- void setActiveSocket(HifiSockAddr* discoveredSocket);
+ void setActiveSocket(SockAddr* discoveredSocket);
QUuid _uuid;
LocalID _localID { 0 };
- HifiSockAddr _publicSocket;
- HifiSockAddr _localSocket;
- HifiSockAddr _symmetricSocket;
- HifiSockAddr* _activeSocket;
+ SockAddr _publicSocket;
+ SockAddr _localSocket;
+ SockAddr _symmetricSocket;
+ SockAddr* _activeSocket;
quint64 _wakeTimestamp;
std::atomic_ullong _lastHeardMicrostamp;
diff --git a/libraries/networking/src/NetworkingConstants.h b/libraries/networking/src/NetworkingConstants.h
index d5ad90a6f4..ae3607eed9 100644
--- a/libraries/networking/src/NetworkingConstants.h
+++ b/libraries/networking/src/NetworkingConstants.h
@@ -25,7 +25,7 @@ namespace NetworkingConstants {
// You can avoid changing that and still effectively use a connected domain on staging
// if you manually generate a personal access token for the domains scope
// at https://staging.highfidelity.com/user/tokens/new?for_domain_server=true
-
+
const QString WEB_ENGINE_VERSION = "Chrome/83.0.4103.122";
// For now we only have one Metaverse server.
@@ -35,21 +35,21 @@ namespace NetworkingConstants {
// Web Engine requests to this parent domain have an account authorization header added
const QString AUTH_HOSTNAME_BASE = "vircadia.com";
const QStringList IS_AUTHABLE_HOSTNAME = { "vircadia.com", "vircadia.io" };
-
+
// Use a custom User-Agent to avoid ModSecurity filtering, e.g. by hosting providers.
const QByteArray VIRCADIA_USER_AGENT = "Mozilla/5.0 (VircadiaInterface)";
-
+
const QString WEB_ENGINE_USER_AGENT = "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) " + WEB_ENGINE_VERSION + " Mobile Safari/537.36";
const QString MOBILE_USER_AGENT = "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) " + WEB_ENGINE_VERSION + " Mobile Safari/537.36";
-
+
// WebEntity Defaults
const QString WEB_ENTITY_DEFAULT_SOURCE_URL = "https://vircadia.com/";
const QString WEB_ENTITY_DEFAULT_USER_AGENT = WEB_ENGINE_USER_AGENT;
-
+
// Builds URLs
const QUrl BUILDS_XML_URL("https://highfidelity.com/builds.xml");
const QUrl MASTER_BUILDS_XML_URL("https://highfidelity.com/dev-builds.xml");
-
+
const QString DEFAULT_AVATAR_COLLISION_SOUND_URL = "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/Body_Hits_Impact.wav";
// CDN URLs
@@ -71,20 +71,20 @@ namespace NetworkingConstants {
const unsigned short STUN_SERVER_DEFAULT_PORT = 19302;
#endif
- const QUrl HELP_DOCS_URL { "https://docs.vircadia.dev" };
- const QUrl HELP_FORUM_URL { "https://forums.vircadia.dev" };
+ const QUrl HELP_DOCS_URL { "https://docs.vircadia.com" };
+ const QUrl HELP_FORUM_URL { "https://forum.vircadia.com" };
const QUrl HELP_SCRIPTING_REFERENCE_URL{ "https://apidocs.vircadia.dev/" };
- const QUrl HELP_RELEASE_NOTES_URL{ "https://docs.vircadia.dev/release-notes.html" };
+ const QUrl HELP_RELEASE_NOTES_URL{ "https://docs.vircadia.com/release-notes.html" };
const QUrl HELP_BUG_REPORT_URL{ "https://github.com/vircadia/vircadia/issues" };
-
+
const QString DEFAULT_VIRCADIA_ADDRESS = "file:///~/serverless/tutorial.json";
const QString DEFAULT_HOME_ADDRESS = "file:///~/serverless/tutorial.json";
const QString REDIRECT_HIFI_ADDRESS = "file:///~/serverless/redirect.json";
}
const QString HIFI_URL_SCHEME_ABOUT = "about";
-const QString URL_SCHEME_HIFI = "hifi";
-const QString URL_SCHEME_HIFIAPP = "hifiapp";
+const QString URL_SCHEME_VIRCADIA = "hifi";
+const QString URL_SCHEME_VIRCADIAAPP = "hifiapp";
const QString URL_SCHEME_DATA = "data";
const QString URL_SCHEME_QRC = "qrc";
const QString HIFI_URL_SCHEME_FILE = "file";
diff --git a/libraries/networking/src/Node.cpp b/libraries/networking/src/Node.cpp
index a2bd60914a..aa13dd6565 100644
--- a/libraries/networking/src/Node.cpp
+++ b/libraries/networking/src/Node.cpp
@@ -4,6 +4,7 @@
//
// Created by Stephen Birarda on 2/15/13.
// Copyright 2013 High Fidelity, Inc.
+// Copyright 2021 Vircadia contributors.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@@ -85,8 +86,8 @@ NodeType_t NodeType::fromString(QString type) {
}
-Node::Node(const QUuid& uuid, NodeType_t type, const HifiSockAddr& publicSocket,
- const HifiSockAddr& localSocket, QObject* parent) :
+Node::Node(const QUuid& uuid, NodeType_t type, const SockAddr& publicSocket,
+ const SockAddr& localSocket, QObject* parent) :
NetworkPeer(uuid, publicSocket, localSocket, parent),
_type(type),
_pingMs(-1), // "Uninitialized"
diff --git a/libraries/networking/src/Node.h b/libraries/networking/src/Node.h
index 7435ebaaf8..cf2f081da6 100644
--- a/libraries/networking/src/Node.h
+++ b/libraries/networking/src/Node.h
@@ -4,6 +4,7 @@
//
// Created by Stephen Birarda on 2/15/13.
// Copyright 2013 High Fidelity, Inc.
+// Copyright 2021 Vircadia contributors.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@@ -27,7 +28,7 @@
#include
-#include "HifiSockAddr.h"
+#include "SockAddr.h"
#include "NetworkPeer.h"
#include "NodeData.h"
#include "NodeType.h"
@@ -44,7 +45,7 @@ public:
using Stats = udt::ConnectionStats::Stats;
Node(const QUuid& uuid, NodeType_t type,
- const HifiSockAddr& publicSocket, const HifiSockAddr& localSocket,
+ const SockAddr& publicSocket, const SockAddr& localSocket,
QObject* parent = nullptr);
bool operator==(const Node& otherNode) const { return _uuid == otherNode._uuid; }
diff --git a/libraries/networking/src/NodeList.cpp b/libraries/networking/src/NodeList.cpp
index 3d28457633..1e07e14803 100644
--- a/libraries/networking/src/NodeList.cpp
+++ b/libraries/networking/src/NodeList.cpp
@@ -35,7 +35,7 @@
#include "Assignment.h"
#include "AudioHelpers.h"
#include "DomainAccountManager.h"
-#include "HifiSockAddr.h"
+#include "SockAddr.h"
#include "FingerprintUtils.h"
#include "NetworkLogging.h"
@@ -176,11 +176,11 @@ NodeList::NodeList(char newOwnerType, int socketListenPort, int dtlsListenPort)
PacketReceiver::makeUnsourcedListenerReference(this, &NodeList::processUsernameFromIDReply));
}
-qint64 NodeList::sendStats(QJsonObject statsObject, HifiSockAddr destination) {
+qint64 NodeList::sendStats(QJsonObject statsObject, SockAddr destination) {
if (thread() != QThread::currentThread()) {
QMetaObject::invokeMethod(this, "sendStats", Qt::QueuedConnection,
Q_ARG(QJsonObject, statsObject),
- Q_ARG(HifiSockAddr, destination));
+ Q_ARG(SockAddr, destination));
return 0;
}
@@ -245,7 +245,7 @@ void NodeList::timePingReply(ReceivedMessage& message, const SharedNodePointer&
void NodeList::processPingPacket(QSharedPointer message, SharedNodePointer sendingNode) {
// send back a reply
auto replyPacket = constructPingReplyPacket(*message);
- const HifiSockAddr& senderSockAddr = message->getSenderSockAddr();
+ const SockAddr& senderSockAddr = message->getSenderSockAddr();
sendPacket(std::move(replyPacket), *sendingNode, senderSockAddr);
// If we don't have a symmetric socket for this node and this socket doesn't match
@@ -364,7 +364,7 @@ void NodeList::sendDomainServerCheckIn() {
// let the domain handler know we are due to send a checkin packet
} else if (!domainHandlerIp.isNull() && !_domainHandler.checkInPacketTimeout()) {
bool domainIsConnected = _domainHandler.isConnected();
- HifiSockAddr domainSockAddr = _domainHandler.getSockAddr();
+ SockAddr domainSockAddr = _domainHandler.getSockAddr();
PacketType domainPacketType = !domainIsConnected
? PacketType::DomainConnectRequest : PacketType::DomainListRequest;
@@ -405,7 +405,7 @@ void NodeList::sendDomainServerCheckIn() {
QDataStream packetStream(domainPacket.get());
- HifiSockAddr localSockAddr = _localSockAddr;
+ SockAddr localSockAddr = _localSockAddr;
if (domainPacketType == PacketType::DomainConnectRequest) {
#if (PR_BUILD || DEV_BUILD)
@@ -823,8 +823,8 @@ void NodeList::processDomainServerList(QSharedPointer message)
// FIXME: Remove this call to requestDomainSettings() and reinstate the one in DomainHandler::setIsConnected(), in version
// 2021.2.0. (New protocol version implies a domain server upgrade.)
- if (!_domainHandler.isConnected()
- && _domainHandler.getScheme() == URL_SCHEME_HIFI && !_domainHandler.getHostname().isEmpty()) {
+ if (!_domainHandler.isConnected()
+ && _domainHandler.getScheme() == URL_SCHEME_VIRCADIA && !_domainHandler.getHostname().isEmpty()) {
// We're about to connect but we need the domain settings (in particular, the node permissions) in order to adjust the
// canRezAvatarEntities permission above before using the permissions in determining whether or not to connect without
// avatar entities rezzing below.
@@ -1012,7 +1012,7 @@ void NodeList::sendKeepAlivePings() {
});
}
-bool NodeList::sockAddrBelongsToDomainOrNode(const HifiSockAddr& sockAddr) {
+bool NodeList::sockAddrBelongsToDomainOrNode(const SockAddr& sockAddr) {
return _domainHandler.getSockAddr() == sockAddr || LimitedNodeList::sockAddrBelongsToNode(sockAddr);
}
diff --git a/libraries/networking/src/NodeList.h b/libraries/networking/src/NodeList.h
index 9c47abbd9f..1c01d384cc 100644
--- a/libraries/networking/src/NodeList.h
+++ b/libraries/networking/src/NodeList.h
@@ -4,6 +4,7 @@
//
// Created by Stephen Birarda on 2/15/13.
// Copyright 2013 High Fidelity, Inc.
+// Copyright 2021 Vircadia contributors.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@@ -57,7 +58,7 @@ public:
NodeType_t getOwnerType() const { return _ownerType.load(); }
void setOwnerType(NodeType_t ownerType) { _ownerType.store(ownerType); }
- Q_INVOKABLE qint64 sendStats(QJsonObject statsObject, HifiSockAddr destination);
+ Q_INVOKABLE qint64 sendStats(QJsonObject statsObject, SockAddr destination);
Q_INVOKABLE qint64 sendStatsToDomainServer(QJsonObject statsObject);
DomainHandler& getDomainHandler() { return _domainHandler; }
@@ -67,7 +68,7 @@ public:
void addSetOfNodeTypesToNodeInterestSet(const NodeSet& setOfNodeTypes);
void resetNodeInterestSet() { _nodeTypesOfInterest.clear(); }
- void setAssignmentServerSocket(const HifiSockAddr& serverSocket) { _assignmentServerSocket = serverSocket; }
+ void setAssignmentServerSocket(const SockAddr& serverSocket) { _assignmentServerSocket = serverSocket; }
void sendAssignment(Assignment& assignment);
void disableDomainPortAutoDiscovery(bool disabled = false) { _domainPortAutoDiscovery = disabled; };
@@ -102,7 +103,7 @@ public:
virtual bool isDomainServer() const override { return false; }
virtual QUuid getDomainUUID() const override { return _domainHandler.getUUID(); }
virtual Node::LocalID getDomainLocalID() const override { return _domainHandler.getLocalID(); }
- virtual HifiSockAddr getDomainSockAddr() const override { return _domainHandler.getSockAddr(); }
+ virtual SockAddr getDomainSockAddr() const override { return _domainHandler.getSockAddr(); }
public slots:
void reset(QString reason, bool skipDomainHandlerReset = false);
@@ -171,12 +172,12 @@ private:
void pingPunchForInactiveNode(const SharedNodePointer& node);
- bool sockAddrBelongsToDomainOrNode(const HifiSockAddr& sockAddr);
+ bool sockAddrBelongsToDomainOrNode(const SockAddr& sockAddr);
std::atomic _ownerType;
NodeSet _nodeTypesOfInterest;
DomainHandler _domainHandler;
- HifiSockAddr _assignmentServerSocket;
+ SockAddr _assignmentServerSocket;
bool _isShuttingDown { false };
QTimer _keepAlivePingTimer;
bool _requestsDomainListData { false };
diff --git a/libraries/networking/src/PacketReceiver.cpp b/libraries/networking/src/PacketReceiver.cpp
index c13fb8566b..384355b53c 100644
--- a/libraries/networking/src/PacketReceiver.cpp
+++ b/libraries/networking/src/PacketReceiver.cpp
@@ -5,6 +5,7 @@
// Created by Stephen Birarda on 1/23/2014.
// Update by Ryan Huffman on 7/8/2015.
// Copyright 2014 High Fidelity, Inc.
+// Copyright 2021 Vircadia contributors.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@@ -152,7 +153,7 @@ void PacketReceiver::handleVerifiedPacket(std::unique_ptr packet) {
void PacketReceiver::handleVerifiedMessagePacket(std::unique_ptr packet) {
auto nlPacket = NLPacket::fromBase(std::move(packet));
- auto key = std::pair(nlPacket->getSenderSockAddr(), nlPacket->getMessageNumber());
+ auto key = std::pair(nlPacket->getSenderSockAddr(), nlPacket->getMessageNumber());
auto it = _pendingMessages.find(key);
QSharedPointer message;
@@ -174,8 +175,8 @@ void PacketReceiver::handleVerifiedMessagePacket(std::unique_ptr pa
}
}
-void PacketReceiver::handleMessageFailure(HifiSockAddr from, udt::Packet::MessageNumber messageNumber) {
- auto key = std::pair(from, messageNumber);
+void PacketReceiver::handleMessageFailure(SockAddr from, udt::Packet::MessageNumber messageNumber) {
+ auto key = std::pair(from, messageNumber);
auto it = _pendingMessages.find(key);
if (it != _pendingMessages.end()) {
auto message = it->second;
diff --git a/libraries/networking/src/PacketReceiver.h b/libraries/networking/src/PacketReceiver.h
index 4d2f11360e..c354e98a37 100644
--- a/libraries/networking/src/PacketReceiver.h
+++ b/libraries/networking/src/PacketReceiver.h
@@ -5,6 +5,7 @@
// Created by Stephen Birarda on 1/23/2014.
// Update by Ryan Huffman on 7/8/2015.
// Copyright 2014 High Fidelity, Inc.
+// Copyright 2021 Vircadia contributors.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@@ -34,9 +35,9 @@ class OctreePacketProcessor;
namespace std {
template <>
- struct hash> {
- size_t operator()(const std::pair& pair) const {
- return hash()(pair.first) ^ hash()(pair.second);
+ struct hash> {
+ size_t operator()(const std::pair& pair) const {
+ return hash()(pair.first) ^ hash()(pair.second);
}
};
}
@@ -78,7 +79,7 @@ public:
void handleVerifiedPacket(std::unique_ptr packet);
void handleVerifiedMessagePacket(std::unique_ptr message);
- void handleMessageFailure(HifiSockAddr from, udt::Packet::MessageNumber messageNumber);
+ void handleMessageFailure(SockAddr from, udt::Packet::MessageNumber messageNumber);
private:
template
@@ -129,7 +130,7 @@ private:
QMutex _directConnectSetMutex;
QSet _directlyConnectedObjects;
- std::unordered_map, QSharedPointer> _pendingMessages;
+ std::unordered_map, QSharedPointer> _pendingMessages;
friend class EntityEditPacketSender;
friend class OctreePacketProcessor;
diff --git a/libraries/networking/src/ReceivedMessage.cpp b/libraries/networking/src/ReceivedMessage.cpp
index 7ae408ef7a..684ad665ba 100644
--- a/libraries/networking/src/ReceivedMessage.cpp
+++ b/libraries/networking/src/ReceivedMessage.cpp
@@ -4,6 +4,7 @@
//
// Created by Ryan Huffman on 2015/09/17
// Copyright 2015 High Fidelity, Inc.
+// Copyright 2021 Vircadia contributors.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@@ -49,7 +50,7 @@ ReceivedMessage::ReceivedMessage(NLPacket& packet)
}
ReceivedMessage::ReceivedMessage(QByteArray byteArray, PacketType packetType, PacketVersion packetVersion,
- const HifiSockAddr& senderSockAddr, NLPacket::LocalID sourceID) :
+ const SockAddr& senderSockAddr, NLPacket::LocalID sourceID) :
_data(byteArray),
_headData(_data.mid(0, HEAD_DATA_SIZE)),
_numPackets(1),
diff --git a/libraries/networking/src/ReceivedMessage.h b/libraries/networking/src/ReceivedMessage.h
index c864616635..f9c8245a10 100644
--- a/libraries/networking/src/ReceivedMessage.h
+++ b/libraries/networking/src/ReceivedMessage.h
@@ -4,6 +4,7 @@
//
// Created by Ryan Huffman on 2015/09/15
// Copyright 2015 High Fidelity, Inc.
+// Copyright 2021 Vircadia contributors.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@@ -25,7 +26,7 @@ public:
ReceivedMessage(const NLPacketList& packetList);
ReceivedMessage(NLPacket& packet);
ReceivedMessage(QByteArray byteArray, PacketType packetType, PacketVersion packetVersion,
- const HifiSockAddr& senderSockAddr, NLPacket::LocalID sourceID = NLPacket::NULL_LOCAL_ID);
+ const SockAddr& senderSockAddr, NLPacket::LocalID sourceID = NLPacket::NULL_LOCAL_ID);
QByteArray getMessage() const { return _data; }
const char* getRawMessage() const { return _data.constData(); }
@@ -41,7 +42,7 @@ public:
bool isComplete() const { return _isComplete; }
NLPacket::LocalID getSourceID() const { return _sourceID; }
- const HifiSockAddr& getSenderSockAddr() { return _senderSockAddr; }
+ const SockAddr& getSenderSockAddr() { return _senderSockAddr; }
qint64 getPosition() const { return _position; }
@@ -99,7 +100,7 @@ private:
NLPacket::LocalID _sourceID { NLPacket::NULL_LOCAL_ID };
PacketType _packetType;
PacketVersion _packetVersion;
- HifiSockAddr _senderSockAddr;
+ SockAddr _senderSockAddr;
std::atomic _isComplete { true };
std::atomic _failed { false };
diff --git a/libraries/networking/src/HifiSockAddr.cpp b/libraries/networking/src/SockAddr.cpp
similarity index 78%
rename from libraries/networking/src/HifiSockAddr.cpp
rename to libraries/networking/src/SockAddr.cpp
index 086dd08489..e61ae5bccc 100644
--- a/libraries/networking/src/HifiSockAddr.cpp
+++ b/libraries/networking/src/SockAddr.cpp
@@ -1,15 +1,16 @@
//
-// HifiSockAddr.cpp
+// SockAddr.cpp
// libraries/networking/src
//
// Created by Stephen Birarda on 11/26/2013.
// Copyright 2013 High Fidelity, Inc.
+// Copyright 2021 Vircadia contributors.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
-#include "HifiSockAddr.h"
+#include "SockAddr.h"
#include
#include
@@ -24,23 +25,23 @@
#include
#endif
-int hifiSockAddrMetaTypeId = qRegisterMetaType();
+int sockAddrMetaTypeId = qRegisterMetaType();
-HifiSockAddr::HifiSockAddr() :
+SockAddr::SockAddr() :
_address(),
_port(0)
{
}
-HifiSockAddr::HifiSockAddr(const QHostAddress& address, quint16 port) :
+SockAddr::SockAddr(const QHostAddress& address, quint16 port) :
_address(address),
_port(port)
{
}
-HifiSockAddr::HifiSockAddr(const HifiSockAddr& otherSockAddr) :
+SockAddr::SockAddr(const SockAddr& otherSockAddr) :
QObject(),
_address(otherSockAddr._address),
_port(otherSockAddr._port)
@@ -48,14 +49,14 @@ HifiSockAddr::HifiSockAddr(const HifiSockAddr& otherSockAddr) :
setObjectName(otherSockAddr.objectName());
}
-HifiSockAddr& HifiSockAddr::operator=(const HifiSockAddr& rhsSockAddr) {
+SockAddr& SockAddr::operator=(const SockAddr& rhsSockAddr) {
setObjectName(rhsSockAddr.objectName());
_address = rhsSockAddr._address;
_port = rhsSockAddr._port;
return *this;
}
-HifiSockAddr::HifiSockAddr(const QString& hostname, quint16 hostOrderPort, bool shouldBlockForLookup) :
+SockAddr::SockAddr(const QString& hostname, quint16 hostOrderPort, bool shouldBlockForLookup) :
_address(hostname),
_port(hostOrderPort)
{
@@ -73,7 +74,7 @@ HifiSockAddr::HifiSockAddr(const QString& hostname, quint16 hostOrderPort, bool
}
}
-HifiSockAddr::HifiSockAddr(const sockaddr* sockaddr) {
+SockAddr::SockAddr(const sockaddr* sockaddr) {
_address = QHostAddress(sockaddr);
if (sockaddr->sa_family == AF_INET) {
@@ -83,7 +84,7 @@ HifiSockAddr::HifiSockAddr(const sockaddr* sockaddr) {
}
}
-void HifiSockAddr::swap(HifiSockAddr& otherSockAddr) {
+void SockAddr::swap(SockAddr& otherSockAddr) {
using std::swap;
swap(_address, otherSockAddr._address);
@@ -95,11 +96,11 @@ void HifiSockAddr::swap(HifiSockAddr& otherSockAddr) {
setObjectName(temp);
}
-bool HifiSockAddr::operator==(const HifiSockAddr& rhsSockAddr) const {
+bool SockAddr::operator==(const SockAddr& rhsSockAddr) const {
return _address == rhsSockAddr._address && _port == rhsSockAddr._port;
}
-void HifiSockAddr::handleLookupResult(const QHostInfo& hostInfo) {
+void SockAddr::handleLookupResult(const QHostInfo& hostInfo) {
if (hostInfo.error() != QHostInfo::NoError) {
qCDebug(networking) << "Lookup failed for" << hostInfo.lookupId() << ":" << hostInfo.errorString();
emit lookupFailed();
@@ -117,11 +118,11 @@ void HifiSockAddr::handleLookupResult(const QHostInfo& hostInfo) {
}
}
-QString HifiSockAddr::toString() const {
+QString SockAddr::toString() const {
return _address.toString() + ":" + QString::number(_port);
}
-bool HifiSockAddr::hasPrivateAddress() const {
+bool SockAddr::hasPrivateAddress() const {
// an address is private if it is loopback or falls in any of the RFC1918 address spaces
const QPair TWENTY_FOUR_BIT_BLOCK = { QHostAddress("10.0.0.0"), 8 };
const QPair TWENTY_BIT_BLOCK = { QHostAddress("172.16.0.0") , 12 };
@@ -133,22 +134,22 @@ bool HifiSockAddr::hasPrivateAddress() const {
|| _address.isInSubnet(SIXTEEN_BIT_BLOCK);
}
-QDebug operator<<(QDebug debug, const HifiSockAddr& sockAddr) {
+QDebug operator<<(QDebug debug, const SockAddr& sockAddr) {
debug.nospace() << sockAddr._address.toString().toLocal8Bit().constData() << ":" << sockAddr._port;
return debug.space();
}
-QDataStream& operator<<(QDataStream& dataStream, const HifiSockAddr& sockAddr) {
+QDataStream& operator<<(QDataStream& dataStream, const SockAddr& sockAddr) {
dataStream << sockAddr._address << sockAddr._port;
return dataStream;
}
-QDataStream& operator>>(QDataStream& dataStream, HifiSockAddr& sockAddr) {
+QDataStream& operator>>(QDataStream& dataStream, SockAddr& sockAddr) {
dataStream >> sockAddr._address >> sockAddr._port;
return dataStream;
}
-uint qHash(const HifiSockAddr& key, uint seed) {
+uint qHash(const SockAddr& key, uint seed) {
// use the existing QHostAddress and quint16 hash functions to get our hash
return qHash(key.getAddress(), seed) ^ qHash(key.getPort(), seed);
}
diff --git a/libraries/networking/src/HifiSockAddr.h b/libraries/networking/src/SockAddr.h
similarity index 64%
rename from libraries/networking/src/HifiSockAddr.h
rename to libraries/networking/src/SockAddr.h
index dcf7f9a6a9..07b3e8c306 100644
--- a/libraries/networking/src/HifiSockAddr.h
+++ b/libraries/networking/src/SockAddr.h
@@ -1,16 +1,17 @@
//
-// HifiSockAddr.h
+// SockAddr.h
// libraries/networking/src
//
// Created by Stephen Birarda on 11/26/2013.
// Copyright 2013 High Fidelity, Inc.
+// Copyright 2021 Vircadia contributors.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
-#ifndef hifi_HifiSockAddr_h
-#define hifi_HifiSockAddr_h
+#ifndef hifi_SockAddr_h
+#define hifi_SockAddr_h
#include
#include
@@ -19,23 +20,23 @@ struct sockaddr;
#include
-class HifiSockAddr : public QObject {
+class SockAddr : public QObject {
Q_OBJECT
public:
- HifiSockAddr();
- HifiSockAddr(const QHostAddress& address, quint16 port);
- HifiSockAddr(const HifiSockAddr& otherSockAddr);
- HifiSockAddr(const QString& hostname, quint16 hostOrderPort, bool shouldBlockForLookup = false);
- HifiSockAddr(const sockaddr* sockaddr);
+ SockAddr();
+ SockAddr(const QHostAddress& address, quint16 port);
+ SockAddr(const SockAddr& otherSockAddr);
+ SockAddr(const QString& hostname, quint16 hostOrderPort, bool shouldBlockForLookup = false);
+ SockAddr(const sockaddr* sockaddr);
bool isNull() const { return _address.isNull() && _port == 0; }
void clear() { _address.clear(); _port = 0;}
- HifiSockAddr& operator=(const HifiSockAddr& rhsSockAddr);
- void swap(HifiSockAddr& otherSockAddr);
+ SockAddr& operator=(const SockAddr& rhsSockAddr);
+ void swap(SockAddr& otherSockAddr);
- bool operator==(const HifiSockAddr& rhsSockAddr) const;
- bool operator!=(const HifiSockAddr& rhsSockAddr) const { return !(*this == rhsSockAddr); }
+ bool operator==(const SockAddr& rhsSockAddr) const;
+ bool operator!=(const SockAddr& rhsSockAddr) const { return !(*this == rhsSockAddr); }
const QHostAddress& getAddress() const { return _address; }
QHostAddress* getAddressPointer() { return &_address; }
@@ -45,16 +46,16 @@ public:
quint16* getPortPointer() { return &_port; }
void setPort(quint16 port) { _port = port; }
- static int packSockAddr(unsigned char* packetData, const HifiSockAddr& packSockAddr);
- static int unpackSockAddr(const unsigned char* packetData, HifiSockAddr& unpackDestSockAddr);
+ static int packSockAddr(unsigned char* packetData, const SockAddr& packSockAddr);
+ static int unpackSockAddr(const unsigned char* packetData, SockAddr& unpackDestSockAddr);
QString toString() const;
bool hasPrivateAddress() const; // checks if the address behind this sock addr is private per RFC 1918
- friend QDebug operator<<(QDebug debug, const HifiSockAddr& sockAddr);
- friend QDataStream& operator<<(QDataStream& dataStream, const HifiSockAddr& sockAddr);
- friend QDataStream& operator>>(QDataStream& dataStream, HifiSockAddr& sockAddr);
+ friend QDebug operator<<(QDebug debug, const SockAddr& sockAddr);
+ friend QDataStream& operator<<(QDataStream& dataStream, const SockAddr& sockAddr);
+ friend QDataStream& operator>>(QDataStream& dataStream, SockAddr& sockAddr);
private slots:
void handleLookupResult(const QHostInfo& hostInfo);
@@ -66,14 +67,14 @@ private:
quint16 _port;
};
-uint qHash(const HifiSockAddr& key, uint seed);
+uint qHash(const SockAddr& key, uint seed);
namespace std {
template <>
- struct hash {
+ struct hash {
// NOTE: this hashing specifically ignores IPv6 addresses - if we begin to support those we will need
// to conditionally hash the bytes that represent an IPv6 address
- size_t operator()(const HifiSockAddr& sockAddr) const {
+ size_t operator()(const SockAddr& sockAddr) const {
// use XOR of implemented std::hash templates for new hash
// depending on the type of address we're looking at
@@ -90,6 +91,6 @@ namespace std {
};
}
-Q_DECLARE_METATYPE(HifiSockAddr);
+Q_DECLARE_METATYPE(SockAddr);
-#endif // hifi_HifiSockAddr_h
+#endif // hifi_SockAddr_h
diff --git a/libraries/networking/src/udt/BasePacket.cpp b/libraries/networking/src/udt/BasePacket.cpp
index 12a174b7d3..442ed8a2c8 100644
--- a/libraries/networking/src/udt/BasePacket.cpp
+++ b/libraries/networking/src/udt/BasePacket.cpp
@@ -4,6 +4,7 @@
//
// Created by Stephen Birarda on 2015-07-23.
// Copyright 2015 High Fidelity, Inc.
+// Copyright 2021 Vircadia contributors.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@@ -36,7 +37,7 @@ std::unique_ptr BasePacket::create(qint64 size) {
}
std::unique_ptr BasePacket::fromReceivedPacket(std::unique_ptr data,
- qint64 size, const HifiSockAddr& senderSockAddr) {
+ qint64 size, const SockAddr& senderSockAddr) {
// Fail with invalid size
Q_ASSERT(size >= 0);
@@ -66,7 +67,7 @@ BasePacket::BasePacket(qint64 size) {
_payloadStart = _packet.get();
}
-BasePacket::BasePacket(std::unique_ptr data, qint64 size, const HifiSockAddr& senderSockAddr) :
+BasePacket::BasePacket(std::unique_ptr data, qint64 size, const SockAddr& senderSockAddr) :
_packetSize(size),
_packet(std::move(data)),
_payloadStart(_packet.get()),
diff --git a/libraries/networking/src/udt/BasePacket.h b/libraries/networking/src/udt/BasePacket.h
index 4981cb4720..b196f5de24 100644
--- a/libraries/networking/src/udt/BasePacket.h
+++ b/libraries/networking/src/udt/BasePacket.h
@@ -4,6 +4,7 @@
//
// Created by Stephen Birarda on 2015-07-23.
// Copyright 2015 High Fidelity, Inc.
+// Copyright 2021 Vircadia contributors.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@@ -18,7 +19,7 @@
#include
-#include "../HifiSockAddr.h"
+#include "../SockAddr.h"
#include "Constants.h"
#include "../ExtendedIODevice.h"
@@ -31,7 +32,7 @@ public:
static std::unique_ptr create(qint64 size = -1);
static std::unique_ptr fromReceivedPacket(std::unique_ptr data, qint64 size,
- const HifiSockAddr& senderSockAddr);
+ const SockAddr& senderSockAddr);
// Current level's header size
static int localHeaderSize();
@@ -66,8 +67,8 @@ public:
qint64 bytesLeftToRead() const { return _payloadSize - pos(); }
qint64 bytesAvailableForWrite() const { return _payloadCapacity - pos(); }
- HifiSockAddr& getSenderSockAddr() { return _senderSockAddr; }
- const HifiSockAddr& getSenderSockAddr() const { return _senderSockAddr; }
+ SockAddr& getSenderSockAddr() { return _senderSockAddr; }
+ const SockAddr& getSenderSockAddr() const { return _senderSockAddr; }
// QIODevice virtual functions
// WARNING: Those methods all refer to the payload ONLY and NOT the entire packet
@@ -87,7 +88,7 @@ public:
protected:
BasePacket(qint64 size);
- BasePacket(std::unique_ptr data, qint64 size, const HifiSockAddr& senderSockAddr);
+ BasePacket(std::unique_ptr data, qint64 size, const SockAddr& senderSockAddr);
BasePacket(const BasePacket& other) : ExtendedIODevice() { *this = other; }
BasePacket& operator=(const BasePacket& other);
BasePacket(BasePacket&& other);
@@ -107,7 +108,7 @@ protected:
qint64 _payloadSize = 0; // How much of the payload is actually used
- HifiSockAddr _senderSockAddr; // sender address for packet (only used on receiving end)
+ SockAddr _senderSockAddr; // sender address for packet (only used on receiving end)
p_high_resolution_clock::time_point _receiveTime; // captures the time the packet received (only used on receiving end)
};
diff --git a/libraries/networking/src/udt/Connection.cpp b/libraries/networking/src/udt/Connection.cpp
index 338b95163f..66bf3f6613 100644
--- a/libraries/networking/src/udt/Connection.cpp
+++ b/libraries/networking/src/udt/Connection.cpp
@@ -4,6 +4,7 @@
//
// Created by Clement on 7/27/15.
// Copyright 2015 High Fidelity, Inc.
+// Copyright 2021 Vircadia contributors.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@@ -17,7 +18,7 @@
#include
-#include "../HifiSockAddr.h"
+#include "../SockAddr.h"
#include "../NetworkLogging.h"
#include "CongestionControl.h"
@@ -30,7 +31,7 @@
using namespace udt;
using namespace std::chrono;
-Connection::Connection(Socket* parentSocket, HifiSockAddr destination, std::unique_ptr congestionControl) :
+Connection::Connection(Socket* parentSocket, SockAddr destination, std::unique_ptr congestionControl) :
_parentSocket(parentSocket),
_destination(destination),
_congestionControl(move(congestionControl))
@@ -485,7 +486,7 @@ std::unique_ptr PendingReceivedMessage::removeNextPacket() {
return std::unique_ptr();
}
-void Connection::setDestinationAddress(const HifiSockAddr& destination) {
+void Connection::setDestinationAddress(const SockAddr& destination) {
if (_destination != destination) {
_destination = destination;
emit destinationAddressChange(destination);
diff --git a/libraries/networking/src/udt/Connection.h b/libraries/networking/src/udt/Connection.h
index 00d5beb5ab..2869b7f57d 100644
--- a/libraries/networking/src/udt/Connection.h
+++ b/libraries/networking/src/udt/Connection.h
@@ -4,6 +4,7 @@
//
// Created by Clement on 7/27/15.
// Copyright 2015 High Fidelity, Inc.
+// Copyright 2021 Vircadia contributors.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@@ -23,7 +24,7 @@
#include "Constants.h"
#include "LossList.h"
#include "SendQueue.h"
-#include "../HifiSockAddr.h"
+#include "../SockAddr.h"
namespace udt {
@@ -52,7 +53,7 @@ class Connection : public QObject {
public:
using ControlPacketPointer = std::unique_ptr;
- Connection(Socket* parentSocket, HifiSockAddr destination, std::unique_ptr congestionControl);
+ Connection(Socket* parentSocket, SockAddr destination, std::unique_ptr congestionControl);
virtual ~Connection();
void sendReliablePacket(std::unique_ptr packet);
@@ -68,7 +69,7 @@ public:
ConnectionStats::Stats sampleStats() { return _stats.sample(); }
- HifiSockAddr getDestination() const { return _destination; }
+ SockAddr getDestination() const { return _destination; }
void setMaxBandwidth(int maxBandwidth);
@@ -77,12 +78,12 @@ public:
void recordSentUnreliablePackets(int wireSize, int payloadSize);
void recordReceivedUnreliablePackets(int wireSize, int payloadSize);
- void setDestinationAddress(const HifiSockAddr& destination);
+ void setDestinationAddress(const SockAddr& destination);
signals:
void packetSent();
- void receiverHandshakeRequestComplete(const HifiSockAddr& sockAddr);
- void destinationAddressChange(HifiSockAddr currentAddress);
+ void receiverHandshakeRequestComplete(const SockAddr& sockAddr);
+ void destinationAddressChange(SockAddr currentAddress);
private slots:
void recordSentPackets(int wireSize, int payloadSize, SequenceNumber seqNum, p_high_resolution_clock::time_point timePoint);
@@ -124,7 +125,7 @@ private:
SequenceNumber _lastReceivedACK; // The last ACK received
Socket* _parentSocket { nullptr };
- HifiSockAddr _destination;
+ SockAddr _destination;
std::unique_ptr _congestionControl;
diff --git a/libraries/networking/src/udt/ControlPacket.cpp b/libraries/networking/src/udt/ControlPacket.cpp
index 6fdefd36f6..b56f455030 100644
--- a/libraries/networking/src/udt/ControlPacket.cpp
+++ b/libraries/networking/src/udt/ControlPacket.cpp
@@ -4,6 +4,7 @@
//
// Created by Stephen Birarda on 2015-07-24.
// Copyright 2015 High Fidelity, Inc.
+// Copyright 2021 Vircadia contributors.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@@ -26,7 +27,7 @@ int ControlPacket::maxPayloadSize() {
}
std::unique_ptr ControlPacket::fromReceivedPacket(std::unique_ptr data, qint64 size,
- const HifiSockAddr &senderSockAddr) {
+ const SockAddr &senderSockAddr) {
// Fail with null data
Q_ASSERT(data);
@@ -56,7 +57,7 @@ ControlPacket::ControlPacket(Type type, qint64 size) :
writeType();
}
-ControlPacket::ControlPacket(std::unique_ptr data, qint64 size, const HifiSockAddr& senderSockAddr) :
+ControlPacket::ControlPacket(std::unique_ptr data, qint64 size, const SockAddr& senderSockAddr) :
BasePacket(std::move(data), size, senderSockAddr)
{
// sanity check before we decrease the payloadSize with the payloadCapacity
diff --git a/libraries/networking/src/udt/ControlPacket.h b/libraries/networking/src/udt/ControlPacket.h
index 46b9cdbd40..772df41455 100644
--- a/libraries/networking/src/udt/ControlPacket.h
+++ b/libraries/networking/src/udt/ControlPacket.h
@@ -4,6 +4,7 @@
//
// Created by Stephen Birarda on 2015-07-24.
// Copyright 2015 High Fidelity, Inc.
+// Copyright 2021 Vircadia contributors.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@@ -35,7 +36,7 @@ public:
static std::unique_ptr create(Type type, qint64 size = -1);
static std::unique_ptr fromReceivedPacket(std::unique_ptr data, qint64 size,
- const HifiSockAddr& senderSockAddr);
+ const SockAddr& senderSockAddr);
// Current level's header size
static int localHeaderSize();
// Cumulated size of all the headers
@@ -48,7 +49,7 @@ public:
private:
ControlPacket(Type type, qint64 size = -1);
- ControlPacket(std::unique_ptr data, qint64 size, const HifiSockAddr& senderSockAddr);
+ ControlPacket(std::unique_ptr data, qint64 size, const SockAddr& senderSockAddr);
ControlPacket(ControlPacket&& other);
ControlPacket(const ControlPacket& other) = delete;
diff --git a/libraries/networking/src/udt/Packet.cpp b/libraries/networking/src/udt/Packet.cpp
index f8b74cea37..8c8f72457c 100644
--- a/libraries/networking/src/udt/Packet.cpp
+++ b/libraries/networking/src/udt/Packet.cpp
@@ -4,6 +4,7 @@
//
// Created by Clement on 7/2/15.
// Copyright 2015 High Fidelity, Inc.
+// Copyright 2021 Vircadia contributors.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@@ -61,7 +62,7 @@ std::unique_ptr Packet::create(qint64 size, bool isReliable, bool isPart
return packet;
}
-std::unique_ptr