diff --git a/src/model/nifmodel.cpp b/src/model/nifmodel.cpp index 40ed097a..92c212d5 100644 --- a/src/model/nifmodel.cpp +++ b/src/model/nifmodel.cpp @@ -1824,6 +1824,30 @@ class spMeshFileImport static bool processAllItems( NifModel * nif ); }; +bool NifModel::checkInternalGeometry( const QModelIndex & blockIndex ) +{ + if ( !blockIndex.isValid() ) { + int n = getBlockCount(); + for ( int i = 0; i < n; i++ ) { + QModelIndex b = getBlockIndex( i ); + if ( isNiBlock( b, "BSGeometry" ) && !checkInternalGeometry( b ) ) + return false; + } + return true; + } + if ( !isNiBlock( blockIndex, "BSGeometry" ) ) + return true; + if ( get( blockIndex, "Flags" ) & 0x0200 ) + return true; + if ( QMessageBox::question( parentWindow, tr( "NifSkope warning" ), + tr( "This operation can only be performed on internal geometry. Convert meshes?" ) ) + != QMessageBox::Yes ) { + return false; + } + spMeshFileImport::processAllItems( this ); + return bool( get( blockIndex, "Flags" ) & 0x0200 ); +} + bool NifModel::load( QIODevice & device, const char* fileName ) { QSettings settings; diff --git a/src/model/nifmodel.h b/src/model/nifmodel.h index a6cc0264..7e97e62b 100644 --- a/src/model/nifmodel.h +++ b/src/model/nifmodel.h @@ -97,6 +97,8 @@ class NifModel final : public BaseModel // BaseModel void clear() override final; + //! Check if a Starfield model uses internal geometry data, and optionally convert meshes. Returns true on success. + bool checkInternalGeometry( const QModelIndex & blockIndex ); bool load( QIODevice & device, const char* fileName = nullptr ) override final; bool save( QIODevice & device ) const override final;