Skip to content

Commit

Permalink
fixed photo texture attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
vicrucann committed May 9, 2016
1 parent 90ffd17 commit 06127c2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/libSGControls/AddEntityCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ AddPhotoCommand::AddPhotoCommand(entity::UserScene* scene, const std::string& fn
m_photo->setName(ename);
m_photo->loadImage(fname);

m_canvas->getGeodeData()->getOrCreateStateSet()->setTextureAttributeAndModes(0, m_photo->getTextureAsAttribute() );
// m_canvas->getGeodeData()->getOrCreateStateSet()->setTextureAttributeAndModes(0, m_photo->getTextureAsAttribute() );

this->setText(QObject::tr("Add photo to %1")
.arg(QString(m_canvas->getName().c_str())));
Expand All @@ -113,6 +113,8 @@ void AddPhotoCommand::undo()

void AddPhotoCommand::redo()
{
m_photo->getOrCreateStateSet()->setTextureAttributeAndModes(0, m_photo->getTextureAsAttribute());

if (!m_canvas->getGeodeData()->addDrawable(m_photo.get()))
outErrMsg("Could not add photo to current canvas");

Expand Down
3 changes: 2 additions & 1 deletion src/libSGControls/EditEntityCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,8 @@ void EditPhotoPushCommand::undo()

void EditPhotoPushCommand::redo()
{
m_destination->getGeodeData()->getOrCreateStateSet()->setTextureAttributeAndModes(0, m_photo->getTextureAsAttribute());
m_photo->getOrCreateStateSet()->setTextureAttributeAndModes(0, m_photo->getTextureAsAttribute());
// m_destination->getGeodeData()->getOrCreateStateSet()->setTextureAttributeAndModes(0, m_photo->getTextureAsAttribute());
m_destination->getGeodeData()->addDrawable(m_photo.get());
m_source->getGeodeData()->removeDrawable(m_photo.get());
m_destination->updateFrame(m_scene->getCanvasPrevious());
Expand Down

0 comments on commit 06127c2

Please sign in to comment.