Skip to content

Commit

Permalink
Image: fixes #3959: Created image plane is not proportional to loaded…
Browse files Browse the repository at this point in the history
… image
  • Loading branch information
wwmayer committed Feb 28, 2021
1 parent 59048fb commit f0e4265
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/Mod/Image/Gui/Command.cpp
Expand Up @@ -144,19 +144,17 @@ void CmdCreateImagePlane::activated(int iMsg)
double xPixelsPerM = impQ.dotsPerMeterX();
double width = impQ.width();
width = width * 1000 / xPixelsPerM;
int nWidth = static_cast<int>(width+0.5);
double yPixelsPerM = impQ.dotsPerMeterY();
double height = impQ.height();
height = height * 1000 / yPixelsPerM;
int nHeight = static_cast<int>(height+0.5);

QString pyfile = Base::Tools::escapeEncodeFilename(s);

openCommand(QT_TRANSLATE_NOOP("Command", "Create ImagePlane"));
doCommand(Doc,"App.activeDocument().addObject('Image::ImagePlane','%s\')",FeatName.c_str());
doCommand(Doc,"App.activeDocument().%s.ImageFile = '%s'",FeatName.c_str(),(const char*)pyfile.toUtf8());
doCommand(Doc,"App.activeDocument().%s.XSize = %d",FeatName.c_str(),nWidth);
doCommand(Doc,"App.activeDocument().%s.YSize = %d",FeatName.c_str(),nHeight);
doCommand(Doc,"App.activeDocument().%s.XSize = %f",FeatName.c_str(),width);
doCommand(Doc,"App.activeDocument().%s.YSize = %f",FeatName.c_str(),height);
doCommand(Doc,"App.activeDocument().%s.Placement = App.Placement(App.Vector(%f,%f,%f),App.Rotation(%f,%f,%f,%f))"
,FeatName.c_str(),p.x,p.y,p.z,r[0],r[1],r[2],r[3]);
doCommand(Doc,"Gui.SendMsgToActiveView('ViewFit')");
Expand Down

1 comment on commit f0e4265

@donovaly
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this please be backported to 0.19?

Please sign in to comment.