This commit is contained in:
samcake 2018-05-17 18:06:46 -07:00
parent 0cf87748cd
commit aa18aaa7b1
4 changed files with 21 additions and 3 deletions

View file

@ -1127,8 +1127,8 @@ void MyAvatar::setEnableDebugDrawIKChains(bool isEnabled) {
}
void MyAvatar::setEnableMeshVisible(bool isEnabled) {
// TODO: This should tell the main MetaRenderItem of the Avatar to be hidden to control vsisiblity since the model is culled by the MetaRI.
_skeletonModel->setVisibleInScene(isEnabled, qApp->getMain3DScene(), render::ItemKey::TAG_BITS_0 | render::ItemKey::TAG_BITS_1, true);
Avatar::setEnableMeshVisible(isEnabled);
}
void MyAvatar::setEnableInverseKinematics(bool isEnabled) {

View file

@ -1159,7 +1159,7 @@ public slots:
* @function MyAvatar.getEnableMeshVisible
* @returns {boolean} <code>true</code> if your avatar's mesh is visible, otherwise <code>false</code>.
*/
bool getEnableMeshVisible() const { return _skeletonModel->isVisible(); }
bool getEnableMeshVisible() const override { return _skeletonModel->isVisible(); }
/**jsdoc
* Set whether or not your avatar mesh is visible.
@ -1171,7 +1171,7 @@ public slots:
* MyAvatar.setEnableMeshVisible(true);
* }, 10000);
*/
void setEnableMeshVisible(bool isEnabled);
void setEnableMeshVisible(bool isEnabled) override;
/**jsdoc
* @function MyAvatar.setEnableInverseKinematics

View file

@ -765,6 +765,20 @@ void Avatar::render(RenderArgs* renderArgs) {
}
}
void Avatar::setEnableMeshVisible(bool isEnabled) {
render::Transaction transaction;
if (render::Item::isValidID(_renderItemID)) {
transaction.updateItem<render::Payload<AvatarData>>(_renderItemID, [](render::Payload<AvatarData>& p) {
});
}
qApp->getMain3DScene()->enqueueTransaction(transaction);
}
bool Avatar::getEnableMeshVisible() const {
return true;
}
void Avatar::fixupModelsInScene(const render::ScenePointer& scene) {
bool canTryFade{ false };

View file

@ -356,6 +356,10 @@ public:
virtual void setAvatarEntityDataChanged(bool value) override;
// Show hide the model representation of the avatar
virtual void setEnableMeshVisible(bool isEnabled);
virtual bool getEnableMeshVisible() const;
void addMaterial(graphics::MaterialLayer material, const std::string& parentMaterialName) override;
void removeMaterial(graphics::MaterialPointer material, const std::string& parentMaterialName) override;