mirror of
https://github.com/overte-org/overte.git
synced 2025-06-28 19:50:09 +02:00
Cleanup copy/paste changes
This commit is contained in:
parent
9cc2add4a0
commit
65fdd16d90
1 changed files with 11 additions and 10 deletions
|
@ -2401,9 +2401,11 @@ function addChildrenEntities(parentEntityID, entityList) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return true if the given entity with `properties` is being grabbed by an avatar.
|
// Determine if an entity is being grabbed.
|
||||||
// This is mostly a heuristic - there is no perfect way to know if an entity is being
|
// This is mostly a heuristic - there is no perfect way to know if an entity is being
|
||||||
// grabbed.
|
// grabbed.
|
||||||
|
//
|
||||||
|
// @return {boolean} true if the given entity with `properties` is being grabbed by an avatar
|
||||||
function nonDynamicEntityIsBeingGrabbedByAvatar(properties) {
|
function nonDynamicEntityIsBeingGrabbedByAvatar(properties) {
|
||||||
if (properties.dynamic || Uuid.isNull(properties.parentID)) {
|
if (properties.dynamic || Uuid.isNull(properties.parentID)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -2429,7 +2431,8 @@ function nonDynamicEntityIsBeingGrabbedByAvatar(properties) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// entityProperites - array of entity property objects
|
// Create the entities in entityProperties, maintaining parent-child relationships.
|
||||||
|
// @param entityPropertites {array} - Array of entity property objects
|
||||||
function createEntities(entityProperties) {
|
function createEntities(entityProperties) {
|
||||||
var entitiesToCreate = [];
|
var entitiesToCreate = [];
|
||||||
var createdEntityIDs = [];
|
var createdEntityIDs = [];
|
||||||
|
@ -2438,7 +2441,7 @@ function createEntities(entityProperties) {
|
||||||
|
|
||||||
SelectionManager.saveProperties();
|
SelectionManager.saveProperties();
|
||||||
|
|
||||||
for (var i = 0, len = entityProperties.length; i < len; ++i) {
|
for (var i = 0; i < entityProperties.length; ++i) {
|
||||||
var properties = entityProperties[i];
|
var properties = entityProperties[i];
|
||||||
if (properties.parentID in originalEntityToNewEntityID) {
|
if (properties.parentID in originalEntityToNewEntityID) {
|
||||||
properties.parentID = originalEntityToNewEntityID[properties.parentID];
|
properties.parentID = originalEntityToNewEntityID[properties.parentID];
|
||||||
|
@ -2556,22 +2559,21 @@ function deepCopy(v) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function pasteEntities() {
|
function pasteEntities() {
|
||||||
var dims = entityClipboard.dimensions;
|
var dimensions = entityClipboard.dimensions;
|
||||||
var maxDim = Math.max(dims.x, dims.y, dims.z);
|
var maxDimension = Math.max(dimensions.x, dimensions.y, dimensions.z);
|
||||||
var pastePosition = getPositionToCreateEntity(maxDim);
|
var pastePosition = getPositionToCreateEntity(maxDimension);
|
||||||
var deltaPosition = Vec3.subtract(pastePosition, entityClipboard.position);
|
var deltaPosition = Vec3.subtract(pastePosition, entityClipboard.position);
|
||||||
|
|
||||||
var copiedProperties = []
|
var copiedProperties = []
|
||||||
var ids = [];
|
var ids = [];
|
||||||
entityClipboard.entities.forEach(function(origproperties) {
|
entityClipboard.entities.forEach(function(originalProperties) {
|
||||||
var properties = deepCopy(origproperties);
|
var properties = deepCopy(originalProperties);
|
||||||
if (properties.root) {
|
if (properties.root) {
|
||||||
properties.position = Vec3.sum(properties.position, deltaPosition);
|
properties.position = Vec3.sum(properties.position, deltaPosition);
|
||||||
delete properties.localPosition;
|
delete properties.localPosition;
|
||||||
} else {
|
} else {
|
||||||
delete properties.position;
|
delete properties.position;
|
||||||
}
|
}
|
||||||
//entityProperties[properties.id] = properties;
|
|
||||||
copiedProperties.push(properties);
|
copiedProperties.push(properties);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2777,7 +2779,6 @@ mapping.from([Controller.Hardware.Keyboard.C]).when([Controller.Hardware.Keyboar
|
||||||
mapping.from([Controller.Hardware.Keyboard.V]).when([Controller.Hardware.Keyboard.Control]).to(pasteKey);
|
mapping.from([Controller.Hardware.Keyboard.V]).when([Controller.Hardware.Keyboard.Control]).to(pasteKey);
|
||||||
|
|
||||||
function copyKey(value) {
|
function copyKey(value) {
|
||||||
console.log("Copy", value);
|
|
||||||
if (value > 0) {
|
if (value > 0) {
|
||||||
copySelectedEntities();
|
copySelectedEntities();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue