mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 14:30:08 +02:00
Add Location and Rotation Copy-Paste
Add Location and Rotation Copy-Paste
This commit is contained in:
parent
884fa2f125
commit
c1ee8801e0
1 changed files with 62 additions and 1 deletions
|
@ -1353,6 +1353,12 @@ const GROUPS = [
|
||||||
propertyID: "localPosition",
|
propertyID: "localPosition",
|
||||||
spaceMode: PROPERTY_SPACE_MODE.LOCAL,
|
spaceMode: PROPERTY_SPACE_MODE.LOCAL,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
type: "buttons",
|
||||||
|
buttons: [ { id: "copyPosition", label: "Copy Position", className: "black", onClick: copyPositionProperty },
|
||||||
|
{ id: "pastePosition", label: "Paste Position", className: "black", onClick: pastePositionProperty } ],
|
||||||
|
propertyID: "copyPastePosition"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: "Rotation",
|
label: "Rotation",
|
||||||
type: "vec3",
|
type: "vec3",
|
||||||
|
@ -1375,6 +1381,12 @@ const GROUPS = [
|
||||||
propertyID: "localRotation",
|
propertyID: "localRotation",
|
||||||
spaceMode: PROPERTY_SPACE_MODE.LOCAL,
|
spaceMode: PROPERTY_SPACE_MODE.LOCAL,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
type: "buttons",
|
||||||
|
buttons: [ { id: "copyRotation", label: "Copy Rotation", className: "black", onClick: copyRotationProperty },
|
||||||
|
{ id: "pasteRotation", label: "Paste Rotation", className: "black", onClick: pasteRotationProperty } ],
|
||||||
|
propertyID: "copyPasteRotation"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: "Dimensions",
|
label: "Dimensions",
|
||||||
type: "vec3",
|
type: "vec3",
|
||||||
|
@ -1852,6 +1864,24 @@ function setPropertyVisibility(property, visible) {
|
||||||
property.elContainer.style.display = visible ? null : "none";
|
property.elContainer.style.display = visible ? null : "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setCopyPastePositionAndRotationAvailability (selectionLength, islocked) {
|
||||||
|
if (selectionLength === 1) {
|
||||||
|
$('#property-copyPastePosition-button-copyPosition').attr('disabled', false);
|
||||||
|
$('#property-copyPasteRotation-button-copyRotation').attr('disabled', false);
|
||||||
|
} else {
|
||||||
|
$('#property-copyPastePosition-button-copyPosition').attr('disabled', true);
|
||||||
|
$('#property-copyPasteRotation-button-copyRotation').attr('disabled', true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selectionLength > 0 && !islocked) {
|
||||||
|
$('#property-copyPastePosition-button-pastePosition').attr('disabled', false);
|
||||||
|
$('#property-copyPasteRotation-button-pasteRotation').attr('disabled', false);
|
||||||
|
} else {
|
||||||
|
$('#property-copyPastePosition-button-pastePosition').attr('disabled', true);
|
||||||
|
$('#property-copyPasteRotation-button-pasteRotation').attr('disabled', true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function resetProperties() {
|
function resetProperties() {
|
||||||
for (let propertyID in properties) {
|
for (let propertyID in properties) {
|
||||||
let property = properties[propertyID];
|
let property = properties[propertyID];
|
||||||
|
@ -3217,6 +3247,33 @@ function copySkyboxURLToAmbientURL() {
|
||||||
updateProperty("ambientLight.ambientURL", skyboxURL, false);
|
updateProperty("ambientLight.ambientURL", skyboxURL, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function copyPositionProperty() {
|
||||||
|
EventBridge.emitWebEvent(JSON.stringify({
|
||||||
|
type: "action",
|
||||||
|
action: "copyPosition"
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
function pastePositionProperty() {
|
||||||
|
EventBridge.emitWebEvent(JSON.stringify({
|
||||||
|
type: "action",
|
||||||
|
action: "pastePosition"
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
function copyRotationProperty() {
|
||||||
|
EventBridge.emitWebEvent(JSON.stringify({
|
||||||
|
type: "action",
|
||||||
|
action: "copyRotation"
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
function pasteRotationProperty() {
|
||||||
|
EventBridge.emitWebEvent(JSON.stringify({
|
||||||
|
type: "action",
|
||||||
|
action: "pasteRotation"
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* USER DATA FUNCTIONS
|
* USER DATA FUNCTIONS
|
||||||
|
@ -3952,7 +4009,7 @@ function handleEntitySelectionUpdate(selections, isPropertiesToolUpdate) {
|
||||||
selectedEntityIDs = new Set(selections.map(selection => selection.id));
|
selectedEntityIDs = new Set(selections.map(selection => selection.id));
|
||||||
const multipleSelections = currentSelections.length > 1;
|
const multipleSelections = currentSelections.length > 1;
|
||||||
const hasSelectedEntityChanged = !areSetsEqual(selectedEntityIDs, previouslySelectedEntityIDs);
|
const hasSelectedEntityChanged = !areSetsEqual(selectedEntityIDs, previouslySelectedEntityIDs);
|
||||||
|
|
||||||
requestZoneList();
|
requestZoneList();
|
||||||
|
|
||||||
if (selections.length === 0) {
|
if (selections.length === 0) {
|
||||||
|
@ -3976,6 +4033,8 @@ function handleEntitySelectionUpdate(selections, isPropertiesToolUpdate) {
|
||||||
showSaveMaterialDataButton();
|
showSaveMaterialDataButton();
|
||||||
showNewJSONMaterialEditorButton();
|
showNewJSONMaterialEditorButton();
|
||||||
|
|
||||||
|
setCopyPastePositionAndRotationAvailability (selections.length, true);
|
||||||
|
|
||||||
disableProperties();
|
disableProperties();
|
||||||
} else {
|
} else {
|
||||||
if (!isPropertiesToolUpdate && !hasSelectedEntityChanged && document.hasFocus()) {
|
if (!isPropertiesToolUpdate && !hasSelectedEntityChanged && document.hasFocus()) {
|
||||||
|
@ -4006,10 +4065,12 @@ function handleEntitySelectionUpdate(selections, isPropertiesToolUpdate) {
|
||||||
if (lockedMultiValue.isMultiDiffValue || lockedMultiValue.value) {
|
if (lockedMultiValue.isMultiDiffValue || lockedMultiValue.value) {
|
||||||
disableProperties();
|
disableProperties();
|
||||||
getPropertyInputElement('locked').removeAttribute('disabled');
|
getPropertyInputElement('locked').removeAttribute('disabled');
|
||||||
|
setCopyPastePositionAndRotationAvailability (selections.length, true);
|
||||||
} else {
|
} else {
|
||||||
enableProperties();
|
enableProperties();
|
||||||
disableSaveUserDataButton();
|
disableSaveUserDataButton();
|
||||||
disableSaveMaterialDataButton();
|
disableSaveMaterialDataButton();
|
||||||
|
setCopyPastePositionAndRotationAvailability (selections.length, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
const certificateIDMultiValue = getMultiplePropertyValue('certificateID');
|
const certificateIDMultiValue = getMultiplePropertyValue('certificateID');
|
||||||
|
|
Loading…
Reference in a new issue