mirror of
https://github.com/leozide/leocad
synced 2025-01-17 18:11:42 +01:00
Correctly draw selection box outline of submodels.
This commit is contained in:
parent
d7396b4edb
commit
98aa121dec
4 changed files with 31 additions and 9 deletions
|
@ -77,6 +77,7 @@ void lcApplication::SetProject(Project* Project)
|
|||
for (int ViewIdx = 0; ViewIdx < Views.GetSize(); ViewIdx++)
|
||||
Views[ViewIdx]->SetModel(lcGetActiveModel());
|
||||
|
||||
gMainWindow->UpdateAllViews();
|
||||
gMainWindow->UpdateModels();
|
||||
gMainWindow->UpdateTitle();
|
||||
}
|
||||
|
|
|
@ -449,7 +449,6 @@ void lcModel::LoadLDraw(QTextStream& Stream)
|
|||
continue;
|
||||
}
|
||||
|
||||
// todo: mpd
|
||||
// todo: load from disk
|
||||
|
||||
Info = lcGetPiecesLibrary()->FindPiece(PartID.toLatin1().constData(), true);
|
||||
|
@ -954,10 +953,6 @@ void lcModel::SubModelAddRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMat
|
|||
PieceInfo* Info = Piece->mPieceInfo;
|
||||
Info->AddRenderMeshes(Scene, lcMul(Piece->mModelWorld, WorldMatrix), ColorIndex, Focused, Selected);
|
||||
}
|
||||
|
||||
// todo: add model bounding box
|
||||
// if (Selected)
|
||||
// Scene.InterfaceObjects.Add(Piece);
|
||||
}
|
||||
|
||||
void lcModel::DrawBackground(lcContext* Context)
|
||||
|
@ -1172,6 +1167,33 @@ void lcModel::LoadCheckPoint(lcModelHistoryEntry* CheckPoint)
|
|||
gMainWindow->UpdateAllViews();
|
||||
}
|
||||
|
||||
void lcModel::SetActive(bool Active)
|
||||
{
|
||||
if (Active)
|
||||
{
|
||||
CalculateStep(mCurrentStep);
|
||||
}
|
||||
else
|
||||
{
|
||||
CalculateStep(LC_STEP_MAX);
|
||||
|
||||
float BoundingBox[6];
|
||||
GetPiecesBoundingBox(BoundingBox);
|
||||
|
||||
mPieceInfo->m_fDimensions[0] = BoundingBox[3];
|
||||
mPieceInfo->m_fDimensions[1] = BoundingBox[4];
|
||||
mPieceInfo->m_fDimensions[2] = BoundingBox[5];
|
||||
mPieceInfo->m_fDimensions[3] = BoundingBox[0];
|
||||
mPieceInfo->m_fDimensions[4] = BoundingBox[1];
|
||||
mPieceInfo->m_fDimensions[5] = BoundingBox[2];
|
||||
|
||||
strncpy(mPieceInfo->m_strName, mProperties.mName.toLatin1().constData(), sizeof(mPieceInfo->m_strName));
|
||||
mPieceInfo->m_strName[sizeof(mPieceInfo->m_strName) - 1] = 0;
|
||||
strncpy(mPieceInfo->m_strDescription, mProperties.mName.toLatin1().constData(), sizeof(mPieceInfo->m_strDescription));
|
||||
mPieceInfo->m_strDescription[sizeof(mPieceInfo->m_strDescription) - 1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void lcModel::CalculateStep(lcStep Step)
|
||||
{
|
||||
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
||||
|
|
|
@ -170,6 +170,7 @@ public:
|
|||
return mCurrentStep;
|
||||
}
|
||||
|
||||
void SetActive(bool Active);
|
||||
void CalculateStep(lcStep Step);
|
||||
void SetCurrentStep(lcStep Step)
|
||||
{
|
||||
|
|
|
@ -55,11 +55,9 @@ void Project::SetActiveModel(int ModelIndex)
|
|||
return;
|
||||
|
||||
for (int ModelIdx = 0; ModelIdx < mModels.GetSize(); ModelIdx++)
|
||||
if (ModelIdx != ModelIndex)
|
||||
mModels[ModelIdx]->CalculateStep(LC_STEP_MAX);
|
||||
mModels[ModelIdx]->SetActive(ModelIdx == ModelIndex);
|
||||
|
||||
mActiveModel = mModels[ModelIndex];
|
||||
mActiveModel->CalculateStep(mActiveModel->GetCurrentStep());
|
||||
mActiveModel->UpdateInterface();
|
||||
gMainWindow->UpdateModels();
|
||||
|
||||
|
@ -242,7 +240,7 @@ bool Project::Load(const QString& FileName)
|
|||
Model->CreatePieceInfo();
|
||||
}
|
||||
|
||||
mActiveModel = mModels[0];
|
||||
SetActiveModel(0);
|
||||
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue