diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index f273507d0d..ba39727ff9 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -314,6 +314,8 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const { CHECK_PROPERTY_CHANGE(PROP_CLIENT_ONLY, clientOnly); CHECK_PROPERTY_CHANGE(PROP_OWNING_AVATAR_ID, owningAvatarID); + CHECK_PROPERTY_CHANGE(PROP_SHAPE, shape); + changedProperties += _animation.getChangedProperties(); changedProperties += _keyLight.getChangedProperties(); changedProperties += _skybox.getChangedProperties(); @@ -435,6 +437,9 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool if (_type == EntityTypes::Sphere) { COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_SHAPE_TYPE, shapeType, QString("Sphere")); } + if (_type == EntityTypes::Box || _type == EntityTypes::Sphere || _type == EntityTypes::Shape) { + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_SHAPE, shape); + } // FIXME - it seems like ParticleEffect should also support this if (_type == EntityTypes::Model || _type == EntityTypes::Zone) { @@ -1144,7 +1149,11 @@ bool EntityItemProperties::encodeEntityEditPacket(PacketType command, EntityItem APPEND_ENTITY_PROPERTY(PROP_STROKE_WIDTHS, properties.getStrokeWidths()); APPEND_ENTITY_PROPERTY(PROP_TEXTURES, properties.getTextures()); } - if (properties.getType() == EntityTypes::Shape) { + // 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_MARKETPLACE_ID, properties.getMarketplaceID()); @@ -1211,7 +1220,6 @@ bool EntityItemProperties::encodeEntityEditPacket(PacketType command, EntityItem } else { packetData->discardSubTree(); } - return success; } @@ -1434,7 +1442,12 @@ bool EntityItemProperties::decodeEntityEditPacket(const unsigned char* data, int READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_STROKE_WIDTHS, QVector, setStrokeWidths); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_TEXTURES, QString, setTextures); } - if (properties.getType() == EntityTypes::Shape) { + + // 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) { READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_SHAPE, QString, setShape); } diff --git a/libraries/networking/src/udt/PacketHeaders.cpp b/libraries/networking/src/udt/PacketHeaders.cpp index 92e5b52f75..db743f81e4 100644 --- a/libraries/networking/src/udt/PacketHeaders.cpp +++ b/libraries/networking/src/udt/PacketHeaders.cpp @@ -49,7 +49,7 @@ PacketVersion versionForPacketType(PacketType packetType) { case PacketType::EntityAdd: case PacketType::EntityEdit: case PacketType::EntityData: - return VERSION_ENTITIES_MORE_SHAPES; + return VERSION_ENTITIES_PROPERLY_ENCODE_SHAPE_EDITS; case PacketType::AvatarIdentity: case PacketType::AvatarData: case PacketType::BulkAvatarData: diff --git a/libraries/networking/src/udt/PacketHeaders.h b/libraries/networking/src/udt/PacketHeaders.h index 97398c6744..320635379d 100644 --- a/libraries/networking/src/udt/PacketHeaders.h +++ b/libraries/networking/src/udt/PacketHeaders.h @@ -179,6 +179,7 @@ const PacketVersion VERSION_ATMOSPHERE_REMOVED = 56; const PacketVersion VERSION_LIGHT_HAS_FALLOFF_RADIUS = 57; const PacketVersion VERSION_ENTITIES_NO_FLY_ZONES = 58; const PacketVersion VERSION_ENTITIES_MORE_SHAPES = 59; +const PacketVersion VERSION_ENTITIES_PROPERLY_ENCODE_SHAPE_EDITS = 60; enum class AvatarMixerPacketVersion : PacketVersion { TranslationSupport = 17, diff --git a/scripts/system/html/entityProperties.html b/scripts/system/html/entityProperties.html index 5c87f753d9..2a82d8fa74 100644 --- a/scripts/system/html/entityProperties.html +++ b/scripts/system/html/entityProperties.html @@ -557,7 +557,6 @@ } properties = data.selections[0].properties; - elID.innerHTML = properties.id; elType.innerHTML = properties.type; @@ -675,6 +674,9 @@ for (var i = 0; i < elShapeSections.length; i++) { elShapeSections[i].style.display = 'table'; } + elShape.value = properties.shape; + setDropdownText(elShape); + } else { for (var i = 0; i < elShapeSections.length; i++) { console.log("Hiding shape section " + elShapeSections[i]) @@ -1349,6 +1351,17 @@
+
@@ -1362,39 +1375,6 @@
-
- M -
- -
- - -
-
- - -
- -