Merge branch 'master' of https://github.com/highfidelity/hifi into hobbes

This commit is contained in:
samcake 2015-10-08 15:25:32 -07:00
commit f105803958
3 changed files with 29 additions and 43 deletions

View file

@ -305,15 +305,12 @@
var elParticleSections = document.querySelectorAll(".particle-section"); var elParticleSections = document.querySelectorAll(".particle-section");
allSections.push(elParticleSections); allSections.push(elParticleSections);
var elParticleIsEmitting = document.getElementById("property-particle-is-emitting");
var elParticleMaxParticles = document.getElementById("property-particle-maxparticles"); var elParticleMaxParticles = document.getElementById("property-particle-maxparticles");
var elParticleLifeSpan = document.getElementById("property-particle-lifespan"); var elParticleLifeSpan = document.getElementById("property-particle-lifespan");
var elParticleEmitRate = document.getElementById("property-particle-emit-rate"); 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 elParticleRadius = document.getElementById("property-particle-radius");
var elParticleTextures = document.getElementById("property-particle-textures");
var elTextSections = document.querySelectorAll(".text-section"); var elTextSections = document.querySelectorAll(".text-section");
allSections.push(elTextSections); allSections.push(elTextSections);
@ -511,7 +508,7 @@
elColorSection.style.display = 'none'; elColorSection.style.display = 'none';
} }
if (properties.type == "Model" || properties.type == "ParticleEffect") { if (properties.type == "Model") {
for (var i = 0; i < elModelSections.length; i++) { for (var i = 0; i < elModelSections.length; i++) {
elModelSections[i].style.display = 'block'; elModelSections[i].style.display = 'block';
} }
@ -529,7 +526,7 @@
elModelAnimationHold.checked = properties.animation.hold; elModelAnimationHold.checked = properties.animation.hold;
elModelAnimationStartAutomatically.checked = properties.animation.startAutomatically; elModelAnimationStartAutomatically.checked = properties.animation.startAutomatically;
elModelTextures.value = properties.textures; elModelTextures.value = properties.textures;
elModelOriginalTextures.value = properties.originalTextures; elModelOriginalTextures.value = properties.originalTextures;
} else if (properties.type == "Web") { } else if (properties.type == "Web") {
for (var i = 0; i < elWebSections.length; i++) { for (var i = 0; i < elWebSections.length; i++) {
elWebSections[i].style.display = 'block'; elWebSections[i].style.display = 'block';
@ -617,15 +614,13 @@
elParticleSections[i].style.display = 'block'; elParticleSections[i].style.display = 'block';
} }
elParticleIsEmitting.checked = properties.isEmitting;
elParticleMaxParticles.value = properties.maxParticles; elParticleMaxParticles.value = properties.maxParticles;
elParticleLifeSpan.value = properties.lifespan.toFixed(2); elParticleLifeSpan.value = properties.lifespan.toFixed(2);
elParticleEmitRate.value = properties.emitRate.toFixed(1); 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); elParticleRadius.value = properties.particleRadius.toFixed(3);
elParticleTextures.value = properties.textures;
} else if (properties.type == "PolyVox") { } else if (properties.type == "PolyVox") {
for (var i = 0; i < elPolyVoxSections.length; i++) { for (var i = 0; i < elPolyVoxSections.length; i++) {
elPolyVoxSections[i].style.display = 'block'; elPolyVoxSections[i].style.display = 'block';
@ -758,17 +753,12 @@
elWebSourceURL.addEventListener('change', createEmitTextPropertyUpdateFunction('sourceUrl')); elWebSourceURL.addEventListener('change', createEmitTextPropertyUpdateFunction('sourceUrl'));
elParticleIsEmitting.addEventListener('change', createEmitCheckedPropertyUpdateFunction('isEmitting'));
elParticleMaxParticles.addEventListener('change', createEmitNumberPropertyUpdateFunction('maxParticles')); elParticleMaxParticles.addEventListener('change', createEmitNumberPropertyUpdateFunction('maxParticles'));
elParticleLifeSpan.addEventListener('change', createEmitNumberPropertyUpdateFunction('lifespan')); elParticleLifeSpan.addEventListener('change', createEmitNumberPropertyUpdateFunction('lifespan'));
elParticleEmitRate.addEventListener('change', createEmitNumberPropertyUpdateFunction('emitRate')); 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')); elParticleRadius.addEventListener('change', createEmitNumberPropertyUpdateFunction('particleRadius'));
elParticleTextures.addEventListener('change', createEmitTextPropertyUpdateFunction('textures'));
elModelURL.addEventListener('change', createEmitTextPropertyUpdateFunction('modelURL')); elModelURL.addEventListener('change', createEmitTextPropertyUpdateFunction('modelURL'));
elShapeType.addEventListener('change', createEmitTextPropertyUpdateFunction('shapeType')); elShapeType.addEventListener('change', createEmitTextPropertyUpdateFunction('shapeType'));
@ -1335,13 +1325,13 @@
<div class="model-section property"> <div class="model-section property">
<div class="label">Textures</div> <div class="label">Textures</div>
<div class="value"> <div class="value">
<textarea id="property-model-textures" value='asdfasdf'></textarea> <textarea id="property-model-textures" value=''></textarea>
</div> </div>
</div> </div>
<div class="model-section property"> <div class="model-section property">
<div class="label">Original Textures</div> <div class="label">Original Textures</div>
<div class="value"> <div class="value">
<textarea id="property-model-original-textures" readonly value='asdfasdf'></textarea> <textarea id="property-model-original-textures" readonly value=''></textarea>
</div> </div>
</div> </div>
@ -1362,6 +1352,12 @@
<label>Particle</label> <label>Particle</label>
</div> </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="particle-section property">
<div class="label">Max Particles</div> <div class="label">Max Particles</div>
<div class="value"> <div class="value">
@ -1380,30 +1376,16 @@
<input type='number' id="property-particle-emit-rate" min="0" step="0.5"> <input type='number' id="property-particle-emit-rate" min="0" step="0.5">
</div> </div>
</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="particle-section property">
<div class="label">Particle Radius</div> <div class="label">Particle Radius</div>
<div class="value"> <div class="value">
<input class="coord" type='number' id="property-particle-radius" min="0" step="0.005"> <input class="coord" type='number' id="property-particle-radius" min="0" step="0.005">
</div>
</div>
<div class="particle-section property">
<div class="label">Textures</div>
<div class="value">
<textarea id="property-particle-textures" value=''></textarea>
</div> </div>
</div> </div>

View file

@ -313,6 +313,7 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
CHECK_PROPERTY_CHANGE(PROP_TEXT_COLOR, textColor); CHECK_PROPERTY_CHANGE(PROP_TEXT_COLOR, textColor);
CHECK_PROPERTY_CHANGE(PROP_BACKGROUND_COLOR, backgroundColor); CHECK_PROPERTY_CHANGE(PROP_BACKGROUND_COLOR, backgroundColor);
CHECK_PROPERTY_CHANGE(PROP_SHAPE_TYPE, shapeType); 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_MAX_PARTICLES, maxParticles);
CHECK_PROPERTY_CHANGE(PROP_LIFESPAN, lifespan); CHECK_PROPERTY_CHANGE(PROP_LIFESPAN, lifespan);
CHECK_PROPERTY_CHANGE(PROP_EMIT_RATE, emitRate); CHECK_PROPERTY_CHANGE(PROP_EMIT_RATE, emitRate);
@ -424,6 +425,7 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
// Particles only // Particles only
if (_type == EntityTypes::ParticleEffect) { 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_MAX_PARTICLES, maxParticles);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LIFESPAN, lifespan); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LIFESPAN, lifespan);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_EMIT_RATE, emitRate); 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_ACTION_DATA, properties.getActionData());
APPEND_ENTITY_PROPERTY(PROP_ALPHA, properties.getAlpha()); APPEND_ENTITY_PROPERTY(PROP_ALPHA, properties.getAlpha());
} }
if (propertyCount > 0) { if (propertyCount > 0) {
int endOfEntityItemData = packetData->getUncompressedByteOffset(); int endOfEntityItemData = packetData->getUncompressedByteOffset();
@ -1472,6 +1475,7 @@ void EntityItemProperties::markAllChanged() {
_backgroundColorChanged = true; _backgroundColorChanged = true;
_shapeTypeChanged = true; _shapeTypeChanged = true;
_isEmittingChanged = true;
_maxParticlesChanged = true; _maxParticlesChanged = true;
_lifespanChanged = true; _lifespanChanged = true;
_emitRateChanged = true; _emitRateChanged = true;

View file

@ -329,7 +329,7 @@ EntityItemProperties ParticleEffectEntityItem::getProperties(EntityPropertyFlags
COPY_ENTITY_PROPERTY_TO_PROPERTIES(color, getXColor); COPY_ENTITY_PROPERTY_TO_PROPERTIES(color, getXColor);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(alpha, getAlpha); COPY_ENTITY_PROPERTY_TO_PROPERTIES(alpha, getAlpha);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(glowLevel, getGlowLevel); COPY_ENTITY_PROPERTY_TO_PROPERTIES(glowLevel, getGlowLevel);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(shapeType, getShapeType); COPY_ENTITY_PROPERTY_TO_PROPERTIES(shapeType, getShapeType); // FIXME - this doesn't appear to get used
COPY_ENTITY_PROPERTY_TO_PROPERTIES(maxParticles, getMaxParticles); COPY_ENTITY_PROPERTY_TO_PROPERTIES(maxParticles, getMaxParticles);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(lifespan, getLifespan); COPY_ENTITY_PROPERTY_TO_PROPERTIES(lifespan, getLifespan);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(isEmitting, getIsEmitting); COPY_ENTITY_PROPERTY_TO_PROPERTIES(isEmitting, getIsEmitting);