Fix for successive heightfield placements.

This commit is contained in:
Andrzej Kapolka 2014-12-02 13:12:45 -08:00
parent b4b1559e32
commit a022b7fa17
3 changed files with 9 additions and 1 deletions

View file

@ -789,7 +789,7 @@ void ImportHeightfieldTool::apply() {
if (!(_height->getHeight() && attribute)) {
return;
}
MetavoxelEditMessage message = { QVariant::fromValue(InsertSpannerEdit(attribute, _spanner)) };
MetavoxelEditMessage message = { QVariant::fromValue(InsertSpannerEdit(attribute, _spanner->clone())) };
Application::getInstance()->getMetavoxels()->applyEdit(message, true);
}

View file

@ -2063,6 +2063,12 @@ MetavoxelLOD Heightfield::transformLOD(const MetavoxelLOD& lod) const {
qMax(0.5f, glm::abs(position.y * _aspectY - 0.5f)) * THRESHOLD_MULTIPLIER);
}
SharedObject* Heightfield::clone(bool withID, SharedObject* target) const {
Heightfield* newHeightfield = static_cast<Heightfield*>(Spanner::clone(withID, target));
newHeightfield->setRoot(_root);
return newHeightfield;
}
bool Heightfield::isHeightfield() const {
return true;
}

View file

@ -579,6 +579,8 @@ public:
MetavoxelLOD transformLOD(const MetavoxelLOD& lod) const;
virtual SharedObject* clone(bool withID = false, SharedObject* target = NULL) const;
virtual bool isHeightfield() const;
virtual float getHeight(const glm::vec3& location) const;