mirror of
https://github.com/leozide/leocad
synced 2025-01-18 22:26:44 +01:00
Unofficial project part
This commit is contained in:
parent
23a93b4afb
commit
90d4feffe9
5 changed files with 13 additions and 4 deletions
|
@ -164,7 +164,7 @@ PieceInfo* lcPiecesLibrary::FindPiece(const char* PieceName, Project* CurrentPro
|
|||
{
|
||||
PieceInfo* Info = PieceIt->second;
|
||||
|
||||
if ((!CurrentProject || !Info->IsModel() || CurrentProject->GetModels().FindIndex(Info->GetModel()) != -1) && (!ProjectPath.isEmpty() || !Info->IsProject()))
|
||||
if ((!CurrentProject || !Info->IsModel() || CurrentProject->GetModels().FindIndex(Info->GetModel()) != -1) && (!ProjectPath.isEmpty() || !Info->IsProject() || Info->IsProjectPiece()))
|
||||
return Info;
|
||||
}
|
||||
|
||||
|
|
|
@ -266,7 +266,7 @@ void lcPartSelectionListModel::SetFilter(const QString& Filter)
|
|||
PieceInfo* Info = mParts[PartIdx].first;
|
||||
bool Visible;
|
||||
|
||||
if (!mShowDecoratedParts && Info->IsPatterned())
|
||||
if (!mShowDecoratedParts && Info->IsPatterned() && !Info->IsProjectPiece())
|
||||
Visible = false;
|
||||
else if (!mShowPartAliases && Info->m_strDescription[0] == '=')
|
||||
Visible = false;
|
||||
|
|
|
@ -93,7 +93,8 @@ lcPreview::lcPreview()
|
|||
bool lcPreview::SetCurrentPiece(const QString& PartType, int ColorCode)
|
||||
{
|
||||
lcPiecesLibrary* Library = lcGetPiecesLibrary();
|
||||
PieceInfo* Info = Library->FindPiece(PartType.toLatin1().constData(), nullptr, false, false);
|
||||
Project* CurrentProject = lcGetActiveProject();
|
||||
PieceInfo* Info = Library->FindPiece(PartType.toLatin1().constData(), CurrentProject, false, true);
|
||||
|
||||
if (Info)
|
||||
{
|
||||
|
|
|
@ -112,6 +112,13 @@ void PieceInfo::CreateProject(Project* Project, const char* PieceName)
|
|||
m_strDescription[sizeof(m_strDescription) - 1] = 0;
|
||||
}
|
||||
|
||||
bool PieceInfo::IsProjectPiece() const
|
||||
{
|
||||
if (mProject)
|
||||
return !strcmp(m_strDescription, mProject->GetFileName().toLatin1().data());
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PieceInfo::GetPieceWorldMatrix(lcPiece* Piece, lcMatrix44& WorldMatrix) const
|
||||
{
|
||||
if (IsModel())
|
||||
|
@ -346,7 +353,7 @@ void PieceInfo::GetPartsList(int DefaultColorIndex, bool ScanSubModels, bool Add
|
|||
if (AddSubModels)
|
||||
PartsList[this][DefaultColorIndex]++;
|
||||
}
|
||||
else if (IsProject())
|
||||
else if (IsProject() && !IsProjectPiece())
|
||||
{
|
||||
const lcModel* const Model = mProject->GetMainModel();
|
||||
if (Model)
|
||||
|
|
|
@ -158,6 +158,7 @@ public:
|
|||
return (m_strDescription[0] == '~');
|
||||
}
|
||||
|
||||
bool IsProjectPiece() const;
|
||||
void ZoomExtents(float FoV, float AspectRatio, lcMatrix44& ProjectionMatrix, lcMatrix44& ViewMatrix) const;
|
||||
void AddRenderMesh(lcScene& Scene);
|
||||
void AddRenderMeshes(lcScene* Scene, const lcMatrix44& WorldMatrix, int ColorIndex, lcRenderMeshState RenderMeshState, bool ParentActive) const;
|
||||
|
|
Loading…
Reference in a new issue