workaround deadlock in editRenderState

This commit is contained in:
SamGondelman 2017-08-08 11:11:19 -07:00
parent 6d253fcc5f
commit 684001a756
3 changed files with 11 additions and 20 deletions

View file

@ -78,24 +78,15 @@ void LaserPointer::setRenderState(const QString& state) {
}
void LaserPointer::editRenderState(const QString& state, const QVariant& startProps, const QVariant& pathProps, const QVariant& endProps) {
_renderStates[state].setStartID(updateRenderStateOverlay(_renderStates[state].getStartID(), startProps));
_renderStates[state].setPathID(updateRenderStateOverlay(_renderStates[state].getPathID(), pathProps));
_renderStates[state].setEndID(updateRenderStateOverlay(_renderStates[state].getEndID(), endProps));
updateRenderStateOverlay(_renderStates[state].getStartID(), startProps);
updateRenderStateOverlay(_renderStates[state].getPathID(), pathProps);
updateRenderStateOverlay(_renderStates[state].getEndID(), endProps);
}
OverlayID LaserPointer::updateRenderStateOverlay(const OverlayID& id, const QVariant& props) {
if (props.isValid()) {
if (!id.isNull()) {
qApp->getOverlays().editOverlay(id, props);
return id;
} else {
QVariantMap propsMap = props.toMap();
if (propsMap["type"].isValid()) {
return qApp->getOverlays().addOverlay(propsMap["type"].toString(), props);
}
}
void LaserPointer::updateRenderStateOverlay(const OverlayID& id, const QVariant& props) {
if (!id.isNull() && props.isValid()) {
qApp->getOverlays().editOverlay(id, props);
}
return OverlayID();
}
void LaserPointer::updateRenderState(const RenderState& renderState, const IntersectionType type, const float distance, const QUuid& objectID, const bool defaultState) {

View file

@ -29,9 +29,6 @@ public:
const OverlayID& getStartID() const { return _startID; }
const OverlayID& getPathID() const { return _pathID; }
const OverlayID& getEndID() const { return _endID; }
void setStartID(const OverlayID& startID) { _startID = startID; }
void setPathID(const OverlayID& pathID) { _pathID = pathID; }
void setEndID(const OverlayID& endID) { _endID = endID; }
const bool& doesStartIgnoreRays() const { return _startIgnoreRays; }
const bool& doesPathIgnoreRays() const { return _pathIgnoreRays; }
const bool& doesEndIgnoreRays() const { return _endIgnoreRays; }
@ -61,6 +58,7 @@ public:
const RayPickResult getPrevRayPickResult() { return DependencyManager::get<RayPickManager>()->getPrevRayPickResult(_rayPickUID); }
void setRenderState(const QString& state);
// You cannot use editRenderState to change the overlay type of any part of the laser pointer. You can only edit the properties of the existing overlays.
void editRenderState(const QString& state, const QVariant& startProps, const QVariant& pathProps, const QVariant& endProps);
void setIgnoreEntities(const QScriptValue& ignoreEntities) { DependencyManager::get<RayPickManager>()->setIgnoreEntities(_rayPickUID, ignoreEntities); }
@ -86,7 +84,7 @@ private:
QUuid _rayPickUID;
OverlayID updateRenderStateOverlay(const OverlayID& id, const QVariant& props);
void updateRenderStateOverlay(const OverlayID& id, const QVariant& props);
void updateRenderState(const RenderState& renderState, const IntersectionType type, const float distance, const QUuid& objectID, const bool defaultState);
void disableRenderState(const RenderState& renderState);
};

View file

@ -263,11 +263,13 @@ function Grabber() {
enabled: true
});
RayPick.setIncludeOverlays(this.mouseRayOverlays, [HMD.tabletID, HMD.tabletScreenID, HMD.homeButtonID]);
var renderStates = [{name: "grabbed", end: beacon}];
this.mouseRayEntities = LaserPointers.createLaserPointer({
joint: "Mouse",
filter: RayPick.PICK_ENTITIES,
faceAvatar: true,
enabled: true
enabled: true,
renderStates: renderStates
});
}