Update system scripts to use new properties

This commit is contained in:
David Rowe 2017-10-14 08:32:14 +13:00
parent 949ed3b33d
commit fc4e440dc4
22 changed files with 109 additions and 255 deletions

View file

@ -12,7 +12,6 @@
Script.include("libraries/utils.js");
var NULL_UUID = "{00000000-0000-0000-0000-000000000000}";
var DEFAULT_WEARABLE_DATA = {
joints: {}
};
@ -116,7 +115,7 @@ function AttachedEntitiesManager() {
var allowedJoints = getEntityCustomData('wearable', grabbedEntity, DEFAULT_WEARABLE_DATA).joints;
var props = Entities.getEntityProperties(grabbedEntity, ["position", "parentID", "parentJointIndex"]);
if (props.parentID === NULL_UUID || props.parentID === MyAvatar.sessionUUID) {
if (props.parentID === Uuid.NULL || props.parentID === MyAvatar.sessionUUID) {
var bestJointName = "";
var bestJointIndex = -1;
var bestJointDistance = 0;
@ -168,7 +167,7 @@ function AttachedEntitiesManager() {
if (updatePresets) {
this.updateRelativeOffsets(newEntity);
}
} else if (props.parentID != NULL_UUID) {
} else if (props.parentID != Uuid.NULL) {
// drop the entity and set it to have no parent (not on the avatar), unless it's being equipped in a hand.
if (props.parentID === MyAvatar.sessionUUID &&
(props.parentJointIndex == MyAvatar.getJointIndex("RightHand") ||
@ -176,7 +175,7 @@ function AttachedEntitiesManager() {
// this is equipped on a hand -- don't clear the parent.
} else {
var wearProps = Entities.getEntityProperties(grabbedEntity);
wearProps.parentID = NULL_UUID;
wearProps.parentID = Uuid.NULL;
wearProps.parentJointIndex = -1;
delete wearProps.id;
delete wearProps.created;

View file

@ -30,7 +30,6 @@ var OVERLAY_DATA = {
};
var AVATAR_MOVE_FOR_ACTIVE_DISTANCE = 0.8; // meters -- no longer away if avatar moves this far while away
var AVATAR_SELF_ID = "{00000000-0000-0000-0000-000000000001}";
var CAMERA_MATRIX = -7;
var OVERLAY_DATA_HMD = {
@ -44,7 +43,7 @@ var OVERLAY_DATA_HMD = {
scale: 2 * MyAvatar.sensorToWorldScale,
emissive: true,
drawInFront: true,
parentID: AVATAR_SELF_ID,
parentID: Uuid.SELF,
parentJointIndex: CAMERA_MATRIX
};

View file

@ -9,8 +9,6 @@
/* globals createControllerDisplay:true deleteControllerDisplay:true */
var PARENT_ID = "{00000000-0000-0000-0000-000000000001}";
function clamp(value, min, max) {
if (value < min) {
return min;
@ -178,7 +176,7 @@ createControllerDisplay = function(config) {
dimensions: Vec3.multiply(sensorScaleFactor, controller.dimensions),
localRotation: controller.rotation,
localPosition: Vec3.multiply(sensorScaleFactor, position),
parentID: PARENT_ID,
parentID: Uuid.SELF,
parentJointIndex: controller.jointIndex,
ignoreRayIntersection: true
});
@ -198,7 +196,7 @@ createControllerDisplay = function(config) {
url: part.modelURL,
localPosition: partPosition,
localRotation: innerRotation,
parentID: PARENT_ID,
parentID: Uuid.SELF,
parentJointIndex: controller.jointIndex,
ignoreRayIntersection: true
};

View file

@ -7,7 +7,7 @@
/* global Script, Entities, MyAvatar, Controller, RIGHT_HAND, LEFT_HAND, AVATAR_SELF_ID,
getControllerJointIndex, NULL_UUID, enableDispatcherModule, disableDispatcherModule,
getControllerJointIndex, enableDispatcherModule, disableDispatcherModule,
Messages, makeDispatcherModuleParameters, makeRunningValues, Settings, entityHasActions,
Vec3, Overlays, flatten, Xform, getControllerWorldLocation, ensureDynamic, entityIsCloneable,
cloneEntity, DISPATCHER_PROPERTIES
@ -333,7 +333,7 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa
var props = controllerData.nearbyEntityPropertiesByID[hotspot.entityID];
var hasParent = true;
if (props.parentID === NULL_UUID) {
if (props.parentID === Uuid.NULL) {
hasParent = false;
}
@ -539,7 +539,7 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa
this.endEquipEntity = function () {
Entities.editEntity(this.targetEntityID, {
parentID: NULL_UUID,
parentID: Uuid.NULL,
parentJointIndex: -1
});

View file

@ -8,7 +8,7 @@
/* jslint bitwise: true */
/* global Script, Controller, LaserPointers, RayPick, RIGHT_HAND, LEFT_HAND, Mat4, MyAvatar, Vec3, Camera, Quat,
getGrabPointSphereOffset, getEnabledModuleByName, makeRunningValues, Entities, NULL_UUID,
getGrabPointSphereOffset, getEnabledModuleByName, makeRunningValues, Entities,
enableDispatcherModule, disableDispatcherModule, entityIsDistanceGrabbable,
makeDispatcherModuleParameters, MSECS_PER_SEC, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION,
PICK_MAX_DISTANCE, COLORS_GRAB_SEARCHING_HALF_SQUEEZE, COLORS_GRAB_SEARCHING_FULL_SQUEEZE, COLORS_GRAB_DISTANCE_HOLD,
@ -238,7 +238,7 @@ Script.include("/~/system/libraries/controllers.js");
tag: "far-grab-" + MyAvatar.sessionUUID,
ttl: ACTION_TTL
});
if (this.actionID === NULL_UUID) {
if (this.actionID === Uuid.NULL) {
this.actionID = null;
}

View file

@ -11,7 +11,7 @@
//
/* global Script, Controller, LaserPointers, RayPick, RIGHT_HAND, LEFT_HAND, Mat4, MyAvatar, Vec3, Camera, Quat,
getGrabPointSphereOffset, getEnabledModuleByName, makeRunningValues, Entities, NULL_UUID,
getGrabPointSphereOffset, getEnabledModuleByName, makeRunningValues, Entities,
enableDispatcherModule, disableDispatcherModule, entityIsDistanceGrabbable,
makeDispatcherModuleParameters, MSECS_PER_SEC, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION,
PICK_MAX_DISTANCE, COLORS_GRAB_SEARCHING_HALF_SQUEEZE, COLORS_GRAB_SEARCHING_FULL_SQUEEZE, COLORS_GRAB_DISTANCE_HOLD,

View file

@ -6,7 +6,7 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
/* global Script, Entities, MyAvatar, Controller, RIGHT_HAND, LEFT_HAND,
getControllerJointIndex, getGrabbableData, NULL_UUID, enableDispatcherModule, disableDispatcherModule,
getControllerJointIndex, getGrabbableData, enableDispatcherModule, disableDispatcherModule,
propsArePhysical, Messages, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, entityIsGrabbable,
Quat, Vec3, MSECS_PER_SEC, getControllerWorldLocation, makeDispatcherModuleParameters, makeRunningValues,
TRIGGER_OFF_VALUE, NEAR_GRAB_RADIUS, findGroupParent, entityIsCloneable, propsAreCloneDynamic, cloneEntity,
@ -101,7 +101,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
kinematicSetVelocity: true,
ignoreIK: this.ignoreIK
});
if (this.actionID === NULL_UUID) {
if (this.actionID === Uuid.NULL) {
this.actionID = null;
return;
}
@ -183,7 +183,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
if (targetProps) {
if ((!propsArePhysical(targetProps) && !propsAreCloneDynamic(targetProps)) ||
targetProps.parentID != NULL_UUID) {
targetProps.parentID !== Uuid.NULL) {
return makeRunningValues(false, [], []); // let nearParentGrabEntity handle it
} else {
this.targetEntityID = targetProps.id;

View file

@ -6,7 +6,7 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
/* global Script, Entities, MyAvatar, Controller, RIGHT_HAND, LEFT_HAND, AVATAR_SELF_ID, getControllerJointIndex, NULL_UUID,
/* global Script, Entities, MyAvatar, Controller, RIGHT_HAND, LEFT_HAND, AVATAR_SELF_ID, getControllerJointIndex,
enableDispatcherModule, disableDispatcherModule, propsArePhysical, Messages, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION,
TRIGGER_OFF_VALUE, makeDispatcherModuleParameters, entityIsGrabbable, makeRunningValues, NEAR_GRAB_RADIUS,
findGroupParent, Vec3, cloneEntity, entityIsCloneable, propsAreCloneDynamic, HAPTIC_PULSE_STRENGTH,
@ -120,7 +120,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
this.hapticTargetID = null;
var props = controllerData.nearbyEntityPropertiesByID[this.targetEntityID];
if (this.thisHandIsParent(props)) {
if (this.previousParentID[this.targetEntityID] === NULL_UUID || this.previousParentID === undefined) {
if (this.previousParentID[this.targetEntityID] === Uuid.NULL || this.previousParentID === undefined) {
Entities.editEntity(this.targetEntityID, {
parentID: this.previousParentID[this.targetEntityID],
parentJointIndex: this.previousParentJointIndex[this.targetEntityID]
@ -193,7 +193,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
var UNHOOK_LOOP_DETECT_MS = 200;
if (_this.previouslyUnhooked[childID]) {
if (now - _this.previouslyUnhooked[childID] < UNHOOK_LOOP_DETECT_MS) {
previousParentID = NULL_UUID;
previousParentID = Uuid.NULL;
previousParentJointIndex = -1;
}
}
@ -204,7 +204,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
parentJointIndex: previousParentJointIndex
});
} else {
Entities.editEntity(childID, { parentID: NULL_UUID });
Entities.editEntity(childID, { parentID: Uuid.NULL });
}
});
}
@ -253,7 +253,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
if (targetProps) {
if ((propsArePhysical(targetProps) || propsAreCloneDynamic(targetProps)) &&
targetProps.parentID == NULL_UUID) {
targetProps.parentID === Uuid.NULL) {
return makeRunningValues(false, [], []); // let nearActionGrabEntity handle it
} else {
this.targetEntityID = targetProps.id;
@ -268,7 +268,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
this.run = function (controllerData, deltaTime) {
if (this.grabbing) {
if (controllerData.triggerClicks[this.hand] < TRIGGER_OFF_VALUE &&
controllerData.secondaryValues[this.hand] < TRIGGER_OFF_VALUE) {
controllerData.secondaryValues[this.hand] < TRIGGER_OFF_VALUE) {
this.endNearParentingGrabEntity(controllerData);
return makeRunningValues(false, [], []);
}

View file

@ -6,7 +6,7 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
/* global Script, MyAvatar, Controller, RIGHT_HAND, LEFT_HAND, AVATAR_SELF_ID, getControllerJointIndex, NULL_UUID,
/* global Script, MyAvatar, Controller, RIGHT_HAND, LEFT_HAND, AVATAR_SELF_ID, getControllerJointIndex,
enableDispatcherModule, disableDispatcherModule, Messages, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION,
makeDispatcherModuleParameters, Overlays, makeRunningValues, Vec3, resizeTablet, getTabletWidthFromSettings,
NEAR_GRAB_RADIUS
@ -130,9 +130,9 @@ Script.include("/~/system/libraries/utils.js");
this.endNearParentingGrabOverlay = function () {
var previousParentID = this.previousParentID[this.grabbedThingID];
if ((previousParentID === NULL_UUID || previousParentID === null) && !this.robbed) {
if ((previousParentID === Uuid.NULL || previousParentID === null) && !this.robbed) {
Overlays.editOverlay(this.grabbedThingID, {
parentID: NULL_UUID,
parentID: Uuid.NULL,
parentJointIndex: -1
});
} else if (!this.robbed){

View file

@ -5,7 +5,7 @@
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
/* global Script, Entities, Controller, RIGHT_HAND, LEFT_HAND, NULL_UUID, enableDispatcherModule, disableDispatcherModule,
/* global Script, Entities, Controller, RIGHT_HAND, LEFT_HAND, enableDispatcherModule, disableDispatcherModule,
makeRunningValues, Messages, Quat, Vec3, makeDispatcherModuleParameters, Overlays, ZERO_VEC, AVATAR_SELF_ID, HMD,
INCHES_TO_METERS, DEFAULT_REGISTRATION_POINT, getGrabPointSphereOffset, COLORS_GRAB_SEARCHING_HALF_SQUEEZE,
COLORS_GRAB_SEARCHING_FULL_SQUEEZE, COLORS_GRAB_DISTANCE_HOLD, DEFAULT_SEARCH_SPHERE_DISTANCE, TRIGGER_ON_VALUE,

View file

@ -6,7 +6,7 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
/* global Script, Entities, MyAvatar, Controller, RIGHT_HAND, LEFT_HAND,
NULL_UUID, enableDispatcherModule, disableDispatcherModule, makeRunningValues,
enableDispatcherModule, disableDispatcherModule, makeRunningValues,
Messages, Quat, Vec3, getControllerWorldLocation, makeDispatcherModuleParameters, Overlays, ZERO_VEC,
AVATAR_SELF_ID, HMD, INCHES_TO_METERS, DEFAULT_REGISTRATION_POINT, Settings, getGrabPointSphereOffset,
getEnabledModuleByName
@ -286,7 +286,7 @@ Script.include("/~/system/libraries/controllers.js");
}
// add the tabletScreen, if it is valid
if (HMD.tabletScreenID && HMD.tabletScreenID !== NULL_UUID &&
if (HMD.tabletScreenID && HMD.tabletScreenID !== Uuid.NULL &&
Overlays.getProperty(HMD.tabletScreenID, "visible")) {
stylusTarget = TouchEventUtils.calculateTouchTargetFromOverlay(this.stylusTip, HMD.tabletScreenID);
if (stylusTarget) {
@ -295,7 +295,7 @@ Script.include("/~/system/libraries/controllers.js");
}
// add the tablet home button.
if (HMD.homeButtonID && HMD.homeButtonID !== NULL_UUID &&
if (HMD.homeButtonID && HMD.homeButtonID !== Uuid.NULL &&
Overlays.getProperty(HMD.homeButtonID, "visible")) {
stylusTarget = TouchEventUtils.calculateTouchTargetFromOverlay(this.stylusTip, HMD.homeButtonID);
if (stylusTarget) {

View file

@ -10,7 +10,7 @@
/* jslint bitwise: true */
/* global Script, Entities, MyAvatar, Controller, RIGHT_HAND, LEFT_HAND, AVATAR_SELF_ID, getControllerJointIndex, NULL_UUID,
/* global Script, Entities, MyAvatar, Controller, RIGHT_HAND, LEFT_HAND, AVATAR_SELF_ID, getControllerJointIndex,
enableDispatcherModule, disableDispatcherModule, Messages, makeDispatcherModuleParameters, makeRunningValues, Vec3,
LaserPointers, RayPick, HMD, Uuid, AvatarList
*/

View file

@ -8,7 +8,7 @@
/* jslint bitwise: true */
/* global Script, Controller, LaserPointers, RayPick, RIGHT_HAND, LEFT_HAND, Vec3, Quat, getGrabPointSphereOffset,
makeRunningValues, Entities, NULL_UUID, enableDispatcherModule, disableDispatcherModule, makeDispatcherModuleParameters,
makeRunningValues, Entities, enableDispatcherModule, disableDispatcherModule, makeDispatcherModuleParameters,
PICK_MAX_DISTANCE, COLORS_GRAB_SEARCHING_HALF_SQUEEZE, COLORS_GRAB_SEARCHING_FULL_SQUEEZE, COLORS_GRAB_DISTANCE_HOLD,
AVATAR_SELF_ID, DEFAULT_SEARCH_SPHERE_DISTANCE, TRIGGER_ON_VALUE, ZERO_VEC, Overlays
*/
@ -90,15 +90,15 @@ Script.include("/~/system/libraries/controllers.js");
var HAPTIC_STYLUS_DURATION = 20.0;
function laserTargetHasKeyboardFocus(laserTarget) {
if (laserTarget && laserTarget !== NULL_UUID) {
if (laserTarget && laserTarget !== Uuid.NULL) {
return Entities.keyboardFocusOverlay === laserTarget;
}
}
function setKeyboardFocusOnLaserTarget(laserTarget) {
if (laserTarget && laserTarget !== NULL_UUID) {
if (laserTarget && laserTarget !== Uuid.NULL) {
Entities.wantsHandControllerPointerEvents(laserTarget);
Overlays.keyboardFocusOverlay = NULL_UUID;
Overlays.keyboardFocusOverlay = Uuid.NULL;
Entities.keyboardFocusEntity = laserTarget;
}
}
@ -117,7 +117,7 @@ Script.include("/~/system/libraries/controllers.js");
button: "None"
};
if (laserTarget.entityID && laserTarget.entityID !== NULL_UUID) {
if (laserTarget.entityID && laserTarget.entityID !== Uuid.NULL) {
Entities.sendHoverEnterEntity(laserTarget.entityID, pointerEvent);
}
}
@ -137,7 +137,7 @@ Script.include("/~/system/libraries/controllers.js");
button: "None"
};
if (laserTarget.entityID && laserTarget.entityID !== NULL_UUID) {
if (laserTarget.entityID && laserTarget.entityID !== Uuid.NULL) {
Entities.sendMouseMoveOnEntity(laserTarget.entityID, pointerEvent);
Entities.sendHoverOverEntity(laserTarget.entityID, pointerEvent);
}
@ -156,7 +156,7 @@ Script.include("/~/system/libraries/controllers.js");
isPrimaryHeld: true
};
if (laserTarget.entityID && laserTarget.entityID !== NULL_UUID) {
if (laserTarget.entityID && laserTarget.entityID !== Uuid.NULL) {
Entities.sendMousePressOnEntity(laserTarget.entityID, pointerEvent);
Entities.sendClickDownOnEntity(laserTarget.entityID, pointerEvent);
}
@ -173,7 +173,7 @@ Script.include("/~/system/libraries/controllers.js");
button: "Primary"
};
if (laserTarget.entityID && laserTarget.entityID !== NULL_UUID) {
if (laserTarget.entityID && laserTarget.entityID !== Uuid.NULL) {
Entities.sendMouseReleaseOnEntity(laserTarget.entityID, pointerEvent);
Entities.sendClickReleaseOnEntity(laserTarget.entityID, pointerEvent);
Entities.sendHoverLeaveEntity(laserTarget.entityID, pointerEvent);
@ -192,7 +192,7 @@ Script.include("/~/system/libraries/controllers.js");
isPrimaryHeld: true
};
if (laserTarget.entityID && laserTarget.entityID !== NULL_UUID) {
if (laserTarget.entityID && laserTarget.entityID !== Uuid.NULL) {
Entities.sendMouseMoveOnEntity(laserTarget.entityID, pointerEvent);
Entities.sendHoldingClickOnEntity(laserTarget.entityID, pointerEvent);
}

View file

@ -1360,7 +1360,7 @@ function unparentSelectedEntities() {
}
selectedEntities.forEach(function (id, index) {
var parentId = Entities.getEntityProperties(id, ["parentID"]).parentID;
if (parentId !== null && parentId.length > 0 && parentId !== "{00000000-0000-0000-0000-000000000000}") {
if (parentId !== null && parentId.length > 0 && parentId !== Uuid.NULL) {
parentCheck = true;
}
Entities.editEntity(id, {parentID: null});

View file

@ -25,7 +25,6 @@ var ROT_LANDSCAPE = {x: 1.0, y: 1.0, z: 0, w: 0};
var ROT_LANDSCAPE_WINDOW = {x: 0.0, y: 0.0, z: 0.0, w: 0};
var TABLET_TEXTURE_RESOLUTION = { x: 480, y: 706 };
var INCHES_TO_METERS = 1 / 39.3701;
var AVATAR_SELF_ID = "{00000000-0000-0000-0000-000000000001}";
var NO_HANDS = -1;
var DELAY_FOR_30HZ = 33; // milliseconds
@ -100,7 +99,7 @@ WebTablet = function (url, width, dpi, hand, clientOnly, location, visible) {
"grabbableKey": {"grabbable": true}
}),
dimensions: { x: tabletWidth, y: tabletHeight, z: tabletDepth },
parentID: AVATAR_SELF_ID,
parentID: Uuid.SELF,
visible: visible
};
@ -414,7 +413,7 @@ WebTablet.prototype.register = function() {
WebTablet.prototype.cleanUpOldTabletsOnJoint = function(jointIndex) {
var children = Entities.getChildrenIDsOfJoint(MyAvatar.sessionUUID, jointIndex);
children = children.concat(Entities.getChildrenIDsOfJoint(AVATAR_SELF_ID, jointIndex));
children = children.concat(Entities.getChildrenIDsOfJoint(Uuid.SELF, jointIndex));
children.forEach(function(childID) {
var props = Entities.getEntityProperties(childID, ["name"]);
if (props.name === "WebTablet Tablet") {

View file

@ -7,7 +7,7 @@
/* global module, Camera, HMD, MyAvatar, controllerDispatcherPlugins:true, Quat, Vec3, Overlays, Xform,
MSECS_PER_SEC:true , LEFT_HAND:true, RIGHT_HAND:true, NULL_UUID:true, AVATAR_SELF_ID:true, FORBIDDEN_GRAB_TYPES:true,
MSECS_PER_SEC:true , LEFT_HAND:true, RIGHT_HAND:true, FORBIDDEN_GRAB_TYPES:true,
HAPTIC_PULSE_STRENGTH:true, HAPTIC_PULSE_DURATION:true, ZERO_VEC:true, ONE_VEC:true,
DEFAULT_REGISTRATION_POINT:true, INCHES_TO_METERS:true,
TRIGGER_OFF_VALUE:true,
@ -60,9 +60,6 @@ ONE_VEC = { x: 1, y: 1, z: 1 };
LEFT_HAND = 0;
RIGHT_HAND = 1;
NULL_UUID = "{00000000-0000-0000-0000-000000000000}";
AVATAR_SELF_ID = "{00000000-0000-0000-0000-000000000001}";
FORBIDDEN_GRAB_TYPES = ["Unknown", "Light", "PolyLine", "Zone"];
HAPTIC_PULSE_STRENGTH = 1.0;
@ -284,7 +281,7 @@ ensureDynamic = function (entityID) {
// if we distance hold something and keep it very still before releasing it, it ends up
// non-dynamic in bullet. If it's too still, give it a little bounce so it will fall.
var props = Entities.getEntityProperties(entityID, ["velocity", "dynamic", "parentID"]);
if (props.dynamic && props.parentID === NULL_UUID) {
if (props.dynamic && props.parentID === Uuid.NULL) {
var velocity = props.velocity;
if (Vec3.length(velocity) < 0.05) { // see EntityMotionState.cpp DYNAMIC_LINEAR_VELOCITY_THRESHOLD
velocity = { x: 0.0, y: 0.2, z: 0.0 };
@ -295,7 +292,7 @@ ensureDynamic = function (entityID) {
findGroupParent = function (controllerData, targetProps) {
while (targetProps.parentID &&
targetProps.parentID !== NULL_UUID &&
targetProps.parentID !== Uuid.NULL &&
Entities.getNestableType(targetProps.parentID) == "entity") {
var parentProps = Entities.getEntityProperties(targetProps.parentID, DISPATCHER_PROPERTIES);
if (!parentProps) {
@ -314,19 +311,19 @@ findHandChildEntities = function(hand) {
// find children of avatar's hand joint
var handJointIndex = MyAvatar.getJointIndex(hand === RIGHT_HAND ? "RightHand" : "LeftHand");
var children = Entities.getChildrenIDsOfJoint(MyAvatar.sessionUUID, handJointIndex);
children = children.concat(Entities.getChildrenIDsOfJoint(AVATAR_SELF_ID, handJointIndex));
children = children.concat(Entities.getChildrenIDsOfJoint(Uuid.SELF, handJointIndex));
// find children of faux controller joint
var controllerJointIndex = getControllerJointIndex(hand);
children = children.concat(Entities.getChildrenIDsOfJoint(MyAvatar.sessionUUID, controllerJointIndex));
children = children.concat(Entities.getChildrenIDsOfJoint(AVATAR_SELF_ID, controllerJointIndex));
children = children.concat(Entities.getChildrenIDsOfJoint(Uuid.SELF, controllerJointIndex));
// find children of faux camera-relative controller joint
var controllerCRJointIndex = MyAvatar.getJointIndex(hand === RIGHT_HAND ?
"_CAMERA_RELATIVE_CONTROLLER_RIGHTHAND" :
"_CAMERA_RELATIVE_CONTROLLER_LEFTHAND");
children = children.concat(Entities.getChildrenIDsOfJoint(MyAvatar.sessionUUID, controllerCRJointIndex));
children = children.concat(Entities.getChildrenIDsOfJoint(AVATAR_SELF_ID, controllerCRJointIndex));
children = children.concat(Entities.getChildrenIDsOfJoint(Uuid.SELF, controllerCRJointIndex));
return children.filter(function (childID) {
var childType = Entities.getNestableType(childID);

View file

@ -118,20 +118,12 @@ CameraManager = function() {
that.targetYaw = 0;
that.targetPitch = 0;
that.focalPoint = {
x: 0,
y: 0,
z: 0
};
that.targetFocalPoint = {
x: 0,
y: 0,
z: 0
};
that.focalPoint = Vec3.ZERO;
that.targetFocalPoint = Vec3.ZERO;
easing = false;
easingTime = 0;
startOrientation = Quat.fromPitchYawRollDegrees(0, 0, 0);
startOrientation = Quat.ZERO;
that.previousCameraMode = null;

View file

@ -71,44 +71,16 @@ SelectionManager = (function() {
that.selections = [];
var listeners = [];
that.localRotation = Quat.fromPitchYawRollDegrees(0, 0, 0);
that.localPosition = {
x: 0,
y: 0,
z: 0
};
that.localDimensions = {
x: 0,
y: 0,
z: 0
};
that.localRegistrationPoint = {
x: 0.5,
y: 0.5,
z: 0.5
};
that.localRotation = Quat.ZERO;
that.localPosition = Vec3.ZERO;
that.localDimensions = Vec3.ZERO;
that.localRegistrationPoint = Vec3.HALF;
that.worldRotation = Quat.fromPitchYawRollDegrees(0, 0, 0);
that.worldPosition = {
x: 0,
y: 0,
z: 0
};
that.worldDimensions = {
x: 0,
y: 0,
z: 0
};
that.worldRegistrationPoint = {
x: 0.5,
y: 0.5,
z: 0.5
};
that.centerPosition = {
x: 0,
y: 0,
z: 0
};
that.worldRotation = Quat.ZERO;
that.worldPosition = Vec3.ZERO;
that.worldDimensions = Vec3.ZERO;
that.worldRegistrationPoint = Vec3.HALF;
that.centerPosition = Vec3.ZERO;
that.saveProperties = function() {
that.savedProperties = {};
@ -350,11 +322,7 @@ SelectionDisplay = (function() {
};
var grabberLineWidth = 0.5;
var grabberSolid = true;
var grabberMoveUpPosition = {
x: 0,
y: 0,
z: 0
};
var grabberMoveUpPosition = Vec3.ZERO;
var lightOverlayColor = {
red: 255,
@ -363,11 +331,7 @@ SelectionDisplay = (function() {
};
var grabberPropertiesCorner = {
position: {
x: 0,
y: 0,
z: 0
},
position: Vec3.ZERO,
size: grabberSizeCorner,
color: grabberColorCorner,
alpha: 1,
@ -380,11 +344,7 @@ SelectionDisplay = (function() {
};
var grabberPropertiesEdge = {
position: {
x: 0,
y: 0,
z: 0
},
position: Vec3.ZERO,
size: grabberSizeEdge,
color: grabberColorEdge,
alpha: 1,
@ -397,11 +357,7 @@ SelectionDisplay = (function() {
};
var grabberPropertiesFace = {
position: {
x: 0,
y: 0,
z: 0
},
position: Vec3.ZERO,
size: grabberSizeFace,
color: grabberColorFace,
alpha: 1,
@ -414,11 +370,7 @@ SelectionDisplay = (function() {
};
var grabberPropertiesCloner = {
position: {
x: 0,
y: 0,
z: 0
},
position: Vec3.ZERO,
size: grabberSizeCorner,
color: grabberColorCloner,
alpha: 1,
@ -436,11 +388,7 @@ SelectionDisplay = (function() {
};
var highlightBox = Overlays.addOverlay("cube", {
position: {
x: 0,
y: 0,
z: 0
},
position: Vec3.ZERO,
size: 1,
color: {
red: 90,
@ -457,11 +405,7 @@ SelectionDisplay = (function() {
});
var selectionBox = Overlays.addOverlay("cube", {
position: {
x: 0,
y: 0,
z: 0
},
position: Vec3.ZERO,
size: 1,
color: {
red: 255,
@ -478,11 +422,7 @@ SelectionDisplay = (function() {
var selectionBoxes = [];
var rotationDegreesDisplay = Overlays.addOverlay("text3d", {
position: {
x: 0,
y: 0,
z: 0
},
position: Vec3.ZERO,
text: "",
color: {
red: 0,
@ -513,11 +453,7 @@ SelectionDisplay = (function() {
var grabberMoveUp = Overlays.addOverlay("image3d", {
url: HIFI_PUBLIC_BUCKET + "images/up-arrow.svg",
position: {
x: 0,
y: 0,
z: 0
},
position: Vec3.ZERO,
color: handleColor,
alpha: handleAlpha,
visible: false,
@ -720,16 +656,8 @@ SelectionDisplay = (function() {
var xRailOverlay = Overlays.addOverlay("line3d", {
visible: false,
lineWidth: 1.0,
start: {
x: 0,
y: 0,
z: 0
},
end: {
x: 0,
y: 0,
z: 0
},
start: Vec3.ZERO,
end: Vec3.ZERO,
color: {
red: 255,
green: 0,
@ -740,16 +668,8 @@ SelectionDisplay = (function() {
var yRailOverlay = Overlays.addOverlay("line3d", {
visible: false,
lineWidth: 1.0,
start: {
x: 0,
y: 0,
z: 0
},
end: {
x: 0,
y: 0,
z: 0
},
start: Vec3.ZERO,
end: Vec3.ZERO,
color: {
red: 0,
green: 255,
@ -760,16 +680,8 @@ SelectionDisplay = (function() {
var zRailOverlay = Overlays.addOverlay("line3d", {
visible: false,
lineWidth: 1.0,
start: {
x: 0,
y: 0,
z: 0
},
end: {
x: 0,
y: 0,
z: 0
},
start: Vec3.ZERO,
end: Vec3.ZERO,
color: {
red: 0,
green: 0,
@ -781,16 +693,8 @@ SelectionDisplay = (function() {
var rotateZeroOverlay = Overlays.addOverlay("line3d", {
visible: false,
lineWidth: 2.0,
start: {
x: 0,
y: 0,
z: 0
},
end: {
x: 0,
y: 0,
z: 0
},
start: Vec3.ZERO,
end: Vec3.ZERO,
color: {
red: 255,
green: 0,
@ -802,16 +706,8 @@ SelectionDisplay = (function() {
var rotateCurrentOverlay = Overlays.addOverlay("line3d", {
visible: false,
lineWidth: 2.0,
start: {
x: 0,
y: 0,
z: 0
},
end: {
x: 0,
y: 0,
z: 0
},
start: Vec3.ZERO,
end: Vec3.ZERO,
color: {
red: 0,
green: 0,
@ -822,11 +718,7 @@ SelectionDisplay = (function() {
var rotateOverlayInner = Overlays.addOverlay("circle3d", {
position: {
x: 0,
y: 0,
z: 0
},
position: Vec3.ZERO,
size: 1,
color: {
red: 51,
@ -856,11 +748,7 @@ SelectionDisplay = (function() {
});
var rotateOverlayOuter = Overlays.addOverlay("circle3d", {
position: {
x: 0,
y: 0,
z: 0
},
position: Vec3.ZERO,
size: 1,
color: {
red: 51,
@ -891,11 +779,7 @@ SelectionDisplay = (function() {
});
var rotateOverlayCurrent = Overlays.addOverlay("circle3d", {
position: {
x: 0,
y: 0,
z: 0
},
position: Vec3.ZERO,
size: 1,
color: {
red: 224,
@ -922,11 +806,7 @@ SelectionDisplay = (function() {
var yawHandle = Overlays.addOverlay("image3d", {
url: ROTATE_ARROW_WEST_NORTH_URL,
position: {
x: 0,
y: 0,
z: 0
},
position: Vec3.ZERO,
color: handleColor,
alpha: handleAlpha,
visible: false,
@ -939,11 +819,7 @@ SelectionDisplay = (function() {
var pitchHandle = Overlays.addOverlay("image3d", {
url: ROTATE_ARROW_WEST_NORTH_URL,
position: {
x: 0,
y: 0,
z: 0
},
position: Vec3.ZERO,
color: handleColor,
alpha: handleAlpha,
visible: false,
@ -956,11 +832,7 @@ SelectionDisplay = (function() {
var rollHandle = Overlays.addOverlay("image3d", {
url: ROTATE_ARROW_WEST_NORTH_URL,
position: {
x: 0,
y: 0,
z: 0
},
position: Vec3.ZERO,
color: handleColor,
alpha: handleAlpha,
visible: false,
@ -1636,7 +1508,7 @@ SelectionDisplay = (function() {
position = SelectionManager.localPosition;
registrationPoint = SelectionManager.localRegistrationPoint;
} else {
rotation = Quat.fromPitchYawRollDegrees(0, 0, 0);
rotation = Quat.ZERO;
dimensions = SelectionManager.worldDimensions;
position = SelectionManager.worldPosition;
registrationPoint = SelectionManager.worldRegistrationPoint;
@ -2692,7 +2564,7 @@ SelectionDisplay = (function() {
var onBegin = function(event, pickRay, pickResult) {
var properties = Entities.getEntityProperties(SelectionManager.selections[0]);
initialProperties = properties;
rotation = (spaceMode === SPACE_LOCAL) ? properties.rotation : Quat.fromPitchYawRollDegrees(0, 0, 0);
rotation = (spaceMode === SPACE_LOCAL) ? properties.rotation : Quat.ZERO;
if (spaceMode === SPACE_LOCAL) {
rotation = SelectionManager.localRotation;

View file

@ -18,7 +18,7 @@ OverlayGroup = function(opts) {
var overlays = {};
var rootPosition = opts.position || { x: 0, y: 0, z: 0 };
var rootRotation = opts.rotation || Quat.fromPitchYawRollRadians(0, 0, 0);
var rootRotation = opts.rotation || Quat.ZERO;
var visible = opts.visible == true;
function updateOverlays() {
@ -36,7 +36,7 @@ OverlayGroup = function(opts) {
that.createOverlay = function(type, properties) {
properties.position = properties.position || { x: 0, y: 0, z: 0 };
properties.rotation = properties.rotation || Quat.fromPitchYawRollRadians(0, 0, 0);
properties.rotation = properties.rotation || Quat.ZERO;
var overlay = Overlays.addOverlay(type, properties);

View file

@ -6,28 +6,28 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
/* global Script, Entities, MyAvatar, Controller, RIGHT_HAND, LEFT_HAND,
controllerDispatcher.NULL_UUID, enableDispatcherModule, disableDispatcherModule, makeRunningValues,
enableDispatcherModule, disableDispatcherModule, makeRunningValues,
Messages, Quat, Vec3, getControllerWorldLocation, makeDispatcherModuleParameters, Overlays, controllerDispatcher.ZERO_VEC,
AVATAR_SELF_ID, HMD, INCHES_TO_METERS, DEFAULT_REGISTRATION_POINT, Settings, getGrabPointSphereOffset
*/
var controllerDispatcher = Script.require("/~/system/libraries/controllerDispatcherUtils.js");
function touchTargetHasKeyboardFocus(touchTarget) {
if (touchTarget.entityID && touchTarget.entityID !== controllerDispatcher.NULL_UUID) {
if (touchTarget.entityID && touchTarget.entityID !== Uuid.NULL) {
return Entities.keyboardFocusEntity === touchTarget.entityID;
} else if (touchTarget.overlayID && touchTarget.overlayID !== controllerDispatcher.NULL_UUID) {
} else if (touchTarget.overlayID && touchTarget.overlayID !== Uuid.NULL) {
return Overlays.keyboardFocusOverlay === touchTarget.overlayID;
}
}
function setKeyboardFocusOnTouchTarget(touchTarget) {
if (touchTarget.entityID && touchTarget.entityID !== controllerDispatcher.NULL_UUID &&
if (touchTarget.entityID && touchTarget.entityID !== Uuid.NULL &&
Entities.wantsHandControllerPointerEvents(touchTarget.entityID)) {
Overlays.keyboardFocusOverlay = controllerDispatcher.NULL_UUID;
Overlays.keyboardFocusOverlay = Uuid.NULL;
Entities.keyboardFocusEntity = touchTarget.entityID;
} else if (touchTarget.overlayID && touchTarget.overlayID !== controllerDispatcher.NULL_UUID) {
} else if (touchTarget.overlayID && touchTarget.overlayID !== Uuid.NULL) {
Overlays.keyboardFocusOverlay = touchTarget.overlayID;
Entities.keyboardFocusEntity = controllerDispatcher.NULL_UUID;
Entities.keyboardFocusEntity = Uuid.NULL;
}
}
@ -42,9 +42,9 @@ function sendHoverEnterEventToTouchTarget(hand, touchTarget) {
button: "None"
};
if (touchTarget.entityID && touchTarget.entityID !== controllerDispatcher.NULL_UUID) {
if (touchTarget.entityID && touchTarget.entityID !== Uuid.NULL) {
Entities.sendHoverEnterEntity(touchTarget.entityID, pointerEvent);
} else if (touchTarget.overlayID && touchTarget.overlayID !== controllerDispatcher.NULL_UUID) {
} else if (touchTarget.overlayID && touchTarget.overlayID !== Uuid.NULL) {
Overlays.sendHoverEnterOverlay(touchTarget.overlayID, pointerEvent);
}
}
@ -60,10 +60,10 @@ function sendHoverOverEventToTouchTarget(hand, touchTarget) {
button: "None"
};
if (touchTarget.entityID && touchTarget.entityID !== controllerDispatcher.NULL_UUID) {
if (touchTarget.entityID && touchTarget.entityID !== Uuid.NULL) {
Entities.sendMouseMoveOnEntity(touchTarget.entityID, pointerEvent);
Entities.sendHoverOverEntity(touchTarget.entityID, pointerEvent);
} else if (touchTarget.overlayID && touchTarget.overlayID !== controllerDispatcher.NULL_UUID) {
} else if (touchTarget.overlayID && touchTarget.overlayID !== Uuid.NULL) {
Overlays.sendMouseMoveOnOverlay(touchTarget.overlayID, pointerEvent);
Overlays.sendHoverOverOverlay(touchTarget.overlayID, pointerEvent);
}
@ -81,10 +81,10 @@ function sendTouchStartEventToTouchTarget(hand, touchTarget) {
isPrimaryHeld: true
};
if (touchTarget.entityID && touchTarget.entityID !== controllerDispatcher.NULL_UUID) {
if (touchTarget.entityID && touchTarget.entityID !== Uuid.NULL) {
Entities.sendMousePressOnEntity(touchTarget.entityID, pointerEvent);
Entities.sendClickDownOnEntity(touchTarget.entityID, pointerEvent);
} else if (touchTarget.overlayID && touchTarget.overlayID !== controllerDispatcher.NULL_UUID) {
} else if (touchTarget.overlayID && touchTarget.overlayID !== Uuid.NULL) {
Overlays.sendMousePressOnOverlay(touchTarget.overlayID, pointerEvent);
}
}
@ -100,11 +100,11 @@ function sendTouchEndEventToTouchTarget(hand, touchTarget) {
button: "Primary"
};
if (touchTarget.entityID && touchTarget.entityID !== controllerDispatcher.NULL_UUID) {
if (touchTarget.entityID && touchTarget.entityID !== Uuid.NULL) {
Entities.sendMouseReleaseOnEntity(touchTarget.entityID, pointerEvent);
Entities.sendClickReleaseOnEntity(touchTarget.entityID, pointerEvent);
Entities.sendHoverLeaveEntity(touchTarget.entityID, pointerEvent);
} else if (touchTarget.overlayID && touchTarget.overlayID !== controllerDispatcher.NULL_UUID) {
} else if (touchTarget.overlayID && touchTarget.overlayID !== Uuid.NULL) {
Overlays.sendMouseReleaseOnOverlay(touchTarget.overlayID, pointerEvent);
}
}
@ -121,10 +121,10 @@ function sendTouchMoveEventToTouchTarget(hand, touchTarget) {
isPrimaryHeld: true
};
if (touchTarget.entityID && touchTarget.entityID !== controllerDispatcher.NULL_UUID) {
if (touchTarget.entityID && touchTarget.entityID !== Uuid.NULL) {
Entities.sendMouseMoveOnEntity(touchTarget.entityID, pointerEvent);
Entities.sendHoldingClickOnEntity(touchTarget.entityID, pointerEvent);
} else if (touchTarget.overlayID && touchTarget.overlayID !== controllerDispatcher.NULL_UUID) {
} else if (touchTarget.overlayID && touchTarget.overlayID !== Uuid.NULL) {
Overlays.sendMouseMoveOnOverlay(touchTarget.overlayID, pointerEvent);
}
}

View file

@ -13,7 +13,6 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
const CLIENTONLY = false;
const NULL_UUID = "{00000000-0000-0000-0000-000000000000}";
const ENTITY_CHECK_INTERVAL = 5000; // ms = 5 seconds
const STARTUP_DELAY = 2000; // ms = 2 second
const OLD_AGE = 3500; // we recreate the entity if older than this time in seconds
@ -24,7 +23,7 @@ const SIZE_Y = 0.075;
const LETTER_OFFSET = 0.03; // arbitrary value to dynamically change width, could be more accurate by detecting characters
const LINE_HEIGHT = 0.05;
var nameTagEntityID = NULL_UUID;
var nameTagEntityID = Uuid.NULL;
var lastCheckForEntity = 0;
// create the name tag entity after a brief delay
@ -62,9 +61,9 @@ function updateNameTag() {
};
function deleteNameTag() {
if(nameTagEntityID !== NULL_UUID) {
if(nameTagEntityID !== Uuid.NULL) {
Entities.deleteEntity(nameTagEntityID);
nameTagEntityID = NULL_UUID;
nameTagEntityID = Uuid.NULL;
}
}
@ -85,7 +84,7 @@ function cleanup() {
Script.update.connect(update);
function update() {
// if no entity we return
if(nameTagEntityID == NULL_UUID) {
if(nameTagEntityID == Uuid.NULL) {
return;
}

View file

@ -14,7 +14,6 @@
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
var NULL_UUID = "{00000000-0000-0000-0000-000000000000}";
var LIFETIME = 3600;
var BALL_SIZE = 0.175;
var BALL_DAMPING = 0.5;