Only highlight new pieces when the option is enabled.

This commit is contained in:
Leonardo Zide 2017-06-20 08:06:40 -07:00
parent c2f3c15f86
commit 05104162e9
6 changed files with 17 additions and 9 deletions

View file

@ -374,7 +374,7 @@ bool lcApplication::Initialize(int argc, char* argv[], const char* LibraryInstal
else
Frame = FileName;
lcGetActiveModel()->SaveStepImages(Frame, ImageStart != ImageEnd, true, ImageWidth, ImageHeight, ImageStart, ImageEnd);
lcGetActiveModel()->SaveStepImages(Frame, ImageStart != ImageEnd, true, false, ImageWidth, ImageHeight, ImageStart, ImageEnd);
}
if (SaveWavefront)

View file

@ -1077,7 +1077,7 @@ void lcModel::DuplicateSelectedPieces()
SaveCheckpoint(tr("Duplicating Pieces"));
}
void lcModel::GetScene(lcScene& Scene, lcCamera* ViewCamera, bool DrawInterface) const
void lcModel::GetScene(lcScene& Scene, lcCamera* ViewCamera, bool DrawInterface, bool Highlight) const
{
Scene.Begin(ViewCamera->mWorldView);
@ -1088,7 +1088,7 @@ void lcModel::GetScene(lcScene& Scene, lcCamera* ViewCamera, bool DrawInterface)
lcPiece* Piece = mPieces[PieceIdx];
if (Piece->IsVisible(mCurrentStep))
Piece->AddRenderMeshes(Scene, DrawInterface, Piece->GetStepShow()==mCurrentStep);
Piece->AddRenderMeshes(Scene, DrawInterface, Highlight && Piece->GetStepShow() == mCurrentStep);
}
if (DrawInterface)
@ -1201,7 +1201,7 @@ void lcModel::DrawBackground(lcGLWidget* Widget)
glDepthMask(GL_TRUE);
}
void lcModel::SaveStepImages(const QString& BaseName, bool AddStepSuffix, bool Zoom, int Width, int Height, lcStep Start, lcStep End)
void lcModel::SaveStepImages(const QString& BaseName, bool AddStepSuffix, bool Zoom, bool Highlight, int Width, int Height, lcStep Start, lcStep End)
{
View* ActiveView = gMainWindow->GetActiveView();
ActiveView->MakeCurrent();
@ -1220,6 +1220,7 @@ void lcModel::SaveStepImages(const QString& BaseName, bool AddStepSuffix, bool Z
ZoomExtents(Camera, (float)Width / (float)Height);
View View(this);
View.SetHighlight(Highlight);
View.SetCamera(Camera, false);
View.mWidth = Width;
View.mHeight = Height;

View file

@ -209,10 +209,10 @@ public:
void Paste();
void DuplicateSelectedPieces();
void GetScene(lcScene& Scene, lcCamera* ViewCamera, bool DrawInterface) const;
void GetScene(lcScene& Scene, lcCamera* ViewCamera, bool DrawInterface, bool Highlight) const;
void SubModelAddRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMatrix, int DefaultColorIndex, bool Focused, bool Selected) const;
void DrawBackground(lcGLWidget* Widget);
void SaveStepImages(const QString& BaseName, bool AddStepSuffix, bool Zoom, int Width, int Height, lcStep Start, lcStep End);
void SaveStepImages(const QString& BaseName, bool AddStepSuffix, bool Zoom, bool Highlight, int Width, int Height, lcStep Start, lcStep End);
void RayTest(lcObjectRayTest& ObjectRayTest) const;
void BoxTest(lcObjectBoxTest& ObjectBoxTest) const;

View file

@ -1245,7 +1245,7 @@ void Project::ExportHTML()
}
QString StepImageBaseName = QFileInfo(Dir, BaseName + QLatin1String("-%1.png")).absoluteFilePath();
Model->SaveStepImages(StepImageBaseName, true, false, Options.StepImagesWidth, Options.StepImagesHeight, 1, LastStep);
Model->SaveStepImages(StepImageBaseName, true, false, Options.HighlightNewParts, Options.StepImagesWidth, Options.StepImagesHeight, 1, LastStep);
if (Options.PartsListImages)
{
@ -1724,7 +1724,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.mStart != Dialog.mEnd, false, Dialog.mWidth, Dialog.mHeight, Dialog.mStart, Dialog.mEnd);
mActiveModel->SaveStepImages(Dialog.mFileName, Dialog.mStart != Dialog.mEnd, false, false, Dialog.mWidth, Dialog.mHeight, Dialog.mStart, Dialog.mEnd);
}
void Project::UpdatePieceInfo(PieceInfo* Info) const

View file

@ -17,6 +17,7 @@ View::View(lcModel* Model)
{
mModel = Model;
mCamera = nullptr;
mHighlight = false;
memset(mGridSettings, 0, sizeof(mGridSettings));
mDragState = LC_DRAGSTATE_NONE;
@ -549,7 +550,7 @@ void View::OnDraw()
{
bool DrawInterface = mWidget != nullptr;
mModel->GetScene(mScene, mCamera, DrawInterface);
mModel->GetScene(mScene, mCamera, DrawInterface, mHighlight);
if (DrawInterface && mTrackTool == LC_TRACKTOOL_INSERT)
{

View file

@ -59,6 +59,11 @@ public:
View(lcModel* Model);
virtual ~View();
void SetHighlight(bool Highlight)
{
mHighlight = Highlight;
}
static void CreateResources(lcContext* Context);
static void DestroyResources(lcContext* Context);
@ -148,6 +153,7 @@ protected:
bool mTrackUpdated;
int mMouseDownX;
int mMouseDownY;
bool mHighlight;
lcVertexBuffer mGridBuffer;
int mGridSettings[7];