mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Merge pull request #7123 from ericrius1/editProps
added collidesWith property to entities list
This commit is contained in:
commit
e3ae2baa7b
2 changed files with 120 additions and 2 deletions
|
@ -47,6 +47,17 @@
|
|||
);
|
||||
};
|
||||
}
|
||||
|
||||
function createEmitCheckedToStringPropertyUpdateFunction(checkboxElement, name, propertyName) {
|
||||
var newString = "";
|
||||
if (checkboxElement.checked) {
|
||||
newString += name + "";
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function createEmitGroupCheckedPropertyUpdateFunction(group, propertyName) {
|
||||
return function () {
|
||||
var properties = {};
|
||||
|
@ -207,6 +218,28 @@
|
|||
}
|
||||
};
|
||||
|
||||
function updateCheckedSubProperty(propertyName, propertyValue, subPropertyElement, subPropertyString) {
|
||||
if (subPropertyElement.checked) {
|
||||
if (propertyValue.indexOf(subPropertyString)) {
|
||||
propertyValue += subPropertyString + ',';
|
||||
}
|
||||
} else {
|
||||
// We've unchecked, so remove
|
||||
propertyValue = propertyValue.replace(subPropertyString + ",", "");
|
||||
}
|
||||
|
||||
var _properties ={}
|
||||
_properties[propertyName] = propertyValue;
|
||||
|
||||
EventBridge.emitWebEvent(
|
||||
JSON.stringify({
|
||||
type: "update",
|
||||
properties: _properties
|
||||
})
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
function loaded() {
|
||||
openEventBridge(function() {
|
||||
var allSections = [];
|
||||
|
@ -263,6 +296,11 @@
|
|||
var elDensity = document.getElementById("property-density");
|
||||
var elCollisionless = document.getElementById("property-collisionless");
|
||||
var elDynamic = document.getElementById("property-dynamic" );
|
||||
var elCollideStatic = document.getElementById("property-collide-static");
|
||||
var elCollideDynamic = document.getElementById("property-collide-dynamic");
|
||||
var elCollideKinematic = document.getElementById("property-collide-kinematic");
|
||||
var elCollideMyAvatar = document.getElementById("property-collide-myAvatar");
|
||||
var elCollideOtherAvatar = document.getElementById("property-collide-otherAvatar");
|
||||
var elCollisionSoundURL = document.getElementById("property-collision-sound-url");
|
||||
var elLifetime = document.getElementById("property-lifetime");
|
||||
var elScriptURL = document.getElementById("property-script-url");
|
||||
|
@ -370,6 +408,7 @@
|
|||
var elPreviewCameraButton = document.getElementById("preview-camera-button");
|
||||
|
||||
if (window.EventBridge !== undefined) {
|
||||
var properties;
|
||||
EventBridge.scriptEventReceived.connect(function(data) {
|
||||
data = JSON.parse(data);
|
||||
if (data.type == "update") {
|
||||
|
@ -411,7 +450,7 @@
|
|||
var selected = false;
|
||||
}
|
||||
|
||||
var properties = data.selections[0].properties;
|
||||
properties = data.selections[0].properties;
|
||||
|
||||
elID.innerHTML = properties.id;
|
||||
|
||||
|
@ -425,6 +464,7 @@
|
|||
} else {
|
||||
enableChildren(document.getElementById("properties-list"), 'input');
|
||||
}
|
||||
|
||||
|
||||
elName.value = properties.name;
|
||||
|
||||
|
@ -473,6 +513,15 @@
|
|||
elDensity.value = properties.density.toFixed(4);
|
||||
elCollisionless.checked = properties.collisionless;
|
||||
elDynamic.checked = properties.dynamic;
|
||||
|
||||
|
||||
elCollideStatic.checked = properties.collidesWith.indexOf("static") > -1;
|
||||
elCollideKinematic.checked = properties.collidesWith.indexOf("kinematic") > -1;
|
||||
elCollideDynamic.checked = properties.collidesWith.indexOf("dynamic") > -1;
|
||||
elCollideMyAvatar.checked = properties.collidesWith.indexOf("myAvatar") > -1;
|
||||
elCollideOtherAvatar.checked = properties.collidesWith.indexOf("otherAvatar") > -1;
|
||||
|
||||
|
||||
elCollisionSoundURL.value = properties.collisionSoundURL;
|
||||
elLifetime.value = properties.lifetime;
|
||||
elScriptURL.value = properties.script;
|
||||
|
@ -682,6 +731,29 @@
|
|||
elDensity.addEventListener('change', createEmitNumberPropertyUpdateFunction('density'));
|
||||
elCollisionless.addEventListener('change', createEmitCheckedPropertyUpdateFunction('collisionless'));
|
||||
elDynamic.addEventListener('change', createEmitCheckedPropertyUpdateFunction('dynamic'));
|
||||
|
||||
|
||||
|
||||
|
||||
elCollideDynamic.addEventListener('change', function() {
|
||||
updateCheckedSubProperty("collidesWith", properties.collidesWith, elCollideDynamic, 'dynamic');
|
||||
});
|
||||
|
||||
elCollideKinematic.addEventListener('change', function() {
|
||||
updateCheckedSubProperty("collidesWith", properties.collidesWith, elCollideKinematic, 'kinematic');
|
||||
});
|
||||
|
||||
elCollideStatic.addEventListener('change', function() {
|
||||
updateCheckedSubProperty("collidesWith", properties.collidesWith, elCollideStatic, 'static');
|
||||
});
|
||||
elCollideMyAvatar.addEventListener('change', function() {
|
||||
updateCheckedSubProperty("collidesWith", properties.collidesWith, elCollideMyAvatar, 'myAvatar');
|
||||
});
|
||||
elCollideOtherAvatar.addEventListener('change', function() {
|
||||
updateCheckedSubProperty("collidesWith", properties.collidesWith, elCollideOtherAvatar, 'otherAvatar');
|
||||
});
|
||||
|
||||
|
||||
elCollisionSoundURL.addEventListener('change', createEmitTextPropertyUpdateFunction('collisionSoundURL'));
|
||||
|
||||
elLifetime.addEventListener('change', createEmitNumberPropertyUpdateFunction('lifetime'));
|
||||
|
@ -1357,6 +1429,48 @@
|
|||
<span class="value">
|
||||
<input type='checkbox' id="property-dynamic">
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class = "sub-section-header"> Collides With: </div>
|
||||
<div class = "sub-props-checkbox-group">
|
||||
<div class="property">
|
||||
<span class="label"> static</span>
|
||||
<span class="value">
|
||||
<input type='checkbox' id="property-collide-static">
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="property">
|
||||
<span class="label"> dynamic</span>
|
||||
<span class="value">
|
||||
<input type='checkbox' id="property-collide-dynamic">
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="property">
|
||||
<span class="label"> kinematic</span>
|
||||
<span class="value">
|
||||
<input type='checkbox' id="property-collide-kinematic">
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="property">
|
||||
<span class="label"> myAvatar</span>
|
||||
<span class="value">
|
||||
<input type='checkbox' id="property-collide-myAvatar">
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="property">
|
||||
<span class="label"> otherAvatar</span>
|
||||
<span class="value">
|
||||
<input type='checkbox' id="property-collide-otherAvatar">
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="property">
|
||||
|
@ -1512,4 +1626,4 @@
|
|||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
@ -263,6 +263,10 @@ table#properties-list {
|
|||
border-bottom: 0.75pt solid #e5e5e5;
|
||||
}
|
||||
|
||||
.sub-props-checkbox-group {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
#properties-list .label {
|
||||
font-weight: bold;
|
||||
overflow: hidden;
|
||||
|
|
Loading…
Reference in a new issue