mirror of
https://github.com/overte-org/overte.git
synced 2025-04-08 08:14:48 +02:00
V8 fixes, incl. enum API objects fix
This commit is contained in:
parent
4cfde4bcc1
commit
4f4c8931a9
11 changed files with 98 additions and 85 deletions
|
@ -1558,6 +1558,7 @@ void ScriptManager::include(const QStringList& includeFiles, const ScriptValue&
|
|||
thisURL = expandScriptUrl(QUrl::fromLocalFile(expandScriptPath(file)));
|
||||
QUrl defaultScriptsLoc = PathUtils::defaultScriptsLocation();
|
||||
if (!defaultScriptsLoc.isParentOf(thisURL)) {
|
||||
//V8TODO this probably needs to be done per context, otherwise file cannot be included again in a module
|
||||
scriptWarningMessage("Script.include() -- skipping" + file + "-- outside of standard libraries");
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -490,7 +490,14 @@ void ScriptEngineV8::registerValue(const QString& valueName, V8ScriptValue value
|
|||
partsToGo--;
|
||||
v8::Local<v8::String> pathPartV8 = v8::String::NewFromUtf8(_v8Isolate, pathPart.toStdString().c_str(),v8::NewStringType::kNormal).ToLocalChecked();
|
||||
v8::Local<v8::Value> currentPath;
|
||||
bool createProperty = false;
|
||||
if (!partObject->Get(context, pathPartV8).ToLocal(¤tPath)) {
|
||||
createProperty = true;
|
||||
}
|
||||
if (currentPath->IsUndefined()) {
|
||||
createProperty = true;
|
||||
}
|
||||
if (createProperty) {
|
||||
if (partsToGo > 0) {
|
||||
//This was commented out
|
||||
//QObject *object = new QObject;
|
||||
|
@ -507,10 +514,19 @@ void ScriptEngineV8::registerValue(const QString& valueName, V8ScriptValue value
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> child;
|
||||
if (!partObject->Get(context, pathPartV8).ToLocal(&child)) {
|
||||
Q_ASSERT(false);
|
||||
}
|
||||
if (partsToGo > 0) {
|
||||
if (!child->IsObject()) {
|
||||
QString details = *v8::String::Utf8Value(_v8Isolate, child->ToDetailString(context).ToLocalChecked());
|
||||
qCDebug(scriptengine) << "ScriptEngineV8::registerValue: Part of path is not an object: " << pathPart << " details: " << details;
|
||||
Q_ASSERT(false);
|
||||
}
|
||||
partObject = v8::Local<v8::Object>::Cast(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -305,10 +305,10 @@ bool ScriptEngineV8::castValueToVariant(const V8ScriptValue& v8Val, QVariant& de
|
|||
const v8::Local<v8::Value> val = v8Val.constGet();
|
||||
|
||||
// Conversion debugging:
|
||||
if (destTypeId == QMetaType::QVariant && val->IsBoolean()) {
|
||||
/*if (destTypeId == QMetaType::QVariant && val->IsBoolean()) {
|
||||
//It's for placing breakpoint here
|
||||
qDebug() << "Conversion Debug: " << scriptValueDebugDetailsV8(v8Val);
|
||||
}
|
||||
}*/
|
||||
|
||||
// if we're not particularly interested in a specific type, try to detect if we're dealing with a registered type
|
||||
if (destTypeId == QMetaType::UnknownType) {
|
||||
|
|
|
@ -414,7 +414,7 @@ void ScriptObjectV8Proxy::v8Get(v8::Local<v8::Name> name, const v8::PropertyCall
|
|||
void ScriptObjectV8Proxy::v8Set(v8::Local<v8::Name> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info) {
|
||||
v8::HandleScope handleScope(info.GetIsolate());
|
||||
v8::String::Utf8Value utf8Value(info.GetIsolate(), name);
|
||||
qDebug(scriptengine) << "Set: " << *utf8Value;
|
||||
//qDebug(scriptengine) << "Set: " << *utf8Value;
|
||||
V8ScriptValue object(info.GetIsolate(), info.This());
|
||||
ScriptObjectV8Proxy *proxy = ScriptObjectV8Proxy::unwrapProxy(object);
|
||||
if (!proxy) {
|
||||
|
@ -683,10 +683,6 @@ void ScriptMethodV8Proxy::call(const v8::FunctionCallbackInfo<v8::Value>& argume
|
|||
int bestMeta = 0;
|
||||
int bestConversionPenaltyScore = 0;
|
||||
|
||||
if(fullName() == "SettingsScriptingInterface::getValue") {
|
||||
printf("SettingsScriptingInterface::getValue");
|
||||
}
|
||||
|
||||
for (int i = 0; i < num_metas; i++) {
|
||||
const QMetaMethod& meta = _metas[i];
|
||||
int methodNumArgs = meta.parameterCount();
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
PointerManager, print, Keyboard
|
||||
*/
|
||||
|
||||
controllerDispatcherPlugins = {};
|
||||
controllerDispatcherPluginsNeedSort = false;
|
||||
var controllerDispatcherPlugins = {};
|
||||
var controllerDispatcherPluginsNeedSort = false;
|
||||
|
||||
Script.include("/~/system/libraries/utils.js");
|
||||
Script.include("/~/system/libraries/controllers.js");
|
||||
|
|
|
@ -3077,7 +3077,7 @@ mapping.from([Controller.Hardware.Keyboard.P])
|
|||
.when([Controller.Hardware.Keyboard.Control, !Controller.Hardware.Keyboard.Shift])
|
||||
.to(whenReleased(function() { parentSelectedEntities(); }));
|
||||
|
||||
keyUpEventFromUIWindow = function(keyUpEvent) {
|
||||
var keyUpEventFromUIWindow = function(keyUpEvent) {
|
||||
var WANT_DEBUG_MISSING_SHORTCUTS = false;
|
||||
|
||||
var pressedValue = 0.0;
|
||||
|
|
|
@ -30,7 +30,7 @@ const PROFILE = !PROFILING_ENABLED ? PROFILE_NOOP : function(name, fn, args) {
|
|||
console.log("PROFILE-Script " + profileIndent + "(" + name + ") End " + delta + "ms");
|
||||
};
|
||||
|
||||
EntityListTool = function(shouldUseEditTabletApp) {
|
||||
var EntityListTool = function(shouldUseEditTabletApp) {
|
||||
var that = {};
|
||||
|
||||
var CreateWindow = Script.require('../modules/createWindow.js');
|
||||
|
|
|
@ -31,14 +31,14 @@ if (typeof Object.assign !== 'function') {
|
|||
};
|
||||
}
|
||||
|
||||
entityIsCloneable = function(props) {
|
||||
var entityIsCloneable = function(props) {
|
||||
if (props) {
|
||||
return props.cloneable;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
propsAreCloneDynamic = function(props) {
|
||||
var propsAreCloneDynamic = function(props) {
|
||||
var cloneable = entityIsCloneable(props);
|
||||
if (cloneable) {
|
||||
return props.cloneDynamic;
|
||||
|
@ -46,7 +46,7 @@ propsAreCloneDynamic = function(props) {
|
|||
return false;
|
||||
};
|
||||
|
||||
cloneEntity = function(props) {
|
||||
var cloneEntity = function(props) {
|
||||
var entityIDToClone = props.id;
|
||||
if (entityIsCloneable(props) &&
|
||||
(Uuid.isNull(props.certificateID) || props.certificateType.indexOf('domainUnlimited') >= 0)) {
|
||||
|
|
|
@ -68,50 +68,50 @@
|
|||
handsAreTracked: true
|
||||
*/
|
||||
|
||||
MSECS_PER_SEC = 1000.0;
|
||||
INCHES_TO_METERS = 1.0 / 39.3701;
|
||||
var MSECS_PER_SEC = 1000.0;
|
||||
var INCHES_TO_METERS = 1.0 / 39.3701;
|
||||
|
||||
HAPTIC_PULSE_STRENGTH = 1.0;
|
||||
HAPTIC_PULSE_DURATION = 13.0;
|
||||
var HAPTIC_PULSE_STRENGTH = 1.0;
|
||||
var HAPTIC_PULSE_DURATION = 13.0;
|
||||
|
||||
ZERO_VEC = { x: 0, y: 0, z: 0 };
|
||||
ONE_VEC = { x: 1, y: 1, z: 1 };
|
||||
var ZERO_VEC = { x: 0, y: 0, z: 0 };
|
||||
var ONE_VEC = { x: 1, y: 1, z: 1 };
|
||||
|
||||
LEFT_HAND = 0;
|
||||
RIGHT_HAND = 1;
|
||||
var LEFT_HAND = 0;
|
||||
var RIGHT_HAND = 1;
|
||||
|
||||
FORBIDDEN_GRAB_TYPES = ["Unknown", "Light", "PolyLine", "Zone"];
|
||||
var FORBIDDEN_GRAB_TYPES = ["Unknown", "Light", "PolyLine", "Zone"];
|
||||
|
||||
HAPTIC_PULSE_STRENGTH = 1.0;
|
||||
HAPTIC_PULSE_DURATION = 13.0;
|
||||
var HAPTIC_PULSE_STRENGTH = 1.0;
|
||||
var HAPTIC_PULSE_DURATION = 13.0;
|
||||
|
||||
DEFAULT_REGISTRATION_POINT = { x: 0.5, y: 0.5, z: 0.5 };
|
||||
var DEFAULT_REGISTRATION_POINT = { x: 0.5, y: 0.5, z: 0.5 };
|
||||
|
||||
TRIGGER_OFF_VALUE = 0.1;
|
||||
TRIGGER_ON_VALUE = TRIGGER_OFF_VALUE + 0.05; // Squeezed just enough to activate search or near grab
|
||||
BUMPER_ON_VALUE = 0.5;
|
||||
var TRIGGER_OFF_VALUE = 0.1;
|
||||
var TRIGGER_ON_VALUE = TRIGGER_OFF_VALUE + 0.05; // Squeezed just enough to activate search or near grab
|
||||
var BUMPER_ON_VALUE = 0.5;
|
||||
|
||||
PICK_MAX_DISTANCE = 500; // max length of pick-ray
|
||||
DEFAULT_SEARCH_SPHERE_DISTANCE = 1000; // how far from camera to search intersection?
|
||||
NEAR_GRAB_PICK_RADIUS = 0.25; // radius used for search ray vs object for near grabbing.
|
||||
var PICK_MAX_DISTANCE = 500; // max length of pick-ray
|
||||
var DEFAULT_SEARCH_SPHERE_DISTANCE = 1000; // how far from camera to search intersection?
|
||||
var NEAR_GRAB_PICK_RADIUS = 0.25; // radius used for search ray vs object for near grabbing.
|
||||
|
||||
COLORS_GRAB_SEARCHING_HALF_SQUEEZE = { red: 10, green: 10, blue: 255 };
|
||||
COLORS_GRAB_SEARCHING_FULL_SQUEEZE = { red: 250, green: 10, blue: 10 };
|
||||
COLORS_GRAB_DISTANCE_HOLD = { red: 238, green: 75, blue: 214 };
|
||||
var COLORS_GRAB_SEARCHING_HALF_SQUEEZE = { red: 10, green: 10, blue: 255 };
|
||||
var COLORS_GRAB_SEARCHING_FULL_SQUEEZE = { red: 250, green: 10, blue: 10 };
|
||||
var COLORS_GRAB_DISTANCE_HOLD = { red: 238, green: 75, blue: 214 };
|
||||
|
||||
NEAR_GRAB_RADIUS = 1.0;
|
||||
var NEAR_GRAB_RADIUS = 1.0;
|
||||
|
||||
TEAR_AWAY_DISTANCE = 0.15; // ungrab an entity if its bounding-box moves this far from the hand
|
||||
TEAR_AWAY_COUNT = 2; // multiply by TEAR_AWAY_CHECK_TIME to know how long the item must be away
|
||||
TEAR_AWAY_CHECK_TIME = 0.15; // seconds, duration between checks
|
||||
var TEAR_AWAY_DISTANCE = 0.15; // ungrab an entity if its bounding-box moves this far from the hand
|
||||
var TEAR_AWAY_COUNT = 2; // multiply by TEAR_AWAY_CHECK_TIME to know how long the item must be away
|
||||
var TEAR_AWAY_CHECK_TIME = 0.15; // seconds, duration between checks
|
||||
|
||||
TELEPORT_DEADZONE = 0.15;
|
||||
var TELEPORT_DEADZONE = 0.15;
|
||||
|
||||
NEAR_GRAB_DISTANCE = 0.14; // Grab an entity if its bounding box is within this distance.
|
||||
var NEAR_GRAB_DISTANCE = 0.14; // Grab an entity if its bounding box is within this distance.
|
||||
// Smaller than TEAR_AWAY_DISTANCE for hysteresis.
|
||||
|
||||
DISPATCHER_HOVERING_LIST = "dispatcherHoveringList";
|
||||
DISPATCHER_HOVERING_STYLE = {
|
||||
var DISPATCHER_HOVERING_LIST = "dispatcherHoveringList";
|
||||
var DISPATCHER_HOVERING_STYLE = {
|
||||
isOutlineSmooth: true,
|
||||
outlineWidth: 0,
|
||||
outlineUnoccludedColor: {red: 255, green: 128, blue: 128},
|
||||
|
@ -124,7 +124,7 @@ DISPATCHER_HOVERING_STYLE = {
|
|||
fillOccludedAlpha: 0.0
|
||||
};
|
||||
|
||||
DISPATCHER_PROPERTIES = [
|
||||
var DISPATCHER_PROPERTIES = [
|
||||
"position",
|
||||
"registrationPoint",
|
||||
"rotation",
|
||||
|
@ -169,7 +169,7 @@ DISPATCHER_PROPERTIES = [
|
|||
// activitySlots -- indicates which "slots" must not yet be in use for this module to start
|
||||
// requiredDataForReady -- which "situation" parts this module looks at to decide if it will start
|
||||
// sleepMSBetweenRuns -- how long to wait between calls to this module's "run" method
|
||||
makeDispatcherModuleParameters = function (priority, activitySlots, requiredDataForReady, sleepMSBetweenRuns, enableLaserForHand) {
|
||||
var makeDispatcherModuleParameters = function (priority, activitySlots, requiredDataForReady, sleepMSBetweenRuns, enableLaserForHand) {
|
||||
if (enableLaserForHand === undefined) {
|
||||
enableLaserForHand = -1;
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ makeDispatcherModuleParameters = function (priority, activitySlots, requiredData
|
|||
};
|
||||
};
|
||||
|
||||
makeLaserLockInfo = function(targetID, isOverlay, hand, offset) {
|
||||
var makeLaserLockInfo = function(targetID, isOverlay, hand, offset) {
|
||||
return {
|
||||
targetID: targetID,
|
||||
isOverlay: isOverlay,
|
||||
|
@ -192,7 +192,7 @@ makeLaserLockInfo = function(targetID, isOverlay, hand, offset) {
|
|||
};
|
||||
};
|
||||
|
||||
makeLaserParams = function(hand, alwaysOn) {
|
||||
var makeLaserParams = function(hand, alwaysOn) {
|
||||
if (alwaysOn === undefined) {
|
||||
alwaysOn = false;
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ makeLaserParams = function(hand, alwaysOn) {
|
|||
};
|
||||
};
|
||||
|
||||
makeRunningValues = function (active, targets, requiredDataForRun, laserLockInfo) {
|
||||
var makeRunningValues = function (active, targets, requiredDataForRun, laserLockInfo) {
|
||||
return {
|
||||
active: active,
|
||||
targets: targets,
|
||||
|
@ -212,7 +212,7 @@ makeRunningValues = function (active, targets, requiredDataForRun, laserLockInfo
|
|||
};
|
||||
};
|
||||
|
||||
enableDispatcherModule = function (moduleName, module, priority) {
|
||||
var enableDispatcherModule = function (moduleName, module, priority) {
|
||||
if (!controllerDispatcherPlugins) {
|
||||
controllerDispatcherPlugins = {};
|
||||
}
|
||||
|
@ -220,19 +220,19 @@ enableDispatcherModule = function (moduleName, module, priority) {
|
|||
controllerDispatcherPluginsNeedSort = true;
|
||||
};
|
||||
|
||||
disableDispatcherModule = function (moduleName) {
|
||||
var disableDispatcherModule = function (moduleName) {
|
||||
delete controllerDispatcherPlugins[moduleName];
|
||||
controllerDispatcherPluginsNeedSort = true;
|
||||
};
|
||||
|
||||
getEnabledModuleByName = function (moduleName) {
|
||||
var getEnabledModuleByName = function (moduleName) {
|
||||
if (controllerDispatcherPlugins.hasOwnProperty(moduleName)) {
|
||||
return controllerDispatcherPlugins[moduleName];
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
getGrabbableData = function (ggdProps) {
|
||||
var getGrabbableData = function (ggdProps) {
|
||||
// look in userData for a "grabbable" key, return the value or some defaults
|
||||
var grabbableData = {};
|
||||
var userDataParsed = null;
|
||||
|
@ -297,7 +297,7 @@ getGrabbableData = function (ggdProps) {
|
|||
return grabbableData;
|
||||
};
|
||||
|
||||
isAnothersAvatarEntity = function (iaaeProps) {
|
||||
var isAnothersAvatarEntity = function (iaaeProps) {
|
||||
if (!iaaeProps.avatarEntity) {
|
||||
return false;
|
||||
}
|
||||
|
@ -310,7 +310,7 @@ isAnothersAvatarEntity = function (iaaeProps) {
|
|||
return true;
|
||||
};
|
||||
|
||||
isAnothersChildEntity = function (iaceProps) {
|
||||
var isAnothersChildEntity = function (iaceProps) {
|
||||
while (iaceProps.parentID && iaceProps.parentID !== Uuid.NULL) {
|
||||
if (Entities.getNestableType(iaceProps.parentID) == "avatar") {
|
||||
if (iaceProps.parentID == MyAvatar.SELF_ID || iaceProps.parentID == MyAvatar.sessionUUID) {
|
||||
|
@ -330,7 +330,7 @@ isAnothersChildEntity = function (iaceProps) {
|
|||
};
|
||||
|
||||
|
||||
entityIsEquippable = function (eieProps) {
|
||||
var entityIsEquippable = function (eieProps) {
|
||||
var grabbable = getGrabbableData(eieProps).grabbable;
|
||||
if (!grabbable ||
|
||||
isAnothersAvatarEntity(eieProps) ||
|
||||
|
@ -341,7 +341,7 @@ entityIsEquippable = function (eieProps) {
|
|||
return true;
|
||||
};
|
||||
|
||||
entityIsGrabbable = function (eigProps) {
|
||||
var entityIsGrabbable = function (eigProps) {
|
||||
var grabbable = getGrabbableData(eigProps).grabbable;
|
||||
if (!grabbable ||
|
||||
eigProps.locked ||
|
||||
|
@ -351,19 +351,19 @@ entityIsGrabbable = function (eigProps) {
|
|||
return true;
|
||||
};
|
||||
|
||||
clearHighlightedEntities = function() {
|
||||
var clearHighlightedEntities = function() {
|
||||
Selection.clearSelectedItemsList(DISPATCHER_HOVERING_LIST);
|
||||
};
|
||||
|
||||
highlightTargetEntity = function(entityID) {
|
||||
var highlightTargetEntity = function(entityID) {
|
||||
Selection.addToSelectedItemsList(DISPATCHER_HOVERING_LIST, "entity", entityID);
|
||||
};
|
||||
|
||||
unhighlightTargetEntity = function(entityID) {
|
||||
var unhighlightTargetEntity = function(entityID) {
|
||||
Selection.removeFromSelectedItemsList(DISPATCHER_HOVERING_LIST, "entity", entityID);
|
||||
};
|
||||
|
||||
entityIsDistanceGrabbable = function(eidgProps) {
|
||||
var entityIsDistanceGrabbable = function(eidgProps) {
|
||||
if (!entityIsGrabbable(eidgProps)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -377,10 +377,10 @@ entityIsDistanceGrabbable = function(eidgProps) {
|
|||
return true;
|
||||
};
|
||||
|
||||
getControllerJointIndexCacheTime = [0, 0];
|
||||
getControllerJointIndexCache = [-1, -1];
|
||||
var getControllerJointIndexCacheTime = [0, 0];
|
||||
var getControllerJointIndexCache = [-1, -1];
|
||||
|
||||
getControllerJointIndex = function (hand) {
|
||||
var getControllerJointIndex = function (hand) {
|
||||
var GET_CONTROLLERJOINTINDEX_CACHE_REFRESH_TIME = 3000; // msecs
|
||||
|
||||
var now = Date.now();
|
||||
|
@ -400,7 +400,7 @@ getControllerJointIndex = function (hand) {
|
|||
return -1;
|
||||
};
|
||||
|
||||
propsArePhysical = function (papProps) {
|
||||
var propsArePhysical = function (papProps) {
|
||||
if (!papProps.dynamic) {
|
||||
return false;
|
||||
}
|
||||
|
@ -408,7 +408,7 @@ propsArePhysical = function (papProps) {
|
|||
return isPhysical;
|
||||
};
|
||||
|
||||
projectOntoXYPlane = function (worldPos, position, rotation, dimensions, registrationPoint) {
|
||||
var projectOntoXYPlane = function (worldPos, position, rotation, dimensions, registrationPoint) {
|
||||
var invRot = Quat.inverse(rotation);
|
||||
var localPos = Vec3.multiplyQbyV(invRot, Vec3.subtract(worldPos, position));
|
||||
var invDimensions = {
|
||||
|
@ -424,12 +424,12 @@ projectOntoXYPlane = function (worldPos, position, rotation, dimensions, registr
|
|||
};
|
||||
};
|
||||
|
||||
projectOntoEntityXYPlane = function (entityID, worldPos, popProps) {
|
||||
var projectOntoEntityXYPlane = function (entityID, worldPos, popProps) {
|
||||
return projectOntoXYPlane(worldPos, popProps.position, popProps.rotation,
|
||||
popProps.dimensions, popProps.registrationPoint);
|
||||
};
|
||||
|
||||
projectOntoOverlayXYPlane = function projectOntoOverlayXYPlane(overlayID, worldPos) {
|
||||
var projectOntoOverlayXYPlane = function projectOntoOverlayXYPlane(overlayID, worldPos) {
|
||||
var position = Overlays.getProperty(overlayID, "position");
|
||||
var rotation = Overlays.getProperty(overlayID, "rotation");
|
||||
var dimensions = Overlays.getProperty(overlayID, "dimensions");
|
||||
|
@ -438,11 +438,11 @@ projectOntoOverlayXYPlane = function projectOntoOverlayXYPlane(overlayID, worldP
|
|||
return projectOntoXYPlane(worldPos, position, rotation, dimensions, DEFAULT_REGISTRATION_POINT);
|
||||
};
|
||||
|
||||
entityHasActions = function (entityID) {
|
||||
var entityHasActions = function (entityID) {
|
||||
return Entities.getActionIDs(entityID).length > 0;
|
||||
};
|
||||
|
||||
ensureDynamic = function (entityID) {
|
||||
var 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 edProps = Entities.getEntityProperties(entityID, ["velocity", "dynamic", "parentID"]);
|
||||
|
@ -455,7 +455,7 @@ ensureDynamic = function (entityID) {
|
|||
}
|
||||
};
|
||||
|
||||
findGrabbableGroupParent = function (controllerData, targetProps) {
|
||||
var findGrabbableGroupParent = function (controllerData, targetProps) {
|
||||
while (targetProps.grab.grabDelegateToParent &&
|
||||
targetProps.parentID &&
|
||||
targetProps.parentID !== Uuid.NULL &&
|
||||
|
@ -475,7 +475,7 @@ findGrabbableGroupParent = function (controllerData, targetProps) {
|
|||
return targetProps;
|
||||
};
|
||||
|
||||
getEntityParents = function(targetProps) {
|
||||
var getEntityParents = function(targetProps) {
|
||||
var parentProperties = [];
|
||||
while (targetProps.parentID &&
|
||||
targetProps.parentID !== Uuid.NULL &&
|
||||
|
@ -493,7 +493,7 @@ getEntityParents = function(targetProps) {
|
|||
};
|
||||
|
||||
|
||||
findHandChildEntities = function(hand) {
|
||||
var 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);
|
||||
|
@ -517,7 +517,7 @@ findHandChildEntities = function(hand) {
|
|||
});
|
||||
};
|
||||
|
||||
findFarGrabJointChildEntities = function(hand) {
|
||||
var findFarGrabJointChildEntities = function(hand) {
|
||||
// find children of avatar's far-grab joint
|
||||
var farGrabJointIndex = MyAvatar.getJointIndex(hand === RIGHT_HAND ? "_FARGRAB_RIGHTHAND" : "_FARGRAB_LEFTHAND");
|
||||
var children = Entities.getChildrenIDsOfJoint(MyAvatar.sessionUUID, farGrabJointIndex);
|
||||
|
@ -529,7 +529,7 @@ findFarGrabJointChildEntities = function(hand) {
|
|||
});
|
||||
};
|
||||
|
||||
distanceBetweenEntityLocalPositionAndBoundingBox = function(entityProps, jointGrabOffset) {
|
||||
var distanceBetweenEntityLocalPositionAndBoundingBox = function(entityProps, jointGrabOffset) {
|
||||
var DEFAULT_REGISTRATION_POINT = { x: 0.5, y: 0.5, z: 0.5 };
|
||||
var rotInv = Quat.inverse(entityProps.localRotation);
|
||||
var localPosition = Vec3.sum(entityProps.localPosition, jointGrabOffset);
|
||||
|
@ -553,7 +553,7 @@ distanceBetweenEntityLocalPositionAndBoundingBox = function(entityProps, jointGr
|
|||
return Vec3.distance(v, localPoint);
|
||||
};
|
||||
|
||||
distanceBetweenPointAndEntityBoundingBox = function(point, entityProps) {
|
||||
var distanceBetweenPointAndEntityBoundingBox = function(point, entityProps) {
|
||||
var entityXform = new Xform(entityProps.rotation, entityProps.position);
|
||||
var localPoint = entityXform.inv().xformPoint(point);
|
||||
var minOffset = Vec3.multiplyVbyV(entityProps.registrationPoint, entityProps.dimensions);
|
||||
|
@ -572,7 +572,7 @@ distanceBetweenPointAndEntityBoundingBox = function(point, entityProps) {
|
|||
return Vec3.distance(v, localPoint);
|
||||
};
|
||||
|
||||
entityIsEquipped = function(entityID) {
|
||||
var entityIsEquipped = function(entityID) {
|
||||
var rightEquipEntity = getEnabledModuleByName("RightEquipEntity");
|
||||
var leftEquipEntity = getEnabledModuleByName("LeftEquipEntity");
|
||||
var equippedInRightHand = rightEquipEntity ? rightEquipEntity.targetEntityID === entityID : false;
|
||||
|
@ -580,7 +580,7 @@ entityIsEquipped = function(entityID) {
|
|||
return equippedInRightHand || equippedInLeftHand;
|
||||
};
|
||||
|
||||
worldPositionToRegistrationFrameMatrix = function(wptrProps, pos) {
|
||||
var worldPositionToRegistrationFrameMatrix = function(wptrProps, pos) {
|
||||
// get world matrix for intersection point
|
||||
var intersectionMat = new Xform({ x: 0, y: 0, z:0, w: 1 }, pos);
|
||||
|
||||
|
@ -602,7 +602,7 @@ worldPositionToRegistrationFrameMatrix = function(wptrProps, pos) {
|
|||
return offsetMat;
|
||||
};
|
||||
|
||||
handsAreTracked = function () {
|
||||
var handsAreTracked = function () {
|
||||
return Controller.getPoseValue(Controller.Standard.LeftHandIndex3).valid ||
|
||||
Controller.getPoseValue(Controller.Standard.RightHandIndex3).valid;
|
||||
};
|
||||
|
|
|
@ -12,17 +12,17 @@
|
|||
getControllerWorldLocation:true
|
||||
*/
|
||||
|
||||
var GRAB_COMMUNICATIONS_SETTING = "io.highfidelity.isFarGrabbing";
|
||||
setGrabCommunications = function setFarGrabCommunications(on) {
|
||||
const GRAB_COMMUNICATIONS_SETTING = "io.highfidelity.isFarGrabbing";
|
||||
const setGrabCommunications = function setFarGrabCommunications(on) {
|
||||
Settings.setValue(GRAB_COMMUNICATIONS_SETTING, on ? "on" : "");
|
||||
};
|
||||
getGrabCommunications = function getFarGrabCommunications() {
|
||||
const getGrabCommunications = function getFarGrabCommunications() {
|
||||
return !!Settings.getValue(GRAB_COMMUNICATIONS_SETTING, "");
|
||||
};
|
||||
|
||||
// this offset needs to match the one in libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.cpp:378
|
||||
|
||||
getGrabPointSphereOffset = function(handController, ignoreSensorToWorldScale) {
|
||||
const getGrabPointSphereOffset = function(handController, ignoreSensorToWorldScale) {
|
||||
var GRAB_POINT_SPHERE_OFFSET = { x: 0.04, y: 0.13, z: 0.039 }; // x = upward, y = forward, z = lateral
|
||||
var offset = GRAB_POINT_SPHERE_OFFSET;
|
||||
if (handController === Controller.Standard.LeftHand) {
|
||||
|
@ -40,7 +40,7 @@ getGrabPointSphereOffset = function(handController, ignoreSensorToWorldScale) {
|
|||
};
|
||||
|
||||
// controllerWorldLocation is where the controller would be, in-world, with an added offset
|
||||
getControllerWorldLocation = function (handController, doOffset) {
|
||||
const getControllerWorldLocation = function (handController, doOffset) {
|
||||
var orientation;
|
||||
var position;
|
||||
var valid = false;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
||||
Pointer = function(hudLayer, pickType, pointerData) {
|
||||
var Pointer = function(hudLayer, pickType, pointerData) {
|
||||
this.SEARCH_SPHERE_SIZE = 0.0132;
|
||||
this.dim = {x: this.SEARCH_SPHERE_SIZE, y: this.SEARCH_SPHERE_SIZE, z: this.SEARCH_SPHERE_SIZE};
|
||||
this.halfPath = {
|
||||
|
@ -158,7 +158,7 @@ Pointer = function(hudLayer, pickType, pointerData) {
|
|||
};
|
||||
|
||||
|
||||
PointerManager = function() {
|
||||
var PointerManager = function() {
|
||||
this.pointers = [];
|
||||
|
||||
this.createPointer = function(hudLayer, pickType, pointerData) {
|
||||
|
|
Loading…
Reference in a new issue