Skip to content

Commit

Permalink
CSV crash hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbui78 committed Apr 16, 2023
1 parent 40a37f4 commit b8abd35
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
23 changes: 17 additions & 6 deletions DazStudioPlugin/DzUnrealAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ void DzUnrealAction::writeConfiguration()
if (m_pSelectedNode == nullptr)
return;

QTextStream* pCSVStream = nullptr;
QFile *pCSVfile = nullptr;

QString DTUfilename = m_sDestinationPath + m_sExportFilename + ".dtu";
QFile DTUfile(DTUfilename);
DTUfile.open(QIODevice::WriteOnly);
Expand All @@ -195,16 +198,17 @@ void DzUnrealAction::writeConfiguration()

if (m_sAssetType.toLower().contains("mesh") || m_sAssetType == "Animation")
{
QTextStream *pCVSStream = nullptr;
if (m_bExportMaterialPropertiesCSV)
{
QString filename = m_sDestinationPath + m_sExportFilename + "_Maps.csv";
QFile file(filename);
file.open(QIODevice::WriteOnly);
pCVSStream = new QTextStream(&file);
*pCVSStream << "Version, Object, Material, Type, Color, Opacity, File" << endl;
pCSVfile = new QFile(filename);
if (pCSVfile->open(QIODevice::WriteOnly))
{
pCSVStream = new QTextStream(pCSVfile);
*pCSVStream << "Version, Object, Material, Type, Color, Opacity, File" << endl;
}
}
writeAllMaterials(m_pSelectedNode, writer, pCVSStream);
writeAllMaterials(m_pSelectedNode, writer, pCSVStream);
writeAllMorphs(writer);

// DB, 2022-July-5: Daz To Unified Bridge Format support
Expand Down Expand Up @@ -234,6 +238,13 @@ void DzUnrealAction::writeConfiguration()
writer.finishObject();
DTUfile.close();

if (pCSVStream) delete(pCSVStream);
if (pCSVfile)
{
pCSVfile->close();
delete(pCSVfile);
}

// DB, 2022-June-4: Hotfix for Corrupted Imports due to UDP Packet before UpgradeToHD
if (m_EnableSubdivisions == false)
{
Expand Down
4 changes: 2 additions & 2 deletions DazStudioPlugin/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// Version number for DazToUnreal
#define PLUGIN_MAJOR 2022
#define PLUGIN_MINOR 2
#define PLUGIN_REV 18
#define PLUGIN_BUILD 24
#define PLUGIN_REV 19
#define PLUGIN_BUILD 25

#define PLUGIN_VERSION DZ_MAKE_VERSION( PLUGIN_MAJOR, PLUGIN_MINOR, PLUGIN_REV, PLUGIN_BUILD )

0 comments on commit b8abd35

Please sign in to comment.