Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions indra/newview/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ set(viewer_SOURCE_FILES
vjlocalmesh.cpp
vjfloaterlocalmesh.cpp
vjlocalmeshimportdae.cpp
vjlocalmeshimportgltf.cpp
gltfexport.cpp

gltfscenemanager.cpp
# <FS:Ansariel> Group GLTF files into their subfolders
Expand Down Expand Up @@ -1037,6 +1039,8 @@ set(viewer_HEADER_FILES
vjlocalmesh.h
vjfloaterlocalmesh.h
vjlocalmeshimportdae.h
vjlocalmeshimportgltf.h
gltfexport.h

gltfscenemanager.h
groupchatlistener.h
Expand Down
39 changes: 35 additions & 4 deletions indra/newview/daeexport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,20 +197,51 @@ void ColladaExportFloater::updateUI()
void ColladaExportFloater::onClickExport()
{
LLFilePickerReplyThread::startPicker(boost::bind(&ColladaExportFloater::onExportFileSelected, this, _1),
LLFilePicker::FFSAVE_COLLADA, LLDir::getScrubbedFileName(mObjectName + ".dae"));
LLFilePicker::FFSAVE_COLLADA | LLFilePicker::FFSAVE_GLTF, LLDir::getScrubbedFileName(mObjectName + ".dae"));
}

void ColladaExportFloater::onExportFileSelected(const std::vector<std::string>& filenames)
{
mFilename = filenames[0];

if (gSavedSettings.getBOOL("DAEExportTextures"))
// Check extension
std::string ext = gDirUtilp->getExtension(mFilename);
LLStringUtil::toLower(ext);

if (ext == "gltf" || ext == "glb")
{
saveTextures();
// GLTF export
// For GLTF we skip texture saving logic of DAE for now (unless GLTFExporter handles it)
// GLTFExporter handles internal logic.

mGLTFSaver.setObjects(mSaver.mObjects); // Reuse object list populated in addSelectedObjects
bool success = mGLTFSaver.save(mFilename);

LLSD args;
args["OBJECT"] = mObjectName;
args["FILENAME"] = mFilename;
if (success)
{
LL_INFOS() << "GLTF export successful" << LL_ENDL;
LLNotificationsUtil::add("ExportColladaSuccess", args); // Reuse success message
}
else
{
LL_WARNS() << "GLTF export failed" << LL_ENDL;
LLNotificationsUtil::add("ExportColladaFailure", args); // Reuse failure message
}
closeFloater();
}
else
{
onTexturesSaved();
if (gSavedSettings.getBOOL("DAEExportTextures"))
{
saveTextures();
}
else
{
onTexturesSaved();
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions indra/newview/daeexport.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "lltextureentry.h"
#include "lltexturecache.h"
#include <dom/domElements.h>
#include "gltfexport.h"

class LLViewerObject;
class LLObjectSelection;
Expand Down Expand Up @@ -142,6 +143,7 @@ class ColladaExportFloater : public LLFloater
S32 getNumExportableTextures();

DAESaver mSaver;
GLTFExporter mGLTFSaver;
S32 mTotal;
S32 mIncluded;
S32 mNumTextures;
Expand Down
Loading