Merge pull request #819 from trevorsandy/PROJECT_PART

Unofficial project part
This commit is contained in:
Leonardo Zide
2022-07-09 09:28:39 -07:00
committed by GitHub
4 changed files with 11 additions and 3 deletions
+1 -1
View File
@@ -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;
}
+1 -1
View File
@@ -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;
+8 -1
View File
@@ -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)
+1
View File
@@ -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;