mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 23:03:12 +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
|
// note: we don't mind if the model fails to add, we'll retry (in render()) until it succeeds
|
||||||
_model->addToScene(scene, transaction, statusGetters);
|
_model->addToScene(scene, transaction, statusGetters);
|
||||||
|
|
||||||
|
transaction.transitionItem(_myMetaItem, render::Transition::ELEMENT_ENTER_LEAVE_DOMAIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
// we've successfully added _myMetaItem so we always return true
|
// we've successfully added _myMetaItem so we always return true
|
||||||
|
@ -475,6 +477,8 @@ void RenderableModelEntityItem::render(RenderArgs* args) {
|
||||||
makeEntityItemStatusGetters(getThisPointer(), statusGetters);
|
makeEntityItemStatusGetters(getThisPointer(), statusGetters);
|
||||||
_model->addToScene(scene, transaction, statusGetters);
|
_model->addToScene(scene, transaction, statusGetters);
|
||||||
|
|
||||||
|
transaction.transitionItem(_myMetaItem, render::Transition::ELEMENT_ENTER_LEAVE_DOMAIN);
|
||||||
|
|
||||||
scene->enqueueTransaction(transaction);
|
scene->enqueueTransaction(transaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -490,23 +494,6 @@ ModelPointer RenderableModelEntityItem::getModelNotSafe() {
|
||||||
return _model;
|
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() {
|
ModelPointer RenderableModelEntityItem::getModel() {
|
||||||
// make sure our renderer is setup
|
// make sure our renderer is setup
|
||||||
if (!_myRenderer) {
|
if (!_myRenderer) {
|
||||||
|
@ -524,7 +511,6 @@ ModelPointer RenderableModelEntityItem::getModel() {
|
||||||
// If we don't have a model, allocate one *immediately*
|
// If we don't have a model, allocate one *immediately*
|
||||||
if (!_model) {
|
if (!_model) {
|
||||||
_model = _myRenderer->allocateModel(getModelURL(), _myRenderer->getEntityLoadingPriority(*this), this);
|
_model = _myRenderer->allocateModel(getModelURL(), _myRenderer->getEntityLoadingPriority(*this), this);
|
||||||
QObject::connect(_model.get(), &Model::setURLFinished, this, &RenderableModelEntityItem::setModelURLFinished);
|
|
||||||
_needsInitialSimulation = true;
|
_needsInitialSimulation = true;
|
||||||
// If we need to change URLs, update it *after rendering* (to avoid access violations)
|
// If we need to change URLs, update it *after rendering* (to avoid access violations)
|
||||||
} else if (QUrl(getModelURL()) != _model->getURL()) {
|
} else if (QUrl(getModelURL()) != _model->getURL()) {
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#ifndef hifi_RenderableModelEntityItem_h
|
#ifndef hifi_RenderableModelEntityItem_h
|
||||||
#define hifi_RenderableModelEntityItem_h
|
#define hifi_RenderableModelEntityItem_h
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
|
@ -25,8 +24,7 @@
|
||||||
class Model;
|
class Model;
|
||||||
class EntityTreeRenderer;
|
class EntityTreeRenderer;
|
||||||
|
|
||||||
class RenderableModelEntityItem : public QObject, public ModelEntityItem, RenderableEntityInterface {
|
class RenderableModelEntityItem : public ModelEntityItem, RenderableEntityInterface {
|
||||||
Q_OBJECT
|
|
||||||
public:
|
public:
|
||||||
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties);
|
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties);
|
||||||
|
|
||||||
|
@ -121,10 +119,6 @@ public:
|
||||||
return _animation;
|
return _animation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public slots:
|
|
||||||
|
|
||||||
void setModelURLFinished(bool success);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVariantMap parseTexturesToMap(QString textures);
|
QVariantMap parseTexturesToMap(QString textures);
|
||||||
void remapTextures();
|
void remapTextures();
|
||||||
|
|
|
@ -238,17 +238,24 @@ void Scene::transitionItems(const ItemIDs& ids, const TransitionTypes& types) {
|
||||||
auto transitionStage = getStage<TransitionStage>(TransitionStage::getName());
|
auto transitionStage = getStage<TransitionStage>(TransitionStage::getName());
|
||||||
|
|
||||||
for (auto itemId : ids) {
|
for (auto itemId : ids) {
|
||||||
auto transitionId = INVALID_INDEX;
|
// Access the true item
|
||||||
|
const auto& item = _items[itemId];
|
||||||
if (*transitionType != Transition::NONE) {
|
if (item.exist()) {
|
||||||
transitionId = transitionStage->addTransition(itemId, *transitionType);
|
auto transitionId = INVALID_INDEX;
|
||||||
}
|
|
||||||
else {
|
|
||||||
const auto& item = _items[itemId];
|
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
|
// next loop
|
||||||
transitionType++;
|
transitionType++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue