mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-16 17:00:22 +02:00
resolved conflict with master in AnimClip.cpp
This commit is contained in:
commit
a11c4bf4e3
40 changed files with 460 additions and 303 deletions
|
@ -25,13 +25,13 @@
|
||||||
|
|
||||||
#include <AccountManager.h>
|
#include <AccountManager.h>
|
||||||
#include <Assignment.h>
|
#include <Assignment.h>
|
||||||
|
#include <AvatarData.h>
|
||||||
#include <HifiConfigVariantMap.h>
|
#include <HifiConfigVariantMap.h>
|
||||||
#include <HTTPConnection.h>
|
#include <HTTPConnection.h>
|
||||||
#include <NLPacketList.h>
|
#include <NLPacketList.h>
|
||||||
#include <NumericalConstants.h>
|
#include <NumericalConstants.h>
|
||||||
#include <SettingHandle.h>
|
#include <SettingHandle.h>
|
||||||
#include <SettingHelpers.h>
|
#include <SettingHelpers.h>
|
||||||
#include <AvatarData.h> //for KillAvatarReason
|
|
||||||
#include <FingerprintUtils.h>
|
#include <FingerprintUtils.h>
|
||||||
|
|
||||||
#include "DomainServerNodeData.h"
|
#include "DomainServerNodeData.h"
|
||||||
|
@ -870,14 +870,6 @@ void DomainServerSettingsManager::processNodeKickRequestPacket(QSharedPointer<Re
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we are here, then we kicked them, so send the KillAvatar message
|
|
||||||
auto packet = NLPacket::create(PacketType::KillAvatar, NUM_BYTES_RFC4122_UUID + sizeof(KillAvatarReason), true);
|
|
||||||
packet->write(nodeUUID.toRfc4122());
|
|
||||||
packet->writePrimitive(KillAvatarReason::NoReason);
|
|
||||||
|
|
||||||
// send to avatar mixer, it sends the kill to everyone else
|
|
||||||
limitedNodeList->broadcastToNodes(std::move(packet), NodeSet() << NodeType::AvatarMixer);
|
|
||||||
|
|
||||||
if (newPermissions) {
|
if (newPermissions) {
|
||||||
qDebug() << "Removing connect permission for node" << uuidStringWithoutCurlyBraces(matchingNode->getUUID())
|
qDebug() << "Removing connect permission for node" << uuidStringWithoutCurlyBraces(matchingNode->getUUID())
|
||||||
<< "after kick request from" << uuidStringWithoutCurlyBraces(sendingNode->getUUID());
|
<< "after kick request from" << uuidStringWithoutCurlyBraces(sendingNode->getUUID());
|
||||||
|
|
|
@ -3773,9 +3773,12 @@ std::map<QString, QString> Application::prepareServerlessDomainContents(QUrl dom
|
||||||
tmpTree->reaverageOctreeElements();
|
tmpTree->reaverageOctreeElements();
|
||||||
tmpTree->sendEntities(&_entityEditSender, getEntities()->getTree(), 0, 0, 0);
|
tmpTree->sendEntities(&_entityEditSender, getEntities()->getTree(), 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
std::map<QString, QString> namedPaths = tmpTree->getNamedPaths();
|
||||||
|
|
||||||
return tmpTree->getNamedPaths();
|
// we must manually eraseAllOctreeElements(false) else the tmpTree will mem-leak
|
||||||
|
tmpTree->eraseAllOctreeElements(false);
|
||||||
|
|
||||||
|
return namedPaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::loadServerlessDomain(QUrl domainURL) {
|
void Application::loadServerlessDomain(QUrl domainURL) {
|
||||||
|
@ -4981,9 +4984,9 @@ void Application::idle() {
|
||||||
|
|
||||||
{
|
{
|
||||||
if (_keyboardFocusWaitingOnRenderable && getEntities()->renderableForEntityId(_keyboardFocusedEntity.get())) {
|
if (_keyboardFocusWaitingOnRenderable && getEntities()->renderableForEntityId(_keyboardFocusedEntity.get())) {
|
||||||
_keyboardFocusWaitingOnRenderable = false;
|
|
||||||
QUuid entityId = _keyboardFocusedEntity.get();
|
QUuid entityId = _keyboardFocusedEntity.get();
|
||||||
setKeyboardFocusEntity(UNKNOWN_ENTITY_ID);
|
setKeyboardFocusEntity(UNKNOWN_ENTITY_ID);
|
||||||
|
_keyboardFocusWaitingOnRenderable = false;
|
||||||
setKeyboardFocusEntity(entityId);
|
setKeyboardFocusEntity(entityId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5770,6 +5773,11 @@ void Application::reloadResourceCaches() {
|
||||||
|
|
||||||
DependencyManager::get<NodeList>()->reset(); // Force redownload of .fst models
|
DependencyManager::get<NodeList>()->reset(); // Force redownload of .fst models
|
||||||
|
|
||||||
|
DependencyManager::get<ScriptEngines>()->reloadAllScripts();
|
||||||
|
getOffscreenUI()->clearCache();
|
||||||
|
|
||||||
|
DependencyManager::get<Keyboard>()->createKeyboard();
|
||||||
|
|
||||||
getMyAvatar()->resetFullAvatarURL();
|
getMyAvatar()->resetFullAvatarURL();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -254,11 +254,15 @@ void AvatarProject::openInInventory() const {
|
||||||
DependencyManager::get<TabletScriptingInterface>()->getTablet("com.highfidelity.interface.tablet.system"));
|
DependencyManager::get<TabletScriptingInterface>()->getTablet("com.highfidelity.interface.tablet.system"));
|
||||||
tablet->loadQMLSource("hifi/commerce/wallet/Wallet.qml");
|
tablet->loadQMLSource("hifi/commerce/wallet/Wallet.qml");
|
||||||
DependencyManager::get<HMDScriptingInterface>()->openTablet();
|
DependencyManager::get<HMDScriptingInterface>()->openTablet();
|
||||||
tablet->getTabletRoot()->forceActiveFocus();
|
|
||||||
auto name = getProjectName();
|
|
||||||
|
|
||||||
// I'm not a fan of this, but it's the only current option.
|
// I'm not a fan of this, but it's the only current option.
|
||||||
|
auto name = getProjectName();
|
||||||
QTimer::singleShot(TIME_TO_WAIT_FOR_INVENTORY_TO_OPEN_MS, [name, tablet]() {
|
QTimer::singleShot(TIME_TO_WAIT_FOR_INVENTORY_TO_OPEN_MS, [name, tablet]() {
|
||||||
tablet->sendToQml(QVariantMap({ { "method", "updatePurchases" }, { "filterText", name } }));
|
tablet->sendToQml(QVariantMap({ { "method", "updatePurchases" }, { "filterText", name } }));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
QQuickItem* root = tablet->getTabletRoot();
|
||||||
|
if (root) {
|
||||||
|
root->forceActiveFocus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -259,6 +259,12 @@ void Keyboard::setUse3DKeyboard(bool use) {
|
||||||
void Keyboard::createKeyboard() {
|
void Keyboard::createKeyboard() {
|
||||||
auto pointerManager = DependencyManager::get<PointerManager>();
|
auto pointerManager = DependencyManager::get<PointerManager>();
|
||||||
|
|
||||||
|
if (_created) {
|
||||||
|
pointerManager->removePointer(_leftHandStylus);
|
||||||
|
pointerManager->removePointer(_rightHandStylus);
|
||||||
|
clearKeyboardKeys();
|
||||||
|
}
|
||||||
|
|
||||||
QVariantMap modelProperties {
|
QVariantMap modelProperties {
|
||||||
{ "url", MALLET_MODEL_URL }
|
{ "url", MALLET_MODEL_URL }
|
||||||
};
|
};
|
||||||
|
@ -289,6 +295,8 @@ void Keyboard::createKeyboard() {
|
||||||
loadKeyboardFile(keyboardSvg);
|
loadKeyboardFile(keyboardSvg);
|
||||||
|
|
||||||
_keySound = DependencyManager::get<SoundCache>()->getSound(SOUND_FILE);
|
_keySound = DependencyManager::get<SoundCache>()->getSound(SOUND_FILE);
|
||||||
|
|
||||||
|
_created = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Keyboard::isRaised() const {
|
bool Keyboard::isRaised() const {
|
||||||
|
|
|
@ -193,6 +193,8 @@ private:
|
||||||
|
|
||||||
QSet<QUuid> _itemsToIgnore;
|
QSet<QUuid> _itemsToIgnore;
|
||||||
std::vector<QHash<QUuid, Key>> _keyboardLayers;
|
std::vector<QHash<QUuid, Key>> _keyboardLayers;
|
||||||
|
|
||||||
|
bool _created { false };
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -50,11 +50,14 @@ ContextOverlayInterface::ContextOverlayInterface() {
|
||||||
_entityPropertyFlags += PROP_OWNING_AVATAR_ID;
|
_entityPropertyFlags += PROP_OWNING_AVATAR_ID;
|
||||||
|
|
||||||
auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>().data();
|
auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>().data();
|
||||||
connect(entityScriptingInterface, &EntityScriptingInterface::clickDownOnEntity, this, &ContextOverlayInterface::clickDownOnEntity);
|
connect(entityScriptingInterface, &EntityScriptingInterface::mousePressOnEntity, this, &ContextOverlayInterface::clickDownOnEntity);
|
||||||
connect(entityScriptingInterface, &EntityScriptingInterface::holdingClickOnEntity, this, &ContextOverlayInterface::holdingClickOnEntity);
|
|
||||||
connect(entityScriptingInterface, &EntityScriptingInterface::mouseReleaseOnEntity, this, &ContextOverlayInterface::mouseReleaseOnEntity);
|
connect(entityScriptingInterface, &EntityScriptingInterface::mouseReleaseOnEntity, this, &ContextOverlayInterface::mouseReleaseOnEntity);
|
||||||
connect(entityScriptingInterface, &EntityScriptingInterface::hoverEnterEntity, this, &ContextOverlayInterface::contextOverlays_hoverEnterEntity);
|
connect(entityScriptingInterface, &EntityScriptingInterface::hoverEnterEntity, this, &ContextOverlayInterface::contextOverlays_hoverEnterEntity);
|
||||||
connect(entityScriptingInterface, &EntityScriptingInterface::hoverLeaveEntity, this, &ContextOverlayInterface::contextOverlays_hoverLeaveEntity);
|
connect(entityScriptingInterface, &EntityScriptingInterface::hoverLeaveEntity, this, &ContextOverlayInterface::contextOverlays_hoverLeaveEntity);
|
||||||
|
|
||||||
|
connect(&qApp->getOverlays(), &Overlays::hoverEnterOverlay, this, &ContextOverlayInterface::contextOverlays_hoverEnterOverlay);
|
||||||
|
connect(&qApp->getOverlays(), &Overlays::hoverLeaveOverlay, this, &ContextOverlayInterface::contextOverlays_hoverLeaveOverlay);
|
||||||
|
|
||||||
connect(_tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system"), &TabletProxy::tabletShownChanged, this, [&]() {
|
connect(_tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system"), &TabletProxy::tabletShownChanged, this, [&]() {
|
||||||
if (_contextOverlayJustClicked && _hmdScriptingInterface->isMounted()) {
|
if (_contextOverlayJustClicked && _hmdScriptingInterface->isMounted()) {
|
||||||
QUuid tabletFrameID = _hmdScriptingInterface->getCurrentTabletFrameID();
|
QUuid tabletFrameID = _hmdScriptingInterface->getCurrentTabletFrameID();
|
||||||
|
@ -70,8 +73,6 @@ ContextOverlayInterface::ContextOverlayInterface() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
connect(entityScriptingInterface, &EntityScriptingInterface::deletingEntity, this, &ContextOverlayInterface::deletingEntity);
|
connect(entityScriptingInterface, &EntityScriptingInterface::deletingEntity, this, &ContextOverlayInterface::deletingEntity);
|
||||||
connect(&qApp->getOverlays(), &Overlays::hoverEnterOverlay, this, &ContextOverlayInterface::contextOverlays_hoverEnterOverlay);
|
|
||||||
connect(&qApp->getOverlays(), &Overlays::hoverLeaveOverlay, this, &ContextOverlayInterface::contextOverlays_hoverLeaveOverlay);
|
|
||||||
|
|
||||||
{
|
{
|
||||||
_selectionScriptingInterface->enableListHighlight("contextOverlayHighlightList", QVariantMap());
|
_selectionScriptingInterface->enableListHighlight("contextOverlayHighlightList", QVariantMap());
|
||||||
|
@ -106,7 +107,7 @@ void ContextOverlayInterface::clickDownOnEntity(const EntityItemID& id, const Po
|
||||||
if (_enabled && event.getButton() == PointerEvent::SecondaryButton && contextOverlayFilterPassed(id)) {
|
if (_enabled && event.getButton() == PointerEvent::SecondaryButton && contextOverlayFilterPassed(id)) {
|
||||||
_mouseDownEntity = id;
|
_mouseDownEntity = id;
|
||||||
_mouseDownEntityTimestamp = usecTimestampNow();
|
_mouseDownEntityTimestamp = usecTimestampNow();
|
||||||
} else if (id == _contextOverlayID && event.getButton() == PointerEvent::PrimaryButton) {
|
} else if ((event.shouldFocus() || event.getButton() == PointerEvent::PrimaryButton) && id == _contextOverlayID) {
|
||||||
qCDebug(context_overlay) << "Clicked Context Overlay. Entity ID:" << _currentEntityWithContextOverlay << "ID:" << id;
|
qCDebug(context_overlay) << "Clicked Context Overlay. Entity ID:" << _currentEntityWithContextOverlay << "ID:" << id;
|
||||||
emit contextOverlayClicked(_currentEntityWithContextOverlay);
|
emit contextOverlayClicked(_currentEntityWithContextOverlay);
|
||||||
_contextOverlayJustClicked = true;
|
_contextOverlayJustClicked = true;
|
||||||
|
@ -119,13 +120,10 @@ void ContextOverlayInterface::clickDownOnEntity(const EntityItemID& id, const Po
|
||||||
}
|
}
|
||||||
|
|
||||||
static const float CONTEXT_OVERLAY_CLICK_HOLD_TIME_MSEC = 400.0f;
|
static const float CONTEXT_OVERLAY_CLICK_HOLD_TIME_MSEC = 400.0f;
|
||||||
void ContextOverlayInterface::holdingClickOnEntity(const EntityItemID& entityItemID, const PointerEvent& event) {
|
void ContextOverlayInterface::mouseReleaseOnEntity(const EntityItemID& entityItemID, const PointerEvent& event) {
|
||||||
if (!_mouseDownEntity.isNull() && ((usecTimestampNow() - _mouseDownEntityTimestamp) > (CONTEXT_OVERLAY_CLICK_HOLD_TIME_MSEC * USECS_PER_MSEC))) {
|
if (!_mouseDownEntity.isNull() && ((usecTimestampNow() - _mouseDownEntityTimestamp) > (CONTEXT_OVERLAY_CLICK_HOLD_TIME_MSEC * USECS_PER_MSEC))) {
|
||||||
_mouseDownEntity = EntityItemID();
|
_mouseDownEntity = EntityItemID();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void ContextOverlayInterface::mouseReleaseOnEntity(const EntityItemID& entityItemID, const PointerEvent& event) {
|
|
||||||
if (_enabled && event.getButton() == PointerEvent::SecondaryButton && contextOverlayFilterPassed(entityItemID) && _mouseDownEntity == entityItemID) {
|
if (_enabled && event.getButton() == PointerEvent::SecondaryButton && contextOverlayFilterPassed(entityItemID) && _mouseDownEntity == entityItemID) {
|
||||||
createOrDestroyContextOverlay(entityItemID, event);
|
createOrDestroyContextOverlay(entityItemID, event);
|
||||||
}
|
}
|
||||||
|
@ -253,7 +251,7 @@ bool ContextOverlayInterface::destroyContextOverlay(const EntityItemID& entityIt
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContextOverlayInterface::contextOverlays_hoverEnterOverlay(const QUuid& id, const PointerEvent& event) {
|
void ContextOverlayInterface::contextOverlays_hoverEnterOverlay(const QUuid& id, const PointerEvent& event) {
|
||||||
if (_contextOverlayID != UNKNOWN_ENTITY_ID) {
|
if (_contextOverlayID == id) {
|
||||||
qCDebug(context_overlay) << "Started hovering over Context Overlay. ID:" << id;
|
qCDebug(context_overlay) << "Started hovering over Context Overlay. ID:" << id;
|
||||||
EntityItemProperties properties;
|
EntityItemProperties properties;
|
||||||
properties.setColor(CONTEXT_OVERLAY_COLOR);
|
properties.setColor(CONTEXT_OVERLAY_COLOR);
|
||||||
|
@ -265,7 +263,7 @@ void ContextOverlayInterface::contextOverlays_hoverEnterOverlay(const QUuid& id,
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContextOverlayInterface::contextOverlays_hoverLeaveOverlay(const QUuid& id, const PointerEvent& event) {
|
void ContextOverlayInterface::contextOverlays_hoverLeaveOverlay(const QUuid& id, const PointerEvent& event) {
|
||||||
if (_contextOverlayID != UNKNOWN_ENTITY_ID) {
|
if (_contextOverlayID == id) {
|
||||||
qCDebug(context_overlay) << "Stopped hovering over Context Overlay. ID:" << id;
|
qCDebug(context_overlay) << "Stopped hovering over Context Overlay. ID:" << id;
|
||||||
EntityItemProperties properties;
|
EntityItemProperties properties;
|
||||||
properties.setColor(CONTEXT_OVERLAY_COLOR);
|
properties.setColor(CONTEXT_OVERLAY_COLOR);
|
||||||
|
|
|
@ -59,7 +59,6 @@ signals:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void clickDownOnEntity(const EntityItemID& entityItemID, const PointerEvent& event);
|
void clickDownOnEntity(const EntityItemID& entityItemID, const PointerEvent& event);
|
||||||
void holdingClickOnEntity(const EntityItemID& entityItemID, const PointerEvent& event);
|
|
||||||
void mouseReleaseOnEntity(const EntityItemID& entityItemID, const PointerEvent& event);
|
void mouseReleaseOnEntity(const EntityItemID& entityItemID, const PointerEvent& event);
|
||||||
|
|
||||||
bool createOrDestroyContextOverlay(const EntityItemID& entityItemID, const PointerEvent& event);
|
bool createOrDestroyContextOverlay(const EntityItemID& entityItemID, const PointerEvent& event);
|
||||||
|
|
|
@ -16,8 +16,7 @@
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
|
||||||
Overlay::Overlay() :
|
Overlay::Overlay() :
|
||||||
_renderItemID(render::Item::INVALID_ITEM_ID),
|
_renderItemID(render::Item::INVALID_ITEM_ID)
|
||||||
_visible(true)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,20 +33,6 @@ void Overlay::setProperties(const QVariantMap& properties) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant Overlay::getProperty(const QString& property) {
|
|
||||||
if (property == "type") {
|
|
||||||
return QVariant(getType());
|
|
||||||
}
|
|
||||||
if (property == "id") {
|
|
||||||
return getID();
|
|
||||||
}
|
|
||||||
if (property == "visible") {
|
|
||||||
return _visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
return QVariant();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Overlay::addToScene(Overlay::Pointer overlay, const render::ScenePointer& scene, render::Transaction& transaction) {
|
bool Overlay::addToScene(Overlay::Pointer overlay, const render::ScenePointer& scene, render::Transaction& transaction) {
|
||||||
_renderItemID = scene->allocateID();
|
_renderItemID = scene->allocateID();
|
||||||
transaction.resetItem(_renderItemID, std::make_shared<Overlay::Payload>(overlay));
|
transaction.resetItem(_renderItemID, std::make_shared<Overlay::Payload>(overlay));
|
||||||
|
@ -65,7 +50,7 @@ render::ItemKey Overlay::getKey() {
|
||||||
builder.withViewSpace();
|
builder.withViewSpace();
|
||||||
builder.withLayer(render::hifi::LAYER_2D);
|
builder.withLayer(render::hifi::LAYER_2D);
|
||||||
|
|
||||||
if (!getVisible()) {
|
if (!_visible) {
|
||||||
builder.withInvisible();
|
builder.withInvisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,6 @@ public:
|
||||||
|
|
||||||
virtual render::ItemKey getKey();
|
virtual render::ItemKey getKey();
|
||||||
virtual AABox getBounds() const = 0;
|
virtual AABox getBounds() const = 0;
|
||||||
virtual bool supportsGetProperty() const { return true; }
|
|
||||||
|
|
||||||
virtual bool addToScene(Overlay::Pointer overlay, const render::ScenePointer& scene, render::Transaction& transaction);
|
virtual bool addToScene(Overlay::Pointer overlay, const render::ScenePointer& scene, render::Transaction& transaction);
|
||||||
virtual void removeFromScene(Overlay::Pointer overlay, const render::ScenePointer& scene, render::Transaction& transaction);
|
virtual void removeFromScene(Overlay::Pointer overlay, const render::ScenePointer& scene, render::Transaction& transaction);
|
||||||
|
@ -42,17 +41,15 @@ public:
|
||||||
|
|
||||||
// getters
|
// getters
|
||||||
virtual QString getType() const = 0;
|
virtual QString getType() const = 0;
|
||||||
bool isLoaded() { return true; }
|
|
||||||
bool getVisible() const { return _visible; }
|
bool getVisible() const { return _visible; }
|
||||||
|
|
||||||
// setters
|
// setters
|
||||||
virtual void setVisible(bool visible) { _visible = visible; }
|
void setVisible(bool visible) { _visible = visible; }
|
||||||
unsigned int getStackOrder() const { return _stackOrder; }
|
unsigned int getStackOrder() const { return _stackOrder; }
|
||||||
void setStackOrder(unsigned int stackOrder) { _stackOrder = stackOrder; }
|
void setStackOrder(unsigned int stackOrder) { _stackOrder = stackOrder; }
|
||||||
|
|
||||||
Q_INVOKABLE virtual void setProperties(const QVariantMap& properties);
|
Q_INVOKABLE virtual void setProperties(const QVariantMap& properties) = 0;
|
||||||
Q_INVOKABLE virtual Overlay* createClone() const = 0;
|
Q_INVOKABLE virtual Overlay* createClone() const = 0;
|
||||||
Q_INVOKABLE virtual QVariant getProperty(const QString& property);
|
|
||||||
|
|
||||||
render::ItemID getRenderItemID() const { return _renderItemID; }
|
render::ItemID getRenderItemID() const { return _renderItemID; }
|
||||||
void setRenderItemID(render::ItemID renderItemID) { _renderItemID = renderItemID; }
|
void setRenderItemID(render::ItemID renderItemID) { _renderItemID = renderItemID; }
|
||||||
|
@ -60,7 +57,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
render::ItemID _renderItemID { render::Item::INVALID_ITEM_ID };
|
render::ItemID _renderItemID { render::Item::INVALID_ITEM_ID };
|
||||||
|
|
||||||
bool _visible;
|
bool _visible { true };
|
||||||
unsigned int _stackOrder { 0 };
|
unsigned int _stackOrder { 0 };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -66,23 +66,3 @@ void Overlay2D::setProperties(const QVariantMap& properties) {
|
||||||
setBounds(newBounds);
|
setBounds(newBounds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant Overlay2D::getProperty(const QString& property) {
|
|
||||||
if (property == "bounds") {
|
|
||||||
return qRectToVariant(_bounds);
|
|
||||||
}
|
|
||||||
if (property == "x") {
|
|
||||||
return _bounds.x();
|
|
||||||
}
|
|
||||||
if (property == "y") {
|
|
||||||
return _bounds.y();
|
|
||||||
}
|
|
||||||
if (property == "width") {
|
|
||||||
return _bounds.width();
|
|
||||||
}
|
|
||||||
if (property == "height") {
|
|
||||||
return _bounds.height();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Overlay::getProperty(property);
|
|
||||||
}
|
|
||||||
|
|
|
@ -26,10 +26,6 @@ public:
|
||||||
virtual uint32_t fetchMetaSubItems(render::ItemIDs& subItems) const override { subItems.push_back(getRenderItemID()); return 1; }
|
virtual uint32_t fetchMetaSubItems(render::ItemIDs& subItems) const override { subItems.push_back(getRenderItemID()); return 1; }
|
||||||
|
|
||||||
// getters
|
// getters
|
||||||
int getX() const { return _bounds.x(); }
|
|
||||||
int getY() const { return _bounds.y(); }
|
|
||||||
int getWidth() const { return _bounds.width(); }
|
|
||||||
int getHeight() const { return _bounds.height(); }
|
|
||||||
const QRect& getBoundingRect() const { return _bounds; }
|
const QRect& getBoundingRect() const { return _bounds; }
|
||||||
|
|
||||||
// setters
|
// setters
|
||||||
|
@ -40,7 +36,6 @@ public:
|
||||||
void setBounds(const QRect& bounds) { _bounds = bounds; }
|
void setBounds(const QRect& bounds) { _bounds = bounds; }
|
||||||
|
|
||||||
void setProperties(const QVariantMap& properties) override;
|
void setProperties(const QVariantMap& properties) override;
|
||||||
QVariant getProperty(const QString& property) override;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QRect _bounds; // where on the screen to draw
|
QRect _bounds; // where on the screen to draw
|
||||||
|
|
|
@ -772,6 +772,8 @@ QUuid Overlays::addOverlay(const QString& type, const QVariant& properties) {
|
||||||
return UNKNOWN_ENTITY_ID;
|
return UNKNOWN_ENTITY_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (type == ImageOverlay::TYPE || type == TextOverlay::TYPE || type == RectangleOverlay::TYPE) {
|
||||||
|
#if !defined(DISABLE_QML)
|
||||||
if (QThread::currentThread() != thread()) {
|
if (QThread::currentThread() != thread()) {
|
||||||
QUuid result;
|
QUuid result;
|
||||||
PROFILE_RANGE(script, __FUNCTION__);
|
PROFILE_RANGE(script, __FUNCTION__);
|
||||||
|
@ -781,21 +783,19 @@ QUuid Overlays::addOverlay(const QString& type, const QVariant& properties) {
|
||||||
|
|
||||||
Overlay::Pointer overlay;
|
Overlay::Pointer overlay;
|
||||||
if (type == ImageOverlay::TYPE) {
|
if (type == ImageOverlay::TYPE) {
|
||||||
#if !defined(DISABLE_QML)
|
|
||||||
overlay = Overlay::Pointer(new ImageOverlay(), [](Overlay* ptr) { ptr->deleteLater(); });
|
overlay = Overlay::Pointer(new ImageOverlay(), [](Overlay* ptr) { ptr->deleteLater(); });
|
||||||
#endif
|
|
||||||
} else if (type == TextOverlay::TYPE) {
|
} else if (type == TextOverlay::TYPE) {
|
||||||
#if !defined(DISABLE_QML)
|
|
||||||
overlay = Overlay::Pointer(new TextOverlay(), [](Overlay* ptr) { ptr->deleteLater(); });
|
overlay = Overlay::Pointer(new TextOverlay(), [](Overlay* ptr) { ptr->deleteLater(); });
|
||||||
#endif
|
|
||||||
} else if (type == RectangleOverlay::TYPE) {
|
} else if (type == RectangleOverlay::TYPE) {
|
||||||
overlay = Overlay::Pointer(new RectangleOverlay(), [](Overlay* ptr) { ptr->deleteLater(); });
|
overlay = Overlay::Pointer(new RectangleOverlay(), [](Overlay* ptr) { ptr->deleteLater(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (overlay) {
|
if (overlay) {
|
||||||
overlay->setProperties(properties.toMap());
|
overlay->setProperties(properties.toMap());
|
||||||
return add2DOverlay(overlay);
|
return add2DOverlay(overlay);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
return QUuid();
|
||||||
|
}
|
||||||
|
|
||||||
QString entityType = overlayToEntityType(type);
|
QString entityType = overlayToEntityType(type);
|
||||||
if (entityType == "Unknown") {
|
if (entityType == "Unknown") {
|
||||||
|
@ -835,15 +835,14 @@ QUuid Overlays::cloneOverlay(const QUuid& id) {
|
||||||
return UNKNOWN_ENTITY_ID;
|
return UNKNOWN_ENTITY_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Overlay::Pointer overlay = get2DOverlay(id);
|
||||||
|
if (overlay) {
|
||||||
if (QThread::currentThread() != thread()) {
|
if (QThread::currentThread() != thread()) {
|
||||||
QUuid result;
|
QUuid result;
|
||||||
PROFILE_RANGE(script, __FUNCTION__);
|
PROFILE_RANGE(script, __FUNCTION__);
|
||||||
BLOCKING_INVOKE_METHOD(this, "cloneOverlay", Q_RETURN_ARG(QUuid, result), Q_ARG(const QUuid&, id));
|
BLOCKING_INVOKE_METHOD(this, "cloneOverlay", Q_RETURN_ARG(QUuid, result), Q_ARG(const QUuid&, id));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Overlay::Pointer overlay = get2DOverlay(id);
|
|
||||||
if (overlay) {
|
|
||||||
return add2DOverlay(Overlay::Pointer(overlay->createClone(), [](Overlay* ptr) { ptr->deleteLater(); }));
|
return add2DOverlay(Overlay::Pointer(overlay->createClone(), [](Overlay* ptr) { ptr->deleteLater(); }));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -919,6 +918,11 @@ void Overlays::deleteOverlay(const QUuid& id) {
|
||||||
|
|
||||||
Overlay::Pointer overlay = take2DOverlay(id);
|
Overlay::Pointer overlay = take2DOverlay(id);
|
||||||
if (overlay) {
|
if (overlay) {
|
||||||
|
if (QThread::currentThread() != thread()) {
|
||||||
|
QMetaObject::invokeMethod(this, "deleteOverlay", Q_ARG(const QUuid&, id));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_overlaysToDelete.push_back(overlay);
|
_overlaysToDelete.push_back(overlay);
|
||||||
emit overlayDeleted(id);
|
emit overlayDeleted(id);
|
||||||
return;
|
return;
|
||||||
|
@ -933,15 +937,14 @@ QString Overlays::getOverlayType(const QUuid& id) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Overlay::Pointer overlay = get2DOverlay(id);
|
||||||
|
if (overlay) {
|
||||||
if (QThread::currentThread() != thread()) {
|
if (QThread::currentThread() != thread()) {
|
||||||
QString result;
|
QString result;
|
||||||
PROFILE_RANGE(script, __FUNCTION__);
|
PROFILE_RANGE(script, __FUNCTION__);
|
||||||
BLOCKING_INVOKE_METHOD(this, "getOverlayType", Q_RETURN_ARG(QString, result), Q_ARG(const QUuid&, id));
|
BLOCKING_INVOKE_METHOD(this, "getOverlayType", Q_RETURN_ARG(QString, result), Q_ARG(const QUuid&, id));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Overlay::Pointer overlay = get2DOverlay(id);
|
|
||||||
if (overlay) {
|
|
||||||
return overlay->getType();
|
return overlay->getType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -949,15 +952,14 @@ QString Overlays::getOverlayType(const QUuid& id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QObject* Overlays::getOverlayObject(const QUuid& id) {
|
QObject* Overlays::getOverlayObject(const QUuid& id) {
|
||||||
|
Overlay::Pointer overlay = get2DOverlay(id);
|
||||||
|
if (overlay) {
|
||||||
if (QThread::currentThread() != thread()) {
|
if (QThread::currentThread() != thread()) {
|
||||||
QObject* result;
|
QObject* result;
|
||||||
PROFILE_RANGE(script, __FUNCTION__);
|
PROFILE_RANGE(script, __FUNCTION__);
|
||||||
BLOCKING_INVOKE_METHOD(this, "getOverlayObject", Q_RETURN_ARG(QObject*, result), Q_ARG(const QUuid&, id));
|
BLOCKING_INVOKE_METHOD(this, "getOverlayObject", Q_RETURN_ARG(QObject*, result), Q_ARG(const QUuid&, id));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Overlay::Pointer overlay = get2DOverlay(id);
|
|
||||||
if (overlay) {
|
|
||||||
return qobject_cast<QObject*>(&(*overlay));
|
return qobject_cast<QObject*>(&(*overlay));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -969,6 +971,12 @@ QUuid Overlays::getOverlayAtPoint(const glm::vec2& point) {
|
||||||
return UNKNOWN_ENTITY_ID;
|
return UNKNOWN_ENTITY_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (QThread::currentThread() != thread()) {
|
||||||
|
QUuid result;
|
||||||
|
BLOCKING_INVOKE_METHOD(this, "getOverlayAtPoint", Q_RETURN_ARG(QUuid, result), Q_ARG(const glm::vec2&, point));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
QMutexLocker locker(&_mutex);
|
QMutexLocker locker(&_mutex);
|
||||||
QMapIterator<QUuid, Overlay::Pointer> i(_overlays);
|
QMapIterator<QUuid, Overlay::Pointer> i(_overlays);
|
||||||
unsigned int bestStackOrder = 0;
|
unsigned int bestStackOrder = 0;
|
||||||
|
@ -976,8 +984,7 @@ QUuid Overlays::getOverlayAtPoint(const glm::vec2& point) {
|
||||||
while (i.hasNext()) {
|
while (i.hasNext()) {
|
||||||
i.next();
|
i.next();
|
||||||
auto thisOverlay = std::dynamic_pointer_cast<Overlay2D>(i.value());
|
auto thisOverlay = std::dynamic_pointer_cast<Overlay2D>(i.value());
|
||||||
if (thisOverlay && thisOverlay->getVisible() && thisOverlay->isLoaded() &&
|
if (thisOverlay && thisOverlay->getVisible() && thisOverlay->getBoundingRect().contains(point.x, point.y, false)) {
|
||||||
thisOverlay->getBoundingRect().contains(point.x, point.y, false)) {
|
|
||||||
if (thisOverlay->getStackOrder() > bestStackOrder) {
|
if (thisOverlay->getStackOrder() > bestStackOrder) {
|
||||||
bestID = i.key();
|
bestID = i.key();
|
||||||
bestStackOrder = thisOverlay->getStackOrder();
|
bestStackOrder = thisOverlay->getStackOrder();
|
||||||
|
@ -991,9 +998,7 @@ QUuid Overlays::getOverlayAtPoint(const glm::vec2& point) {
|
||||||
QVariant Overlays::getProperty(const QUuid& id, const QString& property) {
|
QVariant Overlays::getProperty(const QUuid& id, const QString& property) {
|
||||||
Overlay::Pointer overlay = get2DOverlay(id);
|
Overlay::Pointer overlay = get2DOverlay(id);
|
||||||
if (overlay) {
|
if (overlay) {
|
||||||
if (overlay->supportsGetProperty()) {
|
// We don't support getting properties from QML Overlays right now
|
||||||
return overlay->getProperty(property);
|
|
||||||
}
|
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1009,12 +1014,8 @@ QVariantMap Overlays::getProperties(const QUuid& id, const QStringList& properti
|
||||||
Overlay::Pointer overlay = get2DOverlay(id);
|
Overlay::Pointer overlay = get2DOverlay(id);
|
||||||
QVariantMap result;
|
QVariantMap result;
|
||||||
if (overlay) {
|
if (overlay) {
|
||||||
if (overlay->supportsGetProperty()) {
|
// We don't support getting properties from QML Overlays right now
|
||||||
for (const auto& property : properties) {
|
return QVariantMap();
|
||||||
result.insert(property, overlay->getProperty(property));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantMap overlayProperties = convertEntityToOverlayProperties(DependencyManager::get<EntityScriptingInterface>()->getEntityProperties(id));
|
QVariantMap overlayProperties = convertEntityToOverlayProperties(DependencyManager::get<EntityScriptingInterface>()->getEntityProperties(id));
|
||||||
|
@ -1141,38 +1142,30 @@ void RayToOverlayIntersectionResultFromScriptValue(const QScriptValue& object, R
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Overlays::isLoaded(const QUuid& id) {
|
bool Overlays::isLoaded(const QUuid& id) {
|
||||||
if (QThread::currentThread() != thread()) {
|
|
||||||
bool result;
|
|
||||||
PROFILE_RANGE(script, __FUNCTION__);
|
|
||||||
BLOCKING_INVOKE_METHOD(this, "isLoaded", Q_RETURN_ARG(bool, result), Q_ARG(const QUuid&, id));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
Overlay::Pointer overlay = get2DOverlay(id);
|
Overlay::Pointer overlay = get2DOverlay(id);
|
||||||
if (overlay) {
|
if (overlay) {
|
||||||
return overlay->isLoaded();
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return DependencyManager::get<EntityScriptingInterface>()->isLoaded(id);
|
return DependencyManager::get<EntityScriptingInterface>()->isLoaded(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
QSizeF Overlays::textSize(const QUuid& id, const QString& text) {
|
QSizeF Overlays::textSize(const QUuid& id, const QString& text) {
|
||||||
|
Overlay::Pointer overlay = get2DOverlay(id);
|
||||||
|
if (overlay) {
|
||||||
if (QThread::currentThread() != thread()) {
|
if (QThread::currentThread() != thread()) {
|
||||||
QSizeF result;
|
QSizeF result;
|
||||||
PROFILE_RANGE(script, __FUNCTION__);
|
PROFILE_RANGE(script, __FUNCTION__);
|
||||||
BLOCKING_INVOKE_METHOD(this, "textSize", Q_RETURN_ARG(QSizeF, result), Q_ARG(const QUuid&, id), Q_ARG(QString, text));
|
BLOCKING_INVOKE_METHOD(this, "textSize", Q_RETURN_ARG(QSizeF, result), Q_ARG(const QUuid&, id), Q_ARG(QString, text));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Overlay::Pointer overlay = get2DOverlay(id);
|
|
||||||
if (overlay) {
|
|
||||||
if (auto textOverlay = std::dynamic_pointer_cast<TextOverlay>(overlay)) {
|
if (auto textOverlay = std::dynamic_pointer_cast<TextOverlay>(overlay)) {
|
||||||
return textOverlay->textSize(text);
|
return textOverlay->textSize(text);
|
||||||
}
|
}
|
||||||
return QSizeF(0.0f, 0.0f);
|
return QSizeF(0.0f, 0.0f);
|
||||||
} else {
|
|
||||||
return DependencyManager::get<EntityScriptingInterface>()->textSize(id, text);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return DependencyManager::get<EntityScriptingInterface>()->textSize(id, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Overlays::isAddedOverlay(const QUuid& id) {
|
bool Overlays::isAddedOverlay(const QUuid& id) {
|
||||||
|
|
|
@ -57,29 +57,15 @@ QmlOverlay::~QmlOverlay() {
|
||||||
|
|
||||||
// QmlOverlay replaces Overlay's properties with those defined in the QML file used but keeps Overlay2D's properties.
|
// QmlOverlay replaces Overlay's properties with those defined in the QML file used but keeps Overlay2D's properties.
|
||||||
void QmlOverlay::setProperties(const QVariantMap& properties) {
|
void QmlOverlay::setProperties(const QVariantMap& properties) {
|
||||||
if (QThread::currentThread() != thread()) {
|
|
||||||
QMetaObject::invokeMethod(this, "setProperties", Q_ARG(QVariantMap, properties));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Overlay2D::setProperties(properties);
|
Overlay2D::setProperties(properties);
|
||||||
auto bounds = _bounds;
|
|
||||||
// check to see if qmlElement still exists
|
// check to see if qmlElement still exists
|
||||||
if (_qmlElement) {
|
if (_qmlElement) {
|
||||||
_qmlElement->setX(bounds.left());
|
_qmlElement->setX(_bounds.left());
|
||||||
_qmlElement->setY(bounds.top());
|
_qmlElement->setY(_bounds.top());
|
||||||
_qmlElement->setWidth(bounds.width());
|
_qmlElement->setWidth(_bounds.width());
|
||||||
_qmlElement->setHeight(bounds.height());
|
_qmlElement->setHeight(_bounds.height());
|
||||||
|
_qmlElement->setVisible(_visible);
|
||||||
QMetaObject::invokeMethod(_qmlElement, "updatePropertiesFromScript", Qt::DirectConnection, Q_ARG(QVariant, properties));
|
QMetaObject::invokeMethod(_qmlElement, "updatePropertiesFromScript", Qt::DirectConnection, Q_ARG(QVariant, properties));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlOverlay::render(RenderArgs* args) {
|
|
||||||
if (!_qmlElement) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_visible != _qmlElement->isVisible()) {
|
|
||||||
_qmlElement->setVisible(_visible);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -25,10 +25,8 @@ public:
|
||||||
QmlOverlay(const QUrl& url, const QmlOverlay* overlay);
|
QmlOverlay(const QUrl& url, const QmlOverlay* overlay);
|
||||||
~QmlOverlay();
|
~QmlOverlay();
|
||||||
|
|
||||||
bool supportsGetProperty() const override { return false; }
|
|
||||||
|
|
||||||
void setProperties(const QVariantMap& properties) override;
|
void setProperties(const QVariantMap& properties) override;
|
||||||
void render(RenderArgs* args) override;
|
void render(RenderArgs* args) override {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_INVOKABLE void qmlElementDestroyed();
|
Q_INVOKABLE void qmlElementDestroyed();
|
||||||
|
|
|
@ -95,57 +95,85 @@ void AnimClip::setCurrentFrameInternal(float frame) {
|
||||||
_frame = ::accumulateTime(_startFrame, _endFrame, _timeScale, frame + _startFrame, dt, _loopFlag, _id, triggers);
|
_frame = ::accumulateTime(_startFrame, _endFrame, _timeScale, frame + _startFrame, dt, _loopFlag, _id, triggers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::vector<int> buildJointIndexMap(const AnimSkeleton& dstSkeleton, const AnimSkeleton& srcSkeleton) {
|
||||||
|
std::vector<int> jointIndexMap;
|
||||||
|
int srcJointCount = srcSkeleton.getNumJoints();
|
||||||
|
jointIndexMap.reserve(srcJointCount);
|
||||||
|
for (int srcJointIndex = 0; srcJointIndex < srcJointCount; srcJointIndex++) {
|
||||||
|
QString srcJointName = srcSkeleton.getJointName(srcJointIndex);
|
||||||
|
int dstJointIndex = dstSkeleton.nameToJointIndex(srcJointName);
|
||||||
|
jointIndexMap.push_back(dstJointIndex);
|
||||||
|
}
|
||||||
|
return jointIndexMap;
|
||||||
|
}
|
||||||
|
|
||||||
void AnimClip::copyFromNetworkAnim() {
|
void AnimClip::copyFromNetworkAnim() {
|
||||||
assert(_networkAnim && _networkAnim->isLoaded() && _skeleton);
|
assert(_networkAnim && _networkAnim->isLoaded() && _skeleton);
|
||||||
_anim.clear();
|
_anim.clear();
|
||||||
|
|
||||||
auto avatarSkeleton = getSkeleton();
|
auto avatarSkeleton = getSkeleton();
|
||||||
|
|
||||||
// build a mapping from animation joint indices to avatar joint indices.
|
|
||||||
// by matching joints with the same name.
|
|
||||||
const HFMModel& animModel = _networkAnim->getHFMModel();
|
const HFMModel& animModel = _networkAnim->getHFMModel();
|
||||||
AnimSkeleton animSkeleton(animModel);
|
AnimSkeleton animSkeleton(animModel);
|
||||||
const int animJointCount = animSkeleton.getNumJoints();
|
const int animJointCount = animSkeleton.getNumJoints();
|
||||||
const int avatarJointCount = avatarSkeleton->getNumJoints();
|
const int avatarJointCount = avatarSkeleton->getNumJoints();
|
||||||
std::vector<int> animToAvatarJointIndexMap;
|
|
||||||
animToAvatarJointIndexMap.reserve(animJointCount);
|
// build a mapping from animation joint indices to avatar joint indices by matching joints with the same name.
|
||||||
for (int animJointIndex = 0; animJointIndex < animJointCount; animJointIndex++) {
|
std::vector<int> avatarToAnimJointIndexMap = buildJointIndexMap(animSkeleton, *avatarSkeleton);
|
||||||
QString animJointName = animSkeleton.getJointName(animJointIndex);
|
|
||||||
int avatarJointIndex = avatarSkeleton->nameToJointIndex(animJointName);
|
|
||||||
animToAvatarJointIndexMap.push_back(avatarJointIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
const int animFrameCount = animModel.animationFrames.size();
|
const int animFrameCount = animModel.animationFrames.size();
|
||||||
_anim.resize(animFrameCount);
|
_anim.resize(animFrameCount);
|
||||||
|
|
||||||
for (int frame = 0; frame < animFrameCount; frame++) {
|
for (int frame = 0; frame < animFrameCount; frame++) {
|
||||||
|
|
||||||
const HFMAnimationFrame& animFrame = animModel.animationFrames[frame];
|
const HFMAnimationFrame& animFrame = animModel.animationFrames[frame];
|
||||||
|
|
||||||
// init all joints in animation to default pose
|
// extract the full rotations from the animFrame (including pre and post rotations from the animModel).
|
||||||
// this will give us a resonable result for bones in the avatar skeleton but not in the animation.
|
std::vector<glm::quat> animRotations;
|
||||||
_anim[frame].reserve(avatarJointCount);
|
animRotations.reserve(animJointCount);
|
||||||
for (int avatarJointIndex = 0; avatarJointIndex < avatarJointCount; avatarJointIndex++) {
|
for (int i = 0; i < animJointCount; i++) {
|
||||||
_anim[frame].push_back(avatarSkeleton->getRelativeDefaultPose(avatarJointIndex));
|
animRotations.push_back(animModel.joints[i].preRotation * animFrame.rotations[i] * animModel.joints[i].postRotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int animJointIndex = 0; animJointIndex < animJointCount; animJointIndex++) {
|
// convert rotations into absolute frame
|
||||||
int avatarJointIndex = animToAvatarJointIndexMap[animJointIndex];
|
animSkeleton.convertRelativeRotationsToAbsolute(animRotations);
|
||||||
|
|
||||||
// skip joints that are in the animation but not in the avatar.
|
// build absolute rotations for the avatar
|
||||||
if (avatarJointIndex >= 0 && avatarJointIndex < avatarJointCount) {
|
std::vector<glm::quat> avatarRotations;
|
||||||
|
avatarRotations.reserve(avatarJointCount);
|
||||||
|
for (int avatarJointIndex = 0; avatarJointIndex < avatarJointCount; avatarJointIndex++) {
|
||||||
|
int animJointIndex = avatarToAnimJointIndexMap[avatarJointIndex];
|
||||||
|
if (animJointIndex >= 0) {
|
||||||
|
// This joint is in both animation and avatar.
|
||||||
|
// Set the absolute rotation directly
|
||||||
|
avatarRotations.push_back(animRotations[animJointIndex]);
|
||||||
|
} else {
|
||||||
|
// This joint is NOT in the animation at all.
|
||||||
|
// Set it so that the default relative rotation remains unchanged.
|
||||||
|
glm::quat avatarRelativeDefaultRot = avatarSkeleton->getRelativeDefaultPose(avatarJointIndex).rot();
|
||||||
|
glm::quat avatarParentAbsoluteRot;
|
||||||
|
int avatarParentJointIndex = avatarSkeleton->getParentIndex(avatarJointIndex);
|
||||||
|
if (avatarParentJointIndex >= 0) {
|
||||||
|
avatarParentAbsoluteRot = avatarRotations[avatarParentJointIndex];
|
||||||
|
}
|
||||||
|
avatarRotations.push_back(avatarParentAbsoluteRot * avatarRelativeDefaultRot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const glm::vec3& animTrans = animFrame.translations[animJointIndex];
|
// convert avatar rotations into relative frame
|
||||||
const glm::quat& animRot = animFrame.rotations[animJointIndex];
|
avatarSkeleton->convertAbsoluteRotationsToRelative(avatarRotations);
|
||||||
|
|
||||||
const AnimPose& animPreRotPose = animSkeleton.getPreRotationPose(animJointIndex);
|
_anim[frame].reserve(avatarJointCount);
|
||||||
AnimPose animPostRotPose = animSkeleton.getPostRotationPose(animJointIndex);
|
|
||||||
AnimPose animRotPose(glm::vec3(1.0f), animRot, glm::vec3());
|
|
||||||
|
|
||||||
// adjust anim scale to equal the scale from the avatar joint.
|
for (int avatarJointIndex = 0; avatarJointIndex < avatarJointCount; avatarJointIndex++) {
|
||||||
// we do not support animated scale.
|
|
||||||
const AnimPose& avatarDefaultPose = avatarSkeleton->getRelativeDefaultPose(avatarJointIndex);
|
const AnimPose& avatarDefaultPose = avatarSkeleton->getRelativeDefaultPose(avatarJointIndex);
|
||||||
animPostRotPose.scale() = avatarDefaultPose.scale();
|
|
||||||
|
// copy scale over from avatar default pose
|
||||||
|
glm::vec3 relativeScale = avatarDefaultPose.scale();
|
||||||
|
|
||||||
|
glm::vec3 relativeTranslation;
|
||||||
|
int animJointIndex = avatarToAnimJointIndexMap[avatarJointIndex];
|
||||||
|
if (animJointIndex >= 0) {
|
||||||
|
// This joint is in both animation and avatar.
|
||||||
|
const glm::vec3& animTrans = animFrame.translations[animJointIndex];
|
||||||
|
|
||||||
// retarget translation from animation to avatar
|
// retarget translation from animation to avatar
|
||||||
const glm::vec3& animZeroTrans = animModel.animationFrames[0].translations[animJointIndex];
|
const glm::vec3& animZeroTrans = animModel.animationFrames[0].translations[animJointIndex];
|
||||||
|
@ -192,11 +220,15 @@ void AnimClip::copyFromNetworkAnim() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AnimPose animTransPose = AnimPose(glm::vec3(1.0f), glm::quat(), avatarDefaultPose.trans() + boneLengthScale * (animTrans - animZeroTrans));
|
relativeTranslation = avatarDefaultPose.trans() + boneLengthScale * (animTrans - animZeroTrans);
|
||||||
|
} else {
|
||||||
_anim[frame][avatarJointIndex] = animTransPose * animPreRotPose * animRotPose * animPostRotPose;
|
// This joint is NOT in the animation at all.
|
||||||
|
// preserve the default translation.
|
||||||
|
relativeTranslation = avatarDefaultPose.trans();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// build the final pose
|
||||||
|
_anim[frame].push_back(AnimPose(relativeScale, avatarRotations[avatarJointIndex], relativeTranslation));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -152,8 +152,19 @@ void AnimSkeleton::convertAbsolutePosesToRelative(AnimPoseVec& poses) const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AnimSkeleton::convertRelativeRotationsToAbsolute(std::vector<glm::quat>& rotations) const {
|
||||||
|
// rotations start off relative and leave in absolute frame
|
||||||
|
int lastIndex = std::min((int)rotations.size(), _jointsSize);
|
||||||
|
for (int i = 0; i < lastIndex; ++i) {
|
||||||
|
int parentIndex = _parentIndices[i];
|
||||||
|
if (parentIndex != -1) {
|
||||||
|
rotations[i] = rotations[parentIndex] * rotations[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AnimSkeleton::convertAbsoluteRotationsToRelative(std::vector<glm::quat>& rotations) const {
|
void AnimSkeleton::convertAbsoluteRotationsToRelative(std::vector<glm::quat>& rotations) const {
|
||||||
// poses start off absolute and leave in relative frame
|
// rotations start off absolute and leave in relative frame
|
||||||
int lastIndex = std::min((int)rotations.size(), _jointsSize);
|
int lastIndex = std::min((int)rotations.size(), _jointsSize);
|
||||||
for (int i = lastIndex - 1; i >= 0; --i) {
|
for (int i = lastIndex - 1; i >= 0; --i) {
|
||||||
int parentIndex = _parentIndices[i];
|
int parentIndex = _parentIndices[i];
|
||||||
|
|
|
@ -55,6 +55,7 @@ public:
|
||||||
void convertRelativePosesToAbsolute(AnimPoseVec& poses) const;
|
void convertRelativePosesToAbsolute(AnimPoseVec& poses) const;
|
||||||
void convertAbsolutePosesToRelative(AnimPoseVec& poses) const;
|
void convertAbsolutePosesToRelative(AnimPoseVec& poses) const;
|
||||||
|
|
||||||
|
void convertRelativeRotationsToAbsolute(std::vector<glm::quat>& rotations) const;
|
||||||
void convertAbsoluteRotationsToRelative(std::vector<glm::quat>& rotations) const;
|
void convertAbsoluteRotationsToRelative(std::vector<glm::quat>& rotations) const;
|
||||||
|
|
||||||
void saveNonMirroredPoses(const AnimPoseVec& poses) const;
|
void saveNonMirroredPoses(const AnimPoseVec& poses) const;
|
||||||
|
|
|
@ -232,8 +232,6 @@ void EntityTreeRenderer::clearNonLocalEntities() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
scene->enqueueTransaction(transaction);
|
scene->enqueueTransaction(transaction);
|
||||||
} else {
|
|
||||||
qCWarning(entitiesrenderer) << "EntitityTreeRenderer::clear(), Unexpected null scene, possibly during application shutdown";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_renderablesToUpdate = savedEntities;
|
_renderablesToUpdate = savedEntities;
|
||||||
|
|
|
@ -266,6 +266,7 @@ void WebEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& scene
|
||||||
_webSurface->resize(QSize(windowSize.x, windowSize.y));
|
_webSurface->resize(QSize(windowSize.x, windowSize.y));
|
||||||
updateModelTransformAndBound();
|
updateModelTransformAndBound();
|
||||||
_renderTransform = getModelTransform();
|
_renderTransform = getModelTransform();
|
||||||
|
_renderTransform.setScale(1.0f);
|
||||||
_renderTransform.postScale(entity->getScaledDimensions());
|
_renderTransform.postScale(entity->getScaledDimensions());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -79,6 +79,8 @@ EntityPropertyFlags EntityItem::getEntityProperties(EncodeBitstreamParams& param
|
||||||
|
|
||||||
// Core
|
// Core
|
||||||
requestedProperties += PROP_SIMULATION_OWNER;
|
requestedProperties += PROP_SIMULATION_OWNER;
|
||||||
|
requestedProperties += PROP_PARENT_ID;
|
||||||
|
requestedProperties += PROP_PARENT_JOINT_INDEX;
|
||||||
requestedProperties += PROP_VISIBLE;
|
requestedProperties += PROP_VISIBLE;
|
||||||
requestedProperties += PROP_NAME;
|
requestedProperties += PROP_NAME;
|
||||||
requestedProperties += PROP_LOCKED;
|
requestedProperties += PROP_LOCKED;
|
||||||
|
@ -93,8 +95,6 @@ EntityPropertyFlags EntityItem::getEntityProperties(EncodeBitstreamParams& param
|
||||||
requestedProperties += PROP_LAST_EDITED_BY;
|
requestedProperties += PROP_LAST_EDITED_BY;
|
||||||
requestedProperties += PROP_ENTITY_HOST_TYPE;
|
requestedProperties += PROP_ENTITY_HOST_TYPE;
|
||||||
requestedProperties += PROP_OWNING_AVATAR_ID;
|
requestedProperties += PROP_OWNING_AVATAR_ID;
|
||||||
requestedProperties += PROP_PARENT_ID;
|
|
||||||
requestedProperties += PROP_PARENT_JOINT_INDEX;
|
|
||||||
requestedProperties += PROP_QUERY_AA_CUBE;
|
requestedProperties += PROP_QUERY_AA_CUBE;
|
||||||
requestedProperties += PROP_CAN_CAST_SHADOW;
|
requestedProperties += PROP_CAN_CAST_SHADOW;
|
||||||
requestedProperties += PROP_VISIBLE_IN_SECONDARY_CAMERA;
|
requestedProperties += PROP_VISIBLE_IN_SECONDARY_CAMERA;
|
||||||
|
@ -260,6 +260,14 @@ OctreeElement::AppendState EntityItem::appendEntityData(OctreePacketData* packet
|
||||||
// PROP_CUSTOM_PROPERTIES_INCLUDED,
|
// PROP_CUSTOM_PROPERTIES_INCLUDED,
|
||||||
|
|
||||||
APPEND_ENTITY_PROPERTY(PROP_SIMULATION_OWNER, _simulationOwner.toByteArray());
|
APPEND_ENTITY_PROPERTY(PROP_SIMULATION_OWNER, _simulationOwner.toByteArray());
|
||||||
|
// convert AVATAR_SELF_ID to actual sessionUUID.
|
||||||
|
QUuid actualParentID = getParentID();
|
||||||
|
if (actualParentID == AVATAR_SELF_ID) {
|
||||||
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
|
actualParentID = nodeList->getSessionUUID();
|
||||||
|
}
|
||||||
|
APPEND_ENTITY_PROPERTY(PROP_PARENT_ID, actualParentID);
|
||||||
|
APPEND_ENTITY_PROPERTY(PROP_PARENT_JOINT_INDEX, getParentJointIndex());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_VISIBLE, getVisible());
|
APPEND_ENTITY_PROPERTY(PROP_VISIBLE, getVisible());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_NAME, getName());
|
APPEND_ENTITY_PROPERTY(PROP_NAME, getName());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_LOCKED, getLocked());
|
APPEND_ENTITY_PROPERTY(PROP_LOCKED, getLocked());
|
||||||
|
@ -274,14 +282,6 @@ OctreeElement::AppendState EntityItem::appendEntityData(OctreePacketData* packet
|
||||||
APPEND_ENTITY_PROPERTY(PROP_LAST_EDITED_BY, getLastEditedBy());
|
APPEND_ENTITY_PROPERTY(PROP_LAST_EDITED_BY, getLastEditedBy());
|
||||||
// APPEND_ENTITY_PROPERTY(PROP_ENTITY_HOST_TYPE, (uint32_t)getEntityHostType()); // not sent over the wire
|
// APPEND_ENTITY_PROPERTY(PROP_ENTITY_HOST_TYPE, (uint32_t)getEntityHostType()); // not sent over the wire
|
||||||
// APPEND_ENTITY_PROPERTY(PROP_OWNING_AVATAR_ID, getOwningAvatarID()); // not sent over the wire
|
// APPEND_ENTITY_PROPERTY(PROP_OWNING_AVATAR_ID, getOwningAvatarID()); // not sent over the wire
|
||||||
// convert AVATAR_SELF_ID to actual sessionUUID.
|
|
||||||
QUuid actualParentID = getParentID();
|
|
||||||
if (actualParentID == AVATAR_SELF_ID) {
|
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
|
||||||
actualParentID = nodeList->getSessionUUID();
|
|
||||||
}
|
|
||||||
APPEND_ENTITY_PROPERTY(PROP_PARENT_ID, actualParentID);
|
|
||||||
APPEND_ENTITY_PROPERTY(PROP_PARENT_JOINT_INDEX, getParentJointIndex());
|
|
||||||
APPEND_ENTITY_PROPERTY(PROP_QUERY_AA_CUBE, getQueryAACube());
|
APPEND_ENTITY_PROPERTY(PROP_QUERY_AA_CUBE, getQueryAACube());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_CAN_CAST_SHADOW, getCanCastShadow());
|
APPEND_ENTITY_PROPERTY(PROP_CAN_CAST_SHADOW, getCanCastShadow());
|
||||||
// APPEND_ENTITY_PROPERTY(PROP_VISIBLE_IN_SECONDARY_CAMERA, getIsVisibleInSecondaryCamera()); // not sent over the wire
|
// APPEND_ENTITY_PROPERTY(PROP_VISIBLE_IN_SECONDARY_CAMERA, getIsVisibleInSecondaryCamera()); // not sent over the wire
|
||||||
|
@ -792,6 +792,13 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
|
||||||
|
|
||||||
// Core
|
// Core
|
||||||
// PROP_SIMULATION_OWNER handled above
|
// PROP_SIMULATION_OWNER handled above
|
||||||
|
{ // parentID and parentJointIndex are protected by simulation ownership
|
||||||
|
bool oldOverwrite = overwriteLocalData;
|
||||||
|
overwriteLocalData = overwriteLocalData && !weOwnSimulation;
|
||||||
|
READ_ENTITY_PROPERTY(PROP_PARENT_ID, QUuid, setParentID);
|
||||||
|
READ_ENTITY_PROPERTY(PROP_PARENT_JOINT_INDEX, quint16, setParentJointIndex);
|
||||||
|
overwriteLocalData = oldOverwrite;
|
||||||
|
}
|
||||||
READ_ENTITY_PROPERTY(PROP_VISIBLE, bool, setVisible);
|
READ_ENTITY_PROPERTY(PROP_VISIBLE, bool, setVisible);
|
||||||
READ_ENTITY_PROPERTY(PROP_NAME, QString, setName);
|
READ_ENTITY_PROPERTY(PROP_NAME, QString, setName);
|
||||||
READ_ENTITY_PROPERTY(PROP_LOCKED, bool, setLocked);
|
READ_ENTITY_PROPERTY(PROP_LOCKED, bool, setLocked);
|
||||||
|
@ -835,13 +842,6 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
|
||||||
READ_ENTITY_PROPERTY(PROP_LAST_EDITED_BY, QUuid, setLastEditedBy);
|
READ_ENTITY_PROPERTY(PROP_LAST_EDITED_BY, QUuid, setLastEditedBy);
|
||||||
// READ_ENTITY_PROPERTY(PROP_ENTITY_HOST_TYPE, entity::HostType, setEntityHostType); // not sent over the wire
|
// READ_ENTITY_PROPERTY(PROP_ENTITY_HOST_TYPE, entity::HostType, setEntityHostType); // not sent over the wire
|
||||||
// READ_ENTITY_PROPERTY(PROP_OWNING_AVATAR_ID, QUuuid, setOwningAvatarID); // not sent over the wire
|
// READ_ENTITY_PROPERTY(PROP_OWNING_AVATAR_ID, QUuuid, setOwningAvatarID); // not sent over the wire
|
||||||
{ // parentID and parentJointIndex are protected by simulation ownership
|
|
||||||
bool oldOverwrite = overwriteLocalData;
|
|
||||||
overwriteLocalData = overwriteLocalData && !weOwnSimulation;
|
|
||||||
READ_ENTITY_PROPERTY(PROP_PARENT_ID, QUuid, setParentID);
|
|
||||||
READ_ENTITY_PROPERTY(PROP_PARENT_JOINT_INDEX, quint16, setParentJointIndex);
|
|
||||||
overwriteLocalData = oldOverwrite;
|
|
||||||
}
|
|
||||||
{ // See comment above
|
{ // See comment above
|
||||||
auto customUpdateQueryAACubeFromNetwork = [this, shouldUpdate, lastEdited](AACube value) {
|
auto customUpdateQueryAACubeFromNetwork = [this, shouldUpdate, lastEdited](AACube value) {
|
||||||
if (shouldUpdate(_lastUpdatedQueryAACubeTimestamp, value != _lastUpdatedQueryAACubeValue)) {
|
if (shouldUpdate(_lastUpdatedQueryAACubeTimestamp, value != _lastUpdatedQueryAACubeValue)) {
|
||||||
|
@ -1309,6 +1309,8 @@ EntityItemProperties EntityItem::getProperties(const EntityPropertyFlags& desire
|
||||||
|
|
||||||
// Core
|
// Core
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(simulationOwner, getSimulationOwner);
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(simulationOwner, getSimulationOwner);
|
||||||
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(parentID, getParentID);
|
||||||
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(parentJointIndex, getParentJointIndex);
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(visible, getVisible);
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(visible, getVisible);
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(name, getName);
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(name, getName);
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(locked, getLocked);
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(locked, getLocked);
|
||||||
|
@ -1323,8 +1325,6 @@ EntityItemProperties EntityItem::getProperties(const EntityPropertyFlags& desire
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(lastEditedBy, getLastEditedBy);
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(lastEditedBy, getLastEditedBy);
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(entityHostType, getEntityHostType);
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(entityHostType, getEntityHostType);
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(owningAvatarID, getOwningAvatarID);
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(owningAvatarID, getOwningAvatarID);
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(parentID, getParentID);
|
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(parentJointIndex, getParentJointIndex);
|
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(queryAACube, getQueryAACube);
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(queryAACube, getQueryAACube);
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(canCastShadow, getCanCastShadow);
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(canCastShadow, getCanCastShadow);
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(isVisibleInSecondaryCamera, isVisibleInSecondaryCamera);
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(isVisibleInSecondaryCamera, isVisibleInSecondaryCamera);
|
||||||
|
@ -1456,6 +1456,8 @@ bool EntityItem::setProperties(const EntityItemProperties& properties) {
|
||||||
|
|
||||||
// Core
|
// Core
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(simulationOwner, setSimulationOwner);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(simulationOwner, setSimulationOwner);
|
||||||
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(parentID, setParentID);
|
||||||
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(parentJointIndex, setParentJointIndex);
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(visible, setVisible);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(visible, setVisible);
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(name, setName);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(name, setName);
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(locked, setLocked);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(locked, setLocked);
|
||||||
|
@ -1470,8 +1472,6 @@ bool EntityItem::setProperties(const EntityItemProperties& properties) {
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(lastEditedBy, setLastEditedBy);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(lastEditedBy, setLastEditedBy);
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(entityHostType, setEntityHostType);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(entityHostType, setEntityHostType);
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(owningAvatarID, setOwningAvatarID);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(owningAvatarID, setOwningAvatarID);
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(parentID, setParentID);
|
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(parentJointIndex, setParentJointIndex);
|
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(queryAACube, setQueryAACube);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(queryAACube, setQueryAACube);
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(canCastShadow, setCanCastShadow);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(canCastShadow, setCanCastShadow);
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(isVisibleInSecondaryCamera, setIsVisibleInSecondaryCamera);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(isVisibleInSecondaryCamera, setIsVisibleInSecondaryCamera);
|
||||||
|
|
|
@ -197,7 +197,7 @@ public:
|
||||||
void setDescription(const QString& value);
|
void setDescription(const QString& value);
|
||||||
|
|
||||||
/// Dimensions in meters (0.0 - TREE_SCALE)
|
/// Dimensions in meters (0.0 - TREE_SCALE)
|
||||||
glm::vec3 getScaledDimensions() const;
|
virtual glm::vec3 getScaledDimensions() const;
|
||||||
virtual void setScaledDimensions(const glm::vec3& value);
|
virtual void setScaledDimensions(const glm::vec3& value);
|
||||||
virtual glm::vec3 getRaycastDimensions() const { return getScaledDimensions(); }
|
virtual glm::vec3 getRaycastDimensions() const { return getScaledDimensions(); }
|
||||||
|
|
||||||
|
|
|
@ -462,6 +462,8 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
|
||||||
|
|
||||||
// Core
|
// Core
|
||||||
CHECK_PROPERTY_CHANGE(PROP_SIMULATION_OWNER, simulationOwner);
|
CHECK_PROPERTY_CHANGE(PROP_SIMULATION_OWNER, simulationOwner);
|
||||||
|
CHECK_PROPERTY_CHANGE(PROP_PARENT_ID, parentID);
|
||||||
|
CHECK_PROPERTY_CHANGE(PROP_PARENT_JOINT_INDEX, parentJointIndex);
|
||||||
CHECK_PROPERTY_CHANGE(PROP_VISIBLE, visible);
|
CHECK_PROPERTY_CHANGE(PROP_VISIBLE, visible);
|
||||||
CHECK_PROPERTY_CHANGE(PROP_NAME, name);
|
CHECK_PROPERTY_CHANGE(PROP_NAME, name);
|
||||||
CHECK_PROPERTY_CHANGE(PROP_LOCKED, locked);
|
CHECK_PROPERTY_CHANGE(PROP_LOCKED, locked);
|
||||||
|
@ -476,8 +478,6 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
|
||||||
CHECK_PROPERTY_CHANGE(PROP_LAST_EDITED_BY, lastEditedBy);
|
CHECK_PROPERTY_CHANGE(PROP_LAST_EDITED_BY, lastEditedBy);
|
||||||
CHECK_PROPERTY_CHANGE(PROP_ENTITY_HOST_TYPE, entityHostType);
|
CHECK_PROPERTY_CHANGE(PROP_ENTITY_HOST_TYPE, entityHostType);
|
||||||
CHECK_PROPERTY_CHANGE(PROP_OWNING_AVATAR_ID, owningAvatarID);
|
CHECK_PROPERTY_CHANGE(PROP_OWNING_AVATAR_ID, owningAvatarID);
|
||||||
CHECK_PROPERTY_CHANGE(PROP_PARENT_ID, parentID);
|
|
||||||
CHECK_PROPERTY_CHANGE(PROP_PARENT_JOINT_INDEX, parentJointIndex);
|
|
||||||
CHECK_PROPERTY_CHANGE(PROP_QUERY_AA_CUBE, queryAACube);
|
CHECK_PROPERTY_CHANGE(PROP_QUERY_AA_CUBE, queryAACube);
|
||||||
CHECK_PROPERTY_CHANGE(PROP_CAN_CAST_SHADOW, canCastShadow);
|
CHECK_PROPERTY_CHANGE(PROP_CAN_CAST_SHADOW, canCastShadow);
|
||||||
CHECK_PROPERTY_CHANGE(PROP_VISIBLE_IN_SECONDARY_CAMERA, isVisibleInSecondaryCamera);
|
CHECK_PROPERTY_CHANGE(PROP_VISIBLE_IN_SECONDARY_CAMERA, isVisibleInSecondaryCamera);
|
||||||
|
@ -1551,6 +1551,8 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
|
||||||
|
|
||||||
// Core properties
|
// Core properties
|
||||||
//COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_SIMULATION_OWNER, simulationOwner); // not exposed yet
|
//COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_SIMULATION_OWNER, simulationOwner); // not exposed yet
|
||||||
|
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_PARENT_ID, parentID);
|
||||||
|
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_PARENT_JOINT_INDEX, parentJointIndex);
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_VISIBLE, visible);
|
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_VISIBLE, visible);
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_NAME, name);
|
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_NAME, name);
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LOCKED, locked);
|
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LOCKED, locked);
|
||||||
|
@ -1565,8 +1567,6 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LAST_EDITED_BY, lastEditedBy);
|
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LAST_EDITED_BY, lastEditedBy);
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_ENTITY_HOST_TYPE, entityHostType, getEntityHostTypeAsString());
|
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_ENTITY_HOST_TYPE, entityHostType, getEntityHostTypeAsString());
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_OWNING_AVATAR_ID, owningAvatarID);
|
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_OWNING_AVATAR_ID, owningAvatarID);
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_PARENT_ID, parentID);
|
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_PARENT_JOINT_INDEX, parentJointIndex);
|
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_QUERY_AA_CUBE, queryAACube);
|
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_QUERY_AA_CUBE, queryAACube);
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_CAN_CAST_SHADOW, canCastShadow);
|
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_CAN_CAST_SHADOW, canCastShadow);
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_VISIBLE_IN_SECONDARY_CAMERA, isVisibleInSecondaryCamera);
|
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_VISIBLE_IN_SECONDARY_CAMERA, isVisibleInSecondaryCamera);
|
||||||
|
@ -1956,6 +1956,8 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object, bool
|
||||||
// not handled yet
|
// not handled yet
|
||||||
// COPY_PROPERTY_FROM_QSCRIPTVALUE(simulationOwner, SimulationOwner, setSimulationOwner);
|
// COPY_PROPERTY_FROM_QSCRIPTVALUE(simulationOwner, SimulationOwner, setSimulationOwner);
|
||||||
}
|
}
|
||||||
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(parentID, QUuid, setParentID);
|
||||||
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(parentJointIndex, quint16, setParentJointIndex);
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(visible, bool, setVisible);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(visible, bool, setVisible);
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(name, QString, setName);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(name, QString, setName);
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(locked, bool, setLocked);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(locked, bool, setLocked);
|
||||||
|
@ -1972,8 +1974,6 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object, bool
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(entityHostType, EntityHostType);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(entityHostType, EntityHostType);
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(owningAvatarID, QUuid, setOwningAvatarID);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(owningAvatarID, QUuid, setOwningAvatarID);
|
||||||
}
|
}
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(parentID, QUuid, setParentID);
|
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(parentJointIndex, quint16, setParentJointIndex);
|
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(queryAACube, AACube, setQueryAACube); // TODO: should scripts be able to set this?
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(queryAACube, AACube, setQueryAACube); // TODO: should scripts be able to set this?
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(canCastShadow, bool, setCanCastShadow);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(canCastShadow, bool, setCanCastShadow);
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(isVisibleInSecondaryCamera, bool, setIsVisibleInSecondaryCamera);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(isVisibleInSecondaryCamera, bool, setIsVisibleInSecondaryCamera);
|
||||||
|
@ -2243,6 +2243,8 @@ void EntityItemProperties::copyFromJSONString(QScriptEngine& scriptEngine, const
|
||||||
void EntityItemProperties::merge(const EntityItemProperties& other) {
|
void EntityItemProperties::merge(const EntityItemProperties& other) {
|
||||||
// Core
|
// Core
|
||||||
COPY_PROPERTY_IF_CHANGED(simulationOwner);
|
COPY_PROPERTY_IF_CHANGED(simulationOwner);
|
||||||
|
COPY_PROPERTY_IF_CHANGED(parentID);
|
||||||
|
COPY_PROPERTY_IF_CHANGED(parentJointIndex);
|
||||||
COPY_PROPERTY_IF_CHANGED(visible);
|
COPY_PROPERTY_IF_CHANGED(visible);
|
||||||
COPY_PROPERTY_IF_CHANGED(name);
|
COPY_PROPERTY_IF_CHANGED(name);
|
||||||
COPY_PROPERTY_IF_CHANGED(locked);
|
COPY_PROPERTY_IF_CHANGED(locked);
|
||||||
|
@ -2257,8 +2259,6 @@ void EntityItemProperties::merge(const EntityItemProperties& other) {
|
||||||
COPY_PROPERTY_IF_CHANGED(lastEditedBy);
|
COPY_PROPERTY_IF_CHANGED(lastEditedBy);
|
||||||
COPY_PROPERTY_IF_CHANGED(entityHostType);
|
COPY_PROPERTY_IF_CHANGED(entityHostType);
|
||||||
COPY_PROPERTY_IF_CHANGED(owningAvatarID);
|
COPY_PROPERTY_IF_CHANGED(owningAvatarID);
|
||||||
COPY_PROPERTY_IF_CHANGED(parentID);
|
|
||||||
COPY_PROPERTY_IF_CHANGED(parentJointIndex);
|
|
||||||
COPY_PROPERTY_IF_CHANGED(queryAACube);
|
COPY_PROPERTY_IF_CHANGED(queryAACube);
|
||||||
COPY_PROPERTY_IF_CHANGED(canCastShadow);
|
COPY_PROPERTY_IF_CHANGED(canCastShadow);
|
||||||
COPY_PROPERTY_IF_CHANGED(isVisibleInSecondaryCamera);
|
COPY_PROPERTY_IF_CHANGED(isVisibleInSecondaryCamera);
|
||||||
|
@ -2526,6 +2526,8 @@ bool EntityItemProperties::getPropertyInfo(const QString& propertyName, EntityPr
|
||||||
std::call_once(initMap, []() {
|
std::call_once(initMap, []() {
|
||||||
// Core
|
// Core
|
||||||
ADD_PROPERTY_TO_MAP(PROP_SIMULATION_OWNER, SimulationOwner, simulationOwner, SimulationOwner);
|
ADD_PROPERTY_TO_MAP(PROP_SIMULATION_OWNER, SimulationOwner, simulationOwner, SimulationOwner);
|
||||||
|
ADD_PROPERTY_TO_MAP(PROP_PARENT_ID, ParentID, parentID, QUuid);
|
||||||
|
ADD_PROPERTY_TO_MAP(PROP_PARENT_JOINT_INDEX, ParentJointIndex, parentJointIndex, uint16_t);
|
||||||
ADD_PROPERTY_TO_MAP(PROP_VISIBLE, Visible, visible, bool);
|
ADD_PROPERTY_TO_MAP(PROP_VISIBLE, Visible, visible, bool);
|
||||||
ADD_PROPERTY_TO_MAP(PROP_NAME, Name, name, QString);
|
ADD_PROPERTY_TO_MAP(PROP_NAME, Name, name, QString);
|
||||||
ADD_PROPERTY_TO_MAP(PROP_LOCKED, Locked, locked, bool);
|
ADD_PROPERTY_TO_MAP(PROP_LOCKED, Locked, locked, bool);
|
||||||
|
@ -2541,8 +2543,6 @@ bool EntityItemProperties::getPropertyInfo(const QString& propertyName, EntityPr
|
||||||
ADD_PROPERTY_TO_MAP(PROP_LAST_EDITED_BY, LastEditedBy, lastEditedBy, QUuid);
|
ADD_PROPERTY_TO_MAP(PROP_LAST_EDITED_BY, LastEditedBy, lastEditedBy, QUuid);
|
||||||
ADD_PROPERTY_TO_MAP(PROP_ENTITY_HOST_TYPE, EntityHostType, entityHostType, entity::HostType);
|
ADD_PROPERTY_TO_MAP(PROP_ENTITY_HOST_TYPE, EntityHostType, entityHostType, entity::HostType);
|
||||||
ADD_PROPERTY_TO_MAP(PROP_OWNING_AVATAR_ID, OwningAvatarID, owningAvatarID, QUuid);
|
ADD_PROPERTY_TO_MAP(PROP_OWNING_AVATAR_ID, OwningAvatarID, owningAvatarID, QUuid);
|
||||||
ADD_PROPERTY_TO_MAP(PROP_PARENT_ID, ParentID, parentID, QUuid);
|
|
||||||
ADD_PROPERTY_TO_MAP(PROP_PARENT_JOINT_INDEX, ParentJointIndex, parentJointIndex, uint16_t);
|
|
||||||
ADD_PROPERTY_TO_MAP(PROP_QUERY_AA_CUBE, QueryAACube, queryAACube, AACube);
|
ADD_PROPERTY_TO_MAP(PROP_QUERY_AA_CUBE, QueryAACube, queryAACube, AACube);
|
||||||
ADD_PROPERTY_TO_MAP(PROP_CAN_CAST_SHADOW, CanCastShadow, canCastShadow, bool);
|
ADD_PROPERTY_TO_MAP(PROP_CAN_CAST_SHADOW, CanCastShadow, canCastShadow, bool);
|
||||||
ADD_PROPERTY_TO_MAP(PROP_VISIBLE_IN_SECONDARY_CAMERA, IsVisibleInSecondaryCamera, isVisibleInSecondaryCamera, bool);
|
ADD_PROPERTY_TO_MAP(PROP_VISIBLE_IN_SECONDARY_CAMERA, IsVisibleInSecondaryCamera, isVisibleInSecondaryCamera, bool);
|
||||||
|
@ -2998,6 +2998,8 @@ OctreeElement::AppendState EntityItemProperties::encodeEntityEditPacket(PacketTy
|
||||||
|
|
||||||
|
|
||||||
APPEND_ENTITY_PROPERTY(PROP_SIMULATION_OWNER, properties._simulationOwner.toByteArray());
|
APPEND_ENTITY_PROPERTY(PROP_SIMULATION_OWNER, properties._simulationOwner.toByteArray());
|
||||||
|
APPEND_ENTITY_PROPERTY(PROP_PARENT_ID, properties.getParentID());
|
||||||
|
APPEND_ENTITY_PROPERTY(PROP_PARENT_JOINT_INDEX, properties.getParentJointIndex());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_VISIBLE, properties.getVisible());
|
APPEND_ENTITY_PROPERTY(PROP_VISIBLE, properties.getVisible());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_NAME, properties.getName());
|
APPEND_ENTITY_PROPERTY(PROP_NAME, properties.getName());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_LOCKED, properties.getLocked());
|
APPEND_ENTITY_PROPERTY(PROP_LOCKED, properties.getLocked());
|
||||||
|
@ -3012,8 +3014,6 @@ OctreeElement::AppendState EntityItemProperties::encodeEntityEditPacket(PacketTy
|
||||||
APPEND_ENTITY_PROPERTY(PROP_LAST_EDITED_BY, properties.getLastEditedBy());
|
APPEND_ENTITY_PROPERTY(PROP_LAST_EDITED_BY, properties.getLastEditedBy());
|
||||||
// APPEND_ENTITY_PROPERTY(PROP_ENTITY_HOST_TYPE, (uint32_t)properties.getEntityHostType()); // not sent over the wire
|
// APPEND_ENTITY_PROPERTY(PROP_ENTITY_HOST_TYPE, (uint32_t)properties.getEntityHostType()); // not sent over the wire
|
||||||
// APPEND_ENTITY_PROPERTY(PROP_OWNING_AVATAR_ID, properties.getOwningAvatarID()); // not sent over the wire
|
// APPEND_ENTITY_PROPERTY(PROP_OWNING_AVATAR_ID, properties.getOwningAvatarID()); // not sent over the wire
|
||||||
APPEND_ENTITY_PROPERTY(PROP_PARENT_ID, properties.getParentID());
|
|
||||||
APPEND_ENTITY_PROPERTY(PROP_PARENT_JOINT_INDEX, properties.getParentJointIndex());
|
|
||||||
APPEND_ENTITY_PROPERTY(PROP_QUERY_AA_CUBE, properties.getQueryAACube());
|
APPEND_ENTITY_PROPERTY(PROP_QUERY_AA_CUBE, properties.getQueryAACube());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_CAN_CAST_SHADOW, properties.getCanCastShadow());
|
APPEND_ENTITY_PROPERTY(PROP_CAN_CAST_SHADOW, properties.getCanCastShadow());
|
||||||
// APPEND_ENTITY_PROPERTY(PROP_VISIBLE_IN_SECONDARY_CAMERA, properties.getIsVisibleInSecondaryCamera()); // not sent over the wire
|
// APPEND_ENTITY_PROPERTY(PROP_VISIBLE_IN_SECONDARY_CAMERA, properties.getIsVisibleInSecondaryCamera()); // not sent over the wire
|
||||||
|
@ -3124,6 +3124,7 @@ OctreeElement::AppendState EntityItemProperties::encodeEntityEditPacket(PacketTy
|
||||||
APPEND_ENTITY_PROPERTY(PROP_TEXTURES, properties.getTextures());
|
APPEND_ENTITY_PROPERTY(PROP_TEXTURES, properties.getTextures());
|
||||||
|
|
||||||
APPEND_ENTITY_PROPERTY(PROP_MODEL_URL, properties.getModelURL());
|
APPEND_ENTITY_PROPERTY(PROP_MODEL_URL, properties.getModelURL());
|
||||||
|
APPEND_ENTITY_PROPERTY(PROP_MODEL_SCALE, properties.getModelScale());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_JOINT_ROTATIONS_SET, properties.getJointRotationsSet());
|
APPEND_ENTITY_PROPERTY(PROP_JOINT_ROTATIONS_SET, properties.getJointRotationsSet());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_JOINT_ROTATIONS, properties.getJointRotations());
|
APPEND_ENTITY_PROPERTY(PROP_JOINT_ROTATIONS, properties.getJointRotations());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_JOINT_TRANSLATIONS_SET, properties.getJointTranslationsSet());
|
APPEND_ENTITY_PROPERTY(PROP_JOINT_TRANSLATIONS_SET, properties.getJointTranslationsSet());
|
||||||
|
@ -3477,6 +3478,8 @@ bool EntityItemProperties::decodeEntityEditPacket(const unsigned char* data, int
|
||||||
processedBytes += propertyFlags.getEncodedLength();
|
processedBytes += propertyFlags.getEncodedLength();
|
||||||
|
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_SIMULATION_OWNER, QByteArray, setSimulationOwner);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_SIMULATION_OWNER, QByteArray, setSimulationOwner);
|
||||||
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_PARENT_ID, QUuid, setParentID);
|
||||||
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_PARENT_JOINT_INDEX, quint16, setParentJointIndex);
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_VISIBLE, bool, setVisible);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_VISIBLE, bool, setVisible);
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_NAME, QString, setName);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_NAME, QString, setName);
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LOCKED, bool, setLocked);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LOCKED, bool, setLocked);
|
||||||
|
@ -3491,8 +3494,6 @@ bool EntityItemProperties::decodeEntityEditPacket(const unsigned char* data, int
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LAST_EDITED_BY, QUuid, setLastEditedBy);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LAST_EDITED_BY, QUuid, setLastEditedBy);
|
||||||
// READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ENTITY_HOST_TYPE, entity::HostType, setEntityHostType); // not sent over the wire
|
// READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ENTITY_HOST_TYPE, entity::HostType, setEntityHostType); // not sent over the wire
|
||||||
// READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_OWNING_AVATAR_ID, QUuid, setOwningAvatarID); // not sent over the wire
|
// READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_OWNING_AVATAR_ID, QUuid, setOwningAvatarID); // not sent over the wire
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_PARENT_ID, QUuid, setParentID);
|
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_PARENT_JOINT_INDEX, quint16, setParentJointIndex);
|
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_QUERY_AA_CUBE, AACube, setQueryAACube);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_QUERY_AA_CUBE, AACube, setQueryAACube);
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_CAN_CAST_SHADOW, bool, setCanCastShadow);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_CAN_CAST_SHADOW, bool, setCanCastShadow);
|
||||||
// READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_VISIBLE_IN_SECONDARY_CAMERA, bool, setIsVisibleInSecondaryCamera); // not sent over the wire
|
// READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_VISIBLE_IN_SECONDARY_CAMERA, bool, setIsVisibleInSecondaryCamera); // not sent over the wire
|
||||||
|
@ -3599,6 +3600,7 @@ bool EntityItemProperties::decodeEntityEditPacket(const unsigned char* data, int
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_TEXTURES, QString, setTextures);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_TEXTURES, QString, setTextures);
|
||||||
|
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_MODEL_URL, QString, setModelURL);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_MODEL_URL, QString, setModelURL);
|
||||||
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_MODEL_SCALE, vec3, setModelScale);
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_JOINT_ROTATIONS_SET, QVector<bool>, setJointRotationsSet);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_JOINT_ROTATIONS_SET, QVector<bool>, setJointRotationsSet);
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_JOINT_ROTATIONS, QVector<quat>, setJointRotations);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_JOINT_ROTATIONS, QVector<quat>, setJointRotations);
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_JOINT_TRANSLATIONS_SET, QVector<bool>, setJointTranslationsSet);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_JOINT_TRANSLATIONS_SET, QVector<bool>, setJointTranslationsSet);
|
||||||
|
@ -3884,6 +3886,8 @@ bool EntityItemProperties::decodeCloneEntityMessage(const QByteArray& buffer, in
|
||||||
void EntityItemProperties::markAllChanged() {
|
void EntityItemProperties::markAllChanged() {
|
||||||
// Core
|
// Core
|
||||||
_simulationOwnerChanged = true;
|
_simulationOwnerChanged = true;
|
||||||
|
_parentIDChanged = true;
|
||||||
|
_parentJointIndexChanged = true;
|
||||||
_visibleChanged = true;
|
_visibleChanged = true;
|
||||||
_nameChanged = true;
|
_nameChanged = true;
|
||||||
_lockedChanged = true;
|
_lockedChanged = true;
|
||||||
|
@ -3898,8 +3902,6 @@ void EntityItemProperties::markAllChanged() {
|
||||||
_lastEditedByChanged = true;
|
_lastEditedByChanged = true;
|
||||||
_entityHostTypeChanged = true;
|
_entityHostTypeChanged = true;
|
||||||
_owningAvatarIDChanged = true;
|
_owningAvatarIDChanged = true;
|
||||||
_parentIDChanged = true;
|
|
||||||
_parentJointIndexChanged = true;
|
|
||||||
_queryAACubeChanged = true;
|
_queryAACubeChanged = true;
|
||||||
_canCastShadowChanged = true;
|
_canCastShadowChanged = true;
|
||||||
_isVisibleInSecondaryCameraChanged = true;
|
_isVisibleInSecondaryCameraChanged = true;
|
||||||
|
@ -4232,6 +4234,12 @@ QList<QString> EntityItemProperties::listChangedProperties() {
|
||||||
if (simulationOwnerChanged()) {
|
if (simulationOwnerChanged()) {
|
||||||
out += "simulationOwner";
|
out += "simulationOwner";
|
||||||
}
|
}
|
||||||
|
if (parentIDChanged()) {
|
||||||
|
out += "parentID";
|
||||||
|
}
|
||||||
|
if (parentJointIndexChanged()) {
|
||||||
|
out += "parentJointIndex";
|
||||||
|
}
|
||||||
if (visibleChanged()) {
|
if (visibleChanged()) {
|
||||||
out += "visible";
|
out += "visible";
|
||||||
}
|
}
|
||||||
|
@ -4274,12 +4282,6 @@ QList<QString> EntityItemProperties::listChangedProperties() {
|
||||||
if (owningAvatarIDChanged()) {
|
if (owningAvatarIDChanged()) {
|
||||||
out += "owningAvatarID";
|
out += "owningAvatarID";
|
||||||
}
|
}
|
||||||
if (parentIDChanged()) {
|
|
||||||
out += "parentID";
|
|
||||||
}
|
|
||||||
if (parentJointIndexChanged()) {
|
|
||||||
out += "parentJointIndex";
|
|
||||||
}
|
|
||||||
if (queryAACubeChanged()) {
|
if (queryAACubeChanged()) {
|
||||||
out += "queryAACube";
|
out += "queryAACube";
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,6 +161,8 @@ public:
|
||||||
|
|
||||||
// Core Properties
|
// Core Properties
|
||||||
DEFINE_PROPERTY_REF(PROP_SIMULATION_OWNER, SimulationOwner, simulationOwner, SimulationOwner, SimulationOwner());
|
DEFINE_PROPERTY_REF(PROP_SIMULATION_OWNER, SimulationOwner, simulationOwner, SimulationOwner, SimulationOwner());
|
||||||
|
DEFINE_PROPERTY_REF(PROP_PARENT_ID, ParentID, parentID, QUuid, UNKNOWN_ENTITY_ID);
|
||||||
|
DEFINE_PROPERTY_REF(PROP_PARENT_JOINT_INDEX, ParentJointIndex, parentJointIndex, quint16, -1);
|
||||||
DEFINE_PROPERTY(PROP_VISIBLE, Visible, visible, bool, ENTITY_ITEM_DEFAULT_VISIBLE);
|
DEFINE_PROPERTY(PROP_VISIBLE, Visible, visible, bool, ENTITY_ITEM_DEFAULT_VISIBLE);
|
||||||
DEFINE_PROPERTY_REF(PROP_NAME, Name, name, QString, ENTITY_ITEM_DEFAULT_NAME);
|
DEFINE_PROPERTY_REF(PROP_NAME, Name, name, QString, ENTITY_ITEM_DEFAULT_NAME);
|
||||||
DEFINE_PROPERTY(PROP_LOCKED, Locked, locked, bool, ENTITY_ITEM_DEFAULT_LOCKED);
|
DEFINE_PROPERTY(PROP_LOCKED, Locked, locked, bool, ENTITY_ITEM_DEFAULT_LOCKED);
|
||||||
|
@ -175,8 +177,6 @@ public:
|
||||||
DEFINE_PROPERTY_REF(PROP_LAST_EDITED_BY, LastEditedBy, lastEditedBy, QUuid, ENTITY_ITEM_DEFAULT_LAST_EDITED_BY);
|
DEFINE_PROPERTY_REF(PROP_LAST_EDITED_BY, LastEditedBy, lastEditedBy, QUuid, ENTITY_ITEM_DEFAULT_LAST_EDITED_BY);
|
||||||
DEFINE_PROPERTY_REF_ENUM(PROP_ENTITY_HOST_TYPE, EntityHostType, entityHostType, entity::HostType, entity::HostType::DOMAIN);
|
DEFINE_PROPERTY_REF_ENUM(PROP_ENTITY_HOST_TYPE, EntityHostType, entityHostType, entity::HostType, entity::HostType::DOMAIN);
|
||||||
DEFINE_PROPERTY_REF_WITH_SETTER(PROP_OWNING_AVATAR_ID, OwningAvatarID, owningAvatarID, QUuid, UNKNOWN_ENTITY_ID);
|
DEFINE_PROPERTY_REF_WITH_SETTER(PROP_OWNING_AVATAR_ID, OwningAvatarID, owningAvatarID, QUuid, UNKNOWN_ENTITY_ID);
|
||||||
DEFINE_PROPERTY_REF(PROP_PARENT_ID, ParentID, parentID, QUuid, UNKNOWN_ENTITY_ID);
|
|
||||||
DEFINE_PROPERTY_REF(PROP_PARENT_JOINT_INDEX, ParentJointIndex, parentJointIndex, quint16, -1);
|
|
||||||
DEFINE_PROPERTY_REF(PROP_QUERY_AA_CUBE, QueryAACube, queryAACube, AACube, AACube());
|
DEFINE_PROPERTY_REF(PROP_QUERY_AA_CUBE, QueryAACube, queryAACube, AACube, AACube());
|
||||||
DEFINE_PROPERTY(PROP_CAN_CAST_SHADOW, CanCastShadow, canCastShadow, bool, ENTITY_ITEM_DEFAULT_CAN_CAST_SHADOW);
|
DEFINE_PROPERTY(PROP_CAN_CAST_SHADOW, CanCastShadow, canCastShadow, bool, ENTITY_ITEM_DEFAULT_CAN_CAST_SHADOW);
|
||||||
DEFINE_PROPERTY(PROP_VISIBLE_IN_SECONDARY_CAMERA, IsVisibleInSecondaryCamera, isVisibleInSecondaryCamera, bool, ENTITY_ITEM_DEFAULT_VISIBLE_IN_SECONDARY_CAMERA);
|
DEFINE_PROPERTY(PROP_VISIBLE_IN_SECONDARY_CAMERA, IsVisibleInSecondaryCamera, isVisibleInSecondaryCamera, bool, ENTITY_ITEM_DEFAULT_VISIBLE_IN_SECONDARY_CAMERA);
|
||||||
|
|
|
@ -20,6 +20,8 @@ enum EntityPropertyList {
|
||||||
|
|
||||||
// Core properties
|
// Core properties
|
||||||
PROP_SIMULATION_OWNER,
|
PROP_SIMULATION_OWNER,
|
||||||
|
PROP_PARENT_ID,
|
||||||
|
PROP_PARENT_JOINT_INDEX,
|
||||||
PROP_VISIBLE,
|
PROP_VISIBLE,
|
||||||
PROP_NAME,
|
PROP_NAME,
|
||||||
PROP_LOCKED,
|
PROP_LOCKED,
|
||||||
|
@ -34,8 +36,6 @@ enum EntityPropertyList {
|
||||||
PROP_LAST_EDITED_BY,
|
PROP_LAST_EDITED_BY,
|
||||||
PROP_ENTITY_HOST_TYPE, // not sent over the wire
|
PROP_ENTITY_HOST_TYPE, // not sent over the wire
|
||||||
PROP_OWNING_AVATAR_ID, // not sent over the wire
|
PROP_OWNING_AVATAR_ID, // not sent over the wire
|
||||||
PROP_PARENT_ID,
|
|
||||||
PROP_PARENT_JOINT_INDEX,
|
|
||||||
PROP_QUERY_AA_CUBE,
|
PROP_QUERY_AA_CUBE,
|
||||||
PROP_CAN_CAST_SHADOW,
|
PROP_CAN_CAST_SHADOW,
|
||||||
PROP_VISIBLE_IN_SECONDARY_CAMERA, // not sent over the wire
|
PROP_VISIBLE_IN_SECONDARY_CAMERA, // not sent over the wire
|
||||||
|
|
|
@ -52,7 +52,15 @@ EntityTree::EntityTree(bool shouldReaverage) :
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityTree::~EntityTree() {
|
EntityTree::~EntityTree() {
|
||||||
eraseAllOctreeElements(false);
|
// NOTE: to eraseAllOctreeElements() in this context is useless because
|
||||||
|
// any OctreeElements in the tree still have shared backpointers to this Tree
|
||||||
|
// which means the dtor never would have been called in the first place!
|
||||||
|
//
|
||||||
|
// I'm keeping this useless commented-out line to remind us:
|
||||||
|
// we don't need shared pointer overhead for EntityTrees.
|
||||||
|
// TODO: EntityTreeElement::_tree should be raw back pointer.
|
||||||
|
// AND: EntityItem::_element should be a raw back pointer.
|
||||||
|
//eraseAllOctreeElements(false); // KEEP THIS
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityTree::setEntityScriptSourceWhitelist(const QString& entityScriptSourceWhitelist) {
|
void EntityTree::setEntityScriptSourceWhitelist(const QString& entityScriptSourceWhitelist) {
|
||||||
|
@ -74,16 +82,15 @@ void EntityTree::eraseNonLocalEntities() {
|
||||||
emit clearingEntities();
|
emit clearingEntities();
|
||||||
|
|
||||||
if (_simulation) {
|
if (_simulation) {
|
||||||
// This will clear all entities host types including local entities, because local entities
|
// local entities are not in the simulation, so we clear ALL
|
||||||
// are not in the physics simulation
|
|
||||||
_simulation->clearEntities();
|
_simulation->clearEntities();
|
||||||
}
|
}
|
||||||
_staleProxies.clear();
|
|
||||||
QHash<EntityItemID, EntityItemPointer> localMap;
|
|
||||||
localMap.swap(_entityMap);
|
|
||||||
QHash<EntityItemID, EntityItemPointer> savedEntities;
|
|
||||||
this->withWriteLock([&] {
|
this->withWriteLock([&] {
|
||||||
foreach(EntityItemPointer entity, localMap) {
|
QHash<EntityItemID, EntityItemPointer> savedEntities;
|
||||||
|
// NOTE: lock the Tree first, then lock the _entityMap.
|
||||||
|
// It should never be done the other way around.
|
||||||
|
QReadLocker locker(&_entityMapLock);
|
||||||
|
foreach(EntityItemPointer entity, _entityMap) {
|
||||||
EntityTreeElementPointer element = entity->getElement();
|
EntityTreeElementPointer element = entity->getElement();
|
||||||
if (element) {
|
if (element) {
|
||||||
element->cleanupNonLocalEntities();
|
element->cleanupNonLocalEntities();
|
||||||
|
@ -91,11 +98,16 @@ void EntityTree::eraseNonLocalEntities() {
|
||||||
|
|
||||||
if (entity->isLocalEntity()) {
|
if (entity->isLocalEntity()) {
|
||||||
savedEntities[entity->getEntityItemID()] = entity;
|
savedEntities[entity->getEntityItemID()] = entity;
|
||||||
|
} else {
|
||||||
|
int32_t spaceIndex = entity->getSpaceIndex();
|
||||||
|
if (spaceIndex != -1) {
|
||||||
|
// stale spaceIndices will be freed later
|
||||||
|
_staleProxies.push_back(spaceIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
_entityMap.swap(savedEntities);
|
||||||
});
|
});
|
||||||
localMap.clear();
|
|
||||||
_entityMap = savedEntities;
|
|
||||||
|
|
||||||
resetClientEditStats();
|
resetClientEditStats();
|
||||||
clearDeletedEntities();
|
clearDeletedEntities();
|
||||||
|
@ -113,13 +125,13 @@ void EntityTree::eraseNonLocalEntities() {
|
||||||
_needsParentFixup = localEntitiesNeedsParentFixup;
|
_needsParentFixup = localEntitiesNeedsParentFixup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityTree::eraseAllOctreeElements(bool createNewRoot) {
|
void EntityTree::eraseAllOctreeElements(bool createNewRoot) {
|
||||||
emit clearingEntities();
|
emit clearingEntities();
|
||||||
|
|
||||||
if (_simulation) {
|
if (_simulation) {
|
||||||
_simulation->clearEntities();
|
_simulation->clearEntities();
|
||||||
}
|
}
|
||||||
_staleProxies.clear();
|
|
||||||
QHash<EntityItemID, EntityItemPointer> localMap;
|
QHash<EntityItemID, EntityItemPointer> localMap;
|
||||||
localMap.swap(_entityMap);
|
localMap.swap(_entityMap);
|
||||||
this->withWriteLock([&] {
|
this->withWriteLock([&] {
|
||||||
|
@ -128,6 +140,11 @@ void EntityTree::eraseAllOctreeElements(bool createNewRoot) {
|
||||||
if (element) {
|
if (element) {
|
||||||
element->cleanupEntities();
|
element->cleanupEntities();
|
||||||
}
|
}
|
||||||
|
int32_t spaceIndex = entity->getSpaceIndex();
|
||||||
|
if (spaceIndex != -1) {
|
||||||
|
// assume stale spaceIndices will be freed later
|
||||||
|
_staleProxies.push_back(spaceIndex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
localMap.clear();
|
localMap.clear();
|
||||||
|
@ -764,9 +781,9 @@ void EntityTree::processRemovedEntities(const DeleteEntityOperator& theOperator)
|
||||||
_simulation->prepareEntityForDelete(theEntity);
|
_simulation->prepareEntityForDelete(theEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
// keep a record of valid stale spaceIndices so they can be removed from the Space
|
|
||||||
int32_t spaceIndex = theEntity->getSpaceIndex();
|
int32_t spaceIndex = theEntity->getSpaceIndex();
|
||||||
if (spaceIndex != -1) {
|
if (spaceIndex != -1) {
|
||||||
|
// stale spaceIndices will be freed later
|
||||||
_staleProxies.push_back(spaceIndex);
|
_staleProxies.push_back(spaceIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -301,6 +301,31 @@ void ModelEntityItem::setModelURL(const QString& url) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glm::vec3 ModelEntityItem::getScaledDimensions() const {
|
||||||
|
glm::vec3 parentScale = getTransform().getScale();
|
||||||
|
return _unscaledDimensions * parentScale;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModelEntityItem::setScaledDimensions(const glm::vec3& value) {
|
||||||
|
glm::vec3 parentScale = getTransform().getScale();
|
||||||
|
setUnscaledDimensions(value / parentScale);
|
||||||
|
}
|
||||||
|
|
||||||
|
const Transform ModelEntityItem::getTransform() const {
|
||||||
|
bool success;
|
||||||
|
return getTransform(success);
|
||||||
|
}
|
||||||
|
|
||||||
|
const Transform ModelEntityItem::getTransform(bool& success, int depth) const {
|
||||||
|
const Transform parentTransform = getParentTransform(success, depth);
|
||||||
|
Transform localTransform = getLocalTransform();
|
||||||
|
localTransform.postScale(getModelScale());
|
||||||
|
|
||||||
|
Transform worldTransform;
|
||||||
|
Transform::mult(worldTransform, parentTransform, localTransform);
|
||||||
|
|
||||||
|
return worldTransform;
|
||||||
|
}
|
||||||
void ModelEntityItem::setCompoundShapeURL(const QString& url) {
|
void ModelEntityItem::setCompoundShapeURL(const QString& url) {
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
if (_compoundShapeURL.get() != url) {
|
if (_compoundShapeURL.get() != url) {
|
||||||
|
@ -715,13 +740,13 @@ bool ModelEntityItem::applyNewAnimationProperties(AnimationPropertyGroup newProp
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec3 ModelEntityItem::getModelScale() const {
|
glm::vec3 ModelEntityItem::getModelScale() const {
|
||||||
return _modelScaleLock.resultWithReadLock<glm::vec3>([&] {
|
return resultWithReadLock<glm::vec3>([&] {
|
||||||
return getSNScale();
|
return _modelScale;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelEntityItem::setModelScale(const glm::vec3& modelScale) {
|
void ModelEntityItem::setModelScale(const glm::vec3& modelScale) {
|
||||||
_modelScaleLock.withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
setSNScale(modelScale);
|
_modelScale = modelScale;
|
||||||
});
|
});
|
||||||
}
|
}
|
|
@ -66,6 +66,12 @@ public:
|
||||||
static const QString DEFAULT_MODEL_URL;
|
static const QString DEFAULT_MODEL_URL;
|
||||||
QString getModelURL() const;
|
QString getModelURL() const;
|
||||||
|
|
||||||
|
virtual glm::vec3 getScaledDimensions() const override;
|
||||||
|
virtual void setScaledDimensions(const glm::vec3& value) override;
|
||||||
|
|
||||||
|
virtual const Transform getTransform(bool& success, int depth = 0) const override;
|
||||||
|
virtual const Transform getTransform() const override;
|
||||||
|
|
||||||
static const QString DEFAULT_COMPOUND_SHAPE_URL;
|
static const QString DEFAULT_COMPOUND_SHAPE_URL;
|
||||||
QString getCompoundShapeURL() const;
|
QString getCompoundShapeURL() const;
|
||||||
|
|
||||||
|
@ -144,7 +150,6 @@ protected:
|
||||||
// they aren't currently updated from data in the model/rig, and they don't have a direct effect
|
// they aren't currently updated from data in the model/rig, and they don't have a direct effect
|
||||||
// on what's rendered.
|
// on what's rendered.
|
||||||
ReadWriteLockable _jointDataLock;
|
ReadWriteLockable _jointDataLock;
|
||||||
ReadWriteLockable _modelScaleLock;
|
|
||||||
|
|
||||||
bool _jointRotationsExplicitlySet { false }; // were the joints set as a property or just side effect of animations
|
bool _jointRotationsExplicitlySet { false }; // were the joints set as a property or just side effect of animations
|
||||||
bool _jointTranslationsExplicitlySet{ false }; // were the joints set as a property or just side effect of animations
|
bool _jointTranslationsExplicitlySet{ false }; // were the joints set as a property or just side effect of animations
|
||||||
|
@ -159,6 +164,7 @@ protected:
|
||||||
int _lastKnownCurrentFrame{-1};
|
int _lastKnownCurrentFrame{-1};
|
||||||
|
|
||||||
glm::u8vec3 _color;
|
glm::u8vec3 _color;
|
||||||
|
glm::vec3 _modelScale;
|
||||||
QString _modelURL;
|
QString _modelURL;
|
||||||
bool _relayParentJoints;
|
bool _relayParentJoints;
|
||||||
bool _groupCulled { false };
|
bool _groupCulled { false };
|
||||||
|
|
|
@ -263,6 +263,7 @@ enum class EntityVersion : PacketVersion {
|
||||||
ShowKeyboardFocusHighlight,
|
ShowKeyboardFocusHighlight,
|
||||||
WebBillboardMode,
|
WebBillboardMode,
|
||||||
ModelScale,
|
ModelScale,
|
||||||
|
ReOrderParentIDProperties,
|
||||||
|
|
||||||
// Add new versions above here
|
// Add new versions above here
|
||||||
NUM_PACKET_TYPE,
|
NUM_PACKET_TYPE,
|
||||||
|
|
|
@ -60,7 +60,7 @@ bool ObjectActionTractor::getTarget(float deltaTimeStep, glm::quat& rotation, gl
|
||||||
}
|
}
|
||||||
if (other && otherIsReady) {
|
if (other && otherIsReady) {
|
||||||
bool success;
|
bool success;
|
||||||
glm::vec3 otherWorldPosition = other->getWorldPosition(_otherJointIndex, success);
|
glm::vec3 otherWorldPosition = other->getJointWorldPosition(_otherJointIndex, success);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
linearTimeScale = FLT_MAX;
|
linearTimeScale = FLT_MAX;
|
||||||
angularTimeScale = FLT_MAX;
|
angularTimeScale = FLT_MAX;
|
||||||
|
|
|
@ -32,7 +32,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
bool success;
|
bool success;
|
||||||
Transform jointWorldTransform = nestable->getTransform(_jointIndex, success);
|
Transform jointWorldTransform = nestable->getJointTransform(_jointIndex, success);
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
return Transform();
|
return Transform();
|
||||||
|
|
|
@ -92,7 +92,7 @@ Transform SpatiallyNestable::getParentTransform(bool& success, int depth) const
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (parent) {
|
if (parent) {
|
||||||
result = parent->getTransform(_parentJointIndex, success, depth + 1);
|
result = parent->getJointTransform(_parentJointIndex, success, depth + 1);
|
||||||
if (getScalesWithParent()) {
|
if (getScalesWithParent()) {
|
||||||
result.setScale(parent->scaleForChildren());
|
result.setScale(parent->scaleForChildren());
|
||||||
}
|
}
|
||||||
|
@ -203,7 +203,7 @@ glm::vec3 SpatiallyNestable::worldToLocal(const glm::vec3& position,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parent) {
|
if (parent) {
|
||||||
parentTransform = parent->getTransform(parentJointIndex, success);
|
parentTransform = parent->getJointTransform(parentJointIndex, success);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
return glm::vec3(0.0f);
|
return glm::vec3(0.0f);
|
||||||
}
|
}
|
||||||
|
@ -240,7 +240,7 @@ glm::quat SpatiallyNestable::worldToLocal(const glm::quat& orientation,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parent) {
|
if (parent) {
|
||||||
parentTransform = parent->getTransform(parentJointIndex, success);
|
parentTransform = parent->getJointTransform(parentJointIndex, success);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
return glm::quat();
|
return glm::quat();
|
||||||
}
|
}
|
||||||
|
@ -350,7 +350,7 @@ glm::vec3 SpatiallyNestable::localToWorld(const glm::vec3& position,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parent) {
|
if (parent) {
|
||||||
parentTransform = parent->getTransform(parentJointIndex, success);
|
parentTransform = parent->getJointTransform(parentJointIndex, success);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
return glm::vec3(0.0f);
|
return glm::vec3(0.0f);
|
||||||
}
|
}
|
||||||
|
@ -390,7 +390,7 @@ glm::quat SpatiallyNestable::localToWorld(const glm::quat& orientation,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parent) {
|
if (parent) {
|
||||||
parentTransform = parent->getTransform(parentJointIndex, success);
|
parentTransform = parent->getJointTransform(parentJointIndex, success);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
return glm::quat();
|
return glm::quat();
|
||||||
}
|
}
|
||||||
|
@ -525,8 +525,8 @@ glm::vec3 SpatiallyNestable::getWorldPosition() const {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec3 SpatiallyNestable::getWorldPosition(int jointIndex, bool& success) const {
|
glm::vec3 SpatiallyNestable::getJointWorldPosition(int jointIndex, bool& success) const {
|
||||||
return getTransform(jointIndex, success).getTranslation();
|
return getJointTransform(jointIndex, success).getTranslation();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpatiallyNestable::setWorldPosition(const glm::vec3& position, bool& success, bool tellPhysics) {
|
void SpatiallyNestable::setWorldPosition(const glm::vec3& position, bool& success, bool tellPhysics) {
|
||||||
|
@ -579,7 +579,7 @@ glm::quat SpatiallyNestable::getWorldOrientation() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::quat SpatiallyNestable::getWorldOrientation(int jointIndex, bool& success) const {
|
glm::quat SpatiallyNestable::getWorldOrientation(int jointIndex, bool& success) const {
|
||||||
return getTransform(jointIndex, success).getRotation();
|
return getJointTransform(jointIndex, success).getRotation();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpatiallyNestable::setWorldOrientation(const glm::quat& orientation, bool& success, bool tellPhysics) {
|
void SpatiallyNestable::setWorldOrientation(const glm::quat& orientation, bool& success, bool tellPhysics) {
|
||||||
|
@ -765,7 +765,7 @@ void SpatiallyNestable::breakParentingLoop() const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const Transform SpatiallyNestable::getTransform(int jointIndex, bool& success, int depth) const {
|
const Transform SpatiallyNestable::getJointTransform(int jointIndex, bool& success, int depth) const {
|
||||||
// this returns the world-space transform for this object. It finds its parent's transform (which may
|
// this returns the world-space transform for this object. It finds its parent's transform (which may
|
||||||
// cause this object's parent to query its parent, etc) and multiplies this object's local transform onto it.
|
// cause this object's parent to query its parent, etc) and multiplies this object's local transform onto it.
|
||||||
Transform jointInWorldFrame;
|
Transform jointInWorldFrame;
|
||||||
|
@ -832,8 +832,8 @@ glm::vec3 SpatiallyNestable::getSNScale(bool& success) const {
|
||||||
return getTransform(success).getScale();
|
return getTransform(success).getScale();
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec3 SpatiallyNestable::getSNScale(int jointIndex, bool& success) const {
|
glm::vec3 SpatiallyNestable::getJointSNScale(int jointIndex, bool& success) const {
|
||||||
return getTransform(jointIndex, success).getScale();
|
return getJointTransform(jointIndex, success).getScale();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpatiallyNestable::setSNScale(const glm::vec3& scale) {
|
void SpatiallyNestable::setSNScale(const glm::vec3& scale) {
|
||||||
|
|
|
@ -129,9 +129,9 @@ public:
|
||||||
virtual void setSNScale(const glm::vec3& scale, bool& success);
|
virtual void setSNScale(const glm::vec3& scale, bool& success);
|
||||||
|
|
||||||
// get world-frame values for a specific joint
|
// get world-frame values for a specific joint
|
||||||
virtual const Transform getTransform(int jointIndex, bool& success, int depth = 0) const;
|
virtual const Transform getJointTransform(int jointIndex, bool& success, int depth = 0) const;
|
||||||
virtual glm::vec3 getWorldPosition(int jointIndex, bool& success) const;
|
virtual glm::vec3 getJointWorldPosition(int jointIndex, bool& success) const;
|
||||||
virtual glm::vec3 getSNScale(int jointIndex, bool& success) const;
|
virtual glm::vec3 getJointSNScale(int jointIndex, bool& success) const;
|
||||||
|
|
||||||
// object's parent's frame
|
// object's parent's frame
|
||||||
virtual Transform getLocalTransform() const;
|
virtual Transform getLocalTransform() const;
|
||||||
|
|
|
@ -458,6 +458,11 @@ void TabletProxy::emitWebEvent(const QVariant& msg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabletProxy::onTabletShown() {
|
void TabletProxy::onTabletShown() {
|
||||||
|
if (QThread::currentThread() != thread()) {
|
||||||
|
QMetaObject::invokeMethod(this, "onTabletShown");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (_tabletShown) {
|
if (_tabletShown) {
|
||||||
Setting::Handle<bool> notificationSounds{ QStringLiteral("play_notification_sounds"), true};
|
Setting::Handle<bool> notificationSounds{ QStringLiteral("play_notification_sounds"), true};
|
||||||
Setting::Handle<bool> notificationSoundTablet{ QStringLiteral("play_notification_sounds_tablet"), true};
|
Setting::Handle<bool> notificationSoundTablet{ QStringLiteral("play_notification_sounds_tablet"), true};
|
||||||
|
@ -485,7 +490,11 @@ bool TabletProxy::isPathLoaded(const QVariant& path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabletProxy::setQmlTabletRoot(OffscreenQmlSurface* qmlOffscreenSurface) {
|
void TabletProxy::setQmlTabletRoot(OffscreenQmlSurface* qmlOffscreenSurface) {
|
||||||
Q_ASSERT(QThread::currentThread() == qApp->thread());
|
if (QThread::currentThread() != thread()) {
|
||||||
|
QMetaObject::invokeMethod(this, "setQmlTabletRoot", Q_ARG(OffscreenQmlSurface*, qmlOffscreenSurface));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_qmlOffscreenSurface = qmlOffscreenSurface;
|
_qmlOffscreenSurface = qmlOffscreenSurface;
|
||||||
_qmlTabletRoot = qmlOffscreenSurface ? qmlOffscreenSurface->getRootItem() : nullptr;
|
_qmlTabletRoot = qmlOffscreenSurface ? qmlOffscreenSurface->getRootItem() : nullptr;
|
||||||
if (_qmlTabletRoot && _qmlOffscreenSurface) {
|
if (_qmlTabletRoot && _qmlOffscreenSurface) {
|
||||||
|
@ -654,6 +663,11 @@ void TabletProxy::loadQMLSource(const QVariant& path, bool resizable) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabletProxy::stopQMLSource() {
|
void TabletProxy::stopQMLSource() {
|
||||||
|
if (QThread::currentThread() != thread()) {
|
||||||
|
QMetaObject::invokeMethod(this, "stopQMLSource");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// For desktop toolbar mode dialogs.
|
// For desktop toolbar mode dialogs.
|
||||||
if (!_toolbarMode || !_desktopWindow) {
|
if (!_toolbarMode || !_desktopWindow) {
|
||||||
qCDebug(uiLogging) << "tablet cannot clear QML because not desktop toolbar mode";
|
qCDebug(uiLogging) << "tablet cannot clear QML because not desktop toolbar mode";
|
||||||
|
@ -879,6 +893,12 @@ void TabletProxy::sendToQml(const QVariant& msg) {
|
||||||
|
|
||||||
|
|
||||||
OffscreenQmlSurface* TabletProxy::getTabletSurface() {
|
OffscreenQmlSurface* TabletProxy::getTabletSurface() {
|
||||||
|
if (QThread::currentThread() != thread()) {
|
||||||
|
OffscreenQmlSurface* result = nullptr;
|
||||||
|
BLOCKING_INVOKE_METHOD(this, "getTabletSurface", Q_RETURN_ARG(OffscreenQmlSurface*, result));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
return _qmlOffscreenSurface;
|
return _qmlOffscreenSurface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -888,6 +908,11 @@ void TabletProxy::desktopWindowClosed() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabletProxy::unfocus() {
|
void TabletProxy::unfocus() {
|
||||||
|
if (QThread::currentThread() != thread()) {
|
||||||
|
QMetaObject::invokeMethod(this, "unfocus");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (_qmlOffscreenSurface) {
|
if (_qmlOffscreenSurface) {
|
||||||
_qmlOffscreenSurface->lowerKeyboard();
|
_qmlOffscreenSurface->lowerKeyboard();
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ var eventMappingName = "io.highfidelity.away"; // goActive on hand controller bu
|
||||||
var eventMapping = Controller.newMapping(eventMappingName);
|
var eventMapping = Controller.newMapping(eventMappingName);
|
||||||
var avatarPosition = MyAvatar.position;
|
var avatarPosition = MyAvatar.position;
|
||||||
var wasHmdMounted = HMD.mounted;
|
var wasHmdMounted = HMD.mounted;
|
||||||
|
var previousBubbleState = Users.getIgnoreRadiusEnabled();
|
||||||
|
|
||||||
// some intervals we may create/delete
|
// some intervals we may create/delete
|
||||||
var avatarMovedInterval;
|
var avatarMovedInterval;
|
||||||
|
@ -167,6 +167,11 @@ function goAway(fromStartup) {
|
||||||
}, WAIT_FOR_MOVE_ON_STARTUP);
|
}, WAIT_FOR_MOVE_ON_STARTUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
previousBubbleState = Users.getIgnoreRadiusEnabled();
|
||||||
|
if (!previousBubbleState) {
|
||||||
|
Users.toggleIgnoreRadius();
|
||||||
|
}
|
||||||
|
UserActivityLogger.bubbleToggled(Users.getIgnoreRadiusEnabled());
|
||||||
UserActivityLogger.toggledAway(true);
|
UserActivityLogger.toggledAway(true);
|
||||||
MyAvatar.isAway = true;
|
MyAvatar.isAway = true;
|
||||||
}
|
}
|
||||||
|
@ -179,6 +184,11 @@ function goActive() {
|
||||||
UserActivityLogger.toggledAway(false);
|
UserActivityLogger.toggledAway(false);
|
||||||
MyAvatar.isAway = false;
|
MyAvatar.isAway = false;
|
||||||
|
|
||||||
|
if (Users.getIgnoreRadiusEnabled() !== previousBubbleState) {
|
||||||
|
Users.toggleIgnoreRadius();
|
||||||
|
UserActivityLogger.bubbleToggled(Users.getIgnoreRadiusEnabled());
|
||||||
|
}
|
||||||
|
|
||||||
if (!Window.hasFocus()) {
|
if (!Window.hasFocus()) {
|
||||||
Window.setFocus();
|
Window.setFocus();
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,17 @@
|
||||||
var speechBubbleLineHeight = 0.05; // The height of a line of text in the speech bubble.
|
var speechBubbleLineHeight = 0.05; // The height of a line of text in the speech bubble.
|
||||||
var SPEECH_BUBBLE_MAX_WIDTH = 1; // meters
|
var SPEECH_BUBBLE_MAX_WIDTH = 1; // meters
|
||||||
|
|
||||||
|
var textSizeOverlay = Overlays.addOverlay("text3d", {
|
||||||
|
position: MyAvatar.position,
|
||||||
|
lineHeight: speechBubbleLineHeight,
|
||||||
|
leftMargin: 0,
|
||||||
|
topMargin: 0,
|
||||||
|
rightMargin: 0,
|
||||||
|
bottomMargin: 0,
|
||||||
|
ignoreRayIntersection: true,
|
||||||
|
visible: false
|
||||||
|
});
|
||||||
|
|
||||||
// Load the persistent variables from the Settings, with defaults.
|
// Load the persistent variables from the Settings, with defaults.
|
||||||
function loadSettings() {
|
function loadSettings() {
|
||||||
chatName = Settings.getValue('Chat_chatName', MyAvatar.displayName);
|
chatName = Settings.getValue('Chat_chatName', MyAvatar.displayName);
|
||||||
|
@ -63,6 +74,9 @@
|
||||||
speechBubbleOffset = Settings.getValue('Chat_speechBubbleOffset', {x: 0.0, y: 0.3, z:0.0});
|
speechBubbleOffset = Settings.getValue('Chat_speechBubbleOffset', {x: 0.0, y: 0.3, z:0.0});
|
||||||
speechBubbleJointName = Settings.getValue('Chat_speechBubbleJointName', 'Head');
|
speechBubbleJointName = Settings.getValue('Chat_speechBubbleJointName', 'Head');
|
||||||
speechBubbleLineHeight = Settings.getValue('Chat_speechBubbleLineHeight', 0.05);
|
speechBubbleLineHeight = Settings.getValue('Chat_speechBubbleLineHeight', 0.05);
|
||||||
|
Overlays.editOverlay(textSizeOverlay, {
|
||||||
|
lineHeight: speechBubbleLineHeight
|
||||||
|
});
|
||||||
|
|
||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
|
@ -637,7 +651,7 @@
|
||||||
// Only overlay text3d has a way to measure the text, not entities.
|
// Only overlay text3d has a way to measure the text, not entities.
|
||||||
// So we make a temporary one just for measuring text, then delete it.
|
// So we make a temporary one just for measuring text, then delete it.
|
||||||
var speechBubbleTextOverlayID = Overlays.addOverlay("text3d", speechBubbleParams);
|
var speechBubbleTextOverlayID = Overlays.addOverlay("text3d", speechBubbleParams);
|
||||||
var textSize = Overlays.textSize(speechBubbleTextOverlayID, speechBubbleMessage);
|
var textSize = Overlays.textSize(textSizeOverlay, speechBubbleMessage);
|
||||||
try {
|
try {
|
||||||
Overlays.deleteOverlay(speechBubbleTextOverlayID);
|
Overlays.deleteOverlay(speechBubbleTextOverlayID);
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
@ -971,6 +985,8 @@
|
||||||
unidentifyAvatars();
|
unidentifyAvatars();
|
||||||
disconnectWebHandler();
|
disconnectWebHandler();
|
||||||
|
|
||||||
|
Overlays.deleteOverlay(textSizeOverlay);
|
||||||
|
|
||||||
if (onChatPage) {
|
if (onChatPage) {
|
||||||
tablet.gotoHomeScreen();
|
tablet.gotoHomeScreen();
|
||||||
onChatPage = false;
|
onChatPage = false;
|
||||||
|
|
|
@ -117,11 +117,12 @@ Script.include("/~/system/libraries/utils.js");
|
||||||
this.previousParentID[this.grabbedThingID] = grabbedProperties.parentID;
|
this.previousParentID[this.grabbedThingID] = grabbedProperties.parentID;
|
||||||
this.previousParentJointIndex[this.grabbedThingID] = grabbedProperties.parentJointIndex;
|
this.previousParentJointIndex[this.grabbedThingID] = grabbedProperties.parentJointIndex;
|
||||||
}
|
}
|
||||||
Overlays.editOverlay(this.grabbedThingID, reparentProps);
|
|
||||||
|
|
||||||
// resizeTablet to counter adjust offsets to account for change of scale from sensorToWorldMatrix
|
// resizeTablet to counter adjust offsets to account for change of scale from sensorToWorldMatrix
|
||||||
if (HMD.tabletID && this.grabbedThingID === HMD.tabletID) {
|
if (HMD.tabletID && this.grabbedThingID === HMD.tabletID) {
|
||||||
resizeTablet(getTabletWidthFromSettings(), reparentProps.parentJointIndex);
|
reparentAndScaleTablet(getTabletWidthFromSettings(), reparentProps);
|
||||||
|
} else {
|
||||||
|
Entities.editEntity(this.grabbedThingID, reparentProps);
|
||||||
}
|
}
|
||||||
|
|
||||||
Messages.sendMessage('Hifi-Object-Manipulation', JSON.stringify({
|
Messages.sendMessage('Hifi-Object-Manipulation', JSON.stringify({
|
||||||
|
@ -140,7 +141,7 @@ Script.include("/~/system/libraries/utils.js");
|
||||||
});
|
});
|
||||||
} else if (!this.robbed){
|
} else if (!this.robbed){
|
||||||
// before we grabbed it, overlay was a child of something; put it back.
|
// before we grabbed it, overlay was a child of something; put it back.
|
||||||
Overlays.editOverlay(this.grabbedThingID, {
|
Entities.editEntity(this.grabbedThingID, {
|
||||||
parentID: this.previousParentID[this.grabbedThingID],
|
parentID: this.previousParentID[this.grabbedThingID],
|
||||||
parentJointIndex: this.previousParentJointIndex[this.grabbedThingID]
|
parentJointIndex: this.previousParentJointIndex[this.grabbedThingID]
|
||||||
});
|
});
|
||||||
|
|
|
@ -159,7 +159,7 @@ WebTablet = function (url, width, dpi, hand, location, visible) {
|
||||||
url: url,
|
url: url,
|
||||||
localPosition: { x: 0, y: WEB_ENTITY_Y_OFFSET, z: -WEB_ENTITY_Z_OFFSET },
|
localPosition: { x: 0, y: WEB_ENTITY_Y_OFFSET, z: -WEB_ENTITY_Z_OFFSET },
|
||||||
localRotation: Quat.angleAxis(180, Y_AXIS),
|
localRotation: Quat.angleAxis(180, Y_AXIS),
|
||||||
dimensions: {x: screenWidth, y: screenHeight, z: 0.1},
|
dimensions: {x: screenWidth, y: screenHeight, z: 1.0},
|
||||||
dpi: tabletDpi,
|
dpi: tabletDpi,
|
||||||
color: { red: 255, green: 255, blue: 255 },
|
color: { red: 255, green: 255, blue: 255 },
|
||||||
alpha: 1.0,
|
alpha: 1.0,
|
||||||
|
|
|
@ -395,7 +395,7 @@ resizeTablet = function (width, newParentJointIndex, sensorToWorldScaleOverride)
|
||||||
var tabletDpi = DEFAULT_DPI * (DEFAULT_WIDTH / tabletWidth);
|
var tabletDpi = DEFAULT_DPI * (DEFAULT_WIDTH / tabletWidth);
|
||||||
|
|
||||||
// update tablet model dimensions
|
// update tablet model dimensions
|
||||||
Overlays.editOverlay(HMD.tabletID, {
|
Entities.editEntity(HMD.tabletID, {
|
||||||
dimensions: { x: tabletWidth, y: tabletHeight, z: tabletDepth }
|
dimensions: { x: tabletWidth, y: tabletHeight, z: tabletDepth }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -405,9 +405,9 @@ resizeTablet = function (width, newParentJointIndex, sensorToWorldScaleOverride)
|
||||||
var screenWidth = 0.9367 * tabletWidth;
|
var screenWidth = 0.9367 * tabletWidth;
|
||||||
var screenHeight = 0.9000 * tabletHeight;
|
var screenHeight = 0.9000 * tabletHeight;
|
||||||
var landscape = Tablet.getTablet("com.highfidelity.interface.tablet.system").landscape;
|
var landscape = Tablet.getTablet("com.highfidelity.interface.tablet.system").landscape;
|
||||||
Overlays.editOverlay(HMD.tabletScreenID, {
|
Entities.editEntity(HMD.tabletScreenID, {
|
||||||
localPosition: { x: 0, y: WEB_ENTITY_Y_OFFSET, z: -WEB_ENTITY_Z_OFFSET},
|
localPosition: { x: 0, y: WEB_ENTITY_Y_OFFSET, z: -WEB_ENTITY_Z_OFFSET},
|
||||||
dimensions: {x: landscape ? screenHeight : screenWidth, y: landscape ? screenWidth : screenHeight, z: 0.1},
|
dimensions: {x: landscape ? screenHeight : screenWidth, y: landscape ? screenWidth : screenHeight, z: 1.0},
|
||||||
dpi: tabletDpi
|
dpi: tabletDpi
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -416,19 +416,83 @@ resizeTablet = function (width, newParentJointIndex, sensorToWorldScaleOverride)
|
||||||
var HOME_BUTTON_X_OFFSET = 0.00079 * sensorScaleOffsetOverride * sensorScaleFactor;
|
var HOME_BUTTON_X_OFFSET = 0.00079 * sensorScaleOffsetOverride * sensorScaleFactor;
|
||||||
var HOME_BUTTON_Y_OFFSET = -1 * ((tabletHeight / 2) - (4.0 * tabletScaleFactor / 2)) * sensorScaleOffsetOverride;
|
var HOME_BUTTON_Y_OFFSET = -1 * ((tabletHeight / 2) - (4.0 * tabletScaleFactor / 2)) * sensorScaleOffsetOverride;
|
||||||
var HOME_BUTTON_Z_OFFSET = (tabletDepth / 1.9) * sensorScaleOffsetOverride;
|
var HOME_BUTTON_Z_OFFSET = (tabletDepth / 1.9) * sensorScaleOffsetOverride;
|
||||||
Overlays.editOverlay(HMD.homeButtonID, {
|
Entities.editEntity(HMD.homeButtonID, {
|
||||||
localPosition: { x: HOME_BUTTON_X_OFFSET, y: HOME_BUTTON_Y_OFFSET, z: -HOME_BUTTON_Z_OFFSET },
|
localPosition: { x: HOME_BUTTON_X_OFFSET, y: HOME_BUTTON_Y_OFFSET, z: -HOME_BUTTON_Z_OFFSET },
|
||||||
localRotation: { x: 0, y: 1, z: 0, w: 0 },
|
localRotation: { x: 0, y: 1, z: 0, w: 0 },
|
||||||
dimensions: { x: homeButtonDim, y: homeButtonDim, z: homeButtonDim }
|
dimensions: { x: homeButtonDim, y: homeButtonDim, z: homeButtonDim }
|
||||||
});
|
});
|
||||||
|
|
||||||
Overlays.editOverlay(HMD.homeButtonHighlightID, {
|
Entities.editEntity(HMD.homeButtonHighlightID, {
|
||||||
localPosition: { x: -HOME_BUTTON_X_OFFSET, y: HOME_BUTTON_Y_OFFSET, z: -HOME_BUTTON_Z_OFFSET },
|
localPosition: { x: -HOME_BUTTON_X_OFFSET, y: HOME_BUTTON_Y_OFFSET, z: -HOME_BUTTON_Z_OFFSET },
|
||||||
localRotation: { x: 0, y: 1, z: 0, w: 0 },
|
localRotation: { x: 0, y: 1, z: 0, w: 0 },
|
||||||
dimensions: { x: homeButtonDim, y: homeButtonDim, z: homeButtonDim }
|
dimensions: { x: homeButtonDim, y: homeButtonDim, z: homeButtonDim }
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
reparentAndScaleTablet = function(width, reparentProps) {
|
||||||
|
|
||||||
|
if (!HMD.tabletID || !HMD.tabletScreenID || !HMD.homeButtonID || !HMD.homeButtonHighlightID) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var sensorScaleFactor = MyAvatar.sensorToWorldScale;
|
||||||
|
var sensorScaleOffsetOverride = 1;
|
||||||
|
var SENSOR_TO_ROOM_MATRIX = 65534;
|
||||||
|
var parentJointIndex = reparentProps.parentJointIndex;
|
||||||
|
if (parentJointIndex === SENSOR_TO_ROOM_MATRIX) {
|
||||||
|
sensorScaleOffsetOverride = 1 / sensorScaleFactor;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// will need to be recaclulated if dimensions of fbx model change.
|
||||||
|
var TABLET_NATURAL_DIMENSIONS = {x: 32.083, y: 48.553, z: 2.269};
|
||||||
|
var DEFAULT_DPI = 31;
|
||||||
|
var DEFAULT_WIDTH = 0.4375;
|
||||||
|
|
||||||
|
// scale factor of natural tablet dimensions.
|
||||||
|
var tabletWidth = (width || DEFAULT_WIDTH) * sensorScaleFactor;
|
||||||
|
var tabletScaleFactor = tabletWidth / TABLET_NATURAL_DIMENSIONS.x;
|
||||||
|
var tabletHeight = TABLET_NATURAL_DIMENSIONS.y * tabletScaleFactor;
|
||||||
|
var tabletDepth = TABLET_NATURAL_DIMENSIONS.z * tabletScaleFactor;
|
||||||
|
var tabletDpi = DEFAULT_DPI * (DEFAULT_WIDTH / tabletWidth);
|
||||||
|
|
||||||
|
// update tablet model dimensions
|
||||||
|
|
||||||
|
Entities.editEntity(HMD.tabletID, {
|
||||||
|
parentID: reparentProps.parentID,
|
||||||
|
parentJointIndex: reparentProps.parentJointIndex,
|
||||||
|
dimensions: { x: tabletWidth, y: tabletHeight, z: tabletDepth}
|
||||||
|
});
|
||||||
|
// update webOverlay
|
||||||
|
var WEB_ENTITY_Z_OFFSET = (tabletDepth / 2.5) * sensorScaleOffsetOverride;
|
||||||
|
var WEB_ENTITY_Y_OFFSET = 1.25 * tabletScaleFactor * sensorScaleOffsetOverride;
|
||||||
|
var screenWidth = 0.9367 * tabletWidth;
|
||||||
|
var screenHeight = 0.9000 * tabletHeight;
|
||||||
|
var landscape = Tablet.getTablet("com.highfidelity.interface.tablet.system").landscape;
|
||||||
|
Entities.editEntity(HMD.tabletScreenID, {
|
||||||
|
localPosition: { x: 0, y: WEB_ENTITY_Y_OFFSET, z: -WEB_ENTITY_Z_OFFSET},
|
||||||
|
dimensions: {x: landscape ? screenHeight : screenWidth, y: landscape ? screenWidth : screenHeight, z: 1.0},
|
||||||
|
dpi: tabletDpi
|
||||||
|
});
|
||||||
|
|
||||||
|
// update homeButton
|
||||||
|
var homeButtonDim = 4.0 * tabletScaleFactor / 1.5;
|
||||||
|
var HOME_BUTTON_X_OFFSET = 0.00079 * sensorScaleOffsetOverride * sensorScaleFactor;
|
||||||
|
var HOME_BUTTON_Y_OFFSET = -1 * ((tabletHeight / 2) - (4.0 * tabletScaleFactor / 2)) * sensorScaleOffsetOverride;
|
||||||
|
var HOME_BUTTON_Z_OFFSET = (tabletDepth / 1.9) * sensorScaleOffsetOverride;
|
||||||
|
Entities.editEntity(HMD.homeButtonID, {
|
||||||
|
localPosition: { x: HOME_BUTTON_X_OFFSET, y: HOME_BUTTON_Y_OFFSET, z: -HOME_BUTTON_Z_OFFSET },
|
||||||
|
localRotation: { x: 0, y: 1, z: 0, w: 0 },
|
||||||
|
dimensions: { x: homeButtonDim, y: homeButtonDim, z: homeButtonDim }
|
||||||
|
});
|
||||||
|
|
||||||
|
Entities.editEntity(HMD.homeButtonHighlightID, {
|
||||||
|
localPosition: { x: -HOME_BUTTON_X_OFFSET, y: HOME_BUTTON_Y_OFFSET, z: -HOME_BUTTON_Z_OFFSET },
|
||||||
|
localRotation: { x: 0, y: 1, z: 0, w: 0 },
|
||||||
|
dimensions: { x: homeButtonDim, y: homeButtonDim, z: homeButtonDim }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
getMainTabletIDs = function () {
|
getMainTabletIDs = function () {
|
||||||
var tabletIDs = [];
|
var tabletIDs = [];
|
||||||
if (HMD.tabletID) {
|
if (HMD.tabletID) {
|
||||||
|
|
|
@ -20,7 +20,7 @@ endfunction()
|
||||||
|
|
||||||
if (BUILD_TOOLS)
|
if (BUILD_TOOLS)
|
||||||
# Allow different tools for stable builds
|
# Allow different tools for stable builds
|
||||||
if (RELEASE_TYPE STREQUAL "PRODUCTION")
|
if (STABLE_BUILD)
|
||||||
set(ALL_TOOLS
|
set(ALL_TOOLS
|
||||||
udt-test
|
udt-test
|
||||||
vhacd-util
|
vhacd-util
|
||||||
|
|
|
@ -80,7 +80,9 @@ else ()
|
||||||
add_executable(${TARGET_NAME} ${NITPICK_SRCS} ${QM})
|
add_executable(${TARGET_NAME} ${NITPICK_SRCS} ${QM})
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
add_dependencies(${TARGET_NAME} resources)
|
if (NOT UNIX)
|
||||||
|
add_dependencies(${TARGET_NAME} resources)
|
||||||
|
endif()
|
||||||
|
|
||||||
# disable /OPT:REF and /OPT:ICF for the Debug builds
|
# disable /OPT:REF and /OPT:ICF for the Debug builds
|
||||||
# This will prevent the following linker warnings
|
# This will prevent the following linker warnings
|
||||||
|
|
Loading…
Reference in a new issue