mirror of
https://github.com/overte-org/overte.git
synced 2025-04-16 21:02:17 +02:00
added support for exporting parentJointName
This commit is contained in:
parent
c3754d6369
commit
627fee80ec
4 changed files with 21 additions and 4 deletions
|
@ -4003,6 +4003,7 @@ bool Application::exportEntities(const QString& filename,
|
|||
|
||||
auto entityTree = getEntities()->getTree();
|
||||
auto exportTree = std::make_shared<EntityTree>();
|
||||
exportTree->setMyAvatar(getMyAvatar());
|
||||
exportTree->createRootElement();
|
||||
glm::vec3 root(TREE_SCALE, TREE_SCALE, TREE_SCALE);
|
||||
bool success = true;
|
||||
|
|
|
@ -2254,7 +2254,8 @@ bool EntityTree::writeToMap(QVariantMap& entityDescription, OctreeElementPointer
|
|||
entityDescription["Entities"] = QVariantList();
|
||||
}
|
||||
QScriptEngine scriptEngine;
|
||||
RecurseOctreeToMapOperator theOperator(entityDescription, element, &scriptEngine, skipDefaultValues, skipThoseWithBadParents);
|
||||
RecurseOctreeToMapOperator theOperator(entityDescription, element, &scriptEngine, skipDefaultValues,
|
||||
skipThoseWithBadParents, _myAvatar);
|
||||
recurseTreeWithOperator(&theOperator);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -17,13 +17,15 @@ RecurseOctreeToMapOperator::RecurseOctreeToMapOperator(QVariantMap& map,
|
|||
const OctreeElementPointer& top,
|
||||
QScriptEngine* engine,
|
||||
bool skipDefaultValues,
|
||||
bool skipThoseWithBadParents) :
|
||||
bool skipThoseWithBadParents,
|
||||
std::shared_ptr<AvatarData> myAvatar) :
|
||||
RecurseOctreeOperator(),
|
||||
_map(map),
|
||||
_top(top),
|
||||
_engine(engine),
|
||||
_skipDefaultValues(skipDefaultValues),
|
||||
_skipThoseWithBadParents(skipThoseWithBadParents)
|
||||
_skipThoseWithBadParents(skipThoseWithBadParents),
|
||||
_myAvatar(myAvatar)
|
||||
{
|
||||
// if some element "top" was given, only save information for that element and its children.
|
||||
if (_top) {
|
||||
|
@ -60,6 +62,18 @@ bool RecurseOctreeToMapOperator::postRecursion(const OctreeElementPointer& eleme
|
|||
} else {
|
||||
qScriptValues = EntityItemPropertiesToScriptValue(_engine, properties);
|
||||
}
|
||||
|
||||
// handle parentJointName for wearables
|
||||
if (_myAvatar && entityItem->getParentID() == AVATAR_SELF_ID &&
|
||||
entityItem->getParentJointIndex() != INVALID_JOINT_INDEX) {
|
||||
|
||||
auto jointNames = _myAvatar->getJointNames();
|
||||
auto parentJointIndex = entityItem->getParentJointIndex();
|
||||
if (parentJointIndex < jointNames.count()) {
|
||||
qScriptValues.setProperty("parentJointName", jointNames.at(parentJointIndex));
|
||||
}
|
||||
}
|
||||
|
||||
entitiesQList << qScriptValues.toVariant();
|
||||
});
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
class RecurseOctreeToMapOperator : public RecurseOctreeOperator {
|
||||
public:
|
||||
RecurseOctreeToMapOperator(QVariantMap& map, const OctreeElementPointer& top, QScriptEngine* engine, bool skipDefaultValues,
|
||||
bool skipThoseWithBadParents);
|
||||
bool skipThoseWithBadParents, std::shared_ptr<AvatarData> myAvatar);
|
||||
bool preRecursion(const OctreeElementPointer& element) override;
|
||||
bool postRecursion(const OctreeElementPointer& element) override;
|
||||
private:
|
||||
|
@ -24,4 +24,5 @@ public:
|
|||
bool _withinTop;
|
||||
bool _skipDefaultValues;
|
||||
bool _skipThoseWithBadParents;
|
||||
std::shared_ptr<AvatarData> _myAvatar;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue