mirror of
https://github.com/overte-org/overte.git
synced 2025-04-16 16:26:17 +02:00
Merge pull request #1342 from AleziaKurdis/createApp_childEntitiesTab
Create app.: child entities tab, Copy Color from Skybox Color, Hifi-Glyphs font update.
This commit is contained in:
commit
83c1595190
6 changed files with 571 additions and 27 deletions
|
@ -4,7 +4,7 @@
|
|||
// Persist toolbar by HRS on June 2nd, 2015.
|
||||
// Copyright 2014 High Fidelity, Inc.
|
||||
// Copyright 2020 Vircadia contributors.
|
||||
// Copyright 2022-2024 Overte e.V.
|
||||
// Copyright 2022-2025 Overte e.V.
|
||||
//
|
||||
// This script allows you to edit entities with a new UI/UX for mouse and trackpad based editing
|
||||
//
|
||||
|
@ -544,7 +544,7 @@
|
|||
localOnly: false
|
||||
},
|
||||
};
|
||||
|
||||
var fcreateNewEntity;
|
||||
var toolBar = (function () {
|
||||
var EDIT_SETTING = "io.highfidelity.isEditing"; // for communication with other scripts
|
||||
var that = {},
|
||||
|
@ -554,7 +554,7 @@
|
|||
dialogWindow = null,
|
||||
tablet = null;
|
||||
|
||||
function createNewEntity(requestedProperties) {
|
||||
function createNewEntity(requestedProperties, entityHostType="domain") {
|
||||
var dimensions = requestedProperties.dimensions ? requestedProperties.dimensions : DEFAULT_DIMENSIONS;
|
||||
var position = createApp.getPositionToCreateEntity();
|
||||
var entityID = null;
|
||||
|
@ -634,7 +634,7 @@
|
|||
properties.visible = false;
|
||||
}
|
||||
|
||||
entityID = Entities.addEntity(properties);
|
||||
entityID = Entities.addEntity(properties, entityHostType);
|
||||
|
||||
var dimensionsCheckCallback = function(){
|
||||
// Adjust position of entity per bounding box after it has been created and auto-resized.
|
||||
|
@ -713,7 +713,9 @@
|
|||
|
||||
return entityID;
|
||||
}
|
||||
|
||||
|
||||
fcreateNewEntity = createNewEntity;
|
||||
|
||||
function closeExistingDialogWindow() {
|
||||
if (dialogWindow) {
|
||||
dialogWindow.close();
|
||||
|
@ -2611,6 +2613,10 @@
|
|||
entity.properties.keyLight.direction = Vec3.toPolar(entity.properties.keyLight.direction);
|
||||
entity.properties.keyLight.direction.z = 0.0;
|
||||
}
|
||||
if (selectionManager.selections.length === 1) {
|
||||
entity.properties.children = createApp.getChildEntitiesList(entity.id);
|
||||
}
|
||||
|
||||
selections.push(entity);
|
||||
}
|
||||
data.selections = selections;
|
||||
|
@ -2982,6 +2988,10 @@
|
|||
type: 'importUi_LOAD_DATA',
|
||||
importUiPersistedData: importUiPersistedData
|
||||
});
|
||||
} else if (data.type === "specificEntityNavigation") {
|
||||
selectionManager.setSelections([data.id], this);
|
||||
} else if (data.type === "createChildEntity") {
|
||||
fcreateNewEntity(data.properties, data.entityHostType);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -3388,7 +3398,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
createApp.rotateAsNextClickedSurface = function() {
|
||||
createApp.rotateAsNextClickedSurface = function() {
|
||||
if (!SelectionManager.hasSelection() || !SelectionManager.hasUnlockedSelection()) {
|
||||
audioFeedback.rejection();
|
||||
Window.notifyEditError("You have nothing selected, or the selection is locked.");
|
||||
|
@ -3398,4 +3408,19 @@
|
|||
}
|
||||
}
|
||||
|
||||
createApp.getChildEntitiesList = function(parentID) {
|
||||
let children = Entities.getChildrenIDs(parentID);
|
||||
let childList = [];
|
||||
let i, properties;
|
||||
if (children.length > 0) {
|
||||
for (i = 0; i < children.length; i++ ) {
|
||||
properties = Entities.getEntityProperties(children[i], ["id", "name", "type", "entityHostType"]);
|
||||
if (properties.name !== undefined && properties.name !== entityShapeVisualizerSessionName) {
|
||||
childList.push(properties);
|
||||
}
|
||||
}
|
||||
}
|
||||
return childList;
|
||||
}
|
||||
|
||||
}()); // END LOCAL_SCOPE
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// Created by Ryan Huffman on 13 Nov 2014
|
||||
// Copyright 2014 High Fidelity, Inc.
|
||||
// Copyright 2020 Vircadia contributors.
|
||||
// Copyright 2022-2024 Overte e.V.
|
||||
// Copyright 2022-2025 Overte e.V.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
@ -20,6 +20,7 @@
|
|||
<link rel="stylesheet" type="text/css" href="../../../html/css/jsoneditor.css">
|
||||
<link rel="stylesheet" type="text/css" href="../../../html/css/tabs.css">
|
||||
<link rel="stylesheet" type="text/css" href="../../../html/css/materialAssistant.css">
|
||||
<link rel="stylesheet" type="text/css" href="../../../html/css/createChildEntityAssistant.css">
|
||||
<script type="text/javascript" src="qrc:///qtwebchannel/qwebchannel.js"></script>
|
||||
<script src="../../../html/js/jquery-2.1.4.min.js"></script>
|
||||
<script type="text/javascript" src="../../../html/js/colpick.js"></script>
|
||||
|
@ -62,6 +63,13 @@
|
|||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="uiCreateChildEntityAssistant" style="display: none;">
|
||||
<div id="uiCreateChildEntityAssistant-headerContainer">
|
||||
<div style="width: 85%; text-align: left;"><font class="uiCreateChildEntityAssistant-title">CREATE CHILD ENTITY</font></div>
|
||||
<div style="width: 15%; text-align: right;"><span id="uiCreateChildEntityAssistant-closeButton" onclick="closeCreateChildEntityAssistant()">✖ </span></div>
|
||||
</div>
|
||||
<div id="uiCreateChildEntityAssistant-form"></div>
|
||||
</div>
|
||||
<div id="uiMaterialAssistant" style="display: none;">
|
||||
<div id="uiMaterialAssistant-headerContainer">
|
||||
<div style="width: 85%; text-align: left;"><font class="uiMaterialAssistant-title">MATERIAL DATA</font></div>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// Created by Ryan Huffman on November 13th, 2014
|
||||
// Copyright 2014 High Fidelity, Inc.
|
||||
// Copyright 2020 Vircadia contributors.
|
||||
// Copyright 2022-2024 Overte e.V.
|
||||
// Copyright 2022-2025 Overte e.V.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
@ -15,6 +15,8 @@ var currentTab = "base";
|
|||
|
||||
const DEGREES_TO_RADIANS = Math.PI / 180.0;
|
||||
|
||||
const UUID_NONE = "{00000000-0000-0000-0000-000000000000}";
|
||||
|
||||
const ENTITY_HOST_TYPE_COLOR_DOMAIN = "#afafaf";
|
||||
const ENTITY_HOST_TYPE_COLOR_AVATAR = "#7fdb98";
|
||||
const ENTITY_HOST_TYPE_COLOR_LOCAL = "#f0d769";
|
||||
|
@ -81,6 +83,7 @@ const GROUPS = [
|
|||
label: "Parent",
|
||||
type: "string",
|
||||
propertyID: "parentID",
|
||||
buttons: [ { id: "navigateToParentEntity", label: "1", className: "navigation", onClick: navigateToSpecificEntityFromParentID } ],
|
||||
onChange: parentIDChanged,
|
||||
},
|
||||
{
|
||||
|
@ -476,6 +479,13 @@ const GROUPS = [
|
|||
propertyID: "ambientLight.ambientColor",
|
||||
showPropertyRule: { "ambientLightMode": "enabled" },
|
||||
},
|
||||
{
|
||||
type: "buttons",
|
||||
buttons: [ { id: "copy", label: "Copy color from Skybox",
|
||||
className: "black", onClick: copySkyboxColorToAmbientColor } ],
|
||||
propertyID: "copyColorToAmbient",
|
||||
showPropertyRule: { "ambientLightMode": "enabled" },
|
||||
},
|
||||
{
|
||||
label: "Ambient Intensity",
|
||||
type: "number-draggable",
|
||||
|
@ -495,7 +505,7 @@ const GROUPS = [
|
|||
},
|
||||
{
|
||||
type: "buttons",
|
||||
buttons: [ { id: "copy", label: "Copy from Skybox",
|
||||
buttons: [ { id: "copy", label: "Copy URL from Skybox",
|
||||
className: "black", onClick: copySkyboxURLToAmbientURL } ],
|
||||
propertyID: "copyURLToAmbient",
|
||||
showPropertyRule: { "ambientLightMode": "enabled" },
|
||||
|
@ -2156,28 +2166,39 @@ const GROUPS = [
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
id: "children",
|
||||
label: "CHILD ENTITIES",
|
||||
properties: [
|
||||
{
|
||||
label: "Children",
|
||||
type: "childList",
|
||||
propertyID: "children",
|
||||
}
|
||||
]
|
||||
},
|
||||
];
|
||||
|
||||
const GROUPS_PER_TYPE = {
|
||||
None: [ 'base', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'collision', 'physics' ],
|
||||
Shape: [ 'base', 'shape', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'collision', 'physics' ],
|
||||
Text: [ 'base', 'text', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'collision', 'physics' ],
|
||||
None: [ 'base', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'collision', 'physics', 'children' ],
|
||||
Shape: [ 'base', 'shape', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'collision', 'physics', 'children' ],
|
||||
Text: [ 'base', 'text', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'collision', 'physics', 'children' ],
|
||||
Zone: [ 'base', 'zone', 'zone_key_light', 'zone_skybox', 'zone_ambient_light', 'zone_haze',
|
||||
'zone_bloom', 'zone_tonemapping', 'zone_ambient_occlusion', 'zone_avatar_priority',
|
||||
'zone_audio', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'physics' ],
|
||||
Model: [ 'base', 'model', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'collision', 'physics' ],
|
||||
Image: [ 'base', 'image', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'collision', 'physics' ],
|
||||
Web: [ 'base', 'web', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'collision', 'physics' ],
|
||||
Light: [ 'base', 'light', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'collision', 'physics' ],
|
||||
Material: [ 'base', 'material', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'physics' ],
|
||||
'zone_audio', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'physics', 'children' ],
|
||||
Model: [ 'base', 'model', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'collision', 'physics', 'children' ],
|
||||
Image: [ 'base', 'image', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'collision', 'physics', 'children' ],
|
||||
Web: [ 'base', 'web', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'collision', 'physics', 'children' ],
|
||||
Light: [ 'base', 'light', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'collision', 'physics', 'children' ],
|
||||
Material: [ 'base', 'material', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'physics', 'children' ],
|
||||
ParticleEffect: [ 'base', 'particles', 'particles_emit', 'particles_size', 'particles_color',
|
||||
'particles_behavior', 'particles_constraints', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'physics' ],
|
||||
ProceduralParticleEffect: [ 'base', 'particles_procedural', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'physics' ],
|
||||
PolyLine: [ 'base', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'collision', 'physics' ],
|
||||
PolyVox: [ 'base', 'polyvox', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'collision', 'physics' ],
|
||||
Grid: [ 'base', 'grid', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'physics' ],
|
||||
Sound: [ 'base', 'sound', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'physics' ],
|
||||
Multiple: [ 'base', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'collision', 'physics' ],
|
||||
'particles_behavior', 'particles_constraints', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'physics', 'children' ],
|
||||
ProceduralParticleEffect: [ 'base', 'particles_procedural', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'physics', 'children' ],
|
||||
PolyLine: [ 'base', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'collision', 'physics', 'children' ],
|
||||
PolyVox: [ 'base', 'polyvox', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'collision', 'physics', 'children' ],
|
||||
Grid: [ 'base', 'grid', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'physics', 'children' ],
|
||||
Sound: [ 'base', 'sound', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'physics', 'children' ],
|
||||
Multiple: [ 'base', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'collision', 'physics', 'children' ],
|
||||
};
|
||||
|
||||
const EDITOR_TIMEOUT_DURATION = 1500;
|
||||
|
@ -2247,6 +2268,7 @@ let currentSpaceMode = PROPERTY_SPACE_MODE.LOCAL;
|
|||
let zonesList = [];
|
||||
let canViewAssetURLs = false;
|
||||
let maSelectedId;
|
||||
let skyboxColorForCopy;
|
||||
|
||||
function createElementFromHTML(htmlString) {
|
||||
let elTemplate = document.createElement('template');
|
||||
|
@ -2440,6 +2462,10 @@ function resetProperties() {
|
|||
setZonesSelectionData(property.elInput, false);
|
||||
break;
|
||||
}
|
||||
case 'childList': {
|
||||
setChildListData(property.elInput, undefined, "");
|
||||
break;
|
||||
}
|
||||
case 'icon': {
|
||||
property.elSpan.style.display = "none";
|
||||
break;
|
||||
|
@ -3643,6 +3669,10 @@ function createProperty(propertyData, propertyElementID, propertyName, propertyI
|
|||
property.elInput = createZonesSelection(property, elProperty);
|
||||
break;
|
||||
}
|
||||
case 'childList': {
|
||||
property.elInput = createChildList(property, elProperty);
|
||||
break;
|
||||
}
|
||||
case 'icon': {
|
||||
property.elSpan = createIconProperty(property, elProperty);
|
||||
break;
|
||||
|
@ -3791,6 +3821,10 @@ function copySkyboxURLToAmbientURL() {
|
|||
updateProperty("ambientLight.ambientURL", skyboxURL, false);
|
||||
}
|
||||
|
||||
function copySkyboxColorToAmbientColor() {
|
||||
updateProperty("ambientLight.ambientColor", skyboxColorForCopy, false);
|
||||
}
|
||||
|
||||
function copyPositionProperty() {
|
||||
EventBridge.emitWebEvent(JSON.stringify({
|
||||
type: "action",
|
||||
|
@ -4753,6 +4787,251 @@ function setZonesSelectionData(element, isEditable) {
|
|||
displaySelectedZones(element.id, isEditable);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* CHILD ENTITIES FUNCTIONS
|
||||
*/
|
||||
|
||||
function createChildList(property, elProperty) {
|
||||
let elementID = property.elementID;
|
||||
elProperty.className = "childEntityList";
|
||||
|
||||
let elInput = document.createElement('div');
|
||||
elInput.setAttribute("id", "childList-" + elementID);
|
||||
|
||||
elProperty.appendChild(elInput);
|
||||
return elInput;
|
||||
}
|
||||
|
||||
function setChildListData(element, children, parentID, entityHostType = "") {
|
||||
|
||||
let childListContainer = document.getElementById(element.id);
|
||||
let renderer = "";
|
||||
let i;
|
||||
renderer += "<div id='childEntityActionsContainer'>";
|
||||
if (parentID !== "") {
|
||||
renderer += "<div id='viewParentContainer'><span class='viewParent' onClick='navigateToSpecificEntity(" + '"'+ parentID + '"'+ ")'><font class='viewParentIcon'>1</font>View Parent</span></div>";
|
||||
} else {
|
||||
renderer += "<div id='viewParentContainer'></div>";
|
||||
}
|
||||
if ((entityHostType === "domain" || entityHostType === "avatar") && children !== undefined) {
|
||||
renderer += "<div id='addChildEntityContainer'><span class='viewParent' onClick='openCreateChildEntityAssistant(" + '"' + entityHostType + '"' + ")'>+ Add Child Entity </span></div>";
|
||||
} else {
|
||||
renderer += "<div id='addChildEntityContainer'></div>";
|
||||
}
|
||||
renderer += "</div>";
|
||||
|
||||
renderer += "<table>";
|
||||
renderer += "<tr><th class='childrenTableHeader' width='30%'>TYPE</th><th class='childrenTableHeader' width='65%'>NAME</th><th class='childrenTableHeader' width='5%'>VIEW</th></tr>";
|
||||
if (children === undefined) {
|
||||
renderer += "<tr><td colspan = '3' style='text-align: center;'><i>Not applicable</i></td></tr>";
|
||||
} else {
|
||||
if (children.length > 0) {
|
||||
for (i = 0; i < children.length; i++ ) {
|
||||
let entityHostTypeClass = "";
|
||||
if (children[i].entityHostType !== "domain") {
|
||||
entityHostTypeClass = " class='" + children[i].entityHostType + "Entity'";
|
||||
}
|
||||
let navigatorBtn = "<span class='viewChildProperties' onClick='navigateToSpecificEntity(" + '"'+ children[i].id + '"'+ ")'>🡆</span>";
|
||||
renderer += "<tr" + entityHostTypeClass + "><td>" + children[i].type + "</td><td>" + children[i].name + "</td><td>" + navigatorBtn + "</td></tr>";
|
||||
}
|
||||
} else {
|
||||
renderer += "<tr><td colspan = '3' style='text-align: center;'><i>No children</i></td></tr>";
|
||||
}
|
||||
}
|
||||
renderer += "</table>";
|
||||
childListContainer.innerHTML = renderer;
|
||||
}
|
||||
|
||||
function navigateToSpecificEntityFromParentID() {
|
||||
let parentID = getPropertyInputElement("parentID").value;
|
||||
if (parentID !== "" && parentID !== UUID_NONE) {
|
||||
navigateToSpecificEntity(parentID);
|
||||
}
|
||||
}
|
||||
|
||||
function setParentIdNavigationAvailable(selectionLength) {
|
||||
$('#property-parentID-button-navigateToParentEntity').attr('disabled', selectionLength !== 1);
|
||||
}
|
||||
|
||||
function navigateToSpecificEntity(id) {
|
||||
EventBridge.emitWebEvent(JSON.stringify({
|
||||
type: "specificEntityNavigation",
|
||||
id: id
|
||||
}));
|
||||
}
|
||||
|
||||
//CREATE CHILD ENTITY FUNCTIONS:
|
||||
|
||||
function openCreateChildEntityAssistant(entityHostType) {
|
||||
$('#uiCreateChildEntityAssistant').show();
|
||||
$('#properties-list').hide();
|
||||
generateCreateChildEntityAssistant(entityHostType);
|
||||
}
|
||||
|
||||
function generateCreateChildEntityAssistant(entityHostType) {
|
||||
let entityType = [
|
||||
{"type": "Model", "name": "Model"},
|
||||
{"type": "Shape", "name": "Shape"},
|
||||
{"type": "Text", "name": "Text"},
|
||||
{"type": "Image", "name": "Image"},
|
||||
{"type": "Web", "name": "Web"},
|
||||
{"type": "ParticleEffect", "name": "Particle"},
|
||||
{"type": "ProceduralParticleEffect", "name": "Proc. Part."},
|
||||
{"type": "Light", "name": "Light"},
|
||||
{"type": "Zone", "name": "Zone"},
|
||||
{"type": "Material", "name": "Material"},
|
||||
{"type": "Sound", "name": "Sound"},
|
||||
{"type": "PolyVox", "name": "Voxel"},
|
||||
];
|
||||
const TILES_PER_ROW = 4;
|
||||
let renderer = "<div id='typeSelectorCreateChildEntityAssistant' style = 'display: block;'>";
|
||||
let i;
|
||||
let rowCount = 0;
|
||||
for (i = 0; i < entityType.length; i++) {
|
||||
if (rowCount === 0) {
|
||||
renderer += "<div>";
|
||||
}
|
||||
rowCount++;
|
||||
renderer += "<span class='tileCreateChildEntityAssistant-" + entityHostType + "' onclick='selectTypeInChildEntityAssistant(" + '"' + entityType[i].type + '"' + ", " + '"' + entityHostType + '"' + ")'>";
|
||||
renderer += "<font class = 'iconCreateChildEntityAssistant'>" + ENTITY_TYPE_ICON[entityType[i].type] + "</font><br>" + entityType[i].name.toUpperCase() + "</span>";
|
||||
if (rowCount === TILES_PER_ROW) {
|
||||
renderer += "</div>";
|
||||
rowCount = 0;
|
||||
}
|
||||
}
|
||||
if (rowCount !== 0) {
|
||||
renderer += "</div>";
|
||||
}
|
||||
renderer += "</div>";
|
||||
|
||||
renderer += "<div id='paramaterCreateChildEntityAssistant' style='display: none;'>";
|
||||
renderer += "<div id='nameCreateChildEntityAssistant'></div><br>";
|
||||
renderer += "<font class='addChildEntity-" + entityHostType + "'>URL: </font><input id='urlCreateChildEntityAssistant' type='text'><br><br>";
|
||||
renderer += "<div style='text-align: right;'>";
|
||||
renderer += "<input type='button' class='black' id='cancelBtnCreateChildEntityAssistant' value='Cancel'> ";
|
||||
renderer += "<input type='button' class='white' id='createBtnCreateChildEntityAssistant' value='Create'>";
|
||||
renderer += "<div>";
|
||||
renderer += "</div>";
|
||||
|
||||
document.getElementById("uiCreateChildEntityAssistant-form").innerHTML = renderer;
|
||||
}
|
||||
|
||||
function selectTypeInChildEntityAssistant(type, entityHostType) {
|
||||
if (type === "Model" || type === "Sound") { //Only if the url is cruxial. We want the less entry as possible for the user.
|
||||
document.getElementById("nameCreateChildEntityAssistant").innerHTML = "<br><br><font class='addChildEntity-" + entityHostType + "'>Create a child '" + type + "' entity<br>";
|
||||
document.getElementById("typeSelectorCreateChildEntityAssistant").style.display = "none";
|
||||
document.getElementById("paramaterCreateChildEntityAssistant").style.display = "block";
|
||||
document.getElementById("createBtnCreateChildEntityAssistant").setAttribute("onclick","createChildEntity('" + type + "', '" + entityHostType + "')");
|
||||
document.getElementById("cancelBtnCreateChildEntityAssistant").setAttribute("onclick","closeCreateChildEntityAssistant()");
|
||||
} else {
|
||||
createChildEntity(type, entityHostType);
|
||||
}
|
||||
}
|
||||
|
||||
function createChildEntity(type, entityHostType) {
|
||||
let url = document.getElementById("urlCreateChildEntityAssistant").value;
|
||||
let parentID = getPropertyInputElement("id").value;
|
||||
let properties;
|
||||
switch(type) {
|
||||
case "Model":
|
||||
properties = {
|
||||
"type": type,
|
||||
"modelURL": url,
|
||||
"parentID": parentID,
|
||||
"shapeType": "static-mesh",
|
||||
"dynamic": false,
|
||||
"grab": {"grabbable": false},
|
||||
"useOriginalPivot": true
|
||||
};
|
||||
break;
|
||||
case "Shape":
|
||||
properties = {
|
||||
"type": type,
|
||||
"parentID": parentID,
|
||||
"shape": "Cube"
|
||||
};
|
||||
break;
|
||||
case "Text":
|
||||
properties = {
|
||||
"type": type,
|
||||
"parentID": parentID
|
||||
};
|
||||
break;
|
||||
case "Image":
|
||||
properties = {
|
||||
"type": type,
|
||||
"parentID": parentID
|
||||
};
|
||||
break;
|
||||
case "Web":
|
||||
properties = {
|
||||
"type": type,
|
||||
"parentID": parentID
|
||||
};
|
||||
break;
|
||||
case "ParticleEffect":
|
||||
properties = {
|
||||
"type": type,
|
||||
"parentID": parentID
|
||||
};
|
||||
break;
|
||||
case "ProceduralParticleEffect":
|
||||
properties = {
|
||||
"type": type,
|
||||
"parentID": parentID
|
||||
};
|
||||
break;
|
||||
case "Light":
|
||||
properties = {
|
||||
"type": type,
|
||||
"parentID": parentID
|
||||
};
|
||||
break;
|
||||
case "Zone":
|
||||
properties = {
|
||||
"type": type,
|
||||
"parentID": parentID
|
||||
};
|
||||
break;
|
||||
case "Material":
|
||||
properties = {
|
||||
"type": type,
|
||||
"materialURL": "materialData",
|
||||
"materialData": JSON.stringify({ "materials": {} }),
|
||||
"parentID": parentID,
|
||||
"priority": 1
|
||||
};
|
||||
break;
|
||||
case "Sound":
|
||||
properties = {
|
||||
"type": type,
|
||||
"soundURL": url,
|
||||
"parentID": parentID
|
||||
};
|
||||
break;
|
||||
case "PolyVox":
|
||||
properties = {
|
||||
"type": type,
|
||||
"parentID": parentID
|
||||
};
|
||||
break;
|
||||
}
|
||||
|
||||
EventBridge.emitWebEvent(JSON.stringify({
|
||||
"type": "createChildEntity",
|
||||
"properties": properties,
|
||||
"entityHostType": entityHostType
|
||||
}));
|
||||
|
||||
closeCreateChildEntityAssistant();
|
||||
}
|
||||
|
||||
function closeCreateChildEntityAssistant() {
|
||||
$('#uiCreateChildEntityAssistant').hide();
|
||||
$('#properties-list').show();
|
||||
}
|
||||
|
||||
/**
|
||||
* MATERIAL TARGET FUNCTIONS
|
||||
*/
|
||||
|
@ -4925,15 +5204,21 @@ function handleEntitySelectionUpdate(selections, isPropertiesToolUpdate) {
|
|||
selectedEntityIDs = new Set(selections.map(selection => selection.id));
|
||||
const multipleSelections = currentSelections.length > 1;
|
||||
const hasSelectedEntityChanged = !areSetsEqual(selectedEntityIDs, previouslySelectedEntityIDs);
|
||||
|
||||
|
||||
if (selections.length === 1) {
|
||||
if (maSelectedId !== selections[0].id) {
|
||||
closeMaterialAssistant();
|
||||
}
|
||||
maSelectedId = selections[0].id;
|
||||
if (selections[0].properties.type === "Zone") {
|
||||
skyboxColorForCopy = selections[0].properties.skybox.color;
|
||||
} else {
|
||||
skyboxColorForCopy = undefined;
|
||||
}
|
||||
} else {
|
||||
closeMaterialAssistant();
|
||||
maSelectedId = "";
|
||||
skyboxColorForCopy = undefined;
|
||||
}
|
||||
|
||||
requestZoneList();
|
||||
|
@ -4974,6 +5259,8 @@ function handleEntitySelectionUpdate(selections, isPropertiesToolUpdate) {
|
|||
setCopyPastePositionAndRotationAvailability (selections.length, true);
|
||||
|
||||
disableProperties();
|
||||
|
||||
setParentIdNavigationAvailable(selections.length);
|
||||
} else {
|
||||
let entityHostType = selections[0].properties.entityHostType;
|
||||
|
||||
|
@ -4984,6 +5271,7 @@ function handleEntitySelectionUpdate(selections, isPropertiesToolUpdate) {
|
|||
}
|
||||
|
||||
if (hasSelectedEntityChanged) {
|
||||
closeCreateChildEntityAssistant();
|
||||
if (!multipleSelections) {
|
||||
resetServerScriptStatus();
|
||||
}
|
||||
|
@ -5006,6 +5294,7 @@ function handleEntitySelectionUpdate(selections, isPropertiesToolUpdate) {
|
|||
disableProperties();
|
||||
getPropertyInputElement('locked').removeAttribute('disabled');
|
||||
setCopyPastePositionAndRotationAvailability (selections.length, true);
|
||||
setParentIdNavigationAvailable(selections.length);
|
||||
} else {
|
||||
enableProperties();
|
||||
disableSaveUserDataButton();
|
||||
|
@ -5013,6 +5302,7 @@ function handleEntitySelectionUpdate(selections, isPropertiesToolUpdate) {
|
|||
disableSaveParticleUpdateDataButton();
|
||||
disableSaveParticleRenderDataButton();
|
||||
setCopyPastePositionAndRotationAvailability (selections.length, false);
|
||||
setParentIdNavigationAvailable(selections.length);
|
||||
}
|
||||
|
||||
Object.entries(properties).forEach(function([propertyID, property]) {
|
||||
|
@ -5037,7 +5327,9 @@ function handleEntitySelectionUpdate(selections, isPropertiesToolUpdate) {
|
|||
|
||||
const isSubProperty = propertyData.subPropertyOf !== undefined;
|
||||
if (propertyValue === undefined && !isMultiDiffValue && !isSubProperty) {
|
||||
return;
|
||||
if (propertyData.type !== "childList") {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!shownGroups.includes(property.group_id)) {
|
||||
|
@ -5198,6 +5490,14 @@ function handleEntitySelectionUpdate(selections, isPropertiesToolUpdate) {
|
|||
}
|
||||
break;
|
||||
}
|
||||
case 'childList': {
|
||||
let parentID = selections[0].properties.parentID;
|
||||
if (selections.length !== 1 || parentID === UUID_NONE) {
|
||||
parentID = "";
|
||||
}
|
||||
setChildListData(property.elInput, propertyValue, parentID, entityHostType);
|
||||
break;
|
||||
}
|
||||
case 'icon': {
|
||||
property.elSpan.innerHTML = propertyData.icons[propertyValue];
|
||||
property.elSpan.style.display = "inline-block";
|
||||
|
@ -5641,6 +5941,9 @@ function loaded() {
|
|||
elScript.parentNode.className = "url refresh";
|
||||
elServerScripts.parentNode.className = "url refresh";
|
||||
|
||||
let elParentID = getPropertyInputElement("parentID");
|
||||
elParentID.parentNode.className = "url refresh";
|
||||
|
||||
// User Data
|
||||
let userDataProperty = properties["userData"];
|
||||
let elUserData = userDataProperty.elInput;
|
||||
|
|
BIN
scripts/system/create/entityProperties/html/tabs/children.png
Normal file
BIN
scripts/system/create/entityProperties/html/tabs/children.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 762 B |
175
scripts/system/html/css/createChildEntityAssistant.css
Normal file
175
scripts/system/html/css/createChildEntityAssistant.css
Normal file
|
@ -0,0 +1,175 @@
|
|||
/*
|
||||
// createChildEntityAssistant.css
|
||||
//
|
||||
// Created by Alezia Kurdis on March 3rd, 2025.
|
||||
// Copyright 2025 Overte e.V.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
*/
|
||||
|
||||
#uiCreateChildEntityAssistant {
|
||||
position: fixed;
|
||||
display: none;
|
||||
width: 100%;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
right: 0px;
|
||||
bottom: 0px;
|
||||
border: 0px;
|
||||
padding: 0px;
|
||||
background-color: #404040;
|
||||
z-index: 2;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
#uiCreateChildEntityAssistant-scrollable {
|
||||
border-collapse: collapse;
|
||||
overflow-y: scroll;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#uiCreateChildEntityAssistant-headerContainer {
|
||||
width: 98%;
|
||||
text-align: right;
|
||||
padding: 6px;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
#uiCreateChildEntityAssistant-closeButton {
|
||||
font-family: Raleway-Bold;
|
||||
font-size: 18px;
|
||||
text-align: center;
|
||||
border: 0px;
|
||||
padding: 6px;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
font.uiCreateChildEntityAssistant-Explain{
|
||||
background-color: #2E2E2E;
|
||||
font-family: Raleway-Regular;
|
||||
text-decoration: Italic;
|
||||
font-size: 10px;
|
||||
color: #8ad5ff;
|
||||
}
|
||||
|
||||
font.uiCreateChildEntityAssistant-label{
|
||||
background-color: #2E2E2E;
|
||||
font-family: Raleway-SemiBold;
|
||||
text-decoration: none;
|
||||
font-size: 12px;
|
||||
color: #D2D2D2;
|
||||
}
|
||||
|
||||
label.uiCreateChildEntityAssistant-label{
|
||||
background-color: #2E2E2E;
|
||||
font-family: Raleway-SemiBold;
|
||||
text-decoration: none;
|
||||
font-size: 12px;
|
||||
color: #D2D2D2;
|
||||
}
|
||||
|
||||
font.uiCreateChildEntityAssistant-title{
|
||||
background-color: #404040;
|
||||
font-family: Raleway-Bold;
|
||||
font-size: 18px;
|
||||
text-decoration: none;
|
||||
color: #F2F2F2;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
#urlCreateChildEntityAssistant {
|
||||
background-color: #222222;
|
||||
color: #bbbbbb;
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
#childEntityActionsContainer {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
#viewParentContainer {
|
||||
display: inline-block;
|
||||
text-align: left;
|
||||
width: 50%;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
#addChildEntityContainer {
|
||||
display: inline-block;
|
||||
width: 50%;
|
||||
text-align: right;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
span.tileCreateChildEntityAssistant-domain {
|
||||
border: 2px solid #000000;
|
||||
background-color: #000000;
|
||||
padding: 5px;
|
||||
margin: 10px;
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
border-radius: 10px;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
color: #FFFFFF;
|
||||
font-family: FiraSans-SemiBold;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
span.tileCreateChildEntityAssistant-domain:hover {
|
||||
border: 2px solid #FFFFFF;
|
||||
}
|
||||
|
||||
span.tileCreateChildEntityAssistant-avatar {
|
||||
border: 2px solid #000000;
|
||||
background-color: #000000;
|
||||
padding: 5px;
|
||||
margin: 10px;
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
align-items: center;
|
||||
border-radius: 10px;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
color: #7fdb98;
|
||||
font-family: FiraSans-SemiBold;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
span.tileCreateChildEntityAssistant-avatar:hover {
|
||||
border: 2px solid #7fdb98;
|
||||
}
|
||||
|
||||
span.viewChildProperties {
|
||||
width: 100%;
|
||||
padding-left: 12px;
|
||||
padding-right: 12px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
font.iconCreateChildEntityAssistant {
|
||||
font-family: HiFi-Glyphs;
|
||||
font-size: 50px;
|
||||
}
|
||||
|
||||
#typeSelectorCreateChildEntityAssistant {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
font.addChildEntity-domain {
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
font.addChildEntity-avatar {
|
||||
color: #7fdb98;
|
||||
}
|
||||
|
||||
#paramaterCreateChildEntityAssistant {
|
||||
font-family: FiraSans-SemiBold;
|
||||
font-size: 14px;
|
||||
padding: 10px;
|
||||
}
|
|
@ -175,10 +175,21 @@ tr:focus {
|
|||
outline: none;
|
||||
}
|
||||
|
||||
th.childrenTableHeader {
|
||||
height: 26px;
|
||||
background-color: #1c1c1c;
|
||||
border-right: 1px solid #575757;
|
||||
border-bottom: 1px solid #575757;
|
||||
}
|
||||
|
||||
tr.avatarEntity {
|
||||
color: #7fdb98;
|
||||
}
|
||||
|
||||
tr.localEntity {
|
||||
color: #f0d769;
|
||||
}
|
||||
|
||||
tr.selAvatarEntity {
|
||||
color: #000000;
|
||||
background-color: #7fdb98;
|
||||
|
@ -468,6 +479,18 @@ input[type=button].glyph, button.hifi-edit-button.glyph {
|
|||
padding: 0;
|
||||
}
|
||||
|
||||
input[type=button].navigation, button.hifi-edit-button.navigation {
|
||||
font-family: HiFi-Glyphs;
|
||||
font-size: 20px;
|
||||
text-transform: none;
|
||||
min-width: 32px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
input[type=button].navigation:focus, button.hifi-edit-button.navigation:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
input[type=button].normal, button.hifi-edit-button.normal {
|
||||
font-family: FiraSans-SemiBold;
|
||||
font-size: 15px;
|
||||
|
@ -2259,3 +2282,13 @@ div.menu-item-caption {
|
|||
div.menu-item-shortcut {
|
||||
float: right;
|
||||
}
|
||||
|
||||
span.viewParent {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
font.viewParentIcon {
|
||||
font-family: HiFi-Glyphs;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue