mirror of
https://github.com/overte-org/overte.git
synced 2025-06-15 14:39:25 +02:00
Code review
This commit is contained in:
parent
fb684909ce
commit
94e6a68d41
3 changed files with 19 additions and 42 deletions
|
@ -111,7 +111,7 @@ void Pointer::generatePointerEvents(unsigned int pointerID, const PickResultPoin
|
||||||
hoveredEvent.setMoveOnHoverLeave(moveOnHoverLeave);
|
hoveredEvent.setMoveOnHoverLeave(moveOnHoverLeave);
|
||||||
|
|
||||||
// if shouldHover && !_prevDoHover, only send hoverBegin
|
// if shouldHover && !_prevDoHover, only send hoverBegin
|
||||||
if (_enabled && _hover && doHover && !_prevDoHover) {
|
if (_enabled && doHover && !_prevDoHover) {
|
||||||
if (hoveredObject.type == ENTITY) {
|
if (hoveredObject.type == ENTITY) {
|
||||||
emit pointerManager->hoverBeginEntity(hoveredObject.objectID, hoveredEvent);
|
emit pointerManager->hoverBeginEntity(hoveredObject.objectID, hoveredEvent);
|
||||||
} else if (hoveredObject.type == OVERLAY) {
|
} else if (hoveredObject.type == OVERLAY) {
|
||||||
|
@ -119,7 +119,7 @@ void Pointer::generatePointerEvents(unsigned int pointerID, const PickResultPoin
|
||||||
} else if (hoveredObject.type == HUD) {
|
} else if (hoveredObject.type == HUD) {
|
||||||
emit pointerManager->hoverBeginHUD(hoveredEvent);
|
emit pointerManager->hoverBeginHUD(hoveredEvent);
|
||||||
}
|
}
|
||||||
} else if (_enabled && _hover && doHover) {
|
} else if (_enabled && doHover) {
|
||||||
if (hoveredObject.type == OVERLAY) {
|
if (hoveredObject.type == OVERLAY) {
|
||||||
if (_prevHoveredObject.type == OVERLAY) {
|
if (_prevHoveredObject.type == OVERLAY) {
|
||||||
if (hoveredObject.objectID == _prevHoveredObject.objectID) {
|
if (hoveredObject.objectID == _prevHoveredObject.objectID) {
|
||||||
|
|
|
@ -62,7 +62,7 @@ public:
|
||||||
virtual void setLength(float length) {}
|
virtual void setLength(float length) {}
|
||||||
virtual void setLockEndUUID(const QUuid& objectID, bool isOverlay, const glm::mat4& offsetMat = glm::mat4()) {}
|
virtual void setLockEndUUID(const QUuid& objectID, bool isOverlay, const glm::mat4& offsetMat = glm::mat4()) {}
|
||||||
|
|
||||||
void setDoesHover(bool hover);
|
virtual void setDoesHover(bool hover);
|
||||||
|
|
||||||
void update(unsigned int pointerID);
|
void update(unsigned int pointerID);
|
||||||
virtual void updateVisuals(const PickResultPointer& pickResult) = 0;
|
virtual void updateVisuals(const PickResultPointer& pickResult) = 0;
|
||||||
|
|
|
@ -163,6 +163,20 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.updateDoesHover = function(handLaser) {
|
||||||
|
if (handLaser.doesHover !== undefined) {
|
||||||
|
if (handLaser.hand === LEFT_HAND
|
||||||
|
&& _this.leftPointerDoesHover !== handLaser.doesHover) {
|
||||||
|
_this.leftPointerDoesHover = handLaser.doesHover;
|
||||||
|
_this.leftPointerDoesHoverChanged = true;
|
||||||
|
} else if (handLaser.hand === RIGHT_HAND
|
||||||
|
&& _this.rightPointerDoesHover !== handLaser.doesHover) {
|
||||||
|
_this.rightPointerDoesHover = handLaser.doesHover;
|
||||||
|
_this.rightPointerDoesHoverChanged = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.updateHovering = function () {
|
this.updateHovering = function () {
|
||||||
if (_this.leftPointerDoesHoverChanged) {
|
if (_this.leftPointerDoesHoverChanged) {
|
||||||
Pointers.setDoesHover(_this.leftPointer, _this.leftPointerDoesHover);
|
Pointers.setDoesHover(_this.leftPointer, _this.leftPointerDoesHover);
|
||||||
|
@ -345,19 +359,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
||||||
_this.runningPluginNames[orderedPluginName] = true;
|
_this.runningPluginNames[orderedPluginName] = true;
|
||||||
_this.markSlots(candidatePlugin, orderedPluginName);
|
_this.markSlots(candidatePlugin, orderedPluginName);
|
||||||
_this.pointerManager.makePointerVisible(candidatePlugin.parameters.handLaser);
|
_this.pointerManager.makePointerVisible(candidatePlugin.parameters.handLaser);
|
||||||
|
_this.updateDoesHover(candidatePlugin.parameters.handLaser);
|
||||||
if (candidatePlugin.parameters.handLaser.doesHover !== undefined) {
|
|
||||||
if (candidatePlugin.parameters.handLaser.hand === LEFT_HAND
|
|
||||||
&& _this.leftPointerDoesHover !== candidatePlugin.parameters.handLaser.doesHover) {
|
|
||||||
_this.leftPointerDoesHover = candidatePlugin.parameters.handLaser.doesHover;
|
|
||||||
_this.leftPointerDoesHoverChanged = true;
|
|
||||||
} else if (candidatePlugin.parameters.handLaser.hand === RIGHT_HAND
|
|
||||||
&& _this.rightPointerDoesHover !== candidatePlugin.parameters.handLaser.doesHover) {
|
|
||||||
_this.rightPointerDoesHover = candidatePlugin.parameters.handLaser.doesHover;
|
|
||||||
_this.rightPointerDoesHoverChanged = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
print("controllerDispatcher running " + orderedPluginName);
|
print("controllerDispatcher running " + orderedPluginName);
|
||||||
}
|
}
|
||||||
|
@ -387,39 +389,14 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
||||||
if (PROFILE) {
|
if (PROFILE) {
|
||||||
Script.beginProfileRange("dispatch.run." + runningPluginName);
|
Script.beginProfileRange("dispatch.run." + runningPluginName);
|
||||||
}
|
}
|
||||||
|
_this.updateDoesHover(plugin.parameters.handLaser);
|
||||||
var runningness = plugin.run(controllerData, deltaTime);
|
var runningness = plugin.run(controllerData, deltaTime);
|
||||||
|
|
||||||
if (runningness.active) {
|
|
||||||
if (plugin.parameters.handLaser.doesHover !== undefined) {
|
|
||||||
if (plugin.parameters.handLaser.hand === LEFT_HAND
|
|
||||||
&& _this.leftPointerDoesHover !== plugin.parameters.handLaser.doesHover) {
|
|
||||||
_this.leftPointerDoesHover = plugin.parameters.handLaser.doesHover;
|
|
||||||
_this.leftPointerDoesHoverChanged = true;
|
|
||||||
} else if (plugin.parameters.handLaser.hand === RIGHT_HAND
|
|
||||||
&& _this.rightPointerDoesHover !== plugin.parameters.handLaser.doesHover) {
|
|
||||||
_this.rightPointerDoesHover = plugin.parameters.handLaser.doesHover;
|
|
||||||
_this.rightPointerDoesHoverChanged = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!runningness.active) {
|
if (!runningness.active) {
|
||||||
// plugin is finished running, for now. remove it from the list
|
// plugin is finished running, for now. remove it from the list
|
||||||
// of running plugins and mark its activity-slots as "not in use"
|
// of running plugins and mark its activity-slots as "not in use"
|
||||||
delete _this.runningPluginNames[runningPluginName];
|
delete _this.runningPluginNames[runningPluginName];
|
||||||
_this.markSlots(plugin, false);
|
_this.markSlots(plugin, false);
|
||||||
_this.pointerManager.makePointerInvisible(plugin.parameters.handLaser);
|
_this.pointerManager.makePointerInvisible(plugin.parameters.handLaser);
|
||||||
|
|
||||||
if (plugin.parameters.handLaser.doesHover !== undefined) {
|
|
||||||
if (plugin.parameters.handLaser.hand === LEFT_HAND && !_this.leftPointerDoesHover) {
|
|
||||||
_this.leftPointerDoesHover = true;
|
|
||||||
_this.leftPointerDoesHoverChanged = true;
|
|
||||||
} else if (plugin.parameters.handLaser.hand === RIGHT_HAND && !_this.rightPointerDoesHover) {
|
|
||||||
_this.rightPointerDoesHover = true;
|
|
||||||
_this.rightPointerDoesHoverChanged = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
print("controllerDispatcher stopping " + runningPluginName);
|
print("controllerDispatcher stopping " + runningPluginName);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue