mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 03:03:35 +02:00
Add method to check entities joint hierarchy
This commit is contained in:
parent
2586811e76
commit
ad42f6a590
6 changed files with 22 additions and 1 deletions
|
@ -774,6 +774,14 @@ bool RenderableModelEntityItem::shouldBePhysical() const {
|
|||
}
|
||||
}
|
||||
|
||||
int RenderableModelEntityItem::getJointParent(int index) const {
|
||||
auto model = getModel();
|
||||
if (model) {
|
||||
return model->getRig().getJointParentIndex(index);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
glm::quat RenderableModelEntityItem::getAbsoluteJointRotationInObjectFrame(int index) const {
|
||||
auto model = getModel();
|
||||
if (model) {
|
||||
|
|
|
@ -94,6 +94,7 @@ public:
|
|||
// these are in the frame of this object (model space)
|
||||
virtual glm::quat getAbsoluteJointRotationInObjectFrame(int index) const override;
|
||||
virtual glm::vec3 getAbsoluteJointTranslationInObjectFrame(int index) const override;
|
||||
virtual int getJointParent(int index) const override;
|
||||
virtual bool setAbsoluteJointRotationInObjectFrame(int index, const glm::quat& rotation) override;
|
||||
virtual bool setAbsoluteJointTranslationInObjectFrame(int index, const glm::vec3& translation) override;
|
||||
|
||||
|
|
|
@ -455,6 +455,7 @@ public:
|
|||
// these are in the frame of this object
|
||||
virtual glm::quat getAbsoluteJointRotationInObjectFrame(int index) const override { return glm::quat(); }
|
||||
virtual glm::vec3 getAbsoluteJointTranslationInObjectFrame(int index) const override { return glm::vec3(0.0f); }
|
||||
virtual int getJointParent(int index) const override { return -1; }
|
||||
|
||||
virtual bool setLocalJointRotation(int index, const glm::quat& rotation) override { return false; }
|
||||
virtual bool setLocalJointTranslation(int index, const glm::vec3& translation) override { return false; }
|
||||
|
|
|
@ -1806,6 +1806,15 @@ glm::vec3 EntityScriptingInterface::localCoordsToVoxelCoords(const QUuid& entity
|
|||
}
|
||||
}
|
||||
|
||||
int EntityScriptingInterface::getJointParent(const QUuid& entityID, int index) {
|
||||
if (auto entity = checkForTreeEntityAndTypeMatch(entityID, EntityTypes::Model)) {
|
||||
auto modelEntity = std::dynamic_pointer_cast<ModelEntityItem>(entity);
|
||||
return modelEntity->getJointParent(index);
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
glm::vec3 EntityScriptingInterface::getAbsoluteJointTranslationInObjectFrame(const QUuid& entityID, int jointIndex) {
|
||||
if (auto entity = checkForTreeEntityAndTypeMatch(entityID, EntityTypes::Model)) {
|
||||
auto modelEntity = std::dynamic_pointer_cast<ModelEntityItem>(entity);
|
||||
|
|
|
@ -980,7 +980,7 @@ public slots:
|
|||
*/
|
||||
// FIXME move to a renderable entity interface
|
||||
Q_INVOKABLE glm::vec3 getAbsoluteJointTranslationInObjectFrame(const QUuid& entityID, int jointIndex);
|
||||
|
||||
Q_INVOKABLE int getJointParent(const QUuid& entityID, int index);
|
||||
/**jsdoc
|
||||
* Get the translation of a joint in a {@link Entities.EntityType|Model} entity relative to the entity's position and
|
||||
* orientation.
|
||||
|
|
|
@ -163,6 +163,8 @@ public:
|
|||
virtual glm::vec3 getAbsoluteJointScaleInObjectFrame(int index) const { return glm::vec3(1.0f); }
|
||||
virtual glm::quat getAbsoluteJointRotationInObjectFrame(int index) const { return glm::quat(); }
|
||||
virtual glm::vec3 getAbsoluteJointTranslationInObjectFrame(int index) const { return glm::vec3(); }
|
||||
virtual int getJointParent(int index) const { return -1; }
|
||||
|
||||
virtual bool setAbsoluteJointRotationInObjectFrame(int index, const glm::quat& rotation) { return false; }
|
||||
virtual bool setAbsoluteJointTranslationInObjectFrame(int index, const glm::vec3& translation) {return false; }
|
||||
|
||||
|
|
Loading…
Reference in a new issue