MAINT-4983 Mesh upload of large model ryoma 3d loads indefinitely

meow-7.2.2
andreykproductengine 2015-03-25 20:07:21 +02:00
parent f930cd1492
commit 051052b141
4 changed files with 28 additions and 7 deletions

View File

@ -779,7 +779,8 @@ LLDAELoader::LLDAELoader(
state_callback_t state_cb,
void* opaque_userdata,
JointTransformMap& jointMap,
JointSet& jointsFromNodes )
JointSet& jointsFromNodes,
U32 modelLimit)
: LLModelLoader(
filename,
lod,
@ -789,7 +790,8 @@ LLDAELoader::LLDAELoader(
state_cb,
opaque_userdata,
jointMap,
jointsFromNodes)
jointsFromNodes),
mGeneratedModelLimit(modelLimit)
{
}
@ -911,6 +913,7 @@ bool LLDAELoader::OpenFile(const std::string& filename)
mTransform.condition();
U32 submodel_limit = count > 0 ? mGeneratedModelLimit/count : 0;
for (daeInt idx = 0; idx < count; ++idx)
{ //build map of domEntities to LLModel
domMesh* mesh = NULL;
@ -921,7 +924,7 @@ bool LLDAELoader::OpenFile(const std::string& filename)
std::vector<LLModel*> models;
loadModelsFromDomMesh(mesh, models);
loadModelsFromDomMesh(mesh, models, submodel_limit);
std::vector<LLModel*>::iterator i;
i = models.begin();
@ -2270,7 +2273,7 @@ LLModel* LLDAELoader::loadModelFromDomMesh(domMesh *mesh)
//static diff version supports creating multiple models when material counts spill
// over the 8 face server-side limit
//
bool LLDAELoader::loadModelsFromDomMesh(domMesh* mesh, std::vector<LLModel*>& models_out)
bool LLDAELoader::loadModelsFromDomMesh(domMesh* mesh, std::vector<LLModel*>& models_out, U32 submodel_limit)
{
LLVolumeParams volume_params;
@ -2321,6 +2324,10 @@ bool LLDAELoader::loadModelsFromDomMesh(domMesh* mesh, std::vector<LLModel*>& mo
bool normalized = false;
int submodelID = 0;
// remove all faces that definitely won't fit into one model and submodel limit
ret->setNumVolumeFaces((submodel_limit + 1) * LL_SCULPT_MESH_MAX_FACES);
LLVolume::face_list_t remainder;
do
{

View File

@ -55,7 +55,8 @@ public:
LLModelLoader::state_callback_t state_cb,
void* opaque_userdata,
JointTransformMap& jointMap,
JointSet& jointsFromNodes);
JointSet& jointsFromNodes,
U32 modelLimit);
virtual ~LLDAELoader() ;
virtual bool OpenFile(const std::string& filename);
@ -93,11 +94,12 @@ protected:
// Loads a mesh breaking it into one or more models as necessary
// to get around volume face limitations while retaining >8 materials
//
bool loadModelsFromDomMesh(domMesh* mesh, std::vector<LLModel*>& models_out);
bool loadModelsFromDomMesh(domMesh* mesh, std::vector<LLModel*>& models_out, U32 submodel_limit);
static std::string getElementLabel(daeElement *element);
private:
U32 mGeneratedModelLimit; // Attempt to limit amount of generated submodels
};
#endif // LL_LLDAELLOADER_H

View File

@ -13,6 +13,17 @@
<key>Value</key>
<integer>0</integer>
</map>
<key>ImporterModelLimit</key>
<map>
<key>Comment</key>
<string>Limits amount of importer generated models for dae files</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>U32</string>
<key>Value</key>
<integer>768</integer>
</map>
<key>IMShowTime</key>
<map>
<key>Comment</key>

View File

@ -1754,7 +1754,8 @@ void LLModelPreview::loadModel(std::string filename, S32 lod, bool force_disable
&LLModelPreview::stateChangedCallback,
this,
mJointTransformMap,
mJointsFromNode );
mJointsFromNode,
gSavedSettings.getU32("ImporterModelLimit"));
if (force_disable_slm)
{