mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 23:09:52 +02:00
add DIRTY_UPDATEABLE flag for changes that need it
This commit is contained in:
parent
27bfc9907f
commit
675a2dd989
4 changed files with 28 additions and 17 deletions
|
@ -49,6 +49,7 @@ public:
|
||||||
DIRTY_MOTION_TYPE = 0x0010,
|
DIRTY_MOTION_TYPE = 0x0010,
|
||||||
DIRTY_SHAPE = 0x0020,
|
DIRTY_SHAPE = 0x0020,
|
||||||
DIRTY_LIFETIME = 0x0040,
|
DIRTY_LIFETIME = 0x0040,
|
||||||
|
DIRTY_UPDATEABLE = 0x0080,
|
||||||
// add new simulation-relevant flags above
|
// add new simulation-relevant flags above
|
||||||
// all other flags below
|
// all other flags below
|
||||||
DIRTY_SCRIPT = 0x8000
|
DIRTY_SCRIPT = 0x8000
|
||||||
|
|
|
@ -397,6 +397,11 @@ void ModelEntityItem::debugDump() const {
|
||||||
qDebug() << " model URL:" << getModelURL();
|
qDebug() << " model URL:" << getModelURL();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ModelEntityItem::setAnimationURL(const QString& url) {
|
||||||
|
_dirtyFlags |= EntityItem::DIRTY_UPDATEABLE;
|
||||||
|
_animationURL = url;
|
||||||
|
}
|
||||||
|
|
||||||
void ModelEntityItem::setAnimationSettings(const QString& value) {
|
void ModelEntityItem::setAnimationSettings(const QString& value) {
|
||||||
// the animations setting is a JSON string that may contain various animation settings.
|
// the animations setting is a JSON string that may contain various animation settings.
|
||||||
// if it includes fps, frameIndex, or running, those values will be parsed out and
|
// if it includes fps, frameIndex, or running, those values will be parsed out and
|
||||||
|
@ -448,6 +453,17 @@ void ModelEntityItem::setAnimationSettings(const QString& value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
_animationSettings = value;
|
_animationSettings = value;
|
||||||
|
_dirtyFlags |= EntityItem::DIRTY_UPDATEABLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModelEntityItem::setAnimationIsPlaying(bool value) {
|
||||||
|
_dirtyFlags |= EntityItem::DIRTY_UPDATEABLE;
|
||||||
|
_animationLoop.setRunning(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModelEntityItem::setAnimationFPS(float value) {
|
||||||
|
_dirtyFlags |= EntityItem::DIRTY_UPDATEABLE;
|
||||||
|
_animationLoop.setFPS(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ModelEntityItem::getAnimationSettings() const {
|
QString ModelEntityItem::getAnimationSettings() const {
|
||||||
|
|
|
@ -73,16 +73,16 @@ public:
|
||||||
|
|
||||||
// model related properties
|
// model related properties
|
||||||
void setModelURL(const QString& url) { _modelURL = url; }
|
void setModelURL(const QString& url) { _modelURL = url; }
|
||||||
void setAnimationURL(const QString& url) { _animationURL = url; }
|
void setAnimationURL(const QString& url);
|
||||||
static const float DEFAULT_ANIMATION_FRAME_INDEX;
|
static const float DEFAULT_ANIMATION_FRAME_INDEX;
|
||||||
void setAnimationFrameIndex(float value) { _animationLoop.setFrameIndex(value); }
|
void setAnimationFrameIndex(float value) { _animationLoop.setFrameIndex(value); }
|
||||||
void setAnimationSettings(const QString& value);
|
void setAnimationSettings(const QString& value);
|
||||||
|
|
||||||
static const bool DEFAULT_ANIMATION_IS_PLAYING;
|
static const bool DEFAULT_ANIMATION_IS_PLAYING;
|
||||||
void setAnimationIsPlaying(bool value) { _animationLoop.setRunning(value); }
|
void setAnimationIsPlaying(bool value);
|
||||||
|
|
||||||
static const float DEFAULT_ANIMATION_FPS;
|
static const float DEFAULT_ANIMATION_FPS;
|
||||||
void setAnimationFPS(float value) { _animationLoop.setFPS(value); }
|
void setAnimationFPS(float value);
|
||||||
|
|
||||||
void setAnimationLoop(bool loop) { _animationLoop.setLoop(loop); }
|
void setAnimationLoop(bool loop) { _animationLoop.setLoop(loop); }
|
||||||
bool getAnimationLoop() const { return _animationLoop.getLoop(); }
|
bool getAnimationLoop() const { return _animationLoop.getLoop(); }
|
||||||
|
|
|
@ -31,12 +31,10 @@ void SimpleEntitySimulation::updateEntitiesInternal(const quint64& now) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleEntitySimulation::addEntityInternal(EntityItem* entity) {
|
void SimpleEntitySimulation::addEntityInternal(EntityItem* entity) {
|
||||||
if (entity->getCollisionsWillMove()) {
|
if (entity->isMoving()) {
|
||||||
if (entity->isMoving()) {
|
_movingEntities.insert(entity);
|
||||||
_movingEntities.insert(entity);
|
} else if (entity->getCollisionsWillMove()) {
|
||||||
} else {
|
_movableButStoppedEntities.insert(entity);
|
||||||
_movableButStoppedEntities.insert(entity);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,14 +48,10 @@ const int SIMPLE_SIMULATION_DIRTY_FLAGS = EntityItem::DIRTY_VELOCITY | EntityIte
|
||||||
void SimpleEntitySimulation::entityChangedInternal(EntityItem* entity) {
|
void SimpleEntitySimulation::entityChangedInternal(EntityItem* entity) {
|
||||||
int dirtyFlags = entity->getDirtyFlags();
|
int dirtyFlags = entity->getDirtyFlags();
|
||||||
if (dirtyFlags & SIMPLE_SIMULATION_DIRTY_FLAGS) {
|
if (dirtyFlags & SIMPLE_SIMULATION_DIRTY_FLAGS) {
|
||||||
if (entity->getCollisionsWillMove()) {
|
if (entity->isMoving()) {
|
||||||
if (entity->isMoving()) {
|
_movingEntities.insert(entity);
|
||||||
_movingEntities.insert(entity);
|
} else if (entity->getCollisionsWillMove()) {
|
||||||
_movableButStoppedEntities.remove(entity);
|
_movableButStoppedEntities.remove(entity);
|
||||||
} else {
|
|
||||||
_movingEntities.remove(entity);
|
|
||||||
_movableButStoppedEntities.insert(entity);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
_movingEntities.remove(entity);
|
_movingEntities.remove(entity);
|
||||||
_movableButStoppedEntities.remove(entity);
|
_movableButStoppedEntities.remove(entity);
|
||||||
|
|
Loading…
Reference in a new issue