mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Merge pull request #4956 from Triplelexx/particle-entityProperties
expose particle properties for editing
This commit is contained in:
commit
8c0bf19536
1 changed files with 88 additions and 3 deletions
|
@ -287,6 +287,18 @@
|
|||
allSections.push(elWebSections);
|
||||
var elWebSourceURL = document.getElementById("property-web-source-url");
|
||||
|
||||
var elParticleSections = document.querySelectorAll(".particle-section");
|
||||
allSections.push(elParticleSections);
|
||||
var elParticleMaxParticles = document.getElementById("property-particle-maxparticles");
|
||||
var elParticleLifeSpan = document.getElementById("property-particle-lifespan");
|
||||
var elParticleEmitRate = document.getElementById("property-particle-emit-rate");
|
||||
var elParticleEmitDirectionX = document.getElementById("property-particle-emit-direction-x");
|
||||
var elParticleEmitDirectionY = document.getElementById("property-particle-emit-direction-y");
|
||||
var elParticleEmitDirectionZ = document.getElementById("property-particle-emit-direction-z");
|
||||
var elParticleEmitStrength = document.getElementById("property-particle-emit-strength");
|
||||
var elParticleLocalGravity = document.getElementById("property-particle-localgravity");
|
||||
var elParticleRadius = document.getElementById("property-particle-radius");
|
||||
|
||||
var elTextSections = document.querySelectorAll(".text-section");
|
||||
allSections.push(elTextSections);
|
||||
var elTextText = document.getElementById("property-text-text");
|
||||
|
@ -455,7 +467,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
if (properties.type == "Box" || properties.type == "Sphere") {
|
||||
if (properties.type == "Box" || properties.type == "Sphere" || properties.type == "ParticleEffect") {
|
||||
elColorSection.style.display = 'block';
|
||||
elColorRed.value = properties.color.red;
|
||||
elColorGreen.value = properties.color.green;
|
||||
|
@ -465,7 +477,7 @@
|
|||
elColorSection.style.display = 'none';
|
||||
}
|
||||
|
||||
if (properties.type == "Model") {
|
||||
if (properties.type == "Model" || properties.type == "ParticleEffect") {
|
||||
for (var i = 0; i < elModelSections.length; i++) {
|
||||
elModelSections[i].style.display = 'block';
|
||||
}
|
||||
|
@ -480,6 +492,21 @@
|
|||
elModelAnimationSettings.value = properties.animationSettings;
|
||||
elModelTextures.value = properties.textures;
|
||||
elModelOriginalTextures.value = properties.originalTextures;
|
||||
if (properties.type == "ParticleEffect") {
|
||||
for (var i = 0; i < elParticleSections.length; i++) {
|
||||
elParticleSections[i].style.display = 'block';
|
||||
}
|
||||
|
||||
elParticleMaxParticles.value = properties.maxParticles;
|
||||
elParticleLifeSpan.value = properties.lifespan.toFixed(2);
|
||||
elParticleEmitRate.value = properties.emitRate.toFixed(1);
|
||||
elParticleEmitDirectionX.value = properties.emitDirection.x.toFixed(2);
|
||||
elParticleEmitDirectionY.value = properties.emitDirection.y.toFixed(2);
|
||||
elParticleEmitDirectionZ.value = properties.emitDirection.z.toFixed(2);
|
||||
elParticleEmitStrength.value = properties.emitStrength.toFixed(2);
|
||||
elParticleLocalGravity.value = properties.localGravity.toFixed(2);
|
||||
elParticleRadius.value = properties.particleRadius.toFixed(3);
|
||||
}
|
||||
} else if (properties.type == "Web") {
|
||||
for (var i = 0; i < elWebSections.length; i++) {
|
||||
elWebSections[i].style.display = 'block';
|
||||
|
@ -678,6 +705,19 @@
|
|||
elLightCutoff.addEventListener('change', createEmitNumberPropertyUpdateFunction('cutoff'));
|
||||
|
||||
elWebSourceURL.addEventListener('change', createEmitTextPropertyUpdateFunction('sourceUrl'));
|
||||
|
||||
elParticleMaxParticles.addEventListener('change', createEmitNumberPropertyUpdateFunction('maxParticles'));
|
||||
elParticleLifeSpan.addEventListener('change', createEmitNumberPropertyUpdateFunction('lifespan'));
|
||||
elParticleEmitRate.addEventListener('change', createEmitNumberPropertyUpdateFunction('emitRate'));
|
||||
elParticleEmitDirection.addEventListener('change', createEmitNumberPropertyUpdateFunction('emitDirection'));
|
||||
var particleEmitDirectionChangeFunction = createEmitVec3PropertyUpdateFunctionWithMultiplier(
|
||||
'emitDirection', elParticleEmitDirectionX, elParticleEmitDirectionY, elParticleEmitDirectionZ, DEGREES_TO_RADIANS);
|
||||
elParticleEmitDirectionX.addEventListener('change', particleEmitDirectionChangeFunction);
|
||||
elParticleEmitDirectionY.addEventListener('change', particleEmitDirectionChangeFunction);
|
||||
elParticleEmitDirectionZ.addEventListener('change', particleEmitDirectionChangeFunction);
|
||||
elParticleEmitStrength.addEventListener('change', createEmitNumberPropertyUpdateFunction('emitStrength'));
|
||||
elParticleLocalGravity.addEventListener('change', createEmitNumberPropertyUpdateFunction('localGravity'));
|
||||
elParticleRadius.addEventListener('change', createEmitNumberPropertyUpdateFunction('particleRadius'));
|
||||
|
||||
elModelURL.addEventListener('change', createEmitTextPropertyUpdateFunction('modelURL'));
|
||||
elShapeType.addEventListener('change', createEmitTextPropertyUpdateFunction('shapeType'));
|
||||
|
@ -1069,7 +1109,52 @@
|
|||
<input type="text" id="property-web-source-url" class="url"></input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="particle-section property">
|
||||
<div class="label">Max Particles</div>
|
||||
<div class="value">
|
||||
<input type='number' id="property-particle-maxparticles" min="0" max="2048" step="1"></input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="particle-section property">
|
||||
<div class="label">Particle Life Span</div>
|
||||
<div class="value">
|
||||
<input type='number' id="property-particle-lifespan" min="0" step="0.1"></input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="particle-section property">
|
||||
<div class="label">Particle Emission Rate</div>
|
||||
<div class="value">
|
||||
<input type='number' id="property-particle-emit-rate" min="0" step="0.5"></input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="particle-section property">
|
||||
<div class="label">Particle Emission Direction</div>
|
||||
<div class="value">
|
||||
<div class="input-area">X <input class="coord" type='number' id="property-particle-emit-direction-x"></input></div>
|
||||
<div class="input-area">Y <input class="coord" type='number' id="property-particle-emit-direction-y"></input></div>
|
||||
<div class="input-area">Z <input class="coord" type='number' id="property-particle-emit-direction-z"></input></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="particle-section property">
|
||||
<div class="label">Particle Emission Strength</div>
|
||||
<div class="value">
|
||||
<input type='number' id="property-particle-emit-strength" min="0" step="0.1"></input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="particle-section property">
|
||||
<div class="label">Particle Local Gravity</div>
|
||||
<div class="value">
|
||||
<input class="coord" type='number' id="property-particle-localgravity" step="0.05"></input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="particle-section property">
|
||||
<div class="label">Particle Radius</div>
|
||||
<div class="value">
|
||||
<input class="coord" type='number' id="property-particle-radius" min="0" step="0.005"></input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="model-section property">
|
||||
<div class="label">Model URL</div>
|
||||
<div class="value">
|
||||
|
|
Loading…
Reference in a new issue