mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 18:41:10 +02:00
Merge branch 'master' of github.com:highfidelity/hifi into emojiAppAdd
This commit is contained in:
commit
ecbcb6a178
54 changed files with 539 additions and 147 deletions
|
@ -160,6 +160,11 @@ bool EntityTreeSendThread::traverseTreeAndSendContents(SharedNodePointer node, O
|
||||||
if (sendComplete && nodeData->wantReportInitialCompletion() && _traversal.finished()) {
|
if (sendComplete && nodeData->wantReportInitialCompletion() && _traversal.finished()) {
|
||||||
// Dealt with all nearby entities.
|
// Dealt with all nearby entities.
|
||||||
nodeData->setReportInitialCompletion(false);
|
nodeData->setReportInitialCompletion(false);
|
||||||
|
// initial stats and entity packets are reliable until the initial query is complete
|
||||||
|
// to guarantee all entity data is available for safe landing/physics start. Afterwards
|
||||||
|
// the packets are unreliable for performance.
|
||||||
|
nodeData->stats.getStatsMessage().setReliable(false);
|
||||||
|
nodeData->getPacket().setReliable(false);
|
||||||
|
|
||||||
// Send EntityQueryInitialResultsComplete reliable packet ...
|
// Send EntityQueryInitialResultsComplete reliable packet ...
|
||||||
auto initialCompletion = NLPacket::create(PacketType::EntityQueryInitialResultsComplete,
|
auto initialCompletion = NLPacket::create(PacketType::EntityQueryInitialResultsComplete,
|
||||||
|
|
|
@ -194,13 +194,13 @@ int OctreeSendThread::handlePacketSend(SharedNodePointer node, OctreeQueryNode*
|
||||||
|
|
||||||
// actually send it
|
// actually send it
|
||||||
OctreeServer::didCallWriteDatagram(this);
|
OctreeServer::didCallWriteDatagram(this);
|
||||||
DependencyManager::get<NodeList>()->sendUnreliablePacket(statsPacket, *node);
|
DependencyManager::get<NodeList>()->sendPacket(NLPacket::createCopy(statsPacket), *node);
|
||||||
} else {
|
} else {
|
||||||
// not enough room in the packet, send two packets
|
// not enough room in the packet, send two packets
|
||||||
|
|
||||||
// first packet
|
// first packet
|
||||||
OctreeServer::didCallWriteDatagram(this);
|
OctreeServer::didCallWriteDatagram(this);
|
||||||
DependencyManager::get<NodeList>()->sendUnreliablePacket(statsPacket, *node);
|
DependencyManager::get<NodeList>()->sendPacket(NLPacket::createCopy(statsPacket), *node);
|
||||||
|
|
||||||
int numBytes = statsPacket.getDataSize();
|
int numBytes = statsPacket.getDataSize();
|
||||||
_totalBytes += numBytes;
|
_totalBytes += numBytes;
|
||||||
|
@ -230,7 +230,7 @@ int OctreeSendThread::handlePacketSend(SharedNodePointer node, OctreeQueryNode*
|
||||||
|
|
||||||
// second packet
|
// second packet
|
||||||
OctreeServer::didCallWriteDatagram(this);
|
OctreeServer::didCallWriteDatagram(this);
|
||||||
DependencyManager::get<NodeList>()->sendUnreliablePacket(sentPacket, *node);
|
DependencyManager::get<NodeList>()->sendPacket(NLPacket::createCopy(sentPacket), *node);
|
||||||
|
|
||||||
numBytes = sentPacket.getDataSize();
|
numBytes = sentPacket.getDataSize();
|
||||||
_totalBytes += numBytes;
|
_totalBytes += numBytes;
|
||||||
|
@ -263,7 +263,8 @@ int OctreeSendThread::handlePacketSend(SharedNodePointer node, OctreeQueryNode*
|
||||||
// just send the octree packet
|
// just send the octree packet
|
||||||
OctreeServer::didCallWriteDatagram(this);
|
OctreeServer::didCallWriteDatagram(this);
|
||||||
NLPacket& sentPacket = nodeData->getPacket();
|
NLPacket& sentPacket = nodeData->getPacket();
|
||||||
DependencyManager::get<NodeList>()->sendUnreliablePacket(sentPacket, *node);
|
|
||||||
|
DependencyManager::get<NodeList>()->sendPacket(NLPacket::createCopy(sentPacket), *node);
|
||||||
|
|
||||||
int numBytes = sentPacket.getDataSize();
|
int numBytes = sentPacket.getDataSize();
|
||||||
_totalBytes += numBytes;
|
_totalBytes += numBytes;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// Created by Sabrina Shanman 8/14/2018
|
// Created by Sabrina Shanman 2018/08/14
|
||||||
// Copyright 2018 High Fidelity, Inc.
|
// Copyright 2018 High Fidelity, Inc.
|
||||||
//
|
//
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
@ -21,4 +21,10 @@ Transform MyAvatarHeadTransformNode::getTransform() {
|
||||||
glm::quat ori = headOri * glm::angleAxis(-PI / 2.0f, Vectors::RIGHT);
|
glm::quat ori = headOri * glm::angleAxis(-PI / 2.0f, Vectors::RIGHT);
|
||||||
|
|
||||||
return Transform(ori, scale, pos);
|
return Transform(ori, scale, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVariantMap MyAvatarHeadTransformNode::toVariantMap() const {
|
||||||
|
QVariantMap map;
|
||||||
|
map["joint"] = "Avatar";
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// Created by Sabrina Shanman 8/14/2018
|
// Created by Sabrina Shanman 2018/08/14
|
||||||
// Copyright 2018 High Fidelity, Inc.
|
// Copyright 2018 High Fidelity, Inc.
|
||||||
//
|
//
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
@ -14,6 +14,7 @@ class MyAvatarHeadTransformNode : public TransformNode {
|
||||||
public:
|
public:
|
||||||
MyAvatarHeadTransformNode() { }
|
MyAvatarHeadTransformNode() { }
|
||||||
Transform getTransform() override;
|
Transform getTransform() override;
|
||||||
|
QVariantMap toVariantMap() const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_MyAvatarHeadTransformNode_h
|
#endif // hifi_MyAvatarHeadTransformNode_h
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// Created by Sabrina Shanman 7/16/2018
|
// Created by Sabrina Shanman 2018/07/16
|
||||||
// Copyright 2018 High Fidelity, Inc.
|
// Copyright 2018 High Fidelity, Inc.
|
||||||
//
|
//
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
@ -460,4 +460,4 @@ Transform CollisionPick::getResultTransform() const {
|
||||||
Transform transform;
|
Transform transform;
|
||||||
transform.setTranslation(_mathPick.transform.getTranslation());
|
transform.setTranslation(_mathPick.transform.getTranslation());
|
||||||
return transform;
|
return transform;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// Created by Sabrina Shanman 7/11/2018
|
// Created by Sabrina Shanman 2018/07/11
|
||||||
// Copyright 2018 High Fidelity, Inc.
|
// Copyright 2018 High Fidelity, Inc.
|
||||||
//
|
//
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
@ -49,6 +49,7 @@ class CollisionPick : public Pick<CollisionRegion> {
|
||||||
public:
|
public:
|
||||||
CollisionPick(const PickFilter& filter, float maxDistance, bool enabled, bool scaleWithParent, CollisionRegion collisionRegion, PhysicsEnginePointer physicsEngine);
|
CollisionPick(const PickFilter& filter, float maxDistance, bool enabled, bool scaleWithParent, CollisionRegion collisionRegion, PhysicsEnginePointer physicsEngine);
|
||||||
|
|
||||||
|
PickType getType() const override { return PickType::Collision; }
|
||||||
CollisionRegion getMathematicalPick() const override;
|
CollisionRegion getMathematicalPick() const override;
|
||||||
PickResultPointer getDefaultResult(const QVariantMap& pickVariant) const override {
|
PickResultPointer getDefaultResult(const QVariantMap& pickVariant) const override {
|
||||||
return std::make_shared<CollisionPickResult>(pickVariant, std::vector<ContactTestResult>(), std::vector<ContactTestResult>());
|
return std::make_shared<CollisionPickResult>(pickVariant, std::vector<ContactTestResult>(), std::vector<ContactTestResult>());
|
||||||
|
|
|
@ -27,6 +27,10 @@ LaserPointer::LaserPointer(const QVariant& rayProps, const RenderStateMap& rende
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PickQuery::PickType LaserPointer::getType() const {
|
||||||
|
return PickQuery::PickType::Ray;
|
||||||
|
}
|
||||||
|
|
||||||
void LaserPointer::editRenderStatePath(const std::string& state, const QVariant& pathProps) {
|
void LaserPointer::editRenderStatePath(const std::string& state, const QVariant& pathProps) {
|
||||||
auto renderState = std::static_pointer_cast<RenderState>(_renderStates[state]);
|
auto renderState = std::static_pointer_cast<RenderState>(_renderStates[state]);
|
||||||
if (renderState) {
|
if (renderState) {
|
||||||
|
@ -47,7 +51,7 @@ PickResultPointer LaserPointer::getPickResultCopy(const PickResultPointer& pickR
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantMap LaserPointer::toVariantMap() const {
|
QVariantMap LaserPointer::toVariantMap() const {
|
||||||
QVariantMap qVariantMap;
|
QVariantMap qVariantMap = Parent::toVariantMap();
|
||||||
|
|
||||||
QVariantMap qRenderStates;
|
QVariantMap qRenderStates;
|
||||||
for (auto iter = _renderStates.cbegin(); iter != _renderStates.cend(); iter++) {
|
for (auto iter = _renderStates.cbegin(); iter != _renderStates.cend(); iter++) {
|
||||||
|
|
|
@ -42,6 +42,8 @@ public:
|
||||||
LaserPointer(const QVariant& rayProps, const RenderStateMap& renderStates, const DefaultRenderStateMap& defaultRenderStates, bool hover, const PointerTriggers& triggers,
|
LaserPointer(const QVariant& rayProps, const RenderStateMap& renderStates, const DefaultRenderStateMap& defaultRenderStates, bool hover, const PointerTriggers& triggers,
|
||||||
bool faceAvatar, bool followNormal, float followNormalStrength, bool centerEndY, bool lockEnd, bool distanceScaleEnd, bool scaleWithParent, bool enabled);
|
bool faceAvatar, bool followNormal, float followNormalStrength, bool centerEndY, bool lockEnd, bool distanceScaleEnd, bool scaleWithParent, bool enabled);
|
||||||
|
|
||||||
|
PickQuery::PickType getType() const override;
|
||||||
|
|
||||||
QVariantMap toVariantMap() const override;
|
QVariantMap toVariantMap() const override;
|
||||||
|
|
||||||
static std::shared_ptr<StartEndRenderState> buildRenderState(const QVariantMap& propMap);
|
static std::shared_ptr<StartEndRenderState> buildRenderState(const QVariantMap& propMap);
|
||||||
|
|
|
@ -23,7 +23,7 @@ void LaserPointerScriptingInterface::setIncludeItems(unsigned int uid, const QSc
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int LaserPointerScriptingInterface::createLaserPointer(const QVariant& properties) const {
|
unsigned int LaserPointerScriptingInterface::createLaserPointer(const QVariant& properties) const {
|
||||||
return DependencyManager::get<PointerScriptingInterface>()->createLaserPointer(properties);
|
return DependencyManager::get<PointerScriptingInterface>()->createPointer(PickQuery::PickType::Ray, properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LaserPointerScriptingInterface::editRenderState(unsigned int uid, const QString& renderState, const QVariant& properties) const {
|
void LaserPointerScriptingInterface::editRenderState(unsigned int uid, const QString& renderState, const QVariant& properties) const {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// Created by Sabrina Shanman 8/14/2018
|
// Created by Sabrina Shanman 2018/08/14
|
||||||
// Copyright 2018 High Fidelity, Inc.
|
// Copyright 2018 High Fidelity, Inc.
|
||||||
//
|
//
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
@ -24,4 +24,10 @@ Transform MouseTransformNode::getTransform() {
|
||||||
}
|
}
|
||||||
|
|
||||||
return Transform();
|
return Transform();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVariantMap MouseTransformNode::toVariantMap() const {
|
||||||
|
QVariantMap map;
|
||||||
|
map["joint"] = "Mouse";
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// Created by Sabrina Shanman 8/14/2018
|
// Created by Sabrina Shanman 2018/08/14
|
||||||
// Copyright 2018 High Fidelity, Inc.
|
// Copyright 2018 High Fidelity, Inc.
|
||||||
//
|
//
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
@ -13,6 +13,7 @@
|
||||||
class MouseTransformNode : public TransformNode {
|
class MouseTransformNode : public TransformNode {
|
||||||
public:
|
public:
|
||||||
Transform getTransform() override;
|
Transform getTransform() override;
|
||||||
|
QVariantMap toVariantMap() const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_MouseTransformNode_h
|
#endif // hifi_MouseTransformNode_h
|
||||||
|
|
|
@ -92,6 +92,8 @@ class ParabolaPick : public Pick<PickParabola> {
|
||||||
public:
|
public:
|
||||||
ParabolaPick(const glm::vec3& position, const glm::vec3& direction, float speed, const glm::vec3& acceleration, bool rotateAccelerationWithAvatar, bool rotateAccelerationWithParent, bool scaleWithParent, const PickFilter& filter, float maxDistance, bool enabled);
|
ParabolaPick(const glm::vec3& position, const glm::vec3& direction, float speed, const glm::vec3& acceleration, bool rotateAccelerationWithAvatar, bool rotateAccelerationWithParent, bool scaleWithParent, const PickFilter& filter, float maxDistance, bool enabled);
|
||||||
|
|
||||||
|
PickType getType() const override { return PickType::Parabola; }
|
||||||
|
|
||||||
PickParabola getMathematicalPick() const override;
|
PickParabola getMathematicalPick() const override;
|
||||||
|
|
||||||
PickResultPointer getDefaultResult(const QVariantMap& pickVariant) const override { return std::make_shared<ParabolaPickResult>(pickVariant); }
|
PickResultPointer getDefaultResult(const QVariantMap& pickVariant) const override { return std::make_shared<ParabolaPickResult>(pickVariant); }
|
||||||
|
|
|
@ -30,6 +30,10 @@ ParabolaPointer::ParabolaPointer(const QVariant& rayProps, const RenderStateMap&
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PickQuery::PickType ParabolaPointer::getType() const {
|
||||||
|
return PickQuery::PickType::Parabola;
|
||||||
|
}
|
||||||
|
|
||||||
PickResultPointer ParabolaPointer::getPickResultCopy(const PickResultPointer& pickResult) const {
|
PickResultPointer ParabolaPointer::getPickResultCopy(const PickResultPointer& pickResult) const {
|
||||||
auto parabolaPickResult = std::dynamic_pointer_cast<ParabolaPickResult>(pickResult);
|
auto parabolaPickResult = std::dynamic_pointer_cast<ParabolaPickResult>(pickResult);
|
||||||
if (!parabolaPickResult) {
|
if (!parabolaPickResult) {
|
||||||
|
@ -72,7 +76,7 @@ void ParabolaPointer::editRenderStatePath(const std::string& state, const QVaria
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantMap ParabolaPointer::toVariantMap() const {
|
QVariantMap ParabolaPointer::toVariantMap() const {
|
||||||
QVariantMap qVariantMap;
|
QVariantMap qVariantMap = Parent::toVariantMap();
|
||||||
|
|
||||||
QVariantMap qRenderStates;
|
QVariantMap qRenderStates;
|
||||||
for (auto iter = _renderStates.cbegin(); iter != _renderStates.cend(); iter++) {
|
for (auto iter = _renderStates.cbegin(); iter != _renderStates.cend(); iter++) {
|
||||||
|
|
|
@ -101,6 +101,8 @@ public:
|
||||||
ParabolaPointer(const QVariant& rayProps, const RenderStateMap& renderStates, const DefaultRenderStateMap& defaultRenderStates, bool hover, const PointerTriggers& triggers,
|
ParabolaPointer(const QVariant& rayProps, const RenderStateMap& renderStates, const DefaultRenderStateMap& defaultRenderStates, bool hover, const PointerTriggers& triggers,
|
||||||
bool faceAvatar, bool followNormal, float followNormalStrength, bool centerEndY, bool lockEnd, bool distanceScaleEnd, bool scaleWithAvatar, bool enabled);
|
bool faceAvatar, bool followNormal, float followNormalStrength, bool centerEndY, bool lockEnd, bool distanceScaleEnd, bool scaleWithAvatar, bool enabled);
|
||||||
|
|
||||||
|
PickQuery::PickType getType() const override;
|
||||||
|
|
||||||
QVariantMap toVariantMap() const override;
|
QVariantMap toVariantMap() const override;
|
||||||
|
|
||||||
static std::shared_ptr<StartEndRenderState> buildRenderState(const QVariantMap& propMap);
|
static std::shared_ptr<StartEndRenderState> buildRenderState(const QVariantMap& propMap);
|
||||||
|
|
|
@ -34,18 +34,35 @@ static const float WEB_TOUCH_Y_OFFSET = 0.105f; // how far forward (or back wit
|
||||||
static const glm::vec3 TIP_OFFSET = glm::vec3(0.0f, StylusPick::WEB_STYLUS_LENGTH - WEB_TOUCH_Y_OFFSET, 0.0f);
|
static const glm::vec3 TIP_OFFSET = glm::vec3(0.0f, StylusPick::WEB_STYLUS_LENGTH - WEB_TOUCH_Y_OFFSET, 0.0f);
|
||||||
|
|
||||||
unsigned int PickScriptingInterface::createPick(const PickQuery::PickType type, const QVariant& properties) {
|
unsigned int PickScriptingInterface::createPick(const PickQuery::PickType type, const QVariant& properties) {
|
||||||
|
std::shared_ptr<PickQuery> pick;
|
||||||
|
QVariantMap propMap = properties.toMap();
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case PickQuery::PickType::Ray:
|
case PickQuery::PickType::Ray:
|
||||||
return createRayPick(properties);
|
pick = buildRayPick(propMap);
|
||||||
|
break;
|
||||||
case PickQuery::PickType::Stylus:
|
case PickQuery::PickType::Stylus:
|
||||||
return createStylusPick(properties);
|
pick = buildStylusPick(propMap);
|
||||||
|
break;
|
||||||
case PickQuery::PickType::Parabola:
|
case PickQuery::PickType::Parabola:
|
||||||
return createParabolaPick(properties);
|
pick = buildParabolaPick(propMap);
|
||||||
|
break;
|
||||||
case PickQuery::PickType::Collision:
|
case PickQuery::PickType::Collision:
|
||||||
return createCollisionPick(properties);
|
pick = buildCollisionPick(propMap);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return PickManager::INVALID_PICK_ID;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!pick) {
|
||||||
|
return PickManager::INVALID_PICK_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
propMap["pickType"] = (int)type;
|
||||||
|
|
||||||
|
pick->setScriptParameters(propMap);
|
||||||
|
|
||||||
|
return DependencyManager::get<PickManager>()->addPick(type, pick);
|
||||||
}
|
}
|
||||||
|
|
||||||
PickFilter getPickFilter(unsigned int filter) {
|
PickFilter getPickFilter(unsigned int filter) {
|
||||||
|
@ -82,17 +99,18 @@ PickFilter getPickFilter(unsigned int filter) {
|
||||||
* @property {Vec3} [dirOffset] - Synonym for <code>direction</code>.
|
* @property {Vec3} [dirOffset] - Synonym for <code>direction</code>.
|
||||||
* @property {Quat} [orientation] - Alternative property for specifying <code>direction</code>. The value is applied to the
|
* @property {Quat} [orientation] - Alternative property for specifying <code>direction</code>. The value is applied to the
|
||||||
* default <code>direction</code> value.
|
* default <code>direction</code> value.
|
||||||
|
* @property {PickType} pickType - The type of pick when getting these properties from {@link Picks.getPickProperties} or {@link Picks.getPickScriptParameters}. A ray pick's type is {@link PickType.Ray}.
|
||||||
|
* @property {Vec3} baseScale - Returned from {@link Picks.getPickProperties} when the pick has a parent with varying scale (usually an avatar or an entity).
|
||||||
|
* Its value is the original scale of the parent at the moment the pick was created, and is used to scale the pointer which owns this pick, if any.
|
||||||
*/
|
*/
|
||||||
unsigned int PickScriptingInterface::createRayPick(const QVariant& properties) {
|
std::shared_ptr<PickQuery> PickScriptingInterface::buildRayPick(const QVariantMap& propMap) {
|
||||||
QVariantMap propMap = properties.toMap();
|
|
||||||
|
|
||||||
#if defined (Q_OS_ANDROID)
|
#if defined (Q_OS_ANDROID)
|
||||||
QString jointName { "" };
|
QString jointName { "" };
|
||||||
if (propMap["joint"].isValid()) {
|
if (propMap["joint"].isValid()) {
|
||||||
QString jointName = propMap["joint"].toString();
|
QString jointName = propMap["joint"].toString();
|
||||||
const QString MOUSE_JOINT = "Mouse";
|
const QString MOUSE_JOINT = "Mouse";
|
||||||
if (jointName == MOUSE_JOINT) {
|
if (jointName == MOUSE_JOINT) {
|
||||||
return PointerEvent::INVALID_POINTER_ID;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -134,7 +152,7 @@ unsigned int PickScriptingInterface::createRayPick(const QVariant& properties) {
|
||||||
auto rayPick = std::make_shared<RayPick>(position, direction, filter, maxDistance, enabled);
|
auto rayPick = std::make_shared<RayPick>(position, direction, filter, maxDistance, enabled);
|
||||||
setParentTransform(rayPick, propMap);
|
setParentTransform(rayPick, propMap);
|
||||||
|
|
||||||
return DependencyManager::get<PickManager>()->addPick(PickQuery::Ray, rayPick);
|
return rayPick;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
|
@ -152,10 +170,9 @@ unsigned int PickScriptingInterface::createRayPick(const QVariant& properties) {
|
||||||
* means no maximum.
|
* means no maximum.
|
||||||
* @property {Vec3} [tipOffset=0,0.095,0] - The position of the stylus tip relative to the hand position at default avatar
|
* @property {Vec3} [tipOffset=0,0.095,0] - The position of the stylus tip relative to the hand position at default avatar
|
||||||
* scale.
|
* scale.
|
||||||
|
* @property {PickType} pickType - The type of pick when getting these properties from {@link Picks.getPickProperties} or {@link Picks.getPickScriptParameters}. A stylus pick's type is {@link PickType.Stylus}.
|
||||||
*/
|
*/
|
||||||
unsigned int PickScriptingInterface::createStylusPick(const QVariant& properties) {
|
std::shared_ptr<PickQuery> PickScriptingInterface::buildStylusPick(const QVariantMap& propMap) {
|
||||||
QVariantMap propMap = properties.toMap();
|
|
||||||
|
|
||||||
bilateral::Side side = bilateral::Side::Invalid;
|
bilateral::Side side = bilateral::Side::Invalid;
|
||||||
{
|
{
|
||||||
QVariant handVar = propMap["hand"];
|
QVariant handVar = propMap["hand"];
|
||||||
|
@ -184,7 +201,7 @@ unsigned int PickScriptingInterface::createStylusPick(const QVariant& properties
|
||||||
tipOffset = vec3FromVariant(propMap["tipOffset"]);
|
tipOffset = vec3FromVariant(propMap["tipOffset"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return DependencyManager::get<PickManager>()->addPick(PickQuery::Stylus, std::make_shared<StylusPick>(side, filter, maxDistance, enabled, tipOffset));
|
return std::make_shared<StylusPick>(side, filter, maxDistance, enabled, tipOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: Laser pointer still uses scaleWithAvatar. Until scaleWithAvatar is also deprecated for pointers, scaleWithAvatar should not be removed from the pick API.
|
// NOTE: Laser pointer still uses scaleWithAvatar. Until scaleWithAvatar is also deprecated for pointers, scaleWithAvatar should not be removed from the pick API.
|
||||||
|
@ -228,10 +245,11 @@ unsigned int PickScriptingInterface::createStylusPick(const QVariant& properties
|
||||||
* with the avatar or other parent.
|
* with the avatar or other parent.
|
||||||
* @property {boolean} [scaleWithAvatar=true] - Synonym for <code>scalewithParent</code>.
|
* @property {boolean} [scaleWithAvatar=true] - Synonym for <code>scalewithParent</code>.
|
||||||
* <p class="important">Deprecated: This property is deprecated and will be removed.</p>
|
* <p class="important">Deprecated: This property is deprecated and will be removed.</p>
|
||||||
|
* @property {PickType} pickType - The type of pick when getting these properties from {@link Picks.getPickProperties} or {@link Picks.getPickScriptParameters}. A parabola pick's type is {@link PickType.Parabola}.
|
||||||
|
* @property {Vec3} baseScale - Returned from {@link Picks.getPickProperties} when the pick has a parent with varying scale (usually an avatar or an entity).
|
||||||
|
* Its value is the original scale of the parent at the moment the pick was created, and is used to rescale the pick, and/or the pointer which owns this pick, if any.
|
||||||
*/
|
*/
|
||||||
unsigned int PickScriptingInterface::createParabolaPick(const QVariant& properties) {
|
std::shared_ptr<PickQuery> PickScriptingInterface::buildParabolaPick(const QVariantMap& propMap) {
|
||||||
QVariantMap propMap = properties.toMap();
|
|
||||||
|
|
||||||
bool enabled = false;
|
bool enabled = false;
|
||||||
if (propMap["enabled"].isValid()) {
|
if (propMap["enabled"].isValid()) {
|
||||||
enabled = propMap["enabled"].toBool();
|
enabled = propMap["enabled"].toBool();
|
||||||
|
@ -292,7 +310,7 @@ unsigned int PickScriptingInterface::createParabolaPick(const QVariant& properti
|
||||||
auto parabolaPick = std::make_shared<ParabolaPick>(position, direction, speed, accelerationAxis,
|
auto parabolaPick = std::make_shared<ParabolaPick>(position, direction, speed, accelerationAxis,
|
||||||
rotateAccelerationWithAvatar, rotateAccelerationWithParent, scaleWithParent, filter, maxDistance, enabled);
|
rotateAccelerationWithAvatar, rotateAccelerationWithParent, scaleWithParent, filter, maxDistance, enabled);
|
||||||
setParentTransform(parabolaPick, propMap);
|
setParentTransform(parabolaPick, propMap);
|
||||||
return DependencyManager::get<PickManager>()->addPick(PickQuery::Parabola, parabolaPick);
|
return parabolaPick;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -326,10 +344,11 @@ unsigned int PickScriptingInterface::createParabolaPick(const QVariant& properti
|
||||||
* the collision region. The depth is in world coordinates but scales with the parent if defined.
|
* the collision region. The depth is in world coordinates but scales with the parent if defined.
|
||||||
* @property {CollisionMask} [collisionGroup=8] - The type of objects the collision region collides as. Objects whose collision
|
* @property {CollisionMask} [collisionGroup=8] - The type of objects the collision region collides as. Objects whose collision
|
||||||
* masks overlap with the region's collision group are considered to be colliding with the region.
|
* masks overlap with the region's collision group are considered to be colliding with the region.
|
||||||
|
* @property {PickType} pickType - The type of pick when getting these properties from {@link Picks.getPickProperties} or {@link Picks.getPickScriptParameters}. A collision pick's type is {@link PickType.Collision}.
|
||||||
|
* @property {Vec3} baseScale - Returned from {@link Picks.getPickProperties} when the pick has a parent with varying scale (usually an avatar or an entity).
|
||||||
|
* Its value is the original scale of the parent at the moment the pick was created, and is used to rescale the pick, and/or the pointer which owns this pick, if any.
|
||||||
*/
|
*/
|
||||||
unsigned int PickScriptingInterface::createCollisionPick(const QVariant& properties) {
|
std::shared_ptr<PickQuery> PickScriptingInterface::buildCollisionPick(const QVariantMap& propMap) {
|
||||||
QVariantMap propMap = properties.toMap();
|
|
||||||
|
|
||||||
bool enabled = false;
|
bool enabled = false;
|
||||||
if (propMap["enabled"].isValid()) {
|
if (propMap["enabled"].isValid()) {
|
||||||
enabled = propMap["enabled"].toBool();
|
enabled = propMap["enabled"].toBool();
|
||||||
|
@ -354,7 +373,7 @@ unsigned int PickScriptingInterface::createCollisionPick(const QVariant& propert
|
||||||
auto collisionPick = std::make_shared<CollisionPick>(filter, maxDistance, enabled, scaleWithParent, collisionRegion, qApp->getPhysicsEngine());
|
auto collisionPick = std::make_shared<CollisionPick>(filter, maxDistance, enabled, scaleWithParent, collisionRegion, qApp->getPhysicsEngine());
|
||||||
setParentTransform(collisionPick, propMap);
|
setParentTransform(collisionPick, propMap);
|
||||||
|
|
||||||
return DependencyManager::get<PickManager>()->addPick(PickQuery::Collision, collisionPick);
|
return collisionPick;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PickScriptingInterface::enablePick(unsigned int uid) {
|
void PickScriptingInterface::enablePick(unsigned int uid) {
|
||||||
|
@ -365,10 +384,26 @@ void PickScriptingInterface::disablePick(unsigned int uid) {
|
||||||
DependencyManager::get<PickManager>()->disablePick(uid);
|
DependencyManager::get<PickManager>()->disablePick(uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PickScriptingInterface::isPickEnabled(unsigned int uid) const {
|
||||||
|
return DependencyManager::get<PickManager>()->isPickEnabled(uid);
|
||||||
|
}
|
||||||
|
|
||||||
void PickScriptingInterface::removePick(unsigned int uid) {
|
void PickScriptingInterface::removePick(unsigned int uid) {
|
||||||
DependencyManager::get<PickManager>()->removePick(uid);
|
DependencyManager::get<PickManager>()->removePick(uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVariantMap PickScriptingInterface::getPickProperties(unsigned int uid) const {
|
||||||
|
return DependencyManager::get<PickManager>()->getPickProperties(uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariantMap PickScriptingInterface::getPickScriptParameters(unsigned int uid) const {
|
||||||
|
return DependencyManager::get<PickManager>()->getPickScriptParameters(uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
QVector<unsigned int> PickScriptingInterface::getPicks() const {
|
||||||
|
return DependencyManager::get<PickManager>()->getPicks();
|
||||||
|
}
|
||||||
|
|
||||||
QVariantMap PickScriptingInterface::getPrevPickResult(unsigned int uid) {
|
QVariantMap PickScriptingInterface::getPrevPickResult(unsigned int uid) {
|
||||||
QVariantMap result;
|
QVariantMap result;
|
||||||
auto pickResult = DependencyManager::get<PickManager>()->getPrevPickResult(uid);
|
auto pickResult = DependencyManager::get<PickManager>()->getPrevPickResult(uid);
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
|
|
||||||
#include <RegisteredMetaTypes.h>
|
|
||||||
#include <DependencyManager.h>
|
#include <DependencyManager.h>
|
||||||
#include <PhysicsEngine.h>
|
#include <PhysicsEngine.h>
|
||||||
#include <Pick.h>
|
#include <Pick.h>
|
||||||
|
@ -98,11 +97,6 @@ class PickScriptingInterface : public QObject, public Dependency {
|
||||||
SINGLETON_DEPENDENCY
|
SINGLETON_DEPENDENCY
|
||||||
|
|
||||||
public:
|
public:
|
||||||
unsigned int createRayPick(const QVariant& properties);
|
|
||||||
unsigned int createStylusPick(const QVariant& properties);
|
|
||||||
unsigned int createCollisionPick(const QVariant& properties);
|
|
||||||
unsigned int createParabolaPick(const QVariant& properties);
|
|
||||||
|
|
||||||
void registerMetaTypes(QScriptEngine* engine);
|
void registerMetaTypes(QScriptEngine* engine);
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
|
@ -134,6 +128,14 @@ public:
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE void disablePick(unsigned int uid);
|
Q_INVOKABLE void disablePick(unsigned int uid);
|
||||||
|
|
||||||
|
/**jsdoc
|
||||||
|
* Get the enabled status of a pick. Enabled picks update their pick results.
|
||||||
|
* @function Picks.isPickEnabled
|
||||||
|
* @param {number} id - The ID of the pick.
|
||||||
|
* @returns {boolean} enabled - Whether or not the pick is enabled.
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE bool isPickEnabled(unsigned int uid) const;
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Removes (deletes) a pick.
|
* Removes (deletes) a pick.
|
||||||
* @function Picks.removePick
|
* @function Picks.removePick
|
||||||
|
@ -141,6 +143,32 @@ public:
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE void removePick(unsigned int uid);
|
Q_INVOKABLE void removePick(unsigned int uid);
|
||||||
|
|
||||||
|
/**jsdoc
|
||||||
|
* Gets the current properties of the pick.
|
||||||
|
* @function Picks.getPickProperties
|
||||||
|
* @param {number} id - The ID of the pick.
|
||||||
|
* @returns {Picks.RayPickProperties|Picks.ParabolaPickProperties|Picks.StylusPickProperties|Picks.CollisionPickProperties} Properties of the pick, per the pick <code>type</code>.
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE QVariantMap getPickProperties(unsigned int uid) const;
|
||||||
|
|
||||||
|
/**jsdoc
|
||||||
|
* Gets the parameters that were passed in to {@link Picks.createPick} to create the pick,
|
||||||
|
* if the pick was created through a script.
|
||||||
|
* Note that these properties do not reflect the current state of the pick.
|
||||||
|
* See {@link Picks.getPickProperties}.
|
||||||
|
* @function Picks.getPickScriptParameters
|
||||||
|
* @param {number} id - The ID of the pick.
|
||||||
|
* @returns {Picks.RayPickProperties|Picks.ParabolaPickProperties|Picks.StylusPickProperties|Picks.CollisionPickProperties} User-provided properties, per the pick <code>type</code>.
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE QVariantMap getPickScriptParameters(unsigned int uid) const;
|
||||||
|
|
||||||
|
/**jsdoc
|
||||||
|
* Gets all picks which currently exist, including disabled picks.
|
||||||
|
* @function Picks.getPicks
|
||||||
|
* @returns {number[]} picks - The IDs of the picks.
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE QVector<unsigned int> getPicks() const;
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Gets the most recent result from a pick. A pick continues to be updated ready to return a result, as long as it is
|
* Gets the most recent result from a pick. A pick continues to be updated ready to return a result, as long as it is
|
||||||
* enabled.
|
* enabled.
|
||||||
|
@ -419,6 +447,11 @@ public slots:
|
||||||
static constexpr unsigned int INTERSECTED_HUD() { return IntersectionType::HUD; }
|
static constexpr unsigned int INTERSECTED_HUD() { return IntersectionType::HUD; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
static std::shared_ptr<PickQuery> buildRayPick(const QVariantMap& properties);
|
||||||
|
static std::shared_ptr<PickQuery> buildStylusPick(const QVariantMap& properties);
|
||||||
|
static std::shared_ptr<PickQuery> buildCollisionPick(const QVariantMap& properties);
|
||||||
|
static std::shared_ptr<PickQuery> buildParabolaPick(const QVariantMap& properties);
|
||||||
|
|
||||||
static void setParentTransform(std::shared_ptr<PickQuery> pick, const QVariantMap& propMap);
|
static void setParentTransform(std::shared_ptr<PickQuery> pick, const QVariantMap& propMap);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include <shared/QtHelpers.h>
|
#include <shared/QtHelpers.h>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
#include "PickManager.h"
|
||||||
#include "LaserPointer.h"
|
#include "LaserPointer.h"
|
||||||
#include "StylusPointer.h"
|
#include "StylusPointer.h"
|
||||||
#include "ParabolaPointer.h"
|
#include "ParabolaPointer.h"
|
||||||
|
@ -38,16 +39,48 @@ unsigned int PointerScriptingInterface::createPointer(const PickQuery::PickType&
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVariantMap propertyMap = properties.toMap();
|
||||||
|
|
||||||
|
std::shared_ptr<Pointer> pointer;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case PickQuery::PickType::Ray:
|
case PickQuery::PickType::Ray:
|
||||||
return createLaserPointer(properties);
|
pointer = buildLaserPointer(propertyMap);
|
||||||
|
break;
|
||||||
case PickQuery::PickType::Stylus:
|
case PickQuery::PickType::Stylus:
|
||||||
return createStylus(properties);
|
pointer = buildStylus(propertyMap);
|
||||||
|
break;
|
||||||
case PickQuery::PickType::Parabola:
|
case PickQuery::PickType::Parabola:
|
||||||
return createParabolaPointer(properties);
|
pointer = buildParabolaPointer(propertyMap);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return PointerEvent::INVALID_POINTER_ID;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!pointer) {
|
||||||
|
return PointerEvent::INVALID_POINTER_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
propertyMap["pointerType"] = (int)type;
|
||||||
|
|
||||||
|
pointer->setScriptParameters(propertyMap);
|
||||||
|
|
||||||
|
return DependencyManager::get<PointerManager>()->addPointer(pointer);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PointerScriptingInterface::isPointerEnabled(unsigned int uid) const {
|
||||||
|
return DependencyManager::get<PointerManager>()->isPointerEnabled(uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
QVector<unsigned int> PointerScriptingInterface::getPointers() const {
|
||||||
|
return DependencyManager::get<PointerManager>()->getPointers();
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariantMap PointerScriptingInterface::getPointerProperties(unsigned int uid) const {
|
||||||
|
return DependencyManager::get<PointerManager>()->getPointerProperties(uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariantMap PointerScriptingInterface::getPointerScriptParameters(unsigned int uid) const {
|
||||||
|
return DependencyManager::get<PointerManager>()->getPointerScriptParameters(uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
|
@ -56,6 +89,8 @@ unsigned int PointerScriptingInterface::createPointer(const PickQuery::PickType&
|
||||||
* @property {Pointers.StylusPointerModel} [model] - Override some or all of the default stylus model properties.
|
* @property {Pointers.StylusPointerModel} [model] - Override some or all of the default stylus model properties.
|
||||||
* @property {boolean} [hover=false] - <code>true</code> if the pointer generates {@link Entities} hover events,
|
* @property {boolean} [hover=false] - <code>true</code> if the pointer generates {@link Entities} hover events,
|
||||||
* <code>false</code> if it doesn't.
|
* <code>false</code> if it doesn't.
|
||||||
|
* @property {PickType} pointerType - The type of pointer when getting these properties from {@link Pointers.getPointerProperties} or {@link Pointers.getPointerScriptParameters}. A stylus pointer's type is {@link PickType.Stylus}.
|
||||||
|
* @property {number} [pickID] - Returned from {@link Pointers.getPointerProperties}. The ID of the pick created alongside this pointer.
|
||||||
* @see {@link Picks.StylusPickProperties} for additional properties from the underlying stylus pick.
|
* @see {@link Picks.StylusPickProperties} for additional properties from the underlying stylus pick.
|
||||||
*/
|
*/
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
|
@ -67,7 +102,7 @@ unsigned int PointerScriptingInterface::createPointer(const PickQuery::PickType&
|
||||||
* offset.
|
* offset.
|
||||||
* @property {Quat} [rotationOffset] - The rotation offset of the model from the hand, to override the default rotation offset.
|
* @property {Quat} [rotationOffset] - The rotation offset of the model from the hand, to override the default rotation offset.
|
||||||
*/
|
*/
|
||||||
unsigned int PointerScriptingInterface::createStylus(const QVariant& properties) const {
|
std::shared_ptr<Pointer> PointerScriptingInterface::buildStylus(const QVariant& properties) {
|
||||||
QVariantMap propertyMap = properties.toMap();
|
QVariantMap propertyMap = properties.toMap();
|
||||||
|
|
||||||
bool hover = false;
|
bool hover = false;
|
||||||
|
@ -100,8 +135,7 @@ unsigned int PointerScriptingInterface::createStylus(const QVariant& properties)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return DependencyManager::get<PointerManager>()->addPointer(std::make_shared<StylusPointer>(properties, StylusPointer::buildStylus(propertyMap), hover, enabled, modelPositionOffset,
|
return std::make_shared<StylusPointer>(properties, StylusPointer::buildStylus(propertyMap), hover, enabled, modelPositionOffset, modelRotationOffset, modelDimensions);
|
||||||
modelRotationOffset, modelDimensions));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
|
@ -174,9 +208,11 @@ unsigned int PointerScriptingInterface::createStylus(const QVariant& properties)
|
||||||
* <code>false</code> if it doesn't.
|
* <code>false</code> if it doesn't.
|
||||||
* @property {Pointers.Trigger[]} [triggers=[]] - A list of ways that a {@link Controller} action or function should trigger
|
* @property {Pointers.Trigger[]} [triggers=[]] - A list of ways that a {@link Controller} action or function should trigger
|
||||||
* events on the entity or overlay currently intersected.
|
* events on the entity or overlay currently intersected.
|
||||||
|
* @property {PickType} pointerType - The type of pointer when getting these properties from {@link Pointers.getPointerProperties} or {@link Pointers.getPointerScriptParameters}. A laser pointer's type is {@link PickType.Ray}.
|
||||||
|
* @property {number} [pickID] - Returned from {@link Pointers.getPointerProperties}. The ID of the pick created alongside this pointer.
|
||||||
* @see {@link Picks.RayPickProperties} for additional properties from the underlying ray pick.
|
* @see {@link Picks.RayPickProperties} for additional properties from the underlying ray pick.
|
||||||
*/
|
*/
|
||||||
unsigned int PointerScriptingInterface::createLaserPointer(const QVariant& properties) const {
|
std::shared_ptr<Pointer> PointerScriptingInterface::buildLaserPointer(const QVariant& properties) {
|
||||||
QVariantMap propertyMap = properties.toMap();
|
QVariantMap propertyMap = properties.toMap();
|
||||||
|
|
||||||
#if defined (Q_OS_ANDROID)
|
#if defined (Q_OS_ANDROID)
|
||||||
|
@ -185,7 +221,7 @@ unsigned int PointerScriptingInterface::createLaserPointer(const QVariant& prope
|
||||||
QString jointName = propertyMap["joint"].toString();
|
QString jointName = propertyMap["joint"].toString();
|
||||||
const QString MOUSE_JOINT = "Mouse";
|
const QString MOUSE_JOINT = "Mouse";
|
||||||
if (jointName == MOUSE_JOINT) {
|
if (jointName == MOUSE_JOINT) {
|
||||||
return PointerEvent::INVALID_POINTER_ID;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -283,9 +319,9 @@ unsigned int PointerScriptingInterface::createLaserPointer(const QVariant& prope
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return DependencyManager::get<PointerManager>()->addPointer(std::make_shared<LaserPointer>(properties, renderStates, defaultRenderStates, hover, triggers,
|
return std::make_shared<LaserPointer>(properties, renderStates, defaultRenderStates, hover, triggers,
|
||||||
faceAvatar, followNormal, followNormalStrength, centerEndY, lockEnd,
|
faceAvatar, followNormal, followNormalStrength, centerEndY, lockEnd,
|
||||||
distanceScaleEnd, scaleWithParent, enabled));
|
distanceScaleEnd, scaleWithParent, enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
|
@ -365,9 +401,11 @@ unsigned int PointerScriptingInterface::createLaserPointer(const QVariant& prope
|
||||||
* <code>false</code> if it doesn't.
|
* <code>false</code> if it doesn't.
|
||||||
* @property {Pointers.Trigger[]} [triggers=[]] - A list of ways that a {@link Controller} action or function should trigger
|
* @property {Pointers.Trigger[]} [triggers=[]] - A list of ways that a {@link Controller} action or function should trigger
|
||||||
* events on the entity or overlay currently intersected.
|
* events on the entity or overlay currently intersected.
|
||||||
|
* @property {PickType} pointerType - The type of pointer when getting these properties from {@link Pointers.getPointerProperties} or {@link Pointers.getPointerScriptParameters}. A parabola pointer's type is {@link PickType.Parabola}.
|
||||||
|
* @property {number} [pickID] - Returned from {@link Pointers.getPointerProperties}. The ID of the pick created alongside this pointer.
|
||||||
* @see {@link Picks.ParabolaPickProperties} for additional properties from the underlying parabola pick.
|
* @see {@link Picks.ParabolaPickProperties} for additional properties from the underlying parabola pick.
|
||||||
*/
|
*/
|
||||||
unsigned int PointerScriptingInterface::createParabolaPointer(const QVariant& properties) const {
|
std::shared_ptr<Pointer> PointerScriptingInterface::buildParabolaPointer(const QVariant& properties) {
|
||||||
QVariantMap propertyMap = properties.toMap();
|
QVariantMap propertyMap = properties.toMap();
|
||||||
|
|
||||||
bool faceAvatar = false;
|
bool faceAvatar = false;
|
||||||
|
@ -463,9 +501,9 @@ unsigned int PointerScriptingInterface::createParabolaPointer(const QVariant& pr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return DependencyManager::get<PointerManager>()->addPointer(std::make_shared<ParabolaPointer>(properties, renderStates, defaultRenderStates, hover, triggers,
|
return std::make_shared<ParabolaPointer>(properties, renderStates, defaultRenderStates, hover, triggers,
|
||||||
faceAvatar, followNormal, followNormalStrength, centerEndY, lockEnd, distanceScaleEnd,
|
faceAvatar, followNormal, followNormalStrength, centerEndY, lockEnd, distanceScaleEnd,
|
||||||
scaleWithParent, enabled));
|
scaleWithParent, enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PointerScriptingInterface::editRenderState(unsigned int uid, const QString& renderState, const QVariant& properties) const {
|
void PointerScriptingInterface::editRenderState(unsigned int uid, const QString& renderState, const QVariant& properties) const {
|
||||||
|
@ -497,7 +535,3 @@ QVariantMap PointerScriptingInterface::getPrevPickResult(unsigned int uid) const
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantMap PointerScriptingInterface::getPointerProperties(unsigned int uid) const {
|
|
||||||
return DependencyManager::get<PointerManager>()->getPointerProperties(uid);
|
|
||||||
}
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
|
|
||||||
#include "DependencyManager.h"
|
#include "DependencyManager.h"
|
||||||
|
#include "RegisteredMetaTypes.h"
|
||||||
#include <PointerManager.h>
|
#include <PointerManager.h>
|
||||||
#include <Pick.h>
|
#include <Pick.h>
|
||||||
|
|
||||||
|
@ -31,9 +32,6 @@ class PointerScriptingInterface : public QObject, public Dependency {
|
||||||
SINGLETON_DEPENDENCY
|
SINGLETON_DEPENDENCY
|
||||||
|
|
||||||
public:
|
public:
|
||||||
unsigned int createLaserPointer(const QVariant& properties) const;
|
|
||||||
unsigned int createStylus(const QVariant& properties) const;
|
|
||||||
unsigned int createParabolaPointer(const QVariant& properties) const;
|
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Specifies that a {@link Controller} action or function should trigger events on the entity or overlay currently
|
* Specifies that a {@link Controller} action or function should trigger events on the entity or overlay currently
|
||||||
|
@ -147,6 +145,14 @@ public:
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE void disablePointer(unsigned int uid) const { DependencyManager::get<PointerManager>()->disablePointer(uid); }
|
Q_INVOKABLE void disablePointer(unsigned int uid) const { DependencyManager::get<PointerManager>()->disablePointer(uid); }
|
||||||
|
|
||||||
|
/**jsdoc
|
||||||
|
* Gets the enabled status of a pointer. Enabled pointers update their pick results and generate events.
|
||||||
|
* @function Pointers.isPointerEnabled
|
||||||
|
* @param {number} id - The ID of the pointer.
|
||||||
|
* @returns {boolean} enabled - Whether or not the pointer is enabled.
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE bool isPointerEnabled(unsigned int uid) const;
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Removes (deletes) a pointer.
|
* Removes (deletes) a pointer.
|
||||||
* @function Pointers.removePointer
|
* @function Pointers.removePointer
|
||||||
|
@ -154,6 +160,24 @@ public:
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE void removePointer(unsigned int uid) const { DependencyManager::get<PointerManager>()->removePointer(uid); }
|
Q_INVOKABLE void removePointer(unsigned int uid) const { DependencyManager::get<PointerManager>()->removePointer(uid); }
|
||||||
|
|
||||||
|
/**jsdoc
|
||||||
|
* Gets the parameters that were passed in to {@link Pointers.createPointer} to create the pointer,
|
||||||
|
* if the pointer was created through a script.
|
||||||
|
* Note that these properties do not reflect the current state of the pointer.
|
||||||
|
* See {@link Pointers.getPointerProperties}.
|
||||||
|
* @function Pointers.getPointerScriptParameters
|
||||||
|
* @param {number} id - The ID of the pointer.
|
||||||
|
* @returns {Pointers.RayPointerProperties|Picks.ParabolaPointerProperties|Picks.StylusPointerProperties} User-provided properties, per the pointer <code>type</code>.
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE QVariantMap getPointerScriptParameters(unsigned int uid) const;
|
||||||
|
|
||||||
|
/**jsdoc
|
||||||
|
* Gets all pointers which currently exist, including disabled pointers.
|
||||||
|
* @function Pointers.getPointers
|
||||||
|
* @returns {number[]} pointers - The IDs of the pointers.
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE QVector<unsigned int> getPointers() const;
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Edits a render state of a {@link Pointers.RayPointerProperties|ray} or
|
* Edits a render state of a {@link Pointers.RayPointerProperties|ray} or
|
||||||
* {@link Pointers.ParabolaPointerProperties|parabola} pointer, to change its visual appearance for the state when the
|
* {@link Pointers.ParabolaPointerProperties|parabola} pointer, to change its visual appearance for the state when the
|
||||||
|
@ -448,6 +472,11 @@ public:
|
||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE QVariantMap getPointerProperties(unsigned int uid) const;
|
Q_INVOKABLE QVariantMap getPointerProperties(unsigned int uid) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static std::shared_ptr<Pointer> buildLaserPointer(const QVariant& properties);
|
||||||
|
static std::shared_ptr<Pointer> buildStylus(const QVariant& properties);
|
||||||
|
static std::shared_ptr<Pointer> buildParabolaPointer(const QVariant& properties);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_PointerScriptingInterface_h
|
#endif // hifi_PointerScriptingInterface_h
|
||||||
|
|
|
@ -88,6 +88,8 @@ public:
|
||||||
Pick(PickRay(position, direction), filter, maxDistance, enabled) {
|
Pick(PickRay(position, direction), filter, maxDistance, enabled) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PickType getType() const override { return PickType::Ray; }
|
||||||
|
|
||||||
PickRay getMathematicalPick() const override;
|
PickRay getMathematicalPick() const override;
|
||||||
|
|
||||||
PickResultPointer getDefaultResult(const QVariantMap& pickVariant) const override { return std::make_shared<RayPickResult>(pickVariant); }
|
PickResultPointer getDefaultResult(const QVariantMap& pickVariant) const override { return std::make_shared<RayPickResult>(pickVariant); }
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include <PickManager.h>
|
#include <PickManager.h>
|
||||||
|
|
||||||
unsigned int RayPickScriptingInterface::createRayPick(const QVariant& properties) {
|
unsigned int RayPickScriptingInterface::createRayPick(const QVariant& properties) {
|
||||||
return DependencyManager::get<PickScriptingInterface>()->createRayPick(properties);
|
return DependencyManager::get<PickScriptingInterface>()->createPick(PickQuery::PickType::Ray, properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RayPickScriptingInterface::enableRayPick(unsigned int uid) {
|
void RayPickScriptingInterface::enableRayPick(unsigned int uid) {
|
||||||
|
|
|
@ -72,6 +72,7 @@ class StylusPick : public Pick<StylusTip> {
|
||||||
public:
|
public:
|
||||||
StylusPick(Side side, const PickFilter& filter, float maxDistance, bool enabled, const glm::vec3& tipOffset);
|
StylusPick(Side side, const PickFilter& filter, float maxDistance, bool enabled, const glm::vec3& tipOffset);
|
||||||
|
|
||||||
|
PickType getType() const override { return PickType::Stylus; }
|
||||||
StylusTip getMathematicalPick() const override;
|
StylusTip getMathematicalPick() const override;
|
||||||
PickResultPointer getDefaultResult(const QVariantMap& pickVariant) const override;
|
PickResultPointer getDefaultResult(const QVariantMap& pickVariant) const override;
|
||||||
PickResultPointer getEntityIntersection(const StylusTip& pick) override;
|
PickResultPointer getEntityIntersection(const StylusTip& pick) override;
|
||||||
|
|
|
@ -29,7 +29,7 @@ static const QString DEFAULT_STYLUS_MODEL_URL = PathUtils::resourcesUrl() + "/me
|
||||||
|
|
||||||
StylusPointer::StylusPointer(const QVariant& props, const QUuid& stylus, bool hover, bool enabled,
|
StylusPointer::StylusPointer(const QVariant& props, const QUuid& stylus, bool hover, bool enabled,
|
||||||
const glm::vec3& modelPositionOffset, const glm::quat& modelRotationOffset, const glm::vec3& modelDimensions) :
|
const glm::vec3& modelPositionOffset, const glm::quat& modelRotationOffset, const glm::vec3& modelDimensions) :
|
||||||
Pointer(DependencyManager::get<PickScriptingInterface>()->createStylusPick(props), enabled, hover),
|
Pointer(DependencyManager::get<PickScriptingInterface>()->createPick(PickQuery::PickType::Stylus, props), enabled, hover),
|
||||||
_stylus(stylus),
|
_stylus(stylus),
|
||||||
_modelPositionOffset(modelPositionOffset),
|
_modelPositionOffset(modelPositionOffset),
|
||||||
_modelDimensions(modelDimensions),
|
_modelDimensions(modelDimensions),
|
||||||
|
@ -43,6 +43,10 @@ StylusPointer::~StylusPointer() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PickQuery::PickType StylusPointer::getType() const {
|
||||||
|
return PickQuery::PickType::Stylus;
|
||||||
|
}
|
||||||
|
|
||||||
QUuid StylusPointer::buildStylus(const QVariantMap& properties) {
|
QUuid StylusPointer::buildStylus(const QVariantMap& properties) {
|
||||||
// FIXME: we have to keep using the Overlays interface here, because existing scripts use overlay properties to define pointers
|
// FIXME: we have to keep using the Overlays interface here, because existing scripts use overlay properties to define pointers
|
||||||
QVariantMap propertiesMap;
|
QVariantMap propertiesMap;
|
||||||
|
@ -229,7 +233,7 @@ void StylusPointer::setRenderState(const std::string& state) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantMap StylusPointer::toVariantMap() const {
|
QVariantMap StylusPointer::toVariantMap() const {
|
||||||
return QVariantMap();
|
return Parent::toVariantMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec3 StylusPointer::findIntersection(const PickedObject& pickedObject, const glm::vec3& origin, const glm::vec3& direction) {
|
glm::vec3 StylusPointer::findIntersection(const PickedObject& pickedObject, const glm::vec3& origin, const glm::vec3& direction) {
|
||||||
|
|
|
@ -23,6 +23,8 @@ public:
|
||||||
const glm::vec3& modelPositionOffset, const glm::quat& modelRotationOffset, const glm::vec3& modelDimensions);
|
const glm::vec3& modelPositionOffset, const glm::quat& modelRotationOffset, const glm::vec3& modelDimensions);
|
||||||
~StylusPointer();
|
~StylusPointer();
|
||||||
|
|
||||||
|
PickQuery::PickType getType() const override;
|
||||||
|
|
||||||
void updateVisuals(const PickResultPointer& pickResult) override;
|
void updateVisuals(const PickResultPointer& pickResult) override;
|
||||||
|
|
||||||
// Styluses have three render states:
|
// Styluses have three render states:
|
||||||
|
|
|
@ -72,9 +72,7 @@ BOOL CLauncherApp::InitInstance() {
|
||||||
} else {
|
} else {
|
||||||
_manager.init(!noUpdate, continueAction);
|
_manager.init(!noUpdate, continueAction);
|
||||||
}
|
}
|
||||||
if (!_manager.hasFailed() && !_manager.installLauncher()) {
|
_manager.tryToInstallLauncher();
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
installFont(IDR_FONT_REGULAR);
|
installFont(IDR_FONT_REGULAR);
|
||||||
installFont(IDR_FONT_BOLD);
|
installFont(IDR_FONT_BOLD);
|
||||||
CWinApp::InitInstance();
|
CWinApp::InitInstance();
|
||||||
|
|
|
@ -656,7 +656,6 @@ BOOL CLauncherDlg::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
|
||||||
|
|
||||||
void CLauncherDlg::OnTimer(UINT_PTR nIDEvent) {
|
void CLauncherDlg::OnTimer(UINT_PTR nIDEvent) {
|
||||||
|
|
||||||
|
|
||||||
if (theApp._manager.hasFailed() && _drawStep != DrawStep::DrawError) {
|
if (theApp._manager.hasFailed() && _drawStep != DrawStep::DrawError) {
|
||||||
theApp._manager.saveErrorLog();
|
theApp._manager.saveErrorLog();
|
||||||
prepareProcess(DrawStep::DrawError);
|
prepareProcess(DrawStep::DrawError);
|
||||||
|
@ -757,6 +756,9 @@ void CLauncherDlg::OnTimer(UINT_PTR nIDEvent) {
|
||||||
_applicationWND = theApp._manager.launchApplication();
|
_applicationWND = theApp._manager.launchApplication();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (theApp._manager.needsToSelfInstall()) {
|
||||||
|
theApp._manager.tryToInstallLauncher(TRUE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLauncherDlg::setVerticalElement(CWnd* element, int verticalOffset, int heightOffset, bool fromMainWindowBottom) {
|
void CLauncherDlg::setVerticalElement(CWnd* element, int verticalOffset, int heightOffset, bool fromMainWindowBottom) {
|
||||||
|
|
|
@ -108,7 +108,7 @@ void LauncherManager::saveErrorLog() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL LauncherManager::installLauncher() {
|
void LauncherManager::tryToInstallLauncher(BOOL retry) {
|
||||||
CString appPath;
|
CString appPath;
|
||||||
BOOL result = getAndCreatePaths(PathType::Running_Path, appPath);
|
BOOL result = getAndCreatePaths(PathType::Running_Path, appPath);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
|
@ -126,26 +126,49 @@ BOOL LauncherManager::installLauncher() {
|
||||||
if (!_shouldUninstall) {
|
if (!_shouldUninstall) {
|
||||||
// The installer is not running on the desired location and has to be installed
|
// The installer is not running on the desired location and has to be installed
|
||||||
// Kill of running before self-copy
|
// Kill of running before self-copy
|
||||||
addToLog(_T("Installing Launcher."));
|
addToLog(_T("Trying to install launcher."));
|
||||||
int launcherPID = -1;
|
int launcherPID = -1;
|
||||||
if (LauncherUtils::isProcessRunning(LAUNCHER_EXE_FILENAME, launcherPID)) {
|
if (LauncherUtils::isProcessRunning(LAUNCHER_EXE_FILENAME, launcherPID)) {
|
||||||
if (!LauncherUtils::shutdownProcess(launcherPID, 0)) {
|
if (!LauncherUtils::shutdownProcess(launcherPID, 0)) {
|
||||||
addToLog(_T("Error shutting down the Launcher"));
|
addToLog(_T("Error shutting down the Launcher"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CopyFile(appPath, instalationPath, FALSE);
|
const int LAUNCHER_INSTALL_RETRYS = 10;
|
||||||
|
const int WAIT_BETWEEN_RETRYS_MS = 10;
|
||||||
|
int installTrys = retry ? LAUNCHER_INSTALL_RETRYS : 0;
|
||||||
|
for (int i = 0; i <= installTrys; i++) {
|
||||||
|
_retryLauncherInstall = !CopyFile(appPath, instalationPath, FALSE);
|
||||||
|
if (!_retryLauncherInstall) {
|
||||||
|
addToLog(_T("Launcher installed successfully."));
|
||||||
|
break;
|
||||||
|
} else if (i < installTrys) {
|
||||||
|
CString msg;
|
||||||
|
msg.Format(_T("Installing launcher try: %d"), i);
|
||||||
|
addToLog(msg);
|
||||||
|
Sleep(WAIT_BETWEEN_RETRYS_MS);
|
||||||
|
} else if (installTrys > 0) {
|
||||||
|
addToLog(_T("Error installing launcher."));
|
||||||
|
_retryLauncherInstall = false;
|
||||||
|
_hasFailed = true;
|
||||||
|
} else {
|
||||||
|
addToLog(_T("Old launcher is still running. Install could not be completed."));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (_shouldUninstall) {
|
} else if (_shouldUninstall) {
|
||||||
addToLog(_T("Launching Uninstall mode."));
|
addToLog(_T("Launching Uninstall mode."));
|
||||||
CString tempPath;
|
CString tempPath;
|
||||||
if (getAndCreatePaths(PathType::Temp_Directory, tempPath)) {
|
if (getAndCreatePaths(PathType::Temp_Directory, tempPath)) {
|
||||||
tempPath += _T("\\HQ_uninstaller_tmp.exe");
|
tempPath += _T("\\HQ_uninstaller_tmp.exe");
|
||||||
CopyFile(instalationPath, tempPath, false);
|
if (!CopyFile(instalationPath, tempPath, false)) {
|
||||||
LauncherUtils::launchApplication(tempPath, _T(" --uninstall"));
|
addToLog(_T("Error copying uninstaller to tmp directory."));
|
||||||
exit(0);
|
_hasFailed = true;
|
||||||
|
} else {
|
||||||
|
LauncherUtils::launchApplication(tempPath, _T(" --uninstall"));
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL LauncherManager::restartLauncher() {
|
BOOL LauncherManager::restartLauncher() {
|
||||||
|
|
|
@ -92,7 +92,7 @@ public:
|
||||||
BOOL deleteShortcuts();
|
BOOL deleteShortcuts();
|
||||||
HWND launchApplication();
|
HWND launchApplication();
|
||||||
BOOL uninstallApplication();
|
BOOL uninstallApplication();
|
||||||
BOOL installLauncher();
|
void tryToInstallLauncher(BOOL retry = FALSE);
|
||||||
BOOL restartLauncher();
|
BOOL restartLauncher();
|
||||||
|
|
||||||
// getters
|
// getters
|
||||||
|
@ -108,6 +108,7 @@ public:
|
||||||
BOOL needsInstall() const { return _shouldInstall; }
|
BOOL needsInstall() const { return _shouldInstall; }
|
||||||
BOOL needsToWait() const { return _shouldWait; }
|
BOOL needsToWait() const { return _shouldWait; }
|
||||||
BOOL needsRestartNewLauncher() const { return _shouldRestartNewLauncher; }
|
BOOL needsRestartNewLauncher() const { return _shouldRestartNewLauncher; }
|
||||||
|
BOOL needsToSelfInstall() const { return _retryLauncherInstall; }
|
||||||
BOOL willContinueUpdating() const { return _keepUpdating; }
|
BOOL willContinueUpdating() const { return _keepUpdating; }
|
||||||
ContinueActionOnStart getContinueAction() { return _continueAction; }
|
ContinueActionOnStart getContinueAction() { return _continueAction; }
|
||||||
void setDisplayName(const CString& displayName) { _displayName = displayName; }
|
void setDisplayName(const CString& displayName) { _displayName = displayName; }
|
||||||
|
@ -164,6 +165,7 @@ private:
|
||||||
BOOL _shouldRestartNewLauncher { FALSE };
|
BOOL _shouldRestartNewLauncher { FALSE };
|
||||||
BOOL _keepLoggingIn { FALSE };
|
BOOL _keepLoggingIn { FALSE };
|
||||||
BOOL _keepUpdating { FALSE };
|
BOOL _keepUpdating { FALSE };
|
||||||
|
BOOL _retryLauncherInstall { FALSE };
|
||||||
ContinueActionOnStart _continueAction;
|
ContinueActionOnStart _continueAction;
|
||||||
float _progressOffset { 0.0f };
|
float _progressOffset { 0.0f };
|
||||||
float _progress { 0.0f };
|
float _progress { 0.0f };
|
||||||
|
|
|
@ -943,9 +943,6 @@ bool processRandomSwitchStateMachineNode(AnimNode::Pointer node, const QJsonObje
|
||||||
}
|
}
|
||||||
|
|
||||||
auto randomStatePtr = std::make_shared<AnimRandomSwitch::RandomSwitchState>(id, iter->second, interpTarget, interpDuration, interpTypeEnum, easingTypeEnum, priority, resume);
|
auto randomStatePtr = std::make_shared<AnimRandomSwitch::RandomSwitchState>(id, iter->second, interpTarget, interpDuration, interpTypeEnum, easingTypeEnum, priority, resume);
|
||||||
if (priority > 0.0f) {
|
|
||||||
smNode->addToPrioritySum(priority);
|
|
||||||
}
|
|
||||||
assert(randomStatePtr);
|
assert(randomStatePtr);
|
||||||
|
|
||||||
if (!interpTargetVar.isEmpty()) {
|
if (!interpTargetVar.isEmpty()) {
|
||||||
|
|
|
@ -27,22 +27,35 @@ const AnimPoseVec& AnimRandomSwitch::evaluate(const AnimVariantMap& animVars, co
|
||||||
AnimRandomSwitch::RandomSwitchState::Pointer desiredState = _currentState;
|
AnimRandomSwitch::RandomSwitchState::Pointer desiredState = _currentState;
|
||||||
if (abs(_randomSwitchEvaluationCount - context.getEvaluationCount()) > 1 || animVars.lookup(_triggerRandomSwitchVar, false)) {
|
if (abs(_randomSwitchEvaluationCount - context.getEvaluationCount()) > 1 || animVars.lookup(_triggerRandomSwitchVar, false)) {
|
||||||
|
|
||||||
// get a random number and decide which motion to choose.
|
// filter states different to the last random state and with priorities.
|
||||||
bool currentStateHasPriority = false;
|
bool currentStateHasPriority = false;
|
||||||
float dice = randFloatInRange(0.0f, 1.0f);
|
std::vector<RandomSwitchState::Pointer> randomStatesToConsider;
|
||||||
float lowerBound = 0.0f;
|
randomStatesToConsider.reserve(_randomStates.size());
|
||||||
for (const RandomSwitchState::Pointer& randState : _randomStates) {
|
float totalPriorities = 0.0f;
|
||||||
|
for (size_t i = 0; i < _randomStates.size(); i++) {
|
||||||
|
auto randState = _randomStates[i];
|
||||||
if (randState->getPriority() > 0.0f) {
|
if (randState->getPriority() > 0.0f) {
|
||||||
float upperBound = lowerBound + (randState->getPriority() / _totalPriorities);
|
bool isRepeatingClip = _children[randState->getChildIndex()]->getID() == _lastPlayedState;
|
||||||
if ((dice > lowerBound) && (dice < upperBound)) {
|
if (!isRepeatingClip) {
|
||||||
desiredState = randState;
|
randomStatesToConsider.push_back(randState);
|
||||||
|
totalPriorities += randState->getPriority();
|
||||||
}
|
}
|
||||||
lowerBound = upperBound;
|
|
||||||
|
|
||||||
// this indicates if the curent state is one that can be selected randomly, or is one that was transitioned to by the random duration timer.
|
// this indicates if the curent state is one that can be selected randomly, or is one that was transitioned to by the random duration timer.
|
||||||
currentStateHasPriority = currentStateHasPriority || (_currentState == randState);
|
currentStateHasPriority = currentStateHasPriority || (_currentState == randState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// get a random number and decide which motion to choose.
|
||||||
|
float dice = randFloatInRange(0.0f, 1.0f);
|
||||||
|
float lowerBound = 0.0f;
|
||||||
|
for (size_t i = 0; i < randomStatesToConsider.size(); i++) {
|
||||||
|
auto randState = randomStatesToConsider[i];
|
||||||
|
float upperBound = lowerBound + (randState->getPriority() / totalPriorities);
|
||||||
|
if ((dice > lowerBound) && (dice < upperBound)) {
|
||||||
|
desiredState = randState;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
lowerBound = upperBound;
|
||||||
|
}
|
||||||
if (abs(_randomSwitchEvaluationCount - context.getEvaluationCount()) > 1) {
|
if (abs(_randomSwitchEvaluationCount - context.getEvaluationCount()) > 1) {
|
||||||
_duringInterp = false;
|
_duringInterp = false;
|
||||||
switchRandomState(animVars, context, desiredState, _duringInterp);
|
switchRandomState(animVars, context, desiredState, _duringInterp);
|
||||||
|
@ -155,8 +168,8 @@ void AnimRandomSwitch::addState(RandomSwitchState::Pointer randomState) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnimRandomSwitch::switchRandomState(const AnimVariantMap& animVars, const AnimContext& context, RandomSwitchState::Pointer desiredState, bool shouldInterp) {
|
void AnimRandomSwitch::switchRandomState(const AnimVariantMap& animVars, const AnimContext& context, RandomSwitchState::Pointer desiredState, bool shouldInterp) {
|
||||||
|
|
||||||
auto nextStateNode = _children[desiredState->getChildIndex()];
|
auto nextStateNode = _children[desiredState->getChildIndex()];
|
||||||
|
_lastPlayedState = nextStateNode->getID();
|
||||||
if (shouldInterp) {
|
if (shouldInterp) {
|
||||||
|
|
||||||
const float FRAMES_PER_SECOND = 30.0f;
|
const float FRAMES_PER_SECOND = 30.0f;
|
||||||
|
|
|
@ -143,7 +143,6 @@ protected:
|
||||||
void setTransitionVar(const QString& transitionVar) { _transitionVar = transitionVar; }
|
void setTransitionVar(const QString& transitionVar) { _transitionVar = transitionVar; }
|
||||||
void setTriggerTimeMin(float triggerTimeMin) { _triggerTimeMin = triggerTimeMin; }
|
void setTriggerTimeMin(float triggerTimeMin) { _triggerTimeMin = triggerTimeMin; }
|
||||||
void setTriggerTimeMax(float triggerTimeMax) { _triggerTimeMax = triggerTimeMax; }
|
void setTriggerTimeMax(float triggerTimeMax) { _triggerTimeMax = triggerTimeMax; }
|
||||||
void addToPrioritySum(float priority) { _totalPriorities += priority; }
|
|
||||||
|
|
||||||
void addState(RandomSwitchState::Pointer randomState);
|
void addState(RandomSwitchState::Pointer randomState);
|
||||||
|
|
||||||
|
@ -164,7 +163,6 @@ protected:
|
||||||
float _alpha = 0.0f;
|
float _alpha = 0.0f;
|
||||||
AnimPoseVec _prevPoses;
|
AnimPoseVec _prevPoses;
|
||||||
AnimPoseVec _nextPoses;
|
AnimPoseVec _nextPoses;
|
||||||
float _totalPriorities { 0.0f };
|
|
||||||
|
|
||||||
RandomSwitchState::Pointer _currentState;
|
RandomSwitchState::Pointer _currentState;
|
||||||
RandomSwitchState::Pointer _previousState;
|
RandomSwitchState::Pointer _previousState;
|
||||||
|
@ -179,6 +177,7 @@ protected:
|
||||||
float _randomSwitchTimeMin { 10.0f };
|
float _randomSwitchTimeMin { 10.0f };
|
||||||
float _randomSwitchTimeMax { 20.0f };
|
float _randomSwitchTimeMax { 20.0f };
|
||||||
float _randomSwitchTime { 0.0f };
|
float _randomSwitchTime { 0.0f };
|
||||||
|
QString _lastPlayedState;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// no copies
|
// no copies
|
||||||
|
|
|
@ -170,27 +170,21 @@ static void channelDownmix(int16_t* source, int16_t* dest, int numSamples) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static float computeLoudness(int16_t* samples, int numSamples, int numChannels, bool& isClipping) {
|
static bool detectClipping(int16_t* samples, int numSamples, int numChannels) {
|
||||||
|
|
||||||
const int32_t CLIPPING_THRESHOLD = 32392; // -0.1 dBFS
|
const int32_t CLIPPING_THRESHOLD = 32392; // -0.1 dBFS
|
||||||
const int32_t CLIPPING_DETECTION = 3; // consecutive samples over threshold
|
const int CLIPPING_DETECTION = 3; // consecutive samples over threshold
|
||||||
|
|
||||||
float scale = numSamples ? 1.0f / numSamples : 0.0f;
|
bool isClipping = false;
|
||||||
|
|
||||||
int32_t loudness = 0;
|
|
||||||
isClipping = false;
|
|
||||||
|
|
||||||
if (numChannels == 2) {
|
if (numChannels == 2) {
|
||||||
int32_t oversLeft = 0;
|
int oversLeft = 0;
|
||||||
int32_t oversRight = 0;
|
int oversRight = 0;
|
||||||
|
|
||||||
for (int i = 0; i < numSamples/2; i++) {
|
for (int i = 0; i < numSamples/2; i++) {
|
||||||
int32_t left = std::abs((int32_t)samples[2*i+0]);
|
int32_t left = std::abs((int32_t)samples[2*i+0]);
|
||||||
int32_t right = std::abs((int32_t)samples[2*i+1]);
|
int32_t right = std::abs((int32_t)samples[2*i+1]);
|
||||||
|
|
||||||
loudness += left;
|
|
||||||
loudness += right;
|
|
||||||
|
|
||||||
if (left > CLIPPING_THRESHOLD) {
|
if (left > CLIPPING_THRESHOLD) {
|
||||||
isClipping |= (++oversLeft >= CLIPPING_DETECTION);
|
isClipping |= (++oversLeft >= CLIPPING_DETECTION);
|
||||||
} else {
|
} else {
|
||||||
|
@ -203,13 +197,11 @@ static float computeLoudness(int16_t* samples, int numSamples, int numChannels,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int32_t overs = 0;
|
int overs = 0;
|
||||||
|
|
||||||
for (int i = 0; i < numSamples; i++) {
|
for (int i = 0; i < numSamples; i++) {
|
||||||
int32_t sample = std::abs((int32_t)samples[i]);
|
int32_t sample = std::abs((int32_t)samples[i]);
|
||||||
|
|
||||||
loudness += sample;
|
|
||||||
|
|
||||||
if (sample > CLIPPING_THRESHOLD) {
|
if (sample > CLIPPING_THRESHOLD) {
|
||||||
isClipping |= (++overs >= CLIPPING_DETECTION);
|
isClipping |= (++overs >= CLIPPING_DETECTION);
|
||||||
} else {
|
} else {
|
||||||
|
@ -218,6 +210,17 @@ static float computeLoudness(int16_t* samples, int numSamples, int numChannels,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return isClipping;
|
||||||
|
}
|
||||||
|
|
||||||
|
static float computeLoudness(int16_t* samples, int numSamples) {
|
||||||
|
|
||||||
|
float scale = numSamples ? 1.0f / numSamples : 0.0f;
|
||||||
|
|
||||||
|
int32_t loudness = 0;
|
||||||
|
for (int i = 0; i < numSamples; i++) {
|
||||||
|
loudness += std::abs((int32_t)samples[i]);
|
||||||
|
}
|
||||||
return (float)loudness * scale;
|
return (float)loudness * scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1404,6 +1407,15 @@ void AudioClient::handleMicAudioInput() {
|
||||||
|
|
||||||
_inputRingBuffer.readSamples(inputAudioSamples.get(), inputSamplesRequired);
|
_inputRingBuffer.readSamples(inputAudioSamples.get(), inputSamplesRequired);
|
||||||
|
|
||||||
|
// detect clipping on the raw input
|
||||||
|
bool isClipping = detectClipping(inputAudioSamples.get(), inputSamplesRequired, _inputFormat.channelCount());
|
||||||
|
if (isClipping) {
|
||||||
|
_timeSinceLastClip = 0.0f;
|
||||||
|
} else if (_timeSinceLastClip >= 0.0f) {
|
||||||
|
_timeSinceLastClip += AudioConstants::NETWORK_FRAME_SECS;
|
||||||
|
}
|
||||||
|
isClipping = (_timeSinceLastClip >= 0.0f) && (_timeSinceLastClip < 2.0f); // 2 second hold time
|
||||||
|
|
||||||
#if defined(WEBRTC_ENABLED)
|
#if defined(WEBRTC_ENABLED)
|
||||||
if (_isAECEnabled) {
|
if (_isAECEnabled) {
|
||||||
processWebrtcNearEnd(inputAudioSamples.get(), inputSamplesRequired / _inputFormat.channelCount(),
|
processWebrtcNearEnd(inputAudioSamples.get(), inputSamplesRequired / _inputFormat.channelCount(),
|
||||||
|
@ -1411,9 +1423,7 @@ void AudioClient::handleMicAudioInput() {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// detect loudness and clipping on the raw input
|
float loudness = computeLoudness(inputAudioSamples.get(), inputSamplesRequired);
|
||||||
bool isClipping = false;
|
|
||||||
float loudness = computeLoudness(inputAudioSamples.get(), inputSamplesRequired, _inputFormat.channelCount(), isClipping);
|
|
||||||
_lastRawInputLoudness = loudness;
|
_lastRawInputLoudness = loudness;
|
||||||
|
|
||||||
// envelope detection
|
// envelope detection
|
||||||
|
@ -1421,14 +1431,6 @@ void AudioClient::handleMicAudioInput() {
|
||||||
loudness += tc * (_lastSmoothedRawInputLoudness - loudness);
|
loudness += tc * (_lastSmoothedRawInputLoudness - loudness);
|
||||||
_lastSmoothedRawInputLoudness = loudness;
|
_lastSmoothedRawInputLoudness = loudness;
|
||||||
|
|
||||||
// clipping indicator
|
|
||||||
if (isClipping) {
|
|
||||||
_timeSinceLastClip = 0.0f;
|
|
||||||
} else if (_timeSinceLastClip >= 0.0f) {
|
|
||||||
_timeSinceLastClip += AudioConstants::NETWORK_FRAME_SECS;
|
|
||||||
}
|
|
||||||
isClipping = (_timeSinceLastClip >= 0.0f) && (_timeSinceLastClip < 2.0f); // 2 second hold time
|
|
||||||
|
|
||||||
emit inputLoudnessChanged(_lastSmoothedRawInputLoudness, isClipping);
|
emit inputLoudnessChanged(_lastSmoothedRawInputLoudness, isClipping);
|
||||||
|
|
||||||
if (!_muted) {
|
if (!_muted) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// Created by Sabrina Shanman 9/5/2018
|
// Created by Sabrina Shanman 2018/09/05
|
||||||
// Copyright 2018 High Fidelity, Inc.
|
// Copyright 2018 High Fidelity, Inc.
|
||||||
//
|
//
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
@ -10,4 +10,4 @@
|
||||||
template<>
|
template<>
|
||||||
glm::vec3 BaseNestableTransformNode<Avatar>::getActualScale(const std::shared_ptr<Avatar>& nestablePointer) const {
|
glm::vec3 BaseNestableTransformNode<Avatar>::getActualScale(const std::shared_ptr<Avatar>& nestablePointer) const {
|
||||||
return nestablePointer->scaleForChildren();
|
return nestablePointer->scaleForChildren();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// Created by Sabrina Shanman 9/5/2018
|
// Created by Sabrina Shanman 2018/09/05
|
||||||
// Copyright 2018 High Fidelity, Inc.
|
// Copyright 2018 High Fidelity, Inc.
|
||||||
//
|
//
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
@ -17,4 +17,4 @@ public:
|
||||||
AvatarTransformNode(std::weak_ptr<Avatar> spatiallyNestable, int jointIndex) : BaseNestableTransformNode(spatiallyNestable, jointIndex) {};
|
AvatarTransformNode(std::weak_ptr<Avatar> spatiallyNestable, int jointIndex) : BaseNestableTransformNode(spatiallyNestable, jointIndex) {};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_AvatarTransformNode_h
|
#endif // hifi_AvatarTransformNode_h
|
||||||
|
|
|
@ -1027,6 +1027,10 @@ void EntityTreeRenderer::addingEntity(const EntityItemID& entityID) {
|
||||||
|
|
||||||
void EntityTreeRenderer::entityScriptChanging(const EntityItemID& entityID, bool reload) {
|
void EntityTreeRenderer::entityScriptChanging(const EntityItemID& entityID, bool reload) {
|
||||||
checkAndCallPreload(entityID, reload, true);
|
checkAndCallPreload(entityID, reload, true);
|
||||||
|
// Force "re-checking" entities so that the logic inside `checkEnterLeaveEntities()` is run.
|
||||||
|
// This will ensure that the `enterEntity()` signal is emitted on clients whose avatars
|
||||||
|
// are inside an entity when the script is reloaded.
|
||||||
|
forceRecheckEntities();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityTreeRenderer::checkAndCallPreload(const EntityItemID& entityID, bool reload, bool unloadFirst) {
|
void EntityTreeRenderer::checkAndCallPreload(const EntityItemID& entityID, bool reload, bool unloadFirst) {
|
||||||
|
|
|
@ -297,10 +297,6 @@ MeshPointer GraphicsScriptingInterface::getMeshPointer(scriptable::ScriptableMes
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
QVector<int> metaTypeIds{
|
QVector<int> metaTypeIds{
|
||||||
qRegisterMetaType<glm::uint32>("uint32"),
|
|
||||||
qRegisterMetaType<glm::uint32>("glm::uint32"),
|
|
||||||
qRegisterMetaType<QVector<glm::uint32>>(),
|
|
||||||
qRegisterMetaType<QVector<glm::uint32>>("QVector<uint32>"),
|
|
||||||
qRegisterMetaType<scriptable::ScriptableMeshes>(),
|
qRegisterMetaType<scriptable::ScriptableMeshes>(),
|
||||||
qRegisterMetaType<scriptable::ScriptableMeshes>("ScriptableMeshes"),
|
qRegisterMetaType<scriptable::ScriptableMeshes>("ScriptableMeshes"),
|
||||||
qRegisterMetaType<scriptable::ScriptableMeshes>("scriptable::ScriptableMeshes"),
|
qRegisterMetaType<scriptable::ScriptableMeshes>("scriptable::ScriptableMeshes"),
|
||||||
|
@ -532,7 +528,6 @@ namespace scriptable {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphicsScriptingInterface::registerMetaTypes(QScriptEngine* engine) {
|
void GraphicsScriptingInterface::registerMetaTypes(QScriptEngine* engine) {
|
||||||
qScriptRegisterSequenceMetaType<QVector<glm::uint32>>(engine);
|
|
||||||
qScriptRegisterSequenceMetaType<QVector<scriptable::ScriptableMaterialLayer>>(engine);
|
qScriptRegisterSequenceMetaType<QVector<scriptable::ScriptableMaterialLayer>>(engine);
|
||||||
|
|
||||||
scriptable::registerQPointerMetaType<scriptable::ScriptableModel>(engine);
|
scriptable::registerQPointerMetaType<scriptable::ScriptableModel>(engine);
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
#include "ScriptableMesh.h"
|
#include "ScriptableMesh.h"
|
||||||
#include <DependencyManager.h>
|
#include <DependencyManager.h>
|
||||||
|
#include "RegisteredMetaTypes.h"
|
||||||
|
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
|
@ -107,8 +108,6 @@ namespace scriptable {
|
||||||
QScriptValue scriptableMaterialToScriptValue(QScriptEngine* engine, const scriptable::ScriptableMaterial &material);
|
QScriptValue scriptableMaterialToScriptValue(QScriptEngine* engine, const scriptable::ScriptableMaterial &material);
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(glm::uint32)
|
|
||||||
Q_DECLARE_METATYPE(QVector<glm::uint32>)
|
|
||||||
Q_DECLARE_METATYPE(NestableType)
|
Q_DECLARE_METATYPE(NestableType)
|
||||||
|
|
||||||
#endif // hifi_GraphicsScriptingInterface_h
|
#endif // hifi_GraphicsScriptingInterface_h
|
||||||
|
|
|
@ -83,6 +83,7 @@ public:
|
||||||
|
|
||||||
bool isPartOfMessage() const { return _isPartOfMessage; }
|
bool isPartOfMessage() const { return _isPartOfMessage; }
|
||||||
bool isReliable() const { return _isReliable; }
|
bool isReliable() const { return _isReliable; }
|
||||||
|
void setReliable(bool reliable) { _isReliable = reliable; }
|
||||||
|
|
||||||
ObfuscationLevel getObfuscationLevel() const { return _obfuscationLevel; }
|
ObfuscationLevel getObfuscationLevel() const { return _obfuscationLevel; }
|
||||||
SequenceNumber getSequenceNumber() const { return _sequenceNumber; }
|
SequenceNumber getSequenceNumber() const { return _sequenceNumber; }
|
||||||
|
|
|
@ -82,7 +82,7 @@ bool OctreeQueryNode::shouldSuppressDuplicatePacket() {
|
||||||
void OctreeQueryNode::init() {
|
void OctreeQueryNode::init() {
|
||||||
_myPacketType = getMyPacketType();
|
_myPacketType = getMyPacketType();
|
||||||
|
|
||||||
_octreePacket = NLPacket::create(getMyPacketType());
|
_octreePacket = NLPacket::create(getMyPacketType(), -1, true);
|
||||||
|
|
||||||
resetOctreePacket(); // don't bump sequence
|
resetOctreePacket(); // don't bump sequence
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,7 +169,7 @@ private:
|
||||||
|
|
||||||
bool _isReadyToSend;
|
bool _isReadyToSend;
|
||||||
|
|
||||||
std::unique_ptr<NLPacket> _statsPacket = NLPacket::create(PacketType::OctreeStats);
|
std::unique_ptr<NLPacket> _statsPacket = NLPacket::create(PacketType::OctreeStats, -1, true);
|
||||||
|
|
||||||
// scene timing data in usecs
|
// scene timing data in usecs
|
||||||
bool _isStarted;
|
bool _isStarted;
|
||||||
|
|
|
@ -56,6 +56,14 @@ QVector<QUuid> PickQuery::getIgnoreItems() const {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PickQuery::setScriptParameters(const QVariantMap& parameters) {
|
||||||
|
_scriptParameters = parameters;
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariantMap PickQuery::getScriptParameters() const {
|
||||||
|
return _scriptParameters;
|
||||||
|
}
|
||||||
|
|
||||||
QVector<QUuid> PickQuery::getIncludeItems() const {
|
QVector<QUuid> PickQuery::getIncludeItems() const {
|
||||||
return resultWithReadLock<QVector<QUuid>>([&] {
|
return resultWithReadLock<QVector<QUuid>>([&] {
|
||||||
return _includeItems;
|
return _includeItems;
|
||||||
|
|
|
@ -117,7 +117,8 @@ public:
|
||||||
Stylus,
|
Stylus,
|
||||||
Parabola,
|
Parabola,
|
||||||
Collision,
|
Collision,
|
||||||
NUM_PICK_TYPES
|
NUM_PICK_TYPES,
|
||||||
|
INVALID_PICK_TYPE = -1
|
||||||
};
|
};
|
||||||
Q_ENUM(PickType)
|
Q_ENUM(PickType)
|
||||||
|
|
||||||
|
@ -134,6 +135,7 @@ public:
|
||||||
PickFilter getFilter() const;
|
PickFilter getFilter() const;
|
||||||
float getMaxDistance() const;
|
float getMaxDistance() const;
|
||||||
bool isEnabled() const;
|
bool isEnabled() const;
|
||||||
|
virtual PickType getType() const = 0;
|
||||||
|
|
||||||
void setPrecisionPicking(bool precisionPicking);
|
void setPrecisionPicking(bool precisionPicking);
|
||||||
|
|
||||||
|
@ -168,6 +170,27 @@ public:
|
||||||
void setIgnoreItems(const QVector<QUuid>& items);
|
void setIgnoreItems(const QVector<QUuid>& items);
|
||||||
void setIncludeItems(const QVector<QUuid>& items);
|
void setIncludeItems(const QVector<QUuid>& items);
|
||||||
|
|
||||||
|
virtual QVariantMap toVariantMap() const {
|
||||||
|
QVariantMap properties;
|
||||||
|
|
||||||
|
properties["pickType"] = (int)getType();
|
||||||
|
properties["enabled"] = isEnabled();
|
||||||
|
properties["filter"] = (unsigned int)getFilter()._flags.to_ulong();
|
||||||
|
properties["maxDistance"] = getMaxDistance();
|
||||||
|
|
||||||
|
if (parentTransform) {
|
||||||
|
auto transformNodeProperties = parentTransform->toVariantMap();
|
||||||
|
for (auto it = transformNodeProperties.cbegin(); it != transformNodeProperties.cend(); ++it) {
|
||||||
|
properties[it.key()] = it.value();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setScriptParameters(const QVariantMap& parameters);
|
||||||
|
QVariantMap getScriptParameters() const;
|
||||||
|
|
||||||
virtual bool isLeftHand() const { return _jointState == JOINT_STATE_LEFT_HAND; }
|
virtual bool isLeftHand() const { return _jointState == JOINT_STATE_LEFT_HAND; }
|
||||||
virtual bool isRightHand() const { return _jointState == JOINT_STATE_RIGHT_HAND; }
|
virtual bool isRightHand() const { return _jointState == JOINT_STATE_RIGHT_HAND; }
|
||||||
virtual bool isMouse() const { return _jointState == JOINT_STATE_MOUSE; }
|
virtual bool isMouse() const { return _jointState == JOINT_STATE_MOUSE; }
|
||||||
|
@ -187,6 +210,9 @@ private:
|
||||||
QVector<QUuid> _ignoreItems;
|
QVector<QUuid> _ignoreItems;
|
||||||
QVector<QUuid> _includeItems;
|
QVector<QUuid> _includeItems;
|
||||||
|
|
||||||
|
// The parameters used to create this pick when created through a script
|
||||||
|
QVariantMap _scriptParameters;
|
||||||
|
|
||||||
JointState _jointState { JOINT_STATE_NONE };
|
JointState _jointState { JOINT_STATE_NONE };
|
||||||
};
|
};
|
||||||
Q_DECLARE_METATYPE(PickQuery::PickType)
|
Q_DECLARE_METATYPE(PickQuery::PickType)
|
||||||
|
@ -202,6 +228,17 @@ public:
|
||||||
virtual PickResultPointer getAvatarIntersection(const T& pick) = 0;
|
virtual PickResultPointer getAvatarIntersection(const T& pick) = 0;
|
||||||
virtual PickResultPointer getHUDIntersection(const T& pick) = 0;
|
virtual PickResultPointer getHUDIntersection(const T& pick) = 0;
|
||||||
|
|
||||||
|
QVariantMap toVariantMap() const override {
|
||||||
|
QVariantMap properties = PickQuery::toVariantMap();
|
||||||
|
|
||||||
|
const QVariantMap mathPickProperties = _mathPick.toVariantMap();
|
||||||
|
for (auto it = mathPickProperties.cbegin(); it != mathPickProperties.cend(); ++it) {
|
||||||
|
properties[it.key()] = it.value();
|
||||||
|
}
|
||||||
|
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
T _mathPick;
|
T _mathPick;
|
||||||
};
|
};
|
||||||
|
|
|
@ -49,6 +49,35 @@ void PickManager::removePick(unsigned int uid) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVariantMap PickManager::getPickProperties(unsigned int uid) const {
|
||||||
|
auto pick = findPick(uid);
|
||||||
|
if (pick) {
|
||||||
|
return pick->toVariantMap();
|
||||||
|
}
|
||||||
|
return QVariantMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariantMap PickManager::getPickScriptParameters(unsigned int uid) const {
|
||||||
|
auto pick = findPick(uid);
|
||||||
|
if (pick) {
|
||||||
|
return pick->getScriptParameters();
|
||||||
|
}
|
||||||
|
return QVariantMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
QVector<unsigned int> PickManager::getPicks() const {
|
||||||
|
QVector<unsigned int> picks;
|
||||||
|
withReadLock([&] {
|
||||||
|
for (auto typeIt = _picks.cbegin(); typeIt != _picks.cend(); ++typeIt) {
|
||||||
|
auto& picksForType = typeIt->second;
|
||||||
|
for (auto pickIt = picksForType.cbegin(); pickIt != picksForType.cend(); ++pickIt) {
|
||||||
|
picks.push_back(pickIt->first);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return picks;
|
||||||
|
}
|
||||||
|
|
||||||
PickResultPointer PickManager::getPrevPickResult(unsigned int uid) const {
|
PickResultPointer PickManager::getPrevPickResult(unsigned int uid) const {
|
||||||
auto pick = findPick(uid);
|
auto pick = findPick(uid);
|
||||||
if (pick) {
|
if (pick) {
|
||||||
|
@ -71,6 +100,14 @@ void PickManager::disablePick(unsigned int uid) const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PickManager::isPickEnabled(unsigned int uid) const {
|
||||||
|
auto pick = findPick(uid);
|
||||||
|
if (pick) {
|
||||||
|
return pick->isEnabled();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void PickManager::setPrecisionPicking(unsigned int uid, bool precisionPicking) const {
|
void PickManager::setPrecisionPicking(unsigned int uid, bool precisionPicking) const {
|
||||||
auto pick = findPick(uid);
|
auto pick = findPick(uid);
|
||||||
if (pick) {
|
if (pick) {
|
||||||
|
|
|
@ -31,8 +31,14 @@ public:
|
||||||
void removePick(unsigned int uid);
|
void removePick(unsigned int uid);
|
||||||
void enablePick(unsigned int uid) const;
|
void enablePick(unsigned int uid) const;
|
||||||
void disablePick(unsigned int uid) const;
|
void disablePick(unsigned int uid) const;
|
||||||
|
bool isPickEnabled(unsigned int uid) const;
|
||||||
|
QVector<unsigned int> getPicks() const;
|
||||||
|
|
||||||
PickResultPointer getPrevPickResult(unsigned int uid) const;
|
PickResultPointer getPrevPickResult(unsigned int uid) const;
|
||||||
|
// The actual current properties of the pick
|
||||||
|
QVariantMap getPickProperties(unsigned int uid) const;
|
||||||
|
// The properties that were passed in to create the pick (may be empty if the pick was created by invoking the constructor)
|
||||||
|
QVariantMap getPickScriptParameters(unsigned int uid) const;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
std::shared_ptr<T> getPrevPickResultTyped(unsigned int uid) const {
|
std::shared_ptr<T> getPrevPickResultTyped(unsigned int uid) const {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// Created by Sabrina Shanman 8/22/2018
|
// Created by Sabrina Shanman 2018/08/22
|
||||||
// Copyright 2018 High Fidelity, Inc.
|
// Copyright 2018 High Fidelity, Inc.
|
||||||
//
|
//
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
@ -23,4 +23,10 @@ Transform PickTransformNode::getTransform() {
|
||||||
}
|
}
|
||||||
|
|
||||||
return pickManager->getResultTransform(_uid);
|
return pickManager->getResultTransform(_uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVariantMap PickTransformNode::toVariantMap() const {
|
||||||
|
QVariantMap map;
|
||||||
|
map["parentID"] = _uid;
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// Created by Sabrina Shanman 8/22/2018
|
// Created by Sabrina Shanman 2018/08/22
|
||||||
// Copyright 2018 High Fidelity, Inc.
|
// Copyright 2018 High Fidelity, Inc.
|
||||||
//
|
//
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
@ -15,9 +15,10 @@ class PickTransformNode : public TransformNode {
|
||||||
public:
|
public:
|
||||||
PickTransformNode(unsigned int uid);
|
PickTransformNode(unsigned int uid);
|
||||||
Transform getTransform() override;
|
Transform getTransform() override;
|
||||||
|
QVariantMap toVariantMap() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
unsigned int _uid;
|
unsigned int _uid;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_PickTransformNode_h
|
#endif // hifi_PickTransformNode_h
|
||||||
|
|
|
@ -36,10 +36,32 @@ void Pointer::disable() {
|
||||||
DependencyManager::get<PickManager>()->disablePick(_pickUID);
|
DependencyManager::get<PickManager>()->disablePick(_pickUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Pointer::isEnabled() {
|
||||||
|
return _enabled;
|
||||||
|
}
|
||||||
|
|
||||||
PickResultPointer Pointer::getPrevPickResult() {
|
PickResultPointer Pointer::getPrevPickResult() {
|
||||||
return DependencyManager::get<PickManager>()->getPrevPickResult(_pickUID);
|
return DependencyManager::get<PickManager>()->getPrevPickResult(_pickUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVariantMap Pointer::toVariantMap() const {
|
||||||
|
QVariantMap qVariantMap = DependencyManager::get<PickManager>()->getPickProperties(_pickUID);
|
||||||
|
|
||||||
|
qVariantMap["pointerType"] = getType();
|
||||||
|
qVariantMap["pickID"] = _pickUID;
|
||||||
|
qVariantMap["hover"] = _hover;
|
||||||
|
|
||||||
|
return qVariantMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Pointer::setScriptParameters(const QVariantMap& scriptParameters) {
|
||||||
|
_scriptParameters = scriptParameters;
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariantMap Pointer::getScriptParameters() const {
|
||||||
|
return _scriptParameters;
|
||||||
|
}
|
||||||
|
|
||||||
void Pointer::setPrecisionPicking(bool precisionPicking) {
|
void Pointer::setPrecisionPicking(bool precisionPicking) {
|
||||||
DependencyManager::get<PickManager>()->setPrecisionPicking(_pickUID, precisionPicking);
|
DependencyManager::get<PickManager>()->setPrecisionPicking(_pickUID, precisionPicking);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,12 +45,16 @@ public:
|
||||||
|
|
||||||
virtual void enable();
|
virtual void enable();
|
||||||
virtual void disable();
|
virtual void disable();
|
||||||
|
virtual bool isEnabled();
|
||||||
|
virtual PickQuery::PickType getType() const = 0;
|
||||||
virtual PickResultPointer getPrevPickResult();
|
virtual PickResultPointer getPrevPickResult();
|
||||||
|
|
||||||
virtual void setRenderState(const std::string& state) = 0;
|
virtual void setRenderState(const std::string& state) = 0;
|
||||||
virtual void editRenderState(const std::string& state, const QVariant& startProps, const QVariant& pathProps, const QVariant& endProps) = 0;
|
virtual void editRenderState(const std::string& state, const QVariant& startProps, const QVariant& pathProps, const QVariant& endProps) = 0;
|
||||||
|
|
||||||
virtual QVariantMap toVariantMap() const = 0;
|
virtual QVariantMap toVariantMap() const;
|
||||||
|
virtual void setScriptParameters(const QVariantMap& scriptParameters);
|
||||||
|
virtual QVariantMap getScriptParameters() const;
|
||||||
|
|
||||||
virtual void setPrecisionPicking(bool precisionPicking);
|
virtual void setPrecisionPicking(bool precisionPicking);
|
||||||
virtual void setIgnoreItems(const QVector<QUuid>& ignoreItems) const;
|
virtual void setIgnoreItems(const QVector<QUuid>& ignoreItems) const;
|
||||||
|
@ -84,6 +88,9 @@ protected:
|
||||||
bool _enabled;
|
bool _enabled;
|
||||||
bool _hover;
|
bool _hover;
|
||||||
|
|
||||||
|
// The parameters used to create this pointer when created through a script
|
||||||
|
QVariantMap _scriptParameters;
|
||||||
|
|
||||||
virtual PointerEvent buildPointerEvent(const PickedObject& target, const PickResultPointer& pickResult, const std::string& button = "", bool hover = true) = 0;
|
virtual PointerEvent buildPointerEvent(const PickedObject& target, const PickResultPointer& pickResult, const std::string& button = "", bool hover = true) = 0;
|
||||||
|
|
||||||
virtual PickedObject getHoveredObject(const PickResultPointer& pickResult) = 0;
|
virtual PickedObject getHoveredObject(const PickResultPointer& pickResult) = 0;
|
||||||
|
|
|
@ -54,6 +54,24 @@ void PointerManager::disablePointer(unsigned int uid) const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PointerManager::isPointerEnabled(unsigned int uid) const {
|
||||||
|
auto pointer = find(uid);
|
||||||
|
if (pointer) {
|
||||||
|
return pointer->isEnabled();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QVector<unsigned int> PointerManager::getPointers() const {
|
||||||
|
QVector<unsigned int> pointers;
|
||||||
|
withReadLock([&] {
|
||||||
|
for (auto it = _pointers.cbegin(); it != _pointers.cend(); ++it) {
|
||||||
|
pointers.push_back(it->first);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return pointers;
|
||||||
|
}
|
||||||
|
|
||||||
void PointerManager::setRenderState(unsigned int uid, const std::string& renderState) const {
|
void PointerManager::setRenderState(unsigned int uid, const std::string& renderState) const {
|
||||||
auto pointer = find(uid);
|
auto pointer = find(uid);
|
||||||
if (pointer) {
|
if (pointer) {
|
||||||
|
@ -86,6 +104,14 @@ QVariantMap PointerManager::getPointerProperties(unsigned int uid) const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVariantMap PointerManager::getPointerScriptParameters(unsigned int uid) const {
|
||||||
|
auto pointer = find(uid);
|
||||||
|
if (pointer) {
|
||||||
|
return pointer->getScriptParameters();
|
||||||
|
}
|
||||||
|
return QVariantMap();
|
||||||
|
}
|
||||||
|
|
||||||
void PointerManager::update() {
|
void PointerManager::update() {
|
||||||
auto cachedPointers = resultWithReadLock<std::unordered_map<unsigned int, std::shared_ptr<Pointer>>>([&] {
|
auto cachedPointers = resultWithReadLock<std::unordered_map<unsigned int, std::shared_ptr<Pointer>>>([&] {
|
||||||
return _pointers;
|
return _pointers;
|
||||||
|
|
|
@ -27,10 +27,17 @@ public:
|
||||||
void removePointer(unsigned int uid);
|
void removePointer(unsigned int uid);
|
||||||
void enablePointer(unsigned int uid) const;
|
void enablePointer(unsigned int uid) const;
|
||||||
void disablePointer(unsigned int uid) const;
|
void disablePointer(unsigned int uid) const;
|
||||||
|
bool isPointerEnabled(unsigned int uid) const;
|
||||||
|
QVector<unsigned int> getPointers() const;
|
||||||
|
|
||||||
void setRenderState(unsigned int uid, const std::string& renderState) const;
|
void setRenderState(unsigned int uid, const std::string& renderState) const;
|
||||||
void editRenderState(unsigned int uid, const std::string& state, const QVariant& startProps, const QVariant& pathProps, const QVariant& endProps) const;
|
void editRenderState(unsigned int uid, const std::string& state, const QVariant& startProps, const QVariant& pathProps, const QVariant& endProps) const;
|
||||||
|
|
||||||
PickResultPointer getPrevPickResult(unsigned int uid) const;
|
PickResultPointer getPrevPickResult(unsigned int uid) const;
|
||||||
|
// The actual current properties of the pointer
|
||||||
QVariantMap getPointerProperties(unsigned int uid) const;
|
QVariantMap getPointerProperties(unsigned int uid) const;
|
||||||
|
// The properties that were passed in to create the pointer (may be empty if the pointer was created by invoking the constructor)
|
||||||
|
QVariantMap getPointerScriptParameters(unsigned int uid) const;
|
||||||
|
|
||||||
void setPrecisionPicking(unsigned int uid, bool precisionPicking) const;
|
void setPrecisionPicking(unsigned int uid, bool precisionPicking) const;
|
||||||
void setIgnoreItems(unsigned int uid, const QVector<QUuid>& ignoreEntities) const;
|
void setIgnoreItems(unsigned int uid, const QVector<QUuid>& ignoreEntities) const;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// Created by Sabrina Shanman 8/14/2018
|
// Created by Sabrina Shanman 2018/08/14
|
||||||
// Copyright 2018 High Fidelity, Inc.
|
// Copyright 2018 High Fidelity, Inc.
|
||||||
//
|
//
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
@ -11,4 +11,4 @@
|
||||||
template<>
|
template<>
|
||||||
glm::vec3 BaseNestableTransformNode<SpatiallyNestable>::getActualScale(const std::shared_ptr<SpatiallyNestable>& nestablePointer) const {
|
glm::vec3 BaseNestableTransformNode<SpatiallyNestable>::getActualScale(const std::shared_ptr<SpatiallyNestable>& nestablePointer) const {
|
||||||
return nestablePointer->getAbsoluteJointScaleInObjectFrame(_jointIndex);
|
return nestablePointer->getAbsoluteJointScaleInObjectFrame(_jointIndex);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// Created by Sabrina Shanman 8/14/2018
|
// Created by Sabrina Shanman 2018/08/14
|
||||||
// Copyright 2018 High Fidelity, Inc.
|
// Copyright 2018 High Fidelity, Inc.
|
||||||
//
|
//
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
@ -12,6 +12,8 @@
|
||||||
|
|
||||||
#include "SpatiallyNestable.h"
|
#include "SpatiallyNestable.h"
|
||||||
|
|
||||||
|
#include "RegisteredMetaTypes.h"
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class BaseNestableTransformNode : public TransformNode {
|
class BaseNestableTransformNode : public TransformNode {
|
||||||
public:
|
public:
|
||||||
|
@ -45,6 +47,19 @@ public:
|
||||||
return jointWorldTransform;
|
return jointWorldTransform;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVariantMap toVariantMap() const override {
|
||||||
|
QVariantMap map;
|
||||||
|
|
||||||
|
auto nestable = _spatiallyNestable.lock();
|
||||||
|
if (nestable) {
|
||||||
|
map["parentID"] = nestable->getID();
|
||||||
|
map["parentJointIndex"] = _jointIndex;
|
||||||
|
map["baseParentScale"] = vec3toVariant(_baseScale);
|
||||||
|
}
|
||||||
|
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
glm::vec3 getActualScale(const std::shared_ptr<T>& nestablePointer) const;
|
glm::vec3 getActualScale(const std::shared_ptr<T>& nestablePointer) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
#include <QtScript/QScriptValueIterator>
|
#include <QtScript/QScriptValueIterator>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
|
|
||||||
|
int uint32MetaTypeId = qRegisterMetaType<glm::uint32>("uint32");
|
||||||
|
int glmUint32MetaTypeId = qRegisterMetaType<glm::uint32>("glm::uint32");
|
||||||
int vec2MetaTypeId = qRegisterMetaType<glm::vec2>();
|
int vec2MetaTypeId = qRegisterMetaType<glm::vec2>();
|
||||||
int u8vec3MetaTypeId = qRegisterMetaType<u8vec3>();
|
int u8vec3MetaTypeId = qRegisterMetaType<u8vec3>();
|
||||||
int vec3MetaTypeId = qRegisterMetaType<glm::vec3>();
|
int vec3MetaTypeId = qRegisterMetaType<glm::vec3>();
|
||||||
|
@ -33,6 +35,7 @@ int vec4MetaTypeId = qRegisterMetaType<glm::vec4>();
|
||||||
int qVectorVec3MetaTypeId = qRegisterMetaType<QVector<glm::vec3>>();
|
int qVectorVec3MetaTypeId = qRegisterMetaType<QVector<glm::vec3>>();
|
||||||
int qVectorQuatMetaTypeId = qRegisterMetaType<QVector<glm::quat>>();
|
int qVectorQuatMetaTypeId = qRegisterMetaType<QVector<glm::quat>>();
|
||||||
int qVectorBoolMetaTypeId = qRegisterMetaType<QVector<bool>>();
|
int qVectorBoolMetaTypeId = qRegisterMetaType<QVector<bool>>();
|
||||||
|
int qVectorGLMUint32MetaTypeId = qRegisterMetaType<QVector<unsigned int>>("QVector<glm::uint32>");
|
||||||
int quatMetaTypeId = qRegisterMetaType<glm::quat>();
|
int quatMetaTypeId = qRegisterMetaType<glm::quat>();
|
||||||
int pickRayMetaTypeId = qRegisterMetaType<PickRay>();
|
int pickRayMetaTypeId = qRegisterMetaType<PickRay>();
|
||||||
int collisionMetaTypeId = qRegisterMetaType<Collision>();
|
int collisionMetaTypeId = qRegisterMetaType<Collision>();
|
||||||
|
@ -67,6 +70,8 @@ void registerMetaTypes(QScriptEngine* engine) {
|
||||||
qScriptRegisterMetaType(engine, aaCubeToScriptValue, aaCubeFromScriptValue);
|
qScriptRegisterMetaType(engine, aaCubeToScriptValue, aaCubeFromScriptValue);
|
||||||
|
|
||||||
qScriptRegisterMetaType(engine, stencilMaskModeToScriptValue, stencilMaskModeFromScriptValue);
|
qScriptRegisterMetaType(engine, stencilMaskModeToScriptValue, stencilMaskModeFromScriptValue);
|
||||||
|
|
||||||
|
qScriptRegisterSequenceMetaType<QVector<unsigned int>>(engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
QScriptValue vec2ToScriptValue(QScriptEngine* engine, const glm::vec2& vec2) {
|
QScriptValue vec2ToScriptValue(QScriptEngine* engine, const glm::vec2& vec2) {
|
||||||
|
|
|
@ -37,6 +37,8 @@ Q_DECLARE_METATYPE(glm::vec4)
|
||||||
Q_DECLARE_METATYPE(glm::quat)
|
Q_DECLARE_METATYPE(glm::quat)
|
||||||
Q_DECLARE_METATYPE(glm::mat4)
|
Q_DECLARE_METATYPE(glm::mat4)
|
||||||
Q_DECLARE_METATYPE(QVector<float>)
|
Q_DECLARE_METATYPE(QVector<float>)
|
||||||
|
Q_DECLARE_METATYPE(unsigned int)
|
||||||
|
Q_DECLARE_METATYPE(QVector<unsigned int>)
|
||||||
Q_DECLARE_METATYPE(AACube)
|
Q_DECLARE_METATYPE(AACube)
|
||||||
Q_DECLARE_METATYPE(std::function<void()>);
|
Q_DECLARE_METATYPE(std::function<void()>);
|
||||||
Q_DECLARE_METATYPE(std::function<QVariant()>);
|
Q_DECLARE_METATYPE(std::function<QVariant()>);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// Created by Sabrina Shanman 8/14/2018
|
// Created by Sabrina Shanman 2018/08/14
|
||||||
// Copyright 2018 High Fidelity, Inc.
|
// Copyright 2018 High Fidelity, Inc.
|
||||||
//
|
//
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
@ -8,6 +8,8 @@
|
||||||
#ifndef hifi_TransformNode_h
|
#ifndef hifi_TransformNode_h
|
||||||
#define hifi_TransformNode_h
|
#define hifi_TransformNode_h
|
||||||
|
|
||||||
|
#include <QVariant>
|
||||||
|
|
||||||
#include "Transform.h"
|
#include "Transform.h"
|
||||||
|
|
||||||
class TransformNode {
|
class TransformNode {
|
||||||
|
@ -15,6 +17,7 @@ public:
|
||||||
virtual ~TransformNode() = default;
|
virtual ~TransformNode() = default;
|
||||||
|
|
||||||
virtual Transform getTransform() = 0;
|
virtual Transform getTransform() = 0;
|
||||||
|
virtual QVariantMap toVariantMap() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_TransformNode_h
|
#endif // hifi_TransformNode_h
|
||||||
|
|
Loading…
Reference in a new issue