mirror of
https://github.com/overte-org/overte.git
synced 2025-06-18 00:00:43 +02:00
fix shapes to property polymorph and persist
This commit is contained in:
parent
76940bad34
commit
0ec7eae58c
4 changed files with 32 additions and 38 deletions
|
@ -314,6 +314,8 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
|
||||||
CHECK_PROPERTY_CHANGE(PROP_CLIENT_ONLY, clientOnly);
|
CHECK_PROPERTY_CHANGE(PROP_CLIENT_ONLY, clientOnly);
|
||||||
CHECK_PROPERTY_CHANGE(PROP_OWNING_AVATAR_ID, owningAvatarID);
|
CHECK_PROPERTY_CHANGE(PROP_OWNING_AVATAR_ID, owningAvatarID);
|
||||||
|
|
||||||
|
CHECK_PROPERTY_CHANGE(PROP_SHAPE, shape);
|
||||||
|
|
||||||
changedProperties += _animation.getChangedProperties();
|
changedProperties += _animation.getChangedProperties();
|
||||||
changedProperties += _keyLight.getChangedProperties();
|
changedProperties += _keyLight.getChangedProperties();
|
||||||
changedProperties += _skybox.getChangedProperties();
|
changedProperties += _skybox.getChangedProperties();
|
||||||
|
@ -435,6 +437,9 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
|
||||||
if (_type == EntityTypes::Sphere) {
|
if (_type == EntityTypes::Sphere) {
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_SHAPE_TYPE, shapeType, QString("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
|
// FIXME - it seems like ParticleEffect should also support this
|
||||||
if (_type == EntityTypes::Model || _type == EntityTypes::Zone) {
|
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_STROKE_WIDTHS, properties.getStrokeWidths());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_TEXTURES, properties.getTextures());
|
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_SHAPE, properties.getShape());
|
||||||
}
|
}
|
||||||
APPEND_ENTITY_PROPERTY(PROP_MARKETPLACE_ID, properties.getMarketplaceID());
|
APPEND_ENTITY_PROPERTY(PROP_MARKETPLACE_ID, properties.getMarketplaceID());
|
||||||
|
@ -1211,7 +1220,6 @@ bool EntityItemProperties::encodeEntityEditPacket(PacketType command, EntityItem
|
||||||
} else {
|
} else {
|
||||||
packetData->discardSubTree();
|
packetData->discardSubTree();
|
||||||
}
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1434,7 +1442,12 @@ bool EntityItemProperties::decodeEntityEditPacket(const unsigned char* data, int
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_STROKE_WIDTHS, QVector<float>, setStrokeWidths);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_STROKE_WIDTHS, QVector<float>, setStrokeWidths);
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_TEXTURES, QString, setTextures);
|
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);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_SHAPE, QString, setShape);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ PacketVersion versionForPacketType(PacketType packetType) {
|
||||||
case PacketType::EntityAdd:
|
case PacketType::EntityAdd:
|
||||||
case PacketType::EntityEdit:
|
case PacketType::EntityEdit:
|
||||||
case PacketType::EntityData:
|
case PacketType::EntityData:
|
||||||
return VERSION_ENTITIES_MORE_SHAPES;
|
return VERSION_ENTITIES_PROPERLY_ENCODE_SHAPE_EDITS;
|
||||||
case PacketType::AvatarIdentity:
|
case PacketType::AvatarIdentity:
|
||||||
case PacketType::AvatarData:
|
case PacketType::AvatarData:
|
||||||
case PacketType::BulkAvatarData:
|
case PacketType::BulkAvatarData:
|
||||||
|
|
|
@ -179,6 +179,7 @@ const PacketVersion VERSION_ATMOSPHERE_REMOVED = 56;
|
||||||
const PacketVersion VERSION_LIGHT_HAS_FALLOFF_RADIUS = 57;
|
const PacketVersion VERSION_LIGHT_HAS_FALLOFF_RADIUS = 57;
|
||||||
const PacketVersion VERSION_ENTITIES_NO_FLY_ZONES = 58;
|
const PacketVersion VERSION_ENTITIES_NO_FLY_ZONES = 58;
|
||||||
const PacketVersion VERSION_ENTITIES_MORE_SHAPES = 59;
|
const PacketVersion VERSION_ENTITIES_MORE_SHAPES = 59;
|
||||||
|
const PacketVersion VERSION_ENTITIES_PROPERLY_ENCODE_SHAPE_EDITS = 60;
|
||||||
|
|
||||||
enum class AvatarMixerPacketVersion : PacketVersion {
|
enum class AvatarMixerPacketVersion : PacketVersion {
|
||||||
TranslationSupport = 17,
|
TranslationSupport = 17,
|
||||||
|
|
|
@ -557,7 +557,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
properties = data.selections[0].properties;
|
properties = data.selections[0].properties;
|
||||||
|
|
||||||
elID.innerHTML = properties.id;
|
elID.innerHTML = properties.id;
|
||||||
|
|
||||||
elType.innerHTML = properties.type;
|
elType.innerHTML = properties.type;
|
||||||
|
@ -675,6 +674,9 @@
|
||||||
for (var i = 0; i < elShapeSections.length; i++) {
|
for (var i = 0; i < elShapeSections.length; i++) {
|
||||||
elShapeSections[i].style.display = 'table';
|
elShapeSections[i].style.display = 'table';
|
||||||
}
|
}
|
||||||
|
elShape.value = properties.shape;
|
||||||
|
setDropdownText(elShape);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
for (var i = 0; i < elShapeSections.length; i++) {
|
for (var i = 0; i < elShapeSections.length; i++) {
|
||||||
console.log("Hiding shape section " + elShapeSections[i])
|
console.log("Hiding shape section " + elShapeSections[i])
|
||||||
|
@ -1349,6 +1351,17 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr />
|
<hr />
|
||||||
|
<div class="shape-group shape-section property dropdown">
|
||||||
|
<label for="property-shape">Shape</label>
|
||||||
|
<select name="SelectShape" id="property-shape">
|
||||||
|
<option value="Cube">Box</option>
|
||||||
|
<option value="Sphere">Sphere</option>
|
||||||
|
<option value="Tetrahedron">Tetrahedron</option>
|
||||||
|
<option value="Octahedron">Octahedron</option>
|
||||||
|
<option value="Icosahedron">Icosahedron</option>
|
||||||
|
<option value="Dodecahedron">Dodecahedron</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
<div class="property text">
|
<div class="property text">
|
||||||
<label for="property-name">Name</label>
|
<label for="property-name">Name</label>
|
||||||
<input type="text" id="property-name">
|
<input type="text" id="property-name">
|
||||||
|
@ -1362,39 +1375,6 @@
|
||||||
<span id="property-id" class="selectable"></span>
|
<span id="property-id" class="selectable"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="section-header shape-group shape-section">
|
|
||||||
<label>Shape</label><span>M</span>
|
|
||||||
</div>
|
|
||||||
<div class="shape-group shape-section property dropdown">
|
|
||||||
<label for="property-shape">Shape</label>
|
|
||||||
<select name="SelectShape" id="property-shape">
|
|
||||||
<option value="Cube">Box</option>
|
|
||||||
<option value="Sphere">Sphere</option>
|
|
||||||
<option value="Tetrahedron">Tetrahedron</option>
|
|
||||||
<option value="Octahedron">Octahedron</option>
|
|
||||||
<option value="Icosahedron">Icosahedron</option>
|
|
||||||
<option value="Dodecahedron">Dodecahedron</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="shape-group shape-section property text">
|
|
||||||
<label>Temp</label>
|
|
||||||
<input type="text" id="property-temp-1">
|
|
||||||
</div>
|
|
||||||
<div class="shape-group shape-section property text">
|
|
||||||
<label>Temp</label>
|
|
||||||
<input type="text" id="property-temp-2">
|
|
||||||
</div>
|
|
||||||
<!--
|
|
||||||
<div class="shape-group shape-section property text">
|
|
||||||
<label>Temp</label>
|
|
||||||
<input type="text" id="property-temp-3">
|
|
||||||
</div>
|
|
||||||
<div class="shape-group shape-section property text">
|
|
||||||
<label>Temp</label>
|
|
||||||
<input type="text" id="property-temp-4">
|
|
||||||
</div>
|
|
||||||
-->
|
|
||||||
|
|
||||||
<div class="section-header hyperlink-group hyperlink-section">
|
<div class="section-header hyperlink-group hyperlink-section">
|
||||||
<label>Hyperlink</label><span>M</span>
|
<label>Hyperlink</label><span>M</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue