mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 14:03:55 +02:00
fix isEmitting property for particle effects, cleaned up some particle property editing in edit.js
This commit is contained in:
parent
90049f6a5f
commit
02a24712ca
3 changed files with 42 additions and 39 deletions
|
@ -1275,7 +1275,7 @@ PropertiesTool = function(opts) {
|
|||
webView.eventBridge.emitScriptEvent(JSON.stringify(data));
|
||||
});
|
||||
|
||||
webView.eventBridge.webEventReceived.connect(function(data) {
|
||||
webView.eventBridge.webEventReceived.connect(function (data) {
|
||||
data = JSON.parse(data);
|
||||
if (data.type == "print") {
|
||||
if (data.message) {
|
||||
|
|
|
@ -305,14 +305,10 @@
|
|||
|
||||
var elParticleSections = document.querySelectorAll(".particle-section");
|
||||
allSections.push(elParticleSections);
|
||||
var elParticleIsEmitting = document.getElementById("property-particle-is-emitting");
|
||||
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");
|
||||
|
@ -511,7 +507,7 @@
|
|||
elColorSection.style.display = 'none';
|
||||
}
|
||||
|
||||
if (properties.type == "Model" || properties.type == "ParticleEffect") {
|
||||
if (properties.type == "Model") {
|
||||
for (var i = 0; i < elModelSections.length; i++) {
|
||||
elModelSections[i].style.display = 'block';
|
||||
}
|
||||
|
@ -617,15 +613,38 @@
|
|||
elParticleSections[i].style.display = 'block';
|
||||
}
|
||||
|
||||
elParticleIsEmitting.checked = properties.isEmitting;
|
||||
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);
|
||||
|
||||
/*
|
||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(shapeType, getShapeType);
|
||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(colorSpread, getColorSpread);
|
||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(colorStart, getColorStart);
|
||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(colorFinish, getColorFinish);
|
||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(alphaSpread, getAlphaSpread);
|
||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(alphaStart, getAlphaStart);
|
||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(alphaFinish, getAlphaFinish);
|
||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(textures, getTextures);
|
||||
// float emitSpeed
|
||||
// float speedSpread
|
||||
// quat emitOrientation
|
||||
// vec3 emitDimensions
|
||||
// float emitRadiusStart
|
||||
// float polarStart
|
||||
// float polarFinish
|
||||
// float azimuthStart
|
||||
// float azimuthFinish
|
||||
// vec3 emitAcceleration
|
||||
// vec3 accelerationSpread
|
||||
// float radiusStart
|
||||
// float radiusSpread??
|
||||
// float radiusFinish
|
||||
// float RadiusSpread
|
||||
*/
|
||||
|
||||
} else if (properties.type == "PolyVox") {
|
||||
for (var i = 0; i < elPolyVoxSections.length; i++) {
|
||||
elPolyVoxSections[i].style.display = 'block';
|
||||
|
@ -758,16 +777,10 @@
|
|||
|
||||
elWebSourceURL.addEventListener('change', createEmitTextPropertyUpdateFunction('sourceUrl'));
|
||||
|
||||
elParticleIsEmitting.addEventListener('change', createEmitCheckedPropertyUpdateFunction('isEmitting'));
|
||||
elParticleMaxParticles.addEventListener('change', createEmitNumberPropertyUpdateFunction('maxParticles'));
|
||||
elParticleLifeSpan.addEventListener('change', createEmitNumberPropertyUpdateFunction('lifespan'));
|
||||
elParticleEmitRate.addEventListener('change', createEmitNumberPropertyUpdateFunction('emitRate'));
|
||||
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'));
|
||||
|
@ -1362,6 +1375,12 @@
|
|||
<label>Particle</label>
|
||||
</div>
|
||||
|
||||
<div class="particle-section property">
|
||||
<span class="label">Is Emitting</span>
|
||||
<span class="value">
|
||||
<input type='checkbox' id="property-particle-is-emitting">
|
||||
</span>
|
||||
</div>
|
||||
<div class="particle-section property">
|
||||
<div class="label">Max Particles</div>
|
||||
<div class="value">
|
||||
|
@ -1380,26 +1399,6 @@
|
|||
<input type='number' id="property-particle-emit-rate" min="0" step="0.5">
|
||||
</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"></div>
|
||||
<div class="input-area">Y <input class="coord" type='number' id="property-particle-emit-direction-y"></div>
|
||||
<div class="input-area">Z <input class="coord" type='number' id="property-particle-emit-direction-z"></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">
|
||||
</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">
|
||||
</div>
|
||||
</div>
|
||||
<div class="particle-section property">
|
||||
<div class="label">Particle Radius</div>
|
||||
<div class="value">
|
||||
|
|
|
@ -313,6 +313,7 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
|
|||
CHECK_PROPERTY_CHANGE(PROP_TEXT_COLOR, textColor);
|
||||
CHECK_PROPERTY_CHANGE(PROP_BACKGROUND_COLOR, backgroundColor);
|
||||
CHECK_PROPERTY_CHANGE(PROP_SHAPE_TYPE, shapeType);
|
||||
CHECK_PROPERTY_CHANGE(PROP_EMITTING_PARTICLES, isEmitting);
|
||||
CHECK_PROPERTY_CHANGE(PROP_MAX_PARTICLES, maxParticles);
|
||||
CHECK_PROPERTY_CHANGE(PROP_LIFESPAN, lifespan);
|
||||
CHECK_PROPERTY_CHANGE(PROP_EMIT_RATE, emitRate);
|
||||
|
@ -424,6 +425,7 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
|
|||
|
||||
// Particles only
|
||||
if (_type == EntityTypes::ParticleEffect) {
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_EMITTING_PARTICLES, isEmitting);
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_MAX_PARTICLES, maxParticles);
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LIFESPAN, lifespan);
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_EMIT_RATE, emitRate);
|
||||
|
@ -1118,6 +1120,7 @@ bool EntityItemProperties::encodeEntityEditPacket(PacketType command, EntityItem
|
|||
APPEND_ENTITY_PROPERTY(PROP_ACTION_DATA, properties.getActionData());
|
||||
APPEND_ENTITY_PROPERTY(PROP_ALPHA, properties.getAlpha());
|
||||
}
|
||||
|
||||
if (propertyCount > 0) {
|
||||
int endOfEntityItemData = packetData->getUncompressedByteOffset();
|
||||
|
||||
|
@ -1472,6 +1475,7 @@ void EntityItemProperties::markAllChanged() {
|
|||
_backgroundColorChanged = true;
|
||||
_shapeTypeChanged = true;
|
||||
|
||||
_isEmittingChanged = true;
|
||||
_maxParticlesChanged = true;
|
||||
_lifespanChanged = true;
|
||||
_emitRateChanged = true;
|
||||
|
|
Loading…
Reference in a new issue