mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 10:29:01 +02:00
code cleanup
This commit is contained in:
parent
7cf27c18d3
commit
2948061904
7 changed files with 15 additions and 23 deletions
|
@ -1891,7 +1891,6 @@ QString Application::getUserAgent() {
|
||||||
void Application::toggleTabletUI(bool shouldOpen) const {
|
void Application::toggleTabletUI(bool shouldOpen) const {
|
||||||
auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>();
|
auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>();
|
||||||
auto hmd = DependencyManager::get<HMDScriptingInterface>();
|
auto hmd = DependencyManager::get<HMDScriptingInterface>();
|
||||||
qDebug() << "Application::toggleTabletUI" << shouldOpen << hmd->getShouldShowTablet();
|
|
||||||
if (!(shouldOpen && hmd->getShouldShowTablet())) {
|
if (!(shouldOpen && hmd->getShouldShowTablet())) {
|
||||||
auto HMD = DependencyManager::get<HMDScriptingInterface>();
|
auto HMD = DependencyManager::get<HMDScriptingInterface>();
|
||||||
HMD->toggleShouldShowTablet();
|
HMD->toggleShouldShowTablet();
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
getControllerJointIndex, NULL_UUID, enableDispatcherModule, disableDispatcherModule,
|
getControllerJointIndex, NULL_UUID, enableDispatcherModule, disableDispatcherModule,
|
||||||
Messages, makeDispatcherModuleParameters, makeRunningValues, Settings, entityHasActions,
|
Messages, makeDispatcherModuleParameters, makeRunningValues, Settings, entityHasActions,
|
||||||
Vec3, Overlays, flatten, Xform, getControllerWorldLocation, ensureDynamic, entityIsCloneable,
|
Vec3, Overlays, flatten, Xform, getControllerWorldLocation, ensureDynamic, entityIsCloneable,
|
||||||
cloneEntity
|
cloneEntity, DISPATCHER_PROPERTIES
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Script.include("/~/system/libraries/Xform.js");
|
Script.include("/~/system/libraries/Xform.js");
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
getControllerJointIndex, NULL_UUID, enableDispatcherModule, disableDispatcherModule,
|
getControllerJointIndex, NULL_UUID, enableDispatcherModule, disableDispatcherModule,
|
||||||
propsArePhysical, Messages, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, TRIGGER_OFF_VALUE,
|
propsArePhysical, Messages, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, TRIGGER_OFF_VALUE,
|
||||||
makeDispatcherModuleParameters, entityIsGrabbable, makeRunningValues, NEAR_GRAB_RADIUS,
|
makeDispatcherModuleParameters, entityIsGrabbable, makeRunningValues, NEAR_GRAB_RADIUS,
|
||||||
findGroupParent, Vec3
|
findGroupParent, Vec3, cloneEntity, entityIsCloneable
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Script.include("/~/system/controllers/controllerDispatcherUtils.js");
|
Script.include("/~/system/controllers/controllerDispatcherUtils.js");
|
||||||
|
@ -46,19 +46,20 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
|
||||||
}
|
}
|
||||||
|
|
||||||
var handJointIndex = MyAvatar.getJointIndex(this.hand === RIGHT_HAND ? "RightHand" : "LeftHand");
|
var handJointIndex = MyAvatar.getJointIndex(this.hand === RIGHT_HAND ? "RightHand" : "LeftHand");
|
||||||
if (props.parentJointIndex == handJointIndex) {
|
if (props.parentJointIndex === handJointIndex) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var controllerJointIndex = this.controllerJointIndex;
|
var controllerJointIndex = this.controllerJointIndex;
|
||||||
if (props.parentJointIndex == controllerJointIndex) {
|
if (props.parentJointIndex === controllerJointIndex) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var controllerCRJointIndex = MyAvatar.getJointIndex(this.hand === RIGHT_HAND ?
|
var controllerCRJointIndex = MyAvatar.getJointIndex(this.hand === RIGHT_HAND ?
|
||||||
"_CAMERA_RELATIVE_CONTROLLER_RIGHTHAND" :
|
"_CAMERA_RELATIVE_CONTROLLER_RIGHTHAND" :
|
||||||
"_CAMERA_RELATIVE_CONTROLLER_LEFTHAND");
|
"_CAMERA_RELATIVE_CONTROLLER_LEFTHAND");
|
||||||
if (props.parentJointIndex == controllerCRJointIndex) {
|
|
||||||
|
if (props.parentJointIndex === controllerCRJointIndex) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +173,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
|
||||||
|
|
||||||
this.run = function (controllerData, deltaTime) {
|
this.run = function (controllerData, deltaTime) {
|
||||||
if (this.grabbing) {
|
if (this.grabbing) {
|
||||||
if (controllerData.triggerClicks[this.hand] == 0) {
|
if (controllerData.triggerClicks[this.hand] === 0) {
|
||||||
this.endNearParentingGrabEntity();
|
this.endNearParentingGrabEntity();
|
||||||
return makeRunningValues(false, [], []);
|
return makeRunningValues(false, [], []);
|
||||||
}
|
}
|
||||||
|
@ -185,7 +186,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
|
||||||
if (!readiness.active) {
|
if (!readiness.active) {
|
||||||
return readiness;
|
return readiness;
|
||||||
}
|
}
|
||||||
if (controllerData.triggerClicks[this.hand] == 1) {
|
if (controllerData.triggerClicks[this.hand] === 1) {
|
||||||
// switch to grab
|
// switch to grab
|
||||||
var targetProps = this.getTargetProps(controllerData);
|
var targetProps = this.getTargetProps(controllerData);
|
||||||
var targetCloneable = entityIsCloneable(targetProps);
|
var targetCloneable = entityIsCloneable(targetProps);
|
||||||
|
@ -196,9 +197,9 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
|
||||||
var cloneProps = Entities.getEntityProperties(cloneID);
|
var cloneProps = Entities.getEntityProperties(cloneID);
|
||||||
|
|
||||||
this.grabbing = true;
|
this.grabbing = true;
|
||||||
this.targetEntityID = cloneID
|
this.targetEntityID = cloneID;
|
||||||
this.startNearParentingGrabEntity(controllerData, cloneProps);
|
this.startNearParentingGrabEntity(controllerData, cloneProps);
|
||||||
|
|
||||||
} else if (targetProps) {
|
} else if (targetProps) {
|
||||||
this.grabbing = true;
|
this.grabbing = true;
|
||||||
this.startNearParentingGrabEntity(controllerData, targetProps);
|
this.startNearParentingGrabEntity(controllerData, targetProps);
|
||||||
|
|
|
@ -84,7 +84,7 @@ Script.include("/~/system/controllers/controllerDispatcherUtils.js");
|
||||||
};
|
};
|
||||||
|
|
||||||
this.run = function (controllerData) {
|
this.run = function (controllerData) {
|
||||||
if (controllerData.triggerClicks[this.hand] == 0) {
|
if (controllerData.triggerClicks[this.hand] === 0) {
|
||||||
this.endNearTrigger(controllerData);
|
this.endNearTrigger(controllerData);
|
||||||
return makeRunningValues(false, [], []);
|
return makeRunningValues(false, [], []);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,8 @@
|
||||||
Messages, Quat, Vec3, getControllerWorldLocation, makeDispatcherModuleParameters, Overlays, ZERO_VEC,
|
Messages, Quat, Vec3, getControllerWorldLocation, makeDispatcherModuleParameters, Overlays, ZERO_VEC,
|
||||||
AVATAR_SELF_ID, HMD, INCHES_TO_METERS, DEFAULT_REGISTRATION_POINT, Settings, getGrabPointSphereOffset,
|
AVATAR_SELF_ID, HMD, INCHES_TO_METERS, DEFAULT_REGISTRATION_POINT, Settings, getGrabPointSphereOffset,
|
||||||
COLORS_GRAB_SEARCHING_HALF_SQUEEZE, COLORS_GRAB_SEARCHING_FULL_SQUEEZE, COLORS_GRAB_DISTANCE_HOLD,
|
COLORS_GRAB_SEARCHING_HALF_SQUEEZE, COLORS_GRAB_SEARCHING_FULL_SQUEEZE, COLORS_GRAB_DISTANCE_HOLD,
|
||||||
DEFAULT_SEARCH_SPHERE_DISTANCE, TRIGGER_ON_VALUE, TRIGGER_OFF_VALUE, getEnabledModuleByName, PICK_MAX_DISTANCE
|
DEFAULT_SEARCH_SPHERE_DISTANCE, TRIGGER_ON_VALUE, TRIGGER_OFF_VALUE, getEnabledModuleByName, PICK_MAX_DISTANCE,
|
||||||
|
DISPATCHER_PROPERTIES
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Script.include("/~/system/controllers/controllerDispatcherUtils.js");
|
Script.include("/~/system/controllers/controllerDispatcherUtils.js");
|
||||||
|
|
|
@ -21,8 +21,6 @@
|
||||||
(function() { // BEGIN LOCAL_SCOPE
|
(function() { // BEGIN LOCAL_SCOPE
|
||||||
|
|
||||||
Script.include("/~/system/libraries/utils.js");
|
Script.include("/~/system/libraries/utils.js");
|
||||||
Script.include("/~/system/controllers/controllerDispatcherUtils.js");
|
|
||||||
Script.include("/~/system/libraries/controllers.js");
|
|
||||||
var MAX_SOLID_ANGLE = 0.01; // objects that appear smaller than this can't be grabbed
|
var MAX_SOLID_ANGLE = 0.01; // objects that appear smaller than this can't be grabbed
|
||||||
|
|
||||||
var DELAY_FOR_30HZ = 33; // milliseconds
|
var DELAY_FOR_30HZ = 33; // milliseconds
|
||||||
|
@ -253,12 +251,6 @@ function Grabber() {
|
||||||
z: 0
|
z: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
this.paramters = makeDispatcherModuleParameters(
|
|
||||||
300,
|
|
||||||
"mouse",
|
|
||||||
[],
|
|
||||||
100);
|
|
||||||
|
|
||||||
this.targetPosition = null;
|
this.targetPosition = null;
|
||||||
this.targetRotation = null;
|
this.targetRotation = null;
|
||||||
|
|
||||||
|
|
|
@ -639,7 +639,6 @@ function update() {
|
||||||
|
|
||||||
// If there's a HUD element at the (newly moved) reticle, just make it visible and bail.
|
// If there's a HUD element at the (newly moved) reticle, just make it visible and bail.
|
||||||
if (isPointingAtOverlay(hudPoint2d) && isPointerEnabled) {
|
if (isPointingAtOverlay(hudPoint2d) && isPointerEnabled) {
|
||||||
//print("--------> pointing at HUD <--------");
|
|
||||||
if (HMD.active) {
|
if (HMD.active) {
|
||||||
Reticle.depth = hudReticleDistance();
|
Reticle.depth = hudReticleDistance();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue