mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 06:54:11 +02:00
cleanup
This commit is contained in:
parent
1319642a59
commit
016bf4011d
5 changed files with 4 additions and 87 deletions
|
@ -20,14 +20,6 @@ var yaw = 0.0;
|
||||||
var roll = 0.0;
|
var roll = 0.0;
|
||||||
var rotation = Quat.fromPitchYawRollDegrees(pitch, yaw, roll);
|
var rotation = Quat.fromPitchYawRollDegrees(pitch, yaw, roll);
|
||||||
|
|
||||||
var animationSettings = JSON.stringify({
|
|
||||||
loop: true,
|
|
||||||
running: true,
|
|
||||||
fps: 30,
|
|
||||||
firstFrame: 10,
|
|
||||||
lastFrame: 20,
|
|
||||||
});
|
|
||||||
|
|
||||||
var originalProperties = {
|
var originalProperties = {
|
||||||
type: "Model",
|
type: "Model",
|
||||||
position: { x: MyAvatar.position.x,
|
position: { x: MyAvatar.position.x,
|
||||||
|
@ -45,12 +37,6 @@ var originalProperties = {
|
||||||
|
|
||||||
modelURL: "http://public.highfidelity.io/cozza13/club/dragon/dragon.fbx",
|
modelURL: "http://public.highfidelity.io/cozza13/club/dragon/dragon.fbx",
|
||||||
rotation: rotation,
|
rotation: rotation,
|
||||||
|
|
||||||
|
|
||||||
animationURL: "http://public.highfidelity.io/cozza13/club/dragon/flying.fbx",
|
|
||||||
animationSettings: animationSettings,
|
|
||||||
//animationIsPlaying: true,
|
|
||||||
/*
|
|
||||||
animation: {
|
animation: {
|
||||||
url: "http://public.highfidelity.io/cozza13/club/dragon/flying.fbx",
|
url: "http://public.highfidelity.io/cozza13/club/dragon/flying.fbx",
|
||||||
running: true,
|
running: true,
|
||||||
|
@ -59,7 +45,6 @@ var originalProperties = {
|
||||||
lastFrame: 20,
|
lastFrame: 20,
|
||||||
loop: true
|
loop: true
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var modelID = Entities.addEntity(originalProperties);
|
var modelID = Entities.addEntity(originalProperties);
|
||||||
|
@ -120,8 +105,6 @@ function moveModel(deltaTime) {
|
||||||
|
|
||||||
if (somethingChanged) {
|
if (somethingChanged) {
|
||||||
var newProperties = {
|
var newProperties = {
|
||||||
//animationIsPlaying: isPlaying,
|
|
||||||
//animationFPS: animationFPS,
|
|
||||||
animation: {
|
animation: {
|
||||||
running: isPlaying,
|
running: isPlaying,
|
||||||
fps: animationFPS
|
fps: animationFPS
|
||||||
|
@ -130,7 +113,6 @@ function moveModel(deltaTime) {
|
||||||
|
|
||||||
if (resetFrame) {
|
if (resetFrame) {
|
||||||
print("resetting the frame!");
|
print("resetting the frame!");
|
||||||
//newProperties.animationFrameIndex = 0;
|
|
||||||
newProperties.animation.frameIndex = 0;
|
newProperties.animation.frameIndex = 0;
|
||||||
resetFrame = false;
|
resetFrame = false;
|
||||||
}
|
}
|
||||||
|
@ -141,7 +123,7 @@ function moveModel(deltaTime) {
|
||||||
|
|
||||||
|
|
||||||
// register the call back so it fires before each data send
|
// register the call back so it fires before each data send
|
||||||
//Script.update.connect(moveModel);
|
Script.update.connect(moveModel);
|
||||||
|
|
||||||
|
|
||||||
Script.scriptEnding.connect(function () {
|
Script.scriptEnding.connect(function () {
|
||||||
|
|
|
@ -104,7 +104,6 @@ void AnimationLoop::setRunning(bool running) {
|
||||||
// If we just set running to true, then also reset the frame to the first frame
|
// If we just set running to true, then also reset the frame to the first frame
|
||||||
if (running && (_resetOnRunning)) {
|
if (running && (_resetOnRunning)) {
|
||||||
// move back to the beginning
|
// move back to the beginning
|
||||||
qDebug() << "resetting _frameIndex:" << _frameIndex << "to _firstFrame:" << _firstFrame;
|
|
||||||
_frameIndex = _firstFrame;
|
_frameIndex = _firstFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -269,7 +269,6 @@ void RenderableModelEntityItem::render(RenderArgs* args) {
|
||||||
if (_model) {
|
if (_model) {
|
||||||
// handle animations..
|
// handle animations..
|
||||||
if (hasAnimation()) {
|
if (hasAnimation()) {
|
||||||
//qDebug() << "RenderableModelEntityItem::render() -- hasAnimation()";
|
|
||||||
if (!jointsMapped()) {
|
if (!jointsMapped()) {
|
||||||
QStringList modelJointNames = _model->getJointNames();
|
QStringList modelJointNames = _model->getJointNames();
|
||||||
mapJoints(modelJointNames);
|
mapJoints(modelJointNames);
|
||||||
|
@ -280,7 +279,6 @@ void RenderableModelEntityItem::render(RenderArgs* args) {
|
||||||
QVector<glm::quat> frameDataRotations;
|
QVector<glm::quat> frameDataRotations;
|
||||||
QVector<glm::vec3> frameDataTranslations;
|
QVector<glm::vec3> frameDataTranslations;
|
||||||
getAnimationFrame(newFrame, frameDataRotations, frameDataTranslations);
|
getAnimationFrame(newFrame, frameDataRotations, frameDataTranslations);
|
||||||
qDebug() << "RenderableModelEntityItem::render() -- getAnimationFrame() newFrame:" << newFrame;
|
|
||||||
assert(frameDataRotations.size() == frameDataTranslations.size());
|
assert(frameDataRotations.size() == frameDataTranslations.size());
|
||||||
if (newFrame) {
|
if (newFrame) {
|
||||||
for (int i = 0; i < frameDataRotations.size(); i++) {
|
for (int i = 0; i < frameDataRotations.size(); i++) {
|
||||||
|
|
|
@ -93,15 +93,6 @@ void AnimationPropertyGroup::copyFromScriptValue(const QScriptValue& object, boo
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE_GETTER(animationFrameIndex, float, setFrameIndex, getFrameIndex);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE_GETTER(animationFrameIndex, float, setFrameIndex, getFrameIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
if (_animationLoop) {
|
|
||||||
qDebug() << "copyFromScriptValue() running:" << _animationLoop->getRunning();
|
|
||||||
} else {
|
|
||||||
qDebug() << "copyFromScriptValue() running:" << getRunning();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnimationPropertyGroup::setFromOldAnimationSettings(const QString& value) {
|
void AnimationPropertyGroup::setFromOldAnimationSettings(const QString& value) {
|
||||||
|
@ -256,19 +247,6 @@ bool AnimationPropertyGroup::decodeFromEditPacket(EntityPropertyFlags& propertyF
|
||||||
|
|
||||||
processedBytes += bytesRead;
|
processedBytes += bytesRead;
|
||||||
|
|
||||||
/*
|
|
||||||
if (propertyFlags.getHasProperty(PROP_ANIMATION_PLAYING)) {
|
|
||||||
qDebug() << "AnimationPropertyGroup::decodeFromEditPacket() DID contain PROP_ANIMATION_PLAYING -----------";
|
|
||||||
if (_animationLoop) {
|
|
||||||
qDebug() << " decodeFromEditPacket() _animationLoop->getRunning:" << _animationLoop->getRunning();
|
|
||||||
} else {
|
|
||||||
qDebug() << " decodeFromEditPacket() getRunning:" << getRunning();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
qDebug() << "AnimationPropertyGroup::decodeFromEditPacket() packet did not contain PROP_ANIMATION_PLAYING";
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,12 +320,6 @@ bool AnimationPropertyGroup::setProperties(const EntityItemProperties& propertie
|
||||||
SET_ENTITY_GROUP_PROPERTY_FROM_PROPERTIES(Animation, StartAutomatically, startAutomatically, setStartAutomatically);
|
SET_ENTITY_GROUP_PROPERTY_FROM_PROPERTIES(Animation, StartAutomatically, startAutomatically, setStartAutomatically);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_animationLoop) {
|
|
||||||
qDebug() << "setProperties() _animationLoop->running:" << _animationLoop->getRunning();
|
|
||||||
} else {
|
|
||||||
qDebug() << "setProperties() running:" << getRunning();
|
|
||||||
}
|
|
||||||
|
|
||||||
_somethingChanged = somethingChanged;
|
_somethingChanged = somethingChanged;
|
||||||
|
|
||||||
return somethingChanged;
|
return somethingChanged;
|
||||||
|
@ -399,15 +371,6 @@ void AnimationPropertyGroup::appendSubclassData(OctreePacketData* packetData, En
|
||||||
APPEND_ENTITY_PROPERTY(PROP_ANIMATION_HOLD, getHold());
|
APPEND_ENTITY_PROPERTY(PROP_ANIMATION_HOLD, getHold());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_ANIMATION_START_AUTOMATICALLY, getStartAutomatically());
|
APPEND_ENTITY_PROPERTY(PROP_ANIMATION_START_AUTOMATICALLY, getStartAutomatically());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
if (_animationLoop) {
|
|
||||||
qDebug() << "appendSubclassData() running:" << _animationLoop->getRunning();
|
|
||||||
} else {
|
|
||||||
qDebug() << "appendSubclassData() running:" << getRunning();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int AnimationPropertyGroup::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
|
int AnimationPropertyGroup::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
|
||||||
|
@ -467,11 +430,5 @@ int AnimationPropertyGroup::readEntitySubclassDataFromBuffer(const unsigned char
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (_animationLoop) {
|
|
||||||
qDebug() << "readEntitySubclassDataFromBuffer() _animationLoop->running:" << _animationLoop->getRunning();
|
|
||||||
} else {
|
|
||||||
qDebug() << "readEntitySubclassDataFromBuffer() running:" << getRunning();
|
|
||||||
}
|
|
||||||
|
|
||||||
return bytesRead;
|
return bytesRead;
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,10 +80,6 @@ bool ModelEntityItem::setProperties(const EntityItemProperties& properties) {
|
||||||
setLastEdited(properties._lastEdited);
|
setLastEdited(properties._lastEdited);
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "ModelEntityItem::setProperties() id:" << getEntityItemID()
|
|
||||||
<< " properties.animation.running:" << properties.getAnimation().getRunning()
|
|
||||||
<< " running:" << getAnimationIsPlaying();
|
|
||||||
|
|
||||||
return somethingChanged;
|
return somethingChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,16 +110,11 @@ int ModelEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data,
|
||||||
|
|
||||||
READ_ENTITY_PROPERTY(PROP_TEXTURES, QString, setTextures);
|
READ_ENTITY_PROPERTY(PROP_TEXTURES, QString, setTextures);
|
||||||
|
|
||||||
qDebug() << "ModelEntityItem::readEntitySubclassDataFromBuffer() id:" << getEntityItemID() << " args.bitstreamVersion:" << args.bitstreamVersion << " VERSION_ENTITIES_ANIMATION_PROPERTIES_GROUP:" << VERSION_ENTITIES_ANIMATION_PROPERTIES_GROUP;
|
|
||||||
|
|
||||||
if (args.bitstreamVersion < VERSION_ENTITIES_ANIMATION_PROPERTIES_GROUP) {
|
if (args.bitstreamVersion < VERSION_ENTITIES_ANIMATION_PROPERTIES_GROUP) {
|
||||||
READ_ENTITY_PROPERTY(PROP_ANIMATION_SETTINGS, QString, setAnimationSettings);
|
READ_ENTITY_PROPERTY(PROP_ANIMATION_SETTINGS, QString, setAnimationSettings);
|
||||||
} else {
|
} else {
|
||||||
// Note: since we've associated our _animationProperties with our _animationLoop, the readEntitySubclassDataFromBuffer()
|
// Note: since we've associated our _animationProperties with our _animationLoop, the readEntitySubclassDataFromBuffer()
|
||||||
// will automatically read into the animation loop
|
// will automatically read into the animation loop
|
||||||
|
|
||||||
qDebug() << "ModelEntityItem::readEntitySubclassDataFromBuffer() id:" << getEntityItemID() << " calling _animationProperties.readEntitySubclassDataFromBuffer()";
|
|
||||||
|
|
||||||
int bytesFromAnimation = _animationProperties.readEntitySubclassDataFromBuffer(dataAt, (bytesLeftToRead - bytesRead), args,
|
int bytesFromAnimation = _animationProperties.readEntitySubclassDataFromBuffer(dataAt, (bytesLeftToRead - bytesRead), args,
|
||||||
propertyFlags, overwriteLocalData);
|
propertyFlags, overwriteLocalData);
|
||||||
|
|
||||||
|
@ -133,8 +124,6 @@ int ModelEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data,
|
||||||
|
|
||||||
READ_ENTITY_PROPERTY(PROP_SHAPE_TYPE, ShapeType, updateShapeType);
|
READ_ENTITY_PROPERTY(PROP_SHAPE_TYPE, ShapeType, updateShapeType);
|
||||||
|
|
||||||
qDebug() << "ModelEntityItem::readEntitySubclassDataFromBuffer() id:" << getEntityItemID() << " running:" << getAnimationIsPlaying();
|
|
||||||
|
|
||||||
if (_animationProperties.somethingChanged()) {
|
if (_animationProperties.somethingChanged()) {
|
||||||
_dirtyFlags |= EntityItem::DIRTY_UPDATEABLE;
|
_dirtyFlags |= EntityItem::DIRTY_UPDATEABLE;
|
||||||
}
|
}
|
||||||
|
@ -174,9 +163,6 @@ void ModelEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBit
|
||||||
propertyFlags, propertiesDidntFit, propertyCount, appendState);
|
propertyFlags, propertiesDidntFit, propertyCount, appendState);
|
||||||
|
|
||||||
APPEND_ENTITY_PROPERTY(PROP_SHAPE_TYPE, (uint32_t)getShapeType());
|
APPEND_ENTITY_PROPERTY(PROP_SHAPE_TYPE, (uint32_t)getShapeType());
|
||||||
|
|
||||||
//qDebug() << "ModelEntityItem::appendSubclassData() id:" << getEntityItemID() << " running:" << getAnimationIsPlaying();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -237,7 +223,6 @@ void ModelEntityItem::getAnimationFrame(bool& newFrame,
|
||||||
|
|
||||||
int frameCount = frames.size();
|
int frameCount = frames.size();
|
||||||
if (frameCount > 0) {
|
if (frameCount > 0) {
|
||||||
qDebug() << "getAnimationFrameIndex:" << getAnimationFrameIndex();
|
|
||||||
int animationFrameIndex = (int)(glm::floor(getAnimationFrameIndex())) % frameCount;
|
int animationFrameIndex = (int)(glm::floor(getAnimationFrameIndex())) % frameCount;
|
||||||
if (animationFrameIndex < 0 || animationFrameIndex > frameCount) {
|
if (animationFrameIndex < 0 || animationFrameIndex > frameCount) {
|
||||||
animationFrameIndex = 0;
|
animationFrameIndex = 0;
|
||||||
|
@ -281,13 +266,9 @@ bool ModelEntityItem::needsToCallUpdate() const {
|
||||||
|
|
||||||
void ModelEntityItem::update(const quint64& now) {
|
void ModelEntityItem::update(const quint64& now) {
|
||||||
|
|
||||||
// only worry about this if we have an animation
|
// only advance the frame index if we're playing
|
||||||
if (hasAnimation()) {
|
if (getAnimationIsPlaying()) {
|
||||||
// only advance the frame index if we're playing
|
_animationLoop.simulateAtTime(now);
|
||||||
if (getAnimationIsPlaying()) {
|
|
||||||
_animationLoop.simulateAtTime(now);
|
|
||||||
qDebug() << "ModelEntityItem::update() getAnimationIsPlaying():" << getAnimationIsPlaying() << "frame:" << getAnimationFrameIndex();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityItem::update(now); // let our base class handle it's updates...
|
EntityItem::update(now); // let our base class handle it's updates...
|
||||||
|
|
Loading…
Reference in a new issue