Mass renaming to be more logical/concise.

FloatingUIPanel -> OverlayPanel
anchorPosition -> position
offsetRotation -> rotation
facingRotation -> offsetRotation
floatingUIExample.js -> overlayPanelExample.js
This commit is contained in:
Zander Otavka 2015-08-06 14:23:04 -07:00
parent 6165e7e6ca
commit b94be926f8
9 changed files with 139 additions and 150 deletions

View file

@ -5,7 +5,7 @@
// Created by Zander Otavka on 7/15/15.
// Copyright 2015 High Fidelity, Inc.
//
// Shows a few common controls in a FloatingUIPanel on right click.
// Shows a few common controls in a OverlayPanel on right click.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@ -22,10 +22,10 @@ var MIC_IMAGE_URL = HIFI_PUBLIC_BUCKET + "images/tools/mic-toggle.svg";
var FACE_IMAGE_URL = HIFI_PUBLIC_BUCKET + "images/tools/face-toggle.svg";
var ADDRESS_BAR_IMAGE_URL = HIFI_PUBLIC_BUCKET + "images/tools/address-bar-toggle.svg";
var panel = new FloatingUIPanel({
anchorPositionBinding: { avatar: "MyAvatar" },
var panel = new OverlayPanel({
positionBinding: { avatar: "MyAvatar" },
offsetPosition: { x: 0, y: 0.4, z: 1 },
facingRotation: { w: 0, x: 0, y: 1, z: 0 }
offsetRotation: { w: 0, x: 0, y: 1, z: 0 }
});
var background = new Image3DOverlay({
@ -192,7 +192,7 @@ function onMouseUp(event) {
if (event.isRightButton && Vec3.distance(mouseDown.pos, { x: event.x, y: event.y }) < 10) {
panel.setProperties({
visible: !panel.visible,
offsetRotation: Quat.multiply(MyAvatar.orientation, { x: 0, y: 1, z: 0, w: 0 })
rotation: Quat.multiply(MyAvatar.orientation, { x: 0, y: 1, z: 0, w: 0 })
});
}

View file

@ -1,5 +1,5 @@
//
// floatingUI.js
// overlayPanelExample.js
// examples/example/ui
//
// Created by Alexander Otavka
@ -18,14 +18,14 @@ var BG_IMAGE_URL = HIFI_PUBLIC_BUCKET + "images/card-bg.svg";
var RED_DOT_IMAGE_URL = HIFI_PUBLIC_BUCKET + "images/red-dot.svg";
var BLUE_SQUARE_IMAGE_URL = HIFI_PUBLIC_BUCKET + "images/blue-square.svg";
var mainPanel = new FloatingUIPanel({
anchorPositionBinding: { avatar: "MyAvatar" },
offsetRotation: { w: 1, x: 0, y: 0, z: 0 },
var mainPanel = new OverlayPanel({
positionBinding: { avatar: "MyAvatar" },
rotation: { w: 1, x: 0, y: 0, z: 0 },
offsetPosition: { x: 0, y: 0.4, z: 1 },
facingRotation: { w: 0, x: 0, y: 1, z: 0 }
offsetRotation: { w: 0, x: 0, y: 1, z: 0 }
});
var bluePanel = mainPanel.addChild(new FloatingUIPanel ({
var bluePanel = mainPanel.addChild(new OverlayPanel ({
offsetPosition: { x: 0.1, y: 0.1, z: 0.2 }
}));

View file

@ -95,7 +95,7 @@
if (!Overlays.isAddedPanel(id)) {
return null;
}
var panel = new FloatingUIPanel();
var panel = new OverlayPanel();
panel._id = id;
overlays[id] = overlay;
return overlay;
@ -234,7 +234,7 @@
// Supports multiple inheritance of properties. Just `concat` them onto the end of the
// properties list.
var PANEL_ATTACHABLE_FIELDS = ["offsetPosition", "facingRotation"];
var PANEL_ATTACHABLE_FIELDS = ["offsetPosition", "offsetRotation"];
Overlay = (function() {
var that = function(type, params) {
@ -374,7 +374,7 @@
//
// Object oriented abstraction layer for panels.
//
FloatingUIPanel = (function() {
OverlayPanel = (function() {
var that = function(params) {
this._id = Overlays.addPanel(params);
panels[this._id] = this;
@ -383,8 +383,8 @@
that.prototype.constructor = that;
[
"anchorPosition", "anchorPositionBinding", "offsetRotation", "offsetRotationBinding",
"offsetPosition", "facingRotation", "visible"
"position", "positionBinding", "rotation", "rotationBinding",
"offsetPosition", "offsetRotation", "visible"
].forEach(function(prop) {
Object.defineProperty(that.prototype, prop, {
get: function() {

View file

@ -1,5 +1,5 @@
//
// FloatingUIPanel.cpp
// OverlayPanel.cpp
// interface/src/ui/overlays
//
// Created by Zander Otavka on 7/2/15.
@ -9,7 +9,7 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "FloatingUIPanel.h"
#include "OverlayPanel.h"
#include <QVariant>
#include <RegisteredMetaTypes.h>
@ -21,42 +21,33 @@
#include "Application.h"
#include "Base3DOverlay.h"
glm::vec3 FloatingUIPanel::getComputedAnchorPosition() const {
glm::vec3 pos = {};
glm::vec3 OverlayPanel::getComputedPosition() const {
if (getAttachedPanel()) {
pos = getAttachedPanel()->getPosition();
} else if (_anchorPositionBindMyAvatar) {
pos = DependencyManager::get<AvatarManager>()->getMyAvatar()->getPosition();
} else if (!_anchorPositionBindEntity.isNull()) {
pos = DependencyManager::get<EntityScriptingInterface>()->getEntityTree()->
findEntityByID(_anchorPositionBindEntity)->getPosition();
return getAttachedPanel()->getComputedRotation() * getAttachedPanel()->getOffsetPosition() +
getAttachedPanel()->getComputedPosition();
} else if (_positionBindMyAvatar) {
return DependencyManager::get<AvatarManager>()->getMyAvatar()->getPosition();
} else if (!_positionBindEntity.isNull()) {
return DependencyManager::get<EntityScriptingInterface>()->getEntityTree()->
findEntityByID(_positionBindEntity)->getPosition();
}
return pos + getAnchorPosition();
return getPosition();
}
glm::quat FloatingUIPanel::getComputedOffsetRotation() const {
glm::quat rot = {1, 0, 0, 0};
glm::quat OverlayPanel::getComputedRotation() const {
if (getAttachedPanel()) {
rot = getAttachedPanel()->getRotation();
} else if (_offsetRotationBindMyAvatar) {
rot = DependencyManager::get<AvatarManager>()->getMyAvatar()->getOrientation() *
return getAttachedPanel()->getComputedRotation() * getAttachedPanel()->getFacingRotation();
} else if (_rotationBindMyAvatar) {
return DependencyManager::get<AvatarManager>()->getMyAvatar()->getOrientation() *
glm::angleAxis(glm::pi<float>(), IDENTITY_UP);
} else if (!_offsetRotationBindEntity.isNull()) {
rot = DependencyManager::get<EntityScriptingInterface>()->getEntityTree()->
findEntityByID(_offsetRotationBindEntity)->getRotation();
} else if (!_rotationBindEntity.isNull()) {
return DependencyManager::get<EntityScriptingInterface>()->getEntityTree()->
findEntityByID(_rotationBindEntity)->getRotation();
}
return rot * getOffsetRotation();
return getRotation();
}
glm::vec3 FloatingUIPanel::getPosition() const {
return getComputedOffsetRotation() * getOffsetPosition() + getComputedAnchorPosition();
}
glm::quat FloatingUIPanel::getRotation() const {
return getComputedOffsetRotation() * getFacingRotation();
}
bool FloatingUIPanel::getParentVisible() const {
bool OverlayPanel::getParentVisible() const {
if (getAttachedPanel()) {
return getAttachedPanel()->getVisible() && getAttachedPanel()->getParentVisible();
} else {
@ -64,53 +55,53 @@ bool FloatingUIPanel::getParentVisible() const {
}
}
void FloatingUIPanel::addChild(unsigned int childId) {
void OverlayPanel::addChild(unsigned int childId) {
if (!_children.contains(childId)) {
_children.append(childId);
}
}
void FloatingUIPanel::removeChild(unsigned int childId) {
void OverlayPanel::removeChild(unsigned int childId) {
if (_children.contains(childId)) {
_children.removeOne(childId);
}
}
QScriptValue FloatingUIPanel::getProperty(const QString &property) {
if (property == "anchorPosition") {
return vec3toScriptValue(_scriptEngine, getAnchorPosition());
QScriptValue OverlayPanel::getProperty(const QString &property) {
if (property == "position") {
return vec3toScriptValue(_scriptEngine, getPosition());
}
if (property == "anchorPositionBinding") {
if (property == "positionBinding") {
QScriptValue obj = _scriptEngine->newObject();
if (_anchorPositionBindMyAvatar) {
if (_positionBindMyAvatar) {
obj.setProperty("avatar", "MyAvatar");
} else if (!_anchorPositionBindEntity.isNull()) {
obj.setProperty("entity", _scriptEngine->newVariant(_anchorPositionBindEntity));
} else if (!_positionBindEntity.isNull()) {
obj.setProperty("entity", _scriptEngine->newVariant(_positionBindEntity));
}
obj.setProperty("computed", vec3toScriptValue(_scriptEngine, getComputedAnchorPosition()));
obj.setProperty("computed", vec3toScriptValue(_scriptEngine, getComputedPosition()));
return obj;
}
if (property == "offsetRotation") {
return quatToScriptValue(_scriptEngine, getOffsetRotation());
if (property == "rotation") {
return quatToScriptValue(_scriptEngine, getRotation());
}
if (property == "offsetRotationBinding") {
if (property == "rotationBinding") {
QScriptValue obj = _scriptEngine->newObject();
if (_offsetRotationBindMyAvatar) {
if (_rotationBindMyAvatar) {
obj.setProperty("avatar", "MyAvatar");
} else if (!_offsetRotationBindEntity.isNull()) {
obj.setProperty("entity", _scriptEngine->newVariant(_offsetRotationBindEntity));
} else if (!_rotationBindEntity.isNull()) {
obj.setProperty("entity", _scriptEngine->newVariant(_rotationBindEntity));
}
obj.setProperty("computed", quatToScriptValue(_scriptEngine, getComputedOffsetRotation()));
obj.setProperty("computed", quatToScriptValue(_scriptEngine, getComputedRotation()));
return obj;
}
if (property == "offsetPosition") {
return vec3toScriptValue(_scriptEngine, getOffsetPosition());
}
if (property == "facingRotation") {
if (property == "offsetRotation") {
return quatToScriptValue(_scriptEngine, getFacingRotation());
}
if (property == "visible") {
@ -127,42 +118,42 @@ QScriptValue FloatingUIPanel::getProperty(const QString &property) {
return QScriptValue();
}
void FloatingUIPanel::setProperties(const QScriptValue &properties) {
QScriptValue anchorPosition = properties.property("anchorPosition");
if (anchorPosition.isValid()) {
QScriptValue x = anchorPosition.property("x");
QScriptValue y = anchorPosition.property("y");
QScriptValue z = anchorPosition.property("z");
void OverlayPanel::setProperties(const QScriptValue &properties) {
QScriptValue position = properties.property("position");
if (position.isValid()) {
QScriptValue x = position.property("x");
QScriptValue y = position.property("y");
QScriptValue z = position.property("z");
if (x.isValid() && y.isValid() && z.isValid()) {
glm::vec3 newPosition;
newPosition.x = x.toVariant().toFloat();
newPosition.y = y.toVariant().toFloat();
newPosition.z = z.toVariant().toFloat();
setAnchorPosition(newPosition);
setPosition(newPosition);
}
}
QScriptValue anchorPositionBinding = properties.property("anchorPositionBinding");
if (anchorPositionBinding.isValid()) {
_anchorPositionBindMyAvatar = false;
_anchorPositionBindEntity = QUuid();
QScriptValue positionBinding = properties.property("positionBinding");
if (positionBinding.isValid()) {
_positionBindMyAvatar = false;
_positionBindEntity = QUuid();
QScriptValue avatar = anchorPositionBinding.property("avatar");
QScriptValue entity = anchorPositionBinding.property("entity");
QScriptValue avatar = positionBinding.property("avatar");
QScriptValue entity = positionBinding.property("entity");
if (avatar.isValid()) {
_anchorPositionBindMyAvatar = (avatar.toVariant().toString() == "MyAvatar");
_positionBindMyAvatar = (avatar.toVariant().toString() == "MyAvatar");
} else if (entity.isValid() && !entity.isNull()) {
_anchorPositionBindEntity = entity.toVariant().toUuid();
_positionBindEntity = entity.toVariant().toUuid();
}
}
QScriptValue offsetRotation = properties.property("offsetRotation");
if (offsetRotation.isValid()) {
QScriptValue x = offsetRotation.property("x");
QScriptValue y = offsetRotation.property("y");
QScriptValue z = offsetRotation.property("z");
QScriptValue w = offsetRotation.property("w");
QScriptValue rotation = properties.property("rotation");
if (rotation.isValid()) {
QScriptValue x = rotation.property("x");
QScriptValue y = rotation.property("y");
QScriptValue z = rotation.property("z");
QScriptValue w = rotation.property("w");
if (x.isValid() && y.isValid() && z.isValid() && w.isValid()) {
glm::quat newRotation;
@ -170,22 +161,22 @@ void FloatingUIPanel::setProperties(const QScriptValue &properties) {
newRotation.y = y.toVariant().toFloat();
newRotation.z = z.toVariant().toFloat();
newRotation.w = w.toVariant().toFloat();
setOffsetRotation(newRotation);
setRotation(newRotation);
}
}
QScriptValue offsetRotationBinding = properties.property("offsetRotationBinding");
if (offsetRotationBinding.isValid()) {
_offsetRotationBindMyAvatar = false;
_offsetRotationBindEntity = QUuid();
QScriptValue rotationBinding = properties.property("rotationBinding");
if (rotationBinding.isValid()) {
_rotationBindMyAvatar = false;
_rotationBindEntity = QUuid();
QScriptValue avatar = offsetRotationBinding.property("avatar");
QScriptValue entity = anchorPositionBinding.property("entity");
QScriptValue avatar = rotationBinding.property("avatar");
QScriptValue entity = positionBinding.property("entity");
if (avatar.isValid()) {
_offsetRotationBindMyAvatar = (avatar.toVariant().toString() == "MyAvatar");
_rotationBindMyAvatar = (avatar.toVariant().toString() == "MyAvatar");
} else if (entity.isValid() && !entity.isNull()) {
_offsetRotationBindEntity = entity.toVariant().toUuid();
_rotationBindEntity = entity.toVariant().toUuid();
}
}
@ -203,12 +194,12 @@ void FloatingUIPanel::setProperties(const QScriptValue &properties) {
}
}
QScriptValue facingRotation = properties.property("facingRotation");
if (facingRotation.isValid()) {
QScriptValue x = facingRotation.property("x");
QScriptValue y = facingRotation.property("y");
QScriptValue z = facingRotation.property("z");
QScriptValue w = facingRotation.property("w");
QScriptValue offsetRotation = properties.property("offsetRotation");
if (offsetRotation.isValid()) {
QScriptValue x = offsetRotation.property("x");
QScriptValue y = offsetRotation.property("y");
QScriptValue z = offsetRotation.property("z");
QScriptValue w = offsetRotation.property("w");
if (x.isValid() && y.isValid() && z.isValid() && w.isValid()) {
glm::quat newRotation;

View file

@ -1,5 +1,5 @@
//
// FloatingUIPanel.h
// OverlayPanel.h
// interface/src/ui/overlays
//
// Created by Zander Otavka on 7/2/15.
@ -9,8 +9,8 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#ifndef hifi_FloatingUIPanel_h
#define hifi_FloatingUIPanel_h
#ifndef hifi_OverlayPanel_h
#define hifi_OverlayPanel_h
#include <memory>
@ -19,32 +19,30 @@
#include <QScriptValue>
#include <QUuid>
class FloatingUIPanel : public QObject {
class OverlayPanel : public QObject {
Q_OBJECT
public:
typedef std::shared_ptr<FloatingUIPanel> Pointer;
typedef std::shared_ptr<OverlayPanel> Pointer;
void init(QScriptEngine* scriptEngine) { _scriptEngine = scriptEngine; }
// getters
glm::vec3 getAnchorPosition() const { return _anchorPosition; }
glm::vec3 getComputedAnchorPosition() const;
glm::quat getOffsetRotation() const { return _offsetRotation; }
glm::quat getComputedOffsetRotation() const;
glm::vec3 getPosition() const { return _position; }
glm::vec3 getComputedPosition() const;
glm::quat getRotation() const { return _rotation; }
glm::quat getComputedRotation() const;
glm::vec3 getOffsetPosition() const { return _offsetPosition; }
glm::quat getFacingRotation() const { return _facingRotation; }
glm::vec3 getPosition() const;
glm::quat getRotation() const;
glm::quat getFacingRotation() const { return _offsetRotation; }
Pointer getAttachedPanel() const { return _attachedPanel; }
bool getVisible() const { return _visible; }
bool getParentVisible() const;
// setters
void setAnchorPosition(const glm::vec3& position) { _anchorPosition = position; }
void setOffsetRotation(const glm::quat& rotation) { _offsetRotation = rotation; }
void setPosition(const glm::vec3& position) { _position = position; }
void setRotation(const glm::quat& rotation) { _rotation = rotation; }
void setOffsetPosition(const glm::vec3& position) { _offsetPosition = position; }
void setFacingRotation(const glm::quat& rotation) { _facingRotation = rotation; }
void setFacingRotation(const glm::quat& rotation) { _offsetRotation = rotation; }
void setAttachedPanel(Pointer panel) { _attachedPanel = panel; }
void setVisible(bool visible) { _visible = visible; }
@ -57,16 +55,16 @@ public:
void setProperties(const QScriptValue& properties);
private:
glm::vec3 _anchorPosition = {0, 0, 0};
glm::quat _offsetRotation = {1, 0, 0, 0};
glm::vec3 _position = {0, 0, 0};
glm::quat _rotation = {1, 0, 0, 0};
glm::vec3 _offsetPosition = {0, 0, 0};
glm::quat _facingRotation = {1, 0, 0, 0};
glm::quat _offsetRotation = {1, 0, 0, 0};
bool _anchorPositionBindMyAvatar = false;
QUuid _anchorPositionBindEntity;
bool _positionBindMyAvatar = false;
QUuid _positionBindEntity;
bool _offsetRotationBindMyAvatar = false;
QUuid _offsetRotationBindEntity;
bool _rotationBindMyAvatar = false;
QUuid _rotationBindEntity;
Pointer _attachedPanel = nullptr;
QList<unsigned int> _children;
@ -75,4 +73,4 @@ private:
QScriptEngine* _scriptEngine;
};
#endif // hifi_FloatingUIPanel_h
#endif // hifi_OverlayPanel_h

View file

@ -303,7 +303,7 @@ void Overlays::setAttachedPanel(unsigned int childId, unsigned int panelId) {
}
}
} else if (_panels.contains(childId)) {
FloatingUIPanel::Pointer child = getPanel(childId);
OverlayPanel::Pointer child = getPanel(childId);
if (_panels.contains(panelId)) {
auto panel = getPanel(panelId);
panel->addChild(childId);
@ -531,7 +531,7 @@ QSizeF Overlays::textSize(unsigned int id, const QString& text) const {
return QSizeF(0.0f, 0.0f);
}
unsigned int Overlays::addPanel(FloatingUIPanel::Pointer panel) {
unsigned int Overlays::addPanel(OverlayPanel::Pointer panel) {
QWriteLocker lock(&_lock);
unsigned int thisID = _nextOverlayID;
@ -542,7 +542,7 @@ unsigned int Overlays::addPanel(FloatingUIPanel::Pointer panel) {
}
unsigned int Overlays::addPanel(const QScriptValue& properties) {
FloatingUIPanel::Pointer panel = std::make_shared<FloatingUIPanel>();
OverlayPanel::Pointer panel = std::make_shared<OverlayPanel>();
panel->init(_scriptEngine);
panel->setProperties(properties);
return addPanel(panel);
@ -557,7 +557,7 @@ void Overlays::editPanel(unsigned int panelId, const QScriptValue& properties) {
OverlayPropertyResult Overlays::getPanelProperty(unsigned int panelId, const QString& property) {
OverlayPropertyResult result;
if (_panels.contains(panelId)) {
FloatingUIPanel::Pointer thisPanel = getPanel(panelId);
OverlayPanel::Pointer thisPanel = getPanel(panelId);
QReadLocker lock(&_lock);
result.value = thisPanel->getProperty(property);
}
@ -566,7 +566,7 @@ OverlayPropertyResult Overlays::getPanelProperty(unsigned int panelId, const QSt
void Overlays::deletePanel(unsigned int panelId) {
FloatingUIPanel::Pointer panelToDelete;
OverlayPanel::Pointer panelToDelete;
{
QWriteLocker lock(&_lock);

View file

@ -5,7 +5,7 @@
// Modified by Zander Otavka on 7/15/15
// Copyright 2014 High Fidelity, Inc.
//
// Exposes methods for managing `Overlay`s and `FloatingUIPanel`s to scripts.
// Exposes methods for managing `Overlay`s and `OverlayPanel`s to scripts.
//
// YOU SHOULD NOT USE `Overlays` DIRECTLY, unless you like pain and deprecation. Instead, use the
// object oriented abstraction layer found in `examples/libraries/overlayUtils.js`.
@ -22,7 +22,7 @@
#include "Overlay.h"
#include "FloatingUIPanel.h"
#include "OverlayPanel.h"
#include "PanelAttachable.h"
class PickRay;
@ -67,7 +67,7 @@ public:
void renderHUD(RenderArgs* renderArgs);
Overlay::Pointer getOverlay(unsigned int id) const;
FloatingUIPanel::Pointer getPanel(unsigned int id) const { return _panels[id]; }
OverlayPanel::Pointer getPanel(unsigned int id) const { return _panels[id]; }
public slots:
/// adds an overlay with the specific properties
@ -111,7 +111,7 @@ public slots:
/// adds a panel that has already been created
unsigned int addPanel(FloatingUIPanel::Pointer panel);
unsigned int addPanel(OverlayPanel::Pointer panel);
/// creates and adds a panel based on a set of properties
unsigned int addPanel(const QScriptValue& properties);
@ -140,7 +140,7 @@ private:
QMap<unsigned int, Overlay::Pointer> _overlaysHUD;
QMap<unsigned int, Overlay::Pointer> _overlaysWorld;
QMap<unsigned int, FloatingUIPanel::Pointer> _panels;
QMap<unsigned int, OverlayPanel::Pointer> _panels;
QList<Overlay::Pointer> _overlaysToDelete;
unsigned int _nextOverlayID;

View file

@ -16,14 +16,14 @@
PanelAttachable::PanelAttachable() :
_attachedPanel(nullptr),
_offsetPosition(0, 0, 0),
_facingRotation(1, 0, 0, 0)
_offsetRotation(1, 0, 0, 0)
{
}
PanelAttachable::PanelAttachable(const PanelAttachable* panelAttachable) :
_attachedPanel(panelAttachable->_attachedPanel),
_offsetPosition(panelAttachable->_offsetPosition),
_facingRotation(panelAttachable->_facingRotation)
_offsetRotation(panelAttachable->_offsetRotation)
{
}
@ -37,8 +37,8 @@ bool PanelAttachable::getParentVisible() const {
void PanelAttachable::setTransforms(Transform& transform) {
if (getAttachedPanel()) {
transform.setTranslation(getAttachedPanel()->getComputedAnchorPosition());
transform.setRotation(getAttachedPanel()->getComputedOffsetRotation());
transform.setTranslation(getAttachedPanel()->getComputedPosition());
transform.setRotation(getAttachedPanel()->getComputedRotation());
transform.postTranslate(getAttachedPanel()->getOffsetPosition());
transform.postRotate(getAttachedPanel()->getFacingRotation());
transform.postTranslate(getOffsetPosition());
@ -50,7 +50,7 @@ QScriptValue PanelAttachable::getProperty(QScriptEngine* scriptEngine, const QSt
if (property == "offsetPosition") {
return vec3toScriptValue(scriptEngine, getOffsetPosition());
}
if (property == "facingRotation") {
if (property == "offsetRotation") {
return quatToScriptValue(scriptEngine, getFacingRotation());
}
return QScriptValue();
@ -72,12 +72,12 @@ void PanelAttachable::setProperties(const QScriptValue &properties) {
}
}
QScriptValue facingRotation = properties.property("facingRotation");
if (facingRotation.isValid()) {
QScriptValue x = facingRotation.property("x");
QScriptValue y = facingRotation.property("y");
QScriptValue z = facingRotation.property("z");
QScriptValue w = facingRotation.property("w");
QScriptValue offsetRotation = properties.property("offsetRotation");
if (offsetRotation.isValid()) {
QScriptValue x = offsetRotation.property("x");
QScriptValue y = offsetRotation.property("y");
QScriptValue z = offsetRotation.property("z");
QScriptValue w = offsetRotation.property("w");
if (x.isValid() && y.isValid() && z.isValid() && w.isValid()) {
glm::quat newRotation;

View file

@ -12,7 +12,7 @@
#ifndef hifi_PanelAttachable_h
#define hifi_PanelAttachable_h
#include "FloatingUIPanel.h"
#include "OverlayPanel.h"
#include <glm/glm.hpp>
#include <Transform.h>
@ -22,14 +22,14 @@ public:
PanelAttachable();
PanelAttachable(const PanelAttachable* panelAttachable);
FloatingUIPanel::Pointer getAttachedPanel() const { return _attachedPanel; }
OverlayPanel::Pointer getAttachedPanel() const { return _attachedPanel; }
virtual glm::vec3 getOffsetPosition() const { return _offsetPosition; }
virtual glm::quat getFacingRotation() const { return _facingRotation; }
virtual glm::quat getFacingRotation() const { return _offsetRotation; }
bool getParentVisible() const;
void setAttachedPanel(FloatingUIPanel::Pointer panel) { _attachedPanel = panel; }
void setAttachedPanel(OverlayPanel::Pointer panel) { _attachedPanel = panel; }
virtual void setOffsetPosition(const glm::vec3& position) { _offsetPosition = position; }
virtual void setFacingRotation(const glm::quat& rotation) { _facingRotation = rotation; }
virtual void setFacingRotation(const glm::quat& rotation) { _offsetRotation = rotation; }
QScriptValue getProperty(QScriptEngine* scriptEngine, const QString& property);
void setProperties(const QScriptValue& properties);
@ -38,9 +38,9 @@ protected:
virtual void setTransforms(Transform& transform);
private:
FloatingUIPanel::Pointer _attachedPanel;
OverlayPanel::Pointer _attachedPanel;
glm::vec3 _offsetPosition;
glm::quat _facingRotation;
glm::quat _offsetRotation;
};
#endif // hifi_PanelAttachable_h