mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 00:56:48 +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 rotation = Quat.fromPitchYawRollDegrees(pitch, yaw, roll);
|
||||
|
||||
var animationSettings = JSON.stringify({
|
||||
loop: true,
|
||||
running: true,
|
||||
fps: 30,
|
||||
firstFrame: 10,
|
||||
lastFrame: 20,
|
||||
});
|
||||
|
||||
var originalProperties = {
|
||||
type: "Model",
|
||||
position: { x: MyAvatar.position.x,
|
||||
|
@ -45,12 +37,6 @@ var originalProperties = {
|
|||
|
||||
modelURL: "http://public.highfidelity.io/cozza13/club/dragon/dragon.fbx",
|
||||
rotation: rotation,
|
||||
|
||||
|
||||
animationURL: "http://public.highfidelity.io/cozza13/club/dragon/flying.fbx",
|
||||
animationSettings: animationSettings,
|
||||
//animationIsPlaying: true,
|
||||
/*
|
||||
animation: {
|
||||
url: "http://public.highfidelity.io/cozza13/club/dragon/flying.fbx",
|
||||
running: true,
|
||||
|
@ -59,7 +45,6 @@ var originalProperties = {
|
|||
lastFrame: 20,
|
||||
loop: true
|
||||
}
|
||||
*/
|
||||
};
|
||||
|
||||
var modelID = Entities.addEntity(originalProperties);
|
||||
|
@ -120,8 +105,6 @@ function moveModel(deltaTime) {
|
|||
|
||||
if (somethingChanged) {
|
||||
var newProperties = {
|
||||
//animationIsPlaying: isPlaying,
|
||||
//animationFPS: animationFPS,
|
||||
animation: {
|
||||
running: isPlaying,
|
||||
fps: animationFPS
|
||||
|
@ -130,7 +113,6 @@ function moveModel(deltaTime) {
|
|||
|
||||
if (resetFrame) {
|
||||
print("resetting the frame!");
|
||||
//newProperties.animationFrameIndex = 0;
|
||||
newProperties.animation.frameIndex = 0;
|
||||
resetFrame = false;
|
||||
}
|
||||
|
@ -141,7 +123,7 @@ function moveModel(deltaTime) {
|
|||
|
||||
|
||||
// register the call back so it fires before each data send
|
||||
//Script.update.connect(moveModel);
|
||||
Script.update.connect(moveModel);
|
||||
|
||||
|
||||
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 (running && (_resetOnRunning)) {
|
||||
// move back to the beginning
|
||||
qDebug() << "resetting _frameIndex:" << _frameIndex << "to _firstFrame:" << _firstFrame;
|
||||
_frameIndex = _firstFrame;
|
||||
}
|
||||
|
||||
|
|
|
@ -269,7 +269,6 @@ void RenderableModelEntityItem::render(RenderArgs* args) {
|
|||
if (_model) {
|
||||
// handle animations..
|
||||
if (hasAnimation()) {
|
||||
//qDebug() << "RenderableModelEntityItem::render() -- hasAnimation()";
|
||||
if (!jointsMapped()) {
|
||||
QStringList modelJointNames = _model->getJointNames();
|
||||
mapJoints(modelJointNames);
|
||||
|
@ -280,7 +279,6 @@ void RenderableModelEntityItem::render(RenderArgs* args) {
|
|||
QVector<glm::quat> frameDataRotations;
|
||||
QVector<glm::vec3> frameDataTranslations;
|
||||
getAnimationFrame(newFrame, frameDataRotations, frameDataTranslations);
|
||||
qDebug() << "RenderableModelEntityItem::render() -- getAnimationFrame() newFrame:" << newFrame;
|
||||
assert(frameDataRotations.size() == frameDataTranslations.size());
|
||||
if (newFrame) {
|
||||
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);
|
||||
}
|
||||
|
||||
/*
|
||||
if (_animationLoop) {
|
||||
qDebug() << "copyFromScriptValue() running:" << _animationLoop->getRunning();
|
||||
} else {
|
||||
qDebug() << "copyFromScriptValue() running:" << getRunning();
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
void AnimationPropertyGroup::setFromOldAnimationSettings(const QString& value) {
|
||||
|
@ -256,19 +247,6 @@ bool AnimationPropertyGroup::decodeFromEditPacket(EntityPropertyFlags& propertyF
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -342,12 +320,6 @@ bool AnimationPropertyGroup::setProperties(const EntityItemProperties& propertie
|
|||
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;
|
||||
|
||||
return somethingChanged;
|
||||
|
@ -399,15 +371,6 @@ void AnimationPropertyGroup::appendSubclassData(OctreePacketData* packetData, En
|
|||
APPEND_ENTITY_PROPERTY(PROP_ANIMATION_HOLD, getHold());
|
||||
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,
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -80,10 +80,6 @@ bool ModelEntityItem::setProperties(const EntityItemProperties& properties) {
|
|||
setLastEdited(properties._lastEdited);
|
||||
}
|
||||
|
||||
qDebug() << "ModelEntityItem::setProperties() id:" << getEntityItemID()
|
||||
<< " properties.animation.running:" << properties.getAnimation().getRunning()
|
||||
<< " running:" << getAnimationIsPlaying();
|
||||
|
||||
return somethingChanged;
|
||||
}
|
||||
|
||||
|
@ -114,16 +110,11 @@ int ModelEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data,
|
|||
|
||||
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) {
|
||||
READ_ENTITY_PROPERTY(PROP_ANIMATION_SETTINGS, QString, setAnimationSettings);
|
||||
} else {
|
||||
// Note: since we've associated our _animationProperties with our _animationLoop, the readEntitySubclassDataFromBuffer()
|
||||
// will automatically read into the animation loop
|
||||
|
||||
qDebug() << "ModelEntityItem::readEntitySubclassDataFromBuffer() id:" << getEntityItemID() << " calling _animationProperties.readEntitySubclassDataFromBuffer()";
|
||||
|
||||
int bytesFromAnimation = _animationProperties.readEntitySubclassDataFromBuffer(dataAt, (bytesLeftToRead - bytesRead), args,
|
||||
propertyFlags, overwriteLocalData);
|
||||
|
||||
|
@ -133,8 +124,6 @@ int ModelEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data,
|
|||
|
||||
READ_ENTITY_PROPERTY(PROP_SHAPE_TYPE, ShapeType, updateShapeType);
|
||||
|
||||
qDebug() << "ModelEntityItem::readEntitySubclassDataFromBuffer() id:" << getEntityItemID() << " running:" << getAnimationIsPlaying();
|
||||
|
||||
if (_animationProperties.somethingChanged()) {
|
||||
_dirtyFlags |= EntityItem::DIRTY_UPDATEABLE;
|
||||
}
|
||||
|
@ -174,9 +163,6 @@ void ModelEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBit
|
|||
propertyFlags, propertiesDidntFit, propertyCount, appendState);
|
||||
|
||||
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();
|
||||
if (frameCount > 0) {
|
||||
qDebug() << "getAnimationFrameIndex:" << getAnimationFrameIndex();
|
||||
int animationFrameIndex = (int)(glm::floor(getAnimationFrameIndex())) % frameCount;
|
||||
if (animationFrameIndex < 0 || animationFrameIndex > frameCount) {
|
||||
animationFrameIndex = 0;
|
||||
|
@ -281,13 +266,9 @@ bool ModelEntityItem::needsToCallUpdate() const {
|
|||
|
||||
void ModelEntityItem::update(const quint64& now) {
|
||||
|
||||
// only worry about this if we have an animation
|
||||
if (hasAnimation()) {
|
||||
// only advance the frame index if we're playing
|
||||
if (getAnimationIsPlaying()) {
|
||||
_animationLoop.simulateAtTime(now);
|
||||
qDebug() << "ModelEntityItem::update() getAnimationIsPlaying():" << getAnimationIsPlaying() << "frame:" << getAnimationFrameIndex();
|
||||
}
|
||||
// only advance the frame index if we're playing
|
||||
if (getAnimationIsPlaying()) {
|
||||
_animationLoop.simulateAtTime(now);
|
||||
}
|
||||
|
||||
EntityItem::update(now); // let our base class handle it's updates...
|
||||
|
|
Loading…
Reference in a new issue