mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 19:59:28 +02:00
more animation work
This commit is contained in:
parent
f1d2017a9e
commit
cd4ea4b34f
4 changed files with 38 additions and 5 deletions
|
@ -1609,6 +1609,7 @@ function handeMenuEvent(menuItem){
|
||||||
array.push({ label: "Animation URL:", value: properties.animationURL });
|
array.push({ label: "Animation URL:", value: properties.animationURL });
|
||||||
array.push({ label: "Animation is playing:", value: properties.animationIsPlaying });
|
array.push({ label: "Animation is playing:", value: properties.animationIsPlaying });
|
||||||
array.push({ label: "Animation FPS:", value: properties.animationFPS });
|
array.push({ label: "Animation FPS:", value: properties.animationFPS });
|
||||||
|
array.push({ label: "Animation Frame:", value: properties.animationFrameIndex });
|
||||||
}
|
}
|
||||||
array.push({ label: "X:", value: properties.position.x.toFixed(decimals) });
|
array.push({ label: "X:", value: properties.position.x.toFixed(decimals) });
|
||||||
array.push({ label: "Y:", value: properties.position.y.toFixed(decimals) });
|
array.push({ label: "Y:", value: properties.position.y.toFixed(decimals) });
|
||||||
|
@ -1634,6 +1635,7 @@ function handeMenuEvent(menuItem){
|
||||||
properties.animationURL = array[index++].value;
|
properties.animationURL = array[index++].value;
|
||||||
properties.animationIsPlaying = array[index++].value;
|
properties.animationIsPlaying = array[index++].value;
|
||||||
properties.animationFPS = array[index++].value;
|
properties.animationFPS = array[index++].value;
|
||||||
|
properties.animationFrameIndex = array[index++].value;
|
||||||
}
|
}
|
||||||
properties.position.x = array[index++].value;
|
properties.position.x = array[index++].value;
|
||||||
properties.position.y = array[index++].value;
|
properties.position.y = array[index++].value;
|
||||||
|
|
|
@ -315,9 +315,11 @@ void EntityTreeRenderer::renderEntityTypeModel(EntityItem* entity, RenderArgs* a
|
||||||
entityItem->mapJoints(modelJointNames);
|
entityItem->mapJoints(modelJointNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<glm::quat> frameData = entityItem->getAnimationFrame();
|
if (entityItem->jointsMapped()) {
|
||||||
for (int i = 0; i < frameData.size(); i++) {
|
QVector<glm::quat> frameData = entityItem->getAnimationFrame();
|
||||||
model->setJointState(i, true, frameData[i]);
|
for (int i = 0; i < frameData.size(); i++) {
|
||||||
|
model->setJointState(i, true, frameData[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1078,7 +1078,16 @@ if (childAt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityTree::changeEntityState(EntityItem* const entity, EntityItem::SimuationState oldState, EntityItem::SimuationState newState) {
|
void EntityTree::changeEntityState(EntityItem* const entity, EntityItem::SimuationState oldState, EntityItem::SimuationState newState) {
|
||||||
if (oldState != newState) {
|
|
||||||
|
qDebug() << "EntityTree::changeEntityState()....";
|
||||||
|
qDebug() << " oldState:" << oldState;
|
||||||
|
qDebug() << " newState:" << newState;
|
||||||
|
|
||||||
|
qDebug() << "EntityTree::changeEntityState() BEFORE....";
|
||||||
|
qDebug() << " _changingEntities:" << _changingEntities;
|
||||||
|
qDebug() << " _movingEntities:" << _movingEntities;
|
||||||
|
|
||||||
|
//if (oldState != newState) {
|
||||||
switch (oldState) {
|
switch (oldState) {
|
||||||
case EntityItem::Changing:
|
case EntityItem::Changing:
|
||||||
_changingEntities.removeAll(entity);
|
_changingEntities.removeAll(entity);
|
||||||
|
@ -1103,7 +1112,13 @@ void EntityTree::changeEntityState(EntityItem* const entity, EntityItem::Simuati
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
qDebug() << "EntityTree::changeEntityState() AFTER....";
|
||||||
|
qDebug() << " _changingEntities:" << _changingEntities;
|
||||||
|
qDebug() << " _movingEntities:" << _movingEntities;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityTree::update() {
|
void EntityTree::update() {
|
||||||
|
|
|
@ -33,6 +33,8 @@ ModelEntityItem::ModelEntityItem(const EntityItemID& entityItemID, const EntityI
|
||||||
qDebug() << "ModelEntityItem::ModelEntityItem() calling setProperties()";
|
qDebug() << "ModelEntityItem::ModelEntityItem() calling setProperties()";
|
||||||
setProperties(properties);
|
setProperties(properties);
|
||||||
qDebug() << "ModelEntityItem::ModelEntityItem() getModelURL()=" << getModelURL();
|
qDebug() << "ModelEntityItem::ModelEntityItem() getModelURL()=" << getModelURL();
|
||||||
|
|
||||||
|
_animationFrameIndex = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityItemProperties ModelEntityItem::getProperties() const {
|
EntityItemProperties ModelEntityItem::getProperties() const {
|
||||||
|
@ -840,6 +842,18 @@ QVector<glm::quat> ModelEntityItem::getAnimationFrame() {
|
||||||
|
|
||||||
if (frameCount > 0) {
|
if (frameCount > 0) {
|
||||||
int animationFrameIndex = (int)glm::floor(_animationFrameIndex) % frameCount;
|
int animationFrameIndex = (int)glm::floor(_animationFrameIndex) % frameCount;
|
||||||
|
|
||||||
|
if (animationFrameIndex < 0 || animationFrameIndex > frameCount) {
|
||||||
|
qDebug() << "ModelEntityItem::getAnimationFrame()....";
|
||||||
|
qDebug() << " frame index out of bounds....";
|
||||||
|
qDebug() << " _animationFrameIndex=" << _animationFrameIndex;
|
||||||
|
qDebug() << " frameCount=" << frameCount;
|
||||||
|
qDebug() << " animationFrameIndex=" << animationFrameIndex;
|
||||||
|
animationFrameIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//qDebug() << "ModelEntityItem::getAnimationFrame().... _animationFrameIndex=" << _animationFrameIndex << "frameCount=" << frameCount << "animationFrameIndex=" << animationFrameIndex;
|
||||||
|
|
||||||
QVector<glm::quat> rotations = frames[animationFrameIndex].rotations;
|
QVector<glm::quat> rotations = frames[animationFrameIndex].rotations;
|
||||||
frameData.resize(_jointMapping.size());
|
frameData.resize(_jointMapping.size());
|
||||||
for (int j = 0; j < _jointMapping.size(); j++) {
|
for (int j = 0; j < _jointMapping.size(); j++) {
|
||||||
|
|
Loading…
Reference in a new issue