mirror of
https://github.com/lubosz/overte.git
synced 2025-04-23 09:25:31 +02:00
Working fade again
This commit is contained in:
parent
66d09a4c3c
commit
cc4e168369
3 changed files with 20 additions and 33 deletions
|
@ -242,6 +242,8 @@ bool RenderableModelEntityItem::addToScene(const EntityItemPointer& self, const
|
|||
|
||||
// note: we don't mind if the model fails to add, we'll retry (in render()) until it succeeds
|
||||
_model->addToScene(scene, transaction, statusGetters);
|
||||
|
||||
transaction.transitionItem(_myMetaItem, render::Transition::ELEMENT_ENTER_LEAVE_DOMAIN);
|
||||
}
|
||||
|
||||
// we've successfully added _myMetaItem so we always return true
|
||||
|
@ -475,6 +477,8 @@ void RenderableModelEntityItem::render(RenderArgs* args) {
|
|||
makeEntityItemStatusGetters(getThisPointer(), statusGetters);
|
||||
_model->addToScene(scene, transaction, statusGetters);
|
||||
|
||||
transaction.transitionItem(_myMetaItem, render::Transition::ELEMENT_ENTER_LEAVE_DOMAIN);
|
||||
|
||||
scene->enqueueTransaction(transaction);
|
||||
}
|
||||
|
||||
|
@ -490,23 +494,6 @@ ModelPointer RenderableModelEntityItem::getModelNotSafe() {
|
|||
return _model;
|
||||
}
|
||||
|
||||
void RenderableModelEntityItem::setModelURLFinished(bool success) {
|
||||
if (success) {
|
||||
const render::ScenePointer& scene = AbstractViewStateInterface::instance()->getMain3DScene();
|
||||
|
||||
if (scene->isAllocatedID(_myMetaItem)) {
|
||||
render::Transaction transaction;
|
||||
|
||||
const auto& item = scene->getItem(_myMetaItem);
|
||||
if (!item.exist()) {
|
||||
qWarning() << "Starting transition on item without payload";
|
||||
}
|
||||
transaction.transitionItem(_myMetaItem, render::Transition::ELEMENT_ENTER_LEAVE_DOMAIN);
|
||||
scene->enqueueTransaction(transaction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ModelPointer RenderableModelEntityItem::getModel() {
|
||||
// make sure our renderer is setup
|
||||
if (!_myRenderer) {
|
||||
|
@ -524,7 +511,6 @@ ModelPointer RenderableModelEntityItem::getModel() {
|
|||
// If we don't have a model, allocate one *immediately*
|
||||
if (!_model) {
|
||||
_model = _myRenderer->allocateModel(getModelURL(), _myRenderer->getEntityLoadingPriority(*this), this);
|
||||
QObject::connect(_model.get(), &Model::setURLFinished, this, &RenderableModelEntityItem::setModelURLFinished);
|
||||
_needsInitialSimulation = true;
|
||||
// If we need to change URLs, update it *after rendering* (to avoid access violations)
|
||||
} else if (QUrl(getModelURL()) != _model->getURL()) {
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#ifndef hifi_RenderableModelEntityItem_h
|
||||
#define hifi_RenderableModelEntityItem_h
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
|
@ -25,8 +24,7 @@
|
|||
class Model;
|
||||
class EntityTreeRenderer;
|
||||
|
||||
class RenderableModelEntityItem : public QObject, public ModelEntityItem, RenderableEntityInterface {
|
||||
Q_OBJECT
|
||||
class RenderableModelEntityItem : public ModelEntityItem, RenderableEntityInterface {
|
||||
public:
|
||||
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties);
|
||||
|
||||
|
@ -121,10 +119,6 @@ public:
|
|||
return _animation;
|
||||
}
|
||||
|
||||
public slots:
|
||||
|
||||
void setModelURLFinished(bool success);
|
||||
|
||||
private:
|
||||
QVariantMap parseTexturesToMap(QString textures);
|
||||
void remapTextures();
|
||||
|
|
|
@ -238,17 +238,24 @@ void Scene::transitionItems(const ItemIDs& ids, const TransitionTypes& types) {
|
|||
auto transitionStage = getStage<TransitionStage>(TransitionStage::getName());
|
||||
|
||||
for (auto itemId : ids) {
|
||||
auto transitionId = INVALID_INDEX;
|
||||
|
||||
if (*transitionType != Transition::NONE) {
|
||||
transitionId = transitionStage->addTransition(itemId, *transitionType);
|
||||
}
|
||||
else {
|
||||
// Access the true item
|
||||
const auto& item = _items[itemId];
|
||||
if (item.exist()) {
|
||||
auto transitionId = INVALID_INDEX;
|
||||
const auto& item = _items[itemId];
|
||||
transitionStage->removeTransition(item.getTransitionId());
|
||||
|
||||
// Remove pre-existing transition, if need be
|
||||
if (item.getTransitionId() == render::TransitionStage::INVALID_INDEX) {
|
||||
transitionStage->removeTransition(item.getTransitionId());
|
||||
}
|
||||
// Add a new one.
|
||||
if (*transitionType != Transition::NONE) {
|
||||
transitionId = transitionStage->addTransition(itemId, *transitionType);
|
||||
}
|
||||
|
||||
setItemTransition(itemId, transitionId);
|
||||
}
|
||||
|
||||
setItemTransition(itemId, transitionId);
|
||||
// next loop
|
||||
transitionType++;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue