From d01d605b4029fdf70529d07d952386e84b3a032b Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 1 Aug 2014 13:52:00 -0700 Subject: [PATCH] Add ModelItemProperties::copyFromNewModelItem --- interface/src/Application.cpp | 2 +- libraries/models/src/ModelItem.cpp | 32 ++++++++++++++++++++++++++++++ libraries/models/src/ModelItem.h | 1 + libraries/models/src/ModelTree.cpp | 2 +- 4 files changed, 35 insertions(+), 2 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 540cb47a79..490e5441d2 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1517,7 +1517,7 @@ bool Application::exportModels(const QString& filename, float x, float y, float ModelItemProperties properties; ModelItemID id = models.at(i)->getModelItemID(); id.isKnownID = false; - properties.copyFromModelItem(*models.at(i)); + properties.copyFromNewModelItem(*models.at(i)); properties.setPosition(properties.getPosition() - root); exportTree.addModel(id, properties); } diff --git a/libraries/models/src/ModelItem.cpp b/libraries/models/src/ModelItem.cpp index afa64e3bc6..2a3a88fb65 100644 --- a/libraries/models/src/ModelItem.cpp +++ b/libraries/models/src/ModelItem.cpp @@ -1142,6 +1142,38 @@ void ModelItemProperties::copyFromModelItem(const ModelItem& modelItem) { _id = modelItem.getID(); _idSet = true; + _positionChanged = false; + _colorChanged = false; + _radiusChanged = false; + + _shouldDieChanged = false; + _modelURLChanged = false; + _modelRotationChanged = false; + _animationURLChanged = false; + _animationIsPlayingChanged = false; + _animationFrameIndexChanged = false; + _animationFPSChanged = false; + _glowLevelChanged = false; + _defaultSettings = false; +} + +void ModelItemProperties::copyFromNewModelItem(const ModelItem& modelItem) { + _position = modelItem.getPosition() * (float) TREE_SCALE; + _color = modelItem.getXColor(); + _radius = modelItem.getRadius() * (float) TREE_SCALE; + _shouldDie = modelItem.getShouldDie(); + _modelURL = modelItem.getModelURL(); + _modelRotation = modelItem.getModelRotation(); + _animationURL = modelItem.getAnimationURL(); + _animationIsPlaying = modelItem.getAnimationIsPlaying(); + _animationFrameIndex = modelItem.getAnimationFrameIndex(); + _animationFPS = modelItem.getAnimationFPS(); + _glowLevel = modelItem.getGlowLevel(); + _sittingPoints = modelItem.getSittingPoints(); + + _id = modelItem.getID(); + _idSet = true; + _positionChanged = true; _colorChanged = true; _radiusChanged = true; diff --git a/libraries/models/src/ModelItem.h b/libraries/models/src/ModelItem.h index 43aaca48a0..3e3c46a12d 100644 --- a/libraries/models/src/ModelItem.h +++ b/libraries/models/src/ModelItem.h @@ -74,6 +74,7 @@ public: void copyToModelItem(ModelItem& modelItem) const; void copyFromModelItem(const ModelItem& modelItem); + void copyFromNewModelItem(const ModelItem& modelItem); const glm::vec3& getPosition() const { return _position; } xColor getColor() const { return _color; } diff --git a/libraries/models/src/ModelTree.cpp b/libraries/models/src/ModelTree.cpp index b9b4faed07..206e67078c 100644 --- a/libraries/models/src/ModelTree.cpp +++ b/libraries/models/src/ModelTree.cpp @@ -221,7 +221,7 @@ bool ModelTree::sendModelsOperation(OctreeElement* element, void* extraData) { uint32_t creatorTokenID = ModelItem::getNextCreatorTokenID(); ModelItemID id(NEW_MODEL, creatorTokenID, false); ModelItemProperties properties; - properties.copyFromModelItem(modelList.at(i)); + properties.copyFromNewModelItem(modelList.at(i)); properties.setPosition(properties.getPosition() + args->root); args->packetSender->queueModelEditMessage(PacketTypeModelAddOrEdit, id, properties); }