mirror of
https://github.com/lubosz/overte.git
synced 2025-04-08 04:42:20 +02:00
Disambiguate pick and pointer types in the returned properties
This commit is contained in:
parent
30482c2db4
commit
8cde93973d
11 changed files with 30 additions and 7 deletions
|
@ -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<RenderState>(_renderStates[state]);
|
||||
if (renderState) {
|
||||
|
|
|
@ -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<StartEndRenderState> buildRenderState(const QVariantMap& propMap);
|
||||
|
|
|
@ -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<ParabolaPickResult>(pickResult);
|
||||
if (!parabolaPickResult) {
|
||||
|
|
|
@ -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<StartEndRenderState> buildRenderState(const QVariantMap& propMap);
|
||||
|
|
|
@ -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 <code>direction</code>.
|
||||
* @property {Quat} [orientation] - Alternative property for specifying <code>direction</code>. The value is applied to the
|
||||
* default <code>direction</code> 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<PickQuery> 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<PickQuery> PickScriptingInterface::buildStylusPick(const QVariantMap& propMap) {
|
||||
bilateral::Side side = bilateral::Side::Invalid;
|
||||
|
@ -245,7 +245,7 @@ std::shared_ptr<PickQuery> PickScriptingInterface::buildStylusPick(const QVarian
|
|||
* with the avatar or other parent.
|
||||
* @property {boolean} [scaleWithAvatar=true] - Synonym for <code>scalewithParent</code>.
|
||||
* <p class="important">Deprecated: This property is deprecated and will be removed.</p>
|
||||
* @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<PickQuery> 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.
|
||||
*/
|
||||
|
|
|
@ -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] - <code>true</code> if the pointer generates {@link Entities} hover events,
|
||||
* <code>false</code> 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<Pointer> PointerScriptingInterface::buildStylus(const QVariant&
|
|||
* <code>false</code> 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<Pointer> PointerScriptingInterface::buildLaserPointer(const QVar
|
|||
* <code>false</code> 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.
|
||||
*/
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -47,6 +47,7 @@ PickResultPointer Pointer::getPrevPickResult() {
|
|||
QVariantMap Pointer::toVariantMap() const {
|
||||
QVariantMap qVariantMap = DependencyManager::get<PickManager>()->getPickProperties(_pickUID);
|
||||
|
||||
qVariantMap["pointerType"] = getType();
|
||||
qVariantMap["pickID"] = _pickUID;
|
||||
qVariantMap["hover"] = _hover;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue