mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 04:37:48 +02:00
Re-work panel position and rotation binding.
This commit is contained in:
parent
5778502c54
commit
481624b48c
7 changed files with 112 additions and 147 deletions
|
@ -23,9 +23,7 @@ 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 ADDRESS_BAR_IMAGE_URL = HIFI_PUBLIC_BUCKET + "images/tools/address-bar-toggle.svg";
|
||||||
|
|
||||||
var panel = new FloatingUIPanel({
|
var panel = new FloatingUIPanel({
|
||||||
anchorPosition: {
|
anchorPositionBinding: { avatar: "MyAvatar" },
|
||||||
bind: "myAvatar"
|
|
||||||
},
|
|
||||||
offsetPosition: { x: 0, y: 0.4, z: 1 },
|
offsetPosition: { x: 0, y: 0.4, z: 1 },
|
||||||
facingRotation: { w: 0, x: 0, y: 1, z: 0 }
|
facingRotation: { w: 0, x: 0, y: 1, z: 0 }
|
||||||
});
|
});
|
||||||
|
@ -194,10 +192,7 @@ function onMouseUp(event) {
|
||||||
if (event.isRightButton && Vec3.distance(mouseDown.pos, { x: event.x, y: event.y }) < 10) {
|
if (event.isRightButton && Vec3.distance(mouseDown.pos, { x: event.x, y: event.y }) < 10) {
|
||||||
panel.setProperties({
|
panel.setProperties({
|
||||||
visible: !panel.visible,
|
visible: !panel.visible,
|
||||||
offsetRotation: {
|
offsetRotation: Quat.multiply(MyAvatar.orientation, { x: 0, y: 1, z: 0, w: 0 })
|
||||||
bind: "quat",
|
|
||||||
value: Quat.multiply(MyAvatar.orientation, { x: 0, y: 1, z: 0, w: 0 })
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,10 +19,8 @@ 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 BLUE_SQUARE_IMAGE_URL = HIFI_PUBLIC_BUCKET + "images/blue-square.svg";
|
||||||
|
|
||||||
var mainPanel = new FloatingUIPanel({
|
var mainPanel = new FloatingUIPanel({
|
||||||
offsetRotation: {
|
anchorPositionBinding: null,//{ avatar: "MyAvatar" },
|
||||||
bind: "quat",
|
offsetRotation: { w: 1, x: 0, y: 0, z: 0 },
|
||||||
value: { w: 1, x: 0, y: 0, z: 0 }
|
|
||||||
},
|
|
||||||
offsetPosition: { x: 0, y: 0.4, z: 1 },
|
offsetPosition: { x: 0, y: 0.4, z: 1 },
|
||||||
facingRotation: { w: 0, x: 0, y: 1, z: 0 }
|
facingRotation: { w: 0, x: 0, y: 1, z: 0 }
|
||||||
});
|
});
|
||||||
|
@ -189,4 +187,4 @@ function onScriptEnd() {
|
||||||
|
|
||||||
Controller.mousePressEvent.connect(onMouseDown);
|
Controller.mousePressEvent.connect(onMouseDown);
|
||||||
Controller.mouseReleaseEvent.connect(onMouseUp);
|
Controller.mouseReleaseEvent.connect(onMouseUp);
|
||||||
Script.scriptEnding.connect(onScriptEnd);
|
Script.scriptEnding.connect(onScriptEnd);
|
||||||
|
|
|
@ -391,8 +391,10 @@
|
||||||
this.message = message;
|
this.message = message;
|
||||||
};
|
};
|
||||||
|
|
||||||
var FIELDS = ["anchorPosition", "offsetRotation", "offsetPosition", "facingRotation"];
|
[
|
||||||
FIELDS.forEach(function(prop) {
|
"anchorPosition", "anchorPositionBinding", "offsetRotation", "offsetRotationBinding",
|
||||||
|
"offsetPosition", "facingRotation"
|
||||||
|
].forEach(function(prop) {
|
||||||
Object.defineProperty(that.prototype, prop, {
|
Object.defineProperty(that.prototype, prop, {
|
||||||
get: function() {
|
get: function() {
|
||||||
return Overlays.getPanelProperty(this._id, prop);
|
return Overlays.getPanelProperty(this._id, prop);
|
||||||
|
|
|
@ -20,41 +20,33 @@
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "Base3DOverlay.h"
|
#include "Base3DOverlay.h"
|
||||||
|
|
||||||
std::function<glm::vec3()> const FloatingUIPanel::AVATAR_POSITION = []() -> glm::vec3 {
|
glm::vec3 FloatingUIPanel::getComputedAnchorPosition() const {
|
||||||
return DependencyManager::get<AvatarManager>()->getMyAvatar()->getPosition();
|
glm::vec3 pos = {};
|
||||||
};
|
if (getAttachedPanel()) {
|
||||||
|
pos = getAttachedPanel()->getPosition();
|
||||||
|
} else if (_anchorPositionBindMyAvatar) {
|
||||||
|
pos = DependencyManager::get<AvatarManager>()->getMyAvatar()->getPosition();
|
||||||
|
}
|
||||||
|
return pos + getAnchorPosition();
|
||||||
|
}
|
||||||
|
|
||||||
std::function<glm::quat()> const FloatingUIPanel::AVATAR_ORIENTATION = []() -> glm::quat {
|
glm::quat FloatingUIPanel::getComputedOffsetRotation() const {
|
||||||
return DependencyManager::get<AvatarManager>()->getMyAvatar()->getOrientation() *
|
glm::quat rot = {1, 0, 0, 0};
|
||||||
glm::angleAxis(glm::pi<float>(), IDENTITY_UP);
|
if (getAttachedPanel()) {
|
||||||
};
|
rot = getAttachedPanel()->getRotation();
|
||||||
|
} else if (_offsetRotationBindMyAvatar) {
|
||||||
|
rot = DependencyManager::get<AvatarManager>()->getMyAvatar()->getOrientation() *
|
||||||
|
glm::angleAxis(glm::pi<float>(), IDENTITY_UP);
|
||||||
|
}
|
||||||
|
return rot * getOffsetRotation();
|
||||||
|
}
|
||||||
|
|
||||||
glm::vec3 FloatingUIPanel::getPosition() const {
|
glm::vec3 FloatingUIPanel::getPosition() const {
|
||||||
return getOffsetRotation() * getOffsetPosition() + getAnchorPosition();
|
return getComputedOffsetRotation() * getOffsetPosition() + getComputedAnchorPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::quat FloatingUIPanel::getRotation() const {
|
glm::quat FloatingUIPanel::getRotation() const {
|
||||||
return getOffsetRotation() * getFacingRotation();
|
return getComputedOffsetRotation() * getFacingRotation();
|
||||||
}
|
|
||||||
|
|
||||||
void FloatingUIPanel::setAnchorPosition(const glm::vec3& position) {
|
|
||||||
setAnchorPosition([position]() -> glm::vec3 {
|
|
||||||
return position;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void FloatingUIPanel::setOffsetRotation(const glm::quat& rotation) {
|
|
||||||
setOffsetRotation([rotation]() -> glm::quat {
|
|
||||||
return rotation;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void FloatingUIPanel::setAttachedPanel(unsigned int panelID) {
|
|
||||||
if (panelID) {
|
|
||||||
attachAnchorToPanel(panelID);
|
|
||||||
attachRotationToPanel(panelID);
|
|
||||||
}
|
|
||||||
_attachedPanel = panelID;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FloatingUIPanel::addChild(unsigned int childId) {
|
void FloatingUIPanel::addChild(unsigned int childId) {
|
||||||
|
@ -73,9 +65,25 @@ QScriptValue FloatingUIPanel::getProperty(const QString &property) {
|
||||||
if (property == "anchorPosition") {
|
if (property == "anchorPosition") {
|
||||||
return vec3toScriptValue(_scriptEngine, getAnchorPosition());
|
return vec3toScriptValue(_scriptEngine, getAnchorPosition());
|
||||||
}
|
}
|
||||||
|
if (property == "anchorPositionBinding") {
|
||||||
|
QScriptValue obj = _scriptEngine->newObject();
|
||||||
|
if (_anchorPositionBindMyAvatar) {
|
||||||
|
obj.setProperty("avatar", "MyAvatar");
|
||||||
|
}
|
||||||
|
obj.setProperty("computed", vec3toScriptValue(_scriptEngine, getComputedAnchorPosition()));
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
if (property == "offsetRotation") {
|
if (property == "offsetRotation") {
|
||||||
return quatToScriptValue(_scriptEngine, getOffsetRotation());
|
return quatToScriptValue(_scriptEngine, getOffsetRotation());
|
||||||
}
|
}
|
||||||
|
if (property == "offsetRotationBinding") {
|
||||||
|
QScriptValue obj = _scriptEngine->newObject();
|
||||||
|
if (_offsetRotationBindMyAvatar) {
|
||||||
|
obj.setProperty("avatar", "MyAvatar");
|
||||||
|
}
|
||||||
|
obj.setProperty("computed", quatToScriptValue(_scriptEngine, getComputedOffsetRotation()));
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
if (property == "offsetPosition") {
|
if (property == "offsetPosition") {
|
||||||
return vec3toScriptValue(_scriptEngine, getOffsetPosition());
|
return vec3toScriptValue(_scriptEngine, getOffsetPosition());
|
||||||
}
|
}
|
||||||
|
@ -87,80 +95,56 @@ QScriptValue FloatingUIPanel::getProperty(const QString &property) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FloatingUIPanel::setProperties(const QScriptValue &properties) {
|
void FloatingUIPanel::setProperties(const QScriptValue &properties) {
|
||||||
QScriptValue anchor = properties.property("anchorPosition");
|
QScriptValue anchorPosition = properties.property("anchorPosition");
|
||||||
if (anchor.isValid()) {
|
if (anchorPosition.isValid()) {
|
||||||
QScriptValue bindType = anchor.property("bind");
|
QScriptValue x = anchorPosition.property("x");
|
||||||
QScriptValue value = anchor.property("value");
|
QScriptValue y = anchorPosition.property("y");
|
||||||
|
QScriptValue z = anchorPosition.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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (bindType.isValid()) {
|
QScriptValue anchorPositionBinding = properties.property("anchorPositionBinding");
|
||||||
QString bindTypeString = bindType.toVariant().toString();
|
if (anchorPositionBinding.isValid()) {
|
||||||
if (bindTypeString == "myAvatar") {
|
_anchorPositionBindMyAvatar = false;
|
||||||
setAnchorPosition(AVATAR_POSITION);
|
|
||||||
} else if (value.isValid()) {
|
QScriptValue avatar = anchorPositionBinding.property("avatar");
|
||||||
if (bindTypeString == "overlay") {
|
|
||||||
Overlay::Pointer overlay = Application::getInstance()->getOverlays()
|
if (avatar.isValid()) {
|
||||||
.getOverlay(value.toVariant().toUInt());
|
_anchorPositionBindMyAvatar = (avatar.toVariant().toString() == "MyAvatar");
|
||||||
if (overlay->is3D()) {
|
|
||||||
auto overlay3D = std::static_pointer_cast<Base3DOverlay>(overlay);
|
|
||||||
setAnchorPosition([&overlay3D]() -> glm::vec3 {
|
|
||||||
return overlay3D->getPosition();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else if (bindTypeString == "panel") {
|
|
||||||
attachAnchorToPanel(value.toVariant().toUInt());
|
|
||||||
} else if (bindTypeString == "vec3") {
|
|
||||||
QScriptValue x = value.property("x");
|
|
||||||
QScriptValue y = value.property("y");
|
|
||||||
QScriptValue z = value.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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QScriptValue offsetRotation = properties.property("offsetRotation");
|
QScriptValue offsetRotation = properties.property("offsetRotation");
|
||||||
if (offsetRotation.isValid()) {
|
if (offsetRotation.isValid()) {
|
||||||
QScriptValue bindType = offsetRotation.property("bind");
|
QScriptValue x = offsetRotation.property("x");
|
||||||
QScriptValue value = offsetRotation.property("value");
|
QScriptValue y = offsetRotation.property("y");
|
||||||
|
QScriptValue z = offsetRotation.property("z");
|
||||||
|
QScriptValue w = offsetRotation.property("w");
|
||||||
|
|
||||||
if (bindType.isValid()) {
|
if (x.isValid() && y.isValid() && z.isValid() && w.isValid()) {
|
||||||
QString bindTypeString = bindType.toVariant().toString();
|
glm::quat newRotation;
|
||||||
if (bindTypeString == "myAvatar") {
|
newRotation.x = x.toVariant().toFloat();
|
||||||
setOffsetRotation(AVATAR_ORIENTATION);
|
newRotation.y = y.toVariant().toFloat();
|
||||||
} else if (value.isValid()) {
|
newRotation.z = z.toVariant().toFloat();
|
||||||
if (bindTypeString == "overlay") {
|
newRotation.w = w.toVariant().toFloat();
|
||||||
Overlay::Pointer overlay = Application::getInstance()->getOverlays()
|
setOffsetRotation(newRotation);
|
||||||
.getOverlay(value.toVariant().toUInt());
|
}
|
||||||
if (overlay->is3D()) {
|
}
|
||||||
auto overlay3D = std::static_pointer_cast<Base3DOverlay>(overlay);
|
|
||||||
setOffsetRotation([&overlay3D]() -> glm::quat {
|
|
||||||
return overlay3D->getRotation();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else if (bindTypeString == "panel") {
|
|
||||||
attachRotationToPanel(value.toVariant().toUInt());
|
|
||||||
} else if (bindTypeString == "quat") {
|
|
||||||
QScriptValue x = value.property("x");
|
|
||||||
QScriptValue y = value.property("y");
|
|
||||||
QScriptValue z = value.property("z");
|
|
||||||
QScriptValue w = value.property("w");
|
|
||||||
|
|
||||||
if (x.isValid() && y.isValid() && z.isValid() && w.isValid()) {
|
QScriptValue offsetRotationBinding = properties.property("offsetRotationBinding");
|
||||||
glm::quat newRotation;
|
if (offsetRotationBinding.isValid()) {
|
||||||
newRotation.x = x.toVariant().toFloat();
|
_offsetRotationBindMyAvatar = false;
|
||||||
newRotation.y = y.toVariant().toFloat();
|
|
||||||
newRotation.z = z.toVariant().toFloat();
|
QScriptValue avatar = offsetRotationBinding.property("avatar");
|
||||||
newRotation.w = w.toVariant().toFloat();
|
|
||||||
setOffsetRotation(newRotation);
|
if (avatar.isValid()) {
|
||||||
}
|
_offsetRotationBindMyAvatar = (avatar.toVariant().toString() == "MyAvatar");
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,17 +179,3 @@ void FloatingUIPanel::setProperties(const QScriptValue &properties) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FloatingUIPanel::attachAnchorToPanel(unsigned int panelID) {
|
|
||||||
FloatingUIPanel::Pointer panel = Application::getInstance()->getOverlays().getPanel(panelID);
|
|
||||||
setAnchorPosition([panel]() -> glm::vec3 {
|
|
||||||
return panel->getPosition();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void FloatingUIPanel::attachRotationToPanel(unsigned int panelID) {
|
|
||||||
FloatingUIPanel::Pointer panel = Application::getInstance()->getOverlays().getPanel(panelID);
|
|
||||||
setOffsetRotation([panel]() -> glm::quat {
|
|
||||||
return panel->getRotation();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#ifndef hifi_FloatingUIPanel_h
|
#ifndef hifi_FloatingUIPanel_h
|
||||||
#define hifi_FloatingUIPanel_h
|
#define hifi_FloatingUIPanel_h
|
||||||
|
|
||||||
#include <functional>
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
|
@ -21,26 +20,29 @@
|
||||||
|
|
||||||
class FloatingUIPanel : public QObject {
|
class FloatingUIPanel : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef std::shared_ptr<FloatingUIPanel> Pointer;
|
typedef std::shared_ptr<FloatingUIPanel> Pointer;
|
||||||
|
|
||||||
void init(QScriptEngine* scriptEngine) { _scriptEngine = scriptEngine; }
|
void init(QScriptEngine* scriptEngine) { _scriptEngine = scriptEngine; }
|
||||||
|
|
||||||
glm::vec3 getAnchorPosition() const { return _anchorPosition(); }
|
// getters
|
||||||
glm::quat getOffsetRotation() const { return _offsetRotation(); }
|
glm::vec3 getAnchorPosition() const { return _anchorPosition; }
|
||||||
|
glm::vec3 getComputedAnchorPosition() const;
|
||||||
|
glm::quat getOffsetRotation() const { return _offsetRotation; }
|
||||||
|
glm::quat getComputedOffsetRotation() const;
|
||||||
glm::vec3 getOffsetPosition() const { return _offsetPosition; }
|
glm::vec3 getOffsetPosition() const { return _offsetPosition; }
|
||||||
glm::quat getFacingRotation() const { return _facingRotation; }
|
glm::quat getFacingRotation() const { return _facingRotation; }
|
||||||
glm::vec3 getPosition() const;
|
glm::vec3 getPosition() const;
|
||||||
glm::quat getRotation() const;
|
glm::quat getRotation() const;
|
||||||
unsigned int getAttachedPanel() const { return _attachedPanel; }
|
Pointer getAttachedPanel() const { return _attachedPanel; }
|
||||||
|
|
||||||
void setAnchorPosition(const std::function<glm::vec3()>& func) { _anchorPosition = func; }
|
// setters
|
||||||
void setAnchorPosition(const glm::vec3& position);
|
void setAnchorPosition(const glm::vec3& position) { _anchorPosition = position; }
|
||||||
void setOffsetRotation(const std::function<glm::quat()>& func) { _offsetRotation = func; }
|
void setOffsetRotation(const glm::quat& rotation) { _offsetRotation = rotation; }
|
||||||
void setOffsetRotation(const glm::quat& rotation);
|
|
||||||
void setOffsetPosition(const glm::vec3& position) { _offsetPosition = position; }
|
void setOffsetPosition(const glm::vec3& position) { _offsetPosition = position; }
|
||||||
void setFacingRotation(const glm::quat& rotation) { _facingRotation = rotation; }
|
void setFacingRotation(const glm::quat& rotation) { _facingRotation = rotation; }
|
||||||
void setAttachedPanel(unsigned int panelID);
|
void setAttachedPanel(Pointer panel) { _attachedPanel = panel; }
|
||||||
|
|
||||||
const QList<unsigned int>& getChildren() { return _children; }
|
const QList<unsigned int>& getChildren() { return _children; }
|
||||||
void addChild(unsigned int childId);
|
void addChild(unsigned int childId);
|
||||||
|
@ -51,17 +53,15 @@ public:
|
||||||
void setProperties(const QScriptValue& properties);
|
void setProperties(const QScriptValue& properties);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static std::function<glm::vec3()> const AVATAR_POSITION;
|
glm::vec3 _anchorPosition = {0, 0, 0};
|
||||||
static std::function<glm::quat()> const AVATAR_ORIENTATION;
|
glm::quat _offsetRotation = {1, 0, 0, 0};
|
||||||
|
glm::vec3 _offsetPosition = {0, 0, 0};
|
||||||
|
glm::quat _facingRotation = {1, 0, 0, 0};
|
||||||
|
|
||||||
void attachAnchorToPanel(unsigned int panelID);
|
bool _anchorPositionBindMyAvatar = false;
|
||||||
void attachRotationToPanel(unsigned int panelID);
|
bool _offsetRotationBindMyAvatar = false;
|
||||||
|
|
||||||
std::function<glm::vec3()> _anchorPosition{AVATAR_POSITION};
|
Pointer _attachedPanel = nullptr;
|
||||||
std::function<glm::quat()> _offsetRotation{AVATAR_ORIENTATION};
|
|
||||||
glm::vec3 _offsetPosition{0, 0, 0};
|
|
||||||
glm::quat _facingRotation{1, 0, 0, 0};
|
|
||||||
unsigned int _attachedPanel{0};
|
|
||||||
QScriptEngine* _scriptEngine;
|
QScriptEngine* _scriptEngine;
|
||||||
QList<unsigned int> _children;
|
QList<unsigned int> _children;
|
||||||
};
|
};
|
||||||
|
|
|
@ -278,7 +278,7 @@ unsigned int Overlays::getAttachedPanel(unsigned int childId) const {
|
||||||
if (attachable) {
|
if (attachable) {
|
||||||
return _panels.key(attachable->getAttachedPanel());
|
return _panels.key(attachable->getAttachedPanel());
|
||||||
} else if (_panels.contains(childId)) {
|
} else if (_panels.contains(childId)) {
|
||||||
return getPanel(childId)->getAttachedPanel();
|
return _panels.key(getPanel(childId)->getAttachedPanel());
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -299,13 +299,13 @@ void Overlays::setAttachedPanel(unsigned int childId, unsigned int panelId) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (_panels.contains(childId)) {
|
} else if (_panels.contains(childId)) {
|
||||||
auto child = getPanel(childId);
|
FloatingUIPanel::Pointer child = getPanel(childId);
|
||||||
if (_panels.contains(panelId)) {
|
if (_panels.contains(panelId)) {
|
||||||
auto panel = getPanel(panelId);
|
auto panel = getPanel(panelId);
|
||||||
panel->addChild(childId);
|
panel->addChild(childId);
|
||||||
child->setAttachedPanel(panelId);
|
child->setAttachedPanel(panel);
|
||||||
} else {
|
} else {
|
||||||
auto panel = getPanel(child->getAttachedPanel());
|
auto panel = child->getAttachedPanel();
|
||||||
if (panel) {
|
if (panel) {
|
||||||
panel->removeChild(childId);
|
panel->removeChild(childId);
|
||||||
child->setAttachedPanel(0);
|
child->setAttachedPanel(0);
|
||||||
|
|
|
@ -29,8 +29,8 @@ PanelAttachable::PanelAttachable(const PanelAttachable* panelAttachable) :
|
||||||
|
|
||||||
void PanelAttachable::setTransforms(Transform& transform) {
|
void PanelAttachable::setTransforms(Transform& transform) {
|
||||||
if (getAttachedPanel()) {
|
if (getAttachedPanel()) {
|
||||||
transform.setTranslation(getAttachedPanel()->getAnchorPosition());
|
transform.setTranslation(getAttachedPanel()->getComputedAnchorPosition());
|
||||||
transform.setRotation(getAttachedPanel()->getOffsetRotation());
|
transform.setRotation(getAttachedPanel()->getComputedOffsetRotation());
|
||||||
transform.postTranslate(getAttachedPanel()->getOffsetPosition());
|
transform.postTranslate(getAttachedPanel()->getOffsetPosition());
|
||||||
transform.postRotate(getAttachedPanel()->getFacingRotation());
|
transform.postRotate(getAttachedPanel()->getFacingRotation());
|
||||||
transform.postTranslate(getOffsetPosition());
|
transform.postTranslate(getOffsetPosition());
|
||||||
|
|
Loading…
Reference in a new issue