mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 12:17:45 +02:00
Merge pull request #863 from AleziaKurdis/CreateAppDimensionsCopyPaste
Create App.: "Copy Dimensions" and "Paste Dimensions"
This commit is contained in:
commit
c41c2deb77
2 changed files with 58 additions and 12 deletions
|
@ -1,7 +1,7 @@
|
||||||
// edit.js
|
// edit.js
|
||||||
//
|
//
|
||||||
// Created by Brad Hefta-Gaub on 10/2/14.
|
// Created by Brad Hefta-Gaub on October 2nd, 2014.
|
||||||
// Persist toolbar by HRS 6/11/15.
|
// Persist toolbar by HRS on June 2nd, 2015.
|
||||||
// Copyright 2014 High Fidelity, Inc.
|
// Copyright 2014 High Fidelity, Inc.
|
||||||
// Copyright 2020 Vircadia contributors.
|
// Copyright 2020 Vircadia contributors.
|
||||||
// Copyright 2022-2024 Overte e.V.
|
// Copyright 2022-2024 Overte e.V.
|
||||||
|
@ -121,6 +121,8 @@
|
||||||
|
|
||||||
var copiedPosition;
|
var copiedPosition;
|
||||||
var copiedRotation;
|
var copiedRotation;
|
||||||
|
var copiedDimensions;
|
||||||
|
|
||||||
var importUiPersistedData = {
|
var importUiPersistedData = {
|
||||||
"elJsonUrl": "",
|
"elJsonUrl": "",
|
||||||
"elImportAtAvatar": true,
|
"elImportAtAvatar": true,
|
||||||
|
@ -2718,6 +2720,13 @@
|
||||||
copiedRotation = properties.rotation;
|
copiedRotation = properties.rotation;
|
||||||
Window.copyToClipboard(JSON.stringify(copiedRotation));
|
Window.copyToClipboard(JSON.stringify(copiedRotation));
|
||||||
}
|
}
|
||||||
|
} else if (data.action === "copyDimensions") {
|
||||||
|
if (selectionManager.selections.length === 1) {
|
||||||
|
selectionManager.saveProperties();
|
||||||
|
properties = selectionManager.savedProperties[selectionManager.selections[0]];
|
||||||
|
copiedDimensions = properties.dimensions;
|
||||||
|
Window.copyToClipboard(JSON.stringify(copiedDimensions));
|
||||||
|
}
|
||||||
} else if (data.action === "pastePosition") {
|
} else if (data.action === "pastePosition") {
|
||||||
if (copiedPosition !== undefined && selectionManager.selections.length > 0 && SelectionManager.hasUnlockedSelection()) {
|
if (copiedPosition !== undefined && selectionManager.selections.length > 0 && SelectionManager.hasUnlockedSelection()) {
|
||||||
selectionManager.saveProperties();
|
selectionManager.saveProperties();
|
||||||
|
@ -2731,6 +2740,19 @@
|
||||||
} else {
|
} else {
|
||||||
audioFeedback.rejection();
|
audioFeedback.rejection();
|
||||||
}
|
}
|
||||||
|
} else if (data.action === "pasteDimensions") {
|
||||||
|
if (copiedDimensions !== undefined && selectionManager.selections.length > 0 && SelectionManager.hasUnlockedSelection()) {
|
||||||
|
selectionManager.saveProperties();
|
||||||
|
for (i = 0; i < selectionManager.selections.length; i++) {
|
||||||
|
Entities.editEntity(selectionManager.selections[i], {
|
||||||
|
dimensions: copiedDimensions
|
||||||
|
});
|
||||||
|
}
|
||||||
|
createApp.pushCommandForSelections();
|
||||||
|
selectionManager._update(false, this);
|
||||||
|
} else {
|
||||||
|
audioFeedback.rejection();
|
||||||
|
}
|
||||||
} else if (data.action === "pasteRotation") {
|
} else if (data.action === "pasteRotation") {
|
||||||
if (copiedRotation !== undefined && selectionManager.selections.length > 0 && SelectionManager.hasUnlockedSelection()) {
|
if (copiedRotation !== undefined && selectionManager.selections.length > 0 && SelectionManager.hasUnlockedSelection()) {
|
||||||
selectionManager.saveProperties();
|
selectionManager.saveProperties();
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
// entityProperties.js
|
// entityProperties.js
|
||||||
//
|
//
|
||||||
// Created by Ryan Huffman on 13 Nov 2014
|
// Created by Ryan Huffman on November 13th, 2014
|
||||||
// Copyright 2014 High Fidelity, Inc.
|
// Copyright 2014 High Fidelity, Inc.
|
||||||
// Copyright 2020 Vircadia contributors.
|
// Copyright 2020 Vircadia contributors.
|
||||||
// Copyright 2022 Overte e.V.
|
// Copyright 2022-2024 Overte e.V.
|
||||||
//
|
//
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
// 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
|
||||||
|
@ -136,7 +136,7 @@ const GROUPS = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "shape",
|
id: "shape",
|
||||||
label: "SHAPE",
|
label: "SHAPE",
|
||||||
properties: [
|
properties: [
|
||||||
{
|
{
|
||||||
label: "Shape",
|
label: "Shape",
|
||||||
|
@ -161,7 +161,7 @@ const GROUPS = [
|
||||||
decimals: 2,
|
decimals: 2,
|
||||||
propertyID: "shapeAlpha",
|
propertyID: "shapeAlpha",
|
||||||
propertyName: "alpha",
|
propertyName: "alpha",
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -393,7 +393,7 @@ const GROUPS = [
|
||||||
decimals: 2,
|
decimals: 2,
|
||||||
propertyID: "keyLight.shadowMaxDistance",
|
propertyID: "keyLight.shadowMaxDistance",
|
||||||
showPropertyRule: { "keyLightMode": "enabled" },
|
showPropertyRule: { "keyLightMode": "enabled" },
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -1458,6 +1458,12 @@ const GROUPS = [
|
||||||
propertyID: "localDimensions",
|
propertyID: "localDimensions",
|
||||||
spaceMode: PROPERTY_SPACE_MODE.LOCAL,
|
spaceMode: PROPERTY_SPACE_MODE.LOCAL,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
type: "buttons",
|
||||||
|
buttons: [ { id: "copyDimensions", label: "Copy Dimensions", className: "secondary", onClick: copyDimensionsProperty },
|
||||||
|
{ id: "pasteDimensions", label: "Paste Dimensions", className: "secondary", onClick: pasteDimensionsProperty } ],
|
||||||
|
propertyID: "copyPasteDimensions"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: "Scale",
|
label: "Scale",
|
||||||
type: "number-draggable",
|
type: "number-draggable",
|
||||||
|
@ -1915,14 +1921,17 @@ function setCopyPastePositionAndRotationAvailability (selectionLength, islocked)
|
||||||
if (selectionLength === 1) {
|
if (selectionLength === 1) {
|
||||||
$('#property-copyPastePosition-button-copyPosition').attr('disabled', false);
|
$('#property-copyPastePosition-button-copyPosition').attr('disabled', false);
|
||||||
$('#property-copyPasteRotation-button-copyRotation').attr('disabled', false);
|
$('#property-copyPasteRotation-button-copyRotation').attr('disabled', false);
|
||||||
|
$('#property-copyPasteDimensions-button-copyDimensions').attr('disabled', false);
|
||||||
} else {
|
} else {
|
||||||
$('#property-copyPastePosition-button-copyPosition').attr('disabled', true);
|
$('#property-copyPastePosition-button-copyPosition').attr('disabled', true);
|
||||||
$('#property-copyPasteRotation-button-copyRotation').attr('disabled', true);
|
$('#property-copyPasteRotation-button-copyRotation').attr('disabled', true);
|
||||||
|
$('#property-copyPasteDimensions-button-copyDimensions').attr('disabled', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectionLength > 0 && !islocked) {
|
if (selectionLength > 0 && !islocked) {
|
||||||
$('#property-copyPastePosition-button-pastePosition').attr('disabled', false);
|
$('#property-copyPastePosition-button-pastePosition').attr('disabled', false);
|
||||||
$('#property-copyPasteRotation-button-pasteRotation').attr('disabled', false);
|
$('#property-copyPasteRotation-button-pasteRotation').attr('disabled', false);
|
||||||
|
$('#property-copyPasteDimensions-button-pasteDimensions').attr('disabled', false);
|
||||||
if (selectionLength === 1) {
|
if (selectionLength === 1) {
|
||||||
$('#property-copyPasteRotation-button-setRotationToZero').attr('disabled', false);
|
$('#property-copyPasteRotation-button-setRotationToZero').attr('disabled', false);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1932,6 +1941,7 @@ function setCopyPastePositionAndRotationAvailability (selectionLength, islocked)
|
||||||
$('#property-copyPastePosition-button-pastePosition').attr('disabled', true);
|
$('#property-copyPastePosition-button-pastePosition').attr('disabled', true);
|
||||||
$('#property-copyPasteRotation-button-pasteRotation').attr('disabled', true);
|
$('#property-copyPasteRotation-button-pasteRotation').attr('disabled', true);
|
||||||
$('#property-copyPasteRotation-button-setRotationToZero').attr('disabled', true);
|
$('#property-copyPasteRotation-button-setRotationToZero').attr('disabled', true);
|
||||||
|
$('#property-copyPasteDimensions-button-pasteDimensions').attr('disabled', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3360,27 +3370,41 @@ function pastePositionProperty() {
|
||||||
EventBridge.emitWebEvent(JSON.stringify({
|
EventBridge.emitWebEvent(JSON.stringify({
|
||||||
type: "action",
|
type: "action",
|
||||||
action: "pastePosition"
|
action: "pastePosition"
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
function copyRotationProperty() {
|
function copyRotationProperty() {
|
||||||
EventBridge.emitWebEvent(JSON.stringify({
|
EventBridge.emitWebEvent(JSON.stringify({
|
||||||
type: "action",
|
type: "action",
|
||||||
action: "copyRotation"
|
action: "copyRotation"
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
function pasteRotationProperty() {
|
function pasteRotationProperty() {
|
||||||
EventBridge.emitWebEvent(JSON.stringify({
|
EventBridge.emitWebEvent(JSON.stringify({
|
||||||
type: "action",
|
type: "action",
|
||||||
action: "pasteRotation"
|
action: "pasteRotation"
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
function setRotationToZeroProperty() {
|
function setRotationToZeroProperty() {
|
||||||
EventBridge.emitWebEvent(JSON.stringify({
|
EventBridge.emitWebEvent(JSON.stringify({
|
||||||
type: "action",
|
type: "action",
|
||||||
action: "setRotationToZero"
|
action: "setRotationToZero"
|
||||||
}));
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
function copyDimensionsProperty() {
|
||||||
|
EventBridge.emitWebEvent(JSON.stringify({
|
||||||
|
type: "action",
|
||||||
|
action: "copyDimensions"
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
function pasteDimensionsProperty() {
|
||||||
|
EventBridge.emitWebEvent(JSON.stringify({
|
||||||
|
type: "action",
|
||||||
|
action: "pasteDimensions"
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* USER DATA FUNCTIONS
|
* USER DATA FUNCTIONS
|
||||||
|
|
Loading…
Reference in a new issue