diff --git a/interface/src/raypick/LaserPointer.cpp b/interface/src/raypick/LaserPointer.cpp index 8249874d33..b97c9b89cb 100644 --- a/interface/src/raypick/LaserPointer.cpp +++ b/interface/src/raypick/LaserPointer.cpp @@ -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) { auto renderState = std::static_pointer_cast(_renderStates[state]); if (renderState) { diff --git a/interface/src/raypick/LaserPointer.h b/interface/src/raypick/LaserPointer.h index 13d108baee..330449a52d 100644 --- a/interface/src/raypick/LaserPointer.h +++ b/interface/src/raypick/LaserPointer.h @@ -42,6 +42,8 @@ public: 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); + PickQuery::PickType getType() const override; + QVariantMap toVariantMap() const override; static std::shared_ptr buildRenderState(const QVariantMap& propMap); diff --git a/interface/src/raypick/ParabolaPointer.cpp b/interface/src/raypick/ParabolaPointer.cpp index f13cc19b9d..8ffd75008f 100644 --- a/interface/src/raypick/ParabolaPointer.cpp +++ b/interface/src/raypick/ParabolaPointer.cpp @@ -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 { auto parabolaPickResult = std::dynamic_pointer_cast(pickResult); if (!parabolaPickResult) { diff --git a/interface/src/raypick/ParabolaPointer.h b/interface/src/raypick/ParabolaPointer.h index 94470971e6..85d09adbdb 100644 --- a/interface/src/raypick/ParabolaPointer.h +++ b/interface/src/raypick/ParabolaPointer.h @@ -101,6 +101,8 @@ public: 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); + PickQuery::PickType getType() const override; + QVariantMap toVariantMap() const override; static std::shared_ptr buildRenderState(const QVariantMap& propMap); diff --git a/interface/src/raypick/PickScriptingInterface.cpp b/interface/src/raypick/PickScriptingInterface.cpp index 04bafaad72..520be5ae21 100644 --- a/interface/src/raypick/PickScriptingInterface.cpp +++ b/interface/src/raypick/PickScriptingInterface.cpp @@ -58,7 +58,7 @@ unsigned int PickScriptingInterface::createPick(const PickQuery::PickType type, return PickManager::INVALID_PICK_ID; } - propMap["type"] = (int)type; + propMap["pickType"] = (int)type; pick->setScriptParameters(propMap); @@ -99,7 +99,7 @@ PickFilter getPickFilter(unsigned int filter) { * @property {Vec3} [dirOffset] - Synonym for direction. * @property {Quat} [orientation] - Alternative property for specifying direction. The value is applied to the * default direction value. - * @property {PickType} type - The type of pick when getting these properties from {@link Picks.getPickProperties}. A ray pick's type is {@link PickType.Ray}. + * @property {PickType} pickType - The type of pick when getting these properties from {@link Picks.getPickProperties}. 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. */ @@ -170,7 +170,7 @@ std::shared_ptr PickScriptingInterface::buildRayPick(const QVariantMa * means no maximum. * @property {Vec3} [tipOffset=0,0.095,0] - The position of the stylus tip relative to the hand position at default avatar * scale. - * @property {PickType} type - The type of pick when getting these properties from {@link Picks.getPickProperties}. A stylus pick's type is {@link PickType.Stylus}. + * @property {PickType} pickType - The type of pick when getting these properties from {@link Picks.getPickProperties}. A stylus pick's type is {@link PickType.Stylus}. */ std::shared_ptr PickScriptingInterface::buildStylusPick(const QVariantMap& propMap) { bilateral::Side side = bilateral::Side::Invalid; @@ -245,7 +245,7 @@ std::shared_ptr PickScriptingInterface::buildStylusPick(const QVarian * with the avatar or other parent. * @property {boolean} [scaleWithAvatar=true] - Synonym for scalewithParent. *

Deprecated: This property is deprecated and will be removed.

- * @property {PickType} type - The type of pick when getting these properties from {@link Picks.getPickProperties}. A parabola pick's type is {@link PickType.Parabola}. + * @property {PickType} pickType - The type of pick when getting these properties from {@link Picks.getPickProperties}. 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. */ @@ -344,7 +344,7 @@ std::shared_ptr PickScriptingInterface::buildParabolaPick(const QVari * 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 * masks overlap with the region's collision group are considered to be colliding with the region. - * @property {PickType} type - The type of pick when getting these properties from {@link Picks.getPickProperties}. A collision pick's type is {@link PickType.Collision}. + * @property {PickType} pickType - The type of pick when getting these properties from {@link Picks.getPickProperties}. 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. */ diff --git a/interface/src/raypick/PointerScriptingInterface.cpp b/interface/src/raypick/PointerScriptingInterface.cpp index d7b4096fbc..8d760800d6 100644 --- a/interface/src/raypick/PointerScriptingInterface.cpp +++ b/interface/src/raypick/PointerScriptingInterface.cpp @@ -60,7 +60,7 @@ unsigned int PointerScriptingInterface::createPointer(const PickQuery::PickType& return PointerEvent::INVALID_POINTER_ID; } - propertyMap["type"] = (int)type; + propertyMap["pointerType"] = (int)type; pointer->setScriptParameters(propertyMap); @@ -89,6 +89,7 @@ QVariantMap PointerScriptingInterface::getPointerScriptParameters(unsigned int u * @property {Pointers.StylusPointerModel} [model] - Override some or all of the default stylus model properties. * @property {boolean} [hover=false] - true if the pointer generates {@link Entities} hover events, * false if it doesn't. + * @property {PickType} pointerType - The type of pointer when getting these properties from {@link Pointers.getPointerProperties}. 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. */ @@ -207,6 +208,7 @@ std::shared_ptr PointerScriptingInterface::buildStylus(const QVariant& * false if it doesn't. * @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. + * @property {PickType} pointerType - The type of pointer when getting these properties from {@link Pointers.getPointerProperties}. 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. */ @@ -399,6 +401,7 @@ std::shared_ptr PointerScriptingInterface::buildLaserPointer(const QVar * false if it doesn't. * @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. + * @property {PickType} pointerType - The type of pointer when getting these properties from {@link Pointers.getPointerProperties}. 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. */ diff --git a/interface/src/raypick/StylusPointer.cpp b/interface/src/raypick/StylusPointer.cpp index 57a035510a..48b61e9a2a 100644 --- a/interface/src/raypick/StylusPointer.cpp +++ b/interface/src/raypick/StylusPointer.cpp @@ -43,6 +43,10 @@ StylusPointer::~StylusPointer() { } } +PickQuery::PickType StylusPointer::getType() const { + return PickQuery::PickType::Stylus; +} + 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 QVariantMap propertiesMap; diff --git a/interface/src/raypick/StylusPointer.h b/interface/src/raypick/StylusPointer.h index 7d43df2379..41ac17e598 100644 --- a/interface/src/raypick/StylusPointer.h +++ b/interface/src/raypick/StylusPointer.h @@ -23,6 +23,8 @@ public: const glm::vec3& modelPositionOffset, const glm::quat& modelRotationOffset, const glm::vec3& modelDimensions); ~StylusPointer(); + PickQuery::PickType getType() const override; + void updateVisuals(const PickResultPointer& pickResult) override; // Styluses have three render states: diff --git a/libraries/pointers/src/Pick.h b/libraries/pointers/src/Pick.h index 30e1ce8972..b9d067a1ca 100644 --- a/libraries/pointers/src/Pick.h +++ b/libraries/pointers/src/Pick.h @@ -173,7 +173,7 @@ public: virtual QVariantMap toVariantMap() const { QVariantMap properties; - properties["type"] = (int)getType(); + properties["pickType"] = (int)getType(); properties["enabled"] = isEnabled(); properties["filter"] = (unsigned int)getFilter()._flags.to_ulong(); properties["maxDistance"] = getMaxDistance(); diff --git a/libraries/pointers/src/Pointer.cpp b/libraries/pointers/src/Pointer.cpp index fa527f95e1..f435482865 100644 --- a/libraries/pointers/src/Pointer.cpp +++ b/libraries/pointers/src/Pointer.cpp @@ -47,6 +47,7 @@ PickResultPointer Pointer::getPrevPickResult() { QVariantMap Pointer::toVariantMap() const { QVariantMap qVariantMap = DependencyManager::get()->getPickProperties(_pickUID); + qVariantMap["pointerType"] = getType(); qVariantMap["pickID"] = _pickUID; qVariantMap["hover"] = _hover; diff --git a/libraries/pointers/src/Pointer.h b/libraries/pointers/src/Pointer.h index c4a0973c14..7a7c51477a 100644 --- a/libraries/pointers/src/Pointer.h +++ b/libraries/pointers/src/Pointer.h @@ -46,6 +46,7 @@ public: virtual void enable(); virtual void disable(); virtual bool isEnabled(); + virtual PickQuery::PickType getType() const = 0; virtual PickResultPointer getPrevPickResult(); virtual void setRenderState(const std::string& state) = 0;