diff --git a/indra/newview/awavefront.cpp b/indra/newview/awavefront.cpp index d48bb8dfa..3f4d2c994 100644 --- a/indra/newview/awavefront.cpp +++ b/indra/newview/awavefront.cpp @@ -52,6 +52,7 @@ typedef LLMemberListener view_listener_t; namespace { const std::string OBJ(".obj"); + void save_wavefront_continued(WavefrontSaver* wfsaver, AIFilePicker* filepicker) { if (filepicker->hasFilename()) @@ -71,6 +72,25 @@ namespace delete wfsaver; } + + void save_wavefront_picker(WavefrontSaver* wfsaver, std::string name) + { + AIFilePicker* filepicker = AIFilePicker::create(); + filepicker->open(name); + filepicker->run(boost::bind(&save_wavefront_continued, wfsaver, filepicker)); + } + + void save_wavefront_on_confirm(const LLSD& notification, const LLSD& response, WavefrontSaver* wfsaver, std::string name) + { + if (LLNotificationsUtil::getSelectedOption(notification, response) == 0) // 0 - Proceed, first choice + { + save_wavefront_picker(wfsaver, name); + } + else + { + delete wfsaver; + } + } } Wavefront::Wavefront(vert_t v, tri_t t) @@ -129,19 +149,19 @@ Wavefront::Wavefront(LLFace* face, LLPolyMesh* mesh, const LLXform* transform, c const U16 start = face->getGeomStart(); const U32 end = start + (mesh ? mesh->getNumVertices() : vb->getNumVerts()) - 1; //vertices - for (int i = start; i <= end; ++i) + for (U32 i = start; i <= end; ++i) vertices.push_back(std::make_pair(getVerts[i], getCoord[i])); if (transform) Transform(vertices, transform); - for (int i = start; i <= end; ++i) + for (U32 i = start; i <= end; ++i) normals.push_back(getNorms[i]); if (transform_normals) Transform(normals, transform_normals); const U32 pcount = mesh ? mesh->getNumFaces() : (vb->getNumIndices()/3); //indices const U16 offset = face->getIndicesStart(); //indices - for (int i = 0; i < pcount; ++i) + for (U32 i = 0; i < pcount; ++i) { triangles.push_back(tri(getIndices[i * 3 + offset] + start, getIndices[i * 3 + 1 + offset] + start, getIndices[i * 3 + 2 + offset] + start)); } @@ -204,12 +224,10 @@ namespace { if (const LLPermissions* perms = node->mPermissions) { - if (!(gAgentID == perms->getCreator() || (LFSimFeatureHandler::instance().simSupportsExport() && gAgentID == perms->getOwner() && perms->getMaskEveryone() & PERM_EXPORT))) + if (gAgentID == perms->getCreator() || (LFSimFeatureHandler::instance().simSupportsExport() && gAgentID == perms->getOwner() && perms->getMaskEveryone() & PERM_EXPORT)) { - static const LLCachedControl notify("OBJExportNotifyFailed", false); - if (notify) LLNotificationsUtil::add("WavefrontExportPartial", LLSD().with("OBJECT", node->mName)); + return true; } - else return true; } return false; } @@ -221,10 +239,14 @@ namespace { WavefrontSaver* wfsaver = new WavefrontSaver; // deleted in callback wfsaver->offset = -selection->getFirstRootObject()->getRenderPosition(); + S32 total = 0; + S32 included = 0; for (LLObjectSelection::iterator iter = selection->begin(); iter != selection->end(); ++iter) { + total++; LLSelectNode* node = *iter; if (!can_export_node(node)) continue; + included++; wfsaver->Add(node->getObject()); } if (wfsaver->obj_v.empty()) @@ -235,9 +257,16 @@ namespace return true; } - AIFilePicker* filepicker = AIFilePicker::create(); - filepicker->open(selection->getFirstNode()->mName.c_str()+OBJ); - filepicker->run(boost::bind(&save_wavefront_continued, wfsaver, filepicker)); + if (total != included) + { + LLSD args; + args["TOTAL"] = total; + args["FAILED"] = total - included; + LLNotificationsUtil::add("WavefrontExportPartial", args, LLSD(), boost::bind(&save_wavefront_on_confirm, _1, _2, wfsaver, selection->getFirstNode()->mName.c_str() + OBJ)); + return true; + } + + save_wavefront_picker(wfsaver, selection->getFirstNode()->mName.c_str() + OBJ); } return true; } diff --git a/indra/newview/skins/default/xui/en-us/menu_pie_self.xml b/indra/newview/skins/default/xui/en-us/menu_pie_self.xml index 96c845e00..9b35ae1f3 100644 --- a/indra/newview/skins/default/xui/en-us/menu_pie_self.xml +++ b/indra/newview/skins/default/xui/en-us/menu_pie_self.xml @@ -107,6 +107,9 @@ + + + @@ -119,7 +122,4 @@ - - - diff --git a/indra/newview/skins/default/xui/en-us/notifications.xml b/indra/newview/skins/default/xui/en-us/notifications.xml index d6f8d4b34..ad9730e5a 100644 --- a/indra/newview/skins/default/xui/en-us/notifications.xml +++ b/indra/newview/skins/default/xui/en-us/notifications.xml @@ -9638,10 +9638,16 @@ Would you like to enable announcing keys to objects in the sim? -Unable to include [OBJECT] in export, insufficient permissions. + type="alertmodal"> +Unable to include [FAILED] out of [TOTAL] objects in export due to insufficient permissions. + +Do you wish to export anyway? +