Add ModelItemProperties::copyFromNewModelItem

This commit is contained in:
Ryan Huffman 2014-08-01 13:52:00 -07:00
parent b98ee351a5
commit d01d605b40
4 changed files with 35 additions and 2 deletions

View file

@ -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);
}

View file

@ -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;

View file

@ -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; }

View file

@ -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);
}