mirror of
https://github.com/lubosz/overte.git
synced 2025-04-08 00:02:05 +02:00
Add Location and Rotation Copy-Paste
Add Location and Rotation Copy-Paste
This commit is contained in:
parent
24b0f85d2a
commit
884fa2f125
1 changed files with 43 additions and 0 deletions
|
@ -113,6 +113,9 @@ var hmdMultiSelectMode = false;
|
|||
var expectingRotateAsClickedSurface = false;
|
||||
var keepSelectedOnNextClick = false;
|
||||
|
||||
var copiedPosition;
|
||||
var copiedRotation;
|
||||
|
||||
var cameraManager = new CameraManager();
|
||||
|
||||
var grid = new Grid();
|
||||
|
@ -2613,6 +2616,46 @@ var PropertiesTool = function (opts) {
|
|||
Entities.reloadServerScripts(selectionManager.selections[i]);
|
||||
}
|
||||
}
|
||||
} else if (data.action === "copyPosition") {
|
||||
selectionManager.saveProperties();
|
||||
properties = selectionManager.savedProperties[selectionManager.selections[0]];
|
||||
copiedPosition = properties.position;
|
||||
Window.copyToClipboard(JSON.stringify(copiedPosition));
|
||||
print("COPIED: " + JSON.stringify(copiedPosition));
|
||||
} else if (data.action === "copyRotation") {
|
||||
selectionManager.saveProperties();
|
||||
properties = selectionManager.savedProperties[selectionManager.selections[0]];
|
||||
copiedRotation = properties.rotation;
|
||||
Window.copyToClipboard(JSON.stringify(copiedRotation));
|
||||
print("COPIED: " + JSON.stringify(copiedRotation));
|
||||
} else if (data.action === "pastePosition") {
|
||||
if (copiedPosition !== undefined) {
|
||||
selectionManager.saveProperties();
|
||||
for (i = 0; i < selectionManager.selections.length; i++) {
|
||||
Entities.editEntity(selectionManager.selections[i], {
|
||||
position: copiedPosition
|
||||
});
|
||||
}
|
||||
pushCommandForSelections();
|
||||
selectionManager._update(false, this);
|
||||
print("PASTE POSITION");
|
||||
} else {
|
||||
audioFeedback.rejection();
|
||||
}
|
||||
} else if (data.action === "pasteRotation") {
|
||||
if (copiedRotation !== undefined) {
|
||||
selectionManager.saveProperties();
|
||||
for (i = 0; i < selectionManager.selections.length; i++) {
|
||||
Entities.editEntity(selectionManager.selections[i], {
|
||||
rotation: copiedRotation
|
||||
});
|
||||
}
|
||||
pushCommandForSelections();
|
||||
selectionManager._update(false, this);
|
||||
print("PASTE ROTATION");
|
||||
} else {
|
||||
audioFeedback.rejection();
|
||||
}
|
||||
}
|
||||
} else if (data.type === "propertiesPageReady") {
|
||||
updateSelections(true);
|
||||
|
|
Loading…
Reference in a new issue