Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 43 additions & 2 deletions interface/resources/qml/hifi/avatarapp/Settings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,14 @@ Rectangle {
Layout.alignment: Qt.AlignVCenter
}
}
}

RowLayout {
id: avatarScaleButtonsRow
anchors.top: avatarScaleRow.bottom

ShadowRectangle {
width: 37
width: 31
height: 28
AvatarAppStyle {
id: style
Expand All @@ -203,7 +208,43 @@ Rectangle {
MouseArea {
anchors.fill: parent
onClicked: {
scaleSlider.value = 10
scaleSlider.notify = false;
scaleSlider.value = 10;
scaleSlider.notify = true;
root.scaleChanged(1.0);
}
}
}

ShadowRectangle {
width: 107
height: 28
AvatarAppStyle {
id: style2
}

gradient: Gradient {
GradientStop { position: 0.0; color: style2.colors.blueHighlight }
GradientStop { position: 1.0; color: style2.colors.blueAccent }
}

radius: 3

RalewaySemiBold {
color: 'white'
anchors.centerIn: parent
text: "Real Height"
size: 18
}

MouseArea {
anchors.fill: parent
onClicked: {
scaleValue = MyAvatar.getAutoAvatarScale();
scaleSlider.notify = false;
scaleSlider.value = Math.round(scaleValue * 10);
scaleSlider.notify = true;
root.scaleChanged(scaleValue);
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions interface/src/avatar/MyAvatar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4566,6 +4566,12 @@ float MyAvatar::getAvatarScale() {
return getTargetScale();
}

// Gets the scale for the avatar that makes the avatar's eye height match the user's real-world eye height
// (derived from the 'User real world height' Interface setting).
float MyAvatar::getAutoAvatarScale() const {
return getUserEyeHeight() / getUnscaledEyeHeight();
}

void MyAvatar::setAvatarScale(float val) {

if (QThread::currentThread() != thread()) {
Expand Down
8 changes: 8 additions & 0 deletions interface/src/avatar/MyAvatar.h
Original file line number Diff line number Diff line change
Expand Up @@ -1598,6 +1598,14 @@ class MyAvatar : public Avatar {
*/
Q_INVOKABLE float getAvatarScale();

/**jsdoc
* Gets the scale for the avatar that makes the avatar's eye height match the user's real-world eye height (derived from
* the "User real world height" Interface setting).
* @function MyAvatar.getAutoAvatarScale
* @returns {number} The scale for the avatar that makes the avatar's eye height match the user's real-world eye height.
*/
Q_INVOKABLE float getAutoAvatarScale() 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.
Expand Down