diff --git a/examples/editEntities.js b/examples/editEntities.js
index 9b13b167e7..ef6472e4b8 100644
--- a/examples/editEntities.js
+++ b/examples/editEntities.js
@@ -934,24 +934,37 @@ PropertiesTool = function(opts) {
data = {
type: 'update',
};
- if (selectionManager.hasSelection()) {
- data.id = selectionManager.selections[0].id;
- data.properties = Entities.getEntityProperties(selectionManager.selections[0]);
- data.properties.rotation = Quat.safeEulerAngles(data.properties.rotation);
+ var selections = [];
+ for (var i = 0; i < selectionManager.selections.length; i++) {
+ var entity = {};
+ entity.id = selectionManager.selections[i].id;
+ entity.properties = Entities.getEntityProperties(selectionManager.selections[i]);
+ entity.properties.rotation = Quat.safeEulerAngles(entity.properties.rotation);
+ selections.push(entity);
}
+ data.selections = selections;
webView.eventBridge.emitScriptEvent(JSON.stringify(data));
});
webView.eventBridge.webEventReceived.connect(function(data) {
- print(data);
data = JSON.parse(data);
if (data.type == "update") {
selectionManager.saveProperties();
- if (data.properties.rotation !== undefined) {
- var rotation = data.properties.rotation;
- data.properties.rotation = Quat.fromPitchYawRollDegrees(rotation.x, rotation.y, rotation.z);
+ if (selectionManager.selections.length > 1) {
+ properties = {
+ locked: data.properties.locked,
+ visible: data.properties.visible,
+ };
+ for (var i = 0; i < selectionManager.selections.length; i++) {
+ Entities.editEntity(selectionManager.selections[i], properties);
+ }
+ } else {
+ if (data.properties.rotation !== undefined) {
+ var rotation = data.properties.rotation;
+ data.properties.rotation = Quat.fromPitchYawRollDegrees(rotation.x, rotation.y, rotation.z);
+ }
+ Entities.editEntity(selectionManager.selections[0], data.properties);
}
- Entities.editEntity(selectionManager.selections[0], data.properties);
pushCommandForSelections();
selectionManager._update();
} else if (data.type == "action") {
diff --git a/examples/html/entityProperties.html b/examples/html/entityProperties.html
index ad2b359e79..f264b569d6 100644
--- a/examples/html/entityProperties.html
+++ b/examples/html/entityProperties.html
@@ -171,12 +171,37 @@
EventBridge.scriptEventReceived.connect(function(data) {
data = JSON.parse(data);
if (data.type == "update") {
- if (data.properties === undefined) {
- disableChildren(document.getElementById("properties"), 'input');
- } else {
- var properties = data.properties;
+ if (data.selections.length == 0) {
+ elType.innerHTML = "No Selection";
+ elID.innerHTML = "";
+ disableChildren(document.getElementById("properties-list"), 'input');
+ } else if (data.selections.length > 1) {
+ var selections = data.selections;
- elID.innerHTML = data.id;
+ var ids = [];
+ var types = {};
+
+ for (var i = 0; i < selections.length; i++) {
+ ids.push(selections[i].id);
+ var type = selections[i].properties.type;
+ if (types[type] === undefined) {
+ types[type] = 0;
+ }
+ types[type]++;
+ }
+ elID.innerHTML = ids.join("
");
+
+ var typeStrs = [];
+ for (type in types) {
+ typeStrs.push(type + " (" + types[type] + ")");
+ }
+ elType.innerHTML = typeStrs.join(", ");
+
+ disableChildren(document.getElementById("properties-list"), 'input');
+ } else {
+ var properties = data.selections[0].properties;
+
+ elID.innerHTML = properties.id;
elType.innerHTML = properties.type;