mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
when a script sets joint-data on a model-entity, send an edit packet
This commit is contained in:
parent
83f60d6e97
commit
175506bbf1
2 changed files with 33 additions and 8 deletions
|
@ -265,10 +265,13 @@ public:
|
|||
void setActionDataDirty() { _actionDataChanged = true; }
|
||||
|
||||
QList<QString> listChangedProperties();
|
||||
|
||||
|
||||
bool getDimensionsInitialized() const { return _dimensionsInitialized; }
|
||||
void setDimensionsInitialized(bool dimensionsInitialized) { _dimensionsInitialized = dimensionsInitialized; }
|
||||
|
||||
|
||||
void setJointRotationsDirty() { _jointRotationsSetChanged = true; _jointRotationsChanged = true; }
|
||||
void setJointTranslationsDirty() { _jointTranslationsSetChanged = true; _jointTranslationsChanged = true; }
|
||||
|
||||
private:
|
||||
QUuid _id;
|
||||
bool _idSet;
|
||||
|
|
|
@ -831,18 +831,40 @@ bool EntityScriptingInterface::setAbsoluteJointTranslationInObjectFrame(const QU
|
|||
int jointIndex, glm::vec3 translation) {
|
||||
if (auto entity = checkForTreeEntityAndTypeMatch(entityID, EntityTypes::Model)) {
|
||||
auto modelEntity = std::dynamic_pointer_cast<ModelEntityItem>(entity);
|
||||
return modelEntity->setAbsoluteJointTranslationInObjectFrame(jointIndex, translation);
|
||||
} else {
|
||||
return false;
|
||||
bool result = modelEntity->setAbsoluteJointTranslationInObjectFrame(jointIndex, translation);
|
||||
if (result) {
|
||||
EntityItemProperties properties;
|
||||
_entityTree->withReadLock([&] {
|
||||
properties = entity->getProperties();
|
||||
});
|
||||
|
||||
properties.setJointTranslationsDirty();
|
||||
auto now = usecTimestampNow();
|
||||
properties.setLastEdited(now);
|
||||
queueEntityMessage(PacketType::EntityEdit, entityID, properties);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool EntityScriptingInterface::setAbsoluteJointRotationInObjectFrame(const QUuid& entityID,
|
||||
int jointIndex, glm::quat rotation) {
|
||||
if (auto entity = checkForTreeEntityAndTypeMatch(entityID, EntityTypes::Model)) {
|
||||
auto modelEntity = std::dynamic_pointer_cast<ModelEntityItem>(entity);
|
||||
return modelEntity->setAbsoluteJointRotationInObjectFrame(jointIndex, rotation);
|
||||
} else {
|
||||
return false;
|
||||
bool result = modelEntity->setAbsoluteJointRotationInObjectFrame(jointIndex, rotation);
|
||||
if (result) {
|
||||
EntityItemProperties properties;
|
||||
_entityTree->withReadLock([&] {
|
||||
properties = entity->getProperties();
|
||||
});
|
||||
|
||||
properties.setJointRotationsDirty();
|
||||
auto now = usecTimestampNow();
|
||||
properties.setLastEdited(now);
|
||||
queueEntityMessage(PacketType::EntityEdit, entityID, properties);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue