mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-29 19:02:55 +02:00
Merge branch 'update-model-meta' of github.com:sethalves/hifi into avatar-entities-3
This commit is contained in:
commit
bfac7c6f68
3 changed files with 24 additions and 4 deletions
|
@ -799,13 +799,26 @@ void RenderableModelEntityItem::locationChanged(bool tellPhysics) {
|
||||||
_model->setRotation(getRotation());
|
_model->setRotation(getRotation());
|
||||||
_model->setTranslation(getPosition());
|
_model->setTranslation(getPosition());
|
||||||
|
|
||||||
auto myMetaItemCopy = _myMetaItem;
|
|
||||||
|
|
||||||
void* key = (void*)this;
|
void* key = (void*)this;
|
||||||
AbstractViewStateInterface::instance()->pushPostUpdateLambda(key, [myMetaItemCopy]() {
|
std::weak_ptr<RenderableModelEntityItem> weakSelf =
|
||||||
|
std::static_pointer_cast<RenderableModelEntityItem>(getThisPointer());
|
||||||
|
|
||||||
|
AbstractViewStateInterface::instance()->pushPostUpdateLambda(key, [weakSelf]() {
|
||||||
|
auto self = weakSelf.lock();
|
||||||
|
if (!self) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
render::ItemID myMetaItem = self->getMetaRenderItem();
|
||||||
|
|
||||||
|
if (myMetaItem == render::Item::INVALID_ITEM_ID) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
render::ScenePointer scene = AbstractViewStateInterface::instance()->getMain3DScene();
|
render::ScenePointer scene = AbstractViewStateInterface::instance()->getMain3DScene();
|
||||||
render::PendingChanges pendingChanges;
|
render::PendingChanges pendingChanges;
|
||||||
pendingChanges.updateItem<RenderableModelEntityItemMeta>(myMetaItemCopy, [](RenderableModelEntityItemMeta& data){});
|
|
||||||
|
pendingChanges.updateItem(myMetaItem);
|
||||||
scene->enqueuePendingChanges(pendingChanges);
|
scene->enqueuePendingChanges(pendingChanges);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,6 +89,8 @@ public:
|
||||||
bool hasRenderAnimation() const { return !_renderAnimationProperties.getURL().isEmpty(); }
|
bool hasRenderAnimation() const { return !_renderAnimationProperties.getURL().isEmpty(); }
|
||||||
const QString& getRenderAnimationURL() const { return _renderAnimationProperties.getURL(); }
|
const QString& getRenderAnimationURL() const { return _renderAnimationProperties.getURL(); }
|
||||||
|
|
||||||
|
render::ItemID getMetaRenderItem() { return _myMetaItem; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVariantMap parseTexturesToMap(QString textures);
|
QVariantMap parseTexturesToMap(QString textures);
|
||||||
void remapTextures();
|
void remapTextures();
|
||||||
|
|
|
@ -157,6 +157,11 @@ void Scene::updateItems(const ItemIDs& ids, UpdateFunctors& functors) {
|
||||||
|
|
||||||
auto updateFunctor = functors.begin();
|
auto updateFunctor = functors.begin();
|
||||||
for (auto updateID : ids) {
|
for (auto updateID : ids) {
|
||||||
|
if (updateID == Item::INVALID_ITEM_ID) {
|
||||||
|
updateFunctor++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Access the true item
|
// Access the true item
|
||||||
auto& item = _items[updateID];
|
auto& item = _items[updateID];
|
||||||
auto oldCell = item.getCell();
|
auto oldCell = item.getCell();
|
||||||
|
|
Loading…
Reference in a new issue