Don't crash when trying to export linked parts

Fixes issue #1176
This commit is contained in:
Latif Khalifa
2013-11-01 22:34:55 +01:00
parent 3d47d6f0dc
commit 1f587d1ad1
3 changed files with 19 additions and 9 deletions

View File

@@ -275,6 +275,13 @@ namespace
{ {
if (LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection()) if (LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection())
{ {
if (!selection->getFirstRootObject())
{
if (gSavedSettings.getBOOL("OBJExportNotifyFailed"))
LLNotificationsUtil::add("ExportFailed");
return true;
}
WavefrontSaver* wfsaver = new WavefrontSaver; // deleted in callback WavefrontSaver* wfsaver = new WavefrontSaver; // deleted in callback
wfsaver->offset = -selection->getFirstRootObject()->getRenderPosition(); wfsaver->offset = -selection->getFirstRootObject()->getRenderPosition();
S32 total = 0; S32 total = 0;

View File

@@ -272,7 +272,9 @@ public:
void addSelectedObjects() void addSelectedObjects()
{ {
if (LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection()) LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
if (selection && selection->getFirstRootObject())
{ {
mSaver.mOffset = -selection->getFirstRootObject()->getRenderPosition(); mSaver.mOffset = -selection->getFirstRootObject()->getRenderPosition();
mObjectName = selection->getFirstRootNode()->mName; mObjectName = selection->getFirstRootNode()->mName;
@@ -285,14 +287,15 @@ public:
if (!node->getObject()->getVolume() || !DAEExportUtil::canExportNode(node)) continue; if (!node->getObject()->getVolume() || !DAEExportUtil::canExportNode(node)) continue;
mSaver.add(node->getObject(), node->mName); mSaver.add(node->getObject(), node->mName);
} }
}
if (mSaver.mObjects.empty()) if (mSaver.mObjects.empty())
{ {
LLNotificationsUtil::add("ExportFailed"); LLNotificationsUtil::add("ExportFailed");
close(); close();
return; }
} else
{
mSaver.updateTextureInfo(); mSaver.updateTextureInfo();
mNumTextures = mSaver.mTextures.size(); mNumTextures = mSaver.mTextures.size();
mNumExportableTextures = getNumExportableTextures(); mNumExportableTextures = getNumExportableTextures();

View File

@@ -5869,7 +5869,7 @@ Builds with extended hollow or extended hole size do not render properly on othe
icon="alertmodal.tga" icon="alertmodal.tga"
name="ExportFailed" name="ExportFailed"
type="alertmodal"> type="alertmodal">
Bad permissions for the exported object. Export aborted. None of the selected objects are exportable. Export aborted.
</notification> </notification>
<notification <notification