Move export permission check to LLPermissions, try two.

Removes code duplication.

Several parts of the code ignored the PERM_EXPORT but
and still did demand that things are full perm next
to being a creator. This has now changed the export
rules are the same for everything as they were for mesh:
you need to be the owner and the creator for every element
that is exported (not just the root prim, of course).
This commit is contained in:
Aleric Inglewood
2013-07-22 22:38:43 +02:00
parent be6699198f
commit dcf1cdbc4e
8 changed files with 41 additions and 53 deletions

View File

@@ -117,16 +117,13 @@ namespace DAEExportUtil
}
}
bool canExportNode(const LLSelectNode* node)
// Identical to the one in awavefront.cpp
bool can_export_node(const LLSelectNode* node)
{
if (const LLPermissions* perms = node->mPermissions)
{
if (gAgentID == perms->getCreator() || (LFSimFeatureHandler::instance().simSupportsExport() && gAgentID == perms->getOwner() && perms->getMaskEveryone() & PERM_EXPORT))
{
return true;
}
}
return false;
LLPermissions* perms = node->mPermissions; // Is perms ever NULL?
// This tests the PERM_EXPORT bit too, which is not really necessary (just checking if it's set
// on the root prim would suffice), but also isn't hurting.
return perms && perms->allowExportBy(gAgentID, LFSimFeatureHandler::instance().simSupportsExport());
}
void saveSelectedObject()
@@ -144,7 +141,7 @@ namespace DAEExportUtil
{
total++;
LLSelectNode* node = *iter;
if (!canExportNode(node) || !node->getObject()->getVolume()) continue;
if (!can_export_node(node) || !node->getObject()->getVolume()) continue;
included++;
daesaver->Add(node->getObject(), node->mName);
}