From f8f13e974d2b7337bb18d13d83f9dd90458a1c20 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 27 Dec 2018 19:52:21 -0800 Subject: [PATCH 01/27] property range audit - add range info via macros accessible via API, tweak min/max/steps in entityProperties --- libraries/entities/src/EntityItem.cpp | 7 +- .../entities/src/EntityItemProperties.cpp | 175 ++++++++----- libraries/entities/src/EntityItemProperties.h | 16 ++ .../src/EntityItemPropertiesDefaults.h | 5 + .../entities/src/EntityItemPropertiesMacros.h | 22 +- .../entities/src/EntityScriptingInterface.cpp | 53 ++++ .../entities/src/EntityScriptingInterface.h | 36 +++ libraries/entities/src/LightEntityItem.cpp | 4 +- libraries/entities/src/LightEntityItem.h | 2 + libraries/script-engine/src/ScriptEngine.cpp | 1 + scripts/system/edit.js | 11 +- scripts/system/html/js/draggableNumber.js | 27 +- scripts/system/html/js/entityProperties.js | 240 ++++++++++-------- .../system/libraries/entitySelectionTool.js | 10 +- 14 files changed, 418 insertions(+), 191 deletions(-) diff --git a/libraries/entities/src/EntityItem.cpp b/libraries/entities/src/EntityItem.cpp index 94d0024fd5..cd0f550a05 100644 --- a/libraries/entities/src/EntityItem.cpp +++ b/libraries/entities/src/EntityItem.cpp @@ -1693,7 +1693,8 @@ float EntityItem::getVolumeEstimate() const { void EntityItem::setRegistrationPoint(const glm::vec3& value) { if (value != _registrationPoint) { withWriteLock([&] { - _registrationPoint = glm::clamp(value, 0.0f, 1.0f); + _registrationPoint = glm::clamp(value, glm::vec3(ENTITY_ITEM_MIN_REGISTRATION_POINT), + glm::vec3(ENTITY_ITEM_MAX_REGISTRATION_POINT)); }); dimensionsChanged(); // Registration Point affects the bounding box markDirtyFlags(Simulation::DIRTY_SHAPE); @@ -1858,7 +1859,7 @@ void EntityItem::setVelocity(const glm::vec3& value) { } void EntityItem::setDamping(float value) { - auto clampedDamping = glm::clamp(value, 0.0f, 1.0f); + auto clampedDamping = glm::clamp(value, ENTITY_ITEM_MIN_DAMPING, ENTITY_ITEM_MAX_DAMPING); withWriteLock([&] { if (_damping != clampedDamping) { _damping = clampedDamping; @@ -1913,7 +1914,7 @@ void EntityItem::setAngularVelocity(const glm::vec3& value) { } void EntityItem::setAngularDamping(float value) { - auto clampedDamping = glm::clamp(value, 0.0f, 1.0f); + auto clampedDamping = glm::clamp(value, ENTITY_ITEM_MIN_DAMPING, ENTITY_ITEM_MAX_DAMPING); withWriteLock([&] { if (_angularDamping != clampedDamping) { _angularDamping = clampedDamping; diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index 3eb193f1bd..5616d04ea4 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -2158,8 +2158,6 @@ void EntityItemPropertiesFromScriptValueHonorReadOnly(const QScriptValue &object QScriptValue EntityPropertyFlagsToScriptValue(QScriptEngine* engine, const EntityPropertyFlags& flags) { return EntityItemProperties::entityPropertyFlagsToScriptValue(engine, flags); - QScriptValue result = engine->newObject(); - return result; } void EntityPropertyFlagsFromScriptValue(const QScriptValue& object, EntityPropertyFlags& flags) { @@ -2172,25 +2170,48 @@ QScriptValue EntityItemProperties::entityPropertyFlagsToScriptValue(QScriptEngin return result; } -static QHash _propertyStringsToEnums; - void EntityItemProperties::entityPropertyFlagsFromScriptValue(const QScriptValue& object, EntityPropertyFlags& flags) { + if (object.isString()) { + EntityPropertyInfo propertyInfo; + if (getPropertyInfo(object.toString(), propertyInfo)) { + flags << propertyInfo.propertyEnum; + } + } + else if (object.isArray()) { + quint32 length = object.property("length").toInt32(); + for (quint32 i = 0; i < length; i++) { + QString propertyName = object.property(i).toString(); + EntityPropertyInfo propertyInfo; + if (getPropertyInfo(propertyName, propertyInfo)) { + flags << propertyInfo.propertyEnum; + } + } + } +} + +static QHash _propertyInfos; + +bool EntityItemProperties::getPropertyInfo(const QString& propertyName, EntityPropertyInfo& propertyInfo) { static std::once_flag initMap; - + std::call_once(initMap, []() { ADD_PROPERTY_TO_MAP(PROP_VISIBLE, Visible, visible, bool); ADD_PROPERTY_TO_MAP(PROP_CAN_CAST_SHADOW, CanCastShadow, canCastShadow, bool); ADD_PROPERTY_TO_MAP(PROP_POSITION, Position, position, vec3); - ADD_PROPERTY_TO_MAP(PROP_DIMENSIONS, Dimensions, dimensions, vec3); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_DIMENSIONS, Dimensions, dimensions, vec3, ENTITY_ITEM_MIN_DIMENSION, FLT_MAX); ADD_PROPERTY_TO_MAP(PROP_ROTATION, Rotation, rotation, quat); - ADD_PROPERTY_TO_MAP(PROP_DENSITY, Density, density, float); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_DENSITY, Density, density, float, + ENTITY_ITEM_MIN_DENSITY, ENTITY_ITEM_MAX_DENSITY); ADD_PROPERTY_TO_MAP(PROP_VELOCITY, Velocity, velocity, vec3); ADD_PROPERTY_TO_MAP(PROP_GRAVITY, Gravity, gravity, vec3); ADD_PROPERTY_TO_MAP(PROP_ACCELERATION, Acceleration, acceleration, vec3); - ADD_PROPERTY_TO_MAP(PROP_DAMPING, Damping, damping, float); - ADD_PROPERTY_TO_MAP(PROP_RESTITUTION, Restitution, restitution, float); - ADD_PROPERTY_TO_MAP(PROP_FRICTION, Friction, friction, float); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_DAMPING, Damping, damping, float, + ENTITY_ITEM_MIN_DAMPING, ENTITY_ITEM_MAX_DAMPING); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_RESTITUTION, Restitution, restitution, float, + ENTITY_ITEM_MIN_RESTITUTION, ENTITY_ITEM_MAX_RESTITUTION); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_FRICTION, Friction, friction, float, + ENTITY_ITEM_MIN_FRICTION, ENTITY_ITEM_MAX_FRICTION); ADD_PROPERTY_TO_MAP(PROP_LIFETIME, Lifetime, lifetime, float); ADD_PROPERTY_TO_MAP(PROP_SCRIPT, Script, script, QString); ADD_PROPERTY_TO_MAP(PROP_SCRIPT_TIMESTAMP, ScriptTimestamp, scriptTimestamp, quint64); @@ -2200,16 +2221,21 @@ void EntityItemProperties::entityPropertyFlagsFromScriptValue(const QScriptValue ADD_PROPERTY_TO_MAP(PROP_COLOR_SPREAD, ColorSpread, colorSpread, u8vec3Color); ADD_PROPERTY_TO_MAP(PROP_COLOR_START, ColorStart, colorStart, vec3Color); ADD_PROPERTY_TO_MAP(PROP_COLOR_FINISH, ColorFinish, colorFinish, vec3Color); - ADD_PROPERTY_TO_MAP(PROP_ALPHA, Alpha, alpha, float); - ADD_PROPERTY_TO_MAP(PROP_ALPHA_SPREAD, AlphaSpread, alphaSpread, float); - ADD_PROPERTY_TO_MAP(PROP_ALPHA_START, AlphaStart, alphaStart, float); - ADD_PROPERTY_TO_MAP(PROP_ALPHA_FINISH, AlphaFinish, alphaFinish, float); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_ALPHA, Alpha, alpha, float, particle::MINIMUM_ALPHA, particle::MAXIMUM_ALPHA); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_ALPHA_SPREAD, AlphaSpread, alphaSpread, float, + particle::MINIMUM_ALPHA, particle::MAXIMUM_ALPHA); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_ALPHA_START, AlphaStart, alphaStart, float, + particle::MINIMUM_ALPHA, particle::MAXIMUM_ALPHA); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_ALPHA_FINISH, AlphaFinish, alphaFinish, float, + particle::MINIMUM_ALPHA, particle::MAXIMUM_ALPHA); ADD_PROPERTY_TO_MAP(PROP_EMITTER_SHOULD_TRAIL, EmitterShouldTrail, emitterShouldTrail, bool); ADD_PROPERTY_TO_MAP(PROP_MODEL_URL, ModelURL, modelURL, QString); ADD_PROPERTY_TO_MAP(PROP_COMPOUND_SHAPE_URL, CompoundShapeURL, compoundShapeURL, QString); - ADD_PROPERTY_TO_MAP(PROP_REGISTRATION_POINT, RegistrationPoint, registrationPoint, vec3); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_REGISTRATION_POINT, RegistrationPoint, registrationPoint, vec3, + ENTITY_ITEM_MIN_REGISTRATION_POINT, ENTITY_ITEM_MAX_REGISTRATION_POINT); ADD_PROPERTY_TO_MAP(PROP_ANGULAR_VELOCITY, AngularVelocity, angularVelocity, vec3); - ADD_PROPERTY_TO_MAP(PROP_ANGULAR_DAMPING, AngularDamping, angularDamping, float); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_ANGULAR_DAMPING, AngularDamping, angularDamping, float, + ENTITY_ITEM_MIN_DAMPING, ENTITY_ITEM_MAX_DAMPING); ADD_PROPERTY_TO_MAP(PROP_COLLISIONLESS, Collisionless, collisionless, bool); ADD_PROPERTY_TO_MAP(PROP_COLLISIONLESS, unused, ignoreForCollisions, unused); // legacy support ADD_PROPERTY_TO_MAP(PROP_COLLISION_MASK, unused, collisionMask, unused); @@ -2220,7 +2246,8 @@ void EntityItemProperties::entityPropertyFlagsFromScriptValue(const QScriptValue ADD_PROPERTY_TO_MAP(PROP_INTENSITY, Intensity, intensity, float); ADD_PROPERTY_TO_MAP(PROP_FALLOFF_RADIUS, FalloffRadius, falloffRadius, float); ADD_PROPERTY_TO_MAP(PROP_EXPONENT, Exponent, exponent, float); - ADD_PROPERTY_TO_MAP(PROP_CUTOFF, Cutoff, cutoff, float); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_CUTOFF, Cutoff, cutoff, float, + LightEntityItem::MIN_CUTOFF, LightEntityItem::MAX_CUTOFF); ADD_PROPERTY_TO_MAP(PROP_LOCKED, Locked, locked, bool); ADD_PROPERTY_TO_MAP(PROP_TEXTURES, Textures, textures, QString); ADD_PROPERTY_TO_MAP(PROP_USER_DATA, UserData, userData, QString); @@ -2230,25 +2257,42 @@ void EntityItemProperties::entityPropertyFlagsFromScriptValue(const QScriptValue ADD_PROPERTY_TO_MAP(PROP_TEXT_COLOR, TextColor, textColor, u8vec3Color); ADD_PROPERTY_TO_MAP(PROP_BACKGROUND_COLOR, BackgroundColor, backgroundColor, u8vec3Color); ADD_PROPERTY_TO_MAP(PROP_SHAPE_TYPE, ShapeType, shapeType, ShapeType); - ADD_PROPERTY_TO_MAP(PROP_MAX_PARTICLES, MaxParticles, maxParticles, quint32); - ADD_PROPERTY_TO_MAP(PROP_LIFESPAN, Lifespan, lifespan, float); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_MAX_PARTICLES, MaxParticles, maxParticles, quint32, + particle::MINIMUM_MAX_PARTICLES, particle::MAXIMUM_MAX_PARTICLES); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_LIFESPAN, Lifespan, lifespan, float, + particle::MINIMUM_LIFESPAN, particle::MAXIMUM_LIFESPAN); ADD_PROPERTY_TO_MAP(PROP_EMITTING_PARTICLES, IsEmitting, isEmitting, bool); - ADD_PROPERTY_TO_MAP(PROP_EMIT_RATE, EmitRate, emitRate, float); - ADD_PROPERTY_TO_MAP(PROP_EMIT_SPEED, EmitSpeed, emitSpeed, vec3); - ADD_PROPERTY_TO_MAP(PROP_SPEED_SPREAD, SpeedSpread, speedSpread, vec3); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_EMIT_RATE, EmitRate, emitRate, float, + particle::MINIMUM_EMIT_RATE, particle::MAXIMUM_EMIT_RATE); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_EMIT_SPEED, EmitSpeed, emitSpeed, vec3, + particle::MINIMUM_EMIT_SPEED, particle::MAXIMUM_EMIT_SPEED); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_SPEED_SPREAD, SpeedSpread, speedSpread, vec3, + particle::MINIMUM_EMIT_SPEED, particle::MAXIMUM_EMIT_SPEED); ADD_PROPERTY_TO_MAP(PROP_EMIT_ORIENTATION, EmitOrientation, emitOrientation, quat); - ADD_PROPERTY_TO_MAP(PROP_EMIT_DIMENSIONS, EmitDimensions, emitDimensions, vec3); - ADD_PROPERTY_TO_MAP(PROP_EMIT_RADIUS_START, EmitRadiusStart, emitRadiusStart, float); - ADD_PROPERTY_TO_MAP(PROP_POLAR_START, EmitPolarStart, polarStart, float); - ADD_PROPERTY_TO_MAP(PROP_POLAR_FINISH, EmitPolarFinish, polarFinish, float); - ADD_PROPERTY_TO_MAP(PROP_AZIMUTH_START, EmitAzimuthStart, azimuthStart, float); - ADD_PROPERTY_TO_MAP(PROP_AZIMUTH_FINISH, EmitAzimuthFinish, azimuthFinish, float); - ADD_PROPERTY_TO_MAP(PROP_EMIT_ACCELERATION, EmitAcceleration, emitAcceleration, vec3); - ADD_PROPERTY_TO_MAP(PROP_ACCELERATION_SPREAD, AccelerationSpread, accelerationSpread, vec3); - ADD_PROPERTY_TO_MAP(PROP_PARTICLE_RADIUS, ParticleRadius, particleRadius, float); - ADD_PROPERTY_TO_MAP(PROP_RADIUS_SPREAD, RadiusSpread, radiusSpread, float); - ADD_PROPERTY_TO_MAP(PROP_RADIUS_START, RadiusStart, radiusStart, float); - ADD_PROPERTY_TO_MAP(PROP_RADIUS_FINISH, RadiusFinish, radiusFinish, float); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_EMIT_DIMENSIONS, EmitDimensions, emitDimensions, vec3, + particle::MINIMUM_EMIT_DIMENSION, particle::MAXIMUM_EMIT_DIMENSION); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_EMIT_RADIUS_START, EmitRadiusStart, emitRadiusStart, float, + particle::MINIMUM_EMIT_RADIUS_START, particle::MAXIMUM_EMIT_RADIUS_START); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_POLAR_START, EmitPolarStart, polarStart, float, + particle::MINIMUM_POLAR, particle::MAXIMUM_POLAR); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_POLAR_FINISH, EmitPolarFinish, polarFinish, float, + particle::MINIMUM_POLAR, particle::MAXIMUM_POLAR); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_AZIMUTH_START, EmitAzimuthStart, azimuthStart, float, + particle::MINIMUM_AZIMUTH, particle::MAXIMUM_AZIMUTH); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_AZIMUTH_FINISH, EmitAzimuthFinish, azimuthFinish, float, + particle::MINIMUM_AZIMUTH, particle::MAXIMUM_AZIMUTH); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_EMIT_ACCELERATION, EmitAcceleration, emitAcceleration, vec3, + particle::MINIMUM_EMIT_ACCELERATION, particle::MAXIMUM_EMIT_ACCELERATION); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_ACCELERATION_SPREAD, AccelerationSpread, accelerationSpread, vec3, + particle::MINIMUM_ACCELERATION_SPREAD, particle::MAXIMUM_ACCELERATION_SPREAD); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_PARTICLE_RADIUS, ParticleRadius, particleRadius, float, + particle::MINIMUM_PARTICLE_RADIUS, particle::MAXIMUM_PARTICLE_RADIUS); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_RADIUS_SPREAD, RadiusSpread, radiusSpread, float, + particle::MINIMUM_PARTICLE_RADIUS, particle::MAXIMUM_PARTICLE_RADIUS); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_RADIUS_START, RadiusStart, radiusStart, float, + particle::MINIMUM_PARTICLE_RADIUS, particle::MAXIMUM_PARTICLE_RADIUS); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_RADIUS_FINISH, RadiusFinish, radiusFinish, float, + particle::MINIMUM_PARTICLE_RADIUS, particle::MAXIMUM_PARTICLE_RADIUS); ADD_PROPERTY_TO_MAP(PROP_MATERIAL_URL, MaterialURL, materialURL, QString); ADD_PROPERTY_TO_MAP(PROP_MATERIAL_MAPPING_MODE, MaterialMappingMode, materialMappingMode, MaterialMappingMode); @@ -2262,10 +2306,14 @@ void EntityItemProperties::entityPropertyFlagsFromScriptValue(const QScriptValue ADD_PROPERTY_TO_MAP(PROP_VISIBLE_IN_SECONDARY_CAMERA, IsVisibleInSecondaryCamera, isVisibleInSecondaryCamera, bool); - ADD_PROPERTY_TO_MAP(PROP_PARTICLE_SPIN, ParticleSpin, particleSpin, float); - ADD_PROPERTY_TO_MAP(PROP_SPIN_SPREAD, SpinSpread, spinSpread, float); - ADD_PROPERTY_TO_MAP(PROP_SPIN_START, SpinStart, spinStart, float); - ADD_PROPERTY_TO_MAP(PROP_SPIN_FINISH, SpinFinish, spinFinish, float); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_PARTICLE_SPIN, ParticleSpin, particleSpin, float, + particle::MINIMUM_PARTICLE_SPIN, particle::MAXIMUM_PARTICLE_SPIN); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_SPIN_SPREAD, SpinSpread, spinSpread, float, -120.2365895, 1563.2556); + //particle::MINIMUM_PARTICLE_SPIN, particle::MAXIMUM_PARTICLE_SPIN); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_SPIN_START, SpinStart, spinStart, float, + particle::MINIMUM_PARTICLE_SPIN, particle::MAXIMUM_PARTICLE_SPIN); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_SPIN_FINISH, SpinFinish, spinFinish, float, + particle::MINIMUM_PARTICLE_SPIN, particle::MAXIMUM_PARTICLE_SPIN); ADD_PROPERTY_TO_MAP(PROP_PARTICLE_ROTATE_WITH_ENTITY, RotateWithEntity, rotateWithEntity, float); // Certifiable Properties @@ -2318,7 +2366,8 @@ void EntityItemProperties::entityPropertyFlagsFromScriptValue(const QScriptValue ADD_PROPERTY_TO_MAP(PROP_LOCAL_ROTATION, LocalRotation, localRotation, quat); ADD_PROPERTY_TO_MAP(PROP_LOCAL_VELOCITY, LocalVelocity, localVelocity, vec3); ADD_PROPERTY_TO_MAP(PROP_LOCAL_ANGULAR_VELOCITY, LocalAngularVelocity, localAngularVelocity, vec3); - ADD_PROPERTY_TO_MAP(PROP_LOCAL_DIMENSIONS, LocalDimensions, localDimensions, vec3); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_LOCAL_DIMENSIONS, LocalDimensions, localDimensions, vec3, + ENTITY_ITEM_MIN_DIMENSION, FLT_MAX); ADD_PROPERTY_TO_MAP(PROP_JOINT_ROTATIONS_SET, JointRotationsSet, jointRotationsSet, QVector); ADD_PROPERTY_TO_MAP(PROP_JOINT_ROTATIONS, JointRotations, jointRotations, QVector); @@ -2387,19 +2436,19 @@ void EntityItemProperties::entityPropertyFlagsFromScriptValue(const QScriptValue ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_TRIGGERABLE, Grab, grab, Triggerable, triggerable); ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_EQUIPPABLE, Grab, grab, Equippable, equippable); ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_LEFT_EQUIPPABLE_POSITION_OFFSET, Grab, grab, - EquippableLeftPosition, equippableLeftPosition); + EquippableLeftPosition, equippableLeftPosition); ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_LEFT_EQUIPPABLE_ROTATION_OFFSET, Grab, grab, - EquippableLeftRotation, equippableLeftRotation); + EquippableLeftRotation, equippableLeftRotation); ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_RIGHT_EQUIPPABLE_POSITION_OFFSET, Grab, grab, - EquippableRightPosition, equippableRightPosition); + EquippableRightPosition, equippableRightPosition); ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_RIGHT_EQUIPPABLE_ROTATION_OFFSET, Grab, grab, - EquippableRightRotation, equippableRightRotation); + EquippableRightRotation, equippableRightRotation); ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_EQUIPPABLE_INDICATOR_URL, Grab, grab, - EquippableIndicatorURL, equippableIndicatorURL); + EquippableIndicatorURL, equippableIndicatorURL); ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_EQUIPPABLE_INDICATOR_SCALE, Grab, grab, - EquippableIndicatorScale, equippableIndicatorScale); + EquippableIndicatorScale, equippableIndicatorScale); ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_EQUIPPABLE_INDICATOR_OFFSET, Grab, grab, - EquippableIndicatorOffset, equippableIndicatorOffset); + EquippableIndicatorOffset, equippableIndicatorOffset); ADD_PROPERTY_TO_MAP(PROP_IMAGE_URL, ImageURL, imageURL, QString); ADD_PROPERTY_TO_MAP(PROP_EMISSIVE, Emissive, emissive, bool); @@ -2415,21 +2464,27 @@ void EntityItemProperties::entityPropertyFlagsFromScriptValue(const QScriptValue }); - if (object.isString()) { - // TODO: figure out how to do this without a double lookup in the map - if (_propertyStringsToEnums.contains(object.toString())) { - flags << _propertyStringsToEnums[object.toString()]; - } - } else if (object.isArray()) { - quint32 length = object.property("length").toInt32(); - for (quint32 i = 0; i < length; i++) { - QString propertyName = object.property(i).toString(); - // TODO: figure out how to do this without a double lookup in the map - if (_propertyStringsToEnums.contains(propertyName)) { - flags << _propertyStringsToEnums[propertyName]; - } - } + auto iter = _propertyInfos.find(propertyName); + if (iter != _propertyInfos.end()) { + propertyInfo = *iter; + return true; } + + return false; +} + +QScriptValue EntityPropertyInfoToScriptValue(QScriptEngine* engine, const EntityPropertyInfo& propertyInfo) { + QScriptValue obj = engine->newObject(); + obj.setProperty("propertyEnum", propertyInfo.propertyEnum); + obj.setProperty("minimum", propertyInfo.minimum.toString()); + obj.setProperty("maximum", propertyInfo.maximum.toString()); + return obj; +} + +void EntityPropertyInfoFromScriptValue(const QScriptValue& object, EntityPropertyInfo& propertyInfo) { + propertyInfo.propertyEnum = (EntityPropertyList)object.property("propertyEnum").toVariant().toUInt(); + propertyInfo.minimum = object.property("minimum").toVariant(); + propertyInfo.maximum = object.property("maximum").toVariant(); } // TODO: Implement support for edit packets that can span an MTU sized buffer. We need to implement a mechanism for the diff --git a/libraries/entities/src/EntityItemProperties.h b/libraries/entities/src/EntityItemProperties.h index 6fe7907777..33858c6a7f 100644 --- a/libraries/entities/src/EntityItemProperties.h +++ b/libraries/entities/src/EntityItemProperties.h @@ -63,6 +63,17 @@ const std::array COMPONENT_MODES = { { using vec3Color = glm::vec3; using u8vec3Color = glm::u8vec3; +struct EntityPropertyInfo { + EntityPropertyInfo(EntityPropertyList propEnum) : + propertyEnum(propEnum) {} + EntityPropertyInfo(EntityPropertyList propEnum, QVariant min, QVariant max) : + propertyEnum(propEnum), minimum(min), maximum(max) {} + EntityPropertyInfo() = default; + EntityPropertyList propertyEnum; + QVariant minimum; + QVariant maximum; +}; + /// A collection of properties of an entity item used in the scripting API. Translates between the actual properties of an /// entity and a JavaScript style hash/QScriptValue storing a set of properties. Used in scripting to set/get the complete /// set of entity item properties via JavaScript hashes/QScriptValues @@ -101,6 +112,8 @@ public: static QScriptValue entityPropertyFlagsToScriptValue(QScriptEngine* engine, const EntityPropertyFlags& flags); static void entityPropertyFlagsFromScriptValue(const QScriptValue& object, EntityPropertyFlags& flags); + static bool getPropertyInfo(const QString& propertyName, EntityPropertyInfo& propertyInfo); + // editing related features supported by all entities quint64 getLastEdited() const { return _lastEdited; } float getEditedAgo() const /// Elapsed seconds since this entity was last edited @@ -458,6 +471,9 @@ Q_DECLARE_METATYPE(EntityPropertyFlags); QScriptValue EntityPropertyFlagsToScriptValue(QScriptEngine* engine, const EntityPropertyFlags& flags); void EntityPropertyFlagsFromScriptValue(const QScriptValue& object, EntityPropertyFlags& flags); +Q_DECLARE_METATYPE(EntityPropertyInfo); +QScriptValue EntityPropertyInfoToScriptValue(QScriptEngine* engine, const EntityPropertyInfo& propertyInfo); +void EntityPropertyInfoFromScriptValue(const QScriptValue& object, EntityPropertyInfo& propertyInfo); // define these inline here so the macros work inline void EntityItemProperties::setPosition(const glm::vec3& value) diff --git a/libraries/entities/src/EntityItemPropertiesDefaults.h b/libraries/entities/src/EntityItemPropertiesDefaults.h index 6c39e90c91..85f04b9a6b 100644 --- a/libraries/entities/src/EntityItemPropertiesDefaults.h +++ b/libraries/entities/src/EntityItemPropertiesDefaults.h @@ -53,6 +53,9 @@ const QString ENTITY_ITEM_DEFAULT_SCRIPT = QString(""); const quint64 ENTITY_ITEM_DEFAULT_SCRIPT_TIMESTAMP = 0; const QString ENTITY_ITEM_DEFAULT_SERVER_SCRIPTS = QString(""); const QString ENTITY_ITEM_DEFAULT_COLLISION_SOUND_URL = QString(""); + +const float ENTITY_ITEM_MIN_REGISTRATION_POINT = 0.0f; +const float ENTITY_ITEM_MAX_REGISTRATION_POINT = 1.0f; const glm::vec3 ENTITY_ITEM_DEFAULT_REGISTRATION_POINT = ENTITY_ITEM_HALF_VEC3; // center const float ENTITY_ITEM_IMMORTAL_LIFETIME = -1.0f; /// special lifetime which means the entity lives for ever @@ -75,6 +78,8 @@ const glm::vec3 ENTITY_ITEM_DEFAULT_VELOCITY = ENTITY_ITEM_ZERO_VEC3; const glm::vec3 ENTITY_ITEM_DEFAULT_ANGULAR_VELOCITY = ENTITY_ITEM_ZERO_VEC3; const glm::vec3 ENTITY_ITEM_DEFAULT_GRAVITY = ENTITY_ITEM_ZERO_VEC3; const glm::vec3 ENTITY_ITEM_DEFAULT_ACCELERATION = ENTITY_ITEM_ZERO_VEC3; +const float ENTITY_ITEM_MIN_DAMPING = 0.0f; +const float ENTITY_ITEM_MAX_DAMPING = 1.0f; const float ENTITY_ITEM_DEFAULT_DAMPING = 0.39347f; // approx timescale = 2.0 sec (see damping timescale formula in header) const float ENTITY_ITEM_DEFAULT_ANGULAR_DAMPING = 0.39347f; // approx timescale = 2.0 sec (see damping timescale formula in header) diff --git a/libraries/entities/src/EntityItemPropertiesMacros.h b/libraries/entities/src/EntityItemPropertiesMacros.h index c963c66187..b8c15823f9 100644 --- a/libraries/entities/src/EntityItemPropertiesMacros.h +++ b/libraries/entities/src/EntityItemPropertiesMacros.h @@ -411,10 +411,28 @@ inline QRect QRect_convertFromScriptValue(const QScriptValue& v, bool& isValid) static T _static##N; #define ADD_PROPERTY_TO_MAP(P, N, n, T) \ - _propertyStringsToEnums[#n] = P; + { \ + EntityPropertyInfo propertyInfo = EntityPropertyInfo(P); \ + _propertyInfos[#n] = propertyInfo; \ + } + +#define ADD_PROPERTY_TO_MAP_WITH_RANGE(P, N, n, T, M, X) \ + { \ + EntityPropertyInfo propertyInfo = EntityPropertyInfo(P, M, X); \ + _propertyInfos[#n] = propertyInfo; \ + } #define ADD_GROUP_PROPERTY_TO_MAP(P, G, g, N, n) \ - _propertyStringsToEnums[#g "." #n] = P; + { \ + EntityPropertyInfo propertyInfo = EntityPropertyInfo(P); \ + _propertyInfos[#g "." #n] = propertyInfo; \ + } + +#define ADD_GROUP_PROPERTY_TO_MAP_WITH_RANGE(P, G, g, N, n, M, X) \ + { \ + EntityPropertyInfo propertyInfo = EntityPropertyInfo(P, M, X); \ + _propertyInfos[#g "." #n] = propertyInfo; \ + } #define DEFINE_CORE(N, n, T, V) \ public: \ diff --git a/libraries/entities/src/EntityScriptingInterface.cpp b/libraries/entities/src/EntityScriptingInterface.cpp index 303e6d54c4..f9f1cb0a06 100644 --- a/libraries/entities/src/EntityScriptingInterface.cpp +++ b/libraries/entities/src/EntityScriptingInterface.cpp @@ -1089,6 +1089,9 @@ QUuid EntityScriptingInterface::findClosestEntity(const glm::vec3& center, float _entityTree->withReadLock([&] { result = _entityTree->evalClosestEntity(center, radius, PickFilter(searchFilter)); }); + if (closestEntity) { + result = closestEntity->getEntityItemID(); + } } return result; } @@ -1111,6 +1114,10 @@ QVector EntityScriptingInterface::findEntities(const glm::vec3& center, f _entityTree->withReadLock([&] { _entityTree->evalEntitiesInSphere(center, radius, PickFilter(searchFilter), result); }); + + foreach (EntityItemPointer entity, entities) { + result << entity->getEntityItemID(); + } } return result; } @@ -1125,6 +1132,10 @@ QVector EntityScriptingInterface::findEntitiesInBox(const glm::vec3& corn AABox box(corner, dimensions); _entityTree->evalEntitiesInBox(box, PickFilter(searchFilter), result); }); + + foreach (EntityItemPointer entity, entities) { + result << entity->getEntityItemID(); + } } return result; } @@ -1163,6 +1174,10 @@ QVector EntityScriptingInterface::findEntitiesInFrustum(QVariantMap frust _entityTree->withReadLock([&] { _entityTree->evalEntitiesInFrustum(viewFrustum, PickFilter(searchFilter), result); }); + + foreach(EntityItemPointer entity, entities) { + result << entity->getEntityItemID(); + } } } @@ -1178,6 +1193,12 @@ QVector EntityScriptingInterface::findEntitiesByType(const QString entity _entityTree->withReadLock([&] { _entityTree->evalEntitiesInSphereWithType(center, radius, type, PickFilter(searchFilter), result); }); + + foreach(EntityItemPointer entity, entities) { + if (entity->getType() == type) { + result << entity->getEntityItemID().toString(); + } + } } return result; } @@ -1189,6 +1210,24 @@ QVector EntityScriptingInterface::findEntitiesByName(const QString entity unsigned int searchFilter = PickFilter::getBitMask(PickFilter::FlagBit::DOMAIN_ENTITIES) | PickFilter::getBitMask(PickFilter::FlagBit::AVATAR_ENTITIES); _entityTree->evalEntitiesInSphereWithName(center, radius, entityName, caseSensitiveSearch, PickFilter(searchFilter), result); }); + + if (caseSensitiveSearch) { + foreach(EntityItemPointer entity, entities) { + if (entity->getName() == entityName) { + result << entity->getEntityItemID(); + } + } + + } else { + QString entityNameLowerCase = entityName.toLower(); + + foreach(EntityItemPointer entity, entities) { + QString entityItemLowerCase = entity->getName().toLower(); + if (entityItemLowerCase == entityNameLowerCase) { + result << entity->getEntityItemID(); + } + } + } } return result; } @@ -1223,6 +1262,13 @@ RayToEntityIntersectionResult EntityScriptingInterface::evalRayIntersectionVecto return evalRayIntersectionWorker(ray, Octree::Lock, searchFilter, entityIdsToInclude, entityIdsToDiscard); } +RayToEntityIntersectionResult EntityScriptingInterface::evalRayIntersectionVector(const PickRay& ray, PickFilter searchFilter, + const QVector& entityIdsToInclude, const QVector& entityIdsToDiscard) { + PROFILE_RANGE(script_entities, __FUNCTION__); + + return evalRayIntersectionWorker(ray, Octree::Lock, searchFilter, entityIdsToInclude, entityIdsToDiscard); +} + RayToEntityIntersectionResult EntityScriptingInterface::evalRayIntersectionWorker(const PickRay& ray, Octree::lockType lockType, PickFilter searchFilter, const QVector& entityIdsToInclude, const QVector& entityIdsToDiscard) const { @@ -2268,3 +2314,10 @@ bool EntityScriptingInterface::verifyStaticCertificateProperties(const QUuid& en } return result; } + +const EntityPropertyInfo EntityScriptingInterface::getPropertyInfo(const QScriptValue& property) const { + const QString name = property.toString(); + EntityPropertyInfo propertyInfo; + EntityItemProperties::getPropertyInfo(name, propertyInfo); + return propertyInfo; +} diff --git a/libraries/entities/src/EntityScriptingInterface.h b/libraries/entities/src/EntityScriptingInterface.h index 1398c2ad1c..389b5e629b 100644 --- a/libraries/entities/src/EntityScriptingInterface.h +++ b/libraries/entities/src/EntityScriptingInterface.h @@ -513,6 +513,32 @@ public slots: const QScriptValue& entityIdsToInclude = QScriptValue(), const QScriptValue& entityIdsToDiscard = QScriptValue(), bool visibleOnly = false, bool collidableOnly = false) const; + /// Same as above but with QVectors + RayToEntityIntersectionResult findRayIntersectionVector(const PickRay& ray, bool precisionPicking, + const QVector& entityIdsToInclude, const QVector& entityIdsToDiscard, + bool visibleOnly, bool collidableOnly); + + /**jsdoc + * Find the first entity intersected by a {@link PickRay}. Light and Zone entities are not + * intersected unless they've been configured as pickable using {@link Entities.setLightsArePickable|setLightsArePickable} + * and {@link Entities.setZonesArePickable|setZonesArePickable}, respectively.
+ * This is a synonym for {@link Entities.findRayIntersection|findRayIntersection}. + * @function Entities.findRayIntersectionBlocking + * @param {PickRay} pickRay - The PickRay to use for finding entities. + * @param {boolean} [precisionPicking=false] - If true and the intersected entity is a Model + * entity, the result's extraInfo property includes more information than it otherwise would. + * @param {Uuid[]} [entitiesToInclude=[]] - If not empty then the search is restricted to these entities. + * @param {Uuid[]} [entitiesToDiscard=[]] - Entities to ignore during the search. + * @deprecated This function is deprecated and will soon be removed. Use + * {@link Entities.findRayIntersection|findRayIntersection} instead; it blocks and performs the same function. + */ + /// If the scripting context has visible entities, this will determine a ray intersection, and will block in + /// order to return an accurate result + Q_INVOKABLE RayToEntityIntersectionResult findRayIntersectionBlocking(const PickRay& ray, bool precisionPicking = false, + const QScriptValue& entityIdsToInclude = QScriptValue(), const QScriptValue& entityIdsToDiscard = QScriptValue()); + +>>>>>>> property range audit - add range info via macros accessible via API, tweak min/max/steps in entityProperties + /**jsdoc * Reloads an entity's server entity script such that the latest version re-downloaded. * @function Entities.reloadServerScripts @@ -1592,6 +1618,16 @@ public slots: */ Q_INVOKABLE bool verifyStaticCertificateProperties(const QUuid& entityID); + /**jsdoc + * Get information about entity properties including a minimum to maximum range for numerical properties + * as well as property enum value. + * @function Entities.getPropertyInfo + * @param {string} property - The property name to get the information for. + * @returns {Entities.EntityPropertyInfo} The information data including propertyEnum, minimum, and maximum + * if the property can be found, otherwise an empty object. + */ + Q_INVOKABLE const EntityPropertyInfo getPropertyInfo(const QScriptValue& property) const; + signals: /**jsdoc * Triggered on the client that is the physics simulation owner during the collision of two entities. Note: Isn't triggered diff --git a/libraries/entities/src/LightEntityItem.cpp b/libraries/entities/src/LightEntityItem.cpp index e3de5f66f8..dbb55c7329 100644 --- a/libraries/entities/src/LightEntityItem.cpp +++ b/libraries/entities/src/LightEntityItem.cpp @@ -25,6 +25,8 @@ const bool LightEntityItem::DEFAULT_IS_SPOTLIGHT = false; const float LightEntityItem::DEFAULT_INTENSITY = 1.0f; const float LightEntityItem::DEFAULT_FALLOFF_RADIUS = 0.1f; const float LightEntityItem::DEFAULT_EXPONENT = 0.0f; +const float LightEntityItem::MIN_CUTOFF = 0.0f; +const float LightEntityItem::MAX_CUTOFF = 90.0f; const float LightEntityItem::DEFAULT_CUTOFF = PI / 2.0f; bool LightEntityItem::_lightsArePickable = false; @@ -115,7 +117,7 @@ void LightEntityItem::setIsSpotlight(bool value) { } void LightEntityItem::setCutoff(float value) { - value = glm::clamp(value, 0.0f, 90.0f); + value = glm::clamp(value, MIN_CUTOFF, MAX_CUTOFF); if (value == getCutoff()) { return; } diff --git a/libraries/entities/src/LightEntityItem.h b/libraries/entities/src/LightEntityItem.h index 813333d534..26b74f02cd 100644 --- a/libraries/entities/src/LightEntityItem.h +++ b/libraries/entities/src/LightEntityItem.h @@ -20,6 +20,8 @@ public: static const float DEFAULT_INTENSITY; static const float DEFAULT_FALLOFF_RADIUS; static const float DEFAULT_EXPONENT; + static const float MIN_CUTOFF; + static const float MAX_CUTOFF; static const float DEFAULT_CUTOFF; static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties); diff --git a/libraries/script-engine/src/ScriptEngine.cpp b/libraries/script-engine/src/ScriptEngine.cpp index 6f98dd2864..8dad5932be 100644 --- a/libraries/script-engine/src/ScriptEngine.cpp +++ b/libraries/script-engine/src/ScriptEngine.cpp @@ -670,6 +670,7 @@ void ScriptEngine::init() { qScriptRegisterMetaType(this, EntityPropertyFlagsToScriptValue, EntityPropertyFlagsFromScriptValue); qScriptRegisterMetaType(this, EntityItemPropertiesToScriptValue, EntityItemPropertiesFromScriptValueHonorReadOnly); + qScriptRegisterMetaType(this, EntityPropertyInfoToScriptValue, EntityPropertyInfoFromScriptValue); qScriptRegisterMetaType(this, EntityItemIDtoScriptValue, EntityItemIDfromScriptValue); qScriptRegisterMetaType(this, RayToEntityIntersectionResultToScriptValue, RayToEntityIntersectionResultFromScriptValue); qScriptRegisterMetaType(this, RayToAvatarIntersectionResultToScriptValue, RayToAvatarIntersectionResultFromScriptValue); diff --git a/scripts/system/edit.js b/scripts/system/edit.js index 36f9af0ea7..3ff91dbda3 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -453,7 +453,7 @@ const DEFAULT_ENTITY_PROPERTIES = { spinSpread: 0, rotateWithEntity: false, polarStart: 0, - polarFinish: 0, + polarFinish: Math.PI, azimuthStart: -Math.PI, azimuthFinish: Math.PI }, @@ -2479,6 +2479,15 @@ var PropertiesTool = function (opts) { tooltips: Script.require('./assets/data/createAppTooltips.json'), hmdActive: HMD.active, }); + } else if (data.type === "propertyRangeRequest") { + var propertyRanges = {}; + data.properties.forEach(function (property) { + propertyRanges[property] = Entities.getPropertyInfo(property); + }); + emitScriptEvent({ + type: 'propertyRangeReply', + propertyRanges: propertyRanges, + }); } }; diff --git a/scripts/system/html/js/draggableNumber.js b/scripts/system/html/js/draggableNumber.js index 4e3a32b0f2..b1039ed37b 100644 --- a/scripts/system/html/js/draggableNumber.js +++ b/scripts/system/html/js/draggableNumber.js @@ -139,7 +139,14 @@ DraggableNumber.prototype = { }, inputChange: function() { - this.setValue(this.elInput.value); + let value = this.elInput.value; + if (this.max !== undefined) { + value = Math.min(this.max, value); + } + if (this.min !== undefined) { + value = Math.max(this.min, value); + } + this.setValue(value); }, inputBlur: function(ev) { @@ -156,6 +163,17 @@ DraggableNumber.prototype = { return this.elText.getAttribute("disabled") === "disabled"; }, + updateMinMax: function(min, max) { + this.min = min; + this.max = max; + if (this.min !== undefined) { + this.elInput.setAttribute("min", this.min); + } + if (this.max !== undefined) { + this.elInput.setAttribute("max", this.max); + } + }, + initialize: function() { this.onMouseDown = this.mouseDown.bind(this); this.onMouseUp = this.mouseUp.bind(this); @@ -189,12 +207,7 @@ DraggableNumber.prototype = { this.elInput = document.createElement('input'); this.elInput.className = "input"; this.elInput.setAttribute("type", "number"); - if (this.min !== undefined) { - this.elInput.setAttribute("min", this.min); - } - if (this.max !== undefined) { - this.elInput.setAttribute("max", this.max); - } + this.updateMinMax(this.min, this.max); if (this.step !== undefined) { this.elInput.setAttribute("step", this.step); } diff --git a/scripts/system/html/js/entityProperties.js b/scripts/system/html/js/entityProperties.js index 78ef8ac313..16b83285b9 100644 --- a/scripts/system/html/js/entityProperties.js +++ b/scripts/system/html/js/entityProperties.js @@ -75,7 +75,7 @@ const GROUPS = [ }, { label: "Parent Joint Index", - type: "number-draggable", + type: "number", propertyID: "parentJointIndex", }, { @@ -137,7 +137,7 @@ const GROUPS = [ label: "Line Height", type: "number-draggable", min: 0, - step: 0.005, + step: 0.001, decimals: 4, unit: "m", propertyID: "lineHeight" @@ -185,8 +185,8 @@ const GROUPS = [ label: "Light Intensity", type: "number-draggable", min: 0, - max: 10, - step: 0.1, + max: 40, + step: 0.01, decimals: 2, propertyID: "keyLight.intensity", showPropertyRule: { "keyLightMode": "enabled" }, @@ -194,6 +194,7 @@ const GROUPS = [ { label: "Light Horizontal Angle", type: "number-draggable", + step: 0.1, multiplier: DEGREES_TO_RADIANS, decimals: 2, unit: "deg", @@ -203,6 +204,7 @@ const GROUPS = [ { label: "Light Vertical Angle", type: "number-draggable", + step: 0.1, multiplier: DEGREES_TO_RADIANS, decimals: 2, unit: "deg", @@ -243,7 +245,7 @@ const GROUPS = [ label: "Ambient Intensity", type: "number-draggable", min: 0, - max: 10, + max: 200, step: 0.1, decimals: 2, propertyID: "ambientLight.ambientIntensity", @@ -271,9 +273,9 @@ const GROUPS = [ { label: "Range", type: "number-draggable", - min: 5, + min: 1, max: 10000, - step: 5, + step: 1, decimals: 0, unit: "m", propertyID: "haze.hazeRange", @@ -290,7 +292,7 @@ const GROUPS = [ type: "number-draggable", min: -1000, max: 1000, - step: 10, + step: 1, decimals: 0, unit: "m", propertyID: "haze.hazeBaseRef", @@ -301,7 +303,7 @@ const GROUPS = [ type: "number-draggable", min: -1000, max: 5000, - step: 10, + step: 1, decimals: 0, unit: "m", propertyID: "haze.hazeCeiling", @@ -318,8 +320,8 @@ const GROUPS = [ type: "number-draggable", min: 0, max: 1, - step: 0.01, - decimals: 2, + step: 0.001, + decimals: 3, propertyID: "haze.hazeBackgroundBlend", showPropertyRule: { "hazeMode": "enabled" }, }, @@ -356,8 +358,8 @@ const GROUPS = [ type: "number-draggable", min: 0, max: 1, - step: 0.01, - decimals: 2, + step: 0.001, + decimals: 3, propertyID: "bloom.bloomIntensity", showPropertyRule: { "bloomMode": "enabled" }, }, @@ -366,8 +368,8 @@ const GROUPS = [ type: "number-draggable", min: 0, max: 1, - step: 0.01, - decimals: 2, + step: 0.001, + decimals: 3, propertyID: "bloom.bloomThreshold", showPropertyRule: { "bloomMode": "enabled" }, }, @@ -376,8 +378,8 @@ const GROUPS = [ type: "number-draggable", min: 0, max: 2, - step: 0.01, - decimals: 2, + step: 0.001, + decimals: 3, propertyID: "bloom.bloomSize", showPropertyRule: { "bloomMode": "enabled" }, }, @@ -510,16 +512,18 @@ const GROUPS = [ label: "Intensity", type: "number-draggable", min: 0, + max: 10000, step: 0.1, - decimals: 1, + decimals: 2, propertyID: "intensity", }, { label: "Fall-Off Radius", type: "number-draggable", min: 0, + max: 10000, step: 0.1, - decimals: 1, + decimals: 2, unit: "m", propertyID: "falloffRadius", }, @@ -531,6 +535,7 @@ const GROUPS = [ { label: "Spotlight Exponent", type: "number-draggable", + min: 0, step: 0.01, decimals: 2, propertyID: "exponent", @@ -643,8 +648,6 @@ const GROUPS = [ label: "Lifespan", type: "number-draggable", unit: "s", - min: 0.01, - max: 10, step: 0.01, decimals: 2, propertyID: "lifespan", @@ -652,8 +655,6 @@ const GROUPS = [ { label: "Max Particles", type: "number-draggable", - min: 1, - max: 10000, step: 1, propertyID: "maxParticles", }, @@ -673,26 +674,20 @@ const GROUPS = [ { label: "Emit Rate", type: "number-draggable", - min: 1, - max: 1000, step: 1, propertyID: "emitRate", }, { label: "Emit Speed", type: "number-draggable", - min: 0, - max: 5, - step: 0.01, + step: 0.1, decimals: 2, propertyID: "emitSpeed", }, { label: "Speed Spread", type: "number-draggable", - min: 0, - max: 5, - step: 0.01, + step: 0.1, decimals: 2, propertyID: "speedSpread", }, @@ -700,7 +695,6 @@ const GROUPS = [ label: "Emit Dimensions", type: "vec3", vec3Type: "xyz", - min: 0, step: 0.01, round: 100, subLabels: [ "x", "y", "z" ], @@ -709,10 +703,8 @@ const GROUPS = [ { label: "Emit Radius Start", type: "number-draggable", - min: 0, - max: 1, - step: 0.01, - decimals: 2, + step: 0.001, + decimals: 3, propertyID: "emitRadiusStart" }, { @@ -745,8 +737,6 @@ const GROUPS = [ { label: "Start", type: "number-draggable", - min: 0, - max: 4, step: 0.01, decimals: 2, propertyID: "radiusStart", @@ -755,8 +745,6 @@ const GROUPS = [ { label: "Middle", type: "number-draggable", - min: 0, - max: 4, step: 0.01, decimals: 2, propertyID: "particleRadius", @@ -764,8 +752,6 @@ const GROUPS = [ { label: "Finish", type: "number-draggable", - min: 0, - max: 4, step: 0.01, decimals: 2, propertyID: "radiusFinish", @@ -776,8 +762,6 @@ const GROUPS = [ { label: "Size Spread", type: "number-draggable", - min: 0, - max: 4, step: 0.01, decimals: 2, propertyID: "radiusSpread", @@ -834,29 +818,23 @@ const GROUPS = [ { label: "Start", type: "number-draggable", - min: 0, - max: 1, - step: 0.01, - decimals: 2, + step: 0.001, + decimals: 3, propertyID: "alphaStart", fallbackProperty: "alpha", }, { label: "Middle", type: "number-draggable", - min: 0, - max: 1, - step: 0.01, - decimals: 2, + step: 0.001, + decimals: 3, propertyID: "alpha", }, { label: "Finish", type: "number-draggable", - min: 0, - max: 1, - step: 0.01, - decimals: 2, + step: 0.001, + decimals: 3, propertyID: "alphaFinish", fallbackProperty: "alpha", }, @@ -865,10 +843,8 @@ const GROUPS = [ { label: "Alpha Spread", type: "number-draggable", - min: 0, - max: 1, - step: 0.01, - decimals: 2, + step: 0.001, + decimals: 3, propertyID: "alphaSpread", }, ] @@ -911,10 +887,8 @@ const GROUPS = [ { label: "Start", type: "number-draggable", - min: -360, - max: 360, - step: 1, - decimals: 0, + step: 0.1, + decimals: 2, multiplier: DEGREES_TO_RADIANS, unit: "deg", propertyID: "spinStart", @@ -923,10 +897,8 @@ const GROUPS = [ { label: "Middle", type: "number-draggable", - min: -360, - max: 360, - step: 1, - decimals: 0, + step: 0.1, + decimals: 2, multiplier: DEGREES_TO_RADIANS, unit: "deg", propertyID: "particleSpin", @@ -934,10 +906,8 @@ const GROUPS = [ { label: "Finish", type: "number-draggable", - min: -360, - max: 360, - step: 1, - decimals: 0, + step: 0.1, + decimals: 2, multiplier: DEGREES_TO_RADIANS, unit: "deg", propertyID: "spinFinish", @@ -948,10 +918,8 @@ const GROUPS = [ { label: "Spin Spread", type: "number-draggable", - min: 0, - max: 360, - step: 1, - decimals: 0, + step: 0.1, + decimals: 2, multiplier: DEGREES_TO_RADIANS, unit: "deg", propertyID: "spinSpread", @@ -976,10 +944,8 @@ const GROUPS = [ { label: "Start", type: "number-draggable", - min: 0, - max: 180, - step: 1, - decimals: 0, + step: 0.1, + decimals: 2, multiplier: DEGREES_TO_RADIANS, unit: "deg", propertyID: "polarStart", @@ -987,10 +953,8 @@ const GROUPS = [ { label: "Finish", type: "number-draggable", - min: 0, - max: 180, - step: 1, - decimals: 0, + step: 0.1, + decimals: 2, multiplier: DEGREES_TO_RADIANS, unit: "deg", propertyID: "polarFinish", @@ -1005,10 +969,8 @@ const GROUPS = [ { label: "Start", type: "number-draggable", - min: -180, - max: 180, - step: 1, - decimals: 0, + step: 0.1, + decimals: 2, multiplier: DEGREES_TO_RADIANS, unit: "deg", propertyID: "azimuthStart", @@ -1016,10 +978,8 @@ const GROUPS = [ { label: "Finish", type: "number-draggable", - min: -180, - max: 180, - step: 1, - decimals: 0, + step: 0.1, + decimals: 2, multiplier: DEGREES_TO_RADIANS, unit: "deg", propertyID: "azimuthFinish", @@ -1036,6 +996,7 @@ const GROUPS = [ label: "Position", type: "vec3", vec3Type: "xyz", + step: 0.1, decimals: 4, subLabels: [ "x", "y", "z" ], unit: "m", @@ -1046,6 +1007,7 @@ const GROUPS = [ label: "Local Position", type: "vec3", vec3Type: "xyz", + step: 0.1, decimals: 4, subLabels: [ "x", "y", "z" ], unit: "m", @@ -1078,8 +1040,7 @@ const GROUPS = [ label: "Dimensions", type: "vec3", vec3Type: "xyz", - min: 0, - step: 0.1, + step: 0.01, decimals: 4, subLabels: [ "x", "y", "z" ], unit: "m", @@ -1090,8 +1051,7 @@ const GROUPS = [ label: "Local Dimensions", type: "vec3", vec3Type: "xyz", - min: 0, - step: 0.1, + step: 0.01, decimals: 4, subLabels: [ "x", "y", "z" ], unit: "m", @@ -1111,7 +1071,7 @@ const GROUPS = [ label: "Pivot", type: "vec3", vec3Type: "xyz", - step: 0.1, + step: 0.001, decimals: 4, subLabels: [ "x", "y", "z" ], unit: "(ratio of dimension)", @@ -1143,6 +1103,7 @@ const GROUPS = [ { label: "Clone Lifetime", type: "number-draggable", + min: -1, unit: "s", propertyID: "cloneLifetime", showPropertyRule: { "cloneable": "true" }, @@ -1150,6 +1111,7 @@ const GROUPS = [ { label: "Clone Limit", type: "number-draggable", + min: 0, propertyID: "cloneLimit", showPropertyRule: { "cloneable": "true" }, }, @@ -1296,7 +1258,7 @@ const GROUPS = [ label: "Linear Velocity", type: "vec3", vec3Type: "xyz", - step: 0.1, + step: 0.01, decimals: 4, subLabels: [ "x", "y", "z" ], unit: "m/s", @@ -1307,8 +1269,8 @@ const GROUPS = [ type: "number-draggable", min: 0, max: 1, - step: 0.01, - decimals: 2, + step: 0.001, + decimals: 4, propertyID: "damping", }, { @@ -1326,33 +1288,27 @@ const GROUPS = [ type: "number-draggable", min: 0, max: 1, - step: 0.01, + step: 0.001, decimals: 4, propertyID: "angularDamping", }, { label: "Bounciness", type: "number-draggable", - min: 0, - max: 1, - step: 0.01, + step: 0.001, decimals: 4, propertyID: "restitution", }, { label: "Friction", type: "number-draggable", - min: 0, - max: 10, - step: 0.1, + step: 0.01, decimals: 4, propertyID: "friction", }, { label: "Density", type: "number-draggable", - min: 100, - max: 10000, step: 1, decimals: 4, propertyID: "density", @@ -1372,6 +1328,7 @@ const GROUPS = [ type: "vec3", vec3Type: "xyz", subLabels: [ "x", "y", "z" ], + step: 0.1, decimals: 4, unit: "m/s2", propertyID: "acceleration", @@ -1446,6 +1403,7 @@ const JSON_EDITOR_ROW_DIV_INDEX = 2; let elGroups = {}; let properties = {}; +let propertyRangeRequests = []; let colorPickers = {}; let particlePropertyUpdates = {}; let selectedEntityProperties; @@ -1922,6 +1880,17 @@ function createNumberProperty(property, elProperty) { return elInput; } +function updateNumberMinMax(property) { + let propertyData = property.data; + let elInput = property.elInput; + if (propertyData.min !== undefined) { + elInput.setAttribute("min", propertyData.min); + } + if (propertyData.max !== undefined) { + elInput.setAttribute("max", propertyData.max); + } +} + function createNumberDraggableProperty(property, elProperty) { let elementID = property.elementID; let propertyData = property.data; @@ -1951,6 +1920,11 @@ function createNumberDraggableProperty(property, elProperty) { return elDraggableNumber; } +function updateNumberDraggableMinMax(property) { + let propertyData = property.data; + property.elNumber.updateMinMax(propertyData.min, propertyData.max); +} + function createVec3Property(property, elProperty) { let propertyData = property.data; @@ -2000,6 +1974,15 @@ function createVec2Property(property, elProperty) { return elResult; } +function updateVectorMinMax(property) { + let propertyData = property.data; + property.elNumberX.updateMinMax(propertyData.min, propertyData.max); + property.elNumberY.updateMinMax(propertyData.min, propertyData.max); + if (property.elNumberZ) { + property.elNumberZ.updateMinMax(propertyData.min, propertyData.max); + } +} + function createColorProperty(property, elProperty) { let propertyName = property.name; let elementID = property.elementID; @@ -2046,7 +2029,6 @@ function createColorProperty(property, elProperty) { color: '000000', submit: false, // We don't want to have a submission button onShow: function(colpick) { - console.log("Showing"); $(colorPickerID).attr('active', 'true'); // The original color preview within the picker needs to be updated on show because // prior to the picker being shown we don't have access to the selections' starting color. @@ -2986,6 +2968,9 @@ function loaded() { if (property.type !== 'placeholder') { properties[propertyID] = property; } + if (innerPropertyData.type === 'number' || innerPropertyData.type === 'number-draggable') { + propertyRangeRequests.push(propertyID); + } } } else { let property = createProperty(propertyData, propertyElementID, propertyName, propertyID, elProperty); @@ -2995,6 +2980,10 @@ function loaded() { if (property.type !== 'placeholder') { properties[propertyID] = property; + } + if (propertyData.type === 'number' || propertyData.type === 'number-draggable' || + propertyData.type === 'vec2' || propertyData.type === 'vec3') { + propertyRangeRequests.push(propertyID); } let showPropertyRule = propertyData.showPropertyRule; @@ -3346,11 +3335,40 @@ function loaded() { } else if (data.type === 'setSpaceMode') { currentSpaceMode = data.spaceMode === "local" ? PROPERTY_SPACE_MODE.LOCAL : PROPERTY_SPACE_MODE.WORLD; updateVisibleSpaceModeProperties(); + } else if (data.type === 'propertyRangeReply') { + let propertyRanges = data.propertyRanges; + for (let property in propertyRanges) { + let propertyRange = propertyRanges[property]; + if (propertyRange !== undefined) { + let propertyData = properties[property].data; + let multiplier = propertyData.multiplier; + if (propertyData.min === undefined && propertyRange.minimum != "") { + propertyData.min = propertyRange.minimum; + if (multiplier !== undefined) { + propertyData.min /= multiplier; + } + } + if (propertyData.max === undefined && propertyRange.maximum != "") { + propertyData.max = propertyRange.maximum; + if (multiplier !== undefined) { + propertyData.max /= multiplier; + } + } + if (propertyData.type === 'number') { + updateNumberMinMax(properties[property]); + } else if (propertyData.type === 'number-draggable') { + updateNumberDraggableMinMax(properties[property]); + } else if (propertyData.type === 'vec2' || propertyData.type === 'vec3') { + updateVectorMinMax(properties[property]); + } + } + } } }); - // Request tooltips as soon as we can process a reply: + // Request tooltips and property ranges as soon as we can process a reply: EventBridge.emitWebEvent(JSON.stringify({ type: 'tooltipsRequest' })); + EventBridge.emitWebEvent(JSON.stringify({ type: 'propertyRangeRequest', properties: propertyRangeRequests })); } // Server Script Status diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 164899ef86..83cd010337 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -599,12 +599,10 @@ SelectionDisplay = (function() { const STRETCH_CUBE_OFFSET = 0.06; const STRETCH_CUBE_CAMERA_DISTANCE_MULTIPLE = 0.02; - const STRETCH_MINIMUM_DIMENSION = 0.001; const STRETCH_PANEL_WIDTH = 0.01; const SCALE_OVERLAY_CAMERA_DISTANCE_MULTIPLE = 0.02; const SCALE_DIMENSIONS_CAMERA_DISTANCE_MULTIPLE = 0.5; - const SCALE_MINIMUM_DIMENSION = 0.01; const BOUNDING_EDGE_OFFSET = 0.5; @@ -1543,7 +1541,7 @@ SelectionDisplay = (function() { print(" SpaceMode: " + spaceMode); print(" DisplayMode: " + getMode()); } - + if (SelectionManager.selections.length === 0) { that.setOverlaysVisible(false); that.clearDebugPickPlane(); @@ -1574,7 +1572,7 @@ SelectionDisplay = (function() { dimensions: dimensions }; var isCameraInsideBox = isPointInsideBox(Camera.position, selectionBoxGeometry); - + // in HMD if outside the bounding box clamp the overlays to the bounding box for now so lasers can hit them var maxHandleDimension = 0; if (HMD.active && !isCameraInsideBox) { @@ -2515,7 +2513,7 @@ SelectionDisplay = (function() { var newDimensions = Vec3.sum(initialDimensions, changeInDimensions); - var minimumDimension = STRETCH_MINIMUM_DIMENSION; + var minimumDimension = Entities.getPropertyInfo("dimensions").minimum; if (newDimensions.x < minimumDimension) { newDimensions.x = minimumDimension; changeInDimensions.x = minimumDimension - initialDimensions.x; @@ -2634,7 +2632,7 @@ SelectionDisplay = (function() { newDimensions.y = Math.abs(newDimensions.y); newDimensions.z = Math.abs(newDimensions.z); - var minimumDimension = SCALE_MINIMUM_DIMENSION; + var minimumDimension = Entities.getPropertyInfo("dimensions").minimum; if (newDimensions.x < minimumDimension) { newDimensions.x = minimumDimension; changeInDimensions.x = minimumDimension - initialDimensions.x; From dde7fbdfce1cfbf74494773652fbea0db260b1b1 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 27 Dec 2018 19:58:35 -0800 Subject: [PATCH 02/27] how did these happen --- .../entities/src/EntityItemProperties.cpp | 14 ++++---- .../entities/src/EntityScriptingInterface.cpp | 31 ------------------ .../entities/src/EntityScriptingInterface.h | 32 ++----------------- 3 files changed, 10 insertions(+), 67 deletions(-) diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index 5616d04ea4..229e5068d0 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -2436,19 +2436,19 @@ bool EntityItemProperties::getPropertyInfo(const QString& propertyName, EntityPr ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_TRIGGERABLE, Grab, grab, Triggerable, triggerable); ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_EQUIPPABLE, Grab, grab, Equippable, equippable); ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_LEFT_EQUIPPABLE_POSITION_OFFSET, Grab, grab, - EquippableLeftPosition, equippableLeftPosition); + EquippableLeftPosition, equippableLeftPosition); ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_LEFT_EQUIPPABLE_ROTATION_OFFSET, Grab, grab, - EquippableLeftRotation, equippableLeftRotation); + EquippableLeftRotation, equippableLeftRotation); ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_RIGHT_EQUIPPABLE_POSITION_OFFSET, Grab, grab, - EquippableRightPosition, equippableRightPosition); + EquippableRightPosition, equippableRightPosition); ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_RIGHT_EQUIPPABLE_ROTATION_OFFSET, Grab, grab, - EquippableRightRotation, equippableRightRotation); + EquippableRightRotation, equippableRightRotation); ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_EQUIPPABLE_INDICATOR_URL, Grab, grab, - EquippableIndicatorURL, equippableIndicatorURL); + EquippableIndicatorURL, equippableIndicatorURL); ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_EQUIPPABLE_INDICATOR_SCALE, Grab, grab, - EquippableIndicatorScale, equippableIndicatorScale); + EquippableIndicatorScale, equippableIndicatorScale); ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_EQUIPPABLE_INDICATOR_OFFSET, Grab, grab, - EquippableIndicatorOffset, equippableIndicatorOffset); + EquippableIndicatorOffset, equippableIndicatorOffset); ADD_PROPERTY_TO_MAP(PROP_IMAGE_URL, ImageURL, imageURL, QString); ADD_PROPERTY_TO_MAP(PROP_EMISSIVE, Emissive, emissive, bool); diff --git a/libraries/entities/src/EntityScriptingInterface.cpp b/libraries/entities/src/EntityScriptingInterface.cpp index f9f1cb0a06..314604a9da 100644 --- a/libraries/entities/src/EntityScriptingInterface.cpp +++ b/libraries/entities/src/EntityScriptingInterface.cpp @@ -1193,12 +1193,6 @@ QVector EntityScriptingInterface::findEntitiesByType(const QString entity _entityTree->withReadLock([&] { _entityTree->evalEntitiesInSphereWithType(center, radius, type, PickFilter(searchFilter), result); }); - - foreach(EntityItemPointer entity, entities) { - if (entity->getType() == type) { - result << entity->getEntityItemID().toString(); - } - } } return result; } @@ -1210,24 +1204,6 @@ QVector EntityScriptingInterface::findEntitiesByName(const QString entity unsigned int searchFilter = PickFilter::getBitMask(PickFilter::FlagBit::DOMAIN_ENTITIES) | PickFilter::getBitMask(PickFilter::FlagBit::AVATAR_ENTITIES); _entityTree->evalEntitiesInSphereWithName(center, radius, entityName, caseSensitiveSearch, PickFilter(searchFilter), result); }); - - if (caseSensitiveSearch) { - foreach(EntityItemPointer entity, entities) { - if (entity->getName() == entityName) { - result << entity->getEntityItemID(); - } - } - - } else { - QString entityNameLowerCase = entityName.toLower(); - - foreach(EntityItemPointer entity, entities) { - QString entityItemLowerCase = entity->getName().toLower(); - if (entityItemLowerCase == entityNameLowerCase) { - result << entity->getEntityItemID(); - } - } - } } return result; } @@ -1262,13 +1238,6 @@ RayToEntityIntersectionResult EntityScriptingInterface::evalRayIntersectionVecto return evalRayIntersectionWorker(ray, Octree::Lock, searchFilter, entityIdsToInclude, entityIdsToDiscard); } -RayToEntityIntersectionResult EntityScriptingInterface::evalRayIntersectionVector(const PickRay& ray, PickFilter searchFilter, - const QVector& entityIdsToInclude, const QVector& entityIdsToDiscard) { - PROFILE_RANGE(script_entities, __FUNCTION__); - - return evalRayIntersectionWorker(ray, Octree::Lock, searchFilter, entityIdsToInclude, entityIdsToDiscard); -} - RayToEntityIntersectionResult EntityScriptingInterface::evalRayIntersectionWorker(const PickRay& ray, Octree::lockType lockType, PickFilter searchFilter, const QVector& entityIdsToInclude, const QVector& entityIdsToDiscard) const { diff --git a/libraries/entities/src/EntityScriptingInterface.h b/libraries/entities/src/EntityScriptingInterface.h index 389b5e629b..7b8378f6ce 100644 --- a/libraries/entities/src/EntityScriptingInterface.h +++ b/libraries/entities/src/EntityScriptingInterface.h @@ -427,7 +427,7 @@ public slots: * @function Entities.findEntitiesInBox * @param {Vec3} corner - The corner of the search AA box with minimum co-ordinate values. * @param {Vec3} dimensions - The dimensions of the search AA box. - * @returns {Uuid[]} An array of entity IDs whose AA boxes intersect the search AA box. The array is empty if no entities + * @returns {Uuid[]} An array of entity IDs whose AA boxes intersect the search AA box. The array is empty if no entities * could be found. */ /// this function will not find any models in script engine contexts which don't have access to models @@ -438,7 +438,7 @@ public slots: * @function Entities.findEntitiesInFrustum * @param {ViewFrustum} frustum - The frustum to search in. The position, orientation, * projection, and centerRadius properties must be specified. - * @returns {Uuid[]} An array of entity IDs axis-aligned boxes intersect the frustum. The array is empty if no entities + * @returns {Uuid[]} An array of entity IDs axis-aligned boxes intersect the frustum. The array is empty if no entities * could be found. * @example Report the number of entities in view. * var entityIDs = Entities.findEntitiesInFrustum(Camera.frustum); @@ -453,7 +453,7 @@ public slots: * @param {Entities.EntityType} entityType - The type of entity to search for. * @param {Vec3} center - The point about which to search. * @param {number} radius - The radius within which to search. - * @returns {Uuid[]} An array of entity IDs of the specified type that intersect the search sphere. The array is empty if + * @returns {Uuid[]} An array of entity IDs of the specified type that intersect the search sphere. The array is empty if * no entities could be found. * @example Report the number of Model entities within 10m of your avatar. * var entityIDs = Entities.findEntitiesByType("Model", MyAvatar.position, 10); @@ -513,32 +513,6 @@ public slots: const QScriptValue& entityIdsToInclude = QScriptValue(), const QScriptValue& entityIdsToDiscard = QScriptValue(), bool visibleOnly = false, bool collidableOnly = false) const; - /// Same as above but with QVectors - RayToEntityIntersectionResult findRayIntersectionVector(const PickRay& ray, bool precisionPicking, - const QVector& entityIdsToInclude, const QVector& entityIdsToDiscard, - bool visibleOnly, bool collidableOnly); - - /**jsdoc - * Find the first entity intersected by a {@link PickRay}. Light and Zone entities are not - * intersected unless they've been configured as pickable using {@link Entities.setLightsArePickable|setLightsArePickable} - * and {@link Entities.setZonesArePickable|setZonesArePickable}, respectively.
- * This is a synonym for {@link Entities.findRayIntersection|findRayIntersection}. - * @function Entities.findRayIntersectionBlocking - * @param {PickRay} pickRay - The PickRay to use for finding entities. - * @param {boolean} [precisionPicking=false] - If true and the intersected entity is a Model - * entity, the result's extraInfo property includes more information than it otherwise would. - * @param {Uuid[]} [entitiesToInclude=[]] - If not empty then the search is restricted to these entities. - * @param {Uuid[]} [entitiesToDiscard=[]] - Entities to ignore during the search. - * @deprecated This function is deprecated and will soon be removed. Use - * {@link Entities.findRayIntersection|findRayIntersection} instead; it blocks and performs the same function. - */ - /// If the scripting context has visible entities, this will determine a ray intersection, and will block in - /// order to return an accurate result - Q_INVOKABLE RayToEntityIntersectionResult findRayIntersectionBlocking(const PickRay& ray, bool precisionPicking = false, - const QScriptValue& entityIdsToInclude = QScriptValue(), const QScriptValue& entityIdsToDiscard = QScriptValue()); - ->>>>>>> property range audit - add range info via macros accessible via API, tweak min/max/steps in entityProperties - /**jsdoc * Reloads an entity's server entity script such that the latest version re-downloaded. * @function Entities.reloadServerScripts From b92beca7d150ae4ff8bee4b12b1b460003061cb2 Mon Sep 17 00:00:00 2001 From: David Back Date: Wed, 2 Jan 2019 11:26:38 -0800 Subject: [PATCH 03/27] bad merge --- .../entities/src/EntityScriptingInterface.cpp | 15 --------------- libraries/entities/src/EntityScriptingInterface.h | 6 +++--- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/libraries/entities/src/EntityScriptingInterface.cpp b/libraries/entities/src/EntityScriptingInterface.cpp index 314604a9da..709e7f4508 100644 --- a/libraries/entities/src/EntityScriptingInterface.cpp +++ b/libraries/entities/src/EntityScriptingInterface.cpp @@ -1089,9 +1089,6 @@ QUuid EntityScriptingInterface::findClosestEntity(const glm::vec3& center, float _entityTree->withReadLock([&] { result = _entityTree->evalClosestEntity(center, radius, PickFilter(searchFilter)); }); - if (closestEntity) { - result = closestEntity->getEntityItemID(); - } } return result; } @@ -1114,10 +1111,6 @@ QVector EntityScriptingInterface::findEntities(const glm::vec3& center, f _entityTree->withReadLock([&] { _entityTree->evalEntitiesInSphere(center, radius, PickFilter(searchFilter), result); }); - - foreach (EntityItemPointer entity, entities) { - result << entity->getEntityItemID(); - } } return result; } @@ -1132,10 +1125,6 @@ QVector EntityScriptingInterface::findEntitiesInBox(const glm::vec3& corn AABox box(corner, dimensions); _entityTree->evalEntitiesInBox(box, PickFilter(searchFilter), result); }); - - foreach (EntityItemPointer entity, entities) { - result << entity->getEntityItemID(); - } } return result; } @@ -1174,10 +1163,6 @@ QVector EntityScriptingInterface::findEntitiesInFrustum(QVariantMap frust _entityTree->withReadLock([&] { _entityTree->evalEntitiesInFrustum(viewFrustum, PickFilter(searchFilter), result); }); - - foreach(EntityItemPointer entity, entities) { - result << entity->getEntityItemID(); - } } } diff --git a/libraries/entities/src/EntityScriptingInterface.h b/libraries/entities/src/EntityScriptingInterface.h index 7b8378f6ce..1f09198f0f 100644 --- a/libraries/entities/src/EntityScriptingInterface.h +++ b/libraries/entities/src/EntityScriptingInterface.h @@ -427,7 +427,7 @@ public slots: * @function Entities.findEntitiesInBox * @param {Vec3} corner - The corner of the search AA box with minimum co-ordinate values. * @param {Vec3} dimensions - The dimensions of the search AA box. - * @returns {Uuid[]} An array of entity IDs whose AA boxes intersect the search AA box. The array is empty if no entities + * @returns {Uuid[]} An array of entity IDs whose AA boxes intersect the search AA box. The array is empty if no entities * could be found. */ /// this function will not find any models in script engine contexts which don't have access to models @@ -438,7 +438,7 @@ public slots: * @function Entities.findEntitiesInFrustum * @param {ViewFrustum} frustum - The frustum to search in. The position, orientation, * projection, and centerRadius properties must be specified. - * @returns {Uuid[]} An array of entity IDs axis-aligned boxes intersect the frustum. The array is empty if no entities + * @returns {Uuid[]} An array of entity IDs axis-aligned boxes intersect the frustum. The array is empty if no entities * could be found. * @example Report the number of entities in view. * var entityIDs = Entities.findEntitiesInFrustum(Camera.frustum); @@ -453,7 +453,7 @@ public slots: * @param {Entities.EntityType} entityType - The type of entity to search for. * @param {Vec3} center - The point about which to search. * @param {number} radius - The radius within which to search. - * @returns {Uuid[]} An array of entity IDs of the specified type that intersect the search sphere. The array is empty if + * @returns {Uuid[]} An array of entity IDs of the specified type that intersect the search sphere. The array is empty if * no entities could be found. * @example Report the number of Model entities within 10m of your avatar. * var entityIDs = Entities.findEntitiesByType("Model", MyAvatar.position, 10); From 937aa718aef5243801f0eefeb993deaacafeec73 Mon Sep 17 00:00:00 2001 From: David Back Date: Wed, 2 Jan 2019 18:22:55 -0800 Subject: [PATCH 04/27] remove selected particle property defaults --- scripts/system/edit.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/scripts/system/edit.js b/scripts/system/edit.js index 3ff91dbda3..b9c26201b5 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -420,7 +420,6 @@ const DEFAULT_ENTITY_PROPERTIES = { emitOrientation: { x: 0, y: 0, z: 0, w: 1 }, emitterShouldTrail: true, particleRadius: 0.25, - radiusStart: 0, radiusFinish: 0.1, radiusSpread: 0, particleColor: { @@ -435,7 +434,6 @@ const DEFAULT_ENTITY_PROPERTIES = { }, alpha: 0, alphaStart: 1, - alphaFinish: 0, alphaSpread: 0, emitAcceleration: { x: 0, @@ -448,8 +446,6 @@ const DEFAULT_ENTITY_PROPERTIES = { z: 0 }, particleSpin: 0, - spinStart: 0, - spinFinish: 0, spinSpread: 0, rotateWithEntity: false, polarStart: 0, From ad25d50934c73a10ff36fb2b0f2edfdea15db267 Mon Sep 17 00:00:00 2001 From: David Back Date: Fri, 4 Jan 2019 11:09:09 -0800 Subject: [PATCH 05/27] follow-up merge from PR 14585 --- .../entities/src/EntityItemProperties.cpp | 2629 +++++++++-------- 1 file changed, 1450 insertions(+), 1179 deletions(-) diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index 229e5068d0..82fc056f5b 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -50,10 +50,6 @@ EntityItemProperties::EntityItemProperties(EntityPropertyFlags desiredProperties _lastEdited(0), _type(EntityTypes::Unknown), - _localRenderAlpha(1.0f), - - _localRenderAlphaChanged(false), - _defaultSettings(true), _naturalDimensions(1.0f, 1.0f, 1.0f), _naturalPosition(0.0f, 0.0f, 0.0f), @@ -350,58 +346,90 @@ void EntityItemProperties::setBillboardModeFromString(const QString& materialMap EntityPropertyFlags EntityItemProperties::getChangedProperties() const { EntityPropertyFlags changedProperties; - CHECK_PROPERTY_CHANGE(PROP_LAST_EDITED_BY, lastEditedBy); + // Core + CHECK_PROPERTY_CHANGE(PROP_SIMULATION_OWNER, simulationOwner); + CHECK_PROPERTY_CHANGE(PROP_VISIBLE, visible); + CHECK_PROPERTY_CHANGE(PROP_NAME, name); + CHECK_PROPERTY_CHANGE(PROP_LOCKED, locked); + CHECK_PROPERTY_CHANGE(PROP_USER_DATA, userData); + CHECK_PROPERTY_CHANGE(PROP_HREF, href); + CHECK_PROPERTY_CHANGE(PROP_DESCRIPTION, description); CHECK_PROPERTY_CHANGE(PROP_POSITION, position); CHECK_PROPERTY_CHANGE(PROP_DIMENSIONS, dimensions); CHECK_PROPERTY_CHANGE(PROP_ROTATION, rotation); + CHECK_PROPERTY_CHANGE(PROP_REGISTRATION_POINT, registrationPoint); + //CHECK_PROPERTY_CHANGE(PROP_CREATED, created); // can't change + CHECK_PROPERTY_CHANGE(PROP_LAST_EDITED_BY, lastEditedBy); + CHECK_PROPERTY_CHANGE(PROP_ENTITY_HOST_TYPE, entityHostType); + CHECK_PROPERTY_CHANGE(PROP_OWNING_AVATAR_ID, owningAvatarID); + CHECK_PROPERTY_CHANGE(PROP_PARENT_ID, parentID); + CHECK_PROPERTY_CHANGE(PROP_PARENT_JOINT_INDEX, parentJointIndex); + CHECK_PROPERTY_CHANGE(PROP_QUERY_AA_CUBE, queryAACube); + CHECK_PROPERTY_CHANGE(PROP_CAN_CAST_SHADOW, canCastShadow); + CHECK_PROPERTY_CHANGE(PROP_VISIBLE_IN_SECONDARY_CAMERA, isVisibleInSecondaryCamera); + changedProperties += _grab.getChangedProperties(); + + // Physics CHECK_PROPERTY_CHANGE(PROP_DENSITY, density); CHECK_PROPERTY_CHANGE(PROP_VELOCITY, velocity); + CHECK_PROPERTY_CHANGE(PROP_ANGULAR_VELOCITY, angularVelocity); CHECK_PROPERTY_CHANGE(PROP_GRAVITY, gravity); CHECK_PROPERTY_CHANGE(PROP_ACCELERATION, acceleration); CHECK_PROPERTY_CHANGE(PROP_DAMPING, damping); + CHECK_PROPERTY_CHANGE(PROP_ANGULAR_DAMPING, angularDamping); CHECK_PROPERTY_CHANGE(PROP_RESTITUTION, restitution); CHECK_PROPERTY_CHANGE(PROP_FRICTION, friction); CHECK_PROPERTY_CHANGE(PROP_LIFETIME, lifetime); - CHECK_PROPERTY_CHANGE(PROP_SCRIPT, script); - CHECK_PROPERTY_CHANGE(PROP_SCRIPT_TIMESTAMP, scriptTimestamp); - CHECK_PROPERTY_CHANGE(PROP_SERVER_SCRIPTS, serverScripts); - CHECK_PROPERTY_CHANGE(PROP_COLLISION_SOUND_URL, collisionSoundURL); - CHECK_PROPERTY_CHANGE(PROP_COLOR, color); - CHECK_PROPERTY_CHANGE(PROP_COLOR_SPREAD, colorSpread); - CHECK_PROPERTY_CHANGE(PROP_COLOR_START, colorStart); - CHECK_PROPERTY_CHANGE(PROP_COLOR_FINISH, colorFinish); - CHECK_PROPERTY_CHANGE(PROP_ALPHA, alpha); - CHECK_PROPERTY_CHANGE(PROP_ALPHA_SPREAD, alphaSpread); - CHECK_PROPERTY_CHANGE(PROP_ALPHA_START, alphaStart); - CHECK_PROPERTY_CHANGE(PROP_ALPHA_FINISH, alphaFinish); - CHECK_PROPERTY_CHANGE(PROP_EMITTER_SHOULD_TRAIL, emitterShouldTrail); - CHECK_PROPERTY_CHANGE(PROP_MODEL_URL, modelURL); - CHECK_PROPERTY_CHANGE(PROP_COMPOUND_SHAPE_URL, compoundShapeURL); - CHECK_PROPERTY_CHANGE(PROP_VISIBLE, visible); - CHECK_PROPERTY_CHANGE(PROP_CAN_CAST_SHADOW, canCastShadow); - CHECK_PROPERTY_CHANGE(PROP_REGISTRATION_POINT, registrationPoint); - CHECK_PROPERTY_CHANGE(PROP_ANGULAR_VELOCITY, angularVelocity); - CHECK_PROPERTY_CHANGE(PROP_ANGULAR_DAMPING, angularDamping); CHECK_PROPERTY_CHANGE(PROP_COLLISIONLESS, collisionless); CHECK_PROPERTY_CHANGE(PROP_COLLISION_MASK, collisionMask); CHECK_PROPERTY_CHANGE(PROP_DYNAMIC, dynamic); - CHECK_PROPERTY_CHANGE(PROP_IS_SPOTLIGHT, isSpotlight); - CHECK_PROPERTY_CHANGE(PROP_INTENSITY, intensity); - CHECK_PROPERTY_CHANGE(PROP_FALLOFF_RADIUS, falloffRadius); - CHECK_PROPERTY_CHANGE(PROP_EXPONENT, exponent); - CHECK_PROPERTY_CHANGE(PROP_CUTOFF, cutoff); - CHECK_PROPERTY_CHANGE(PROP_LOCKED, locked); - CHECK_PROPERTY_CHANGE(PROP_TEXTURES, textures); - CHECK_PROPERTY_CHANGE(PROP_USER_DATA, userData); - CHECK_PROPERTY_CHANGE(PROP_SIMULATION_OWNER, simulationOwner); - CHECK_PROPERTY_CHANGE(PROP_TEXT, text); - CHECK_PROPERTY_CHANGE(PROP_LINE_HEIGHT, lineHeight); - CHECK_PROPERTY_CHANGE(PROP_TEXT_COLOR, textColor); - CHECK_PROPERTY_CHANGE(PROP_BACKGROUND_COLOR, backgroundColor); + CHECK_PROPERTY_CHANGE(PROP_COLLISION_SOUND_URL, collisionSoundURL); + CHECK_PROPERTY_CHANGE(PROP_ACTION_DATA, actionData); + + // Cloning + CHECK_PROPERTY_CHANGE(PROP_CLONEABLE, cloneable); + CHECK_PROPERTY_CHANGE(PROP_CLONE_LIFETIME, cloneLifetime); + CHECK_PROPERTY_CHANGE(PROP_CLONE_LIMIT, cloneLimit); + CHECK_PROPERTY_CHANGE(PROP_CLONE_DYNAMIC, cloneDynamic); + CHECK_PROPERTY_CHANGE(PROP_CLONE_AVATAR_ENTITY, cloneAvatarEntity); + CHECK_PROPERTY_CHANGE(PROP_CLONE_ORIGIN_ID, cloneOriginID); + + // Scripts + CHECK_PROPERTY_CHANGE(PROP_SCRIPT, script); + CHECK_PROPERTY_CHANGE(PROP_SCRIPT_TIMESTAMP, scriptTimestamp); + CHECK_PROPERTY_CHANGE(PROP_SERVER_SCRIPTS, serverScripts); + + // Certifiable Properties + CHECK_PROPERTY_CHANGE(PROP_ITEM_NAME, itemName); + CHECK_PROPERTY_CHANGE(PROP_ITEM_DESCRIPTION, itemDescription); + CHECK_PROPERTY_CHANGE(PROP_ITEM_CATEGORIES, itemCategories); + CHECK_PROPERTY_CHANGE(PROP_ITEM_ARTIST, itemArtist); + CHECK_PROPERTY_CHANGE(PROP_ITEM_LICENSE, itemLicense); + CHECK_PROPERTY_CHANGE(PROP_LIMITED_RUN, limitedRun); + CHECK_PROPERTY_CHANGE(PROP_MARKETPLACE_ID, marketplaceID); + CHECK_PROPERTY_CHANGE(PROP_EDITION_NUMBER, editionNumber); + CHECK_PROPERTY_CHANGE(PROP_ENTITY_INSTANCE_NUMBER, entityInstanceNumber); + CHECK_PROPERTY_CHANGE(PROP_CERTIFICATE_ID, certificateID); + CHECK_PROPERTY_CHANGE(PROP_STATIC_CERTIFICATE_VERSION, staticCertificateVersion); + + // Location data for scripts + CHECK_PROPERTY_CHANGE(PROP_LOCAL_POSITION, localPosition); + CHECK_PROPERTY_CHANGE(PROP_LOCAL_ROTATION, localRotation); + CHECK_PROPERTY_CHANGE(PROP_LOCAL_VELOCITY, localVelocity); + CHECK_PROPERTY_CHANGE(PROP_LOCAL_ANGULAR_VELOCITY, localAngularVelocity); + CHECK_PROPERTY_CHANGE(PROP_LOCAL_DIMENSIONS, localDimensions); + + // Common CHECK_PROPERTY_CHANGE(PROP_SHAPE_TYPE, shapeType); - CHECK_PROPERTY_CHANGE(PROP_EMITTING_PARTICLES, isEmitting); + CHECK_PROPERTY_CHANGE(PROP_COMPOUND_SHAPE_URL, compoundShapeURL); + CHECK_PROPERTY_CHANGE(PROP_COLOR, color); + CHECK_PROPERTY_CHANGE(PROP_ALPHA, alpha); + CHECK_PROPERTY_CHANGE(PROP_TEXTURES, textures); + + // Particles CHECK_PROPERTY_CHANGE(PROP_MAX_PARTICLES, maxParticles); CHECK_PROPERTY_CHANGE(PROP_LIFESPAN, lifespan); + CHECK_PROPERTY_CHANGE(PROP_EMITTING_PARTICLES, isEmitting); CHECK_PROPERTY_CHANGE(PROP_EMIT_RATE, emitRate); CHECK_PROPERTY_CHANGE(PROP_EMIT_SPEED, emitSpeed); CHECK_PROPERTY_CHANGE(PROP_SPEED_SPREAD, speedSpread); @@ -418,66 +446,67 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const { CHECK_PROPERTY_CHANGE(PROP_RADIUS_SPREAD, radiusSpread); CHECK_PROPERTY_CHANGE(PROP_RADIUS_START, radiusStart); CHECK_PROPERTY_CHANGE(PROP_RADIUS_FINISH, radiusFinish); - CHECK_PROPERTY_CHANGE(PROP_MATERIAL_URL, materialURL); - CHECK_PROPERTY_CHANGE(PROP_MATERIAL_MAPPING_MODE, materialMappingMode); - CHECK_PROPERTY_CHANGE(PROP_MATERIAL_PRIORITY, priority); - CHECK_PROPERTY_CHANGE(PROP_PARENT_MATERIAL_NAME, parentMaterialName); - CHECK_PROPERTY_CHANGE(PROP_MATERIAL_MAPPING_POS, materialMappingPos); - CHECK_PROPERTY_CHANGE(PROP_MATERIAL_MAPPING_SCALE, materialMappingScale); - CHECK_PROPERTY_CHANGE(PROP_MATERIAL_MAPPING_ROT, materialMappingRot); - CHECK_PROPERTY_CHANGE(PROP_MATERIAL_DATA, materialData); - CHECK_PROPERTY_CHANGE(PROP_MATERIAL_REPEAT, materialRepeat); - CHECK_PROPERTY_CHANGE(PROP_VISIBLE_IN_SECONDARY_CAMERA, isVisibleInSecondaryCamera); + CHECK_PROPERTY_CHANGE(PROP_COLOR_SPREAD, colorSpread); + CHECK_PROPERTY_CHANGE(PROP_COLOR_START, colorStart); + CHECK_PROPERTY_CHANGE(PROP_COLOR_FINISH, colorFinish); + CHECK_PROPERTY_CHANGE(PROP_ALPHA_SPREAD, alphaSpread); + CHECK_PROPERTY_CHANGE(PROP_ALPHA_START, alphaStart); + CHECK_PROPERTY_CHANGE(PROP_ALPHA_FINISH, alphaFinish); + CHECK_PROPERTY_CHANGE(PROP_EMITTER_SHOULD_TRAIL, emitterShouldTrail); CHECK_PROPERTY_CHANGE(PROP_PARTICLE_SPIN, particleSpin); CHECK_PROPERTY_CHANGE(PROP_SPIN_SPREAD, spinSpread); CHECK_PROPERTY_CHANGE(PROP_SPIN_START, spinStart); CHECK_PROPERTY_CHANGE(PROP_SPIN_FINISH, spinFinish); CHECK_PROPERTY_CHANGE(PROP_PARTICLE_ROTATE_WITH_ENTITY, rotateWithEntity); - CHECK_PROPERTY_CHANGE(PROP_IMAGE_URL, imageURL); - CHECK_PROPERTY_CHANGE(PROP_EMISSIVE, emissive); - CHECK_PROPERTY_CHANGE(PROP_KEEP_ASPECT_RATIO, keepAspectRatio); - CHECK_PROPERTY_CHANGE(PROP_SUB_IMAGE, subImage); + // Model + CHECK_PROPERTY_CHANGE(PROP_MODEL_URL, modelURL); + CHECK_PROPERTY_CHANGE(PROP_JOINT_ROTATIONS_SET, jointRotationsSet); + CHECK_PROPERTY_CHANGE(PROP_JOINT_ROTATIONS, jointRotations); + CHECK_PROPERTY_CHANGE(PROP_JOINT_TRANSLATIONS_SET, jointTranslationsSet); + CHECK_PROPERTY_CHANGE(PROP_JOINT_TRANSLATIONS, jointTranslations); + CHECK_PROPERTY_CHANGE(PROP_RELAY_PARENT_JOINTS, relayParentJoints); + changedProperties += _animation.getChangedProperties(); - CHECK_PROPERTY_CHANGE(PROP_GRID_FOLLOW_CAMERA, followCamera); - CHECK_PROPERTY_CHANGE(PROP_MAJOR_GRID_EVERY, majorGridEvery); - CHECK_PROPERTY_CHANGE(PROP_MINOR_GRID_EVERY, minorGridEvery); + // Light + CHECK_PROPERTY_CHANGE(PROP_IS_SPOTLIGHT, isSpotlight); + CHECK_PROPERTY_CHANGE(PROP_INTENSITY, intensity); + CHECK_PROPERTY_CHANGE(PROP_EXPONENT, exponent); + CHECK_PROPERTY_CHANGE(PROP_CUTOFF, cutoff); + CHECK_PROPERTY_CHANGE(PROP_FALLOFF_RADIUS, falloffRadius); - // Certifiable Properties - CHECK_PROPERTY_CHANGE(PROP_ITEM_NAME, itemName); - CHECK_PROPERTY_CHANGE(PROP_ITEM_DESCRIPTION, itemDescription); - CHECK_PROPERTY_CHANGE(PROP_ITEM_CATEGORIES, itemCategories); - CHECK_PROPERTY_CHANGE(PROP_ITEM_ARTIST, itemArtist); - CHECK_PROPERTY_CHANGE(PROP_ITEM_LICENSE, itemLicense); - CHECK_PROPERTY_CHANGE(PROP_LIMITED_RUN, limitedRun); - CHECK_PROPERTY_CHANGE(PROP_MARKETPLACE_ID, marketplaceID); - CHECK_PROPERTY_CHANGE(PROP_EDITION_NUMBER, editionNumber); - CHECK_PROPERTY_CHANGE(PROP_ENTITY_INSTANCE_NUMBER, entityInstanceNumber); - CHECK_PROPERTY_CHANGE(PROP_CERTIFICATE_ID, certificateID); - CHECK_PROPERTY_CHANGE(PROP_STATIC_CERTIFICATE_VERSION, staticCertificateVersion); + // Text + CHECK_PROPERTY_CHANGE(PROP_TEXT, text); + CHECK_PROPERTY_CHANGE(PROP_LINE_HEIGHT, lineHeight); + CHECK_PROPERTY_CHANGE(PROP_TEXT_COLOR, textColor); + CHECK_PROPERTY_CHANGE(PROP_TEXT_ALPHA, textAlpha); + CHECK_PROPERTY_CHANGE(PROP_BACKGROUND_COLOR, backgroundColor); + CHECK_PROPERTY_CHANGE(PROP_BACKGROUND_ALPHA, backgroundAlpha); + CHECK_PROPERTY_CHANGE(PROP_BILLBOARD_MODE, billboardMode); + CHECK_PROPERTY_CHANGE(PROP_LEFT_MARGIN, leftMargin); + CHECK_PROPERTY_CHANGE(PROP_RIGHT_MARGIN, rightMargin); + CHECK_PROPERTY_CHANGE(PROP_TOP_MARGIN, topMargin); + CHECK_PROPERTY_CHANGE(PROP_BOTTOM_MARGIN, bottomMargin); - CHECK_PROPERTY_CHANGE(PROP_NAME, name); - - CHECK_PROPERTY_CHANGE(PROP_HAZE_MODE, hazeMode); + // Zone + changedProperties += _keyLight.getChangedProperties(); + changedProperties += _ambientLight.getChangedProperties(); + changedProperties += _skybox.getChangedProperties(); + changedProperties += _haze.getChangedProperties(); + changedProperties += _bloom.getChangedProperties(); + CHECK_PROPERTY_CHANGE(PROP_FLYING_ALLOWED, flyingAllowed); + CHECK_PROPERTY_CHANGE(PROP_GHOSTING_ALLOWED, ghostingAllowed); + CHECK_PROPERTY_CHANGE(PROP_FILTER_URL, filterURL); CHECK_PROPERTY_CHANGE(PROP_KEY_LIGHT_MODE, keyLightMode); CHECK_PROPERTY_CHANGE(PROP_AMBIENT_LIGHT_MODE, ambientLightMode); CHECK_PROPERTY_CHANGE(PROP_SKYBOX_MODE, skyboxMode); + CHECK_PROPERTY_CHANGE(PROP_HAZE_MODE, hazeMode); CHECK_PROPERTY_CHANGE(PROP_BLOOM_MODE, bloomMode); - CHECK_PROPERTY_CHANGE(PROP_SOURCE_URL, sourceUrl); + // Polyvox CHECK_PROPERTY_CHANGE(PROP_VOXEL_VOLUME_SIZE, voxelVolumeSize); CHECK_PROPERTY_CHANGE(PROP_VOXEL_DATA, voxelData); CHECK_PROPERTY_CHANGE(PROP_VOXEL_SURFACE_STYLE, voxelSurfaceStyle); - CHECK_PROPERTY_CHANGE(PROP_LINE_WIDTH, lineWidth); - CHECK_PROPERTY_CHANGE(PROP_LINE_POINTS, linePoints); - CHECK_PROPERTY_CHANGE(PROP_HREF, href); - CHECK_PROPERTY_CHANGE(PROP_DESCRIPTION, description); - CHECK_PROPERTY_CHANGE(PROP_BILLBOARD_MODE, billboardMode); - CHECK_PROPERTY_CHANGE(PROP_ACTION_DATA, actionData); - CHECK_PROPERTY_CHANGE(PROP_NORMALS, normals); - CHECK_PROPERTY_CHANGE(PROP_STROKE_COLORS, strokeColors); - CHECK_PROPERTY_CHANGE(PROP_STROKE_WIDTHS, strokeWidths); - CHECK_PROPERTY_CHANGE(PROP_IS_UV_MODE_STRETCH, isUVModeStretch); CHECK_PROPERTY_CHANGE(PROP_X_TEXTURE_URL, xTextureURL); CHECK_PROPERTY_CHANGE(PROP_Y_TEXTURE_URL, yTextureURL); CHECK_PROPERTY_CHANGE(PROP_Z_TEXTURE_URL, zTextureURL); @@ -487,44 +516,42 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const { CHECK_PROPERTY_CHANGE(PROP_X_P_NEIGHBOR_ID, xPNeighborID); CHECK_PROPERTY_CHANGE(PROP_Y_P_NEIGHBOR_ID, yPNeighborID); CHECK_PROPERTY_CHANGE(PROP_Z_P_NEIGHBOR_ID, zPNeighborID); - CHECK_PROPERTY_CHANGE(PROP_PARENT_ID, parentID); - CHECK_PROPERTY_CHANGE(PROP_PARENT_JOINT_INDEX, parentJointIndex); - CHECK_PROPERTY_CHANGE(PROP_JOINT_ROTATIONS_SET, jointRotationsSet); - CHECK_PROPERTY_CHANGE(PROP_JOINT_ROTATIONS, jointRotations); - CHECK_PROPERTY_CHANGE(PROP_JOINT_TRANSLATIONS_SET, jointTranslationsSet); - CHECK_PROPERTY_CHANGE(PROP_JOINT_TRANSLATIONS, jointTranslations); - CHECK_PROPERTY_CHANGE(PROP_QUERY_AA_CUBE, queryAACube); - CHECK_PROPERTY_CHANGE(PROP_LOCAL_POSITION, localPosition); - CHECK_PROPERTY_CHANGE(PROP_LOCAL_ROTATION, localRotation); - CHECK_PROPERTY_CHANGE(PROP_LOCAL_VELOCITY, localVelocity); - CHECK_PROPERTY_CHANGE(PROP_LOCAL_ANGULAR_VELOCITY, localAngularVelocity); - CHECK_PROPERTY_CHANGE(PROP_LOCAL_DIMENSIONS, localDimensions); - CHECK_PROPERTY_CHANGE(PROP_FLYING_ALLOWED, flyingAllowed); - CHECK_PROPERTY_CHANGE(PROP_GHOSTING_ALLOWED, ghostingAllowed); - CHECK_PROPERTY_CHANGE(PROP_FILTER_URL, filterURL); - - CHECK_PROPERTY_CHANGE(PROP_ENTITY_HOST_TYPE, entityHostType); - CHECK_PROPERTY_CHANGE(PROP_OWNING_AVATAR_ID, owningAvatarID); - - CHECK_PROPERTY_CHANGE(PROP_SHAPE, shape); + // Web + CHECK_PROPERTY_CHANGE(PROP_SOURCE_URL, sourceUrl); CHECK_PROPERTY_CHANGE(PROP_DPI, dpi); - CHECK_PROPERTY_CHANGE(PROP_RELAY_PARENT_JOINTS, relayParentJoints); - CHECK_PROPERTY_CHANGE(PROP_CLONEABLE, cloneable); - CHECK_PROPERTY_CHANGE(PROP_CLONE_LIFETIME, cloneLifetime); - CHECK_PROPERTY_CHANGE(PROP_CLONE_LIMIT, cloneLimit); - CHECK_PROPERTY_CHANGE(PROP_CLONE_DYNAMIC, cloneDynamic); - CHECK_PROPERTY_CHANGE(PROP_CLONE_AVATAR_ENTITY, cloneAvatarEntity); - CHECK_PROPERTY_CHANGE(PROP_CLONE_ORIGIN_ID, cloneOriginID); + // Polyline + CHECK_PROPERTY_CHANGE(PROP_LINE_POINTS, linePoints); + CHECK_PROPERTY_CHANGE(PROP_STROKE_WIDTHS, strokeWidths); + CHECK_PROPERTY_CHANGE(PROP_STROKE_NORMALS, normals); + CHECK_PROPERTY_CHANGE(PROP_STROKE_COLORS, strokeColors); + CHECK_PROPERTY_CHANGE(PROP_IS_UV_MODE_STRETCH, isUVModeStretch); - changedProperties += _animation.getChangedProperties(); - changedProperties += _keyLight.getChangedProperties(); - changedProperties += _ambientLight.getChangedProperties(); - changedProperties += _skybox.getChangedProperties(); - changedProperties += _haze.getChangedProperties(); - changedProperties += _bloom.getChangedProperties(); - changedProperties += _grab.getChangedProperties(); + // Shape + CHECK_PROPERTY_CHANGE(PROP_SHAPE, shape); + + // Material + CHECK_PROPERTY_CHANGE(PROP_MATERIAL_URL, materialURL); + CHECK_PROPERTY_CHANGE(PROP_MATERIAL_MAPPING_MODE, materialMappingMode); + CHECK_PROPERTY_CHANGE(PROP_MATERIAL_PRIORITY, priority); + CHECK_PROPERTY_CHANGE(PROP_PARENT_MATERIAL_NAME, parentMaterialName); + CHECK_PROPERTY_CHANGE(PROP_MATERIAL_MAPPING_POS, materialMappingPos); + CHECK_PROPERTY_CHANGE(PROP_MATERIAL_MAPPING_SCALE, materialMappingScale); + CHECK_PROPERTY_CHANGE(PROP_MATERIAL_MAPPING_ROT, materialMappingRot); + CHECK_PROPERTY_CHANGE(PROP_MATERIAL_DATA, materialData); + CHECK_PROPERTY_CHANGE(PROP_MATERIAL_REPEAT, materialRepeat); + + // Image + CHECK_PROPERTY_CHANGE(PROP_IMAGE_URL, imageURL); + CHECK_PROPERTY_CHANGE(PROP_EMISSIVE, emissive); + CHECK_PROPERTY_CHANGE(PROP_KEEP_ASPECT_RATIO, keepAspectRatio); + CHECK_PROPERTY_CHANGE(PROP_SUB_IMAGE, subImage); + + // Grid + CHECK_PROPERTY_CHANGE(PROP_GRID_FOLLOW_CAMERA, followCamera); + CHECK_PROPERTY_CHANGE(PROP_MAJOR_GRID_EVERY, majorGridEvery); + CHECK_PROPERTY_CHANGE(PROP_MINOR_GRID_EVERY, minorGridEvery); return changedProperties; } @@ -619,16 +646,14 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const { * mass in the application of physics. * * @property {boolean} collisionless=false - Whether or not the entity should collide with items per its - * collisionMask property. If true then the entity does not collide. - * @property {boolean} ignoreForCollisions=false - Synonym for collisionless. + * collisionMask property. If true then the entity does not collide. A synonym is ignoreForCollisions. * @property {Entities.CollisionMask} collisionMask=31 - What types of items the entity should collide with. * @property {string} collidesWith="static,dynamic,kinematic,myAvatar,otherAvatar," - Synonym for collisionMask, * in text format. * @property {string} collisionSoundURL="" - The sound to play when the entity experiences a collision. Valid file formats are * as per the {@link SoundCache} object. * @property {boolean} dynamic=false - Whether or not the entity should be affected by collisions. If true then - * the entity's movement is affected by collisions. - * @property {boolean} collisionsWillMove=false - Synonym for dynamic. + * the entity's movement is affected by collisions. A synonym is collisionsWillMove. * * @property {string} href="" - A "hifi://" metaverse address that a user is taken to when they click on the entity. * @property {string} description="" - A description of the href property value. @@ -674,8 +699,7 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const { * is typically not used in scripts directly; rather, functions that manipulate an entity's actions update it. * The size of this property increases with the number of actions. Because this property value has to fit within a High * Fidelity datagram packet there is a limit to the number of actions that an entity can have, and edits which would result - * in overflow are rejected. - * Read-only. + * in overflow are rejected. Read-only. * @property {Entities.RenderInfo} renderInfo - Information on the cost of rendering the entity. Currently information is only * provided for Model entities. Read-only. * @@ -762,16 +786,15 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const { */ /**jsdoc - * The "Line" {@link Entities.EntityType|EntityType} draws thin, straight lines between a sequence of two or more - * points. + * The "Line" {@link Entities.EntityType|EntityType} draws thin, straight lines between a sequence of two or more + * points. Deprecated: Use PolyLines instead. * It has properties in addition to the common {@link Entities.EntityProperties|EntityProperties}. * @typedef {object} Entities.EntityProperties-Line - * @property {Vec3} dimensions=0.1,0.1,0.1 - The dimensions of the entity. Must be sufficient to contain all the + * @property {Vec3} dimensions=0.1,0.1,0.1 - The dimensions of the entity. Must be sufficient to contain all the * linePoints. * @property {Vec3[]} linePoints=[]] - The sequence of points to draw lines between. The values are relative to the entity's - * position. A maximum of 70 points can be specified. The property's value is set only if all the linePoints + * position. A maximum of 70 points can be specified. The property's value is set only if all the linePoints * lie within the entity's dimensions. - * @property {number} lineWidth=2 - Currently not used. * @property {Color} color=255,255,255 - The color of the line. * @example Draw lines in a "V". * var entity = Entities.addEntity({ @@ -872,22 +895,22 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const { * * @property {Entities.AnimationProperties} animation - An animation to play on the model. * - * @property {Quat[]} jointRotations=[]] - Joint rotations applied to the model; [] if none are applied or the + * @property {Quat[]} jointRotations=[] - Joint rotations applied to the model; [] if none are applied or the * model hasn't loaded. The array indexes are per {@link Entities.getJointIndex|getJointIndex}. Rotations are relative to * each joint's parent.
* Joint rotations can be set by {@link Entities.setLocalJointRotation|setLocalJointRotation} and similar functions, or by * setting the value of this property. If you set a joint rotation using this property you also need to set the * corresponding jointRotationsSet value to true. - * @property {boolean[]} jointRotationsSet=[]] - true values for joints that have had rotations applied, + * @property {boolean[]} jointRotationsSet=[] - true values for joints that have had rotations applied, * false otherwise; [] if none are applied or the model hasn't loaded. The array indexes are per * {@link Entities.getJointIndex|getJointIndex}. - * @property {Vec3[]} jointTranslations=[]] - Joint translations applied to the model; [] if none are applied or + * @property {Vec3[]} jointTranslations=[] - Joint translations applied to the model; [] if none are applied or * the model hasn't loaded. The array indexes are per {@link Entities.getJointIndex|getJointIndex}. Rotations are relative * to each joint's parent.
* Joint translations can be set by {@link Entities.setLocalJointTranslation|setLocalJointTranslation} and similar * functions, or by setting the value of this property. If you set a joint translation using this property you also need to * set the corresponding jointTranslationsSet value to true. - * @property {boolean[]} jointTranslationsSet=[]] - true values for joints that have had translations applied, + * @property {boolean[]} jointTranslationsSet=[] - true values for joints that have had translations applied, * false otherwise; [] if none are applied or the model hasn't loaded. The array indexes are per * {@link Entities.getJointIndex|getJointIndex}. * @property {boolean} relayParentJoints=false - If true and the entity is parented to an avatar, then the @@ -1015,16 +1038,15 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const { * @typedef {object} Entities.EntityProperties-PolyLine * @property {Vec3} dimensions=1,1,1 - The dimensions of the entity, i.e., the size of the bounding box that contains the * lines drawn. - * @property {Vec3[]} linePoints=[]] - The sequence of points to draw lines between. The values are relative to the entity's + * @property {Vec3[]} linePoints=[] - The sequence of points to draw lines between. The values are relative to the entity's * position. A maximum of 70 points can be specified. Must be specified in order for the entity to render. - * @property {Vec3[]} normals=[]] - The normal vectors for the line's surface at the linePoints. The values are + * @property {Vec3[]} normals=[] - The normal vectors for the line's surface at the linePoints. The values are * relative to the entity's orientation. Must be specified in order for the entity to render. - * @property {number[]} strokeWidths=[]] - The widths, in m, of the line at the linePoints. Must be specified in + * @property {number[]} strokeWidths=[] - The widths, in m, of the line at the linePoints. Must be specified in * order for the entity to render. - * @property {number} lineWidth=2 - Currently not used.
- * @property {Vec3[]} strokeColors=[]] - Currently not used. - * @property {Color} color=255,255,255 - The base color of the line, which is multiplied with the color of the texture for - * rendering. + * @property {Vec3[]} strokeColors=[] - The base colors of each point, which are multiplied with the color of the texture, going from 0-1. + * If strokeColors.length < the number of points, color is used for the remaining points. + * @property {Color} color=255,255,255 - Used as the color for each point if strokeColors is too short. * @property {string} textures="" - The URL of a JPG or PNG texture to use for the lines. If you want transparency, use PNG * format. * @property {boolean} isUVModeStretch=true - If true, the texture is stretched to fill the whole line, otherwise @@ -1141,11 +1163,17 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const { * created using \n. Overflowing lines are not displayed. * @property {number} lineHeight=0.1 - The height of each line of text (thus determining the font size). * @property {Color} textColor=255,255,255 - The color of the text. + * @property {number} textAlpha=1.0 - The text alpha. * @property {Color} backgroundColor=0,0,0 - The color of the background rectangle. + * @property {number} backgroundAlpha=1.0 - The background alpha. * @property {BillboardMode} billboardMode="none" - If "none", the entity is not billboarded. If "yaw", the entity will be * oriented to follow your camera around the y-axis. If "full" the entity will be oriented to face your camera. The following deprecated * behavior is also supported: you can also set "faceCamera" to true to set billboardMode to "yaw", and you can set * "isFacingAvatar" to true to set billboardMode to "full". Setting either to false sets the mode to "none" + * @property {number} leftMargin=0.0 - The left margin, in meters. + * @property {number} rightMargin=0.0 - The right margin, in meters. + * @property {number} topMargin=0.0 - The top margin, in meters. + * @property {number} bottomMargin=0.0 - The bottom margin, in meters. * @example Create a text entity. * var text = Entities.addEntity({ * type: "Text", @@ -1344,7 +1372,6 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool created.setTimeSpec(Qt::OffsetFromUTC); COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER_ALWAYS(created, created.toString(Qt::ISODate)); } - if ((!skipDefaults || _lifetime != defaultEntityProperties._lifetime) && !strictSemantics) { if (!psuedoPropertyFlagsActive || psueudoPropertyFlags.test(EntityPsuedoPropertyFlag::Age)) { COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER_NO_SKIP(age, getAge()); // gettable, but not settable @@ -1353,46 +1380,69 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER_NO_SKIP(ageAsText, formatSecondsElapsed(getAge())); // gettable, but not settable } } - if (!psuedoPropertyFlagsActive || psueudoPropertyFlags.test(EntityPsuedoPropertyFlag::LastEdited)) { properties.setProperty("lastEdited", convertScriptValue(engine, _lastEdited)); } - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LAST_EDITED_BY, lastEditedBy); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_POSITION, position); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_DIMENSIONS, dimensions); if (!skipDefaults) { COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_DIMENSIONS, naturalDimensions); // gettable, but not settable COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_POSITION, naturalPosition); } + + // Core properties + //COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_SIMULATION_OWNER, simulationOwner); // not exposed yet + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_VISIBLE, visible); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_NAME, name); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LOCKED, locked); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_USER_DATA, userData); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_HREF, href); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_DESCRIPTION, description); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_POSITION, position); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_DIMENSIONS, dimensions); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_ROTATION, rotation); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_REGISTRATION_POINT, registrationPoint); + //COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_CREATED, created); // handled above + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LAST_EDITED_BY, lastEditedBy); + COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_ENTITY_HOST_TYPE, entityHostType, getEntityHostTypeAsString()); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_OWNING_AVATAR_ID, owningAvatarID); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_PARENT_ID, parentID); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_PARENT_JOINT_INDEX, parentJointIndex); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_QUERY_AA_CUBE, queryAACube); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_CAN_CAST_SHADOW, canCastShadow); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_VISIBLE_IN_SECONDARY_CAMERA, isVisibleInSecondaryCamera); + _grab.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties); + + // Physics + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_DENSITY, density); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_VELOCITY, velocity); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_ANGULAR_VELOCITY, angularVelocity); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_GRAVITY, gravity); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_ACCELERATION, acceleration); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_DAMPING, damping); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_ANGULAR_DAMPING, angularDamping); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_RESTITUTION, restitution); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_FRICTION, friction); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_DENSITY, density); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LIFETIME, lifetime); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_SCRIPT, script); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_SCRIPT_TIMESTAMP, scriptTimestamp); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_SERVER_SCRIPTS, serverScripts); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_REGISTRATION_POINT, registrationPoint); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_ANGULAR_VELOCITY, angularVelocity); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_ANGULAR_DAMPING, angularDamping); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_VISIBLE, visible); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_CAN_CAST_SHADOW, canCastShadow); // Relevant to Shape and Model entities only. COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_COLLISIONLESS, collisionless); COPY_PROXY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_COLLISIONLESS, collisionless, ignoreForCollisions, getCollisionless()); // legacy support COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_COLLISION_MASK, collisionMask); COPY_PROXY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_COLLISION_MASK, collisionMask, collidesWith, getCollisionMaskAsString()); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_DYNAMIC, dynamic); COPY_PROXY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_DYNAMIC, dynamic, collisionsWillMove, getDynamic()); // legacy support - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_HREF, href); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_DESCRIPTION, description); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_COLLISION_SOUND_URL, collisionSoundURL); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_ACTION_DATA, actionData); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LOCKED, locked); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_USER_DATA, userData); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_VISIBLE_IN_SECONDARY_CAMERA, isVisibleInSecondaryCamera); + + // Cloning + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_CLONEABLE, cloneable); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_CLONE_LIFETIME, cloneLifetime); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_CLONE_LIMIT, cloneLimit); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_CLONE_DYNAMIC, cloneDynamic); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_CLONE_AVATAR_ENTITY, cloneAvatarEntity); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_CLONE_ORIGIN_ID, cloneOriginID); + + // Scripts + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_SCRIPT, script); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_SCRIPT_TIMESTAMP, scriptTimestamp); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_SERVER_SCRIPTS, serverScripts); // Certifiable Properties COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_ITEM_NAME, itemName); @@ -1407,12 +1457,20 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_CERTIFICATE_ID, certificateID); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_STATIC_CERTIFICATE_VERSION, staticCertificateVersion); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_NAME, name); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_COLLISION_SOUND_URL, collisionSoundURL); + // Local props for scripts + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LOCAL_POSITION, localPosition); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LOCAL_ROTATION, localRotation); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LOCAL_VELOCITY, localVelocity); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LOCAL_ANGULAR_VELOCITY, localAngularVelocity); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LOCAL_DIMENSIONS, localDimensions); // Particles only if (_type == EntityTypes::ParticleEffect) { COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_SHAPE_TYPE, shapeType, getShapeTypeAsString()); + COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_COLOR, color, u8vec3Color); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_ALPHA, alpha); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_TEXTURES, textures); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_MAX_PARTICLES, maxParticles); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LIFESPAN, lifespan); @@ -1437,17 +1495,14 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_RADIUS_START, radiusStart); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_RADIUS_FINISH, radiusFinish); - COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_COLOR, color, u8vec3Color); COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_COLOR_SPREAD, colorSpread, u8vec3Color); COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_COLOR_START, colorStart, vec3Color); COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_COLOR_FINISH, colorFinish, vec3Color); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_ALPHA, alpha); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_ALPHA_SPREAD, alphaSpread); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_ALPHA_START, alphaStart); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_ALPHA_FINISH, alphaFinish); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_TEXTURES, textures); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_EMITTER_SHOULD_TRAIL, emitterShouldTrail); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_PARTICLE_SPIN, particleSpin); @@ -1459,11 +1514,12 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool // Models only if (_type == EntityTypes::Model) { - COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_COLOR, color, u8vec3Color); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_MODEL_URL, modelURL); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_COMPOUND_SHAPE_URL, compoundShapeURL); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_TEXTURES, textures); COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_SHAPE_TYPE, shapeType, getShapeTypeAsString()); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_COMPOUND_SHAPE_URL, compoundShapeURL); + COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_COLOR, color, u8vec3Color); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_TEXTURES, textures); + + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_MODEL_URL, modelURL); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_JOINT_ROTATIONS_SET, jointRotationsSet); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_JOINT_ROTATIONS, jointRotations); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_JOINT_TRANSLATIONS_SET, jointTranslationsSet); @@ -1483,15 +1539,15 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool } if (_type == EntityTypes::Box || _type == EntityTypes::Sphere || _type == EntityTypes::Shape) { - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_SHAPE, shape); COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_COLOR, color, u8vec3Color); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_ALPHA, alpha); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_SHAPE, shape); } // Lights only if (_type == EntityTypes::Light) { - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_IS_SPOTLIGHT, isSpotlight); COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_COLOR, color, u8vec3Color); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_IS_SPOTLIGHT, isSpotlight); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_INTENSITY, intensity); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_EXPONENT, exponent); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_CUTOFF, cutoff); @@ -1503,12 +1559,21 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_TEXT, text); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LINE_HEIGHT, lineHeight); COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER_TYPED(PROP_TEXT_COLOR, textColor, getTextColor(), u8vec3Color); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_TEXT_ALPHA, textAlpha); COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER_TYPED(PROP_BACKGROUND_COLOR, backgroundColor, getBackgroundColor(), u8vec3Color); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_BACKGROUND_ALPHA, backgroundAlpha); COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_BILLBOARD_MODE, billboardMode, getBillboardModeAsString()); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LEFT_MARGIN, leftMargin); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_RIGHT_MARGIN, rightMargin); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_TOP_MARGIN, topMargin); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_BOTTOM_MARGIN, bottomMargin); } // Zones only if (_type == EntityTypes::Zone) { + COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_SHAPE_TYPE, shapeType, getShapeTypeAsString()); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_COMPOUND_SHAPE_URL, compoundShapeURL); + if (!psuedoPropertyFlagsButDesiredEmpty) { _keyLight.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties); _ambientLight.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties); @@ -1516,8 +1581,6 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool _haze.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties); _bloom.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties); } - COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_SHAPE_TYPE, shapeType, getShapeTypeAsString()); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_COMPOUND_SHAPE_URL, compoundShapeURL); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_FLYING_ALLOWED, flyingAllowed); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_GHOSTING_ALLOWED, ghostingAllowed); @@ -1554,22 +1617,22 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_Z_P_NEIGHBOR_ID, zPNeighborID); } - // Lines & PolyLines + // Lines if (_type == EntityTypes::Line) { COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_COLOR, color, u8vec3Color); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LINE_WIDTH, lineWidth); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LINE_POINTS, linePoints); } + // Polylines if (_type == EntityTypes::PolyLine) { COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_COLOR, color, u8vec3Color); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LINE_WIDTH, lineWidth); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LINE_POINTS, linePoints); - - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_NORMALS, normals); - COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_STROKE_COLORS, strokeColors, qVectorVec3Color); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_STROKE_WIDTHS, strokeWidths); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_TEXTURES, textures); + + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LINE_POINTS, linePoints); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_STROKE_WIDTHS, strokeWidths); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_STROKE_NORMALS, normals); + COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_STROKE_COLORS, strokeColors, qVectorVec3Color); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_IS_UV_MODE_STRETCH, isUVModeStretch); } @@ -1588,15 +1651,15 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool // Image only if (_type == EntityTypes::Image) { + COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_COLOR, color, u8vec3Color); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_ALPHA, alpha); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_IMAGE_URL, imageURL); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_EMISSIVE, emissive); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_KEEP_ASPECT_RATIO, keepAspectRatio); COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_BILLBOARD_MODE, billboardMode, getBillboardModeAsString()); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_SUB_IMAGE, subImage); - COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_COLOR, color, u8vec3Color); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_ALPHA, alpha); - // Handle conversions to old 'textures' property from "imageURL" if (((!psuedoPropertyFlagsButDesiredEmpty && _desiredProperties.isEmpty()) || _desiredProperties.getHasProperty(PROP_IMAGE_URL)) && (!skipDefaults || defaultEntityProperties._imageURL != _imageURL)) { @@ -1645,29 +1708,6 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER_NO_SKIP(originalTextures, textureNamesStr); // gettable, but not settable } - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_PARENT_ID, parentID); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_PARENT_JOINT_INDEX, parentJointIndex); - - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_QUERY_AA_CUBE, queryAACube); - - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LOCAL_POSITION, localPosition); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LOCAL_ROTATION, localRotation); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LOCAL_VELOCITY, localVelocity); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LOCAL_ANGULAR_VELOCITY, localAngularVelocity); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LOCAL_DIMENSIONS, localDimensions); - - COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_ENTITY_HOST_TYPE, entityHostType, getEntityHostTypeAsString()); // Gettable but not settable except at entity creation - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_OWNING_AVATAR_ID, owningAvatarID); // Gettable but not settable - - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_CLONEABLE, cloneable); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_CLONE_LIFETIME, cloneLifetime); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_CLONE_LIMIT, cloneLimit); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_CLONE_DYNAMIC, cloneDynamic); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_CLONE_AVATAR_ENTITY, cloneAvatarEntity); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_CLONE_ORIGIN_ID, cloneOriginID); - - _grab.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties); - // Rendering info if (!skipDefaults && !strictSemantics && (!psuedoPropertyFlagsActive || psueudoPropertyFlags.test(EntityPsuedoPropertyFlag::RenderInfo))) { @@ -1713,9 +1753,6 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool properties.setProperty("isFacingAvatar", convertScriptValue(engine, getBillboardMode() == BillboardMode::FULL)); } - // FIXME - I don't think these properties are supported any more - //COPY_PROPERTY_TO_QSCRIPTVALUE(localRenderAlpha); - return properties; } @@ -1725,57 +1762,100 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object, bool setType(typeScriptValue.toVariant().toString()); } - COPY_PROPERTY_FROM_QSCRIPTVALUE(lastEditedBy, QUuid, setLastEditedBy); + if (!honorReadOnly) { + // this is used by the json reader to set things that we don't want javascript to able to affect. + COPY_PROPERTY_FROM_QSCRIPTVALUE_GETTER(created, QDateTime, setCreated, [this]() { + auto result = QDateTime::fromMSecsSinceEpoch(_created / 1000, Qt::UTC); // usec per msec + return result; + }); + // TODO: expose this to QScriptValue for JSON saves? + //COPY_PROPERTY_FROM_QSCRIPTVALUE(simulationOwner, ???, setSimulatorPriority); + } + + // Core + // simluationOwner above + COPY_PROPERTY_FROM_QSCRIPTVALUE(visible, bool, setVisible); + COPY_PROPERTY_FROM_QSCRIPTVALUE(name, QString, setName); + COPY_PROPERTY_FROM_QSCRIPTVALUE(locked, bool, setLocked); + COPY_PROPERTY_FROM_QSCRIPTVALUE(userData, QString, setUserData); + COPY_PROPERTY_FROM_QSCRIPTVALUE(href, QString, setHref); + COPY_PROPERTY_FROM_QSCRIPTVALUE(description, QString, setDescription); COPY_PROPERTY_FROM_QSCRIPTVALUE(position, vec3, setPosition); COPY_PROPERTY_FROM_QSCRIPTVALUE(dimensions, vec3, setDimensions); COPY_PROPERTY_FROM_QSCRIPTVALUE(rotation, quat, setRotation); + COPY_PROPERTY_FROM_QSCRIPTVALUE(registrationPoint, vec3, setRegistrationPoint); + // created is read only + COPY_PROPERTY_FROM_QSCRIPTVALUE(lastEditedBy, QUuid, setLastEditedBy); + COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(entityHostType, EntityHostType); + COPY_PROPERTY_FROM_QSCRIPTVALUE(owningAvatarID, QUuid, setOwningAvatarID); + COPY_PROPERTY_FROM_QSCRIPTVALUE(parentID, QUuid, setParentID); + COPY_PROPERTY_FROM_QSCRIPTVALUE(parentJointIndex, quint16, setParentJointIndex); + COPY_PROPERTY_FROM_QSCRIPTVALUE(queryAACube, AACube, setQueryAACube); // TODO: should scripts be able to set this? + COPY_PROPERTY_FROM_QSCRIPTVALUE(canCastShadow, bool, setCanCastShadow); + COPY_PROPERTY_FROM_QSCRIPTVALUE(isVisibleInSecondaryCamera, bool, setIsVisibleInSecondaryCamera); + _grab.copyFromScriptValue(object, _defaultSettings); + + // Physics COPY_PROPERTY_FROM_QSCRIPTVALUE(density, float, setDensity); COPY_PROPERTY_FROM_QSCRIPTVALUE(velocity, vec3, setVelocity); + COPY_PROPERTY_FROM_QSCRIPTVALUE(angularVelocity, vec3, setAngularVelocity); COPY_PROPERTY_FROM_QSCRIPTVALUE(gravity, vec3, setGravity); COPY_PROPERTY_FROM_QSCRIPTVALUE(acceleration, vec3, setAcceleration); COPY_PROPERTY_FROM_QSCRIPTVALUE(damping, float, setDamping); + COPY_PROPERTY_FROM_QSCRIPTVALUE(angularDamping, float, setAngularDamping); COPY_PROPERTY_FROM_QSCRIPTVALUE(restitution, float, setRestitution); COPY_PROPERTY_FROM_QSCRIPTVALUE(friction, float, setFriction); COPY_PROPERTY_FROM_QSCRIPTVALUE(lifetime, float, setLifetime); - COPY_PROPERTY_FROM_QSCRIPTVALUE(script, QString, setScript); - COPY_PROPERTY_FROM_QSCRIPTVALUE(scriptTimestamp, quint64, setScriptTimestamp); - COPY_PROPERTY_FROM_QSCRIPTVALUE(serverScripts, QString, setServerScripts); - COPY_PROPERTY_FROM_QSCRIPTVALUE(registrationPoint, vec3, setRegistrationPoint); - COPY_PROPERTY_FROM_QSCRIPTVALUE(angularVelocity, vec3, setAngularVelocity); - COPY_PROPERTY_FROM_QSCRIPTVALUE(angularDamping, float, setAngularDamping); - COPY_PROPERTY_FROM_QSCRIPTVALUE(visible, bool, setVisible); - COPY_PROPERTY_FROM_QSCRIPTVALUE(canCastShadow, bool, setCanCastShadow); - COPY_PROPERTY_FROM_QSCRIPTVALUE(color, u8vec3Color, setColor); - COPY_PROPERTY_FROM_QSCRIPTVALUE(colorSpread, u8vec3Color, setColorSpread); - COPY_PROPERTY_FROM_QSCRIPTVALUE(colorStart, vec3Color, setColorStart); - COPY_PROPERTY_FROM_QSCRIPTVALUE(colorFinish, vec3Color, setColorFinish); - COPY_PROPERTY_FROM_QSCRIPTVALUE(alpha, float, setAlpha); - COPY_PROPERTY_FROM_QSCRIPTVALUE(alphaSpread, float, setAlphaSpread); - COPY_PROPERTY_FROM_QSCRIPTVALUE(alphaStart, float, setAlphaStart); - COPY_PROPERTY_FROM_QSCRIPTVALUE(alphaFinish, float, setAlphaFinish); - COPY_PROPERTY_FROM_QSCRIPTVALUE(emitterShouldTrail, bool, setEmitterShouldTrail); - COPY_PROPERTY_FROM_QSCRIPTVALUE(modelURL, QString, setModelURL); - COPY_PROPERTY_FROM_QSCRIPTVALUE(compoundShapeURL, QString, setCompoundShapeURL); - COPY_PROPERTY_FROM_QSCRIPTVALUE(localRenderAlpha, float, setLocalRenderAlpha); COPY_PROPERTY_FROM_QSCRIPTVALUE(collisionless, bool, setCollisionless); COPY_PROPERTY_FROM_QSCRIPTVALUE_GETTER(ignoreForCollisions, bool, setCollisionless, getCollisionless); // legacy support COPY_PROPERTY_FROM_QSCRIPTVALUE(collisionMask, uint16_t, setCollisionMask); COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(collidesWith, CollisionMask); COPY_PROPERTY_FROM_QSCRIPTVALUE_GETTER(collisionsWillMove, bool, setDynamic, getDynamic); // legacy support COPY_PROPERTY_FROM_QSCRIPTVALUE(dynamic, bool, setDynamic); - COPY_PROPERTY_FROM_QSCRIPTVALUE(isSpotlight, bool, setIsSpotlight); - COPY_PROPERTY_FROM_QSCRIPTVALUE(intensity, float, setIntensity); - COPY_PROPERTY_FROM_QSCRIPTVALUE(falloffRadius, float, setFalloffRadius); - COPY_PROPERTY_FROM_QSCRIPTVALUE(exponent, float, setExponent); - COPY_PROPERTY_FROM_QSCRIPTVALUE(cutoff, float, setCutoff); - COPY_PROPERTY_FROM_QSCRIPTVALUE(locked, bool, setLocked); - COPY_PROPERTY_FROM_QSCRIPTVALUE(textures, QString, setTextures); - COPY_PROPERTY_FROM_QSCRIPTVALUE(userData, QString, setUserData); - COPY_PROPERTY_FROM_QSCRIPTVALUE(text, QString, setText); - COPY_PROPERTY_FROM_QSCRIPTVALUE(lineHeight, float, setLineHeight); - COPY_PROPERTY_FROM_QSCRIPTVALUE(textColor, u8vec3Color, setTextColor); - COPY_PROPERTY_FROM_QSCRIPTVALUE(backgroundColor, u8vec3Color, setBackgroundColor); + COPY_PROPERTY_FROM_QSCRIPTVALUE(collisionSoundURL, QString, setCollisionSoundURL); + COPY_PROPERTY_FROM_QSCRIPTVALUE(actionData, QByteArray, setActionData); // TODO: should scripts be able to set this? + + // Cloning + COPY_PROPERTY_FROM_QSCRIPTVALUE(cloneable, bool, setCloneable); + COPY_PROPERTY_FROM_QSCRIPTVALUE(cloneLifetime, float, setCloneLifetime); + COPY_PROPERTY_FROM_QSCRIPTVALUE(cloneLimit, float, setCloneLimit); + COPY_PROPERTY_FROM_QSCRIPTVALUE(cloneDynamic, bool, setCloneDynamic); + COPY_PROPERTY_FROM_QSCRIPTVALUE(cloneAvatarEntity, bool, setCloneAvatarEntity); + COPY_PROPERTY_FROM_QSCRIPTVALUE(cloneOriginID, QUuid, setCloneOriginID); + + // Scripts + COPY_PROPERTY_FROM_QSCRIPTVALUE(script, QString, setScript); + COPY_PROPERTY_FROM_QSCRIPTVALUE(scriptTimestamp, quint64, setScriptTimestamp); + COPY_PROPERTY_FROM_QSCRIPTVALUE(serverScripts, QString, setServerScripts); + + // Certifiable Properties + COPY_PROPERTY_FROM_QSCRIPTVALUE(itemName, QString, setItemName); + COPY_PROPERTY_FROM_QSCRIPTVALUE(itemDescription, QString, setItemDescription); + COPY_PROPERTY_FROM_QSCRIPTVALUE(itemCategories, QString, setItemCategories); + COPY_PROPERTY_FROM_QSCRIPTVALUE(itemArtist, QString, setItemArtist); + COPY_PROPERTY_FROM_QSCRIPTVALUE(itemLicense, QString, setItemLicense); + COPY_PROPERTY_FROM_QSCRIPTVALUE(limitedRun, quint32, setLimitedRun); + COPY_PROPERTY_FROM_QSCRIPTVALUE(marketplaceID, QString, setMarketplaceID); + COPY_PROPERTY_FROM_QSCRIPTVALUE(editionNumber, quint32, setEditionNumber); + COPY_PROPERTY_FROM_QSCRIPTVALUE(entityInstanceNumber, quint32, setEntityInstanceNumber); + COPY_PROPERTY_FROM_QSCRIPTVALUE(certificateID, QString, setCertificateID); + COPY_PROPERTY_FROM_QSCRIPTVALUE(staticCertificateVersion, quint32, setStaticCertificateVersion); + + // Script location data + COPY_PROPERTY_FROM_QSCRIPTVALUE(localPosition, vec3, setLocalPosition); + COPY_PROPERTY_FROM_QSCRIPTVALUE(localRotation, quat, setLocalRotation); + COPY_PROPERTY_FROM_QSCRIPTVALUE(localVelocity, vec3, setLocalVelocity); + COPY_PROPERTY_FROM_QSCRIPTVALUE(localAngularVelocity, vec3, setLocalAngularVelocity); + COPY_PROPERTY_FROM_QSCRIPTVALUE(localDimensions, vec3, setLocalDimensions); + + // Common COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(shapeType, ShapeType); + COPY_PROPERTY_FROM_QSCRIPTVALUE(compoundShapeURL, QString, setCompoundShapeURL); + COPY_PROPERTY_FROM_QSCRIPTVALUE(color, u8vec3Color, setColor); + COPY_PROPERTY_FROM_QSCRIPTVALUE(alpha, float, setAlpha); + COPY_PROPERTY_FROM_QSCRIPTVALUE(textures, QString, setTextures); + + // Particles COPY_PROPERTY_FROM_QSCRIPTVALUE(maxParticles, quint32, setMaxParticles); COPY_PROPERTY_FROM_QSCRIPTVALUE(lifespan, float, setLifespan); COPY_PROPERTY_FROM_QSCRIPTVALUE(isEmitting, bool, setIsEmitting); @@ -1795,7 +1875,92 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object, bool COPY_PROPERTY_FROM_QSCRIPTVALUE(radiusSpread, float, setRadiusSpread); COPY_PROPERTY_FROM_QSCRIPTVALUE(radiusStart, float, setRadiusStart); COPY_PROPERTY_FROM_QSCRIPTVALUE(radiusFinish, float, setRadiusFinish); + COPY_PROPERTY_FROM_QSCRIPTVALUE(colorSpread, u8vec3Color, setColorSpread); + COPY_PROPERTY_FROM_QSCRIPTVALUE(colorStart, vec3Color, setColorStart); + COPY_PROPERTY_FROM_QSCRIPTVALUE(colorFinish, vec3Color, setColorFinish); + COPY_PROPERTY_FROM_QSCRIPTVALUE(alphaSpread, float, setAlphaSpread); + COPY_PROPERTY_FROM_QSCRIPTVALUE(alphaStart, float, setAlphaStart); + COPY_PROPERTY_FROM_QSCRIPTVALUE(alphaFinish, float, setAlphaFinish); + COPY_PROPERTY_FROM_QSCRIPTVALUE(emitterShouldTrail, bool, setEmitterShouldTrail); + COPY_PROPERTY_FROM_QSCRIPTVALUE(particleSpin, float, setParticleSpin); + COPY_PROPERTY_FROM_QSCRIPTVALUE(spinSpread, float, setSpinSpread); + COPY_PROPERTY_FROM_QSCRIPTVALUE(spinStart, float, setSpinStart); + COPY_PROPERTY_FROM_QSCRIPTVALUE(spinFinish, float, setSpinFinish); + COPY_PROPERTY_FROM_QSCRIPTVALUE(rotateWithEntity, bool, setRotateWithEntity); + + // Model + COPY_PROPERTY_FROM_QSCRIPTVALUE(modelURL, QString, setModelURL); + COPY_PROPERTY_FROM_QSCRIPTVALUE(jointRotationsSet, qVectorBool, setJointRotationsSet); + COPY_PROPERTY_FROM_QSCRIPTVALUE(jointRotations, qVectorQuat, setJointRotations); + COPY_PROPERTY_FROM_QSCRIPTVALUE(jointTranslationsSet, qVectorBool, setJointTranslationsSet); + COPY_PROPERTY_FROM_QSCRIPTVALUE(jointTranslations, qVectorVec3, setJointTranslations); COPY_PROPERTY_FROM_QSCRIPTVALUE(relayParentJoints, bool, setRelayParentJoints); + _animation.copyFromScriptValue(object, _defaultSettings); + + // Light + COPY_PROPERTY_FROM_QSCRIPTVALUE(isSpotlight, bool, setIsSpotlight); + COPY_PROPERTY_FROM_QSCRIPTVALUE(intensity, float, setIntensity); + COPY_PROPERTY_FROM_QSCRIPTVALUE(exponent, float, setExponent); + COPY_PROPERTY_FROM_QSCRIPTVALUE(cutoff, float, setCutoff); + COPY_PROPERTY_FROM_QSCRIPTVALUE(falloffRadius, float, setFalloffRadius); + + // Text + COPY_PROPERTY_FROM_QSCRIPTVALUE(text, QString, setText); + COPY_PROPERTY_FROM_QSCRIPTVALUE(lineHeight, float, setLineHeight); + COPY_PROPERTY_FROM_QSCRIPTVALUE(textColor, u8vec3Color, setTextColor); + COPY_PROPERTY_FROM_QSCRIPTVALUE(textAlpha, float, setTextAlpha); + COPY_PROPERTY_FROM_QSCRIPTVALUE(backgroundColor, u8vec3Color, setBackgroundColor); + COPY_PROPERTY_FROM_QSCRIPTVALUE(backgroundAlpha, float, setBackgroundAlpha); + COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(billboardMode, BillboardMode); + COPY_PROPERTY_FROM_QSCRIPTVALUE(leftMargin, float, setLeftMargin); + COPY_PROPERTY_FROM_QSCRIPTVALUE(rightMargin, float, setRightMargin); + COPY_PROPERTY_FROM_QSCRIPTVALUE(topMargin, float, setTopMargin); + COPY_PROPERTY_FROM_QSCRIPTVALUE(bottomMargin, float, setBottomMargin); + + // Zone + _keyLight.copyFromScriptValue(object, _defaultSettings); + _ambientLight.copyFromScriptValue(object, _defaultSettings); + _skybox.copyFromScriptValue(object, _defaultSettings); + _haze.copyFromScriptValue(object, _defaultSettings); + _bloom.copyFromScriptValue(object, _defaultSettings); + COPY_PROPERTY_FROM_QSCRIPTVALUE(flyingAllowed, bool, setFlyingAllowed); + COPY_PROPERTY_FROM_QSCRIPTVALUE(ghostingAllowed, bool, setGhostingAllowed); + COPY_PROPERTY_FROM_QSCRIPTVALUE(filterURL, QString, setFilterURL); + COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(keyLightMode, KeyLightMode); + COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(ambientLightMode, AmbientLightMode); + COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(skyboxMode, SkyboxMode); + COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(hazeMode, HazeMode); + COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(bloomMode, BloomMode); + + // Polyvox + COPY_PROPERTY_FROM_QSCRIPTVALUE(voxelVolumeSize, vec3, setVoxelVolumeSize); + COPY_PROPERTY_FROM_QSCRIPTVALUE(voxelData, QByteArray, setVoxelData); + COPY_PROPERTY_FROM_QSCRIPTVALUE(voxelSurfaceStyle, uint16_t, setVoxelSurfaceStyle); + COPY_PROPERTY_FROM_QSCRIPTVALUE(xTextureURL, QString, setXTextureURL); + COPY_PROPERTY_FROM_QSCRIPTVALUE(yTextureURL, QString, setYTextureURL); + COPY_PROPERTY_FROM_QSCRIPTVALUE(zTextureURL, QString, setZTextureURL); + COPY_PROPERTY_FROM_QSCRIPTVALUE(xNNeighborID, EntityItemID, setXNNeighborID); + COPY_PROPERTY_FROM_QSCRIPTVALUE(yNNeighborID, EntityItemID, setYNNeighborID); + COPY_PROPERTY_FROM_QSCRIPTVALUE(zNNeighborID, EntityItemID, setZNNeighborID); + COPY_PROPERTY_FROM_QSCRIPTVALUE(xPNeighborID, EntityItemID, setXPNeighborID); + COPY_PROPERTY_FROM_QSCRIPTVALUE(yPNeighborID, EntityItemID, setYPNeighborID); + COPY_PROPERTY_FROM_QSCRIPTVALUE(zPNeighborID, EntityItemID, setZPNeighborID); + + // Web + COPY_PROPERTY_FROM_QSCRIPTVALUE(sourceUrl, QString, setSourceUrl); + COPY_PROPERTY_FROM_QSCRIPTVALUE(dpi, uint16_t, setDPI); + + // Polyline + COPY_PROPERTY_FROM_QSCRIPTVALUE(linePoints, qVectorVec3, setLinePoints); + COPY_PROPERTY_FROM_QSCRIPTVALUE(strokeWidths, qVectorFloat, setStrokeWidths); + COPY_PROPERTY_FROM_QSCRIPTVALUE(normals, qVectorVec3, setNormals); + COPY_PROPERTY_FROM_QSCRIPTVALUE(strokeColors, qVectorVec3, setStrokeColors); + COPY_PROPERTY_FROM_QSCRIPTVALUE(isUVModeStretch, bool, setIsUVModeStretch); + + // Shape + COPY_PROPERTY_FROM_QSCRIPTVALUE(shape, QString, setShape); + + // Material COPY_PROPERTY_FROM_QSCRIPTVALUE(materialURL, QString, setMaterialURL); COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(materialMappingMode, MaterialMappingMode); COPY_PROPERTY_FROM_QSCRIPTVALUE(priority, quint16, setPriority); @@ -1805,121 +1970,18 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object, bool COPY_PROPERTY_FROM_QSCRIPTVALUE(materialMappingRot, float, setMaterialMappingRot); COPY_PROPERTY_FROM_QSCRIPTVALUE(materialData, QString, setMaterialData); COPY_PROPERTY_FROM_QSCRIPTVALUE(materialRepeat, bool, setMaterialRepeat); - COPY_PROPERTY_FROM_QSCRIPTVALUE(isVisibleInSecondaryCamera, bool, setIsVisibleInSecondaryCamera); - COPY_PROPERTY_FROM_QSCRIPTVALUE(particleSpin, float, setParticleSpin); - COPY_PROPERTY_FROM_QSCRIPTVALUE(spinSpread, float, setSpinSpread); - COPY_PROPERTY_FROM_QSCRIPTVALUE(spinStart, float, setSpinStart); - COPY_PROPERTY_FROM_QSCRIPTVALUE(spinFinish, float, setSpinFinish); - COPY_PROPERTY_FROM_QSCRIPTVALUE(rotateWithEntity, bool, setRotateWithEntity); - - // Certifiable Properties - COPY_PROPERTY_FROM_QSCRIPTVALUE(itemName, QString, setItemName); - COPY_PROPERTY_FROM_QSCRIPTVALUE(itemDescription, QString, setItemDescription); - COPY_PROPERTY_FROM_QSCRIPTVALUE(itemCategories, QString, setItemCategories); - COPY_PROPERTY_FROM_QSCRIPTVALUE(itemArtist, QString, setItemArtist); - COPY_PROPERTY_FROM_QSCRIPTVALUE(itemLicense, QString, setItemLicense); - COPY_PROPERTY_FROM_QSCRIPTVALUE(limitedRun, quint32, setLimitedRun); - COPY_PROPERTY_FROM_QSCRIPTVALUE(marketplaceID, QString, setMarketplaceID); - COPY_PROPERTY_FROM_QSCRIPTVALUE(editionNumber, quint32, setEditionNumber); - COPY_PROPERTY_FROM_QSCRIPTVALUE(entityInstanceNumber, quint32, setEntityInstanceNumber); - COPY_PROPERTY_FROM_QSCRIPTVALUE(certificateID, QString, setCertificateID); - COPY_PROPERTY_FROM_QSCRIPTVALUE(staticCertificateVersion, quint32, setStaticCertificateVersion); - - COPY_PROPERTY_FROM_QSCRIPTVALUE(name, QString, setName); - COPY_PROPERTY_FROM_QSCRIPTVALUE(collisionSoundURL, QString, setCollisionSoundURL); - - COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(hazeMode, HazeMode); - COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(keyLightMode, KeyLightMode); - COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(ambientLightMode, AmbientLightMode); - COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(skyboxMode, SkyboxMode); - COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(bloomMode, BloomMode); - - COPY_PROPERTY_FROM_QSCRIPTVALUE(sourceUrl, QString, setSourceUrl); - COPY_PROPERTY_FROM_QSCRIPTVALUE(voxelVolumeSize, vec3, setVoxelVolumeSize); - COPY_PROPERTY_FROM_QSCRIPTVALUE(voxelData, QByteArray, setVoxelData); - COPY_PROPERTY_FROM_QSCRIPTVALUE(voxelSurfaceStyle, uint16_t, setVoxelSurfaceStyle); - COPY_PROPERTY_FROM_QSCRIPTVALUE(lineWidth, float, setLineWidth); - COPY_PROPERTY_FROM_QSCRIPTVALUE(linePoints, qVectorVec3, setLinePoints); - COPY_PROPERTY_FROM_QSCRIPTVALUE(href, QString, setHref); - COPY_PROPERTY_FROM_QSCRIPTVALUE(description, QString, setDescription); - COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(billboardMode, BillboardMode); - COPY_PROPERTY_FROM_QSCRIPTVALUE(actionData, QByteArray, setActionData); - COPY_PROPERTY_FROM_QSCRIPTVALUE(normals, qVectorVec3, setNormals); - COPY_PROPERTY_FROM_QSCRIPTVALUE(strokeColors, qVectorVec3, setStrokeColors); - COPY_PROPERTY_FROM_QSCRIPTVALUE(strokeWidths, qVectorFloat, setStrokeWidths); - COPY_PROPERTY_FROM_QSCRIPTVALUE(isUVModeStretch, bool, setIsUVModeStretch); + // Image COPY_PROPERTY_FROM_QSCRIPTVALUE(imageURL, QString, setImageURL); COPY_PROPERTY_FROM_QSCRIPTVALUE(emissive, bool, setEmissive); COPY_PROPERTY_FROM_QSCRIPTVALUE(keepAspectRatio, bool, setKeepAspectRatio); COPY_PROPERTY_FROM_QSCRIPTVALUE(subImage, QRect, setSubImage); + // Grid COPY_PROPERTY_FROM_QSCRIPTVALUE(followCamera, bool, setFollowCamera); COPY_PROPERTY_FROM_QSCRIPTVALUE(majorGridEvery, uint32_t, setMajorGridEvery); COPY_PROPERTY_FROM_QSCRIPTVALUE(minorGridEvery, float, setMinorGridEvery); - if (!honorReadOnly) { - // this is used by the json reader to set things that we don't want javascript to able to affect. - COPY_PROPERTY_FROM_QSCRIPTVALUE_GETTER(created, QDateTime, setCreated, [this]() { - auto result = QDateTime::fromMSecsSinceEpoch(_created / 1000, Qt::UTC); // usec per msec - return result; - }); - // TODO: expose this to QScriptValue for JSON saves? - //COPY_PROPERTY_FROM_QSCRIPTVALUE(simulationOwner, ???, setSimulatorPriority); - } - - _animation.copyFromScriptValue(object, _defaultSettings); - _keyLight.copyFromScriptValue(object, _defaultSettings); - _ambientLight.copyFromScriptValue(object, _defaultSettings); - _skybox.copyFromScriptValue(object, _defaultSettings); - _haze.copyFromScriptValue(object, _defaultSettings); - _bloom.copyFromScriptValue(object, _defaultSettings); - _grab.copyFromScriptValue(object, _defaultSettings); - - COPY_PROPERTY_FROM_QSCRIPTVALUE(xTextureURL, QString, setXTextureURL); - COPY_PROPERTY_FROM_QSCRIPTVALUE(yTextureURL, QString, setYTextureURL); - COPY_PROPERTY_FROM_QSCRIPTVALUE(zTextureURL, QString, setZTextureURL); - - COPY_PROPERTY_FROM_QSCRIPTVALUE(xNNeighborID, EntityItemID, setXNNeighborID); - COPY_PROPERTY_FROM_QSCRIPTVALUE(yNNeighborID, EntityItemID, setYNNeighborID); - COPY_PROPERTY_FROM_QSCRIPTVALUE(zNNeighborID, EntityItemID, setZNNeighborID); - - COPY_PROPERTY_FROM_QSCRIPTVALUE(xPNeighborID, EntityItemID, setXPNeighborID); - COPY_PROPERTY_FROM_QSCRIPTVALUE(yPNeighborID, EntityItemID, setYPNeighborID); - COPY_PROPERTY_FROM_QSCRIPTVALUE(zPNeighborID, EntityItemID, setZPNeighborID); - - COPY_PROPERTY_FROM_QSCRIPTVALUE(parentID, QUuid, setParentID); - COPY_PROPERTY_FROM_QSCRIPTVALUE(parentJointIndex, quint16, setParentJointIndex); - COPY_PROPERTY_FROM_QSCRIPTVALUE(queryAACube, AACube, setQueryAACube); - - COPY_PROPERTY_FROM_QSCRIPTVALUE(localPosition, vec3, setLocalPosition); - COPY_PROPERTY_FROM_QSCRIPTVALUE(localRotation, quat, setLocalRotation); - COPY_PROPERTY_FROM_QSCRIPTVALUE(localVelocity, vec3, setLocalVelocity); - COPY_PROPERTY_FROM_QSCRIPTVALUE(localAngularVelocity, vec3, setLocalAngularVelocity); - COPY_PROPERTY_FROM_QSCRIPTVALUE(localDimensions, vec3, setLocalDimensions); - - COPY_PROPERTY_FROM_QSCRIPTVALUE(jointRotationsSet, qVectorBool, setJointRotationsSet); - COPY_PROPERTY_FROM_QSCRIPTVALUE(jointRotations, qVectorQuat, setJointRotations); - COPY_PROPERTY_FROM_QSCRIPTVALUE(jointTranslationsSet, qVectorBool, setJointTranslationsSet); - COPY_PROPERTY_FROM_QSCRIPTVALUE(jointTranslations, qVectorVec3, setJointTranslations); - COPY_PROPERTY_FROM_QSCRIPTVALUE(shape, QString, setShape); - - COPY_PROPERTY_FROM_QSCRIPTVALUE(flyingAllowed, bool, setFlyingAllowed); - COPY_PROPERTY_FROM_QSCRIPTVALUE(ghostingAllowed, bool, setGhostingAllowed); - COPY_PROPERTY_FROM_QSCRIPTVALUE(filterURL, QString, setFilterURL); - - COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(entityHostType, EntityHostType); - COPY_PROPERTY_FROM_QSCRIPTVALUE(owningAvatarID, QUuid, setOwningAvatarID); - - COPY_PROPERTY_FROM_QSCRIPTVALUE(dpi, uint16_t, setDPI); - - COPY_PROPERTY_FROM_QSCRIPTVALUE(cloneable, bool, setCloneable); - COPY_PROPERTY_FROM_QSCRIPTVALUE(cloneLifetime, float, setCloneLifetime); - COPY_PROPERTY_FROM_QSCRIPTVALUE(cloneLimit, float, setCloneLimit); - COPY_PROPERTY_FROM_QSCRIPTVALUE(cloneDynamic, bool, setCloneDynamic); - COPY_PROPERTY_FROM_QSCRIPTVALUE(cloneAvatarEntity, bool, setCloneAvatarEntity); - COPY_PROPERTY_FROM_QSCRIPTVALUE(cloneOriginID, QUuid, setCloneOriginID); - // Handle conversions from old 'textures' property to "imageURL" { QScriptValue V = object.property("textures"); @@ -1965,53 +2027,87 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object, bool } void EntityItemProperties::merge(const EntityItemProperties& other) { - COPY_PROPERTY_IF_CHANGED(lastEditedBy); + // Core + COPY_PROPERTY_IF_CHANGED(simulationOwner); + COPY_PROPERTY_IF_CHANGED(visible); + COPY_PROPERTY_IF_CHANGED(name); + COPY_PROPERTY_IF_CHANGED(locked); + COPY_PROPERTY_IF_CHANGED(userData); + COPY_PROPERTY_IF_CHANGED(href); + COPY_PROPERTY_IF_CHANGED(description); COPY_PROPERTY_IF_CHANGED(position); COPY_PROPERTY_IF_CHANGED(dimensions); COPY_PROPERTY_IF_CHANGED(rotation); + COPY_PROPERTY_IF_CHANGED(registrationPoint); + COPY_PROPERTY_IF_CHANGED(created); + COPY_PROPERTY_IF_CHANGED(lastEditedBy); + COPY_PROPERTY_IF_CHANGED(entityHostType); + COPY_PROPERTY_IF_CHANGED(owningAvatarID); + COPY_PROPERTY_IF_CHANGED(parentID); + COPY_PROPERTY_IF_CHANGED(parentJointIndex); + COPY_PROPERTY_IF_CHANGED(queryAACube); + COPY_PROPERTY_IF_CHANGED(canCastShadow); + COPY_PROPERTY_IF_CHANGED(isVisibleInSecondaryCamera); + _grab.merge(other._grab); + + // Physics COPY_PROPERTY_IF_CHANGED(density); COPY_PROPERTY_IF_CHANGED(velocity); + COPY_PROPERTY_IF_CHANGED(angularVelocity); COPY_PROPERTY_IF_CHANGED(gravity); COPY_PROPERTY_IF_CHANGED(acceleration); COPY_PROPERTY_IF_CHANGED(damping); + COPY_PROPERTY_IF_CHANGED(angularDamping); COPY_PROPERTY_IF_CHANGED(restitution); COPY_PROPERTY_IF_CHANGED(friction); COPY_PROPERTY_IF_CHANGED(lifetime); - COPY_PROPERTY_IF_CHANGED(script); - COPY_PROPERTY_IF_CHANGED(scriptTimestamp); - COPY_PROPERTY_IF_CHANGED(registrationPoint); - COPY_PROPERTY_IF_CHANGED(angularVelocity); - COPY_PROPERTY_IF_CHANGED(angularDamping); - COPY_PROPERTY_IF_CHANGED(visible); - COPY_PROPERTY_IF_CHANGED(canCastShadow); - COPY_PROPERTY_IF_CHANGED(color); - COPY_PROPERTY_IF_CHANGED(colorSpread); - COPY_PROPERTY_IF_CHANGED(colorStart); - COPY_PROPERTY_IF_CHANGED(colorFinish); - COPY_PROPERTY_IF_CHANGED(alpha); - COPY_PROPERTY_IF_CHANGED(alphaSpread); - COPY_PROPERTY_IF_CHANGED(alphaStart); - COPY_PROPERTY_IF_CHANGED(alphaFinish); - COPY_PROPERTY_IF_CHANGED(emitterShouldTrail); - COPY_PROPERTY_IF_CHANGED(modelURL); - COPY_PROPERTY_IF_CHANGED(compoundShapeURL); - COPY_PROPERTY_IF_CHANGED(localRenderAlpha); COPY_PROPERTY_IF_CHANGED(collisionless); COPY_PROPERTY_IF_CHANGED(collisionMask); COPY_PROPERTY_IF_CHANGED(dynamic); - COPY_PROPERTY_IF_CHANGED(isSpotlight); - COPY_PROPERTY_IF_CHANGED(intensity); - COPY_PROPERTY_IF_CHANGED(falloffRadius); - COPY_PROPERTY_IF_CHANGED(exponent); - COPY_PROPERTY_IF_CHANGED(cutoff); - COPY_PROPERTY_IF_CHANGED(locked); - COPY_PROPERTY_IF_CHANGED(textures); - COPY_PROPERTY_IF_CHANGED(userData); - COPY_PROPERTY_IF_CHANGED(text); - COPY_PROPERTY_IF_CHANGED(lineHeight); - COPY_PROPERTY_IF_CHANGED(textColor); - COPY_PROPERTY_IF_CHANGED(backgroundColor); + COPY_PROPERTY_IF_CHANGED(collisionSoundURL); + COPY_PROPERTY_IF_CHANGED(actionData); + + // Cloning + COPY_PROPERTY_IF_CHANGED(cloneable); + COPY_PROPERTY_IF_CHANGED(cloneLifetime); + COPY_PROPERTY_IF_CHANGED(cloneLimit); + COPY_PROPERTY_IF_CHANGED(cloneDynamic); + COPY_PROPERTY_IF_CHANGED(cloneAvatarEntity); + COPY_PROPERTY_IF_CHANGED(cloneOriginID); + + // Scripts + COPY_PROPERTY_IF_CHANGED(script); + COPY_PROPERTY_IF_CHANGED(scriptTimestamp); + COPY_PROPERTY_IF_CHANGED(serverScripts); + + // Certifiable Properties + COPY_PROPERTY_IF_CHANGED(itemName); + COPY_PROPERTY_IF_CHANGED(itemDescription); + COPY_PROPERTY_IF_CHANGED(itemCategories); + COPY_PROPERTY_IF_CHANGED(itemArtist); + COPY_PROPERTY_IF_CHANGED(itemLicense); + COPY_PROPERTY_IF_CHANGED(limitedRun); + COPY_PROPERTY_IF_CHANGED(marketplaceID); + COPY_PROPERTY_IF_CHANGED(editionNumber); + COPY_PROPERTY_IF_CHANGED(entityInstanceNumber); + COPY_PROPERTY_IF_CHANGED(certificateID); + COPY_PROPERTY_IF_CHANGED(staticCertificateVersion); + + // Local props for scripts + COPY_PROPERTY_IF_CHANGED(localPosition); + COPY_PROPERTY_IF_CHANGED(localRotation); + COPY_PROPERTY_IF_CHANGED(localVelocity); + COPY_PROPERTY_IF_CHANGED(localAngularVelocity); + COPY_PROPERTY_IF_CHANGED(localDimensions); + + // Common COPY_PROPERTY_IF_CHANGED(shapeType); + COPY_PROPERTY_IF_CHANGED(compoundShapeURL); + COPY_PROPERTY_IF_CHANGED(color); + COPY_PROPERTY_IF_CHANGED(alpha); + COPY_PROPERTY_IF_CHANGED(textures); + + // Particles COPY_PROPERTY_IF_CHANGED(maxParticles); COPY_PROPERTY_IF_CHANGED(lifespan); COPY_PROPERTY_IF_CHANGED(isEmitting); @@ -2031,110 +2127,112 @@ void EntityItemProperties::merge(const EntityItemProperties& other) { COPY_PROPERTY_IF_CHANGED(radiusSpread); COPY_PROPERTY_IF_CHANGED(radiusStart); COPY_PROPERTY_IF_CHANGED(radiusFinish); + COPY_PROPERTY_IF_CHANGED(colorSpread); + COPY_PROPERTY_IF_CHANGED(colorStart); + COPY_PROPERTY_IF_CHANGED(colorFinish); + COPY_PROPERTY_IF_CHANGED(alphaSpread); + COPY_PROPERTY_IF_CHANGED(alphaStart); + COPY_PROPERTY_IF_CHANGED(alphaFinish); + COPY_PROPERTY_IF_CHANGED(emitterShouldTrail); COPY_PROPERTY_IF_CHANGED(particleSpin); COPY_PROPERTY_IF_CHANGED(spinSpread); COPY_PROPERTY_IF_CHANGED(spinStart); COPY_PROPERTY_IF_CHANGED(spinFinish); COPY_PROPERTY_IF_CHANGED(rotateWithEntity); - COPY_PROPERTY_IF_CHANGED(imageURL); - COPY_PROPERTY_IF_CHANGED(emissive); - COPY_PROPERTY_IF_CHANGED(keepAspectRatio); - COPY_PROPERTY_IF_CHANGED(subImage); - - COPY_PROPERTY_IF_CHANGED(followCamera); - COPY_PROPERTY_IF_CHANGED(majorGridEvery); - COPY_PROPERTY_IF_CHANGED(minorGridEvery); - - // Certifiable Properties - COPY_PROPERTY_IF_CHANGED(itemName); - COPY_PROPERTY_IF_CHANGED(itemDescription); - COPY_PROPERTY_IF_CHANGED(itemCategories); - COPY_PROPERTY_IF_CHANGED(itemArtist); - COPY_PROPERTY_IF_CHANGED(itemLicense); - COPY_PROPERTY_IF_CHANGED(limitedRun); - COPY_PROPERTY_IF_CHANGED(marketplaceID); - COPY_PROPERTY_IF_CHANGED(editionNumber); - COPY_PROPERTY_IF_CHANGED(entityInstanceNumber); - COPY_PROPERTY_IF_CHANGED(certificateID); - COPY_PROPERTY_IF_CHANGED(staticCertificateVersion); - - COPY_PROPERTY_IF_CHANGED(name); - COPY_PROPERTY_IF_CHANGED(collisionSoundURL); - - COPY_PROPERTY_IF_CHANGED(hazeMode); - COPY_PROPERTY_IF_CHANGED(keyLightMode); - COPY_PROPERTY_IF_CHANGED(ambientLightMode); - COPY_PROPERTY_IF_CHANGED(skyboxMode); - COPY_PROPERTY_IF_CHANGED(bloomMode); - - COPY_PROPERTY_IF_CHANGED(sourceUrl); - COPY_PROPERTY_IF_CHANGED(voxelVolumeSize); - COPY_PROPERTY_IF_CHANGED(voxelData); - COPY_PROPERTY_IF_CHANGED(voxelSurfaceStyle); - COPY_PROPERTY_IF_CHANGED(lineWidth); - COPY_PROPERTY_IF_CHANGED(linePoints); - COPY_PROPERTY_IF_CHANGED(href); - COPY_PROPERTY_IF_CHANGED(description); - COPY_PROPERTY_IF_CHANGED(billboardMode); - COPY_PROPERTY_IF_CHANGED(actionData); - COPY_PROPERTY_IF_CHANGED(normals); - COPY_PROPERTY_IF_CHANGED(strokeColors); - COPY_PROPERTY_IF_CHANGED(strokeWidths); - COPY_PROPERTY_IF_CHANGED(isUVModeStretch); - COPY_PROPERTY_IF_CHANGED(created); - + // Model + COPY_PROPERTY_IF_CHANGED(modelURL); + COPY_PROPERTY_IF_CHANGED(jointRotationsSet); + COPY_PROPERTY_IF_CHANGED(jointRotations); + COPY_PROPERTY_IF_CHANGED(jointTranslationsSet); + COPY_PROPERTY_IF_CHANGED(jointTranslations); + COPY_PROPERTY_IF_CHANGED(relayParentJoints); _animation.merge(other._animation); + + // Light + COPY_PROPERTY_IF_CHANGED(isSpotlight); + COPY_PROPERTY_IF_CHANGED(intensity); + COPY_PROPERTY_IF_CHANGED(exponent); + COPY_PROPERTY_IF_CHANGED(cutoff); + COPY_PROPERTY_IF_CHANGED(falloffRadius); + + // Text + COPY_PROPERTY_IF_CHANGED(text); + COPY_PROPERTY_IF_CHANGED(lineHeight); + COPY_PROPERTY_IF_CHANGED(textColor); + COPY_PROPERTY_IF_CHANGED(textAlpha); + COPY_PROPERTY_IF_CHANGED(backgroundColor); + COPY_PROPERTY_IF_CHANGED(backgroundAlpha); + COPY_PROPERTY_IF_CHANGED(billboardMode); + COPY_PROPERTY_IF_CHANGED(leftMargin); + COPY_PROPERTY_IF_CHANGED(rightMargin); + COPY_PROPERTY_IF_CHANGED(topMargin); + COPY_PROPERTY_IF_CHANGED(bottomMargin); + + // Zone _keyLight.merge(other._keyLight); _ambientLight.merge(other._ambientLight); _skybox.merge(other._skybox); _haze.merge(other._haze); _bloom.merge(other._bloom); - _grab.merge(other._grab); + COPY_PROPERTY_IF_CHANGED(flyingAllowed); + COPY_PROPERTY_IF_CHANGED(ghostingAllowed); + COPY_PROPERTY_IF_CHANGED(filterURL); + COPY_PROPERTY_IF_CHANGED(keyLightMode); + COPY_PROPERTY_IF_CHANGED(ambientLightMode); + COPY_PROPERTY_IF_CHANGED(skyboxMode); + COPY_PROPERTY_IF_CHANGED(hazeMode); + COPY_PROPERTY_IF_CHANGED(bloomMode); + // Polyvox + COPY_PROPERTY_IF_CHANGED(voxelVolumeSize); + COPY_PROPERTY_IF_CHANGED(voxelData); + COPY_PROPERTY_IF_CHANGED(voxelSurfaceStyle); COPY_PROPERTY_IF_CHANGED(xTextureURL); COPY_PROPERTY_IF_CHANGED(yTextureURL); COPY_PROPERTY_IF_CHANGED(zTextureURL); - COPY_PROPERTY_IF_CHANGED(xNNeighborID); COPY_PROPERTY_IF_CHANGED(yNNeighborID); COPY_PROPERTY_IF_CHANGED(zNNeighborID); - COPY_PROPERTY_IF_CHANGED(xPNeighborID); COPY_PROPERTY_IF_CHANGED(yPNeighborID); COPY_PROPERTY_IF_CHANGED(zPNeighborID); - COPY_PROPERTY_IF_CHANGED(parentID); - COPY_PROPERTY_IF_CHANGED(parentJointIndex); - COPY_PROPERTY_IF_CHANGED(queryAACube); - - COPY_PROPERTY_IF_CHANGED(localPosition); - COPY_PROPERTY_IF_CHANGED(localRotation); - COPY_PROPERTY_IF_CHANGED(localVelocity); - COPY_PROPERTY_IF_CHANGED(localAngularVelocity); - COPY_PROPERTY_IF_CHANGED(localDimensions); - - COPY_PROPERTY_IF_CHANGED(jointRotationsSet); - COPY_PROPERTY_IF_CHANGED(jointRotations); - COPY_PROPERTY_IF_CHANGED(jointTranslationsSet); - COPY_PROPERTY_IF_CHANGED(jointTranslations); - COPY_PROPERTY_IF_CHANGED(shape); - - COPY_PROPERTY_IF_CHANGED(flyingAllowed); - COPY_PROPERTY_IF_CHANGED(ghostingAllowed); - COPY_PROPERTY_IF_CHANGED(filterURL); - - COPY_PROPERTY_IF_CHANGED(entityHostType); - COPY_PROPERTY_IF_CHANGED(owningAvatarID); - + // Web + COPY_PROPERTY_IF_CHANGED(sourceUrl); COPY_PROPERTY_IF_CHANGED(dpi); - COPY_PROPERTY_IF_CHANGED(cloneable); - COPY_PROPERTY_IF_CHANGED(cloneLifetime); - COPY_PROPERTY_IF_CHANGED(cloneLimit); - COPY_PROPERTY_IF_CHANGED(cloneDynamic); - COPY_PROPERTY_IF_CHANGED(cloneAvatarEntity); - COPY_PROPERTY_IF_CHANGED(cloneOriginID); + // Polyline + COPY_PROPERTY_IF_CHANGED(linePoints); + COPY_PROPERTY_IF_CHANGED(strokeWidths); + COPY_PROPERTY_IF_CHANGED(normals); + COPY_PROPERTY_IF_CHANGED(strokeColors); + COPY_PROPERTY_IF_CHANGED(isUVModeStretch); + + // Shape + COPY_PROPERTY_IF_CHANGED(shape); + + // Material + COPY_PROPERTY_IF_CHANGED(materialURL); + COPY_PROPERTY_IF_CHANGED(materialMappingMode); + COPY_PROPERTY_IF_CHANGED(priority); + COPY_PROPERTY_IF_CHANGED(parentMaterialName); + COPY_PROPERTY_IF_CHANGED(materialMappingPos); + COPY_PROPERTY_IF_CHANGED(materialMappingScale); + COPY_PROPERTY_IF_CHANGED(materialMappingRot); + COPY_PROPERTY_IF_CHANGED(materialData); + COPY_PROPERTY_IF_CHANGED(materialRepeat); + + // Image + COPY_PROPERTY_IF_CHANGED(imageURL); + COPY_PROPERTY_IF_CHANGED(emissive); + COPY_PROPERTY_IF_CHANGED(keepAspectRatio); + COPY_PROPERTY_IF_CHANGED(subImage); + + // Grid + COPY_PROPERTY_IF_CHANGED(followCamera); + COPY_PROPERTY_IF_CHANGED(majorGridEvery); + COPY_PROPERTY_IF_CHANGED(minorGridEvery); _lastEdited = usecTimestampNow(); } @@ -2190,73 +2288,125 @@ void EntityItemProperties::entityPropertyFlagsFromScriptValue(const QScriptValue } static QHash _propertyInfos; +static QHash _enumsToPropertyStrings; bool EntityItemProperties::getPropertyInfo(const QString& propertyName, EntityPropertyInfo& propertyInfo) { static std::once_flag initMap; - + std::call_once(initMap, []() { + // Core + ADD_PROPERTY_TO_MAP(PROP_SIMULATION_OWNER, SimulationOwner, simulationOwner, SimulationOwner); ADD_PROPERTY_TO_MAP(PROP_VISIBLE, Visible, visible, bool); - ADD_PROPERTY_TO_MAP(PROP_CAN_CAST_SHADOW, CanCastShadow, canCastShadow, bool); + ADD_PROPERTY_TO_MAP(PROP_NAME, Name, name, QString); + ADD_PROPERTY_TO_MAP(PROP_LOCKED, Locked, locked, bool); + ADD_PROPERTY_TO_MAP(PROP_USER_DATA, UserData, userData, QString); + ADD_PROPERTY_TO_MAP(PROP_HREF, Href, href, QString); + ADD_PROPERTY_TO_MAP(PROP_DESCRIPTION, Description, description, QString); ADD_PROPERTY_TO_MAP(PROP_POSITION, Position, position, vec3); ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_DIMENSIONS, Dimensions, dimensions, vec3, ENTITY_ITEM_MIN_DIMENSION, FLT_MAX); ADD_PROPERTY_TO_MAP(PROP_ROTATION, Rotation, rotation, quat); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_REGISTRATION_POINT, RegistrationPoint, registrationPoint, vec3, + ENTITY_ITEM_MIN_REGISTRATION_POINT, ENTITY_ITEM_MAX_REGISTRATION_POINT); + //ADD_PROPERTY_TO_MAP(PROP_CREATED, Created, created, quint64); // not yet handled + //ADD_PROPERTY_TO_MAP(PROP_LAST_EDITED_BY, LastEditedBy, lastEditedBy, QUuid); // not yet handled + ADD_PROPERTY_TO_MAP(PROP_ENTITY_HOST_TYPE, EntityHostType, entityHostType, entity::HostType); + ADD_PROPERTY_TO_MAP(PROP_OWNING_AVATAR_ID, OwningAvatarID, owningAvatarID, QUuid); + ADD_PROPERTY_TO_MAP(PROP_PARENT_ID, ParentID, parentID, QUuid); + ADD_PROPERTY_TO_MAP(PROP_PARENT_JOINT_INDEX, ParentJointIndex, parentJointIndex, uint16_t); + //ADD_PROPERTY_TO_MAP(PROP_QUERY_AA_CUBE, QueryAACube, queryAACube, AACube); // not yet handled + ADD_PROPERTY_TO_MAP(PROP_CAN_CAST_SHADOW, CanCastShadow, canCastShadow, bool); + ADD_PROPERTY_TO_MAP(PROP_VISIBLE_IN_SECONDARY_CAMERA, IsVisibleInSecondaryCamera, isVisibleInSecondaryCamera, bool); + { // Grab + ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_GRABBABLE, Grab, grab, Grabbable, grabbable); + ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_KINEMATIC, Grab, grab, GrabKinematic, grabKinematic); + ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_FOLLOWS_CONTROLLER, Grab, grab, GrabFollowsController, grabFollowsController); + ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_TRIGGERABLE, Grab, grab, Triggerable, triggerable); + ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_EQUIPPABLE, Grab, grab, Equippable, equippable); + ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_DELEGATE_TO_PARENT, Grab, grab, GrabDelegateToParent, grabDelegateToParent); + ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_LEFT_EQUIPPABLE_POSITION_OFFSET, Grab, grab, + EquippableLeftPosition, equippableLeftPosition); + ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_LEFT_EQUIPPABLE_ROTATION_OFFSET, Grab, grab, + EquippableLeftRotation, equippableLeftRotation); + ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_RIGHT_EQUIPPABLE_POSITION_OFFSET, Grab, grab, + EquippableRightPosition, equippableRightPosition); + ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_RIGHT_EQUIPPABLE_ROTATION_OFFSET, Grab, grab, + EquippableRightRotation, equippableRightRotation); + ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_EQUIPPABLE_INDICATOR_URL, Grab, grab, + EquippableIndicatorURL, equippableIndicatorURL); + ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_EQUIPPABLE_INDICATOR_SCALE, Grab, grab, + EquippableIndicatorScale, equippableIndicatorScale); + ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_EQUIPPABLE_INDICATOR_OFFSET, Grab, grab, + EquippableIndicatorOffset, equippableIndicatorOffset); + } + + // Physics ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_DENSITY, Density, density, float, ENTITY_ITEM_MIN_DENSITY, ENTITY_ITEM_MAX_DENSITY); ADD_PROPERTY_TO_MAP(PROP_VELOCITY, Velocity, velocity, vec3); + ADD_PROPERTY_TO_MAP(PROP_ANGULAR_VELOCITY, AngularVelocity, angularVelocity, vec3); ADD_PROPERTY_TO_MAP(PROP_GRAVITY, Gravity, gravity, vec3); ADD_PROPERTY_TO_MAP(PROP_ACCELERATION, Acceleration, acceleration, vec3); ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_DAMPING, Damping, damping, float, ENTITY_ITEM_MIN_DAMPING, ENTITY_ITEM_MAX_DAMPING); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_ANGULAR_DAMPING, AngularDamping, angularDamping, float, + ENTITY_ITEM_MIN_DAMPING, ENTITY_ITEM_MAX_DAMPING); ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_RESTITUTION, Restitution, restitution, float, ENTITY_ITEM_MIN_RESTITUTION, ENTITY_ITEM_MAX_RESTITUTION); ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_FRICTION, Friction, friction, float, ENTITY_ITEM_MIN_FRICTION, ENTITY_ITEM_MAX_FRICTION); ADD_PROPERTY_TO_MAP(PROP_LIFETIME, Lifetime, lifetime, float); - ADD_PROPERTY_TO_MAP(PROP_SCRIPT, Script, script, QString); - ADD_PROPERTY_TO_MAP(PROP_SCRIPT_TIMESTAMP, ScriptTimestamp, scriptTimestamp, quint64); - ADD_PROPERTY_TO_MAP(PROP_SERVER_SCRIPTS, ServerScripts, serverScripts, QString); - ADD_PROPERTY_TO_MAP(PROP_COLLISION_SOUND_URL, CollisionSoundURL, collisionSoundURL, QString); - ADD_PROPERTY_TO_MAP(PROP_COLOR, Color, color, u8vec3Color); - ADD_PROPERTY_TO_MAP(PROP_COLOR_SPREAD, ColorSpread, colorSpread, u8vec3Color); - ADD_PROPERTY_TO_MAP(PROP_COLOR_START, ColorStart, colorStart, vec3Color); - ADD_PROPERTY_TO_MAP(PROP_COLOR_FINISH, ColorFinish, colorFinish, vec3Color); - ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_ALPHA, Alpha, alpha, float, particle::MINIMUM_ALPHA, particle::MAXIMUM_ALPHA); - ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_ALPHA_SPREAD, AlphaSpread, alphaSpread, float, - particle::MINIMUM_ALPHA, particle::MAXIMUM_ALPHA); - ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_ALPHA_START, AlphaStart, alphaStart, float, - particle::MINIMUM_ALPHA, particle::MAXIMUM_ALPHA); - ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_ALPHA_FINISH, AlphaFinish, alphaFinish, float, - particle::MINIMUM_ALPHA, particle::MAXIMUM_ALPHA); - ADD_PROPERTY_TO_MAP(PROP_EMITTER_SHOULD_TRAIL, EmitterShouldTrail, emitterShouldTrail, bool); - ADD_PROPERTY_TO_MAP(PROP_MODEL_URL, ModelURL, modelURL, QString); - ADD_PROPERTY_TO_MAP(PROP_COMPOUND_SHAPE_URL, CompoundShapeURL, compoundShapeURL, QString); - ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_REGISTRATION_POINT, RegistrationPoint, registrationPoint, vec3, - ENTITY_ITEM_MIN_REGISTRATION_POINT, ENTITY_ITEM_MAX_REGISTRATION_POINT); - ADD_PROPERTY_TO_MAP(PROP_ANGULAR_VELOCITY, AngularVelocity, angularVelocity, vec3); - ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_ANGULAR_DAMPING, AngularDamping, angularDamping, float, - ENTITY_ITEM_MIN_DAMPING, ENTITY_ITEM_MAX_DAMPING); ADD_PROPERTY_TO_MAP(PROP_COLLISIONLESS, Collisionless, collisionless, bool); ADD_PROPERTY_TO_MAP(PROP_COLLISIONLESS, unused, ignoreForCollisions, unused); // legacy support ADD_PROPERTY_TO_MAP(PROP_COLLISION_MASK, unused, collisionMask, unused); ADD_PROPERTY_TO_MAP(PROP_COLLISION_MASK, unused, collidesWith, unused); ADD_PROPERTY_TO_MAP(PROP_DYNAMIC, unused, collisionsWillMove, unused); // legacy support ADD_PROPERTY_TO_MAP(PROP_DYNAMIC, unused, dynamic, unused); - ADD_PROPERTY_TO_MAP(PROP_IS_SPOTLIGHT, IsSpotlight, isSpotlight, bool); - ADD_PROPERTY_TO_MAP(PROP_INTENSITY, Intensity, intensity, float); - ADD_PROPERTY_TO_MAP(PROP_FALLOFF_RADIUS, FalloffRadius, falloffRadius, float); - ADD_PROPERTY_TO_MAP(PROP_EXPONENT, Exponent, exponent, float); - ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_CUTOFF, Cutoff, cutoff, float, - LightEntityItem::MIN_CUTOFF, LightEntityItem::MAX_CUTOFF); - ADD_PROPERTY_TO_MAP(PROP_LOCKED, Locked, locked, bool); - ADD_PROPERTY_TO_MAP(PROP_TEXTURES, Textures, textures, QString); - ADD_PROPERTY_TO_MAP(PROP_USER_DATA, UserData, userData, QString); - ADD_PROPERTY_TO_MAP(PROP_SIMULATION_OWNER, SimulationOwner, simulationOwner, SimulationOwner); - ADD_PROPERTY_TO_MAP(PROP_TEXT, Text, text, QString); - ADD_PROPERTY_TO_MAP(PROP_LINE_HEIGHT, LineHeight, lineHeight, float); - ADD_PROPERTY_TO_MAP(PROP_TEXT_COLOR, TextColor, textColor, u8vec3Color); - ADD_PROPERTY_TO_MAP(PROP_BACKGROUND_COLOR, BackgroundColor, backgroundColor, u8vec3Color); + ADD_PROPERTY_TO_MAP(PROP_COLLISION_SOUND_URL, CollisionSoundURL, collisionSoundURL, QString); + ADD_PROPERTY_TO_MAP(PROP_ACTION_DATA, ActionData, actionData, QByteArray); + + // Cloning + ADD_PROPERTY_TO_MAP(PROP_CLONEABLE, Cloneable, cloneable, bool); + ADD_PROPERTY_TO_MAP(PROP_CLONE_LIFETIME, CloneLifetime, cloneLifetime, float); + ADD_PROPERTY_TO_MAP(PROP_CLONE_LIMIT, CloneLimit, cloneLimit, float); + ADD_PROPERTY_TO_MAP(PROP_CLONE_DYNAMIC, CloneDynamic, cloneDynamic, bool); + ADD_PROPERTY_TO_MAP(PROP_CLONE_AVATAR_ENTITY, CloneAvatarEntity, cloneAvatarEntity, bool); + ADD_PROPERTY_TO_MAP(PROP_CLONE_ORIGIN_ID, CloneOriginID, cloneOriginID, QUuid); + + // Scripts + ADD_PROPERTY_TO_MAP(PROP_SCRIPT, Script, script, QString); + ADD_PROPERTY_TO_MAP(PROP_SCRIPT_TIMESTAMP, ScriptTimestamp, scriptTimestamp, quint64); + ADD_PROPERTY_TO_MAP(PROP_SERVER_SCRIPTS, ServerScripts, serverScripts, QString); + + // Certifiable Properties + ADD_PROPERTY_TO_MAP(PROP_ITEM_NAME, ItemName, itemName, QString); + ADD_PROPERTY_TO_MAP(PROP_ITEM_DESCRIPTION, ItemDescription, itemDescription, QString); + ADD_PROPERTY_TO_MAP(PROP_ITEM_CATEGORIES, ItemCategories, itemCategories, QString); + ADD_PROPERTY_TO_MAP(PROP_ITEM_ARTIST, ItemArtist, itemArtist, QString); + ADD_PROPERTY_TO_MAP(PROP_ITEM_LICENSE, ItemLicense, itemLicense, QString); + ADD_PROPERTY_TO_MAP(PROP_LIMITED_RUN, LimitedRun, limitedRun, quint32); + ADD_PROPERTY_TO_MAP(PROP_MARKETPLACE_ID, MarketplaceID, marketplaceID, QString); + ADD_PROPERTY_TO_MAP(PROP_EDITION_NUMBER, EditionNumber, editionNumber, quint32); + ADD_PROPERTY_TO_MAP(PROP_ENTITY_INSTANCE_NUMBER, EntityInstanceNumber, entityInstanceNumber, quint32); + ADD_PROPERTY_TO_MAP(PROP_CERTIFICATE_ID, CertificateID, certificateID, QString); + ADD_PROPERTY_TO_MAP(PROP_STATIC_CERTIFICATE_VERSION, StaticCertificateVersion, staticCertificateVersion, quint32); + + // Local script props + ADD_PROPERTY_TO_MAP(PROP_LOCAL_POSITION, LocalPosition, localPosition, vec3); + ADD_PROPERTY_TO_MAP(PROP_LOCAL_ROTATION, LocalRotation, localRotation, quat); + ADD_PROPERTY_TO_MAP(PROP_LOCAL_VELOCITY, LocalVelocity, localVelocity, vec3); + ADD_PROPERTY_TO_MAP(PROP_LOCAL_ANGULAR_VELOCITY, LocalAngularVelocity, localAngularVelocity, vec3); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_LOCAL_DIMENSIONS, LocalDimensions, localDimensions, vec3, + ENTITY_ITEM_MIN_DIMENSION, FLT_MAX); + + // Common ADD_PROPERTY_TO_MAP(PROP_SHAPE_TYPE, ShapeType, shapeType, ShapeType); + ADD_PROPERTY_TO_MAP(PROP_COMPOUND_SHAPE_URL, CompoundShapeURL, compoundShapeURL, QString); + ADD_PROPERTY_TO_MAP(PROP_COLOR, Color, color, u8vec3Color); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_ALPHA, Alpha, alpha, float, particle::MINIMUM_ALPHA, particle::MAXIMUM_ALPHA); + ADD_PROPERTY_TO_MAP(PROP_TEXTURES, Textures, textures, QString); + + // Particles ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_MAX_PARTICLES, MaxParticles, maxParticles, quint32, particle::MINIMUM_MAX_PARTICLES, particle::MAXIMUM_MAX_PARTICLES); ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_LIFESPAN, Lifespan, lifespan, float, @@ -2293,62 +2443,116 @@ bool EntityItemProperties::getPropertyInfo(const QString& propertyName, EntityPr particle::MINIMUM_PARTICLE_RADIUS, particle::MAXIMUM_PARTICLE_RADIUS); ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_RADIUS_FINISH, RadiusFinish, radiusFinish, float, particle::MINIMUM_PARTICLE_RADIUS, particle::MAXIMUM_PARTICLE_RADIUS); - - ADD_PROPERTY_TO_MAP(PROP_MATERIAL_URL, MaterialURL, materialURL, QString); - ADD_PROPERTY_TO_MAP(PROP_MATERIAL_MAPPING_MODE, MaterialMappingMode, materialMappingMode, MaterialMappingMode); - ADD_PROPERTY_TO_MAP(PROP_MATERIAL_PRIORITY, Priority, priority, quint16); - ADD_PROPERTY_TO_MAP(PROP_PARENT_MATERIAL_NAME, ParentMaterialName, parentMaterialName, QString); - ADD_PROPERTY_TO_MAP(PROP_MATERIAL_MAPPING_POS, MaterialMappingPos, materialMappingPos, vec2); - ADD_PROPERTY_TO_MAP(PROP_MATERIAL_MAPPING_SCALE, MaterialMappingScale, materialMappingScale, vec2); - ADD_PROPERTY_TO_MAP(PROP_MATERIAL_MAPPING_ROT, MaterialMappingRot, materialMappingRot, float); - ADD_PROPERTY_TO_MAP(PROP_MATERIAL_DATA, MaterialData, materialData, QString); - ADD_PROPERTY_TO_MAP(PROP_MATERIAL_REPEAT, MaterialRepeat, materialRepeat, bool); - - ADD_PROPERTY_TO_MAP(PROP_VISIBLE_IN_SECONDARY_CAMERA, IsVisibleInSecondaryCamera, isVisibleInSecondaryCamera, bool); - + ADD_PROPERTY_TO_MAP(PROP_COLOR_SPREAD, ColorSpread, colorSpread, u8vec3Color); + ADD_PROPERTY_TO_MAP(PROP_COLOR_START, ColorStart, colorStart, vec3Color); + ADD_PROPERTY_TO_MAP(PROP_COLOR_FINISH, ColorFinish, colorFinish, vec3Color); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_ALPHA_SPREAD, AlphaSpread, alphaSpread, float, + particle::MINIMUM_ALPHA, particle::MAXIMUM_ALPHA); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_ALPHA_START, AlphaStart, alphaStart, float, + particle::MINIMUM_ALPHA, particle::MAXIMUM_ALPHA); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_ALPHA_FINISH, AlphaFinish, alphaFinish, float, + particle::MINIMUM_ALPHA, particle::MAXIMUM_ALPHA); + ADD_PROPERTY_TO_MAP(PROP_EMITTER_SHOULD_TRAIL, EmitterShouldTrail, emitterShouldTrail, bool); ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_PARTICLE_SPIN, ParticleSpin, particleSpin, float, particle::MINIMUM_PARTICLE_SPIN, particle::MAXIMUM_PARTICLE_SPIN); - ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_SPIN_SPREAD, SpinSpread, spinSpread, float, -120.2365895, 1563.2556); - //particle::MINIMUM_PARTICLE_SPIN, particle::MAXIMUM_PARTICLE_SPIN); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_SPIN_SPREAD, SpinSpread, spinSpread, float, + particle::MINIMUM_PARTICLE_SPIN, particle::MAXIMUM_PARTICLE_SPIN); ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_SPIN_START, SpinStart, spinStart, float, particle::MINIMUM_PARTICLE_SPIN, particle::MAXIMUM_PARTICLE_SPIN); ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_SPIN_FINISH, SpinFinish, spinFinish, float, particle::MINIMUM_PARTICLE_SPIN, particle::MAXIMUM_PARTICLE_SPIN); ADD_PROPERTY_TO_MAP(PROP_PARTICLE_ROTATE_WITH_ENTITY, RotateWithEntity, rotateWithEntity, float); - // Certifiable Properties - ADD_PROPERTY_TO_MAP(PROP_ITEM_NAME, ItemName, itemName, QString); - ADD_PROPERTY_TO_MAP(PROP_ITEM_DESCRIPTION, ItemDescription, itemDescription, QString); - ADD_PROPERTY_TO_MAP(PROP_ITEM_CATEGORIES, ItemCategories, itemCategories, QString); - ADD_PROPERTY_TO_MAP(PROP_ITEM_ARTIST, ItemArtist, itemArtist, QString); - ADD_PROPERTY_TO_MAP(PROP_ITEM_LICENSE, ItemLicense, itemLicense, QString); - ADD_PROPERTY_TO_MAP(PROP_LIMITED_RUN, LimitedRun, limitedRun, quint32); - ADD_PROPERTY_TO_MAP(PROP_MARKETPLACE_ID, MarketplaceID, marketplaceID, QString); - ADD_PROPERTY_TO_MAP(PROP_EDITION_NUMBER, EditionNumber, editionNumber, quint32); - ADD_PROPERTY_TO_MAP(PROP_ENTITY_INSTANCE_NUMBER, EntityInstanceNumber, entityInstanceNumber, quint32); - ADD_PROPERTY_TO_MAP(PROP_CERTIFICATE_ID, CertificateID, certificateID, QString); - ADD_PROPERTY_TO_MAP(PROP_STATIC_CERTIFICATE_VERSION, StaticCertificateVersion, staticCertificateVersion, quint32); + // Model + ADD_PROPERTY_TO_MAP(PROP_MODEL_URL, ModelURL, modelURL, QString); + ADD_PROPERTY_TO_MAP(PROP_JOINT_ROTATIONS_SET, JointRotationsSet, jointRotationsSet, QVector); + ADD_PROPERTY_TO_MAP(PROP_JOINT_ROTATIONS, JointRotations, jointRotations, QVector); + ADD_PROPERTY_TO_MAP(PROP_JOINT_TRANSLATIONS_SET, JointTranslationsSet, jointTranslationsSet, QVector); + ADD_PROPERTY_TO_MAP(PROP_JOINT_TRANSLATIONS, JointTranslations, jointTranslations, QVector); + ADD_PROPERTY_TO_MAP(PROP_RELAY_PARENT_JOINTS, RelayParentJoints, relayParentJoints, bool); + { // Animation + ADD_GROUP_PROPERTY_TO_MAP(PROP_ANIMATION_URL, Animation, animation, URL, url); + ADD_GROUP_PROPERTY_TO_MAP(PROP_ANIMATION_ALLOW_TRANSLATION, Animation, animation, AllowTranslation, allowTranslation); + ADD_GROUP_PROPERTY_TO_MAP(PROP_ANIMATION_FPS, Animation, animation, FPS, fps); + ADD_GROUP_PROPERTY_TO_MAP(PROP_ANIMATION_FRAME_INDEX, Animation, animation, CurrentFrame, currentFrame); + ADD_GROUP_PROPERTY_TO_MAP(PROP_ANIMATION_PLAYING, Animation, animation, Running, running); + ADD_GROUP_PROPERTY_TO_MAP(PROP_ANIMATION_LOOP, Animation, animation, Loop, loop); + ADD_GROUP_PROPERTY_TO_MAP(PROP_ANIMATION_FIRST_FRAME, Animation, animation, FirstFrame, firstFrame); + ADD_GROUP_PROPERTY_TO_MAP(PROP_ANIMATION_LAST_FRAME, Animation, animation, LastFrame, lastFrame); + ADD_GROUP_PROPERTY_TO_MAP(PROP_ANIMATION_HOLD, Animation, animation, Hold, hold); + } - ADD_PROPERTY_TO_MAP(PROP_KEYLIGHT_COLOR, KeyLightColor, keyLightColor, u8vec3Color); - ADD_PROPERTY_TO_MAP(PROP_KEYLIGHT_INTENSITY, KeyLightIntensity, keyLightIntensity, float); - ADD_PROPERTY_TO_MAP(PROP_KEYLIGHT_DIRECTION, KeyLightDirection, keyLightDirection, vec3); - ADD_PROPERTY_TO_MAP(PROP_KEYLIGHT_CAST_SHADOW, KeyLightCastShadows, keyLightCastShadows, bool); + // Light + ADD_PROPERTY_TO_MAP(PROP_IS_SPOTLIGHT, IsSpotlight, isSpotlight, bool); + ADD_PROPERTY_TO_MAP(PROP_INTENSITY, Intensity, intensity, float); + ADD_PROPERTY_TO_MAP(PROP_EXPONENT, Exponent, exponent, float); + ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_CUTOFF, Cutoff, cutoff, float, + LightEntityItem::MIN_CUTOFF, LightEntityItem::MAX_CUTOFF); + ADD_PROPERTY_TO_MAP(PROP_FALLOFF_RADIUS, FalloffRadius, falloffRadius, float); + // Text + ADD_PROPERTY_TO_MAP(PROP_TEXT, Text, text, QString); + ADD_PROPERTY_TO_MAP(PROP_LINE_HEIGHT, LineHeight, lineHeight, float); + ADD_PROPERTY_TO_MAP(PROP_TEXT_COLOR, TextColor, textColor, u8vec3Color); + ADD_PROPERTY_TO_MAP(PROP_TEXT_ALPHA, TextAlpha, textAlpha, float); + ADD_PROPERTY_TO_MAP(PROP_BACKGROUND_COLOR, BackgroundColor, backgroundColor, u8vec3Color); + ADD_PROPERTY_TO_MAP(PROP_BACKGROUND_ALPHA, BackgroundAlpha, backgroundAlpha, float); + ADD_PROPERTY_TO_MAP(PROP_BILLBOARD_MODE, BillboardMode, billboardMode, BillboardMode); + ADD_PROPERTY_TO_MAP(PROP_LEFT_MARGIN, LeftMargin, leftMargin, float); + ADD_PROPERTY_TO_MAP(PROP_RIGHT_MARGIN, RightMargin, rightMargin, float); + ADD_PROPERTY_TO_MAP(PROP_TOP_MARGIN, TopMargin, topMargin, float); + ADD_PROPERTY_TO_MAP(PROP_BOTTOM_MARGIN, BottomMargin, bottomMargin, float); + + // Zone + { // Keylight + ADD_GROUP_PROPERTY_TO_MAP(PROP_KEYLIGHT_COLOR, KeyLight, keyLight, Color, color); + ADD_GROUP_PROPERTY_TO_MAP(PROP_KEYLIGHT_INTENSITY, KeyLight, keyLight, Intensity, intensity); + ADD_GROUP_PROPERTY_TO_MAP(PROP_KEYLIGHT_DIRECTION, KeyLight, keylight, Direction, direction); + ADD_GROUP_PROPERTY_TO_MAP(PROP_KEYLIGHT_CAST_SHADOW, KeyLight, keyLight, CastShadows, castShadows); + } + { // Ambient light + ADD_GROUP_PROPERTY_TO_MAP(PROP_AMBIENT_LIGHT_INTENSITY, AmbientLight, ambientLight, Intensity, intensity); + ADD_GROUP_PROPERTY_TO_MAP(PROP_AMBIENT_LIGHT_URL, AmbientLight, ambientLight, URL, url); + } + { // Skybox + ADD_GROUP_PROPERTY_TO_MAP(PROP_SKYBOX_COLOR, Skybox, skybox, Color, color); + ADD_GROUP_PROPERTY_TO_MAP(PROP_SKYBOX_URL, Skybox, skybox, URL, url); + } + { // Haze + ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_RANGE, Haze, haze, HazeRange, hazeRange); + ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_COLOR, Haze, haze, HazeColor, hazeColor); + ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_GLARE_COLOR, Haze, haze, HazeGlareColor, hazeGlareColor); + ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_ENABLE_GLARE, Haze, haze, HazeEnableGlare, hazeEnableGlare); + ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_GLARE_ANGLE, Haze, haze, HazeGlareAngle, hazeGlareAngle); + + ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_ALTITUDE_EFFECT, Haze, haze, HazeAltitudeEffect, hazeAltitudeEfect); + ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_CEILING, Haze, haze, HazeCeiling, hazeCeiling); + ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_BASE_REF, Haze, haze, HazeBaseRef, hazeBaseRef); + + ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_BACKGROUND_BLEND, Haze, haze, HazeBackgroundBlend, hazeBackgroundBlend); + + ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_ATTENUATE_KEYLIGHT, Haze, haze, HazeAttenuateKeyLight, hazeAttenuateKeyLight); + ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_KEYLIGHT_RANGE, Haze, haze, HazeKeyLightRange, hazeKeyLightRange); + ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_KEYLIGHT_ALTITUDE, Haze, haze, HazeKeyLightAltitude, hazeKeyLightAltitude); + } + { // Bloom + ADD_GROUP_PROPERTY_TO_MAP(PROP_BLOOM_INTENSITY, Bloom, bloom, BloomIntensity, bloomIntensity); + ADD_GROUP_PROPERTY_TO_MAP(PROP_BLOOM_THRESHOLD, Bloom, bloom, BloomThreshold, bloomThreshold); + ADD_GROUP_PROPERTY_TO_MAP(PROP_BLOOM_SIZE, Bloom, bloom, BloomSize, bloomSize); + } + ADD_PROPERTY_TO_MAP(PROP_FLYING_ALLOWED, FlyingAllowed, flyingAllowed, bool); + ADD_PROPERTY_TO_MAP(PROP_GHOSTING_ALLOWED, GhostingAllowed, ghostingAllowed, bool); + ADD_PROPERTY_TO_MAP(PROP_FILTER_URL, FilterURL, filterURL, QString); + ADD_PROPERTY_TO_MAP(PROP_KEY_LIGHT_MODE, KeyLightMode, keyLightMode, uint32_t); + ADD_PROPERTY_TO_MAP(PROP_AMBIENT_LIGHT_MODE, AmbientLightMode, ambientLightMode, uint32_t); + ADD_PROPERTY_TO_MAP(PROP_SKYBOX_MODE, SkyboxMode, skyboxMode, uint32_t); + ADD_PROPERTY_TO_MAP(PROP_HAZE_MODE, HazeMode, hazeMode, uint32_t); + ADD_PROPERTY_TO_MAP(PROP_BLOOM_MODE, BloomMode, bloomMode, uint32_t); + + // Polyvox ADD_PROPERTY_TO_MAP(PROP_VOXEL_VOLUME_SIZE, VoxelVolumeSize, voxelVolumeSize, vec3); ADD_PROPERTY_TO_MAP(PROP_VOXEL_DATA, VoxelData, voxelData, QByteArray); ADD_PROPERTY_TO_MAP(PROP_VOXEL_SURFACE_STYLE, VoxelSurfaceStyle, voxelSurfaceStyle, uint16_t); - ADD_PROPERTY_TO_MAP(PROP_NAME, Name, name, QString); - ADD_PROPERTY_TO_MAP(PROP_SOURCE_URL, SourceUrl, sourceUrl, QString); - ADD_PROPERTY_TO_MAP(PROP_LINE_WIDTH, LineWidth, lineWidth, float); - ADD_PROPERTY_TO_MAP(PROP_LINE_POINTS, LinePoints, linePoints, QVector); - ADD_PROPERTY_TO_MAP(PROP_HREF, Href, href, QString); - ADD_PROPERTY_TO_MAP(PROP_DESCRIPTION, Description, description, QString); - ADD_PROPERTY_TO_MAP(PROP_BILLBOARD_MODE, BillboardMode, billboardMode, BillboardMode); - ADD_PROPERTY_TO_MAP(PROP_ACTION_DATA, ActionData, actionData, QByteArray); - ADD_PROPERTY_TO_MAP(PROP_NORMALS, Normals, normals, QVector); - ADD_PROPERTY_TO_MAP(PROP_STROKE_COLORS, StrokeColors, strokeColors, QVector); - ADD_PROPERTY_TO_MAP(PROP_STROKE_WIDTHS, StrokeWidths, strokeWidths, QVector); - ADD_PROPERTY_TO_MAP(PROP_IS_UV_MODE_STRETCH, IsUVModeStretch, isUVModeStretch, QVector); ADD_PROPERTY_TO_MAP(PROP_X_TEXTURE_URL, XTextureURL, xTextureURL, QString); ADD_PROPERTY_TO_MAP(PROP_Y_TEXTURE_URL, YTextureURL, yTextureURL, QString); ADD_PROPERTY_TO_MAP(PROP_Z_TEXTURE_URL, ZTextureURL, zTextureURL, QString); @@ -2359,109 +2563,41 @@ bool EntityItemProperties::getPropertyInfo(const QString& propertyName, EntityPr ADD_PROPERTY_TO_MAP(PROP_Y_P_NEIGHBOR_ID, YPNeighborID, yPNeighborID, EntityItemID); ADD_PROPERTY_TO_MAP(PROP_Z_P_NEIGHBOR_ID, ZPNeighborID, zPNeighborID, EntityItemID); - ADD_PROPERTY_TO_MAP(PROP_PARENT_ID, ParentID, parentID, QUuid); - ADD_PROPERTY_TO_MAP(PROP_PARENT_JOINT_INDEX, ParentJointIndex, parentJointIndex, uint16_t); - - ADD_PROPERTY_TO_MAP(PROP_LOCAL_POSITION, LocalPosition, localPosition, vec3); - ADD_PROPERTY_TO_MAP(PROP_LOCAL_ROTATION, LocalRotation, localRotation, quat); - ADD_PROPERTY_TO_MAP(PROP_LOCAL_VELOCITY, LocalVelocity, localVelocity, vec3); - ADD_PROPERTY_TO_MAP(PROP_LOCAL_ANGULAR_VELOCITY, LocalAngularVelocity, localAngularVelocity, vec3); - ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_LOCAL_DIMENSIONS, LocalDimensions, localDimensions, vec3, - ENTITY_ITEM_MIN_DIMENSION, FLT_MAX); - - ADD_PROPERTY_TO_MAP(PROP_JOINT_ROTATIONS_SET, JointRotationsSet, jointRotationsSet, QVector); - ADD_PROPERTY_TO_MAP(PROP_JOINT_ROTATIONS, JointRotations, jointRotations, QVector); - ADD_PROPERTY_TO_MAP(PROP_JOINT_TRANSLATIONS_SET, JointTranslationsSet, jointTranslationsSet, QVector); - ADD_PROPERTY_TO_MAP(PROP_JOINT_TRANSLATIONS, JointTranslations, jointTranslations, QVector); - ADD_PROPERTY_TO_MAP(PROP_RELAY_PARENT_JOINTS, RelayParentJoints, relayParentJoints, bool); - - ADD_PROPERTY_TO_MAP(PROP_SHAPE, Shape, shape, QString); - - ADD_GROUP_PROPERTY_TO_MAP(PROP_ANIMATION_URL, Animation, animation, URL, url); - ADD_GROUP_PROPERTY_TO_MAP(PROP_ANIMATION_FPS, Animation, animation, FPS, fps); - ADD_GROUP_PROPERTY_TO_MAP(PROP_ANIMATION_FRAME_INDEX, Animation, animation, CurrentFrame, currentFrame); - ADD_GROUP_PROPERTY_TO_MAP(PROP_ANIMATION_PLAYING, Animation, animation, Running, running); - ADD_GROUP_PROPERTY_TO_MAP(PROP_ANIMATION_LOOP, Animation, animation, Loop, loop); - ADD_GROUP_PROPERTY_TO_MAP(PROP_ANIMATION_FIRST_FRAME, Animation, animation, FirstFrame, firstFrame); - ADD_GROUP_PROPERTY_TO_MAP(PROP_ANIMATION_LAST_FRAME, Animation, animation, LastFrame, lastFrame); - ADD_GROUP_PROPERTY_TO_MAP(PROP_ANIMATION_HOLD, Animation, animation, Hold, hold); - ADD_GROUP_PROPERTY_TO_MAP(PROP_ANIMATION_ALLOW_TRANSLATION, Animation, animation, AllowTranslation, allowTranslation); - - ADD_GROUP_PROPERTY_TO_MAP(PROP_SKYBOX_COLOR, Skybox, skybox, Color, color); - ADD_GROUP_PROPERTY_TO_MAP(PROP_SKYBOX_URL, Skybox, skybox, URL, url); - - ADD_PROPERTY_TO_MAP(PROP_FLYING_ALLOWED, FlyingAllowed, flyingAllowed, bool); - ADD_PROPERTY_TO_MAP(PROP_GHOSTING_ALLOWED, GhostingAllowed, ghostingAllowed, bool); - ADD_PROPERTY_TO_MAP(PROP_FILTER_URL, FilterURL, filterURL, QString); - - ADD_PROPERTY_TO_MAP(PROP_HAZE_MODE, HazeMode, hazeMode, uint32_t); - - ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_RANGE, Haze, haze, HazeRange, hazeRange); - ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_COLOR, Haze, haze, HazeColor, hazeColor); - ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_GLARE_COLOR, Haze, haze, HazeGlareColor, hazeGlareColor); - ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_ENABLE_GLARE, Haze, haze, HazeEnableGlare, hazeEnableGlare); - ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_GLARE_ANGLE, Haze, haze, HazeGlareAngle, hazeGlareAngle); - - ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_ALTITUDE_EFFECT, Haze, haze, HazeAltitudeEffect, hazeAltitudeEfect); - ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_CEILING, Haze, haze, HazeCeiling, hazeCeiling); - ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_BASE_REF, Haze, haze, HazeBaseRef, hazeBaseRef); - - ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_BACKGROUND_BLEND, Haze, haze, HazeBackgroundBlend, hazeBackgroundBlend); - - ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_ATTENUATE_KEYLIGHT, Haze, haze, HazeAttenuateKeyLight, hazeAttenuateKeyLight); - ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_KEYLIGHT_RANGE, Haze, haze, HazeKeyLightRange, hazeKeyLightRange); - ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_KEYLIGHT_ALTITUDE, Haze, haze, HazeKeyLightAltitude, hazeKeyLightAltitude); - - ADD_PROPERTY_TO_MAP(PROP_BLOOM_MODE, BloomMode, bloomMode, uint32_t); - ADD_GROUP_PROPERTY_TO_MAP(PROP_BLOOM_INTENSITY, Bloom, bloom, BloomIntensity, bloomIntensity); - ADD_GROUP_PROPERTY_TO_MAP(PROP_BLOOM_THRESHOLD, Bloom, bloom, BloomThreshold, bloomThreshold); - ADD_GROUP_PROPERTY_TO_MAP(PROP_BLOOM_SIZE, Bloom, bloom, BloomSize, bloomSize); - - ADD_PROPERTY_TO_MAP(PROP_KEY_LIGHT_MODE, KeyLightMode, keyLightMode, uint32_t); - ADD_PROPERTY_TO_MAP(PROP_AMBIENT_LIGHT_MODE, AmbientLightMode, ambientLightMode, uint32_t); - ADD_PROPERTY_TO_MAP(PROP_SKYBOX_MODE, SkyboxMode, skyboxMode, uint32_t); - + // Web + ADD_PROPERTY_TO_MAP(PROP_SOURCE_URL, SourceUrl, sourceUrl, QString); ADD_PROPERTY_TO_MAP(PROP_DPI, DPI, dpi, uint16_t); - ADD_PROPERTY_TO_MAP(PROP_CLONEABLE, Cloneable, cloneable, bool); - ADD_PROPERTY_TO_MAP(PROP_CLONE_LIFETIME, CloneLifetime, cloneLifetime, float); - ADD_PROPERTY_TO_MAP(PROP_CLONE_LIMIT, CloneLimit, cloneLimit, float); - ADD_PROPERTY_TO_MAP(PROP_CLONE_DYNAMIC, CloneDynamic, cloneDynamic, bool); - ADD_PROPERTY_TO_MAP(PROP_CLONE_AVATAR_ENTITY, CloneAvatarEntity, cloneAvatarEntity, bool); - ADD_PROPERTY_TO_MAP(PROP_CLONE_ORIGIN_ID, CloneOriginID, cloneOriginID, QUuid); + // Polyline + ADD_PROPERTY_TO_MAP(PROP_LINE_POINTS, LinePoints, linePoints, QVector); + ADD_PROPERTY_TO_MAP(PROP_STROKE_WIDTHS, StrokeWidths, strokeWidths, QVector); + ADD_PROPERTY_TO_MAP(PROP_STROKE_NORMALS, Normals, normals, QVector); + ADD_PROPERTY_TO_MAP(PROP_STROKE_COLORS, StrokeColors, strokeColors, QVector); + ADD_PROPERTY_TO_MAP(PROP_IS_UV_MODE_STRETCH, IsUVModeStretch, isUVModeStretch, QVector); - ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_GRABBABLE, Grab, grab, Grabbable, grabbable); - ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_KINEMATIC, Grab, grab, GrabKinematic, grabKinematic); - ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_FOLLOWS_CONTROLLER, Grab, grab, GrabFollowsController, grabFollowsController); - ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_TRIGGERABLE, Grab, grab, Triggerable, triggerable); - ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_EQUIPPABLE, Grab, grab, Equippable, equippable); - ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_LEFT_EQUIPPABLE_POSITION_OFFSET, Grab, grab, - EquippableLeftPosition, equippableLeftPosition); - ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_LEFT_EQUIPPABLE_ROTATION_OFFSET, Grab, grab, - EquippableLeftRotation, equippableLeftRotation); - ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_RIGHT_EQUIPPABLE_POSITION_OFFSET, Grab, grab, - EquippableRightPosition, equippableRightPosition); - ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_RIGHT_EQUIPPABLE_ROTATION_OFFSET, Grab, grab, - EquippableRightRotation, equippableRightRotation); - ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_EQUIPPABLE_INDICATOR_URL, Grab, grab, - EquippableIndicatorURL, equippableIndicatorURL); - ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_EQUIPPABLE_INDICATOR_SCALE, Grab, grab, - EquippableIndicatorScale, equippableIndicatorScale); - ADD_GROUP_PROPERTY_TO_MAP(PROP_GRAB_EQUIPPABLE_INDICATOR_OFFSET, Grab, grab, - EquippableIndicatorOffset, equippableIndicatorOffset); + // Shape + ADD_PROPERTY_TO_MAP(PROP_SHAPE, Shape, shape, QString); + // Material + ADD_PROPERTY_TO_MAP(PROP_MATERIAL_URL, MaterialURL, materialURL, QString); + ADD_PROPERTY_TO_MAP(PROP_MATERIAL_MAPPING_MODE, MaterialMappingMode, materialMappingMode, MaterialMappingMode); + ADD_PROPERTY_TO_MAP(PROP_MATERIAL_PRIORITY, Priority, priority, quint16); + ADD_PROPERTY_TO_MAP(PROP_PARENT_MATERIAL_NAME, ParentMaterialName, parentMaterialName, QString); + ADD_PROPERTY_TO_MAP(PROP_MATERIAL_MAPPING_POS, MaterialMappingPos, materialMappingPos, vec2); + ADD_PROPERTY_TO_MAP(PROP_MATERIAL_MAPPING_SCALE, MaterialMappingScale, materialMappingScale, vec2); + ADD_PROPERTY_TO_MAP(PROP_MATERIAL_MAPPING_ROT, MaterialMappingRot, materialMappingRot, float); + ADD_PROPERTY_TO_MAP(PROP_MATERIAL_DATA, MaterialData, materialData, QString); + ADD_PROPERTY_TO_MAP(PROP_MATERIAL_REPEAT, MaterialRepeat, materialRepeat, bool); + + // Image ADD_PROPERTY_TO_MAP(PROP_IMAGE_URL, ImageURL, imageURL, QString); ADD_PROPERTY_TO_MAP(PROP_EMISSIVE, Emissive, emissive, bool); ADD_PROPERTY_TO_MAP(PROP_KEEP_ASPECT_RATIO, KeepAspectRatio, keepAspectRatio, bool); ADD_PROPERTY_TO_MAP(PROP_SUB_IMAGE, SubImage, subImage, QRect); + // Grid ADD_PROPERTY_TO_MAP(PROP_GRID_FOLLOW_CAMERA, FollowCamera, followCamera, bool); ADD_PROPERTY_TO_MAP(PROP_MAJOR_GRID_EVERY, MajorGridEvery, majorGridEvery, uint32_t); ADD_PROPERTY_TO_MAP(PROP_MINOR_GRID_EVERY, MinorGridEvery, minorGridEvery, float); - - // FIXME - these are not yet handled - //ADD_PROPERTY_TO_MAP(PROP_CREATED, Created, created, quint64); - }); auto iter = _propertyInfos.find(propertyName); @@ -2587,78 +2723,81 @@ OctreeElement::AppendState EntityItemProperties::encodeEntityEditPacket(PacketTy // PROP_PAGED_PROPERTY, // PROP_CUSTOM_PROPERTIES_INCLUDED, + APPEND_ENTITY_PROPERTY(PROP_SIMULATION_OWNER, properties._simulationOwner.toByteArray()); - APPEND_ENTITY_PROPERTY(PROP_POSITION, properties.getPosition()); - APPEND_ENTITY_PROPERTY(PROP_DIMENSIONS, properties.getDimensions()); - APPEND_ENTITY_PROPERTY(PROP_ROTATION, properties.getRotation()); - APPEND_ENTITY_PROPERTY(PROP_DENSITY, properties.getDensity()); - APPEND_ENTITY_PROPERTY(PROP_VELOCITY, properties.getVelocity()); - APPEND_ENTITY_PROPERTY(PROP_GRAVITY, properties.getGravity()); - APPEND_ENTITY_PROPERTY(PROP_ACCELERATION, properties.getAcceleration()); - APPEND_ENTITY_PROPERTY(PROP_DAMPING, properties.getDamping()); - APPEND_ENTITY_PROPERTY(PROP_RESTITUTION, properties.getRestitution()); - APPEND_ENTITY_PROPERTY(PROP_FRICTION, properties.getFriction()); - APPEND_ENTITY_PROPERTY(PROP_LIFETIME, properties.getLifetime()); - APPEND_ENTITY_PROPERTY(PROP_SCRIPT, properties.getScript()); - APPEND_ENTITY_PROPERTY(PROP_SCRIPT_TIMESTAMP, properties.getScriptTimestamp()); - APPEND_ENTITY_PROPERTY(PROP_SERVER_SCRIPTS, properties.getServerScripts()); - APPEND_ENTITY_PROPERTY(PROP_REGISTRATION_POINT, properties.getRegistrationPoint()); - APPEND_ENTITY_PROPERTY(PROP_ANGULAR_VELOCITY, properties.getAngularVelocity()); - APPEND_ENTITY_PROPERTY(PROP_ANGULAR_DAMPING, properties.getAngularDamping()); APPEND_ENTITY_PROPERTY(PROP_VISIBLE, properties.getVisible()); - APPEND_ENTITY_PROPERTY(PROP_CAN_CAST_SHADOW, properties.getCanCastShadow()); - APPEND_ENTITY_PROPERTY(PROP_COLLISIONLESS, properties.getCollisionless()); - APPEND_ENTITY_PROPERTY(PROP_COLLISION_MASK, properties.getCollisionMask()); - APPEND_ENTITY_PROPERTY(PROP_DYNAMIC, properties.getDynamic()); + APPEND_ENTITY_PROPERTY(PROP_NAME, properties.getName()); APPEND_ENTITY_PROPERTY(PROP_LOCKED, properties.getLocked()); APPEND_ENTITY_PROPERTY(PROP_USER_DATA, properties.getUserData()); APPEND_ENTITY_PROPERTY(PROP_HREF, properties.getHref()); APPEND_ENTITY_PROPERTY(PROP_DESCRIPTION, properties.getDescription()); + APPEND_ENTITY_PROPERTY(PROP_POSITION, properties.getPosition()); + APPEND_ENTITY_PROPERTY(PROP_DIMENSIONS, properties.getDimensions()); + APPEND_ENTITY_PROPERTY(PROP_ROTATION, properties.getRotation()); + APPEND_ENTITY_PROPERTY(PROP_REGISTRATION_POINT, properties.getRegistrationPoint()); + // FIXME: deal with these + // APPEND_ENTITY_PROPERTY(PROP_CREATED, properties.getCreated()); + // APPEND_ENTITY_PROPERTY(PROP_LAST_EDITED_BY, properties.getLastEditedBy()); + // APPEND_ENTITY_PROPERTY(PROP_ENTITY_HOST_TYPE, (uint32_t)properties.getEntityHostType()); + // APPEND_ENTITY_PROPERTY(PROP_OWNING_AVATAR_ID, properties.getOwningAvatarID()); APPEND_ENTITY_PROPERTY(PROP_PARENT_ID, properties.getParentID()); APPEND_ENTITY_PROPERTY(PROP_PARENT_JOINT_INDEX, properties.getParentJointIndex()); APPEND_ENTITY_PROPERTY(PROP_QUERY_AA_CUBE, properties.getQueryAACube()); + APPEND_ENTITY_PROPERTY(PROP_CAN_CAST_SHADOW, properties.getCanCastShadow()); + // APPEND_ENTITY_PROPERTY(PROP_VISIBLE_IN_SECONDARY_CAMERA, properties.getIsVisibleInSecondaryCamera()); // Not sent over the wire + _staticGrab.setProperties(properties); + _staticGrab.appendToEditPacket(packetData, requestedProperties, propertyFlags, + propertiesDidntFit, propertyCount, appendState); - if (properties.getType() == EntityTypes::Web) { - APPEND_ENTITY_PROPERTY(PROP_SOURCE_URL, properties.getSourceUrl()); - APPEND_ENTITY_PROPERTY(PROP_DPI, properties.getDPI()); - } + // Physics + APPEND_ENTITY_PROPERTY(PROP_DENSITY, properties.getDensity()); + APPEND_ENTITY_PROPERTY(PROP_VELOCITY, properties.getVelocity()); + APPEND_ENTITY_PROPERTY(PROP_ANGULAR_VELOCITY, properties.getAngularVelocity()); + APPEND_ENTITY_PROPERTY(PROP_GRAVITY, properties.getGravity()); + APPEND_ENTITY_PROPERTY(PROP_ACCELERATION, properties.getAcceleration()); + APPEND_ENTITY_PROPERTY(PROP_DAMPING, properties.getDamping()); + APPEND_ENTITY_PROPERTY(PROP_ANGULAR_DAMPING, properties.getAngularDamping()); + APPEND_ENTITY_PROPERTY(PROP_RESTITUTION, properties.getRestitution()); + APPEND_ENTITY_PROPERTY(PROP_FRICTION, properties.getFriction()); + APPEND_ENTITY_PROPERTY(PROP_LIFETIME, properties.getLifetime()); + APPEND_ENTITY_PROPERTY(PROP_COLLISIONLESS, properties.getCollisionless()); + APPEND_ENTITY_PROPERTY(PROP_COLLISION_MASK, properties.getCollisionMask()); + APPEND_ENTITY_PROPERTY(PROP_DYNAMIC, properties.getDynamic()); + APPEND_ENTITY_PROPERTY(PROP_COLLISION_SOUND_URL, properties.getCollisionSoundURL()); + APPEND_ENTITY_PROPERTY(PROP_ACTION_DATA, properties.getActionData()); - if (properties.getType() == EntityTypes::Text) { - APPEND_ENTITY_PROPERTY(PROP_TEXT, properties.getText()); - APPEND_ENTITY_PROPERTY(PROP_LINE_HEIGHT, properties.getLineHeight()); - APPEND_ENTITY_PROPERTY(PROP_TEXT_COLOR, properties.getTextColor()); - APPEND_ENTITY_PROPERTY(PROP_BACKGROUND_COLOR, properties.getBackgroundColor()); - APPEND_ENTITY_PROPERTY(PROP_BILLBOARD_MODE, (uint32_t)properties.getBillboardMode()); - } + // Cloning + APPEND_ENTITY_PROPERTY(PROP_CLONEABLE, properties.getCloneable()); + APPEND_ENTITY_PROPERTY(PROP_CLONE_LIFETIME, properties.getCloneLifetime()); + APPEND_ENTITY_PROPERTY(PROP_CLONE_LIMIT, properties.getCloneLimit()); + APPEND_ENTITY_PROPERTY(PROP_CLONE_DYNAMIC, properties.getCloneDynamic()); + APPEND_ENTITY_PROPERTY(PROP_CLONE_AVATAR_ENTITY, properties.getCloneAvatarEntity()); + APPEND_ENTITY_PROPERTY(PROP_CLONE_ORIGIN_ID, properties.getCloneOriginID()); - if (properties.getType() == EntityTypes::Model) { - APPEND_ENTITY_PROPERTY(PROP_COLOR, properties.getColor()); - APPEND_ENTITY_PROPERTY(PROP_MODEL_URL, properties.getModelURL()); - APPEND_ENTITY_PROPERTY(PROP_COMPOUND_SHAPE_URL, properties.getCompoundShapeURL()); - APPEND_ENTITY_PROPERTY(PROP_TEXTURES, properties.getTextures()); - APPEND_ENTITY_PROPERTY(PROP_SHAPE_TYPE, (uint32_t)(properties.getShapeType())); + // Scripts + APPEND_ENTITY_PROPERTY(PROP_SCRIPT, properties.getScript()); + APPEND_ENTITY_PROPERTY(PROP_SCRIPT_TIMESTAMP, properties.getScriptTimestamp()); + APPEND_ENTITY_PROPERTY(PROP_SERVER_SCRIPTS, properties.getServerScripts()); - APPEND_ENTITY_PROPERTY(PROP_JOINT_ROTATIONS_SET, properties.getJointRotationsSet()); - APPEND_ENTITY_PROPERTY(PROP_JOINT_ROTATIONS, properties.getJointRotations()); - APPEND_ENTITY_PROPERTY(PROP_JOINT_TRANSLATIONS_SET, properties.getJointTranslationsSet()); - APPEND_ENTITY_PROPERTY(PROP_JOINT_TRANSLATIONS, properties.getJointTranslations()); - APPEND_ENTITY_PROPERTY(PROP_RELAY_PARENT_JOINTS, properties.getRelayParentJoints()); - - _staticAnimation.setProperties(properties); - _staticAnimation.appendToEditPacket(packetData, requestedProperties, propertyFlags, propertiesDidntFit, propertyCount, appendState); - } - - if (properties.getType() == EntityTypes::Light) { - APPEND_ENTITY_PROPERTY(PROP_IS_SPOTLIGHT, properties.getIsSpotlight()); - APPEND_ENTITY_PROPERTY(PROP_COLOR, properties.getColor()); - APPEND_ENTITY_PROPERTY(PROP_INTENSITY, properties.getIntensity()); - APPEND_ENTITY_PROPERTY(PROP_EXPONENT, properties.getExponent()); - APPEND_ENTITY_PROPERTY(PROP_CUTOFF, properties.getCutoff()); - APPEND_ENTITY_PROPERTY(PROP_FALLOFF_RADIUS, properties.getFalloffRadius()); - } + // Certifiable Properties + APPEND_ENTITY_PROPERTY(PROP_ITEM_NAME, properties.getItemName()); + APPEND_ENTITY_PROPERTY(PROP_ITEM_DESCRIPTION, properties.getItemDescription()); + APPEND_ENTITY_PROPERTY(PROP_ITEM_CATEGORIES, properties.getItemCategories()); + APPEND_ENTITY_PROPERTY(PROP_ITEM_ARTIST, properties.getItemArtist()); + APPEND_ENTITY_PROPERTY(PROP_ITEM_LICENSE, properties.getItemLicense()); + APPEND_ENTITY_PROPERTY(PROP_LIMITED_RUN, properties.getLimitedRun()); + APPEND_ENTITY_PROPERTY(PROP_MARKETPLACE_ID, properties.getMarketplaceID()); + APPEND_ENTITY_PROPERTY(PROP_EDITION_NUMBER, properties.getEditionNumber()); + APPEND_ENTITY_PROPERTY(PROP_ENTITY_INSTANCE_NUMBER, properties.getEntityInstanceNumber()); + APPEND_ENTITY_PROPERTY(PROP_CERTIFICATE_ID, properties.getCertificateID()); + APPEND_ENTITY_PROPERTY(PROP_STATIC_CERTIFICATE_VERSION, properties.getStaticCertificateVersion()); if (properties.getType() == EntityTypes::ParticleEffect) { APPEND_ENTITY_PROPERTY(PROP_SHAPE_TYPE, (uint32_t)(properties.getShapeType())); + APPEND_ENTITY_PROPERTY(PROP_COLOR, properties.getColor()); + APPEND_ENTITY_PROPERTY(PROP_ALPHA, properties.getAlpha()); + APPEND_ENTITY_PROPERTY(PROP_TEXTURES, properties.getTextures()); + APPEND_ENTITY_PROPERTY(PROP_MAX_PARTICLES, properties.getMaxParticles()); APPEND_ENTITY_PROPERTY(PROP_LIFESPAN, properties.getLifespan()); @@ -2683,17 +2822,14 @@ OctreeElement::AppendState EntityItemProperties::encodeEntityEditPacket(PacketTy APPEND_ENTITY_PROPERTY(PROP_RADIUS_START, properties.getRadiusStart()); APPEND_ENTITY_PROPERTY(PROP_RADIUS_FINISH, properties.getRadiusFinish()); - APPEND_ENTITY_PROPERTY(PROP_COLOR, properties.getColor()); APPEND_ENTITY_PROPERTY(PROP_COLOR_SPREAD, properties.getColorSpread()); APPEND_ENTITY_PROPERTY(PROP_COLOR_START, properties.getColorStart()); APPEND_ENTITY_PROPERTY(PROP_COLOR_FINISH, properties.getColorFinish()); - APPEND_ENTITY_PROPERTY(PROP_ALPHA, properties.getAlpha()); APPEND_ENTITY_PROPERTY(PROP_ALPHA_SPREAD, properties.getAlphaSpread()); APPEND_ENTITY_PROPERTY(PROP_ALPHA_START, properties.getAlphaStart()); APPEND_ENTITY_PROPERTY(PROP_ALPHA_FINISH, properties.getAlphaFinish()); - APPEND_ENTITY_PROPERTY(PROP_TEXTURES, properties.getTextures()); APPEND_ENTITY_PROPERTY(PROP_EMITTER_SHOULD_TRAIL, properties.getEmitterShouldTrail()); APPEND_ENTITY_PROPERTY(PROP_PARTICLE_SPIN, properties.getParticleSpin()); @@ -2703,7 +2839,50 @@ OctreeElement::AppendState EntityItemProperties::encodeEntityEditPacket(PacketTy APPEND_ENTITY_PROPERTY(PROP_PARTICLE_ROTATE_WITH_ENTITY, properties.getRotateWithEntity()) } + if (properties.getType() == EntityTypes::Model) { + APPEND_ENTITY_PROPERTY(PROP_SHAPE_TYPE, (uint32_t)(properties.getShapeType())); + APPEND_ENTITY_PROPERTY(PROP_COMPOUND_SHAPE_URL, properties.getCompoundShapeURL()); + APPEND_ENTITY_PROPERTY(PROP_COLOR, properties.getColor()); + APPEND_ENTITY_PROPERTY(PROP_TEXTURES, properties.getTextures()); + + APPEND_ENTITY_PROPERTY(PROP_MODEL_URL, properties.getModelURL()); + APPEND_ENTITY_PROPERTY(PROP_JOINT_ROTATIONS_SET, properties.getJointRotationsSet()); + APPEND_ENTITY_PROPERTY(PROP_JOINT_ROTATIONS, properties.getJointRotations()); + APPEND_ENTITY_PROPERTY(PROP_JOINT_TRANSLATIONS_SET, properties.getJointTranslationsSet()); + APPEND_ENTITY_PROPERTY(PROP_JOINT_TRANSLATIONS, properties.getJointTranslations()); + APPEND_ENTITY_PROPERTY(PROP_RELAY_PARENT_JOINTS, properties.getRelayParentJoints()); + + _staticAnimation.setProperties(properties); + _staticAnimation.appendToEditPacket(packetData, requestedProperties, propertyFlags, propertiesDidntFit, propertyCount, appendState); + } + + if (properties.getType() == EntityTypes::Light) { + APPEND_ENTITY_PROPERTY(PROP_COLOR, properties.getColor()); + APPEND_ENTITY_PROPERTY(PROP_IS_SPOTLIGHT, properties.getIsSpotlight()); + APPEND_ENTITY_PROPERTY(PROP_INTENSITY, properties.getIntensity()); + APPEND_ENTITY_PROPERTY(PROP_EXPONENT, properties.getExponent()); + APPEND_ENTITY_PROPERTY(PROP_CUTOFF, properties.getCutoff()); + APPEND_ENTITY_PROPERTY(PROP_FALLOFF_RADIUS, properties.getFalloffRadius()); + } + + if (properties.getType() == EntityTypes::Text) { + APPEND_ENTITY_PROPERTY(PROP_TEXT, properties.getText()); + APPEND_ENTITY_PROPERTY(PROP_LINE_HEIGHT, properties.getLineHeight()); + APPEND_ENTITY_PROPERTY(PROP_TEXT_COLOR, properties.getTextColor()); + APPEND_ENTITY_PROPERTY(PROP_TEXT_ALPHA, properties.getTextAlpha()); + APPEND_ENTITY_PROPERTY(PROP_BACKGROUND_COLOR, properties.getBackgroundColor()); + APPEND_ENTITY_PROPERTY(PROP_BACKGROUND_ALPHA, properties.getBackgroundAlpha()); + APPEND_ENTITY_PROPERTY(PROP_BILLBOARD_MODE, (uint32_t)properties.getBillboardMode()); + APPEND_ENTITY_PROPERTY(PROP_LEFT_MARGIN, properties.getLeftMargin()); + APPEND_ENTITY_PROPERTY(PROP_RIGHT_MARGIN, properties.getRightMargin()); + APPEND_ENTITY_PROPERTY(PROP_TOP_MARGIN, properties.getTopMargin()); + APPEND_ENTITY_PROPERTY(PROP_BOTTOM_MARGIN, properties.getBottomMargin()); + } + if (properties.getType() == EntityTypes::Zone) { + APPEND_ENTITY_PROPERTY(PROP_SHAPE_TYPE, (uint32_t)properties.getShapeType()); + APPEND_ENTITY_PROPERTY(PROP_COMPOUND_SHAPE_URL, properties.getCompoundShapeURL()); + _staticKeyLight.setProperties(properties); _staticKeyLight.appendToEditPacket(packetData, requestedProperties, propertyFlags, propertiesDidntFit, propertyCount, appendState); @@ -2719,9 +2898,6 @@ OctreeElement::AppendState EntityItemProperties::encodeEntityEditPacket(PacketTy _staticBloom.setProperties(properties); _staticBloom.appendToEditPacket(packetData, requestedProperties, propertyFlags, propertiesDidntFit, propertyCount, appendState); - APPEND_ENTITY_PROPERTY(PROP_SHAPE_TYPE, (uint32_t)properties.getShapeType()); - APPEND_ENTITY_PROPERTY(PROP_COMPOUND_SHAPE_URL, properties.getCompoundShapeURL()); - APPEND_ENTITY_PROPERTY(PROP_FLYING_ALLOWED, properties.getFlyingAllowed()); APPEND_ENTITY_PROPERTY(PROP_GHOSTING_ALLOWED, properties.getGhostingAllowed()); APPEND_ENTITY_PROPERTY(PROP_FILTER_URL, properties.getFilterURL()); @@ -2748,30 +2924,36 @@ OctreeElement::AppendState EntityItemProperties::encodeEntityEditPacket(PacketTy APPEND_ENTITY_PROPERTY(PROP_Z_P_NEIGHBOR_ID, properties.getZPNeighborID()); } + if (properties.getType() == EntityTypes::Web) { + APPEND_ENTITY_PROPERTY(PROP_SOURCE_URL, properties.getSourceUrl()); + APPEND_ENTITY_PROPERTY(PROP_DPI, properties.getDPI()); + } + if (properties.getType() == EntityTypes::Line) { APPEND_ENTITY_PROPERTY(PROP_COLOR, properties.getColor()); - APPEND_ENTITY_PROPERTY(PROP_LINE_WIDTH, properties.getLineWidth()); + APPEND_ENTITY_PROPERTY(PROP_LINE_POINTS, properties.getLinePoints()); } if (properties.getType() == EntityTypes::PolyLine) { APPEND_ENTITY_PROPERTY(PROP_COLOR, properties.getColor()); - APPEND_ENTITY_PROPERTY(PROP_LINE_WIDTH, properties.getLineWidth()); - APPEND_ENTITY_PROPERTY(PROP_LINE_POINTS, properties.getLinePoints()); - APPEND_ENTITY_PROPERTY(PROP_NORMALS, properties.getPackedNormals()); - APPEND_ENTITY_PROPERTY(PROP_STROKE_COLORS, properties.getPackedStrokeColors()); - APPEND_ENTITY_PROPERTY(PROP_STROKE_WIDTHS, properties.getStrokeWidths()); APPEND_ENTITY_PROPERTY(PROP_TEXTURES, properties.getTextures()); + + APPEND_ENTITY_PROPERTY(PROP_LINE_POINTS, properties.getLinePoints()); + APPEND_ENTITY_PROPERTY(PROP_STROKE_WIDTHS, properties.getStrokeWidths()); + APPEND_ENTITY_PROPERTY(PROP_STROKE_NORMALS, properties.getPackedNormals()); + APPEND_ENTITY_PROPERTY(PROP_STROKE_COLORS, properties.getPackedStrokeColors()); APPEND_ENTITY_PROPERTY(PROP_IS_UV_MODE_STRETCH, properties.getIsUVModeStretch()); } + // NOTE: Spheres and Boxes are just special cases of Shape, and they need to include their PROP_SHAPE // when encoding/decoding edits because otherwise they can't polymorph to other shape types if (properties.getType() == EntityTypes::Shape || properties.getType() == EntityTypes::Box || properties.getType() == EntityTypes::Sphere) { - APPEND_ENTITY_PROPERTY(PROP_SHAPE, properties.getShape()); APPEND_ENTITY_PROPERTY(PROP_COLOR, properties.getColor()); APPEND_ENTITY_PROPERTY(PROP_ALPHA, properties.getAlpha()); + APPEND_ENTITY_PROPERTY(PROP_SHAPE, properties.getShape()); } // Materials @@ -2789,14 +2971,14 @@ OctreeElement::AppendState EntityItemProperties::encodeEntityEditPacket(PacketTy // Image if (properties.getType() == EntityTypes::Image) { + APPEND_ENTITY_PROPERTY(PROP_COLOR, properties.getColor()); + APPEND_ENTITY_PROPERTY(PROP_ALPHA, properties.getAlpha()); + APPEND_ENTITY_PROPERTY(PROP_IMAGE_URL, properties.getImageURL()); APPEND_ENTITY_PROPERTY(PROP_EMISSIVE, properties.getEmissive()); APPEND_ENTITY_PROPERTY(PROP_KEEP_ASPECT_RATIO, properties.getKeepAspectRatio()); APPEND_ENTITY_PROPERTY(PROP_BILLBOARD_MODE, (uint32_t)properties.getBillboardMode()); APPEND_ENTITY_PROPERTY(PROP_SUB_IMAGE, properties.getSubImage()); - - APPEND_ENTITY_PROPERTY(PROP_COLOR, properties.getColor()); - APPEND_ENTITY_PROPERTY(PROP_ALPHA, properties.getAlpha()); } // Grid @@ -2808,33 +2990,6 @@ OctreeElement::AppendState EntityItemProperties::encodeEntityEditPacket(PacketTy APPEND_ENTITY_PROPERTY(PROP_MAJOR_GRID_EVERY, properties.getMajorGridEvery()); APPEND_ENTITY_PROPERTY(PROP_MINOR_GRID_EVERY, properties.getMinorGridEvery()); } - - APPEND_ENTITY_PROPERTY(PROP_NAME, properties.getName()); - APPEND_ENTITY_PROPERTY(PROP_COLLISION_SOUND_URL, properties.getCollisionSoundURL()); - APPEND_ENTITY_PROPERTY(PROP_ACTION_DATA, properties.getActionData()); - - // Certifiable Properties - APPEND_ENTITY_PROPERTY(PROP_ITEM_NAME, properties.getItemName()); - APPEND_ENTITY_PROPERTY(PROP_ITEM_DESCRIPTION, properties.getItemDescription()); - APPEND_ENTITY_PROPERTY(PROP_ITEM_CATEGORIES, properties.getItemCategories()); - APPEND_ENTITY_PROPERTY(PROP_ITEM_ARTIST, properties.getItemArtist()); - APPEND_ENTITY_PROPERTY(PROP_ITEM_LICENSE, properties.getItemLicense()); - APPEND_ENTITY_PROPERTY(PROP_LIMITED_RUN, properties.getLimitedRun()); - APPEND_ENTITY_PROPERTY(PROP_MARKETPLACE_ID, properties.getMarketplaceID()); - APPEND_ENTITY_PROPERTY(PROP_EDITION_NUMBER, properties.getEditionNumber()); - APPEND_ENTITY_PROPERTY(PROP_ENTITY_INSTANCE_NUMBER, properties.getEntityInstanceNumber()); - APPEND_ENTITY_PROPERTY(PROP_CERTIFICATE_ID, properties.getCertificateID()); - APPEND_ENTITY_PROPERTY(PROP_STATIC_CERTIFICATE_VERSION, properties.getStaticCertificateVersion()); - - APPEND_ENTITY_PROPERTY(PROP_CLONEABLE, properties.getCloneable()); - APPEND_ENTITY_PROPERTY(PROP_CLONE_LIFETIME, properties.getCloneLifetime()); - APPEND_ENTITY_PROPERTY(PROP_CLONE_LIMIT, properties.getCloneLimit()); - APPEND_ENTITY_PROPERTY(PROP_CLONE_DYNAMIC, properties.getCloneDynamic()); - APPEND_ENTITY_PROPERTY(PROP_CLONE_AVATAR_ENTITY, properties.getCloneAvatarEntity()); - - _staticGrab.setProperties(properties); - _staticGrab.appendToEditPacket(packetData, requestedProperties, propertyFlags, - propertiesDidntFit, propertyCount, appendState); } if (propertyCount > 0) { @@ -3014,76 +3169,77 @@ bool EntityItemProperties::decodeEntityEditPacket(const unsigned char* data, int processedBytes += propertyFlags.getEncodedLength(); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_SIMULATION_OWNER, QByteArray, setSimulationOwner); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_POSITION, vec3, setPosition); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_DIMENSIONS, vec3, setDimensions); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ROTATION, quat, setRotation); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_DENSITY, float, setDensity); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_VELOCITY, vec3, setVelocity); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_GRAVITY, vec3, setGravity); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ACCELERATION, vec3, setAcceleration); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_DAMPING, float, setDamping); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_RESTITUTION, float, setRestitution); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_FRICTION, float, setFriction); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LIFETIME, float, setLifetime); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_SCRIPT, QString, setScript); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_SCRIPT_TIMESTAMP, quint64, setScriptTimestamp); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_SERVER_SCRIPTS, QString, setServerScripts); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_REGISTRATION_POINT, vec3, setRegistrationPoint); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ANGULAR_VELOCITY, vec3, setAngularVelocity); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ANGULAR_DAMPING, float, setAngularDamping); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_VISIBLE, bool, setVisible); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_CAN_CAST_SHADOW, bool, setCanCastShadow); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLLISIONLESS, bool, setCollisionless); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLLISION_MASK, uint16_t, setCollisionMask); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_DYNAMIC, bool, setDynamic); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_NAME, QString, setName); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LOCKED, bool, setLocked); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_USER_DATA, QString, setUserData); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_HREF, QString, setHref); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_DESCRIPTION, QString, setDescription); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_POSITION, vec3, setPosition); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_DIMENSIONS, vec3, setDimensions); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ROTATION, quat, setRotation); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_REGISTRATION_POINT, vec3, setRegistrationPoint); + // FIXME: deal with these + // READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_CREATED, quint64, setCreated); + // READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LAST_EDITED_BY, QUuid, setLastEditedBy); + // READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ENTITY_HOST_TYPE, entity::HostType, setEntityHostType); + // READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_OWNING_AVATAR_ID, QUuid, setOwningAvatarID); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_PARENT_ID, QUuid, setParentID); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_PARENT_JOINT_INDEX, quint16, setParentJointIndex); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_QUERY_AA_CUBE, AACube, setQueryAACube); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_CAN_CAST_SHADOW, bool, setCanCastShadow); + // READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_VISIBLE_IN_SECONDARY_CAMERA, bool, setIsVisibleInSecondaryCamera); // Not sent over the wire + properties.getGrab().decodeFromEditPacket(propertyFlags, dataAt, processedBytes); - if (properties.getType() == EntityTypes::Web) { - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_SOURCE_URL, QString, setSourceUrl); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_DPI, uint16_t, setDPI); - } + // Physics + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_DENSITY, float, setDensity); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_VELOCITY, vec3, setVelocity); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ANGULAR_VELOCITY, vec3, setAngularVelocity); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_GRAVITY, vec3, setGravity); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ACCELERATION, vec3, setAcceleration); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_DAMPING, float, setDamping); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ANGULAR_DAMPING, float, setAngularDamping); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_RESTITUTION, float, setRestitution); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_FRICTION, float, setFriction); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LIFETIME, float, setLifetime); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLLISIONLESS, bool, setCollisionless); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLLISION_MASK, uint16_t, setCollisionMask); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_DYNAMIC, bool, setDynamic); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLLISION_SOUND_URL, QString, setCollisionSoundURL); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ACTION_DATA, QByteArray, setActionData); - if (properties.getType() == EntityTypes::Text) { - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_TEXT, QString, setText); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LINE_HEIGHT, float, setLineHeight); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_TEXT_COLOR, u8vec3Color, setTextColor); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_BACKGROUND_COLOR, u8vec3Color, setBackgroundColor); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_BILLBOARD_MODE, BillboardMode, setBillboardMode); - } + // Cloning + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_CLONEABLE, bool, setCloneable); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_CLONE_LIFETIME, float, setCloneLifetime); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_CLONE_LIMIT, float, setCloneLimit); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_CLONE_DYNAMIC, bool, setCloneDynamic); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_CLONE_AVATAR_ENTITY, bool, setCloneAvatarEntity); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_CLONE_ORIGIN_ID, QUuid, setCloneOriginID); - if (properties.getType() == EntityTypes::Model) { - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLOR, u8vec3Color, setColor); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_MODEL_URL, QString, setModelURL); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COMPOUND_SHAPE_URL, QString, setCompoundShapeURL); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_TEXTURES, QString, setTextures); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_SHAPE_TYPE, ShapeType, setShapeType); + // Scripts + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_SCRIPT, QString, setScript); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_SCRIPT_TIMESTAMP, quint64, setScriptTimestamp); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_SERVER_SCRIPTS, QString, setServerScripts); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_JOINT_ROTATIONS_SET, QVector, setJointRotationsSet); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_JOINT_ROTATIONS, QVector, setJointRotations); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_JOINT_TRANSLATIONS_SET, QVector, setJointTranslationsSet); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_JOINT_TRANSLATIONS, QVector, setJointTranslations); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_RELAY_PARENT_JOINTS, bool, setRelayParentJoints); - - properties.getAnimation().decodeFromEditPacket(propertyFlags, dataAt, processedBytes); - } - - if (properties.getType() == EntityTypes::Light) { - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_IS_SPOTLIGHT, bool, setIsSpotlight); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLOR, u8vec3Color, setColor); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_INTENSITY, float, setIntensity); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_EXPONENT, float, setExponent); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_CUTOFF, float, setCutoff); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_FALLOFF_RADIUS, float, setFalloffRadius); - } + // Certifiable Properties + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ITEM_NAME, QString, setItemName); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ITEM_DESCRIPTION, QString, setItemDescription); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ITEM_CATEGORIES, QString, setItemCategories); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ITEM_ARTIST, QString, setItemArtist); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ITEM_LICENSE, QString, setItemLicense); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LIMITED_RUN, quint32, setLimitedRun); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_MARKETPLACE_ID, QString, setMarketplaceID); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_EDITION_NUMBER, quint32, setEditionNumber); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ENTITY_INSTANCE_NUMBER, quint32, setEntityInstanceNumber); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_CERTIFICATE_ID, QString, setCertificateID); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_STATIC_CERTIFICATE_VERSION, quint32, setStaticCertificateVersion); if (properties.getType() == EntityTypes::ParticleEffect) { READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_SHAPE_TYPE, ShapeType, setShapeType); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLOR, u8vec3Color, setColor); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ALPHA, float, setAlpha); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_TEXTURES, QString, setTextures); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_MAX_PARTICLES, quint32, setMaxParticles); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LIFESPAN, float, setLifespan); @@ -3108,17 +3264,14 @@ bool EntityItemProperties::decodeEntityEditPacket(const unsigned char* data, int READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_RADIUS_START, float, setRadiusStart); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_RADIUS_FINISH, float, setRadiusFinish); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLOR, u8vec3Color, setColor); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLOR_SPREAD, u8vec3Color, setColorSpread); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLOR_START, vec3Color, setColorStart); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLOR_FINISH, vec3Color, setColorFinish); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ALPHA, float, setAlpha); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ALPHA_SPREAD, float, setAlphaSpread); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ALPHA_START, float, setAlphaStart); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ALPHA_FINISH, float, setAlphaFinish); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_TEXTURES, QString, setTextures); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_EMITTER_SHOULD_TRAIL, bool, setEmitterShouldTrail); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_PARTICLE_SPIN, float, setParticleSpin); @@ -3128,16 +3281,56 @@ bool EntityItemProperties::decodeEntityEditPacket(const unsigned char* data, int READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_PARTICLE_ROTATE_WITH_ENTITY, bool, setRotateWithEntity); } + if (properties.getType() == EntityTypes::Model) { + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_SHAPE_TYPE, ShapeType, setShapeType); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COMPOUND_SHAPE_URL, QString, setCompoundShapeURL); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLOR, u8vec3Color, setColor); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_TEXTURES, QString, setTextures); + + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_MODEL_URL, QString, setModelURL); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_JOINT_ROTATIONS_SET, QVector, setJointRotationsSet); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_JOINT_ROTATIONS, QVector, setJointRotations); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_JOINT_TRANSLATIONS_SET, QVector, setJointTranslationsSet); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_JOINT_TRANSLATIONS, QVector, setJointTranslations); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_RELAY_PARENT_JOINTS, bool, setRelayParentJoints); + + properties.getAnimation().decodeFromEditPacket(propertyFlags, dataAt, processedBytes); + } + + if (properties.getType() == EntityTypes::Light) { + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLOR, u8vec3Color, setColor); + + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_IS_SPOTLIGHT, bool, setIsSpotlight); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_INTENSITY, float, setIntensity); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_EXPONENT, float, setExponent); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_CUTOFF, float, setCutoff); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_FALLOFF_RADIUS, float, setFalloffRadius); + } + + if (properties.getType() == EntityTypes::Text) { + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_TEXT, QString, setText); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LINE_HEIGHT, float, setLineHeight); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_TEXT_COLOR, u8vec3Color, setTextColor); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_TEXT_ALPHA, float, setTextAlpha); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_BACKGROUND_COLOR, u8vec3Color, setBackgroundColor); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_BACKGROUND_ALPHA, float, setBackgroundAlpha); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_BILLBOARD_MODE, BillboardMode, setBillboardMode); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LEFT_MARGIN, float, setLeftMargin); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_RIGHT_MARGIN, float, setRightMargin); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_TOP_MARGIN, float, setTopMargin); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_BOTTOM_MARGIN, float, setBottomMargin); + } + if (properties.getType() == EntityTypes::Zone) { + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_SHAPE_TYPE, ShapeType, setShapeType); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COMPOUND_SHAPE_URL, QString, setCompoundShapeURL); + properties.getKeyLight().decodeFromEditPacket(propertyFlags, dataAt, processedBytes); properties.getAmbientLight().decodeFromEditPacket(propertyFlags, dataAt, processedBytes); properties.getSkybox().decodeFromEditPacket(propertyFlags, dataAt, processedBytes); properties.getHaze().decodeFromEditPacket(propertyFlags, dataAt, processedBytes); properties.getBloom().decodeFromEditPacket(propertyFlags, dataAt, processedBytes); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_SHAPE_TYPE, ShapeType, setShapeType); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COMPOUND_SHAPE_URL, QString, setCompoundShapeURL); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_FLYING_ALLOWED, bool, setFlyingAllowed); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_GHOSTING_ALLOWED, bool, setGhostingAllowed); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_FILTER_URL, QString, setFilterURL); @@ -3164,21 +3357,25 @@ bool EntityItemProperties::decodeEntityEditPacket(const unsigned char* data, int READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_Z_P_NEIGHBOR_ID, EntityItemID, setZPNeighborID); } + if (properties.getType() == EntityTypes::Web) { + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_SOURCE_URL, QString, setSourceUrl); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_DPI, uint16_t, setDPI); + } + if (properties.getType() == EntityTypes::Line) { READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLOR, u8vec3Color, setColor); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LINE_WIDTH, float, setLineWidth); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LINE_POINTS, QVector, setLinePoints); } - if (properties.getType() == EntityTypes::PolyLine) { READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLOR, u8vec3Color, setColor); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LINE_WIDTH, float, setLineWidth); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LINE_POINTS, QVector, setLinePoints); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_NORMALS, QByteArray, setPackedNormals); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_STROKE_COLORS, QByteArray, setPackedStrokeColors); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_STROKE_WIDTHS, QVector, setStrokeWidths); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_TEXTURES, QString, setTextures); + + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LINE_POINTS, QVector, setLinePoints); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_STROKE_WIDTHS, QVector, setStrokeWidths); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_STROKE_NORMALS, QByteArray, setPackedNormals); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_STROKE_COLORS, QByteArray, setPackedStrokeColors); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_IS_UV_MODE_STRETCH, bool, setIsUVModeStretch); } @@ -3187,9 +3384,9 @@ bool EntityItemProperties::decodeEntityEditPacket(const unsigned char* data, int if (properties.getType() == EntityTypes::Shape || properties.getType() == EntityTypes::Box || properties.getType() == EntityTypes::Sphere) { - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_SHAPE, QString, setShape); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLOR, u8vec3Color, setColor); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ALPHA, float, setAlpha); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_SHAPE, QString, setShape); } // Materials @@ -3207,14 +3404,14 @@ bool EntityItemProperties::decodeEntityEditPacket(const unsigned char* data, int // Image if (properties.getType() == EntityTypes::Image) { + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLOR, u8vec3Color, setColor); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ALPHA, float, setAlpha); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_IMAGE_URL, QString, setImageURL); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_EMISSIVE, bool, setEmissive); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_KEEP_ASPECT_RATIO, bool, setKeepAspectRatio); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_BILLBOARD_MODE, BillboardMode, setBillboardMode); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_SUB_IMAGE, QRect, setSubImage); - - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLOR, u8vec3Color, setColor); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ALPHA, float, setAlpha); } // Grid @@ -3227,31 +3424,6 @@ bool EntityItemProperties::decodeEntityEditPacket(const unsigned char* data, int READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_MINOR_GRID_EVERY, float, setMinorGridEvery); } - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_NAME, QString, setName); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLLISION_SOUND_URL, QString, setCollisionSoundURL); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ACTION_DATA, QByteArray, setActionData); - - // Certifiable Properties - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ITEM_NAME, QString, setItemName); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ITEM_DESCRIPTION, QString, setItemDescription); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ITEM_CATEGORIES, QString, setItemCategories); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ITEM_ARTIST, QString, setItemArtist); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ITEM_LICENSE, QString, setItemLicense); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LIMITED_RUN, quint32, setLimitedRun); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_MARKETPLACE_ID, QString, setMarketplaceID); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_EDITION_NUMBER, quint32, setEditionNumber); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ENTITY_INSTANCE_NUMBER, quint32, setEntityInstanceNumber); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_CERTIFICATE_ID, QString, setCertificateID); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_STATIC_CERTIFICATE_VERSION, quint32, setStaticCertificateVersion); - - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_CLONEABLE, bool, setCloneable); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_CLONE_LIFETIME, float, setCloneLifetime); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_CLONE_LIMIT, float, setCloneLimit); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_CLONE_DYNAMIC, bool, setCloneDynamic); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_CLONE_AVATAR_ENTITY, bool, setCloneAvatarEntity); - - properties.getGrab().decodeFromEditPacket(propertyFlags, dataAt, processedBytes); - return valid; } @@ -3376,94 +3548,58 @@ bool EntityItemProperties::decodeCloneEntityMessage(const QByteArray& buffer, in } void EntityItemProperties::markAllChanged() { - _lastEditedByChanged = true; + // Core _simulationOwnerChanged = true; + _visibleChanged = true; + _nameChanged = true; + _lockedChanged = true; + _userDataChanged = true; + _hrefChanged = true; + _descriptionChanged = true; _positionChanged = true; _dimensionsChanged = true; _rotationChanged = true; + _registrationPointChanged = true; + _createdChanged = true; + _lastEditedByChanged = true; + _entityHostTypeChanged = true; + _owningAvatarIDChanged = true; + _parentIDChanged = true; + _parentJointIndexChanged = true; + _queryAACubeChanged = true; + _canCastShadowChanged = true; + _isVisibleInSecondaryCameraChanged = true; + _grab.markAllChanged(); + + // Physics _densityChanged = true; _velocityChanged = true; + _angularVelocityChanged = true; _gravityChanged = true; _accelerationChanged = true; _dampingChanged = true; + _angularDampingChanged = true; _restitutionChanged = true; _frictionChanged = true; _lifetimeChanged = true; - _userDataChanged = true; - _scriptChanged = true; - _scriptTimestampChanged = true; - _serverScriptsChanged = true; - _collisionSoundURLChanged = true; - _registrationPointChanged = true; - _angularVelocityChanged = true; - _angularDampingChanged = true; - _nameChanged = true; - _visibleChanged = true; - _canCastShadowChanged = true; - _colorChanged = true; - _alphaChanged = true; - _modelURLChanged = true; - _compoundShapeURLChanged = true; - _localRenderAlphaChanged = true; - _isSpotlightChanged = true; _collisionlessChanged = true; _collisionMaskChanged = true; _dynamicChanged = true; + _collisionSoundURLChanged = true; + _actionDataChanged = true; - _intensityChanged = true; - _falloffRadiusChanged = true; - _exponentChanged = true; - _cutoffChanged = true; - _lockedChanged = true; - _texturesChanged = true; + // Cloning + _cloneableChanged = true; + _cloneLifetimeChanged = true; + _cloneLimitChanged = true; + _cloneDynamicChanged = true; + _cloneAvatarEntityChanged = true; + _cloneOriginIDChanged = true; - _textChanged = true; - _lineHeightChanged = true; - _textColorChanged = true; - _backgroundColorChanged = true; - _shapeTypeChanged = true; - - _isEmittingChanged = true; - _emitterShouldTrailChanged = true; - _maxParticlesChanged = true; - _lifespanChanged = true; - _emitRateChanged = true; - _emitSpeedChanged = true; - _speedSpreadChanged = true; - _emitOrientationChanged = true; - _emitDimensionsChanged = true; - _emitRadiusStartChanged = true; - _polarStartChanged = true; - _polarFinishChanged = true; - _azimuthStartChanged = true; - _azimuthFinishChanged = true; - _emitAccelerationChanged = true; - _accelerationSpreadChanged = true; - _particleRadiusChanged = true; - _radiusSpreadChanged = true; - _colorSpreadChanged = true; - _alphaSpreadChanged = true; - _radiusStartChanged = true; - _radiusFinishChanged = true; - _colorStartChanged = true; - _colorFinishChanged = true; - _alphaStartChanged = true; - _alphaFinishChanged = true; - _particleSpinChanged = true; - _spinStartChanged = true; - _spinFinishChanged = true; - _spinSpreadChanged = true; - _rotateWithEntityChanged = true; - - _materialURLChanged = true; - _materialMappingModeChanged = true; - _priorityChanged = true; - _parentMaterialNameChanged = true; - _materialMappingPosChanged = true; - _materialMappingScaleChanged = true; - _materialMappingRotChanged = true; - _materialDataChanged = true; - _materialRepeatChanged = true; + // Scripts + _scriptChanged = true; + _scriptTimestampChanged = true; + _serverScriptsChanged = true; // Certifiable Properties _itemNameChanged = true; @@ -3478,88 +3614,136 @@ void EntityItemProperties::markAllChanged() { _certificateIDChanged = true; _staticCertificateVersionChanged = true; - _keyLight.markAllChanged(); - _ambientLight.markAllChanged(); - _skybox.markAllChanged(); + // Common + _shapeTypeChanged = true; + _colorChanged = true; + _alphaChanged = true; + _texturesChanged = true; + _compoundShapeURLChanged = true; - _keyLightModeChanged = true; - _skyboxModeChanged = true; - _ambientLightModeChanged = true; - _hazeModeChanged = true; - _bloomModeChanged = true; - - _animation.markAllChanged(); - _skybox.markAllChanged(); - _haze.markAllChanged(); - _bloom.markAllChanged(); - _grab.markAllChanged(); - - _sourceUrlChanged = true; - _voxelVolumeSizeChanged = true; - _voxelDataChanged = true; - _voxelSurfaceStyleChanged = true; - - _lineWidthChanged = true; - _linePointsChanged = true; - - _hrefChanged = true; - _descriptionChanged = true; - _billboardModeChanged = true; - _actionDataChanged = true; - - _normalsChanged = true; - _strokeColorsChanged = true; - _strokeWidthsChanged = true; - _isUVModeStretchChanged = true; - - _xTextureURLChanged = true; - _yTextureURLChanged = true; - _zTextureURLChanged = true; - - _xNNeighborIDChanged = true; - _yNNeighborIDChanged = true; - _zNNeighborIDChanged = true; - - _xPNeighborIDChanged = true; - _yPNeighborIDChanged = true; - _zPNeighborIDChanged = true; - - _parentIDChanged = true; - _parentJointIndexChanged = true; + // Particles + _maxParticlesChanged = true; + _lifespanChanged = true; + _isEmittingChanged = true; + _emitRateChanged = true; + _emitSpeedChanged = true; + _speedSpreadChanged = true; + _emitOrientationChanged = true; + _emitDimensionsChanged = true; + _emitRadiusStartChanged = true; + _polarStartChanged = true; + _polarFinishChanged = true; + _azimuthStartChanged = true; + _azimuthFinishChanged = true; + _emitAccelerationChanged = true; + _accelerationSpreadChanged = true; + _particleRadiusChanged = true; + _radiusSpreadChanged = true; + _radiusStartChanged = true; + _radiusFinishChanged = true; + _colorSpreadChanged = true; + _colorStartChanged = true; + _colorFinishChanged = true; + _alphaSpreadChanged = true; + _alphaStartChanged = true; + _alphaFinishChanged = true; + _emitterShouldTrailChanged = true; + _particleSpinChanged = true; + _spinStartChanged = true; + _spinFinishChanged = true; + _spinSpreadChanged = true; + _rotateWithEntityChanged = true; + // Model + _modelURLChanged = true; _jointRotationsSetChanged = true; _jointRotationsChanged = true; _jointTranslationsSetChanged = true; _jointTranslationsChanged = true; + _relayParentJointsChanged = true; + _animation.markAllChanged(); - _queryAACubeChanged = true; + // Light + _isSpotlightChanged = true; + _intensityChanged = true; + _exponentChanged = true; + _cutoffChanged = true; + _falloffRadiusChanged = true; - _shapeChanged = true; + // Text + _textChanged = true; + _lineHeightChanged = true; + _textColorChanged = true; + _textAlphaChanged = true; + _backgroundColorChanged = true; + _backgroundAlphaChanged = true; + _billboardModeChanged = true; + _leftMarginChanged = true; + _rightMarginChanged = true; + _topMarginChanged = true; + _bottomMarginChanged = true; + // Zone + _keyLight.markAllChanged(); + _ambientLight.markAllChanged(); + _skybox.markAllChanged(); + _haze.markAllChanged(); + _bloom.markAllChanged(); _flyingAllowedChanged = true; _ghostingAllowedChanged = true; _filterURLChanged = true; + _keyLightModeChanged = true; + _ambientLightModeChanged = true; + _skyboxModeChanged = true; + _hazeModeChanged = true; + _bloomModeChanged = true; - _entityHostTypeChanged = true; - _owningAvatarIDChanged = true; + // Polyvox + _voxelVolumeSizeChanged = true; + _voxelDataChanged = true; + _voxelSurfaceStyleChanged = true; + _xTextureURLChanged = true; + _yTextureURLChanged = true; + _zTextureURLChanged = true; + _xNNeighborIDChanged = true; + _yNNeighborIDChanged = true; + _zNNeighborIDChanged = true; + _xPNeighborIDChanged = true; + _yPNeighborIDChanged = true; + _zPNeighborIDChanged = true; + // Web + _sourceUrlChanged = true; _dpiChanged = true; - _relayParentJointsChanged = true; - _cloneableChanged = true; - _cloneLifetimeChanged = true; - _cloneLimitChanged = true; - _cloneDynamicChanged = true; - _cloneAvatarEntityChanged = true; - _cloneOriginIDChanged = true; + // Polyline + _linePointsChanged = true; + _strokeWidthsChanged = true; + _normalsChanged = true; + _strokeColorsChanged = true; + _isUVModeStretchChanged = true; - _isVisibleInSecondaryCameraChanged = true; + // Shape + _shapeChanged = true; + // Material + _materialURLChanged = true; + _materialMappingModeChanged = true; + _priorityChanged = true; + _parentMaterialNameChanged = true; + _materialMappingPosChanged = true; + _materialMappingScaleChanged = true; + _materialMappingRotChanged = true; + _materialDataChanged = true; + _materialRepeatChanged = true; + + // Image _imageURLChanged = true; _emissiveChanged = true; _keepAspectRatioChanged = true; _subImageChanged = true; + // Grid _followCameraChanged = true; _majorGridEveryChanged = true; _minorGridEveryChanged = true; @@ -3590,6 +3774,18 @@ bool EntityItemProperties::hasTransformOrVelocityChanges() const { || _accelerationChanged; } +void EntityItemProperties::clearTransformOrVelocityChanges() { + _positionChanged = false; + _localPositionChanged = false; + _rotationChanged = false; + _localRotationChanged = false; + _velocityChanged = false; + _localVelocityChanged = false; + _angularVelocityChanged = false; + _localAngularVelocityChanged = false; + _accelerationChanged = false; +} + bool EntityItemProperties::hasMiscPhysicsChanges() const { return _gravityChanged || _dimensionsChanged || _densityChanged || _frictionChanged || _restitutionChanged || _dampingChanged || _angularDampingChanged || _registrationPointChanged || @@ -3600,6 +3796,7 @@ bool EntityItemProperties::hasSimulationRestrictedChanges() const { return _positionChanged || _localPositionChanged || _rotationChanged || _localRotationChanged || _velocityChanged || _localVelocityChanged + || _localDimensionsChanged || _dimensionsChanged || _angularVelocityChanged || _localAngularVelocityChanged || _accelerationChanged || _parentIDChanged || _parentJointIndexChanged; @@ -3680,30 +3877,81 @@ uint8_t EntityItemProperties::computeSimulationBidPriority() const { QList EntityItemProperties::listChangedProperties() { QList out; + + // Core + if (simulationOwnerChanged()) { + out += "simulationOwner"; + } + if (visibleChanged()) { + out += "visible"; + } + if (nameChanged()) { + out += "name"; + } + if (lockedChanged()) { + out += "locked"; + } + if (userDataChanged()) { + out += "userData"; + } + if (hrefChanged()) { + out += "href"; + } + if (descriptionChanged()) { + out += "description"; + } if (containsPositionChange()) { out += "position"; } if (dimensionsChanged()) { out += "dimensions"; } - if (velocityChanged()) { - out += "velocity"; + if (rotationChanged()) { + out += "rotation"; } - if (nameChanged()) { - out += "name"; + if (registrationPointChanged()) { + out += "registrationPoint"; } - if (visibleChanged()) { - out += "visible"; + // FIXME: handle these + //if (createdChanged()) { + // out += "created"; + //} + //if (lastEditedByChanged()) { + // out += "lastEditedBy"; + //} + if (entityHostTypeChanged()) { + out += "entityHostType"; + } + if (owningAvatarIDChanged()) { + out += "owningAvatarID"; + } + if (parentIDChanged()) { + out += "parentID"; + } + if (parentJointIndexChanged()) { + out += "parentJointIndex"; + } + if (queryAACubeChanged()) { + out += "queryAACube"; } if (canCastShadowChanged()) { out += "canCastShadow"; } - if (rotationChanged()) { - out += "rotation"; + if (isVisibleInSecondaryCameraChanged()) { + out += "isVisibleInSecondaryCamera"; } + getGrab().listChangedProperties(out); + + // Physics if (densityChanged()) { out += "density"; } + if (velocityChanged()) { + out += "velocity"; + } + if (angularVelocityChanged()) { + out += "angularVelocity"; + } if (gravityChanged()) { out += "gravity"; } @@ -3713,6 +3961,9 @@ QList EntityItemProperties::listChangedProperties() { if (dampingChanged()) { out += "damping"; } + if (angularDampingChanged()) { + out += "angularDamping"; + } if (restitutionChanged()) { out += "restitution"; } @@ -3722,60 +3973,6 @@ QList EntityItemProperties::listChangedProperties() { if (lifetimeChanged()) { out += "lifetime"; } - if (scriptChanged()) { - out += "script"; - } - if (scriptTimestampChanged()) { - out += "scriptTimestamp"; - } - if (serverScriptsChanged()) { - out += "serverScripts"; - } - if (collisionSoundURLChanged()) { - out += "collisionSoundURL"; - } - if (colorChanged()) { - out += "color"; - } - if (colorSpreadChanged()) { - out += "colorSpread"; - } - if (colorStartChanged()) { - out += "colorStart"; - } - if (colorFinishChanged()) { - out += "colorFinish"; - } - if (alphaChanged()) { - out += "alpha"; - } - if (alphaSpreadChanged()) { - out += "alphaSpread"; - } - if (alphaStartChanged()) { - out += "alphaStart"; - } - if (alphaFinishChanged()) { - out += "alphaFinish"; - } - if (emitterShouldTrailChanged()) { - out += "emitterShouldTrail"; - } - if (modelURLChanged()) { - out += "modelURL"; - } - if (compoundShapeURLChanged()) { - out += "compoundShapeURL"; - } - if (registrationPointChanged()) { - out += "registrationPoint"; - } - if (angularVelocityChanged()) { - out += "angularVelocity"; - } - if (angularDampingChanged()) { - out += "angularDamping"; - } if (collisionlessChanged()) { out += "collisionless"; } @@ -3785,48 +3982,97 @@ QList EntityItemProperties::listChangedProperties() { if (dynamicChanged()) { out += "dynamic"; } - if (isSpotlightChanged()) { - out += "isSpotlight"; + if (collisionSoundURLChanged()) { + out += "collisionSoundURL"; } - if (intensityChanged()) { - out += "intensity"; + if (actionDataChanged()) { + out += "actionData"; } - if (falloffRadiusChanged()) { - out += "falloffRadius"; + + // Cloning + if (cloneableChanged()) { + out += "cloneable"; } - if (exponentChanged()) { - out += "exponent"; + if (cloneLifetimeChanged()) { + out += "cloneLifetime"; } - if (cutoffChanged()) { - out += "cutoff"; + if (cloneLimitChanged()) { + out += "cloneLimit"; } - if (lockedChanged()) { - out += "locked"; + if (cloneDynamicChanged()) { + out += "cloneDynamic"; + } + if (cloneAvatarEntityChanged()) { + out += "cloneAvatarEntity"; + } + if (cloneOriginIDChanged()) { + out += "cloneOriginID"; + } + + // Scripts + if (scriptChanged()) { + out += "script"; + } + if (scriptTimestampChanged()) { + out += "scriptTimestamp"; + } + if (serverScriptsChanged()) { + out += "serverScripts"; + } + + // Certifiable Properties + if (itemNameChanged()) { + out += "itemName"; + } + if (itemDescriptionChanged()) { + out += "itemDescription"; + } + if (itemCategoriesChanged()) { + out += "itemCategories"; + } + if (itemArtistChanged()) { + out += "itemArtist"; + } + if (itemLicenseChanged()) { + out += "itemLicense"; + } + if (limitedRunChanged()) { + out += "limitedRun"; + } + if (marketplaceIDChanged()) { + out += "marketplaceID"; + } + if (editionNumberChanged()) { + out += "editionNumber"; + } + if (entityInstanceNumberChanged()) { + out += "entityInstanceNumber"; + } + if (certificateIDChanged()) { + out += "certificateID"; + } + if (staticCertificateVersionChanged()) { + out += "staticCertificateVersion"; + } + + // Common + if (shapeTypeChanged()) { + out += "shapeType"; + } + if (compoundShapeURLChanged()) { + out += "compoundShapeURL"; + } + if (colorChanged()) { + out += "color"; + } + if (alphaChanged()) { + out += "alpha"; } if (texturesChanged()) { out += "textures"; } - if (userDataChanged()) { - out += "userData"; - } - if (simulationOwnerChanged()) { - out += "simulationOwner"; - } - if (textChanged()) { - out += "text"; - } - if (lineHeightChanged()) { - out += "lineHeight"; - } - if (textColorChanged()) { - out += "textColor"; - } - if (backgroundColorChanged()) { - out += "backgroundColor"; - } - if (shapeTypeChanged()) { - out += "shapeType"; - } + + // Particles if (maxParticlesChanged()) { out += "maxParticles"; } @@ -3884,6 +4130,27 @@ QList EntityItemProperties::listChangedProperties() { if (radiusFinishChanged()) { out += "radiusFinish"; } + if (colorSpreadChanged()) { + out += "colorSpread"; + } + if (colorStartChanged()) { + out += "colorStart"; + } + if (colorFinishChanged()) { + out += "colorFinish"; + } + if (alphaSpreadChanged()) { + out += "alphaSpread"; + } + if (alphaStartChanged()) { + out += "alphaStart"; + } + if (alphaFinishChanged()) { + out += "alphaFinish"; + } + if (emitterShouldTrailChanged()) { + out += "emitterShouldTrail"; + } if (particleSpinChanged()) { out += "particleSpin"; } @@ -3899,77 +4166,94 @@ QList EntityItemProperties::listChangedProperties() { if (rotateWithEntityChanged()) { out += "rotateWithEntity"; } - if (materialURLChanged()) { - out += "materialURL"; + + // Model + if (modelURLChanged()) { + out += "modelURL"; } - if (materialMappingModeChanged()) { - out += "materialMappingMode"; + if (jointRotationsSetChanged()) { + out += "jointRotationsSet"; } - if (priorityChanged()) { - out += "priority"; + if (jointRotationsChanged()) { + out += "jointRotations"; } - if (parentMaterialNameChanged()) { - out += "parentMaterialName"; + if (jointTranslationsSetChanged()) { + out += "jointTranslationsSet"; } - if (materialMappingPosChanged()) { - out += "materialMappingPos"; + if (jointTranslationsChanged()) { + out += "jointTranslations"; } - if (materialMappingScaleChanged()) { - out += "materialMappingScale"; + if (relayParentJointsChanged()) { + out += "relayParentJoints"; } - if (materialMappingRotChanged()) { - out += "materialMappingRot"; + getAnimation().listChangedProperties(out); + + // Light + if (isSpotlightChanged()) { + out += "isSpotlight"; } - if (materialDataChanged()) { - out += "materialData"; + if (intensityChanged()) { + out += "intensity"; } - if (materialRepeatChanged()) { - out += "materialRepeat"; + if (exponentChanged()) { + out += "exponent"; } - if (isVisibleInSecondaryCameraChanged()) { - out += "isVisibleInSecondaryCamera"; + if (cutoffChanged()) { + out += "cutoff"; + } + if (falloffRadiusChanged()) { + out += "falloffRadius"; } - // Certifiable Properties - if (itemNameChanged()) { - out += "itemName"; + // Text + if (textChanged()) { + out += "text"; } - if (itemDescriptionChanged()) { - out += "itemDescription"; + if (lineHeightChanged()) { + out += "lineHeight"; } - if (itemCategoriesChanged()) { - out += "itemCategories"; + if (textColorChanged()) { + out += "textColor"; } - if (itemArtistChanged()) { - out += "itemArtist"; + if (textAlphaChanged()) { + out += "textAlpha"; } - if (itemLicenseChanged()) { - out += "itemLicense"; + if (backgroundColorChanged()) { + out += "backgroundColor"; } - if (limitedRunChanged()) { - out += "limitedRun"; + if (backgroundAlphaChanged()) { + out += "backgroundAlpha"; } - if (marketplaceIDChanged()) { - out += "marketplaceID"; + if (billboardModeChanged()) { + out += "billboardMode"; } - if (editionNumberChanged()) { - out += "editionNumber"; + if (leftMarginChanged()) { + out += "leftMargin"; } - if (entityInstanceNumberChanged()) { - out += "entityInstanceNumber"; + if (rightMarginChanged()) { + out += "rightMargin"; } - if (certificateIDChanged()) { - out += "certificateID"; + if (topMarginChanged()) { + out += "topMargin"; } - if (staticCertificateVersionChanged()) { - out += "staticCertificateVersion"; + if (bottomMarginChanged()) { + out += "bottomMargin"; } - if (hazeModeChanged()) { - out += "hazeMode"; + // Zone + getKeyLight().listChangedProperties(out); + getAmbientLight().listChangedProperties(out); + getSkybox().listChangedProperties(out); + getHaze().listChangedProperties(out); + getBloom().listChangedProperties(out); + if (flyingAllowedChanged()) { + out += "flyingAllowed"; } - if (bloomModeChanged()) { - out += "bloomMode"; + if (ghostingAllowedChanged()) { + out += "ghostingAllowed"; + } + if (filterURLChanged()) { + out += "filterURL"; } if (keyLightModeChanged()) { out += "keyLightMode"; @@ -3980,7 +4264,14 @@ QList EntityItemProperties::listChangedProperties() { if (skyboxModeChanged()) { out += "skyboxMode"; } + if (hazeModeChanged()) { + out += "hazeMode"; + } + if (bloomModeChanged()) { + out += "bloomMode"; + } + // Polyvox if (voxelVolumeSizeChanged()) { out += "voxelVolumeSize"; } @@ -3990,15 +4281,6 @@ QList EntityItemProperties::listChangedProperties() { if (voxelSurfaceStyleChanged()) { out += "voxelSurfaceStyle"; } - if (hrefChanged()) { - out += "href"; - } - if (descriptionChanged()) { - out += "description"; - } - if (actionDataChanged()) { - out += "actionData"; - } if (xTextureURLChanged()) { out += "xTextureURL"; } @@ -4026,82 +4308,67 @@ QList EntityItemProperties::listChangedProperties() { if (zPNeighborIDChanged()) { out += "zPNeighborID"; } - if (parentIDChanged()) { - out += "parentID"; - } - if (parentJointIndexChanged()) { - out += "parentJointIndex"; - } - if (jointRotationsSetChanged()) { - out += "jointRotationsSet"; - } - if (jointRotationsChanged()) { - out += "jointRotations"; - } - if (jointTranslationsSetChanged()) { - out += "jointTranslationsSet"; - } - if (jointTranslationsChanged()) { - out += "jointTranslations"; - } - if (relayParentJointsChanged()) { - out += "relayParentJoints"; - } - if (queryAACubeChanged()) { - out += "queryAACube"; - } - if (entityHostTypeChanged()) { - out += "entityHostType"; - } - if (owningAvatarIDChanged()) { - out += "owningAvatarID"; - } - - if (flyingAllowedChanged()) { - out += "flyingAllowed"; - } - if (ghostingAllowedChanged()) { - out += "ghostingAllowed"; - } - if (filterURLChanged()) { - out += "filterURL"; + // Web + if (sourceUrlChanged()) { + out += "sourceUrl"; } if (dpiChanged()) { out += "dpi"; } - if (shapeChanged()) { - out += "shape"; + // Polyline + if (linePointsChanged()) { + out += "linePoints"; + } + if (strokeWidthsChanged()) { + out += "strokeWidths"; + } + if (normalsChanged()) { + out += "normals"; } - if (strokeColorsChanged()) { out += "strokeColors"; } - if (isUVModeStretchChanged()) { out += "isUVModeStretch"; } - if (cloneableChanged()) { - out += "cloneable"; - } - if (cloneLifetimeChanged()) { - out += "cloneLifetime"; - } - if (cloneLimitChanged()) { - out += "cloneLimit"; - } - if (cloneDynamicChanged()) { - out += "cloneDynamic"; - } - if (cloneAvatarEntityChanged()) { - out += "cloneAvatarEntity"; - } - if (cloneOriginIDChanged()) { - out += "cloneOriginID"; + // Shape + if (shapeChanged()) { + out += "shape"; } + // Material + if (materialURLChanged()) { + out += "materialURL"; + } + if (materialMappingModeChanged()) { + out += "materialMappingMode"; + } + if (priorityChanged()) { + out += "priority"; + } + if (parentMaterialNameChanged()) { + out += "parentMaterialName"; + } + if (materialMappingPosChanged()) { + out += "materialMappingPos"; + } + if (materialMappingScaleChanged()) { + out += "materialMappingScale"; + } + if (materialMappingRotChanged()) { + out += "materialMappingRot"; + } + if (materialDataChanged()) { + out += "materialData"; + } + if (materialRepeatChanged()) { + out += "materialRepeat"; + } + + // Image if (imageURLChanged()) { out += "imageURL"; } @@ -4115,10 +4382,7 @@ QList EntityItemProperties::listChangedProperties() { out += "subImage"; } - if (billboardModeChanged()) { - out += "billboardMode"; - } - + // Grid if (followCameraChanged()) { out += "followCamera"; } @@ -4129,14 +4393,6 @@ QList EntityItemProperties::listChangedProperties() { out += "minorGridEvery"; } - getAnimation().listChangedProperties(out); - getKeyLight().listChangedProperties(out); - getAmbientLight().listChangedProperties(out); - getSkybox().listChangedProperties(out); - getHaze().listChangedProperties(out); - getBloom().listChangedProperties(out); - getGrab().listChangedProperties(out); - return out; } @@ -4326,4 +4582,19 @@ void EntityItemProperties::convertToCloneProperties(const EntityItemID& entityID setCloneLimit(ENTITY_ITEM_DEFAULT_CLONE_LIMIT); setCloneDynamic(ENTITY_ITEM_DEFAULT_CLONE_DYNAMIC); setCloneAvatarEntity(ENTITY_ITEM_DEFAULT_CLONE_AVATAR_ENTITY); -} \ No newline at end of file +} + +QDebug& operator<<(QDebug& dbg, const EntityPropertyFlags& f) { + QString result = "[ "; + + for (int i = 0; i < PROP_AFTER_LAST_ITEM; i++) { + auto prop = EntityPropertyList(i); + if (f.getHasProperty(prop)) { + result = result + _enumsToPropertyStrings[prop] + " "; + } + } + + result += "]"; + dbg.nospace() << result; + return dbg; +} From 0072684d98c5037e5aad89b61dc6e70eba53bd1a Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Mon, 19 Nov 2018 17:26:00 -0800 Subject: [PATCH 06/27] remove cruft and fix error in transform to mesh frame --- .../src/RenderableModelEntityItem.cpp | 4 +- libraries/render-utils/src/Model.cpp | 57 ++----------------- libraries/render-utils/src/Model.h | 2 +- 3 files changed, 9 insertions(+), 54 deletions(-) diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp index dcad562ba7..3c4aeb2686 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp @@ -726,7 +726,9 @@ int RenderableModelEntityItem::avatarJointIndex(int modelJointIndex) { bool RenderableModelEntityItem::contains(const glm::vec3& point) const { auto model = getModel(); if (EntityItem::contains(point) && model && _compoundShapeResource && _compoundShapeResource->isLoaded()) { - return _compoundShapeResource->getHFMModel().convexHullContains(worldToEntity(point)); + glm::mat4 worldToHFMMatrix = model->getWorldToHFMMatrix(); + glm::vec3 hfmPoint = worldToHFMMatrix * glm::vec4(point, 1.0f); + return _compoundShapeResource->getHFMModel().convexHullContains(hfmPoint); } return false; diff --git a/libraries/render-utils/src/Model.cpp b/libraries/render-utils/src/Model.cpp index 9cefbf65a8..ec29fb009e 100644 --- a/libraries/render-utils/src/Model.cpp +++ b/libraries/render-utils/src/Model.cpp @@ -614,58 +614,11 @@ bool Model::findParabolaIntersectionAgainstSubMeshes(const glm::vec3& origin, co return intersectedSomething; } -bool Model::convexHullContains(glm::vec3 point) { - // if we aren't active, we can't compute that yet... - if (!isActive()) { - return false; - } - - // extents is the entity relative, scaled, centered extents of the entity - glm::vec3 position = _translation; - glm::mat4 rotation = glm::mat4_cast(_rotation); - glm::mat4 translation = glm::translate(position); - glm::mat4 modelToWorldMatrix = translation * rotation; - glm::mat4 worldToModelMatrix = glm::inverse(modelToWorldMatrix); - - Extents modelExtents = getMeshExtents(); // NOTE: unrotated - - glm::vec3 dimensions = modelExtents.maximum - modelExtents.minimum; - glm::vec3 corner = -(dimensions * _registrationPoint); - AABox modelFrameBox(corner, dimensions); - - glm::vec3 modelFramePoint = glm::vec3(worldToModelMatrix * glm::vec4(point, 1.0f)); - - // we can use the AABox's contains() by mapping our point into the model frame - // and testing there. - if (modelFrameBox.contains(modelFramePoint)){ - QMutexLocker locker(&_mutex); - - if (!_triangleSetsValid) { - calculateTriangleSets(getHFMModel()); - } - - // If we are inside the models box, then consider the submeshes... - glm::mat4 meshToModelMatrix = glm::scale(_scale) * glm::translate(_offset); - glm::mat4 meshToWorldMatrix = createMatFromQuatAndPos(_rotation, _translation) * meshToModelMatrix; - glm::mat4 worldToMeshMatrix = glm::inverse(meshToWorldMatrix); - glm::vec3 meshFramePoint = glm::vec3(worldToMeshMatrix * glm::vec4(point, 1.0f)); - - for (auto& meshTriangleSets : _modelSpaceMeshTriangleSets) { - for (auto &partTriangleSet : meshTriangleSets) { - const AABox& box = partTriangleSet.getBounds(); - if (box.contains(meshFramePoint)) { - if (partTriangleSet.convexHullContains(meshFramePoint)) { - // It's inside this mesh, return true. - return true; - } - } - } - } - - - } - // It wasn't in any mesh, return false. - return false; +glm::mat4 Model::getWorldToHFMMatrix() const { + glm::mat4 hfmToModelMatrix = glm::scale(_scale) * glm::translate(_offset); + glm::mat4 modelToWorldMatrix = createMatFromQuatAndPos(_rotation, _translation); + glm::mat4 worldToHFMMatrix = glm::inverse(modelToWorldMatrix * hfmToModelMatrix); + return worldToHFMMatrix; } // TODO: deprecate and remove diff --git a/libraries/render-utils/src/Model.h b/libraries/render-utils/src/Model.h index 93a0626d28..0f8eb782c3 100644 --- a/libraries/render-utils/src/Model.h +++ b/libraries/render-utils/src/Model.h @@ -192,7 +192,7 @@ public: bool didVisualGeometryRequestFail() const { return _visualGeometryRequestFailed; } bool didCollisionGeometryRequestFail() const { return _collisionGeometryRequestFailed; } - bool convexHullContains(glm::vec3 point); + glm::mat4 getWorldToHFMMatrix() const; QStringList getJointNames() const; From 1fabaf0db43b3f1d5a64502ab76dc64bf6938eb7 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Mon, 19 Nov 2018 17:27:18 -0800 Subject: [PATCH 07/27] rename getCollisionGeometryResource to fetchCollisionGeometryResource --- .../src/RenderableModelEntityItem.cpp | 10 +++++----- .../entities-renderer/src/RenderableModelEntityItem.h | 3 +-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp index 3c4aeb2686..5693778e3a 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp @@ -279,7 +279,7 @@ bool RenderableModelEntityItem::findDetailedParabolaIntersection(const glm::vec3 face, surfaceNormal, extraInfo, precisionPicking, false); } -void RenderableModelEntityItem::getCollisionGeometryResource() { +void RenderableModelEntityItem::fetchCollisionGeometryResource() { QUrl hullURL(getCollisionShapeURL()); QUrlQuery queryArgs(hullURL); queryArgs.addQueryItem("collision-hull", ""); @@ -289,7 +289,7 @@ void RenderableModelEntityItem::getCollisionGeometryResource() { bool RenderableModelEntityItem::computeShapeFailedToLoad() { if (!_compoundShapeResource) { - getCollisionGeometryResource(); + fetchCollisionGeometryResource(); } return (_compoundShapeResource && _compoundShapeResource->isFailed()); @@ -300,7 +300,7 @@ void RenderableModelEntityItem::setShapeType(ShapeType type) { auto shapeType = getShapeType(); if (shapeType == SHAPE_TYPE_COMPOUND || shapeType == SHAPE_TYPE_SIMPLE_COMPOUND) { if (!_compoundShapeResource && !getCollisionShapeURL().isEmpty()) { - getCollisionGeometryResource(); + fetchCollisionGeometryResource(); } } else if (_compoundShapeResource && !getCompoundShapeURL().isEmpty()) { // the compoundURL has been set but the shapeType does not agree @@ -317,7 +317,7 @@ void RenderableModelEntityItem::setCompoundShapeURL(const QString& url) { ModelEntityItem::setCompoundShapeURL(url); if (getCompoundShapeURL() != currentCompoundShapeURL || !getModel()) { if (getShapeType() == SHAPE_TYPE_COMPOUND) { - getCollisionGeometryResource(); + fetchCollisionGeometryResource(); } } } @@ -340,7 +340,7 @@ bool RenderableModelEntityItem::isReadyToComputeShape() const { if (model->isLoaded()) { if (!shapeURL.isEmpty() && !_compoundShapeResource) { - const_cast(this)->getCollisionGeometryResource(); + const_cast(this)->fetchCollisionGeometryResource(); } if (_compoundShapeResource && _compoundShapeResource->isLoaded()) { diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.h b/libraries/entities-renderer/src/RenderableModelEntityItem.h index ba185dee96..725c1d96c3 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.h +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.h @@ -122,7 +122,7 @@ private: void autoResizeJointArrays(); void copyAnimationJointDataToModel(); bool readyToAnimate() const; - void getCollisionGeometryResource(); + void fetchCollisionGeometryResource(); GeometryResource::Pointer _compoundShapeResource; std::vector _jointMap; @@ -179,7 +179,6 @@ private: bool _hasModel { false }; ModelPointer _model; - GeometryResource::Pointer _compoundShapeResource; QString _lastTextures; bool _texturesLoaded { false }; int _lastKnownCurrentFrame { -1 }; From b4807204095dffc31752f15d05cacc9a4c50f810 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Mon, 19 Nov 2018 17:32:28 -0800 Subject: [PATCH 08/27] proper shape support for EntityItem::contains(point) --- libraries/entities/src/EntityItem.cpp | 57 ++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 9 deletions(-) diff --git a/libraries/entities/src/EntityItem.cpp b/libraries/entities/src/EntityItem.cpp index bfa238d695..5000a8c2ea 100644 --- a/libraries/entities/src/EntityItem.cpp +++ b/libraries/entities/src/EntityItem.cpp @@ -1680,15 +1680,54 @@ void EntityItem::adjustShapeInfoByRegistration(ShapeInfo& info) const { } bool EntityItem::contains(const glm::vec3& point) const { - if (getShapeType() == SHAPE_TYPE_COMPOUND) { - bool success; - bool result = getAABox(success).contains(point); - return result && success; - } else { - ShapeInfo info; - info.setParams(getShapeType(), glm::vec3(0.5f)); - adjustShapeInfoByRegistration(info); - return info.contains(worldToEntity(point)); + // we transform into the "normalized entity-frame" where the bounding box is centered on the origin + // and has dimensions <1,1,1> + glm::vec3 localPoint = glm::vec3(glm::inverse(getEntityToWorldMatrix()) * glm::vec4(point, 1.0f)); + + const float NORMALIZED_HALF_SIDE = 0.5f; + const float NORMALIZED_RADIUS_SQUARED = NORMALIZED_HALF_SIDE * NORMALIZED_HALF_SIDE; + ShapeType shapeType = getShapeType(); + switch(shapeType) { + case SHAPE_TYPE_NONE: + return false; + case SHAPE_TYPE_CAPSULE_X: + case SHAPE_TYPE_CAPSULE_Y: + case SHAPE_TYPE_CAPSULE_Z: + case SHAPE_TYPE_HULL: + case SHAPE_TYPE_PLANE: + case SHAPE_TYPE_COMPOUND: + case SHAPE_TYPE_SIMPLE_HULL: + case SHAPE_TYPE_SIMPLE_COMPOUND: + case SHAPE_TYPE_STATIC_MESH: + case SHAPE_TYPE_CIRCLE: + // the above cases not yet supported --> fall through to BOX case + case SHAPE_TYPE_BOX: { + localPoint = glm::abs(localPoint); + return localPoint.x <= NORMALIZED_HALF_SIDE && + localPoint.y <= NORMALIZED_HALF_SIDE && + localPoint.z <= NORMALIZED_HALF_SIDE; + } + case SHAPE_TYPE_SPHERE: + case SHAPE_TYPE_ELLIPSOID: { + return glm::length2(localPoint) <= NORMALIZED_RADIUS_SQUARED; + } + case SHAPE_TYPE_CYLINDER_X: + if (fabsf(localPoint.x) <= NORMALIZED_HALF_SIDE) { + return (localPoint.y * localPoint.y + localPoint.z * localPoint.z <= NORMALIZED_RADIUS_SQUARED); + } + return false; + case SHAPE_TYPE_CYLINDER_Y: + if (fabsf(localPoint.x) <= NORMALIZED_HALF_SIDE) { + return (localPoint.z * localPoint.z + localPoint.x * localPoint.x <= NORMALIZED_RADIUS_SQUARED); + } + return false; + case SHAPE_TYPE_CYLINDER_Z: + if (fabsf(localPoint.x) <= NORMALIZED_HALF_SIDE) { + return (localPoint.x * localPoint.x + localPoint.y * localPoint.y <= NORMALIZED_RADIUS_SQUARED); + } + return false; + default: + return false; } } From bb15b3a5d594fa96b558cdc38871b16ef89ce52d Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Mon, 19 Nov 2018 17:33:45 -0800 Subject: [PATCH 09/27] remove ShapeInfo::contains() which was a Bad Idea --- libraries/shared/src/ShapeInfo.cpp | 44 ------------------------------ libraries/shared/src/ShapeInfo.h | 4 --- 2 files changed, 48 deletions(-) diff --git a/libraries/shared/src/ShapeInfo.cpp b/libraries/shared/src/ShapeInfo.cpp index df8e61114d..3118fce891 100644 --- a/libraries/shared/src/ShapeInfo.cpp +++ b/libraries/shared/src/ShapeInfo.cpp @@ -250,50 +250,6 @@ float ShapeInfo::computeVolume() const { return volume; } -bool ShapeInfo::contains(const glm::vec3& point) const { - switch(_type) { - case SHAPE_TYPE_SPHERE: - return glm::length(point) <= _halfExtents.x; - case SHAPE_TYPE_CYLINDER_X: - return glm::length(glm::vec2(point.y, point.z)) <= _halfExtents.z; - case SHAPE_TYPE_CYLINDER_Y: - return glm::length(glm::vec2(point.x, point.z)) <= _halfExtents.x; - case SHAPE_TYPE_CYLINDER_Z: - return glm::length(glm::vec2(point.x, point.y)) <= _halfExtents.y; - case SHAPE_TYPE_CAPSULE_X: { - if (glm::abs(point.x) <= _halfExtents.x - _halfExtents.y) { - return glm::length(glm::vec2(point.y, point.z)) <= _halfExtents.y; - } else { - glm::vec3 absPoint = glm::abs(point) - glm::vec3(_halfExtents.x, 0.0f, 0.0f); - return glm::length(absPoint) <= _halfExtents.y; - } - } - case SHAPE_TYPE_CAPSULE_Y: { - if (glm::abs(point.y) <= _halfExtents.y - _halfExtents.z) { - return glm::length(glm::vec2(point.x, point.z)) <= _halfExtents.z; - } else { - glm::vec3 absPoint = glm::abs(point) - glm::vec3(0.0f, _halfExtents.y, 0.0f); - return glm::length(absPoint) <= _halfExtents.z; - } - } - case SHAPE_TYPE_CAPSULE_Z: { - if (glm::abs(point.z) <= _halfExtents.z - _halfExtents.x) { - return glm::length(glm::vec2(point.x, point.y)) <= _halfExtents.x; - } else { - glm::vec3 absPoint = glm::abs(point) - glm::vec3(0.0f, 0.0f, _halfExtents.z); - return glm::length(absPoint) <= _halfExtents.x; - } - } - case SHAPE_TYPE_BOX: - default: { - glm::vec3 absPoint = glm::abs(point); - return absPoint.x <= _halfExtents.x - && absPoint.y <= _halfExtents.y - && absPoint.z <= _halfExtents.z; - } - } -} - const HashKey& ShapeInfo::getHash() const { // NOTE: we cache the key so we only ever need to compute it once for any valid ShapeInfo instance. if (_hashKey.isNull() && _type != SHAPE_TYPE_NONE) { diff --git a/libraries/shared/src/ShapeInfo.h b/libraries/shared/src/ShapeInfo.h index 16e260d9db..a2092c7f00 100644 --- a/libraries/shared/src/ShapeInfo.h +++ b/libraries/shared/src/ShapeInfo.h @@ -86,10 +86,6 @@ public: float computeVolume() const; - /// Returns whether point is inside the shape - /// For compound shapes it will only return whether it is inside the bounding box - bool contains(const glm::vec3& point) const; - const HashKey& getHash() const; protected: From a8325b5c00d850f8f91c76b3fc200cb635328e5d Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Mon, 19 Nov 2018 17:35:35 -0800 Subject: [PATCH 10/27] add ZoneEntityItem::contains() and support for shapes --- assignment-client/CMakeLists.txt | 1 + .../src/entities/EntityServer.cpp | 1 + libraries/entities/CMakeLists.txt | 2 +- libraries/entities/src/ZoneEntityItem.cpp | 87 ++++++++++++++++--- libraries/entities/src/ZoneEntityItem.h | 13 ++- libraries/physics/CMakeLists.txt | 7 +- 6 files changed, 94 insertions(+), 17 deletions(-) diff --git a/assignment-client/CMakeLists.txt b/assignment-client/CMakeLists.txt index 229e3641d0..f28dc90b7d 100644 --- a/assignment-client/CMakeLists.txt +++ b/assignment-client/CMakeLists.txt @@ -14,6 +14,7 @@ link_hifi_libraries( audio avatars octree gpu graphics shaders fbx hfm entities networking animation recording shared script-engine embedded-webserver controllers physics plugins midi image + model-networking ktx shaders ) add_dependencies(${TARGET_NAME} oven) diff --git a/assignment-client/src/entities/EntityServer.cpp b/assignment-client/src/entities/EntityServer.cpp index 089fb3e52f..22308071eb 100644 --- a/assignment-client/src/entities/EntityServer.cpp +++ b/assignment-client/src/entities/EntityServer.cpp @@ -45,6 +45,7 @@ EntityServer::EntityServer(ReceivedMessage& message) : DependencyManager::registerInheritance(); DependencyManager::set(); + DependencyManager::set(); auto& packetReceiver = DependencyManager::get()->getPacketReceiver(); packetReceiver.registerListenerForTypes({ PacketType::EntityAdd, diff --git a/libraries/entities/CMakeLists.txt b/libraries/entities/CMakeLists.txt index c51ae28d5f..542f6eb0e2 100644 --- a/libraries/entities/CMakeLists.txt +++ b/libraries/entities/CMakeLists.txt @@ -6,4 +6,4 @@ include_hifi_library_headers(fbx) include_hifi_library_headers(gpu) include_hifi_library_headers(image) include_hifi_library_headers(ktx) -link_hifi_libraries(shared shaders networking octree avatars graphics model-networking) \ No newline at end of file +link_hifi_libraries(shared shaders networking octree model-networking avatars graphics model-networking) diff --git a/libraries/entities/src/ZoneEntityItem.cpp b/libraries/entities/src/ZoneEntityItem.cpp index a265fe16cd..4c379f7290 100644 --- a/libraries/entities/src/ZoneEntityItem.cpp +++ b/libraries/entities/src/ZoneEntityItem.cpp @@ -11,7 +11,9 @@ #include "ZoneEntityItem.h" +#include #include +#include #include @@ -275,22 +277,53 @@ void ZoneEntityItem::debugDump() const { _bloomProperties.debugDump(); } -ShapeType ZoneEntityItem::getShapeType() const { - // Zones are not allowed to have a SHAPE_TYPE_NONE... they are always at least a SHAPE_TYPE_BOX - if (_shapeType == SHAPE_TYPE_COMPOUND) { - return hasCompoundShapeURL() ? SHAPE_TYPE_COMPOUND : DEFAULT_SHAPE_TYPE; +void ZoneEntityItem::setShapeType(ShapeType type) { + //ShapeType typeArgument = type; + ShapeType oldShapeType = _shapeType; + switch(type) { + case SHAPE_TYPE_NONE: + case SHAPE_TYPE_CAPSULE_X: + case SHAPE_TYPE_CAPSULE_Y: + case SHAPE_TYPE_CAPSULE_Z: + case SHAPE_TYPE_HULL: + case SHAPE_TYPE_PLANE: + case SHAPE_TYPE_SIMPLE_HULL: + case SHAPE_TYPE_SIMPLE_COMPOUND: + case SHAPE_TYPE_STATIC_MESH: + case SHAPE_TYPE_CIRCLE: + // these types are unsupported for ZoneEntity + type = DEFAULT_SHAPE_TYPE; + break; + default: + break; + } + _shapeType = type; + + if (type == SHAPE_TYPE_COMPOUND) { + if (type != oldShapeType) { + fetchCollisionGeometryResource(); + } } else { - return _shapeType == SHAPE_TYPE_NONE ? DEFAULT_SHAPE_TYPE : _shapeType; + _shapeResource.reset(); } } +ShapeType ZoneEntityItem::getShapeType() const { + return _shapeType; +} + void ZoneEntityItem::setCompoundShapeURL(const QString& url) { + QString oldCompoundShapeURL = _compoundShapeURL; withWriteLock([&] { _compoundShapeURL = url; - if (_compoundShapeURL.isEmpty() && _shapeType == SHAPE_TYPE_COMPOUND) { - _shapeType = DEFAULT_SHAPE_TYPE; - } }); + if (oldCompoundShapeURL != url) { + if (_shapeType == SHAPE_TYPE_COMPOUND) { + fetchCollisionGeometryResource(); + } else { + _shapeResource.reset(); + } + } } bool ZoneEntityItem::findDetailedRayIntersection(const glm::vec3& origin, const glm::vec3& direction, @@ -307,6 +340,28 @@ bool ZoneEntityItem::findDetailedParabolaIntersection(const glm::vec3& origin, c return _zonesArePickable; } +bool ZoneEntityItem::contains(const glm::vec3& point) const { + GeometryResource::Pointer resource = _shapeResource; + if (_shapeType == SHAPE_TYPE_COMPOUND && resource) { + if (resource->isLoaded()) { + const HFMModel& hfmModel = resource->getHFMModel(); + + glm::vec3 minimum = glm::vec3(hfmModel.offset * glm::vec4(hfmModel.meshExtents.minimum, 1.0f)); + glm::vec3 maximum = glm::vec3(hfmModel.offset * glm::vec4(hfmModel.meshExtents.maximum, 1.0f)); + glm::vec3 modelExtentsDiagonal = maximum - minimum; + glm::vec3 offset = -minimum - (modelExtentsDiagonal * getRegistrationPoint()); + glm::vec3 scale(getScaledDimensions() / modelExtentsDiagonal); + + glm::mat4 hfmToEntityMatrix = glm::scale(scale) * glm::translate(offset); + glm::mat4 entityToWorldMatrix = getTransform().getMatrix(); + glm::mat4 worldToHFMMatrix = glm::inverse(entityToWorldMatrix * hfmToEntityMatrix); + + return hfmModel.convexHullContains(glm::vec3(worldToHFMMatrix * glm::vec4(point, 1.0f))); + } + } + return EntityItem::contains(point); +} + void ZoneEntityItem::setFilterURL(QString url) { withWriteLock([&] { _filterURL = url; @@ -326,10 +381,6 @@ QString ZoneEntityItem::getFilterURL() const { return result; } -bool ZoneEntityItem::hasCompoundShapeURL() const { - return !getCompoundShapeURL().isEmpty(); -} - QString ZoneEntityItem::getCompoundShapeURL() const { QString result; withReadLock([&] { @@ -403,3 +454,15 @@ void ZoneEntityItem::setSkyboxMode(const uint32_t value) { uint32_t ZoneEntityItem::getSkyboxMode() const { return _skyboxMode; } + +void ZoneEntityItem::fetchCollisionGeometryResource() { + QUrl hullURL(getCompoundShapeURL()); + if (hullURL.isEmpty()) { + _shapeResource.reset(); + } else { + QUrlQuery queryArgs(hullURL); + queryArgs.addQueryItem("collision-hull", ""); + hullURL.setQuery(queryArgs); + _shapeResource = DependencyManager::get()->getCollisionGeometryResource(hullURL); + } +} diff --git a/libraries/entities/src/ZoneEntityItem.h b/libraries/entities/src/ZoneEntityItem.h index c2f4542aa6..813115add9 100644 --- a/libraries/entities/src/ZoneEntityItem.h +++ b/libraries/entities/src/ZoneEntityItem.h @@ -12,6 +12,9 @@ #ifndef hifi_ZoneEntityItem_h #define hifi_ZoneEntityItem_h +#include +#include + #include "KeyLightPropertyGroup.h" #include "AmbientLightPropertyGroup.h" #include "EntityItem.h" @@ -19,7 +22,6 @@ #include "SkyboxPropertyGroup.h" #include "HazePropertyGroup.h" #include "BloomPropertyGroup.h" -#include class ZoneEntityItem : public EntityItem { public: @@ -58,10 +60,9 @@ public: static void setDrawZoneBoundaries(bool value) { _drawZoneBoundaries = value; } virtual bool isReadyToComputeShape() const override { return false; } - void setShapeType(ShapeType type) override { withWriteLock([&] { _shapeType = type; }); } + virtual void setShapeType(ShapeType type) override; virtual ShapeType getShapeType() const override; - virtual bool hasCompoundShapeURL() const; QString getCompoundShapeURL() const; virtual void setCompoundShapeURL(const QString& url); @@ -115,6 +116,8 @@ public: BoxFace& face, glm::vec3& surfaceNormal, QVariantMap& extraInfo, bool precisionPicking) const override; + bool contains(const glm::vec3& point) const override; + virtual void debugDump() const override; static const ShapeType DEFAULT_SHAPE_TYPE; @@ -156,6 +159,10 @@ protected: static bool _drawZoneBoundaries; static bool _zonesArePickable; + + void fetchCollisionGeometryResource(); + GeometryResource::Pointer _shapeResource; + }; #endif // hifi_ZoneEntityItem_h diff --git a/libraries/physics/CMakeLists.txt b/libraries/physics/CMakeLists.txt index 96a55c8477..5249ed2950 100644 --- a/libraries/physics/CMakeLists.txt +++ b/libraries/physics/CMakeLists.txt @@ -1,11 +1,16 @@ set(TARGET_NAME physics) setup_hifi_library() -link_hifi_libraries(shared task workload fbx entities graphics) +link_hifi_libraries(shared task workload fbx entities graphics shaders) include_hifi_library_headers(networking) include_hifi_library_headers(gpu) include_hifi_library_headers(avatars) include_hifi_library_headers(audio) include_hifi_library_headers(octree) include_hifi_library_headers(animation) +include_hifi_library_headers(model-networking) +include_hifi_library_headers(image) +include_hifi_library_headers(ktx) +include_hifi_library_headers(gpu) +include_hifi_library_headers(hfm) target_bullet() From 7625aebaa8be5aed5c1e2ec0aa3f5bd982f1ad56 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Wed, 21 Nov 2018 12:09:07 -0800 Subject: [PATCH 11/27] remove reduntant model-networking link dependency --- libraries/entities/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/entities/CMakeLists.txt b/libraries/entities/CMakeLists.txt index 542f6eb0e2..fcbe563f88 100644 --- a/libraries/entities/CMakeLists.txt +++ b/libraries/entities/CMakeLists.txt @@ -6,4 +6,4 @@ include_hifi_library_headers(fbx) include_hifi_library_headers(gpu) include_hifi_library_headers(image) include_hifi_library_headers(ktx) -link_hifi_libraries(shared shaders networking octree model-networking avatars graphics model-networking) +link_hifi_libraries(shared shaders networking octree avatars graphics model-networking) From 65e920039c04b4224453ffcbe24adeaec3f6c6ee Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Wed, 21 Nov 2018 12:30:30 -0800 Subject: [PATCH 12/27] cleaner return logic for EntityItem::contains() cylinder cases --- libraries/entities/src/EntityItem.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/libraries/entities/src/EntityItem.cpp b/libraries/entities/src/EntityItem.cpp index 5000a8c2ea..0b6f4c0cf5 100644 --- a/libraries/entities/src/EntityItem.cpp +++ b/libraries/entities/src/EntityItem.cpp @@ -1712,20 +1712,14 @@ bool EntityItem::contains(const glm::vec3& point) const { return glm::length2(localPoint) <= NORMALIZED_RADIUS_SQUARED; } case SHAPE_TYPE_CYLINDER_X: - if (fabsf(localPoint.x) <= NORMALIZED_HALF_SIDE) { - return (localPoint.y * localPoint.y + localPoint.z * localPoint.z <= NORMALIZED_RADIUS_SQUARED); - } - return false; + return fabsf(localPoint.x) <= NORMALIZED_HALF_SIDE && + localPoint.y * localPoint.y + localPoint.z * localPoint.z <= NORMALIZED_RADIUS_SQUARED; case SHAPE_TYPE_CYLINDER_Y: - if (fabsf(localPoint.x) <= NORMALIZED_HALF_SIDE) { - return (localPoint.z * localPoint.z + localPoint.x * localPoint.x <= NORMALIZED_RADIUS_SQUARED); - } - return false; + return fabsf(localPoint.x) <= NORMALIZED_HALF_SIDE && + localPoint.z * localPoint.z + localPoint.x * localPoint.x <= NORMALIZED_RADIUS_SQUARED; case SHAPE_TYPE_CYLINDER_Z: - if (fabsf(localPoint.x) <= NORMALIZED_HALF_SIDE) { - return (localPoint.x * localPoint.x + localPoint.y * localPoint.y <= NORMALIZED_RADIUS_SQUARED); - } - return false; + return fabsf(localPoint.x) <= NORMALIZED_HALF_SIDE && + localPoint.x * localPoint.x + localPoint.y * localPoint.y <= NORMALIZED_RADIUS_SQUARED; default: return false; } From a656ea723e0fc9c0ecd60038269a5e1379200b28 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Mon, 26 Nov 2018 09:14:08 -0800 Subject: [PATCH 13/27] special handling of SPHERE case in EntityItem::contains() --- libraries/entities/src/EntityItem.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/libraries/entities/src/EntityItem.cpp b/libraries/entities/src/EntityItem.cpp index 0b6f4c0cf5..76dd130f70 100644 --- a/libraries/entities/src/EntityItem.cpp +++ b/libraries/entities/src/EntityItem.cpp @@ -1680,13 +1680,24 @@ void EntityItem::adjustShapeInfoByRegistration(ShapeInfo& info) const { } bool EntityItem::contains(const glm::vec3& point) const { + ShapeType shapeType = getShapeType(); + + if (shapeType == SHAPE_TYPE_SPHERE) { + // SPHERE case is special: + // anything with shapeType == SPHERE must collide as a bounding sphere in the world-frame regardless of dimensions + // therefore we must do math using an unscaled localPoint relative to sphere center + glm::vec3 dimensions = getScaledDimensions(); + glm::vec3 localPoint = point - (getWorldPosition() + getWorldOrientation() * (dimensions * (ENTITY_ITEM_DEFAULT_REGISTRATION_POINT - getRegistrationPoint()))); + const float HALF_SQUARED = 0.25f; + return glm::length2(localPoint) < HALF_SQUARED * glm::length2(dimensions); + } + // we transform into the "normalized entity-frame" where the bounding box is centered on the origin // and has dimensions <1,1,1> glm::vec3 localPoint = glm::vec3(glm::inverse(getEntityToWorldMatrix()) * glm::vec4(point, 1.0f)); const float NORMALIZED_HALF_SIDE = 0.5f; const float NORMALIZED_RADIUS_SQUARED = NORMALIZED_HALF_SIDE * NORMALIZED_HALF_SIDE; - ShapeType shapeType = getShapeType(); switch(shapeType) { case SHAPE_TYPE_NONE: return false; @@ -1707,8 +1718,8 @@ bool EntityItem::contains(const glm::vec3& point) const { localPoint.y <= NORMALIZED_HALF_SIDE && localPoint.z <= NORMALIZED_HALF_SIDE; } - case SHAPE_TYPE_SPHERE: case SHAPE_TYPE_ELLIPSOID: { + // since we've transformed into the normalized space this is just a sphere-point intersection test return glm::length2(localPoint) <= NORMALIZED_RADIUS_SQUARED; } case SHAPE_TYPE_CYLINDER_X: From a642af23b79b5deaf229a9baedde36e28435947a Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Tue, 27 Nov 2018 08:44:40 -0800 Subject: [PATCH 14/27] enable shapeType=ellipsoid and expose zone shapeType to UI --- .../entities/src/EntityItemProperties.cpp | 1 + libraries/entities/src/ZoneEntityItem.cpp | 1 - libraries/shared/src/ShapeInfo.cpp | 3 ++- scripts/system/edit.js | 1 + scripts/system/html/js/entityProperties.js | 20 ++++++++++++++++++- 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index 1745658cf1..282e86c4d4 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -117,6 +117,7 @@ void buildStringToShapeTypeLookup() { addShapeType(SHAPE_TYPE_SIMPLE_HULL); addShapeType(SHAPE_TYPE_SIMPLE_COMPOUND); addShapeType(SHAPE_TYPE_STATIC_MESH); + addShapeType(SHAPE_TYPE_ELLIPSOID); } QHash stringToMaterialMappingModeLookup; diff --git a/libraries/entities/src/ZoneEntityItem.cpp b/libraries/entities/src/ZoneEntityItem.cpp index 4c379f7290..61f07808f6 100644 --- a/libraries/entities/src/ZoneEntityItem.cpp +++ b/libraries/entities/src/ZoneEntityItem.cpp @@ -278,7 +278,6 @@ void ZoneEntityItem::debugDump() const { } void ZoneEntityItem::setShapeType(ShapeType type) { - //ShapeType typeArgument = type; ShapeType oldShapeType = _shapeType; switch(type) { case SHAPE_TYPE_NONE: diff --git a/libraries/shared/src/ShapeInfo.cpp b/libraries/shared/src/ShapeInfo.cpp index 3118fce891..3426a79782 100644 --- a/libraries/shared/src/ShapeInfo.cpp +++ b/libraries/shared/src/ShapeInfo.cpp @@ -58,7 +58,8 @@ const char* shapeTypeNames[] = { "compound", "simple-hull", "simple-compound", - "static-mesh" + "static-mesh", + "ellipsoid" }; static const size_t SHAPETYPE_NAME_COUNT = (sizeof(shapeTypeNames) / sizeof((shapeTypeNames)[0])); diff --git a/scripts/system/edit.js b/scripts/system/edit.js index 36f9af0ea7..28309ee98d 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -372,6 +372,7 @@ const DEFAULT_ENTITY_PROPERTIES = { blue: 179 }, }, + shapeType: "box", bloomMode: "inherit" }, Model: { diff --git a/scripts/system/html/js/entityProperties.js b/scripts/system/html/js/entityProperties.js index 78ef8ac313..3554b7e5bf 100644 --- a/scripts/system/html/js/entityProperties.js +++ b/scripts/system/html/js/entityProperties.js @@ -1288,6 +1288,24 @@ const GROUPS = [ }, ] }, + { + id: "zone_shape", + label: "ZONE SHAPE", + properties: [ + { + label: "Shape Type", + type: "dropdown", + options: { "box": "Box", "sphere": "Sphere", "ellipsoid": "Ellipsoid", + "cylinder-y": "Cylinder", "compound": "Use Compound Shape URL" }, + propertyID: "shapeType", + }, + { + label: "Compound Shape URL", + type: "string", + propertyID: "compoundShapeURL", + }, + ] + }, { id: "physics", label: "PHYSICS", @@ -1384,7 +1402,7 @@ const GROUPS_PER_TYPE = { None: [ 'base', 'spatial', 'behavior', 'collision', 'physics' ], Shape: [ 'base', 'shape', 'spatial', 'behavior', 'collision', 'physics' ], Text: [ 'base', 'text', 'spatial', 'behavior', 'collision', 'physics' ], - Zone: [ 'base', 'zone', 'spatial', 'behavior', 'collision', 'physics' ], + Zone: [ 'base', 'zone', 'spatial', 'behavior', 'zone_shape', 'physics' ], Model: [ 'base', 'model', 'spatial', 'behavior', 'collision', 'physics' ], Image: [ 'base', 'image', 'spatial', 'behavior', 'collision', 'physics' ], Web: [ 'base', 'web', 'spatial', 'behavior', 'collision', 'physics' ], From 13a3982b5af70df361c607feb2331e3b17ead418 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Fri, 4 Jan 2019 12:31:29 -0800 Subject: [PATCH 15/27] fix ZoneEntityItem::contains() for model shapes --- .../src/RenderableModelEntityItem.cpp | 21 +++++++++++-------- .../src/RenderableZoneEntityItem.cpp | 19 ----------------- libraries/entities/src/ZoneEntityItem.cpp | 9 ++++---- libraries/hfm/src/hfm/HFM.cpp | 9 +++----- libraries/hfm/src/hfm/HFM.h | 1 + libraries/physics/src/EntityMotionState.cpp | 1 - 6 files changed, 20 insertions(+), 40 deletions(-) diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp index 5693778e3a..aa449b8919 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp @@ -367,8 +367,6 @@ void RenderableModelEntityItem::computeShapeInfo(ShapeInfo& shapeInfo) { const uint32_t QUAD_STRIDE = 4; ShapeType type = getShapeType(); - glm::vec3 dimensions = getScaledDimensions(); - auto model = getModel(); if (type == SHAPE_TYPE_COMPOUND) { updateModelBounds(); @@ -450,6 +448,11 @@ void RenderableModelEntityItem::computeShapeInfo(ShapeInfo& shapeInfo) { // to the visual model and apply them to the collision model (without regard for the // collision model's extents). + auto model = getModel(); + // assert we never fall in here when model not fully loaded + assert(model && model->isLoaded()); + + glm::vec3 dimensions = getScaledDimensions(); glm::vec3 scaleToFit = dimensions / model->getHFMModel().getUnscaledMeshExtents().size(); // multiply each point by scale before handing the point-set off to the physics engine. // also determine the extents of the collision model. @@ -461,11 +464,12 @@ void RenderableModelEntityItem::computeShapeInfo(ShapeInfo& shapeInfo) { } } shapeInfo.setParams(type, dimensions, getCompoundShapeURL()); + adjustShapeInfoByRegistration(shapeInfo); } else if (type >= SHAPE_TYPE_SIMPLE_HULL && type <= SHAPE_TYPE_STATIC_MESH) { - // TODO: assert we never fall in here when model not fully loaded - // assert(_model && _model->isLoaded()); - updateModelBounds(); + auto model = getModel(); + // assert we never fall in here when model not fully loaded + assert(model && model->isLoaded()); model->updateGeometry(); // compute meshPart local transforms @@ -473,6 +477,7 @@ void RenderableModelEntityItem::computeShapeInfo(ShapeInfo& shapeInfo) { const HFMModel& hfmModel = model->getHFMModel(); int numHFMMeshes = hfmModel.meshes.size(); int totalNumVertices = 0; + glm::vec3 dimensions = getScaledDimensions(); glm::mat4 invRegistraionOffset = glm::translate(dimensions * (getRegistrationPoint() - ENTITY_ITEM_DEFAULT_REGISTRATION_POINT)); for (int i = 0; i < numHFMMeshes; i++) { const HFMMesh& mesh = hfmModel.meshes.at(i); @@ -695,12 +700,10 @@ void RenderableModelEntityItem::computeShapeInfo(ShapeInfo& shapeInfo) { } shapeInfo.setParams(type, 0.5f * dimensions, getModelURL()); + adjustShapeInfoByRegistration(shapeInfo); } else { - ModelEntityItem::computeShapeInfo(shapeInfo); - shapeInfo.setParams(type, 0.5f * dimensions); + EntityItem::computeShapeInfo(shapeInfo); } - // finally apply the registration offset to the shapeInfo - adjustShapeInfoByRegistration(shapeInfo); } void RenderableModelEntityItem::setJointMap(std::vector jointMap) { diff --git a/libraries/entities-renderer/src/RenderableZoneEntityItem.cpp b/libraries/entities-renderer/src/RenderableZoneEntityItem.cpp index 232e6efa67..57ff8ed8c2 100644 --- a/libraries/entities-renderer/src/RenderableZoneEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableZoneEntityItem.cpp @@ -546,22 +546,3 @@ void ZoneEntityRenderer::setProceduralUserData(const QString& userData) { } } -#if 0 -bool RenderableZoneEntityItem::contains(const glm::vec3& point) const { - if (getShapeType() != SHAPE_TYPE_COMPOUND) { - return EntityItem::contains(point); - } - const_cast(this)->updateGeometry(); - - if (_model && _model->isActive() && EntityItem::contains(point)) { - return _model->convexHullContains(point); - } - - return false; -} - -void RenderableZoneEntityItem::notifyBoundChanged() { - notifyChangedRenderItem(); -} - -#endif diff --git a/libraries/entities/src/ZoneEntityItem.cpp b/libraries/entities/src/ZoneEntityItem.cpp index 61f07808f6..7f7f6170d4 100644 --- a/libraries/entities/src/ZoneEntityItem.cpp +++ b/libraries/entities/src/ZoneEntityItem.cpp @@ -345,11 +345,10 @@ bool ZoneEntityItem::contains(const glm::vec3& point) const { if (resource->isLoaded()) { const HFMModel& hfmModel = resource->getHFMModel(); - glm::vec3 minimum = glm::vec3(hfmModel.offset * glm::vec4(hfmModel.meshExtents.minimum, 1.0f)); - glm::vec3 maximum = glm::vec3(hfmModel.offset * glm::vec4(hfmModel.meshExtents.maximum, 1.0f)); - glm::vec3 modelExtentsDiagonal = maximum - minimum; - glm::vec3 offset = -minimum - (modelExtentsDiagonal * getRegistrationPoint()); - glm::vec3 scale(getScaledDimensions() / modelExtentsDiagonal); + Extents meshExtents = hfmModel.getMeshExtents(); + glm::vec3 meshExtentsDiagonal = meshExtents.maximum - meshExtents.minimum; + glm::vec3 offset = -meshExtents.minimum- (meshExtentsDiagonal * getRegistrationPoint()); + glm::vec3 scale(getScaledDimensions() / meshExtentsDiagonal); glm::mat4 hfmToEntityMatrix = glm::scale(scale) * glm::translate(offset); glm::mat4 entityToWorldMatrix = getTransform().getMatrix(); diff --git a/libraries/hfm/src/hfm/HFM.cpp b/libraries/hfm/src/hfm/HFM.cpp index 8f01956f17..b9e630456d 100644 --- a/libraries/hfm/src/hfm/HFM.cpp +++ b/libraries/hfm/src/hfm/HFM.cpp @@ -189,20 +189,17 @@ bool HFMModel::hasBlendedMeshes() const { } Extents HFMModel::getUnscaledMeshExtents() const { - const Extents& extents = meshExtents; - // even though our caller asked for "unscaled" we need to include any fst scaling, translation, and rotation, which // is captured in the offset matrix - glm::vec3 minimum = glm::vec3(offset * glm::vec4(extents.minimum, 1.0f)); - glm::vec3 maximum = glm::vec3(offset * glm::vec4(extents.maximum, 1.0f)); + glm::vec3 minimum = glm::vec3(offset * glm::vec4(meshExtents.minimum, 1.0f)); + glm::vec3 maximum = glm::vec3(offset * glm::vec4(meshExtents.maximum, 1.0f)); Extents scaledExtents = { minimum, maximum }; - return scaledExtents; } // TODO: Move to graphics::Mesh when Sam's ready bool HFMModel::convexHullContains(const glm::vec3& point) const { - if (!getUnscaledMeshExtents().containsPoint(point)) { + if (!meshExtents.containsPoint(point)) { return false; } diff --git a/libraries/hfm/src/hfm/HFM.h b/libraries/hfm/src/hfm/HFM.h index 9846e7e891..78f608d72e 100644 --- a/libraries/hfm/src/hfm/HFM.h +++ b/libraries/hfm/src/hfm/HFM.h @@ -310,6 +310,7 @@ public: /// Returns the unscaled extents of the model's mesh Extents getUnscaledMeshExtents() const; + const Extents& getMeshExtents() const { return meshExtents; } bool convexHullContains(const glm::vec3& point) const; diff --git a/libraries/physics/src/EntityMotionState.cpp b/libraries/physics/src/EntityMotionState.cpp index 4b635ef0be..dd906fe5c1 100644 --- a/libraries/physics/src/EntityMotionState.cpp +++ b/libraries/physics/src/EntityMotionState.cpp @@ -91,7 +91,6 @@ EntityMotionState::EntityMotionState(btCollisionShape* shape, EntityItemPointer _serverRotation = localTransform.getRotation(); _serverAcceleration = _entity->getAcceleration(); _serverActionData = _entity->getDynamicData(); - } EntityMotionState::~EntityMotionState() { From 3303bb70170c673f08d8749b4f38d4b72fa1068f Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Fri, 4 Jan 2019 12:36:45 -0800 Subject: [PATCH 16/27] EntityServer now depends on ModelFormatRegistry --- assignment-client/src/entities/EntityServer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/assignment-client/src/entities/EntityServer.cpp b/assignment-client/src/entities/EntityServer.cpp index 22308071eb..581d854909 100644 --- a/assignment-client/src/entities/EntityServer.cpp +++ b/assignment-client/src/entities/EntityServer.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include "../AssignmentDynamicFactory.h" #include "AssignmentParentFinder.h" @@ -45,6 +46,7 @@ EntityServer::EntityServer(ReceivedMessage& message) : DependencyManager::registerInheritance(); DependencyManager::set(); + DependencyManager::set(); // ModelFormatRegistry must be defined before ModelCache. See the ModelCache ctor DependencyManager::set(); auto& packetReceiver = DependencyManager::get()->getPacketReceiver(); From 5ea84fb9527b89d19f531d010ff1d54ee2ec628b Mon Sep 17 00:00:00 2001 From: David Back Date: Fri, 4 Jan 2019 15:39:27 -0800 Subject: [PATCH 17/27] CR fixes --- libraries/entities/src/EntityScriptingInterface.cpp | 5 ++--- libraries/entities/src/EntityScriptingInterface.h | 4 ++-- scripts/system/edit.js | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/libraries/entities/src/EntityScriptingInterface.cpp b/libraries/entities/src/EntityScriptingInterface.cpp index f8e58a38fb..5e4168382e 100644 --- a/libraries/entities/src/EntityScriptingInterface.cpp +++ b/libraries/entities/src/EntityScriptingInterface.cpp @@ -2273,10 +2273,9 @@ bool EntityScriptingInterface::verifyStaticCertificateProperties(const QUuid& en return result; } -const EntityPropertyInfo EntityScriptingInterface::getPropertyInfo(const QScriptValue& property) const { - const QString name = property.toString(); +const EntityPropertyInfo EntityScriptingInterface::getPropertyInfo(const QString& propertyName) const { EntityPropertyInfo propertyInfo; - EntityItemProperties::getPropertyInfo(name, propertyInfo); + EntityItemProperties::getPropertyInfo(propertyName, propertyInfo); return propertyInfo; } diff --git a/libraries/entities/src/EntityScriptingInterface.h b/libraries/entities/src/EntityScriptingInterface.h index 025c52eadf..0e96cb2d25 100644 --- a/libraries/entities/src/EntityScriptingInterface.h +++ b/libraries/entities/src/EntityScriptingInterface.h @@ -1699,11 +1699,11 @@ public slots: * Get information about entity properties including a minimum to maximum range for numerical properties * as well as property enum value. * @function Entities.getPropertyInfo - * @param {string} property - The property name to get the information for. + * @param {string} propertyName - The name of the property to get the information for. * @returns {Entities.EntityPropertyInfo} The information data including propertyEnum, minimum, and maximum * if the property can be found, otherwise an empty object. */ - Q_INVOKABLE const EntityPropertyInfo getPropertyInfo(const QScriptValue& property) const; + Q_INVOKABLE const EntityPropertyInfo getPropertyInfo(const QString& propertyName) const; signals: /**jsdoc diff --git a/scripts/system/edit.js b/scripts/system/edit.js index b9c26201b5..aec3d8bc0b 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -420,7 +420,7 @@ const DEFAULT_ENTITY_PROPERTIES = { emitOrientation: { x: 0, y: 0, z: 0, w: 1 }, emitterShouldTrail: true, particleRadius: 0.25, - radiusFinish: 0.1, + radiusStart: 0, radiusSpread: 0, particleColor: { red: 255, From 5c750b40c9ee6049f6f0a18d577f9cbd39dbb353 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Sat, 5 Jan 2019 08:03:29 -0800 Subject: [PATCH 18/27] fix copy-n-paste errors in EntityItem::contains() for cylinders --- libraries/entities/src/EntityItem.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/libraries/entities/src/EntityItem.cpp b/libraries/entities/src/EntityItem.cpp index 76dd130f70..d05f087fdb 100644 --- a/libraries/entities/src/EntityItem.cpp +++ b/libraries/entities/src/EntityItem.cpp @@ -20,6 +20,7 @@ #include #include +#include #include #include @@ -1714,9 +1715,7 @@ bool EntityItem::contains(const glm::vec3& point) const { // the above cases not yet supported --> fall through to BOX case case SHAPE_TYPE_BOX: { localPoint = glm::abs(localPoint); - return localPoint.x <= NORMALIZED_HALF_SIDE && - localPoint.y <= NORMALIZED_HALF_SIDE && - localPoint.z <= NORMALIZED_HALF_SIDE; + return glm::any(glm::lessThanEqual(localPoint, glm::vec3(NORMALIZED_HALF_SIDE))); } case SHAPE_TYPE_ELLIPSOID: { // since we've transformed into the normalized space this is just a sphere-point intersection test @@ -1726,10 +1725,10 @@ bool EntityItem::contains(const glm::vec3& point) const { return fabsf(localPoint.x) <= NORMALIZED_HALF_SIDE && localPoint.y * localPoint.y + localPoint.z * localPoint.z <= NORMALIZED_RADIUS_SQUARED; case SHAPE_TYPE_CYLINDER_Y: - return fabsf(localPoint.x) <= NORMALIZED_HALF_SIDE && + return fabsf(localPoint.y) <= NORMALIZED_HALF_SIDE && localPoint.z * localPoint.z + localPoint.x * localPoint.x <= NORMALIZED_RADIUS_SQUARED; case SHAPE_TYPE_CYLINDER_Z: - return fabsf(localPoint.x) <= NORMALIZED_HALF_SIDE && + return fabsf(localPoint.z) <= NORMALIZED_HALF_SIDE && localPoint.x * localPoint.x + localPoint.y * localPoint.y <= NORMALIZED_RADIUS_SQUARED; default: return false; From 2f99729905a733df7c39acd1ae0216b28c97282b Mon Sep 17 00:00:00 2001 From: David Back Date: Mon, 7 Jan 2019 11:31:04 -0800 Subject: [PATCH 19/27] add rect case, fix step rounding --- scripts/system/html/js/draggableNumber.js | 7 ++- scripts/system/html/js/entityProperties.js | 53 +++++++++++++++------- 2 files changed, 41 insertions(+), 19 deletions(-) diff --git a/scripts/system/html/js/draggableNumber.js b/scripts/system/html/js/draggableNumber.js index b1039ed37b..b63b6e4688 100644 --- a/scripts/system/html/js/draggableNumber.js +++ b/scripts/system/html/js/draggableNumber.js @@ -106,7 +106,7 @@ DraggableNumber.prototype = { stepUp: function() { if (!this.isDisabled()) { - this.elInput.stepUp(); + this.elInput.value = parseFloat(this.elInput.value) + this.step; this.inputChange(); if (this.valueChangeFunction) { this.valueChangeFunction(); @@ -116,7 +116,7 @@ DraggableNumber.prototype = { stepDown: function() { if (!this.isDisabled()) { - this.elInput.stepDown(); + this.elInput.value = parseFloat(this.elInput.value) - this.step; this.inputChange(); if (this.valueChangeFunction) { this.valueChangeFunction(); @@ -139,6 +139,7 @@ DraggableNumber.prototype = { }, inputChange: function() { + console.log("DBACK TEST inputChange1 elInput " + this.elInput.value + " elText " + this.elText.firstChild.data + " min " + this.min + " max " + this.max + " step " + this.step); let value = this.elInput.value; if (this.max !== undefined) { value = Math.min(this.max, value); @@ -146,7 +147,9 @@ DraggableNumber.prototype = { if (this.min !== undefined) { value = Math.max(this.min, value); } + console.log("DBACK TEST inputChange2 elInput " + this.elInput.value + " elText " + this.elText.firstChild.data + " min " + this.min + " max " + this.max + " step " + this.step); this.setValue(value); + console.log("DBACK TEST inputChange3 elInput " + this.elInput.value + " elText " + this.elText.firstChild.data + " min " + this.min + " max " + this.max + " step " + this.step); }, inputBlur: function(ev) { diff --git a/scripts/system/html/js/entityProperties.js b/scripts/system/html/js/entityProperties.js index a6c9bde84d..2a1e4d0a4e 100644 --- a/scripts/system/html/js/entityProperties.js +++ b/scripts/system/html/js/entityProperties.js @@ -1947,13 +1947,14 @@ function createNumberProperty(property, elProperty) { } function updateNumberMinMax(property) { - let propertyData = property.data; let elInput = property.elInput; - if (propertyData.min !== undefined) { - elInput.setAttribute("min", propertyData.min); + let min = property.data.min; + let max = property.data.max; + if (min !== undefined) { + elInput.setAttribute("min", min); } - if (propertyData.max !== undefined) { - elInput.setAttribute("max", propertyData.max); + if (max !== undefined) { + elInput.setAttribute("max", max); } } @@ -2029,6 +2030,15 @@ function createRectProperty(property, elProperty) { return elResult; } +function updateRectMinMax(property) { + let min = property.data.min; + let max = property.data.max; + property.elNumberX.updateMinMax(min, max); + property.elNumberY.updateMinMax(min, max); + property.elNumberWidth.updateMinMax(min, max); + property.elNumberHeight.updateMinMax(min, max); +} + function createVec3Property(property, elProperty) { let propertyData = property.data; @@ -2079,11 +2089,12 @@ function createVec2Property(property, elProperty) { } function updateVectorMinMax(property) { - let propertyData = property.data; - property.elNumberX.updateMinMax(propertyData.min, propertyData.max); - property.elNumberY.updateMinMax(propertyData.min, propertyData.max); + let min = property.data.min; + let max = property.data.max; + property.elNumberX.updateMinMax(min, max); + property.elNumberY.updateMinMax(min, max); if (property.elNumberZ) { - property.elNumberZ.updateMinMax(propertyData.min, propertyData.max); + property.elNumberZ.updateMinMax(min, max); } } @@ -3094,7 +3105,7 @@ function loaded() { properties[propertyID] = property; } if (propertyData.type === 'number' || propertyData.type === 'number-draggable' || - propertyData.type === 'vec2' || propertyData.type === 'vec3') { + propertyData.type === 'vec2' || propertyData.type === 'vec3' || propertyData.type === 'rect') { propertyRangeRequests.push(propertyID); } @@ -3473,13 +3484,21 @@ function loaded() { propertyData.max /= multiplier; } } - if (propertyData.type === 'number') { - updateNumberMinMax(properties[property]); - } else if (propertyData.type === 'number-draggable') { - updateNumberDraggableMinMax(properties[property]); - } else if (propertyData.type === 'vec2' || propertyData.type === 'vec3') { - updateVectorMinMax(properties[property]); - } + switch (propertyData.type) { + case 'number': + updateNumberMinMax(properties[property]); + break; + case 'number-draggable': + updateNumberDraggableMinMax(properties[property]); + break; + case 'vec3': + case 'vec2': + updateVectorMinMax(properties[property]); + break; + case 'rect': + updateRectMinMax(properties[property]); + break; + } } } } From 5aa5b997fe9dc785614bf61929c7e7de931af6ab Mon Sep 17 00:00:00 2001 From: David Back Date: Mon, 7 Jan 2019 11:33:08 -0800 Subject: [PATCH 20/27] remove logs --- scripts/system/html/js/draggableNumber.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/scripts/system/html/js/draggableNumber.js b/scripts/system/html/js/draggableNumber.js index b63b6e4688..0d6af01ebd 100644 --- a/scripts/system/html/js/draggableNumber.js +++ b/scripts/system/html/js/draggableNumber.js @@ -139,7 +139,6 @@ DraggableNumber.prototype = { }, inputChange: function() { - console.log("DBACK TEST inputChange1 elInput " + this.elInput.value + " elText " + this.elText.firstChild.data + " min " + this.min + " max " + this.max + " step " + this.step); let value = this.elInput.value; if (this.max !== undefined) { value = Math.min(this.max, value); @@ -147,9 +146,7 @@ DraggableNumber.prototype = { if (this.min !== undefined) { value = Math.max(this.min, value); } - console.log("DBACK TEST inputChange2 elInput " + this.elInput.value + " elText " + this.elText.firstChild.data + " min " + this.min + " max " + this.max + " step " + this.step); this.setValue(value); - console.log("DBACK TEST inputChange3 elInput " + this.elInput.value + " elText " + this.elText.firstChild.data + " min " + this.min + " max " + this.max + " step " + this.step); }, inputBlur: function(ev) { From 62dbca6ce7a19a56721913c48dfc18b926cab679 Mon Sep 17 00:00:00 2001 From: SamGondelman Date: Mon, 7 Jan 2019 14:08:52 -0800 Subject: [PATCH 21/27] fix export entities --- interface/src/scripting/ClipboardScriptingInterface.cpp | 4 ++-- interface/src/scripting/ClipboardScriptingInterface.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/interface/src/scripting/ClipboardScriptingInterface.cpp b/interface/src/scripting/ClipboardScriptingInterface.cpp index c14f4ea895..c0a6b64421 100644 --- a/interface/src/scripting/ClipboardScriptingInterface.cpp +++ b/interface/src/scripting/ClipboardScriptingInterface.cpp @@ -25,12 +25,12 @@ float ClipboardScriptingInterface::getClipboardContentsLargestDimension() { return qApp->getEntityClipboard()->getContentsLargestDimension(); } -bool ClipboardScriptingInterface::exportEntities(const QString& filename, const QVector& entityIDs) { +bool ClipboardScriptingInterface::exportEntities(const QString& filename, const QVector& entityIDs) { bool retVal; BLOCKING_INVOKE_METHOD(qApp, "exportEntities", Q_RETURN_ARG(bool, retVal), Q_ARG(const QString&, filename), - Q_ARG(const QVector&, entityIDs)); + Q_ARG(const QVector&, entityIDs)); return retVal; } diff --git a/interface/src/scripting/ClipboardScriptingInterface.h b/interface/src/scripting/ClipboardScriptingInterface.h index 60b6ca2e03..f6a0b29779 100644 --- a/interface/src/scripting/ClipboardScriptingInterface.h +++ b/interface/src/scripting/ClipboardScriptingInterface.h @@ -63,7 +63,7 @@ public: * @param {Uuid[]} entityIDs Array of IDs of the entities to export. * @returns {boolean} true if the export was successful, otherwise false. */ - Q_INVOKABLE bool exportEntities(const QString& filename, const QVector& entityIDs); + Q_INVOKABLE bool exportEntities(const QString& filename, const QVector& entityIDs); /**jsdoc * Export the entities with centers within a cube to a JSON file. From f60b272f1134e5a82158ff45bac039cc364b75a4 Mon Sep 17 00:00:00 2001 From: SamGondelman Date: Mon, 7 Jan 2019 17:19:18 -0800 Subject: [PATCH 22/27] fix crash --- libraries/networking/src/udt/PacketHeaders.cpp | 2 +- libraries/networking/src/udt/PacketHeaders.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libraries/networking/src/udt/PacketHeaders.cpp b/libraries/networking/src/udt/PacketHeaders.cpp index cd15e97739..114a0bc930 100644 --- a/libraries/networking/src/udt/PacketHeaders.cpp +++ b/libraries/networking/src/udt/PacketHeaders.cpp @@ -33,7 +33,7 @@ PacketVersion versionForPacketType(PacketType packetType) { case PacketType::EntityEdit: case PacketType::EntityData: case PacketType::EntityPhysics: - return static_cast(EntityVersion::FixPropertiesFromCleanup); + return static_cast(EntityVersion::FixProtocolVersionBumpMismatch); case PacketType::EntityQuery: return static_cast(EntityQueryPacketVersion::ConicalFrustums); case PacketType::AvatarIdentity: diff --git a/libraries/networking/src/udt/PacketHeaders.h b/libraries/networking/src/udt/PacketHeaders.h index 48f4905915..88b52ec4fb 100644 --- a/libraries/networking/src/udt/PacketHeaders.h +++ b/libraries/networking/src/udt/PacketHeaders.h @@ -254,7 +254,8 @@ enum class EntityVersion : PacketVersion { GrabTraits, MorePropertiesCleanup, FixPropertiesFromCleanup, - UpdatedPolyLines + UpdatedPolyLines, + FixProtocolVersionBumpMismatch }; enum class EntityScriptCallMethodVersion : PacketVersion { From 9013eee352c01047d4e7c4a06ea9faf6b42d3ece Mon Sep 17 00:00:00 2001 From: David Back Date: Fri, 4 Jan 2019 18:31:23 -0800 Subject: [PATCH 23/27] add grid entities to create - icons pending --- .../resources/qml/hifi/tablet/EditTabView.qml | 12 +++++ .../qml/hifi/tablet/EditToolsTabView.qml | 12 +++++ scripts/system/edit.js | 6 +++ scripts/system/html/entityList.html | 1 + scripts/system/html/entityProperties.html | 1 + scripts/system/html/js/entityList.js | 17 +----- scripts/system/html/js/entityProperties.js | 52 ++++++++++++------- scripts/system/html/js/includes.js | 27 ++++++++++ 8 files changed, 95 insertions(+), 33 deletions(-) create mode 100644 scripts/system/html/js/includes.js diff --git a/interface/resources/qml/hifi/tablet/EditTabView.qml b/interface/resources/qml/hifi/tablet/EditTabView.qml index 5959725a6a..21c8756d9a 100644 --- a/interface/resources/qml/hifi/tablet/EditTabView.qml +++ b/interface/resources/qml/hifi/tablet/EditTabView.qml @@ -189,6 +189,18 @@ TabBar { }); editTabView.currentIndex = 2 } + } + + NewEntityButton { + icon: "icons/create-icons/21-cube-01.svg" + text: "GRID" + onClicked: { + editRoot.sendToScript({ + method: "newEntityButtonClicked", + params: { buttonName: "newGridButton" } + }); + editTabView.currentIndex = 2 + } } } diff --git a/interface/resources/qml/hifi/tablet/EditToolsTabView.qml b/interface/resources/qml/hifi/tablet/EditToolsTabView.qml index 6b64520feb..dc062910ca 100644 --- a/interface/resources/qml/hifi/tablet/EditToolsTabView.qml +++ b/interface/resources/qml/hifi/tablet/EditToolsTabView.qml @@ -195,6 +195,18 @@ TabBar { }); editTabView.currentIndex = tabIndex.properties } + } + + NewEntityButton { + icon: "icons/create-icons/21-cube-01.svg" + text: "GRID" + onClicked: { + editRoot.sendToScript({ + method: "newEntityButtonClicked", + params: { buttonName: "newGridButton" } + }); + editTabView.currentIndex = tabIndex.properties + } } } diff --git a/scripts/system/edit.js b/scripts/system/edit.js index 36f9af0ea7..94fca20a9d 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -892,6 +892,12 @@ var toolBar = (function () { }); addButton("newMaterialButton", createNewEntityDialogButtonCallback("Material")); + + addButton("newGridButton", function () { + createNewEntity({ + type: "Grid", + }); + }); var deactivateCreateIfDesktopWindowsHidden = function() { if (!shouldUseEditTabletApp() && !entityListTool.isVisible() && !createToolsWindow.isVisible()) { diff --git a/scripts/system/html/entityList.html b/scripts/system/html/entityList.html index f9948bc8b0..f525c84cbc 100644 --- a/scripts/system/html/entityList.html +++ b/scripts/system/html/entityList.html @@ -19,6 +19,7 @@ + diff --git a/scripts/system/html/entityProperties.html b/scripts/system/html/entityProperties.html index a8bcabbfea..67f03a33a2 100644 --- a/scripts/system/html/entityProperties.html +++ b/scripts/system/html/entityProperties.html @@ -24,6 +24,7 @@ + diff --git a/scripts/system/html/js/entityList.js b/scripts/system/html/js/entityList.js index 156006619d..12ea6c91d0 100644 --- a/scripts/system/html/js/entityList.js +++ b/scripts/system/html/js/entityList.js @@ -153,22 +153,9 @@ const FILTER_TYPES = [ "PolyLine", "PolyVox", "Text", + "Grid", ]; -const ICON_FOR_TYPE = { - Shape: "n", - Model: "", - Image: "", - Light: "p", - Zone: "o", - Web: "q", - Material: "", - ParticleEffect: "", - PolyLine: "", - PolyVox: "", - Text: "l", -}; - const DOUBLE_CLICK_TIMEOUT = 300; // ms const RENAME_COOLDOWN = 400; // ms @@ -325,7 +312,7 @@ function loaded() { let elSpan = document.createElement('span'); elSpan.setAttribute("class", "typeIcon"); - elSpan.innerHTML = ICON_FOR_TYPE[type]; + elSpan.innerHTML = ENTITY_TYPE_ICON[type]; elLabel.insertBefore(elSpan, elLabel.childNodes[0]); diff --git a/scripts/system/html/js/entityProperties.js b/scripts/system/html/js/entityProperties.js index 3ccc5359ff..863a179d17 100644 --- a/scripts/system/html/js/entityProperties.js +++ b/scripts/system/html/js/entityProperties.js @@ -9,23 +9,6 @@ /* global alert, augmentSpinButtons, clearTimeout, console, document, Element, EventBridge, JSONEditor, openEventBridge, setTimeout, window, _ $ */ - -const ICON_FOR_TYPE = { - Box: "V", - Sphere: "n", - Shape: "n", - ParticleEffect: "", - Model: "", - Web: "q", - Image: "", - Text: "l", - Light: "p", - Zone: "o", - PolyVox: "", - Multiple: "", - PolyLine: "", - Material: "" -}; const DEGREES_TO_RADIANS = Math.PI / 180.0; @@ -44,7 +27,7 @@ const GROUPS = [ { label: NO_SELECTION, type: "icon", - icons: ICON_FOR_TYPE, + icons: ENTITY_TYPE_ICON, propertyID: "type", replaceID: "placeholder-property-type", }, @@ -662,6 +645,38 @@ const GROUPS = [ propertyID: "materialRepeat", }, ] + }, + { + id: "grid", + addToGroup: "base", + properties: [ + { + label: "Color", + type: "color", + propertyID: "color", + }, + { + label: "Follow Camera", + type: "bool", + propertyID: "followCamera", + }, + { + label: "Major Grid Every", + type: "number-draggable", + min: 0, + step: 1, + decimals: 0, + propertyID: "majorGridEvery", + }, + { + label: "Minor Grid Every", + type: "number-draggable", + min: 0, + step: 0.01, + decimals: 2, + propertyID: "minorGridEvery", + }, + ] }, { id: "particles", @@ -1427,6 +1442,7 @@ const GROUPS_PER_TYPE = { 'particles_acceleration', 'particles_spin', 'particles_constraints', 'spatial', 'behavior', 'physics' ], PolyLine: [ 'base', 'spatial', 'behavior', 'collision', 'physics' ], PolyVox: [ 'base', 'spatial', 'behavior', 'collision', 'physics' ], + Grid: [ 'base', 'grid', 'spatial', 'behavior', 'physics' ], Multiple: [ 'base', 'spatial', 'behavior', 'collision', 'physics' ], }; diff --git a/scripts/system/html/js/includes.js b/scripts/system/html/js/includes.js new file mode 100644 index 0000000000..02af65b691 --- /dev/null +++ b/scripts/system/html/js/includes.js @@ -0,0 +1,27 @@ +// +// includes.js +// +// Created by David Back on 3 Jan 2019 +// Copyright 2016 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +const ENTITY_TYPE_ICON = { + Box: "m", + Grid: "V", + Image: "", + Light: "p", + Material: "", + Model: "", + ParticleEffect: "", + PolyVox: "", + PolyLine: "", + Shape: "n", + Sphere: "n", + Text: "l", + Web: "q", + Zone: "o", + Multiple: "", +}; From e0e9a7de15abb7e91e0e96e638d81a4097199b18 Mon Sep 17 00:00:00 2001 From: David Back Date: Fri, 4 Jan 2019 18:35:00 -0800 Subject: [PATCH 24/27] tabs --- .../resources/qml/hifi/tablet/EditTabView.qml | 4 ++-- .../qml/hifi/tablet/EditToolsTabView.qml | 4 ++-- scripts/system/edit.js | 4 ++-- scripts/system/html/js/entityList.js | 2 +- scripts/system/html/js/entityProperties.js | 16 +++++++-------- scripts/system/html/js/includes.js | 20 +++++++++---------- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/interface/resources/qml/hifi/tablet/EditTabView.qml b/interface/resources/qml/hifi/tablet/EditTabView.qml index 21c8756d9a..c6b66ae24d 100644 --- a/interface/resources/qml/hifi/tablet/EditTabView.qml +++ b/interface/resources/qml/hifi/tablet/EditTabView.qml @@ -190,8 +190,8 @@ TabBar { editTabView.currentIndex = 2 } } - - NewEntityButton { + + NewEntityButton { icon: "icons/create-icons/21-cube-01.svg" text: "GRID" onClicked: { diff --git a/interface/resources/qml/hifi/tablet/EditToolsTabView.qml b/interface/resources/qml/hifi/tablet/EditToolsTabView.qml index dc062910ca..9db09cd229 100644 --- a/interface/resources/qml/hifi/tablet/EditToolsTabView.qml +++ b/interface/resources/qml/hifi/tablet/EditToolsTabView.qml @@ -196,8 +196,8 @@ TabBar { editTabView.currentIndex = tabIndex.properties } } - - NewEntityButton { + + NewEntityButton { icon: "icons/create-icons/21-cube-01.svg" text: "GRID" onClicked: { diff --git a/scripts/system/edit.js b/scripts/system/edit.js index 94fca20a9d..2bbbd60c23 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -892,8 +892,8 @@ var toolBar = (function () { }); addButton("newMaterialButton", createNewEntityDialogButtonCallback("Material")); - - addButton("newGridButton", function () { + + addButton("newGridButton", function () { createNewEntity({ type: "Grid", }); diff --git a/scripts/system/html/js/entityList.js b/scripts/system/html/js/entityList.js index 12ea6c91d0..fdf0993235 100644 --- a/scripts/system/html/js/entityList.js +++ b/scripts/system/html/js/entityList.js @@ -153,7 +153,7 @@ const FILTER_TYPES = [ "PolyLine", "PolyVox", "Text", - "Grid", + "Grid", ]; const DOUBLE_CLICK_TIMEOUT = 300; // ms diff --git a/scripts/system/html/js/entityProperties.js b/scripts/system/html/js/entityProperties.js index 863a179d17..662d883bd2 100644 --- a/scripts/system/html/js/entityProperties.js +++ b/scripts/system/html/js/entityProperties.js @@ -646,7 +646,7 @@ const GROUPS = [ }, ] }, - { + { id: "grid", addToGroup: "base", properties: [ @@ -663,17 +663,17 @@ const GROUPS = [ { label: "Major Grid Every", type: "number-draggable", - min: 0, - step: 1, - decimals: 0, + min: 0, + step: 1, + decimals: 0, propertyID: "majorGridEvery", }, - { + { label: "Minor Grid Every", type: "number-draggable", - min: 0, - step: 0.01, - decimals: 2, + min: 0, + step: 0.01, + decimals: 2, propertyID: "minorGridEvery", }, ] diff --git a/scripts/system/html/js/includes.js b/scripts/system/html/js/includes.js index 02af65b691..4d2c7f2e15 100644 --- a/scripts/system/html/js/includes.js +++ b/scripts/system/html/js/includes.js @@ -10,17 +10,17 @@ const ENTITY_TYPE_ICON = { Box: "m", - Grid: "V", - Image: "", - Light: "p", - Material: "", - Model: "", - ParticleEffect: "", - PolyVox: "", - PolyLine: "", - Shape: "n", + Grid: "V", + Image: "", + Light: "p", + Material: "", + Model: "", + ParticleEffect: "", + PolyVox: "", + PolyLine: "", + Shape: "n", Sphere: "n", - Text: "l", + Text: "l", Web: "q", Zone: "o", Multiple: "", From 7581c77be877bf56f4e1c8bde76b2f170bf90513 Mon Sep 17 00:00:00 2001 From: David Back Date: Mon, 7 Jan 2019 12:17:40 -0800 Subject: [PATCH 25/27] update tooltips, use Cube icon for now --- scripts/system/assets/data/createAppTooltips.json | 12 +++++++++--- scripts/system/html/js/includes.js | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/scripts/system/assets/data/createAppTooltips.json b/scripts/system/assets/data/createAppTooltips.json index 56341acc90..98e9088e1d 100644 --- a/scripts/system/assets/data/createAppTooltips.json +++ b/scripts/system/assets/data/createAppTooltips.json @@ -17,9 +17,6 @@ "lineHeight": { "tooltip": "The height of each line of text. This determines the size of the text." }, - "faceCamera": { - "tooltip": "If enabled, the entity follows the camera of each user, creating a billboard effect." - }, "textBillboardMode": { "tooltip": "If enabled, determines how the entity will face the camera.", "jsPropertyName": "billboardMode" @@ -356,6 +353,15 @@ "materialMappingRot": { "tooltip": "How much to rotate the material within the parent's UV-space, in degrees." }, + "followCamera": { + "tooltip": "If enabled, the grid is always visible even as the camera moves to another position." + }, + "majorGridEvery": { + "tooltip": "The number of \"Minor Grid Every\" intervals at which to draw a thick grid line." + }, + "minorGridEvery": { + "tooltip": "The real number of meters at which to draw thin grid lines." + }, "id": { "tooltip": "The unique identifier of this entity." }, diff --git a/scripts/system/html/js/includes.js b/scripts/system/html/js/includes.js index 4d2c7f2e15..01fce937bf 100644 --- a/scripts/system/html/js/includes.js +++ b/scripts/system/html/js/includes.js @@ -10,7 +10,7 @@ const ENTITY_TYPE_ICON = { Box: "m", - Grid: "V", + Grid: "m", Image: "", Light: "p", Material: "", From 90e2feb9772829cb5631fcb5e6d7ec16ce6be938 Mon Sep 17 00:00:00 2001 From: David Back Date: Mon, 7 Jan 2019 14:04:11 -0800 Subject: [PATCH 26/27] replace placeholder icon with real icon from Alan --- interface/resources/fonts/hifi-glyphs.ttf | Bin 33952 -> 34396 bytes .../icons/create-icons/142-grid-01.svg | 12 ++++++++++++ .../resources/qml/hifi/tablet/EditTabView.qml | 2 +- .../qml/hifi/tablet/EditToolsTabView.qml | 2 +- scripts/system/html/js/includes.js | 2 +- 5 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 interface/resources/icons/create-icons/142-grid-01.svg diff --git a/interface/resources/fonts/hifi-glyphs.ttf b/interface/resources/fonts/hifi-glyphs.ttf index c27553333bda29cdfd06e4c1ebdd964b83ff6175..aaeb1d2ace9c0f76f01de9035c05cf1af5f44df3 100644 GIT binary patch delta 935 zcmZ8fOK4L;6g~IlWy~|$p*BgYR&5iTUkx^SdHLA-S=826gMz6jeo9DUUeneTjao}% zsz|L=5qwxbxNuQ$BUOp$Mi4i;QK_yJU39G?-BiSl@|qyxz?^en=AL_oJ9jS$pDznV z5P;`NerJ&i3sccm)QGHvnkZy?0|^_p@CEfc68}mmEwC-Fxt$ z2N1pi!dND8V(9m87=ZCQ0H(~qnWI;vrfz^u1E)8r=|rmfo#zvP&j3QInl2{97McUd z0${y5m>+Juzv>1+4*_Z$$R!hB_r09}i~|6L1{1?W_(?|qis*rkB?i;|u5(X-!mM61 zlsl1E7Uq8e#W8^0Tznh>_WGrkUf#9ZK1;yDczwM$ua2W zhRUvAGy#pku&C-G>H%Pa31zplbCFV=p_2?ZajSGhj0j?@t#zt2#U@Ys42Yqdp3-Af zVHISc$?jBw;gB4twOK7on8D7h7F!^s1YOQ0+Vf0ZI|)0pO1LW)3@YKS)_D9>-0SHP zT_%fZMUBN>Q@y@}31W5ivZ`p6(4CESDM~1)BelmjwZ-GnHgEH^HlJBp1dNElPqXwI z2hocpGUx}I^k&VZ$Q2Gc9riWkP=XFS`-k;htz>oBtrpuqY_Z9K%_RTN6)%_7p*Uo# z!>Y*EqU=y)dch>__39uop5{zaIg>n0;vNr|SQ#Y7Rf+MG#CS84c=OuSxT>n>Q>pI~ z<5`Ju{l44HB~}KB@&1aFd-3Ei=uQ*aY*w!q0Bzl<+vUW?@&qBmjF%N{gc)Bdn!!v} z+Og3_*Dgf$DT@+B*f3MkM%eJaq8V)Xq47ek_GYw~hv9=CJ_OJLKcd>!LW3#n^ZNoV z{;2k-;MA@bc4!|94RpKotI$FsU8kv%x46+*vplJ$ll{JA-|^%?IwfX~_ocK$7uL`% OZREmg^WX28&;0>Eq`H{^ delta 552 zcmY+CKWGzC9LGPu%jK*D6>Ev2Q4$g35|Xu4iK9>eJ0NbH0YFo`1JX-G5z-3ZIDaA%v{}UJd3_?LHPknt7XTE&z+<|dRYpHTD-QCev9Q=&d;Tp9?Ez?ad^v&d zk7vFXcb)i6M8O+_17>fyDrWDIOi0%`DOV-yK9MO&;~DrB^8=8ZgnWvj%4N@t5r#?D zX4Z{`CdI9)#}&7)tu8sA+eeefSRGzPCBk~ZVIuqrSR*21&LJz2EHLiHtJ_hD@;cx! zQ3e5PMEUEyv-Ub|tGLHNCx!0M1{rj6&QB{IG4zzKr;LoABRIR$8Mn_mwtZN-Zr{#` g`(-5^_S~F(cMm4l5L5_6yl=qzME}$O?_>7<0Uo1uSpWb4 diff --git a/interface/resources/icons/create-icons/142-grid-01.svg b/interface/resources/icons/create-icons/142-grid-01.svg new file mode 100644 index 0000000000..b4353c1caa --- /dev/null +++ b/interface/resources/icons/create-icons/142-grid-01.svg @@ -0,0 +1,12 @@ + + + + + diff --git a/interface/resources/qml/hifi/tablet/EditTabView.qml b/interface/resources/qml/hifi/tablet/EditTabView.qml index c6b66ae24d..122d87250c 100644 --- a/interface/resources/qml/hifi/tablet/EditTabView.qml +++ b/interface/resources/qml/hifi/tablet/EditTabView.qml @@ -192,7 +192,7 @@ TabBar { } NewEntityButton { - icon: "icons/create-icons/21-cube-01.svg" + icon: "icons/create-icons/142-grid-01.svg" text: "GRID" onClicked: { editRoot.sendToScript({ diff --git a/interface/resources/qml/hifi/tablet/EditToolsTabView.qml b/interface/resources/qml/hifi/tablet/EditToolsTabView.qml index 9db09cd229..8da2e839ce 100644 --- a/interface/resources/qml/hifi/tablet/EditToolsTabView.qml +++ b/interface/resources/qml/hifi/tablet/EditToolsTabView.qml @@ -198,7 +198,7 @@ TabBar { } NewEntityButton { - icon: "icons/create-icons/21-cube-01.svg" + icon: "icons/create-icons/142-grid-01.svg" text: "GRID" onClicked: { editRoot.sendToScript({ diff --git a/scripts/system/html/js/includes.js b/scripts/system/html/js/includes.js index 01fce937bf..c604115f91 100644 --- a/scripts/system/html/js/includes.js +++ b/scripts/system/html/js/includes.js @@ -10,7 +10,7 @@ const ENTITY_TYPE_ICON = { Box: "m", - Grid: "m", + Grid: "", Image: "", Light: "p", Material: "", From d9e229d38e72a253fc82bee0932869ed48632fd0 Mon Sep 17 00:00:00 2001 From: David Back Date: Mon, 7 Jan 2019 17:07:28 -0800 Subject: [PATCH 27/27] remove add Grid entity button, fix color --- .../resources/icons/create-icons/142-grid-01.svg | 12 ------------ interface/resources/qml/hifi/tablet/EditTabView.qml | 12 ------------ .../resources/qml/hifi/tablet/EditToolsTabView.qml | 12 ------------ scripts/system/edit.js | 6 ------ scripts/system/html/js/entityProperties.js | 3 ++- 5 files changed, 2 insertions(+), 43 deletions(-) delete mode 100644 interface/resources/icons/create-icons/142-grid-01.svg diff --git a/interface/resources/icons/create-icons/142-grid-01.svg b/interface/resources/icons/create-icons/142-grid-01.svg deleted file mode 100644 index b4353c1caa..0000000000 --- a/interface/resources/icons/create-icons/142-grid-01.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - diff --git a/interface/resources/qml/hifi/tablet/EditTabView.qml b/interface/resources/qml/hifi/tablet/EditTabView.qml index 122d87250c..5959725a6a 100644 --- a/interface/resources/qml/hifi/tablet/EditTabView.qml +++ b/interface/resources/qml/hifi/tablet/EditTabView.qml @@ -190,18 +190,6 @@ TabBar { editTabView.currentIndex = 2 } } - - NewEntityButton { - icon: "icons/create-icons/142-grid-01.svg" - text: "GRID" - onClicked: { - editRoot.sendToScript({ - method: "newEntityButtonClicked", - params: { buttonName: "newGridButton" } - }); - editTabView.currentIndex = 2 - } - } } HifiControls.Button { diff --git a/interface/resources/qml/hifi/tablet/EditToolsTabView.qml b/interface/resources/qml/hifi/tablet/EditToolsTabView.qml index 8da2e839ce..6b64520feb 100644 --- a/interface/resources/qml/hifi/tablet/EditToolsTabView.qml +++ b/interface/resources/qml/hifi/tablet/EditToolsTabView.qml @@ -196,18 +196,6 @@ TabBar { editTabView.currentIndex = tabIndex.properties } } - - NewEntityButton { - icon: "icons/create-icons/142-grid-01.svg" - text: "GRID" - onClicked: { - editRoot.sendToScript({ - method: "newEntityButtonClicked", - params: { buttonName: "newGridButton" } - }); - editTabView.currentIndex = tabIndex.properties - } - } } HifiControls.Button { diff --git a/scripts/system/edit.js b/scripts/system/edit.js index 2bbbd60c23..36f9af0ea7 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -892,12 +892,6 @@ var toolBar = (function () { }); addButton("newMaterialButton", createNewEntityDialogButtonCallback("Material")); - - addButton("newGridButton", function () { - createNewEntity({ - type: "Grid", - }); - }); var deactivateCreateIfDesktopWindowsHidden = function() { if (!shouldUseEditTabletApp() && !entityListTool.isVisible() && !createToolsWindow.isVisible()) { diff --git a/scripts/system/html/js/entityProperties.js b/scripts/system/html/js/entityProperties.js index 662d883bd2..b7d64e4009 100644 --- a/scripts/system/html/js/entityProperties.js +++ b/scripts/system/html/js/entityProperties.js @@ -653,7 +653,8 @@ const GROUPS = [ { label: "Color", type: "color", - propertyID: "color", + propertyID: "gridColor", + propertyName: "color", // actual entity property name }, { label: "Follow Camera",