mirror of
https://github.com/leozide/leocad
synced 2025-01-17 18:11:42 +01:00
Fixed HTML export not including submodels. Fixes #429.
This commit is contained in:
parent
b43675f323
commit
6d818d48d2
7 changed files with 28 additions and 22 deletions
|
@ -2934,14 +2934,14 @@ lcModel* lcModel::GetFirstSelectedSubmodel() const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void lcModel::GetSubModels(lcArray<lcModel*> SubModels) const
|
||||
void lcModel::GetSubModels(lcArray<lcModel*>& SubModels) const
|
||||
{
|
||||
for (lcPiece* Piece : mPieces)
|
||||
{
|
||||
if (Piece->mPieceInfo->IsModel())
|
||||
{
|
||||
lcModel* SubModel = Piece->mPieceInfo->GetModel();
|
||||
if (SubModels.FindIndex(SubModel) != -1)
|
||||
if (SubModels.FindIndex(SubModel) == -1)
|
||||
SubModels.Add(SubModel);
|
||||
}
|
||||
}
|
||||
|
@ -3153,7 +3153,7 @@ bool lcModel::GetPiecesBoundingBox(lcVector3& Min, lcVector3& Max) const
|
|||
return Valid;
|
||||
}
|
||||
|
||||
void lcModel::GetPartsList(int DefaultColorIndex, bool IncludeSubmodels, lcPartsList& PartsList) const
|
||||
void lcModel::GetPartsList(int DefaultColorIndex, bool ScanSubModels, bool AddSubModels, lcPartsList& PartsList) const
|
||||
{
|
||||
for (lcPiece* Piece : mPieces)
|
||||
{
|
||||
|
@ -3165,7 +3165,7 @@ void lcModel::GetPartsList(int DefaultColorIndex, bool IncludeSubmodels, lcParts
|
|||
if (ColorIndex == gDefaultColor)
|
||||
ColorIndex = DefaultColorIndex;
|
||||
|
||||
Piece->mPieceInfo->GetPartsList(ColorIndex, IncludeSubmodels, PartsList);
|
||||
Piece->mPieceInfo->GetPartsList(ColorIndex, ScanSubModels, AddSubModels, PartsList);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3181,7 +3181,7 @@ void lcModel::GetPartsListForStep(lcStep Step, int DefaultColorIndex, lcPartsLis
|
|||
if (ColorIndex == gDefaultColor)
|
||||
ColorIndex = DefaultColorIndex;
|
||||
|
||||
Piece->mPieceInfo->GetPartsList(ColorIndex, true, PartsList);
|
||||
Piece->mPieceInfo->GetPartsList(ColorIndex, false, true, PartsList);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4091,7 +4091,7 @@ void lcModel::ShowPropertiesDialog()
|
|||
Options.Properties = mProperties;
|
||||
Options.SetDefault = false;
|
||||
|
||||
GetPartsList(gDefaultColor, true, Options.PartsList);
|
||||
GetPartsList(gDefaultColor, true, false, Options.PartsList);
|
||||
|
||||
lcQPropertiesDialog Dialog(gMainWindow, &Options);
|
||||
if (Dialog.exec() != QDialog::Accepted)
|
||||
|
|
|
@ -245,7 +245,7 @@ public:
|
|||
bool AnyPiecesSelected() const;
|
||||
bool AnyObjectsSelected() const;
|
||||
lcModel* GetFirstSelectedSubmodel() const;
|
||||
void GetSubModels(lcArray<lcModel*> SubModels) const;
|
||||
void GetSubModels(lcArray<lcModel*>& SubModels) const;
|
||||
bool GetMoveRotateTransform(lcVector3& Center, lcMatrix33& RelativeRotation) const;
|
||||
bool GetPieceFocusOrSelectionCenter(lcVector3& Center) const;
|
||||
lcVector3 GetSelectionOrModelCenter() const;
|
||||
|
@ -253,7 +253,7 @@ public:
|
|||
lcObject* GetFocusObject() const;
|
||||
bool GetSelectionCenter(lcVector3& Center) const;
|
||||
bool GetPiecesBoundingBox(lcVector3& Min, lcVector3& Max) const;
|
||||
void GetPartsList(int DefaultColorIndex, bool IncludeSubmodels, lcPartsList& PartsList) const;
|
||||
void GetPartsList(int DefaultColorIndex, bool ScanSubModels, bool AddSubModels, lcPartsList& PartsList) const;
|
||||
void GetPartsListForStep(lcStep Step, int DefaultColorIndex, lcPartsList& PartsList) const;
|
||||
void GetModelParts(const lcMatrix44& WorldMatrix, int DefaultColorIndex, std::vector<lcModelPartsEntry>& ModelParts) const;
|
||||
void GetSelectionInformation(int* Flags, lcArray<lcObject*>& Selection, lcObject** Focus) const;
|
||||
|
|
|
@ -232,7 +232,7 @@ void lcPartSelectionListModel::SetCurrentModelCategory()
|
|||
|
||||
lcModel* ActiveModel = gMainWindow->GetActiveModel();
|
||||
lcPartsList PartsList;
|
||||
ActiveModel->GetPartsList(gDefaultColor, true, PartsList);
|
||||
ActiveModel->GetPartsList(gDefaultColor, false, true, PartsList);
|
||||
|
||||
for (const auto& PartIt : PartsList)
|
||||
mParts.emplace_back(std::pair<PieceInfo*, QPixmap>((PieceInfo*)PartIt.first, QPixmap()));
|
||||
|
|
|
@ -320,15 +320,21 @@ void PieceInfo::AddRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMatrix, i
|
|||
}
|
||||
}
|
||||
|
||||
void PieceInfo::GetPartsList(int DefaultColorIndex, bool IncludeSubmodels, lcPartsList& PartsList) const
|
||||
void PieceInfo::GetPartsList(int DefaultColorIndex, bool ScanSubModels, bool AddSubModels, lcPartsList& PartsList) const
|
||||
{
|
||||
if (IsModel() && IncludeSubmodels)
|
||||
mModel->GetPartsList(DefaultColorIndex, IncludeSubmodels, PartsList);
|
||||
if (IsModel())
|
||||
{
|
||||
if (ScanSubModels)
|
||||
mModel->GetPartsList(DefaultColorIndex, ScanSubModels, AddSubModels, PartsList);
|
||||
|
||||
if (AddSubModels && DefaultColorIndex < gNumUserColors)
|
||||
PartsList[this][DefaultColorIndex]++;
|
||||
}
|
||||
else if (IsProject())
|
||||
{
|
||||
lcModel* Model = mProject->GetMainModel();
|
||||
if (Model)
|
||||
Model->GetPartsList(DefaultColorIndex, IncludeSubmodels, PartsList);
|
||||
Model->GetPartsList(DefaultColorIndex, ScanSubModels, AddSubModels, PartsList);
|
||||
}
|
||||
else if (DefaultColorIndex < gNumUserColors)
|
||||
PartsList[this][DefaultColorIndex]++;
|
||||
|
|
|
@ -154,7 +154,7 @@ public:
|
|||
bool IncludesModel(const lcModel* Model) const;
|
||||
bool MinIntersectDist(const lcVector3& Start, const lcVector3& End, float& MinDistance) const;
|
||||
bool BoxTest(const lcMatrix44& WorldMatrix, const lcVector4 Planes[6]) const;
|
||||
void GetPartsList(int DefaultColorIndex, bool IncludeSubmodels, lcPartsList& PartsList) const;
|
||||
void GetPartsList(int DefaultColorIndex, bool ScanSubModels, bool AddSubModels, lcPartsList& PartsList) const;
|
||||
void GetModelParts(const lcMatrix44& WorldMatrix, int DefaultColorIndex, std::vector<lcModelPartsEntry>& ModelParts) const;
|
||||
void UpdateBoundingBox(std::vector<lcModel*>& UpdatedModels);
|
||||
|
||||
|
|
|
@ -1121,7 +1121,7 @@ void Project::ExportBrickLink()
|
|||
lcPartsList PartsList;
|
||||
|
||||
if (!mModels.IsEmpty())
|
||||
mModels[0]->GetPartsList(gDefaultColor, true, PartsList);
|
||||
mModels[0]->GetPartsList(gDefaultColor, true, false, PartsList);
|
||||
|
||||
if (PartsList.empty())
|
||||
{
|
||||
|
@ -1455,7 +1455,7 @@ void Project::ExportCSV()
|
|||
lcPartsList PartsList;
|
||||
|
||||
if (!mModels.IsEmpty())
|
||||
mModels[0]->GetPartsList(gDefaultColor, true, PartsList);
|
||||
mModels[0]->GetPartsList(gDefaultColor, true, false, PartsList);
|
||||
|
||||
if (PartsList.empty())
|
||||
{
|
||||
|
@ -1505,7 +1505,7 @@ QImage Project::CreatePartsListImage(lcModel* Model, lcStep Step)
|
|||
{
|
||||
lcPartsList PartsList;
|
||||
if (Step == 0)
|
||||
Model->GetPartsList(gDefaultColor, true, PartsList);
|
||||
Model->GetPartsList(gDefaultColor, true, false, PartsList);
|
||||
else
|
||||
Model->GetPartsListForStep(Step, gDefaultColor, PartsList);
|
||||
|
||||
|
@ -1705,7 +1705,7 @@ void Project::CreateHTMLPieceList(QTextStream& Stream, lcModel* Model, lcStep St
|
|||
lcPartsList PartsList;
|
||||
|
||||
if (Step == 0)
|
||||
Model->GetPartsList(gDefaultColor, true, PartsList);
|
||||
Model->GetPartsList(gDefaultColor, true, false, PartsList);
|
||||
else
|
||||
Model->GetPartsListForStep(Step, gDefaultColor, PartsList);
|
||||
|
||||
|
@ -1731,7 +1731,7 @@ void Project::CreateHTMLPieceList(QTextStream& Stream, lcModel* Model, lcStep St
|
|||
const PieceInfo* Info = PartIt.first;
|
||||
|
||||
if (Images)
|
||||
Stream << QString("<tr><td><IMG SRC=\"%1.png\" ALT=\"%2\"></td>\r\n").arg(Info->mFileName, Info->m_strDescription);
|
||||
Stream << QString("<tr><td><IMG SRC=\"%1.png\" ALT=\"%2\"></td>\r\n").arg(QString::fromLatin1(Info->mFileName).replace('#', '_'), Info->m_strDescription);
|
||||
else
|
||||
Stream << QString("<tr><td>%1</td>\r\n").arg(Info->m_strDescription);
|
||||
|
||||
|
@ -1951,7 +1951,7 @@ void Project::ExportHTML(const lcHTMLExportOptions& Options)
|
|||
Context->SetViewport(0, 0, Width, Height);
|
||||
|
||||
lcPartsList PartsList;
|
||||
Model->GetPartsList(gDefaultColor, true, PartsList);
|
||||
Model->GetPartsList(gDefaultColor, true, true, PartsList);
|
||||
|
||||
lcMatrix44 ProjectionMatrix, ViewMatrix;
|
||||
|
||||
|
@ -1979,7 +1979,7 @@ void Project::ExportHTML(const lcHTMLExportOptions& Options)
|
|||
|
||||
Scene.Draw(Context);
|
||||
|
||||
QString FileName = QFileInfo(Dir, QLatin1String(Info->mFileName) + QLatin1String(".png")).absoluteFilePath();
|
||||
QString FileName = QFileInfo(Dir, QString::fromLatin1(Info->mFileName).replace('#', '_') + QLatin1String(".png")).absoluteFilePath();
|
||||
QImage Image = Context->GetRenderFramebufferImage(RenderFramebuffer);
|
||||
|
||||
QImageWriter Writer(FileName);
|
||||
|
|
|
@ -16,7 +16,7 @@ lcQFindDialog::lcQFindDialog(QWidget* Parent, lcSearchOptions* SearchOptions, lc
|
|||
parts->setMinimumContentsLength(1);
|
||||
|
||||
lcPartsList PartsList;
|
||||
Model->GetPartsList(gDefaultColor, false, PartsList);
|
||||
Model->GetPartsList(gDefaultColor, false, true, PartsList);
|
||||
|
||||
for (const auto& PartIt : PartsList)
|
||||
parts->addItem(PartIt.first->m_strDescription, qVariantFromValue((void*)PartIt.first));
|
||||
|
|
Loading…
Reference in a new issue