mirror of
https://github.com/leozide/leocad
synced 2025-01-17 18:11:42 +01:00
Fixed file name formatting when saving an image from the command line.
This commit is contained in:
parent
dedc429685
commit
ccadcf7e1a
4 changed files with 11 additions and 6 deletions
|
@ -383,7 +383,7 @@ bool lcApplication::Initialize(int argc, char* argv[], const char* LibraryInstal
|
|||
else
|
||||
Frame = FileName;
|
||||
|
||||
lcGetActiveModel()->SaveStepImages(Frame, ImageWidth, ImageHeight, ImageStart, ImageEnd);
|
||||
lcGetActiveModel()->SaveStepImages(Frame, ImageStart != ImageEnd, ImageWidth, ImageHeight, ImageStart, ImageEnd);
|
||||
}
|
||||
|
||||
if (SaveWavefront)
|
||||
|
|
|
@ -1182,7 +1182,7 @@ void lcModel::DrawBackground(lcContext* Context)
|
|||
glDepthMask(GL_TRUE);
|
||||
}
|
||||
|
||||
void lcModel::SaveStepImages(const QString& BaseName, int Width, int Height, lcStep Start, lcStep End)
|
||||
void lcModel::SaveStepImages(const QString& BaseName, bool AddStepSuffix, int Width, int Height, lcStep Start, lcStep End)
|
||||
{
|
||||
gMainWindow->mPreviewWidget->MakeCurrent();
|
||||
lcContext* Context = gMainWindow->mPreviewWidget->mContext;
|
||||
|
@ -1206,7 +1206,12 @@ void lcModel::SaveStepImages(const QString& BaseName, int Width, int Height, lcS
|
|||
SetTemporaryStep(Step);
|
||||
View.OnDraw();
|
||||
|
||||
QString FileName = BaseName.arg(Step, 2, 10, QLatin1Char('0'));
|
||||
QString FileName;
|
||||
|
||||
if (AddStepSuffix)
|
||||
FileName = BaseName.arg(Step, 2, 10, QLatin1Char('0'));
|
||||
else
|
||||
FileName = BaseName;
|
||||
|
||||
if (!Context->SaveRenderToTextureImage(FileName, Width, Height))
|
||||
break;
|
||||
|
|
|
@ -213,7 +213,7 @@ public:
|
|||
void GetScene(lcScene& Scene, lcCamera* ViewCamera, bool DrawInterface) const;
|
||||
void SubModelAddRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMatrix, int DefaultColorIndex, bool Focused, bool Selected) const;
|
||||
void DrawBackground(lcContext* Context);
|
||||
void SaveStepImages(const QString& BaseName, int Width, int Height, lcStep Start, lcStep End);
|
||||
void SaveStepImages(const QString& BaseName, bool AddStepSuffix, int Width, int Height, lcStep Start, lcStep End);
|
||||
|
||||
void RayTest(lcObjectRayTest& ObjectRayTest) const;
|
||||
void BoxTest(lcObjectBoxTest& ObjectBoxTest) const;
|
||||
|
|
|
@ -1294,7 +1294,7 @@ void Project::ExportHTML()
|
|||
}
|
||||
|
||||
QString StepImageBaseName = QFileInfo(Dir, BaseName + QLatin1String("-%1.png")).absoluteFilePath();
|
||||
Model->SaveStepImages(StepImageBaseName, Options.StepImagesWidth, Options.StepImagesHeight, 1, LastStep);
|
||||
Model->SaveStepImages(StepImageBaseName, true, Options.StepImagesWidth, Options.StepImagesHeight, 1, LastStep);
|
||||
|
||||
if (Options.PartsListImages)
|
||||
{
|
||||
|
@ -1788,7 +1788,7 @@ void Project::SaveImage()
|
|||
if (Dialog.mStart != Dialog.mEnd)
|
||||
Dialog.mFileName = Dialog.mFileName.insert(Dialog.mFileName.length() - Extension.length() - 1, QLatin1String("%1"));
|
||||
|
||||
mActiveModel->SaveStepImages(Dialog.mFileName, Dialog.mWidth, Dialog.mHeight, Dialog.mStart, Dialog.mEnd);
|
||||
mActiveModel->SaveStepImages(Dialog.mFileName, Dialog.mStart != Dialog.mEnd, Dialog.mWidth, Dialog.mHeight, Dialog.mStart, Dialog.mEnd);
|
||||
}
|
||||
|
||||
void Project::UpdatePieceInfo(PieceInfo* Info) const
|
||||
|
|
Loading…
Reference in a new issue