mirror of
https://github.com/lubosz/overte.git
synced 2025-04-16 09:29:16 +02:00
update soft entities and fix deadlock
This commit is contained in:
parent
c1dc0ff2ec
commit
c1c853790b
3 changed files with 32 additions and 6 deletions
|
@ -100,6 +100,21 @@ Rectangle {
|
|||
wearablesModel.setProperty(wearableIndex, 'properties', wearableModelItemProperties);
|
||||
}
|
||||
|
||||
function entityHasAvatarJoints(entityID) {
|
||||
console.log(entityID);
|
||||
var hasAvatarJoint = false;
|
||||
var entityJointNames = Entities.getJointNames(entityID);
|
||||
for (var index = 0; index < entityJointNames.length; index++) {
|
||||
var avatarJointIndex = MyAvatar.getJointIndex(entityJointNames[index]);
|
||||
if (avatarJointIndex >= 0) {
|
||||
hasAvatarJoint = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return hasAvatarJoint;
|
||||
}
|
||||
|
||||
function getCurrentWearable() {
|
||||
return wearablesCombobox.currentIndex !== -1 ? wearablesCombobox.model.get(wearablesCombobox.currentIndex) : null;
|
||||
}
|
||||
|
@ -109,6 +124,7 @@ Rectangle {
|
|||
var wearable = wearablesCombobox.model.get(i);
|
||||
if (wearable.id === entityID) {
|
||||
wearablesCombobox.currentIndex = i;
|
||||
isSoft.enabled = entityHasAvatarJoints(entityID);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -248,12 +264,16 @@ Rectangle {
|
|||
var scale = currentWearable ? currentWearable.dimensions.x / currentWearable.naturalDimensions.x : 1.0;
|
||||
var joint = currentWearable ? currentWearable.parentJointIndex : -1;
|
||||
var soft = currentWearable ? currentWearable.relayParentJoints : false;
|
||||
var softEnabled = currentWearable ? entityHasAvatarJoints(currentWearable.id) : false;
|
||||
|
||||
|
||||
positionVector.set(position);
|
||||
rotationVector.set(rotation);
|
||||
scalespinner.set(scale);
|
||||
jointsCombobox.set(joint);
|
||||
isSoft.set(soft);
|
||||
isSoft.enabled = softEnabled;
|
||||
|
||||
|
||||
if (currentWearable) {
|
||||
wearableSelected(currentWearable.id);
|
||||
|
|
|
@ -436,9 +436,13 @@ void Avatar::relayJointDataToChildren() {
|
|||
modelEntity->setLocalJointTranslation(jointIndex, jointTranslation);
|
||||
}
|
||||
}
|
||||
|
||||
Transform finalTransform;
|
||||
Transform avatarTransform = _skeletonModel->getTransform();
|
||||
avatarTransform.setScale(_skeletonModel->getScale());
|
||||
modelEntity->setOverrideTransform(avatarTransform, _skeletonModel->getOffset());
|
||||
Transform entityTransform = modelEntity->getLocalTransform();
|
||||
Transform::mult(finalTransform, avatarTransform, entityTransform);
|
||||
finalTransform.setScale(_skeletonModel->getScale());
|
||||
modelEntity->setOverrideTransform(finalTransform, _skeletonModel->getOffset());
|
||||
modelEntity->simulateRelayedJoints();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1626,8 +1626,9 @@ int EntityScriptingInterface::getJointIndex(const QUuid& entityID, const QString
|
|||
return -1;
|
||||
}
|
||||
int result;
|
||||
BLOCKING_INVOKE_METHOD(_entityTree.get(), "getJointIndex",
|
||||
Q_RETURN_ARG(int, result), Q_ARG(QUuid, entityID), Q_ARG(QString, name));
|
||||
_entityTree->withReadLock([&] {
|
||||
result = _entityTree->getJointIndex(entityID, name);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -1636,8 +1637,9 @@ QStringList EntityScriptingInterface::getJointNames(const QUuid& entityID) {
|
|||
return QStringList();
|
||||
}
|
||||
QStringList result;
|
||||
BLOCKING_INVOKE_METHOD(_entityTree.get(), "getJointNames",
|
||||
Q_RETURN_ARG(QStringList, result), Q_ARG(QUuid, entityID));
|
||||
_entityTree->withReadLock([&] {
|
||||
result = _entityTree->getJointNames(entityID);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue