mirror of
https://github.com/overte-org/overte.git
synced 2025-06-05 09:52:34 +02:00
Merge pull request #12920 from thoys/fix/create-dontCloneOthersAvatarEntities
edit.js - remove ability to clone non-owned avatar-entities
This commit is contained in:
commit
51a98961a6
1 changed files with 25 additions and 33 deletions
|
@ -13,9 +13,7 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
/* global HIFI_PUBLIC_BUCKET, SPACE_LOCAL, Script, SelectionManager */
|
/* global SPACE_LOCAL, SelectionManager */
|
||||||
|
|
||||||
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
|
||||||
|
|
||||||
SPACE_LOCAL = "local";
|
SPACE_LOCAL = "local";
|
||||||
SPACE_WORLD = "world";
|
SPACE_WORLD = "world";
|
||||||
|
@ -50,6 +48,7 @@ SelectionManager = (function() {
|
||||||
messageParsed = JSON.parse(message);
|
messageParsed = JSON.parse(message);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
print("ERROR: entitySelectionTool.handleEntitySelectionToolUpdates - got malformed message: " + message);
|
print("ERROR: entitySelectionTool.handleEntitySelectionToolUpdates - got malformed message: " + message);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (messageParsed.method === "selectEntity") {
|
if (messageParsed.method === "selectEntity") {
|
||||||
|
@ -155,6 +154,20 @@ SelectionManager = (function() {
|
||||||
that._update(true);
|
that._update(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
that.duplicateSelection = function() {
|
||||||
|
var duplicatedEntityIDs = [];
|
||||||
|
Object.keys(that.savedProperties).forEach(function(otherEntityID) {
|
||||||
|
var properties = that.savedProperties[otherEntityID];
|
||||||
|
if (!properties.locked && (!properties.clientOnly || properties.owningAvatarID === MyAvatar.sessionUUID)) {
|
||||||
|
duplicatedEntityIDs.push({
|
||||||
|
entityID: Entities.addEntity(properties),
|
||||||
|
properties: properties
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return duplicatedEntityIDs;
|
||||||
|
}
|
||||||
|
|
||||||
that._update = function(selectionUpdated) {
|
that._update = function(selectionUpdated) {
|
||||||
var properties = null;
|
var properties = null;
|
||||||
if (that.selections.length === 0) {
|
if (that.selections.length === 0) {
|
||||||
|
@ -443,7 +456,7 @@ SelectionDisplay = (function() {
|
||||||
solid: true,
|
solid: true,
|
||||||
visible: false,
|
visible: false,
|
||||||
ignoreRayIntersection: true,
|
ignoreRayIntersection: true,
|
||||||
drawInFront: true,
|
drawInFront: true
|
||||||
}
|
}
|
||||||
var handleStretchXPanel = Overlays.addOverlay("shape", handlePropertiesStretchPanel);
|
var handleStretchXPanel = Overlays.addOverlay("shape", handlePropertiesStretchPanel);
|
||||||
Overlays.editOverlay(handleStretchXPanel, { color : COLOR_RED });
|
Overlays.editOverlay(handleStretchXPanel, { color : COLOR_RED });
|
||||||
|
@ -749,6 +762,7 @@ SelectionDisplay = (function() {
|
||||||
} else if (overlay === handleTranslateZCylinder) {
|
} else if (overlay === handleTranslateZCylinder) {
|
||||||
return handleTranslateZCone;
|
return handleTranslateZCone;
|
||||||
}
|
}
|
||||||
|
return Uuid.NULL;
|
||||||
};
|
};
|
||||||
|
|
||||||
// FUNCTION: MOUSE MOVE EVENT
|
// FUNCTION: MOUSE MOVE EVENT
|
||||||
|
@ -1038,13 +1052,13 @@ SelectionDisplay = (function() {
|
||||||
var toCameraDistance = getDistanceToCamera(position);
|
var toCameraDistance = getDistanceToCamera(position);
|
||||||
|
|
||||||
var localRotationX = Quat.fromPitchYawRollDegrees(0, 0, -90);
|
var localRotationX = Quat.fromPitchYawRollDegrees(0, 0, -90);
|
||||||
rotationX = Quat.multiply(rotation, localRotationX);
|
var rotationX = Quat.multiply(rotation, localRotationX);
|
||||||
worldRotationX = rotationX;
|
worldRotationX = rotationX;
|
||||||
var localRotationY = Quat.fromPitchYawRollDegrees(0, 90, 0);
|
var localRotationY = Quat.fromPitchYawRollDegrees(0, 90, 0);
|
||||||
rotationY = Quat.multiply(rotation, localRotationY);
|
var rotationY = Quat.multiply(rotation, localRotationY);
|
||||||
worldRotationY = rotationY;
|
worldRotationY = rotationY;
|
||||||
var localRotationZ = Quat.fromPitchYawRollDegrees(90, 0, 0);
|
var localRotationZ = Quat.fromPitchYawRollDegrees(90, 0, 0);
|
||||||
rotationZ = Quat.multiply(rotation, localRotationZ);
|
var rotationZ = Quat.multiply(rotation, localRotationZ);
|
||||||
worldRotationZ = rotationZ;
|
worldRotationZ = rotationZ;
|
||||||
|
|
||||||
// in HMD we clamp the overlays to the bounding box for now so lasers can hit them
|
// in HMD we clamp the overlays to the bounding box for now so lasers can hit them
|
||||||
|
@ -1260,10 +1274,9 @@ SelectionDisplay = (function() {
|
||||||
dimensions: stretchPanelXDimensions
|
dimensions: stretchPanelXDimensions
|
||||||
});
|
});
|
||||||
var stretchPanelYDimensions = Vec3.subtract(scaleLTNCubePositionRotated, scaleRTFCubePositionRotated);
|
var stretchPanelYDimensions = Vec3.subtract(scaleLTNCubePositionRotated, scaleRTFCubePositionRotated);
|
||||||
var tempX = Math.abs(stretchPanelYDimensions.x);
|
|
||||||
stretchPanelYDimensions.x = Math.abs(stretchPanelYDimensions.z);
|
stretchPanelYDimensions.x = Math.abs(stretchPanelYDimensions.z);
|
||||||
stretchPanelYDimensions.y = STRETCH_PANEL_WIDTH;
|
stretchPanelYDimensions.y = STRETCH_PANEL_WIDTH;
|
||||||
stretchPanelYDimensions.z = tempX;
|
stretchPanelYDimensions.z = Math.abs(stretchPanelYDimensions.x);
|
||||||
var stretchPanelYPosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, { x:0, y:dimensions.y / 2, z:0 }));
|
var stretchPanelYPosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, { x:0, y:dimensions.y / 2, z:0 }));
|
||||||
Overlays.editOverlay(handleStretchYPanel, {
|
Overlays.editOverlay(handleStretchYPanel, {
|
||||||
position: stretchPanelYPosition,
|
position: stretchPanelYPosition,
|
||||||
|
@ -1271,9 +1284,8 @@ SelectionDisplay = (function() {
|
||||||
dimensions: stretchPanelYDimensions
|
dimensions: stretchPanelYDimensions
|
||||||
});
|
});
|
||||||
var stretchPanelZDimensions = Vec3.subtract(scaleLTNCubePositionRotated, scaleRBFCubePositionRotated);
|
var stretchPanelZDimensions = Vec3.subtract(scaleLTNCubePositionRotated, scaleRBFCubePositionRotated);
|
||||||
var tempX = Math.abs(stretchPanelZDimensions.x);
|
|
||||||
stretchPanelZDimensions.x = Math.abs(stretchPanelZDimensions.y);
|
stretchPanelZDimensions.x = Math.abs(stretchPanelZDimensions.y);
|
||||||
stretchPanelZDimensions.y = tempX;
|
stretchPanelZDimensions.y = Math.abs(stretchPanelZDimensions.x);
|
||||||
stretchPanelZDimensions.z = STRETCH_PANEL_WIDTH;
|
stretchPanelZDimensions.z = STRETCH_PANEL_WIDTH;
|
||||||
var stretchPanelZPosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, { x:0, y:0, z:dimensions.z / 2 }));
|
var stretchPanelZPosition = Vec3.sum(position, Vec3.multiplyQbyV(rotation, { x:0, y:0, z:dimensions.z / 2 }));
|
||||||
Overlays.editOverlay(handleStretchZPanel, {
|
Overlays.editOverlay(handleStretchZPanel, {
|
||||||
|
@ -1519,17 +1531,7 @@ SelectionDisplay = (function() {
|
||||||
// copy of the selected entities and move the _original_ entities, not
|
// copy of the selected entities and move the _original_ entities, not
|
||||||
// the new ones.
|
// the new ones.
|
||||||
if (event.isAlt || doClone) {
|
if (event.isAlt || doClone) {
|
||||||
duplicatedEntityIDs = [];
|
duplicatedEntityIDs = SelectionManager.duplicateSelection();
|
||||||
for (var otherEntityID in SelectionManager.savedProperties) {
|
|
||||||
var properties = SelectionManager.savedProperties[otherEntityID];
|
|
||||||
if (!properties.locked) {
|
|
||||||
var entityID = Entities.addEntity(properties);
|
|
||||||
duplicatedEntityIDs.push({
|
|
||||||
entityID: entityID,
|
|
||||||
properties: properties
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
duplicatedEntityIDs = null;
|
duplicatedEntityIDs = null;
|
||||||
}
|
}
|
||||||
|
@ -1690,17 +1692,7 @@ SelectionDisplay = (function() {
|
||||||
// copy of the selected entities and move the _original_ entities, not
|
// copy of the selected entities and move the _original_ entities, not
|
||||||
// the new ones.
|
// the new ones.
|
||||||
if (event.isAlt) {
|
if (event.isAlt) {
|
||||||
duplicatedEntityIDs = [];
|
duplicatedEntityIDs = SelectionManager.duplicateSelection();
|
||||||
for (var otherEntityID in SelectionManager.savedProperties) {
|
|
||||||
var properties = SelectionManager.savedProperties[otherEntityID];
|
|
||||||
if (!properties.locked) {
|
|
||||||
var entityID = Entities.addEntity(properties);
|
|
||||||
duplicatedEntityIDs.push({
|
|
||||||
entityID: entityID,
|
|
||||||
properties: properties
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
duplicatedEntityIDs = null;
|
duplicatedEntityIDs = null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue