mirror of
https://github.com/leozide/leocad
synced 2024-11-17 07:47:55 +01:00
Fixed synth parts adding the wrong mesh to the scene when in a submodel. Fixes #42.
This commit is contained in:
parent
ba9a2532a0
commit
49a88e1ab4
3 changed files with 16 additions and 10 deletions
|
@ -1141,16 +1141,8 @@ void lcModel::SubModelAddRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMat
|
|||
{
|
||||
lcPiece* Piece = mPieces[PieceIdx];
|
||||
|
||||
if (Piece->GetStepHide() != LC_STEP_MAX)
|
||||
continue;
|
||||
|
||||
int ColorIndex = Piece->mColorIndex;
|
||||
|
||||
if (ColorIndex == gDefaultColor)
|
||||
ColorIndex = DefaultColorIndex;
|
||||
|
||||
PieceInfo* Info = Piece->mPieceInfo;
|
||||
Info->AddRenderMeshes(Scene, lcMul(Piece->mModelWorld, WorldMatrix), ColorIndex, Focused, Selected);
|
||||
if (Piece->GetStepHide() == LC_STEP_MAX)
|
||||
Piece->SubModelAddRenderMeshes(Scene, WorldMatrix, DefaultColorIndex, Focused, Selected);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -648,6 +648,19 @@ void lcPiece::AddRenderMeshes(lcScene& Scene, bool DrawInterface) const
|
|||
Scene.mInterfaceObjects.Add(this);
|
||||
}
|
||||
|
||||
void lcPiece::SubModelAddRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMatrix, int DefaultColorIndex, bool Focused, bool Selected) const
|
||||
{
|
||||
int ColorIndex = mColorIndex;
|
||||
|
||||
if (ColorIndex == gDefaultColor)
|
||||
ColorIndex = DefaultColorIndex;
|
||||
|
||||
if (!mMesh)
|
||||
mPieceInfo->AddRenderMeshes(Scene, lcMul(mModelWorld, WorldMatrix), ColorIndex, Focused, Selected);
|
||||
else
|
||||
Scene.AddMesh(mMesh, lcMul(mModelWorld, WorldMatrix), ColorIndex, Focused ? LC_RENDERMESH_FOCUSED : (Selected ? LC_RENDERMESH_SELECTED : LC_RENDERMESH_NONE), mPieceInfo->mFlags);
|
||||
}
|
||||
|
||||
void lcPiece::Move(lcStep Step, bool AddKey, const lcVector3& Distance)
|
||||
{
|
||||
lcuint32 Section = GetFocusSection();
|
||||
|
|
|
@ -347,6 +347,7 @@ public:
|
|||
virtual void DrawInterface(lcContext* Context) const;
|
||||
|
||||
void AddRenderMeshes(lcScene& Scene, bool DrawInterface) const;
|
||||
void SubModelAddRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMatrix, int DefaultColorIndex, bool Focused, bool Selected) const;
|
||||
|
||||
void InsertTime(lcStep Start, lcStep Time);
|
||||
void RemoveTime(lcStep Start, lcStep Time);
|
||||
|
|
Loading…
Reference in a new issue