Merge pull request #289 from Areloch/NoAnimatedMakeAMesh

Adds logical check to skip animated statics when baking selection to mesh.
This commit is contained in:
Brian Roberts 2020-08-16 02:27:13 -05:00 committed by GitHub
commit 84bf25f9e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 2 deletions

View file

@ -284,6 +284,8 @@ public:
void updateMaterials(); void updateMaterials();
bool isAnimated() { return mPlayAmbient; }
private: private:
virtual void onStaticModified(const char* slotName, const char* newValue = NULL); virtual void onStaticModified(const char* slotName, const char* newValue = NULL);
protected: protected:

View file

@ -3909,8 +3909,18 @@ bool WorldEditor::makeSelectionAMesh(const char *filename)
for ( S32 i = 0; i < mSelected->size(); i++ ) for ( S32 i = 0; i < mSelected->size(); i++ )
{ {
SceneObject *pObj = dynamic_cast< SceneObject* >( ( *mSelected )[i] ); SceneObject *pObj = dynamic_cast< SceneObject* >( ( *mSelected )[i] );
if ( pObj ) if (pObj)
objectList.push_back( pObj ); {
//Minor sanity check to avoid baking animated shapes
TSStatic* staticShape = dynamic_cast<TSStatic*>(pObj);
if (staticShape)
{
if (staticShape->isAnimated() && staticShape->hasAnim())
continue;
}
objectList.push_back(pObj);
}
} }
if ( objectList.empty() ) if ( objectList.empty() )
@ -3956,6 +3966,7 @@ bool WorldEditor::makeSelectionAMesh(const char *filename)
for (S32 i = 0; i < objectList.size(); i++) for (S32 i = 0; i < objectList.size(); i++)
{ {
SceneObject *pObj = objectList[i]; SceneObject *pObj = objectList[i];
if (!pObj->buildExportPolyList(&exportData, pObj->getWorldBox(), pObj->getWorldSphere())) if (!pObj->buildExportPolyList(&exportData, pObj->getWorldBox(), pObj->getWorldSphere()))
Con::warnf("colladaExportObjectList() - object %i returned no geometry.", pObj->getId()); Con::warnf("colladaExportObjectList() - object %i returned no geometry.", pObj->getId());
} }