From 9b7165121acd3fc93ef9b17354cca515cd6849cf Mon Sep 17 00:00:00 2001 From: prep Date: Thu, 14 Jul 2011 11:36:32 -0400 Subject: Fix for Sh-2047: Partial joint arrays are now able to upload --- indra/newview/llfloatermodelpreview.cpp | 41 ++++++++------------------------- 1 file changed, 10 insertions(+), 31 deletions(-) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 0748ed8039..9ef5c6022e 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -2196,15 +2196,11 @@ void LLModelPreview::critiqueRigForUploadApplicability( const std::vectorchildDisable("ok_btn"); - } - else - if ( !isLegacyRigValid() ) - { - mFMP->childDisable("ok_btn"); - } - //ok_btn should not have been changed unless something was wrong with joint list + } } std::set accounted; @@ -4224,12 +4209,7 @@ void LLModelPreview::updateStatusMessages() if ( uploadingJointPositions && !isRigValidForJointPositionUpload() ) { skinAndRigOk = false; - } - else - if ( !isLegacyRigValid() ) - { - skinAndRigOk = false; - } + } } if(upload_ok && mModelLoader) @@ -4807,8 +4787,12 @@ BOOL LLModelPreview::render() mFMP->childSetValue("upload_joints", false); upload_joints = false; } - - mFMP->childSetEnabled("upload_joints", upload_skin); + + //Only enable joint offsets if it passed the earlier critiquing + if ( isRigValidForJointPositionUpload() ) + { + mFMP->childSetEnabled("upload_joints", upload_skin); + } F32 explode = mFMP->childGetValue("physics_explode").asReal(); @@ -5468,11 +5452,6 @@ void LLFloaterModelPreview::toggleCalculateButton(bool visible) { mCalculateBtn->setVisible( false ); } - else - if ( !mModelPreview->isLegacyRigValid() ) - { - mCalculateBtn->setVisible( false ); - } } mUploadBtn->setVisible(!visible); -- cgit v1.2.3 From a89c58f01bac2bc0bafc69dc31eb6071b6ef8829 Mon Sep 17 00:00:00 2001 From: prep Date: Thu, 14 Jul 2011 17:18:53 -0400 Subject: Fix for SH-2061 model crashes viewer - fixed an issue where a corrupted dae would not disable the calc button --- indra/newview/llfloatermodelpreview.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 9ef5c6022e..9237f3a198 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -1396,6 +1396,8 @@ bool LLModelLoader::doLoadModel() if (!dom) { + llinfos<<" Error with dae - traditionally indicates a corrupt file."<= LLModelLoader::ERROR_PARSING ) { mFMP->childDisable("ok_btn"); + mFMP->childDisable( "calculate_btn" ); } if (lod == mPreviewLOD) -- cgit v1.2.3 From f45eb335df21bfacba3de679751627f219760283 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 20 Jul 2011 17:12:49 -0500 Subject: SH-715 Fix for bad "cancel" behavior in physics tab. --- indra/newview/llfloatermodelpreview.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 203be5bb1f..e045cf6729 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -1032,6 +1032,11 @@ void LLFloaterModelPreview::onPhysicsStageCancel(LLUICtrl* ctrl, void*data) } sInstance->mCurRequest.clear(); + + if (sInstance->mModelPreview) + { + sInstance->mModelPreview->updateStatusMessages(); + } } } @@ -4296,7 +4301,7 @@ void LLModelPreview::updateStatusMessages() //fmp->childSetEnabled("physics_optimize", !use_hull); - bool enable = phys_tris > 0 || phys_hulls > 0; + bool enable = (phys_tris > 0 || phys_hulls > 0) && fmp->mCurRequest.empty(); //enable = enable && !use_hull && fmp->childGetValue("physics_optimize").asBoolean(); //enable/disable "analysis" UI @@ -4308,7 +4313,7 @@ void LLModelPreview::updateStatusMessages() child = panel->findNextSibling(child); } - enable = phys_hulls > 0; + enable = phys_hulls > 0 && fmp->mCurRequest.empty(); //enable/disable "simplification" UI panel = fmp->getChild("physics simplification"); child = panel->getFirstChild(); @@ -4335,6 +4340,11 @@ void LLModelPreview::updateStatusMessages() fmp->childEnable("Decompose"); } } + else + { + fmp->childEnable("simplify_cancel"); + fmp->childEnable("decompose_cancel"); + } } const char* lod_controls[] = -- cgit v1.2.3 From 50b9c63382121df879680cf43f5be6fc09686607 Mon Sep 17 00:00:00 2001 From: seth_productengine Date: Fri, 22 Jul 2011 22:40:18 +0300 Subject: SH-1868 WIP Added user-supplied metric data for uploading a model. The mesh category string selected by user within the model data and sent to the server during calculating the upload fee and upload requests. The accounting info and the upload permissions warning in the bottom left corner of the floater are temporarily made mutually exclusive. --- indra/newview/llfloatermodelpreview.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index e045cf6729..6c01f0c09a 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -3098,6 +3098,7 @@ void LLModelPreview::rebuildUploadData() std::string requested_name = mFMP->getChild("description_form")->getValue().asString(); + std::string metric = mFMP->getChild("model_category_combo")->getValue().asString(); LLSpinCtrl* scale_spinner = mFMP->getChild("import_scale"); @@ -3159,6 +3160,7 @@ void LLModelPreview::rebuildUploadData() if (base_model) { base_model->mRequestedLabel = requested_name; + base_model->mMetric = metric; } S32 idx = 0; @@ -5593,6 +5595,10 @@ void LLFloaterModelPreview::onPermissionsReceived(const LLSD& result) mUploadBtn->setEnabled(mHasUploadPerm && !mUploadModelUrl.empty()); getChild("warning_title")->setVisible(!mHasUploadPerm); getChild("warning_message")->setVisible(!mHasUploadPerm); + + // Hide the accounting info if upload is not permitted. + getChild("weights_text")->setVisible(mHasUploadPerm); + getChild("weights")->setVisible(mHasUploadPerm); } void LLFloaterModelPreview::setPermissonsErrorStatus(U32 status, const std::string& reason) -- cgit v1.2.3 From 4a04458ff560b139c9adf50092a531eb0729652b Mon Sep 17 00:00:00 2001 From: prep Date: Mon, 25 Jul 2011 10:45:05 -0400 Subject: Partial fix for sh-1925. --- indra/newview/llfloatermodelpreview.cpp | 53 ++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 14 deletions(-) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index e045cf6729..5ea8dd07ff 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -1543,8 +1543,7 @@ bool LLModelLoader::doLoadModel() LLMatrix4 trans = normalized_transformation; trans *= skin_info.mBindShapeMatrix; - skin_info.mBindShapeMatrix = trans; - + skin_info.mBindShapeMatrix = trans; } @@ -1747,15 +1746,15 @@ bool LLModelLoader::doLoadModel() } } - model->mSkinInfo.mInvBindMatrix.push_back(mat); + model->mSkinInfo.mInvBindMatrix.push_back(mat); } } } } } - //Now that we've parsed the joint array, let's determine if we have a full rig - //(which means we have all the joints that are required for an avatar versus + //Now that we've parsed the jointa werray, let's determine if we have a full rig + //(which means we have all the joint sthat are required for an avatar versus //a skinned asset attached to a node in a file that contains an entire skeleton, //but does not use the skeleton). buildJointToNodeMappingFromScene( root ); @@ -2159,15 +2158,29 @@ void LLModelLoader::processJointToNodeMapping( domNode* pNode ) mJointsFromNode.push_front( pNode->getName() ); } //2. Handle the kiddo's - daeTArray< daeSmartRef > childOfChild = pNode->getChildren(); - S32 childOfChildCount = childOfChild.getCount(); - for (S32 i = 0; i < childOfChildCount; ++i) + processChildJoints( pNode ); + } + else + { + //Determine if the're any children wrt to this failed node. + //This occurs when an armature is exported and ends up being what essentially amounts to + //as the root for the visual_scene + processChildJoints( pNode ); + } +} +//----------------------------------------------------------------------------- +// processChildJoint() +//----------------------------------------------------------------------------- +void LLModelLoader::processChildJoints( domNode* pParentNode ) +{ + daeTArray< daeSmartRef > childOfChild = pParentNode->getChildren(); + S32 childOfChildCount = childOfChild.getCount(); + for (S32 i = 0; i < childOfChildCount; ++i) + { + domNode* pChildNode = daeSafeCast( childOfChild[i] ); + if ( pChildNode ) { - domNode* pChildNode = daeSafeCast( childOfChild[i] ); - if ( pChildNode ) - { - processJointToNodeMapping( pChildNode ); - } + processJointToNodeMapping( pChildNode ); } } } @@ -2353,8 +2366,20 @@ void LLModelLoader::loadTextures() //----------------------------------------------------------------------------- bool LLModelLoader::isNodeAJoint( domNode* pNode ) { - if ( !pNode || pNode->getName() == NULL) + if ( !pNode ) { + llinfos<<"Created node is NULL"<getName() == NULL ) + { + llinfos<<"Parsed node has no name "<getId() ) + { + llinfos<<"Parsed node ID: "<getId()< Date: Mon, 25 Jul 2011 17:42:22 -0400 Subject: Fix for sh-2162 --- indra/newview/llfloatermodelpreview.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 5ea8dd07ff..62b8d03281 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -4967,18 +4967,22 @@ BOOL LLModelPreview::render() if (textures) { - const std::string& binding = instance.mModel->mMaterialList[i]; - const LLImportMaterial& material = instance.mMaterial[binding]; + int materialCnt = instance.mModel->mMaterialList.size(); + if ( i < materialCnt ) + { + const std::string& binding = instance.mModel->mMaterialList[i]; + const LLImportMaterial& material = instance.mMaterial[binding]; - llassert(binding == model->mMaterialList[i]); + llassert(binding == model->mMaterialList[i]); - glColor4fv(material.mDiffuseColor.mV); - if (material.mDiffuseMap.notNull()) - { - if (material.mDiffuseMap->getDiscardLevel() > -1) + glColor4fv(material.mDiffuseColor.mV); + if (material.mDiffuseMap.notNull()) { - gGL.getTexUnit(0)->bind(material.mDiffuseMap, true); - mTextureSet.insert(material.mDiffuseMap.get()); + if (material.mDiffuseMap->getDiscardLevel() > -1) + { + gGL.getTexUnit(0)->bind(material.mDiffuseMap, true); + mTextureSet.insert(material.mDiffuseMap.get()); + } } } } -- cgit v1.2.3 From 715d9f20a7b64f5b9f52b4c363f32078f7f5e2fd Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 26 Jul 2011 18:01:31 -0500 Subject: SH-1086 Make physics shape display transparent and fix some z-fighting issues. --- indra/newview/llfloatermodelpreview.cpp | 255 +++++++++++++++++--------------- 1 file changed, 135 insertions(+), 120 deletions(-) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 62b8d03281..7844afb456 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -4891,6 +4891,8 @@ BOOL LLModelPreview::render() target_pos); // point of interest + z_near = llclamp(z_far * 0.001f, 0.001f, 0.1f); + LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, width, height, FALSE, z_near, z_far); stop_glerror(); @@ -5010,184 +5012,197 @@ BOOL LLModelPreview::render() if (physics) { glClear(GL_DEPTH_BUFFER_BIT); - LLGLEnable blend(GL_BLEND); - gGL.blendFunc(LLRender::BF_ONE, LLRender::BF_ZERO); - - for (LLMeshUploadThread::instance_list::iterator iter = mUploadData.begin(); iter != mUploadData.end(); ++iter) + + for (U32 i = 0; i < 2; i++) { - LLModelInstance& instance = *iter; + if (i == 0) + { //depth only pass + gGL.setColorMask(false, false); + } + else + { + gGL.setColorMask(true, true); + } - LLModel* model = instance.mLOD[LLModel::LOD_PHYSICS]; + //enable alpha blending on second pass but not first pass + LLGLState blend(GL_BLEND, i); + + gGL.blendFunc(LLRender::BF_SOURCE_ALPHA, LLRender::BF_ONE_MINUS_SOURCE_ALPHA); - if (!model) + for (LLMeshUploadThread::instance_list::iterator iter = mUploadData.begin(); iter != mUploadData.end(); ++iter) { - continue; - } + LLModelInstance& instance = *iter; - gGL.pushMatrix(); - LLMatrix4 mat = instance.mTransform; + LLModel* model = instance.mLOD[LLModel::LOD_PHYSICS]; - glMultMatrixf((GLfloat*) mat.mMatrix); + if (!model) + { + continue; + } + gGL.pushMatrix(); + LLMatrix4 mat = instance.mTransform; - bool render_mesh = true; + glMultMatrixf((GLfloat*) mat.mMatrix); - LLPhysicsDecomp* decomp = gMeshRepo.mDecompThread; - if (decomp) - { - LLMutexLock(decomp->mMutex); - LLModel::Decomposition& physics = model->mPhysics; + bool render_mesh = true; - if (!physics.mHull.empty()) + LLPhysicsDecomp* decomp = gMeshRepo.mDecompThread; + if (decomp) { - render_mesh = false; + LLMutexLock(decomp->mMutex); - if (physics.mMesh.empty()) - { //build vertex buffer for physics mesh - gMeshRepo.buildPhysicsMesh(physics); - } + LLModel::Decomposition& physics = model->mPhysics; + + if (!physics.mHull.empty()) + { + render_mesh = false; + + if (physics.mMesh.empty()) + { //build vertex buffer for physics mesh + gMeshRepo.buildPhysicsMesh(physics); + } - if (!physics.mMesh.empty()) - { //render hull instead of mesh - for (U32 i = 0; i < physics.mMesh.size(); ++i) - { - if (explode > 0.f) + if (!physics.mMesh.empty()) + { //render hull instead of mesh + for (U32 i = 0; i < physics.mMesh.size(); ++i) { - gGL.pushMatrix(); + if (explode > 0.f) + { + gGL.pushMatrix(); - LLVector3 offset = model->mHullCenter[i]-model->mCenterOfHullCenters; - offset *= explode; + LLVector3 offset = model->mHullCenter[i]-model->mCenterOfHullCenters; + offset *= explode; - gGL.translatef(offset.mV[0], offset.mV[1], offset.mV[2]); - } + gGL.translatef(offset.mV[0], offset.mV[1], offset.mV[2]); + } - static std::vector hull_colors; + static std::vector hull_colors; - if (i+1 >= hull_colors.size()) - { - hull_colors.push_back(LLColor4U(rand()%128+127, rand()%128+127, rand()%128+127, 255)); - } + if (i+1 >= hull_colors.size()) + { + hull_colors.push_back(LLColor4U(rand()%128+127, rand()%128+127, rand()%128+127, 128)); + } glColor4ubv(hull_colors[i].mV); - LLVertexBuffer::drawArrays(LLRender::TRIANGLES, physics.mMesh[i].mPositions, physics.mMesh[i].mNormals); + LLVertexBuffer::drawArrays(LLRender::TRIANGLES, physics.mMesh[i].mPositions, physics.mMesh[i].mNormals); - if (explode > 0.f) - { - gGL.popMatrix(); + if (explode > 0.f) + { + gGL.popMatrix(); + } } } } } - } - if (render_mesh) - { - if (mVertexBuffer[LLModel::LOD_PHYSICS].empty()) - { - genBuffers(LLModel::LOD_PHYSICS, false); - } - for (U32 i = 0; i < mVertexBuffer[LLModel::LOD_PHYSICS][model].size(); ++i) + if (render_mesh) { - LLVertexBuffer* buffer = mVertexBuffer[LLModel::LOD_PHYSICS][model][i]; - - buffer->setBuffer(type_mask & buffer->getTypeMask()); + if (mVertexBuffer[LLModel::LOD_PHYSICS].empty()) + { + genBuffers(LLModel::LOD_PHYSICS, false); + } + for (U32 i = 0; i < mVertexBuffer[LLModel::LOD_PHYSICS][model].size(); ++i) + { + LLVertexBuffer* buffer = mVertexBuffer[LLModel::LOD_PHYSICS][model][i]; - buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts()-1, buffer->getNumIndices(), 0); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - glColor4f(0.4f, 0.4f, 0.0f, 0.4f); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + glColor4f(0.4f, 0.4f, 0.0f, 0.4f); - buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts()-1, buffer->getNumIndices(), 0); + buffer->setBuffer(type_mask & buffer->getTypeMask()); + buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts()-1, buffer->getNumIndices(), 0); - glColor3f(1.f, 1.f, 0.f); + glColor3f(1.f, 1.f, 0.f); - glLineWidth(2.f); - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts()-1, buffer->getNumIndices(), 0); + glLineWidth(2.f); + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts()-1, buffer->getNumIndices(), 0); - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - glLineWidth(1.f); + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + glLineWidth(1.f); + } } - } - gGL.popMatrix(); - } - - glLineWidth(3.f); - glPointSize(8.f); - gPipeline.enableLightsFullbright(LLColor4::white); - //show degenerate triangles - LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS); - LLGLDisable cull(GL_CULL_FACE); - glColor4f(1.f,0.f,0.f,1.f); - const LLVector4a scale(0.5f); - - for (LLMeshUploadThread::instance_list::iterator iter = mUploadData.begin(); iter != mUploadData.end(); ++iter) - { - LLModelInstance& instance = *iter; + gGL.popMatrix(); + } - LLModel* model = instance.mLOD[LLModel::LOD_PHYSICS]; + glLineWidth(3.f); + glPointSize(8.f); + gPipeline.enableLightsFullbright(LLColor4::white); + //show degenerate triangles + LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS); + LLGLDisable cull(GL_CULL_FACE); + glColor4f(1.f,0.f,0.f,1.f); + const LLVector4a scale(0.5f); - if (!model) + for (LLMeshUploadThread::instance_list::iterator iter = mUploadData.begin(); iter != mUploadData.end(); ++iter) { - continue; - } + LLModelInstance& instance = *iter; - gGL.pushMatrix(); - LLMatrix4 mat = instance.mTransform; + LLModel* model = instance.mLOD[LLModel::LOD_PHYSICS]; - glMultMatrixf((GLfloat*) mat.mMatrix); + if (!model) + { + continue; + } + gGL.pushMatrix(); + LLMatrix4 mat = instance.mTransform; - LLPhysicsDecomp* decomp = gMeshRepo.mDecompThread; - if (decomp) - { - LLMutexLock(decomp->mMutex); + glMultMatrixf((GLfloat*) mat.mMatrix); - LLModel::Decomposition& physics = model->mPhysics; - if (physics.mHull.empty()) + LLPhysicsDecomp* decomp = gMeshRepo.mDecompThread; + if (decomp) { - if (mVertexBuffer[LLModel::LOD_PHYSICS].empty()) + LLMutexLock(decomp->mMutex); + + LLModel::Decomposition& physics = model->mPhysics; + + if (physics.mHull.empty()) { - genBuffers(LLModel::LOD_PHYSICS, false); - } + if (mVertexBuffer[LLModel::LOD_PHYSICS].empty()) + { + genBuffers(LLModel::LOD_PHYSICS, false); + } - for (U32 i = 0; i < mVertexBuffer[LLModel::LOD_PHYSICS][model].size(); ++i) - { - LLVertexBuffer* buffer = mVertexBuffer[LLModel::LOD_PHYSICS][model][i]; + for (U32 i = 0; i < mVertexBuffer[LLModel::LOD_PHYSICS][model].size(); ++i) + { + LLVertexBuffer* buffer = mVertexBuffer[LLModel::LOD_PHYSICS][model][i]; - buffer->setBuffer(type_mask & buffer->getTypeMask()); + buffer->setBuffer(type_mask & buffer->getTypeMask()); - LLStrider pos_strider; - buffer->getVertexStrider(pos_strider, 0); - LLVector4a* pos = (LLVector4a*) pos_strider.get(); + LLStrider pos_strider; + buffer->getVertexStrider(pos_strider, 0); + LLVector4a* pos = (LLVector4a*) pos_strider.get(); - LLStrider idx; - buffer->getIndexStrider(idx, 0); + LLStrider idx; + buffer->getIndexStrider(idx, 0); - for (U32 i = 0; i < buffer->getNumIndices(); i += 3) - { - LLVector4a v1; v1.setMul(pos[*idx++], scale); - LLVector4a v2; v2.setMul(pos[*idx++], scale); - LLVector4a v3; v3.setMul(pos[*idx++], scale); - - if (ll_is_degenerate(v1,v2,v3)) + for (U32 i = 0; i < buffer->getNumIndices(); i += 3) { - buffer->draw(LLRender::LINE_LOOP, 3, i); - buffer->draw(LLRender::POINTS, 3, i); + LLVector4a v1; v1.setMul(pos[*idx++], scale); + LLVector4a v2; v2.setMul(pos[*idx++], scale); + LLVector4a v3; v3.setMul(pos[*idx++], scale); + + if (ll_is_degenerate(v1,v2,v3)) + { + buffer->draw(LLRender::LINE_LOOP, 3, i); + buffer->draw(LLRender::POINTS, 3, i); + } } } } } - } - gGL.popMatrix(); + gGL.popMatrix(); + } + glLineWidth(1.f); + glPointSize(1.f); + gPipeline.enableLightsPreview(); + gGL.setSceneBlendType(LLRender::BT_ALPHA); } - glLineWidth(1.f); - glPointSize(1.f); - gPipeline.enableLightsPreview(); - gGL.setSceneBlendType(LLRender::BT_ALPHA); } } else -- cgit v1.2.3 From ea3d58b3141a7277870b66262ee0afb9c23c3423 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Wed, 27 Jul 2011 21:20:04 +0300 Subject: SH-1868 FIXED Rearranged the accounting info to leave enough room for the upload permissions warning. Removed hiding the accounting info when warning is displayed. --- indra/newview/llfloatermodelpreview.cpp | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 6c01f0c09a..e68a8cc84a 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -5482,10 +5482,10 @@ void LLFloaterModelPreview::toggleCalculateButton(bool visible) if (visible) { std::string tbd = getString("tbd"); - childSetTextArg("weights", "[EQ]", tbd); - childSetTextArg("weights", "[ST]", tbd); - childSetTextArg("weights", "[SIM]", tbd); - childSetTextArg("weights", "[PH]", tbd); + childSetTextArg("weights_right", "[EQ]", tbd); + childSetTextArg("weights_left", "[ST]", tbd); + childSetTextArg("weights_right", "[SIM]", tbd); + childSetTextArg("weights_left", "[PH]", tbd); childSetTextArg("upload_fee", "[FEE]", tbd); childSetTextArg("price_breakdown", "[STREAMING]", tbd); childSetTextArg("price_breakdown", "[PHYSICS]", tbd); @@ -5508,17 +5508,16 @@ void LLFloaterModelPreview::handleModelPhysicsFeeReceived() const LLSD& result = mModelPhysicsFee; mUploadModelUrl = result["url"].asString(); - childSetTextArg("weights", "[EQ]", llformat("%0.3f", result["resource_cost"].asReal())); - childSetTextArg("weights", "[ST]", llformat("%0.3f", result["model_streaming_cost"].asReal())); - childSetTextArg("weights", "[SIM]", llformat("%0.3f", result["simulation_cost"].asReal())); - childSetTextArg("weights", "[PH]", llformat("%0.3f", result["physics_cost"].asReal())); + childSetTextArg("weights_right", "[EQ]", llformat("%0.3f", result["resource_cost"].asReal())); + childSetTextArg("weights_left", "[ST]", llformat("%0.3f", result["model_streaming_cost"].asReal())); + childSetTextArg("weights_right", "[SIM]", llformat("%0.3f", result["simulation_cost"].asReal())); + childSetTextArg("weights_left", "[PH]", llformat("%0.3f", result["physics_cost"].asReal())); childSetTextArg("upload_fee", "[FEE]", llformat("%d", result["upload_price"].asInteger())); childSetTextArg("price_breakdown", "[STREAMING]", llformat("%d", result["upload_price_breakdown"]["mesh_streaming"].asInteger())); childSetTextArg("price_breakdown", "[PHYSICS]", llformat("%d", result["upload_price_breakdown"]["mesh_physics"].asInteger())); childSetTextArg("price_breakdown", "[INSTANCES]", llformat("%d", result["upload_price_breakdown"]["mesh_instance"].asInteger())); childSetTextArg("price_breakdown", "[TEXTURES]", llformat("%d", result["upload_price_breakdown"]["texture"].asInteger())); childSetTextArg("price_breakdown", "[MODEL]", llformat("%d", result["upload_price_breakdown"]["model"].asInteger())); - childSetVisible("weights", true); childSetVisible("upload_fee", true); childSetVisible("price_breakdown", true); mUploadBtn->setEnabled(mHasUploadPerm && !mUploadModelUrl.empty()); @@ -5595,10 +5594,6 @@ void LLFloaterModelPreview::onPermissionsReceived(const LLSD& result) mUploadBtn->setEnabled(mHasUploadPerm && !mUploadModelUrl.empty()); getChild("warning_title")->setVisible(!mHasUploadPerm); getChild("warning_message")->setVisible(!mHasUploadPerm); - - // Hide the accounting info if upload is not permitted. - getChild("weights_text")->setVisible(mHasUploadPerm); - getChild("weights")->setVisible(mHasUploadPerm); } void LLFloaterModelPreview::setPermissonsErrorStatus(U32 status, const std::string& reason) -- cgit v1.2.3 From 7633b3f1f1191443ae153c02d71dd968b46a2334 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 4 Aug 2011 23:42:41 -0500 Subject: SH-2201 Fix for crash when getting mesh estimates. --- indra/newview/llfloatermodelpreview.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 6e3008049f..95dcf8ba1e 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -3106,6 +3106,7 @@ U32 LLModelPreview::calcResourceCost() void LLFloaterModelPreview::setDetails(F32 x, F32 y, F32 z, F32 streaming_cost, F32 physics_cost) { + assert_main_thread(); childSetTextArg("import_dimensions", "[X]", llformat("%.3f", x)); childSetTextArg("import_dimensions", "[Y]", llformat("%.3f", y)); childSetTextArg("import_dimensions", "[Z]", llformat("%.3f", z)); @@ -5569,19 +5570,21 @@ void LLFloaterModelPreview::handleModelPhysicsFeeReceived() void LLFloaterModelPreview::setModelPhysicsFeeErrorStatus(U32 status, const std::string& reason) { - toggleCalculateButton(true); llwarns << "LLFloaterModelPreview::setModelPhysicsFeeErrorStatus(" << status << " : " << reason << ")" << llendl; + doOnIdleOneTime(boost::bind(&LLFloaterModelPreview::toggleCalculateButton, this, true)); } /*virtual*/ void LLFloaterModelPreview::onModelUploadSuccess() { + assert_main_thread(); closeFloater(false); } /*virtual*/ void LLFloaterModelPreview::onModelUploadFailure() { + assert_main_thread(); toggleCalculateButton(true); } -- cgit v1.2.3 From e384ccb5dacc8208506f8849553af66d87950f5c Mon Sep 17 00:00:00 2001 From: prep linden Date: Tue, 9 Aug 2011 16:31:36 -0400 Subject: Temporarily disallow the upload of non 1.4 dae files --- indra/newview/llfloatermodelpreview.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 95dcf8ba1e..333c0c0000 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -768,6 +768,7 @@ void LLFloaterModelPreview::draw() if ( mModelPreview->getLoadState() == LLModelLoader::ERROR_PARSING ) { childSetTextArg("status", "[STATUS]", getString("status_parse_error")); + toggleCalculateButton(false); } else { @@ -776,7 +777,7 @@ void LLFloaterModelPreview::draw() } childSetEnabled("ok_btn", mHasUploadPerm && !mUploadModelUrl.empty()); - + childSetTextArg("prim_cost", "[PRIM_COST]", llformat("%d", mModelPreview->mResourceCost)); childSetTextArg("description_label", "[TEXTURES]", llformat("%d", mModelPreview->mTextureSet.size())); @@ -1395,6 +1396,18 @@ bool LLModelLoader::doLoadModel() return false; } + //determine if this dae is a valid version. + domVersionType docVersion = dom->getVersion(); + + if ( docVersion != VERSIONTYPE_1_4_0 ) + { + llinfos<<" Error with dae - unsupported dae version "<getElementCount(NULL, COLLADA_TYPE_MESH); -- cgit v1.2.3 From 0405e91df31b7fed5d994a6d2526a1c5a5bc8c5c Mon Sep 17 00:00:00 2001 From: prep linden Date: Tue, 9 Aug 2011 17:10:17 -0400 Subject: Reports error of a non compatible dae to the log if not 1.4 --- indra/newview/llfloatermodelpreview.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 333c0c0000..3aca0f7119 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -1402,8 +1402,8 @@ bool LLModelLoader::doLoadModel() if ( docVersion != VERSIONTYPE_1_4_0 ) { llinfos<<" Error with dae - unsupported dae version "< Date: Thu, 11 Aug 2011 02:00:56 +0300 Subject: SH-2064 FIXED 'Upload' button disabled while mesh upload is in progress. --- indra/newview/llfloatermodelpreview.cpp | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 95dcf8ba1e..dd30671aaa 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -429,8 +429,6 @@ BOOL LLFloaterModelPreview::postBuild() childDisable("upload_skin"); childDisable("upload_joints"); - - childDisable("ok_btn"); mViewOptionMenuButton = getChild("options_gear_btn"); @@ -775,8 +773,6 @@ void LLFloaterModelPreview::draw() } } - childSetEnabled("ok_btn", mHasUploadPerm && !mUploadModelUrl.empty()); - childSetTextArg("prim_cost", "[PRIM_COST]", llformat("%d", mModelPreview->mResourceCost)); childSetTextArg("description_label", "[TEXTURES]", llformat("%d", mModelPreview->mTextureSet.size())); @@ -3004,14 +3000,6 @@ U32 LLModelPreview::calcResourceCost() rebuildUploadData(); - if (mFMP && mModelLoader) - { - if ( getLoadState() < LLModelLoader::ERROR_PARSING) - { - mFMP->childEnable("ok_btn"); - } - } - //Upload skin is selected BUT check to see if the joints coming in from the asset were malformed. if ( mFMP && mFMP->childGetValue("upload_skin").asBoolean() ) { @@ -3140,11 +3128,6 @@ void LLModelPreview::rebuildUploadData() F32 max_scale = 0.f; - if ( mBaseScene.size() > 0) - { - mFMP->childEnable("ok_btn"); - } - //reorder materials to match mBaseModel for (U32 i = 0; i < LLModel::NUM_LODS; i++) { @@ -4245,11 +4228,7 @@ void LLModelPreview::updateStatusMessages() } } - if ( upload_ok && !errorStateFromLoader && skinAndRigOk && !has_degenerate) - { - mFMP->childEnable("ok_btn"); - } - else + if (!upload_ok || errorStateFromLoader || !skinAndRigOk || has_degenerate) { mFMP->childDisable("ok_btn"); } @@ -5438,6 +5417,8 @@ void LLFloaterModelPreview::onUpload(void* user_data) LLFloaterModelPreview* mp = (LLFloaterModelPreview*) user_data; + mp->mUploadBtn->setEnabled(false); + mp->mModelPreview->rebuildUploadData(); bool upload_skinweights = mp->childGetValue("upload_skin").asBoolean(); @@ -5586,6 +5567,7 @@ void LLFloaterModelPreview::onModelUploadFailure() { assert_main_thread(); toggleCalculateButton(true); + mUploadBtn->setEnabled(true); } S32 LLFloaterModelPreview::DecompRequest::statusCallback(const char* status, S32 p1, S32 p2) -- cgit v1.2.3 From b2da13f46b1d5bb2977f06a6c10ec550920b17a0 Mon Sep 17 00:00:00 2001 From: prep linden Date: Wed, 10 Aug 2011 12:27:29 -0400 Subject: Joint resolver now constructed from key name (cts-660) --- indra/newview/llfloatermodelpreview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 3aca0f7119..7d34754214 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -1629,7 +1629,7 @@ bool LLModelLoader::doLoadModel() { //Build a joint for the resolver to work with char str[64]={0}; - sprintf(str,"./%s",(*jointIt).second.c_str() ); + sprintf(str,"./%s",(*jointIt).first.c_str() ); //llwarns<<"Joint "<< str < Date: Thu, 11 Aug 2011 13:19:58 -0400 Subject: Added support for parsing of collada 1.4.1 location sids --- indra/newview/llfloatermodelpreview.cpp | 60 +++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 18 deletions(-) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 195c70c5a6..737fdd4919 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -184,6 +184,13 @@ std::string lod_label_name[NUM_LOD+1] = "I went off the end of the lod_label_name array. Me so smart." }; +std::string colladaVersion[VERSIONTYPE_COUNT+1] = +{ + "1.4.0", + "1.4.1", + "Unsupported" +}; + #define LL_DEGENERACY_TOLERANCE 1e-7f @@ -1395,17 +1402,20 @@ bool LLModelLoader::doLoadModel() setLoadState( ERROR_PARSING ); return false; } - - //determine if this dae is a valid version. + //Dom version + daeString domVersion = dae.getDomVersion(); + std::string sldom(domVersion); + llinfos<<"Collada Importer Version: "<getVersion(); - - if ( docVersion != VERSIONTYPE_1_4_0 ) - { - llinfos<<" Error with dae - unsupported dae version "< 1 ) + { + docVersion = VERSIONTYPE_COUNT; + } + llinfos<<"Dae version "<( jointResolver.getElement() ); + daeSIDResolver jointResolverA( pJoint, "./translate" ); + domTranslate* pTranslateA = daeSafeCast( jointResolverA.getElement() ); + daeSIDResolver jointResolverB( pJoint, "./location" ); + domTranslate* pTranslateB = daeSafeCast( jointResolverB.getElement() ); LLMatrix4 workingTransform; //Translation via SID - if ( pTranslate ) + if ( pTranslateA ) + { + extractTranslation( pTranslateA, workingTransform ); + } + else + if ( pTranslateB ) { - extractTranslation( pTranslate, workingTransform ); + extractTranslation( pTranslateB, workingTransform ); } else { @@ -2525,13 +2542,20 @@ void LLModelLoader::processJointNode( domNode* pNode, JointTransformMap& jointTr LLMatrix4 workingTransform; //Pull out the translate id and store it in the jointTranslations map - daeSIDResolver jointResolver( pNode, "./translate" ); - domTranslate* pTranslate = daeSafeCast( jointResolver.getElement() ); + daeSIDResolver jointResolverA( pNode, "./translate" ); + domTranslate* pTranslateA = daeSafeCast( jointResolverA.getElement() ); + daeSIDResolver jointResolverB( pNode, "./location" ); + domTranslate* pTranslateB = daeSafeCast( jointResolverB.getElement() ); //Translation via SID was successful - if ( pTranslate ) + if ( pTranslateA ) + { + extractTranslation( pTranslateA, workingTransform ); + } + else + if ( pTranslateB ) { - extractTranslation( pTranslate, workingTransform ); + extractTranslation( pTranslateB, workingTransform ); } else { -- cgit v1.2.3 From 2d24203e5912bc6a9c8fa0e5c44cfe0711cb121a Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 15 Aug 2011 16:59:46 -0400 Subject: SH-2029 FIX - persist the model name in SLM --- indra/newview/llfloatermodelpreview.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 737fdd4919..6783d3d1dc 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -106,7 +106,7 @@ #include -const S32 SLM_SUPPORTED_VERSION = 2; +const S32 SLM_SUPPORTED_VERSION = 3; //static S32 LLFloaterModelPreview::sUploadAmount = 10; @@ -2076,6 +2076,14 @@ bool LLModelLoader::loadFromSLM(const std::string& filename) return false; } + // Set name. + std::string name = data["name"]; + if (!name.empty()) + { + model[LLModel::LOD_HIGH][0]->mLabel = data["name"]; + } + + //load instance list model_instance_list instance_list; @@ -3295,6 +3303,10 @@ void LLModelPreview::saveUploadData(const std::string& filename, bool save_skinw LLSD data; data["version"] = SLM_SUPPORTED_VERSION; + if (!mBaseModel.empty()) + { + data["name"] = mBaseModel[0]->getName(); + } S32 mesh_id = 0; -- cgit v1.2.3 From 0301feb80bbf23d65cfd1ddbe22f297c3ff61a48 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 15 Aug 2011 18:54:35 -0400 Subject: SH-2029 FIX - fix for mac build error, hopefully --- indra/newview/llfloatermodelpreview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 6783d3d1dc..0ce8dcd46b 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -2080,7 +2080,7 @@ bool LLModelLoader::loadFromSLM(const std::string& filename) std::string name = data["name"]; if (!name.empty()) { - model[LLModel::LOD_HIGH][0]->mLabel = data["name"]; + model[LLModel::LOD_HIGH][0]->mLabel = name; } -- cgit v1.2.3 From 1d4ccaeb74641ebf199072c8568e26f8fe002d32 Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Wed, 17 Aug 2011 16:29:20 +0300 Subject: SH-2285 FIXED Add localization capability to mesh uploader strings - Added the convex decomposition strings to the strings.xml - Added names to hardcoded strings. --- indra/newview/llfloatermodelpreview.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index c8f4c3ac36..609fb42cc6 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -96,6 +96,7 @@ #include "llsliderctrl.h" #include "llspinctrl.h" #include "lltoggleablemenu.h" +#include "lltrans.h" #include "llvfile.h" #include "llvfs.h" #include "llcallbacklist.h" @@ -1154,7 +1155,11 @@ void LLFloaterModelPreview::initDecompControls() //llinfos << param[i].mDetails.mEnumValues.mEnumsArray[k].mValue // << " - " << param[i].mDetails.mEnumValues.mEnumsArray[k].mName << llendl; - combo_box->add(param[i].mDetails.mEnumValues.mEnumsArray[k].mName, + std::string name(param[i].mDetails.mEnumValues.mEnumsArray[k].mName); + std::string localized_name; + bool is_localized = LLTrans::findString(localized_name, name); + + combo_box->add(is_localized ? localized_name : name, LLSD::Integer(param[i].mDetails.mEnumValues.mEnumsArray[k].mValue)); } combo_box->setValue(param[i].mDefault.mIntOrEnumValue); -- cgit v1.2.3 From e0bf0e3e2150304e7b26c18c274273c18653965b Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 17 Aug 2011 14:59:22 -0500 Subject: SH-2217 Fix for large models not getting properly clampled by importer (odd that server seems to need 240m limit instead of 256m limit) --- indra/newview/llfloatermodelpreview.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 0ce8dcd46b..0c8fd33113 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -3173,11 +3173,6 @@ void LLModelPreview::rebuildUploadData() LLSpinCtrl* scale_spinner = mFMP->getChild("import_scale"); - if (!scale_spinner) - { - llerrs << "floater_model_preview.xml MUST contain import_scale spinner." << llendl; - } - F32 scale = scale_spinner->getValue().asReal(); LLMatrix4 scale_mat; @@ -3262,7 +3257,14 @@ void LLModelPreview::rebuildUploadData() } } - F32 max_import_scale = DEFAULT_MAX_PRIM_SCALE/max_scale; + F32 max_import_scale = (DEFAULT_MAX_PRIM_SCALE-0.1f)/max_scale; + + F32 max_axis = llmax(mPreviewScale.mV[0], mPreviewScale.mV[1]); + max_axis = llmax(max_axis, mPreviewScale.mV[2]); + max_axis *= 2.f; + + //clamp scale so that total imported model bounding box is smaller than 240m on a side + max_import_scale = llmin(max_import_scale, 240.f/max_axis); scale_spinner->setMaxValue(max_import_scale); -- cgit v1.2.3 From 1b36b0425119ce1e96eeeb87af7f150a206e62b0 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 18 Aug 2011 14:41:34 -0500 Subject: SH-1180 Log which nodes are problematic when loading a .dae with mirrored meshes and report error. --- indra/newview/llfloatermodelpreview.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 0c8fd33113..d55849d2fb 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -2705,6 +2705,12 @@ void LLModelLoader::processElement( daeElement* element, bool& badElement ) { LLMatrix4 transformation = mTransform; + if (mTransform.determinant() < 0) + { //negative scales are not supported + llinfos << "Negative scale detected, unsupported transform. domInstance_geometry: " << LLModel::getElementLabel(instance_geo) << llendl; + badElement = true; + } + std::map materials = getMaterials(model, instance_geo); // adjust the transformation to compensate for mesh normalization -- cgit v1.2.3 From 716d2bd2e4a2d556e98a1ac50262a01b5244d442 Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Wed, 24 Aug 2011 14:57:19 +0300 Subject: SH-2309 WIP Priority modifications to mesh uploader UI - Arranged all controls of the floater (according to the last version of the mockup) except for the tab container content. --- indra/newview/llfloatermodelpreview.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index b1b5e69968..acc8a9b213 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -5570,10 +5570,10 @@ void LLFloaterModelPreview::toggleCalculateButton(bool visible) if (visible) { std::string tbd = getString("tbd"); - childSetTextArg("weights_right", "[EQ]", tbd); - childSetTextArg("weights_left", "[ST]", tbd); - childSetTextArg("weights_right", "[SIM]", tbd); - childSetTextArg("weights_left", "[PH]", tbd); + childSetTextArg("prim_weight", "[EQ]", tbd); + childSetTextArg("download_weight", "[ST]", tbd); + childSetTextArg("server_weight", "[SIM]", tbd); + childSetTextArg("physics_weight", "[PH]", tbd); childSetTextArg("upload_fee", "[FEE]", tbd); childSetTextArg("price_breakdown", "[STREAMING]", tbd); childSetTextArg("price_breakdown", "[PHYSICS]", tbd); @@ -5596,10 +5596,10 @@ void LLFloaterModelPreview::handleModelPhysicsFeeReceived() const LLSD& result = mModelPhysicsFee; mUploadModelUrl = result["url"].asString(); - childSetTextArg("weights_right", "[EQ]", llformat("%0.3f", result["resource_cost"].asReal())); - childSetTextArg("weights_left", "[ST]", llformat("%0.3f", result["model_streaming_cost"].asReal())); - childSetTextArg("weights_right", "[SIM]", llformat("%0.3f", result["simulation_cost"].asReal())); - childSetTextArg("weights_left", "[PH]", llformat("%0.3f", result["physics_cost"].asReal())); + childSetTextArg("prim_weight", "[EQ]", llformat("%0.3f", result["resource_cost"].asReal())); + childSetTextArg("download_weight", "[ST]", llformat("%0.3f", result["model_streaming_cost"].asReal())); + childSetTextArg("server_weight", "[SIM]", llformat("%0.3f", result["simulation_cost"].asReal())); + childSetTextArg("physics_weight", "[PH]", llformat("%0.3f", result["physics_cost"].asReal())); childSetTextArg("upload_fee", "[FEE]", llformat("%d", result["upload_price"].asInteger())); childSetTextArg("price_breakdown", "[STREAMING]", llformat("%d", result["upload_price_breakdown"]["mesh_streaming"].asInteger())); childSetTextArg("price_breakdown", "[PHYSICS]", llformat("%d", result["upload_price_breakdown"]["mesh_physics"].asInteger())); -- cgit v1.2.3 From 124e4d587491668354cd9910cea07d299464108e Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Thu, 25 Aug 2011 21:33:10 +0300 Subject: SH-2309 WIP Priority modifications to mesh uploader UI - Updated upload floater according to the UI spec - Updated Modifiers panel according to the UI spec --- indra/newview/llfloatermodelpreview.cpp | 39 ++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 15 deletions(-) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index acc8a9b213..dd652b32a7 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -435,20 +435,15 @@ BOOL LLFloaterModelPreview::postBuild() //childSetCommitCallback("physics_optimize", refresh, this); //childSetCommitCallback("physics_use_hull", refresh, this); + getChild("show_edges")->setCommitCallback(boost::bind(&LLFloaterModelPreview::onViewOptionChecked, this, _1)); + getChild("show_physics")->setCommitCallback(boost::bind(&LLFloaterModelPreview::onViewOptionChecked, this, _1)); + getChild("show_textures")->setCommitCallback(boost::bind(&LLFloaterModelPreview::onViewOptionChecked, this, _1)); + getChild("show_skin_weight")->setCommitCallback(boost::bind(&LLFloaterModelPreview::onViewOptionChecked, this, _1)); + getChild("show_joint_positions")->setCommitCallback(boost::bind(&LLFloaterModelPreview::onViewOptionChecked, this, _1)); + childDisable("upload_skin"); childDisable("upload_joints"); - mViewOptionMenuButton = getChild("options_gear_btn"); - - mCommitCallbackRegistrar.add("ModelImport.ViewOption.Action", boost::bind(&LLFloaterModelPreview::onViewOptionChecked, this, _2)); - mEnableCallbackRegistrar.add("ModelImport.ViewOption.Check", boost::bind(&LLFloaterModelPreview::isViewOptionChecked, this, _2)); - mEnableCallbackRegistrar.add("ModelImport.ViewOption.Enabled", boost::bind(&LLFloaterModelPreview::isViewOptionEnabled, this, _2)); - - - - mViewOptionMenu = LLUICtrlFactory::getInstance()->createFromFile("menu_model_import_gear_default.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); - mViewOptionMenuButton->setMenu(mViewOptionMenu, LLMenuButton::MP_BOTTOM_LEFT); - initDecompControls(); LLView* preview_panel = getChild("preview_panel"); @@ -541,11 +536,11 @@ void LLFloaterModelPreview::initModelPreview() mModelPreview->setModelUpdatedCallback(boost::bind(&LLFloaterModelPreview::toggleCalculateButton, this, _1)); } -void LLFloaterModelPreview::onViewOptionChecked(const LLSD& userdata) +void LLFloaterModelPreview::onViewOptionChecked(LLUICtrl* ctrl) { if (mModelPreview) { - mModelPreview->mViewOption[userdata.asString()] = !mModelPreview->mViewOption[userdata.asString()]; + mModelPreview->mViewOption[ctrl->getName()] = !mModelPreview->mViewOption[ctrl->getName()]; mModelPreview->refresh(); } @@ -563,12 +558,12 @@ bool LLFloaterModelPreview::isViewOptionChecked(const LLSD& userdata) bool LLFloaterModelPreview::isViewOptionEnabled(const LLSD& userdata) { - return !mViewOptionDisabled[userdata.asString()]; + return childIsEnabled(userdata.asString()); } void LLFloaterModelPreview::setViewOptionEnabled(const std::string& option, bool enabled) { - mViewOptionDisabled[option] = !enabled; + childSetEnabled(option, enabled); } void LLFloaterModelPreview::enableViewOption(const std::string& option) @@ -4357,12 +4352,14 @@ void LLModelPreview::updateStatusMessages() { fmp->enableViewOption("show_physics"); mViewOption["show_physics"] = true; + fmp->childSetValue("show_physics", true); } } else { fmp->disableViewOption("show_physics"); mViewOption["show_physics"] = false; + fmp->childSetValue("show_physics", false); } @@ -5465,6 +5462,7 @@ void LLFloaterModelPreview::onReset(void* user_data) LLModelPreview* mp = fmp->mModelPreview; std::string filename = mp->mLODFile[3]; + fmp->resetDisplayOptions(); //reset model preview fmp->initModelPreview(); @@ -5583,6 +5581,17 @@ void LLFloaterModelPreview::toggleCalculateButton(bool visible) } } +void LLFloaterModelPreview::resetDisplayOptions() +{ + std::map::iterator option_it = mModelPreview->mViewOption.begin(); + + for(;option_it != mModelPreview->mViewOption.end(); ++option_it) + { + LLUICtrl* ctrl = getChild(option_it->first); + ctrl->setValue(false); + } +} + void LLFloaterModelPreview::onModelPhysicsFeeReceived(const LLSD& result, std::string upload_url) { mModelPhysicsFee = result; -- cgit v1.2.3 From 71ac45a28b238bac4ac0cf43ee85f04589ffa116 Mon Sep 17 00:00:00 2001 From: prep linden Date: Tue, 30 Aug 2011 09:32:16 -0400 Subject: Handling of material mismatches - lod materials are required to be a subset of the high lod, introduced addEmptyFace() for when parity does not exist between model material counts --- indra/newview/llfloatermodelpreview.cpp | 57 +++++++++++++++++++++++++++++---- 1 file changed, 51 insertions(+), 6 deletions(-) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index b1b5e69968..80db002f0e 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -3186,8 +3186,14 @@ void LLModelPreview::rebuildUploadData() { for (U32 j = 0; j < mBaseModel.size(); ++j) { - mModel[i][j]->matchMaterialOrder(mBaseModel[j]); - llassert(mModel[i][j]->mMaterialList == mBaseModel[j]->mMaterialList); + + int refFaceCnt = 0; + int modelFaceCnt = 0; + + if ( !mModel[i][j]->matchMaterialOrder(mBaseModel[j], refFaceCnt, modelFaceCnt ) ) + { + mFMP->childDisable( "calculate_btn" ); + } } } } @@ -4765,6 +4771,42 @@ void LLModelPreview::createPreviewAvatar( void ) } } +void LLModelPreview::addEmptyFace( LLModel* pTarget ) +{ + U32 type_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD0; + + LLPointer buff = new LLVertexBuffer(type_mask, 0); + + buff->allocateBuffer(1, 3, true); + memset( buff->getMappedData(), 0, buff->getSize() ); + memset( buff->getIndicesPointer(), 0, buff->getIndicesSize() ); + + buff->validateRange( 0, buff->getNumVerts()-1, buff->getNumIndices(), 0 ); + + LLStrider pos; + LLStrider norm; + LLStrider tc; + LLStrider index; + + buff->getVertexStrider(pos); + + if ( type_mask & LLVertexBuffer::MAP_NORMAL ) + { + buff->getNormalStrider(norm); + } + if ( type_mask & LLVertexBuffer::MAP_TEXCOORD0 ) + { + buff->getTexCoord0Strider(tc); + } + + buff->getIndexStrider(index); + + //resize face array + int faceCnt = pTarget->getNumVolumeFaces(); + pTarget->setNumVolumeFaces( faceCnt+1 ); + pTarget->setVolumeFaceData( faceCnt+1, pos, norm, tc, index, buff->getNumVerts(), buff->getNumIndices() ); + +} //----------------------------------------------------------------------------- // render() //----------------------------------------------------------------------------- @@ -4976,8 +5018,13 @@ BOOL LLModelPreview::render() { for (U32 j = 0; j < mBaseModel.size(); ++j) { - mModel[i][j]->matchMaterialOrder(mBaseModel[j]); - llassert(mModel[i][j]->mMaterialList == mBaseModel[j]->mMaterialList); + int refFaceCnt = 0; + int modelFaceCnt = 0; + + if ( !mModel[i][j]->matchMaterialOrder(mBaseModel[j], refFaceCnt, modelFaceCnt ) ) + { + mFMP->childDisable( "calculate_btn" ); + } } } } @@ -5019,8 +5066,6 @@ BOOL LLModelPreview::render() const std::string& binding = instance.mModel->mMaterialList[i]; const LLImportMaterial& material = instance.mMaterial[binding]; - llassert(binding == model->mMaterialList[i]); - glColor4fv(material.mDiffuseColor.mV); if (material.mDiffuseMap.notNull()) { -- cgit v1.2.3 From 5e5869c63a05e3d773fc4d19deaff171efa5014c Mon Sep 17 00:00:00 2001 From: prep linden Date: Tue, 30 Aug 2011 14:59:52 -0400 Subject: Fix for Sh-2350 --- indra/newview/llfloatermodelpreview.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 80db002f0e..0f0f593749 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -2204,7 +2204,15 @@ void LLModelLoader::processJointToNodeMapping( domNode* pNode ) //Determine if the're any children wrt to this failed node. //This occurs when an armature is exported and ends up being what essentially amounts to //as the root for the visual_scene - processChildJoints( pNode ); + if ( pNode ) + { + processChildJoints( pNode ); + } + else + { + llinfos<<"Node is NULL"< Date: Wed, 31 Aug 2011 17:02:15 +0300 Subject: SH-2309 WIP Priority modifications to mesh uploader UI Made next changes according to the last version of UI spec: - Modified Upload Options tab - Modified Physics tab - Modified the floater overall --- indra/newview/llfloatermodelpreview.cpp | 100 +++++++++++++++++++------------- 1 file changed, 60 insertions(+), 40 deletions(-) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index dd652b32a7..276f513abf 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -431,7 +431,6 @@ BOOL LLFloaterModelPreview::postBuild() childSetCommitCallback("pelvis_offset", onPelvisOffsetCommit, this); childSetCommitCallback("lod_file_or_limit", refresh, this); - childSetCommitCallback("physics_load_radio", onPhysicsLoadRadioCommit, this); //childSetCommitCallback("physics_optimize", refresh, this); //childSetCommitCallback("physics_use_hull", refresh, this); @@ -640,29 +639,6 @@ void LLFloaterModelPreview::onPelvisOffsetCommit( LLUICtrl*, void* userdata ) fp->mModelPreview->refresh(); } -//static -void LLFloaterModelPreview::onPhysicsLoadRadioCommit( LLUICtrl*, void *userdata) -{ - LLFloaterModelPreview* fmp = LLFloaterModelPreview::sInstance; - if (fmp) - { - if (fmp->childGetValue("physics_use_lod").asBoolean()) - { - onPhysicsUseLOD(NULL,NULL); - } - if (fmp->childGetValue("physics_load_from_file").asBoolean()) - { - - } - LLModelPreview *model_preview = fmp->mModelPreview; - if (model_preview) - { - model_preview->refresh(); - model_preview->updateStatusMessages(); - } - } -} - //static void LLFloaterModelPreview::onUploadJointsCommit(LLUICtrl*,void* userdata) { @@ -935,16 +911,20 @@ void LLFloaterModelPreview::onPhysicsParamCommit(LLUICtrl* ctrl, void* data) if (name == "Simplify Method") { - if (ctrl->getValue().asInteger() == 0) - { - sInstance->childSetVisible("Retain%", true); - sInstance->childSetVisible("Detail Scale", false); - } - else + bool show_retain = false; + bool show_detail = true; + + if (ctrl->getValue().asInteger() == 0) { - sInstance->childSetVisible("Retain%", false); - sInstance->childSetVisible("Detail Scale", true); + show_retain = true; + show_detail = false; } + + sInstance->childSetVisible("Retain%", show_retain); + sInstance->childSetVisible("Retain%_label", show_retain); + + sInstance->childSetVisible("Detail Scale", show_detail); + sInstance->childSetVisible("Detail Scale label", show_detail); } } } @@ -1001,13 +981,35 @@ void LLFloaterModelPreview::onPhysicsBrowse(LLUICtrl* ctrl, void* userdata) void LLFloaterModelPreview::onPhysicsUseLOD(LLUICtrl* ctrl, void* userdata) { S32 which_mode = 3; + static S32 previous_mode = which_mode; + LLCtrlSelectionInterface* iface = sInstance->childGetSelectionInterface("physics_lod_combo"); if (iface) { which_mode = iface->getFirstSelectedIndex(); } - sInstance->mModelPreview->setPhysicsFromLOD(which_mode); + S32 file_mode = iface->getItemCount() - 1; + bool file_browse = which_mode == file_mode; + bool lod_to_file = file_browse && (previous_mode != file_mode); + bool file_to_lod = !file_browse && (previous_mode == file_mode); + + if (!lod_to_file) + { + sInstance->mModelPreview->setPhysicsFromLOD(which_mode); + } + + if (lod_to_file || file_to_lod) + { + LLModelPreview *model_preview = sInstance->mModelPreview; + if (model_preview) + { + model_preview->refresh(); + model_preview->updateStatusMessages(); + } + } + + previous_mode = which_mode; } //static @@ -1099,8 +1101,9 @@ void LLFloaterModelPreview::initDecompControls() mDecompParams[param[i].mName] = LLSD(param[i].mDefault.mFloat); //llinfos << "Type: float, Default: " << param[i].mDefault.mFloat << llendl; - LLSliderCtrl* slider = getChild(name); - if (slider) + + LLUICtrl* ctrl = getChild(name); + if (LLSliderCtrl* slider = dynamic_cast(ctrl)) { slider->setMinValue(param[i].mDetails.mRange.mLow.mFloat); slider->setMaxValue(param[i].mDetails.mRange.mHigh.mFloat); @@ -1108,14 +1111,23 @@ void LLFloaterModelPreview::initDecompControls() slider->setValue(param[i].mDefault.mFloat); slider->setCommitCallback(onPhysicsParamCommit, (void*) ¶m[i]); } + else if (LLSpinCtrl* spinner = dynamic_cast(ctrl)) + { + spinner->setMinValue(param[i].mDetails.mRange.mLow.mFloat); + spinner->setMaxValue(param[i].mDetails.mRange.mHigh.mFloat); + spinner->setIncrement(param[i].mDetails.mRange.mDelta.mFloat); + spinner->setValue(param[i].mDefault.mFloat); + spinner->setCommitCallback(onPhysicsParamCommit, (void*) ¶m[i]); + } } else if (param[i].mType == LLCDParam::LLCD_INTEGER) { mDecompParams[param[i].mName] = LLSD(param[i].mDefault.mIntOrEnumValue); //llinfos << "Type: integer, Default: " << param[i].mDefault.mIntOrEnumValue << llendl; - LLSliderCtrl* slider = getChild(name); - if (slider) + + LLUICtrl* ctrl = getChild(name); + if (LLSliderCtrl* slider = dynamic_cast(ctrl)) { slider->setMinValue(param[i].mDetails.mRange.mLow.mIntOrEnumValue); slider->setMaxValue(param[i].mDetails.mRange.mHigh.mIntOrEnumValue); @@ -1123,6 +1135,16 @@ void LLFloaterModelPreview::initDecompControls() slider->setValue(param[i].mDefault.mIntOrEnumValue); slider->setCommitCallback(onPhysicsParamCommit, (void*) ¶m[i]); } + else if (LLComboBox* combo_box = dynamic_cast(ctrl)) + { + for(int k = param[i].mDetails.mRange.mLow.mIntOrEnumValue; k<=param[i].mDetails.mRange.mHigh.mIntOrEnumValue; k+=param[i].mDetails.mRange.mDelta.mIntOrEnumValue) + { + std::string name = llformat("%.1d", k); + combo_box->add(name, k, ADD_BOTTOM, true); + } + combo_box->setValue(param[i].mDefault.mIntOrEnumValue); + combo_box->setCommitCallback(onPhysicsParamCommit, (void*) ¶m[i]); + } } else if (param[i].mType == LLCDParam::LLCD_BOOLEAN) { @@ -4528,15 +4550,13 @@ void LLModelPreview::updateStatusMessages() } } - if (mFMP->childGetValue("physics_load_from_file").asBoolean()) + if (mFMP->childGetValue("physics_lod_combo").asString() == "From file") { - mFMP->childDisable("physics_lod_combo"); mFMP->childEnable("physics_file"); mFMP->childEnable("physics_browse"); } else { - mFMP->childEnable("physics_lod_combo"); mFMP->childDisable("physics_file"); mFMP->childDisable("physics_browse"); } -- cgit v1.2.3 From 004de653aa3aa2702c7532d2ff5ce9838636d4ca Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Thu, 1 Sep 2011 19:01:46 +0300 Subject: SH-2309 WIP Priority modifications to mesh uploader UI - Bind "Cosine%" param with "Smooth" combo box. - Corrected some wording. - Little UI polish. Line with results in Physics tab. - Changed ordering of LOD combo box items. --- indra/newview/llfloatermodelpreview.cpp | 42 +++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 276f513abf..362a40632a 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -980,6 +980,7 @@ void LLFloaterModelPreview::onPhysicsBrowse(LLUICtrl* ctrl, void* userdata) //static void LLFloaterModelPreview::onPhysicsUseLOD(LLUICtrl* ctrl, void* userdata) { + S32 num_modes = 3; S32 which_mode = 3; static S32 previous_mode = which_mode; @@ -996,6 +997,7 @@ void LLFloaterModelPreview::onPhysicsUseLOD(LLUICtrl* ctrl, void* userdata) if (!lod_to_file) { + which_mode = num_modes - which_mode; sInstance->mModelPreview->setPhysicsFromLOD(which_mode); } @@ -1119,6 +1121,29 @@ void LLFloaterModelPreview::initDecompControls() spinner->setValue(param[i].mDefault.mFloat); spinner->setCommitCallback(onPhysicsParamCommit, (void*) ¶m[i]); } + else if (LLComboBox* combo_box = dynamic_cast(ctrl)) + { + float min = param[i].mDetails.mRange.mLow.mFloat; + float max = param[i].mDetails.mRange.mHigh.mFloat; + float delta = param[i].mDetails.mRange.mDelta.mFloat; + + if ("Cosine%" == name) + { + createSmoothComboBox(combo_box, min, max); + } + else + { + for(float value = min; value <= max; value += delta) + { + std::string label = llformat("%.1f", value); + combo_box->add(label, value, ADD_BOTTOM, true); + } + combo_box->setValue(param[i].mDefault.mFloat); + + } + + combo_box->setCommitCallback(onPhysicsParamCommit, (void*) ¶m[i]); + } } else if (param[i].mType == LLCDParam::LLCD_INTEGER) { @@ -1192,6 +1217,23 @@ void LLFloaterModelPreview::initDecompControls() childSetCommitCallback("physics_explode", LLFloaterModelPreview::onExplodeCommit, this); } +void LLFloaterModelPreview::createSmoothComboBox(LLComboBox* combo_box, float min, float max) +{ + float combo_list_size = 10; + float delta = (max - min) / combo_list_size; + int ilabel = 0; + + combo_box->add("0 (none)", ADD_BOTTOM, true); + + for(float value = min + delta; value < max; value += delta) + { + std::string label = (++ilabel == combo_list_size) ? "10 (max)" : llformat("%.1d", ilabel); + combo_box->add(label, value, ADD_BOTTOM, true); + } + + +} + //----------------------------------------------------------------------------- // onMouseCaptureLost() //----------------------------------------------------------------------------- -- cgit v1.2.3 From 5da2d4c85370ebe1a14ecbebd8e5df7965e9d02e Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Fri, 2 Sep 2011 17:14:07 +0300 Subject: SH-2309 WIP Priority modifications to mesh uploader UI - Changed representation of Retain% control values - Added "Choose one..." item to the LOD combo_box --- indra/newview/llfloatermodelpreview.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 362a40632a..2d18c2bb24 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -119,6 +119,7 @@ const S32 PREVIEW_RESIZE_HANDLE_SIZE = S32(RESIZE_HANDLE_WIDTH * OO_SQRT2) + PRE const S32 PREVIEW_HPAD = PREVIEW_RESIZE_HANDLE_SIZE; const S32 PREF_BUTTON_HEIGHT = 16 + 7 + 16; const S32 PREVIEW_TEXTURE_HEIGHT = 300; +const double RETAIN_COEFFICIENT = 100; void drawBoxOutline(const LLVector3& pos, const LLVector3& size); @@ -907,7 +908,15 @@ void LLFloaterModelPreview::onPhysicsParamCommit(LLUICtrl* ctrl, void* data) { LLCDParam* param = (LLCDParam*) data; std::string name(param->mName); - sInstance->mDecompParams[name] = ctrl->getValue(); + + LLSD value = ctrl->getValue(); + + if("Retain%" == name) + { + value = ctrl->getValue().asReal() / RETAIN_COEFFICIENT; + } + + sInstance->mDecompParams[name] = value; if (name == "Simplify Method") { @@ -980,7 +989,7 @@ void LLFloaterModelPreview::onPhysicsBrowse(LLUICtrl* ctrl, void* userdata) //static void LLFloaterModelPreview::onPhysicsUseLOD(LLUICtrl* ctrl, void* userdata) { - S32 num_modes = 3; + S32 num_modes = 4; S32 which_mode = 3; static S32 previous_mode = which_mode; @@ -1115,10 +1124,13 @@ void LLFloaterModelPreview::initDecompControls() } else if (LLSpinCtrl* spinner = dynamic_cast(ctrl)) { - spinner->setMinValue(param[i].mDetails.mRange.mLow.mFloat); - spinner->setMaxValue(param[i].mDetails.mRange.mHigh.mFloat); - spinner->setIncrement(param[i].mDetails.mRange.mDelta.mFloat); - spinner->setValue(param[i].mDefault.mFloat); + bool is_retain_ctrl = "Retain%" == name; + double coefficient = is_retain_ctrl ? RETAIN_COEFFICIENT : 1.f; + + spinner->setMinValue(param[i].mDetails.mRange.mLow.mFloat * coefficient); + spinner->setMaxValue(param[i].mDetails.mRange.mHigh.mFloat * coefficient); + spinner->setIncrement(param[i].mDetails.mRange.mDelta.mFloat * coefficient); + spinner->setValue(param[i].mDefault.mFloat * coefficient); spinner->setCommitCallback(onPhysicsParamCommit, (void*) ¶m[i]); } else if (LLComboBox* combo_box = dynamic_cast(ctrl)) -- cgit v1.2.3 From 028c34e0ffd69eeb99f21f8c0bb9b612bd820b10 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Fri, 2 Sep 2011 17:36:54 +0300 Subject: SH-2309 Model preview floater LoD tab updated. - Combo boxes for LoD source added for each level - New option "Use LoD above" added for copying the model from higher LoDs. - Various LoD settings and related controls removed. --- indra/newview/llfloatermodelpreview.cpp | 389 ++++++++++++-------------------- 1 file changed, 139 insertions(+), 250 deletions(-) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 2d18c2bb24..e687b1954c 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -396,21 +396,23 @@ BOOL LLFloaterModelPreview::postBuild() return FALSE; } - childSetAction("lod_browse", onBrowseLOD, this); - childSetCommitCallback("cancel_btn", onCancel, this); childSetCommitCallback("crease_angle", onGenerateNormalsCommit, this); - childSetCommitCallback("generate_normals", onGenerateNormalsCommit, this); + getChild("gen_normals")->setCommitCallback(boost::bind(&LLFloaterModelPreview::toggleGenarateNormals, this)); childSetCommitCallback("lod_generate", onAutoFillCommit, this); - childSetCommitCallback("lod_mode", onLODParamCommit, this); - childSetCommitCallback("lod_error_threshold", onLODParamCommit, this); - childSetCommitCallback("lod_triangle_limit", onLODParamCommitTriangleLimit, this); - childSetCommitCallback("build_operator", onLODParamCommit, this); - childSetCommitCallback("queue_mode", onLODParamCommit, this); - childSetCommitCallback("border_mode", onLODParamCommit, this); - childSetCommitCallback("share_tolerance", onLODParamCommit, this); + for (S32 lod = 0; lod <= LLModel::LOD_HIGH; ++lod) + { + LLComboBox* lod_source_combo = getChild("lod_source_" + lod_name[lod]); + lod_source_combo->setCommitCallback(boost::bind(&LLFloaterModelPreview::onLoDSourceCommit, this, lod)); + lod_source_combo->setCurrentByIndex(mLODMode[lod]); + + getChild("lod_browse_" + lod_name[lod])->setCommitCallback(boost::bind(&LLFloaterModelPreview::onBrowseLOD, this, lod)); + getChild("lod_mode_" + lod_name[lod])->setCommitCallback(boost::bind(&LLFloaterModelPreview::onLODParamCommit, this, lod, false)); + getChild("lod_error_threshold_" + lod_name[lod])->setCommitCallback(boost::bind(&LLFloaterModelPreview::onLODParamCommit, this, lod, false)); + getChild("lod_triangle_limit_" + lod_name[lod])->setCommitCallback(boost::bind(&LLFloaterModelPreview::onLODParamCommit, this, lod, true)); + } childSetCommitCallback("upload_skin", boost::bind(&LLFloaterModelPreview::toggleCalculateButton, this), NULL); childSetCommitCallback("upload_joints", boost::bind(&LLFloaterModelPreview::toggleCalculateButton, this), NULL); @@ -431,10 +433,6 @@ BOOL LLFloaterModelPreview::postBuild() childSetCommitCallback("import_scale", onImportScaleCommit, this); childSetCommitCallback("pelvis_offset", onPelvisOffsetCommit, this); - childSetCommitCallback("lod_file_or_limit", refresh, this); - //childSetCommitCallback("physics_optimize", refresh, this); - //childSetCommitCallback("physics_use_hull", refresh, this); - getChild("show_edges")->setCommitCallback(boost::bind(&LLFloaterModelPreview::onViewOptionChecked, this, _1)); getChild("show_physics")->setCommitCallback(boost::bind(&LLFloaterModelPreview::onViewOptionChecked, this, _1)); getChild("show_textures")->setCommitCallback(boost::bind(&LLFloaterModelPreview::onViewOptionChecked, this, _1)); @@ -694,6 +692,12 @@ void LLFloaterModelPreview::onGenerateNormalsCommit(LLUICtrl* ctrl, void* userda fp->mModelPreview->generateNormals(); } +void LLFloaterModelPreview::toggleGenarateNormals() +{ + bool enabled = childGetValue("gen_normals").asBoolean(); + childSetEnabled("crease_angle", enabled); +} + //static void LLFloaterModelPreview::onExplodeCommit(LLUICtrl* ctrl, void* userdata) { @@ -710,19 +714,9 @@ void LLFloaterModelPreview::onAutoFillCommit(LLUICtrl* ctrl, void* userdata) fp->mModelPreview->genLODs(); } -//static -void LLFloaterModelPreview::onLODParamCommit(LLUICtrl* ctrl, void* userdata) -{ - LLFloaterModelPreview* fp = (LLFloaterModelPreview*) userdata; - - fp->mModelPreview->onLODParamCommit(false); -} - -//static -void LLFloaterModelPreview::onLODParamCommitTriangleLimit(LLUICtrl* ctrl, void* userdata) +void LLFloaterModelPreview::onLODParamCommit(S32 lod, bool enforce_tri_limit) { - LLFloaterModelPreview* fp = (LLFloaterModelPreview*) userdata; - fp->mModelPreview->onLODParamCommit(true); + mModelPreview->onLODParamCommit(lod, enforce_tri_limit); } @@ -3484,7 +3478,7 @@ void LLModelPreview::loadModel(std::string filename, S32 lod, bool force_disable if (lod == mPreviewLOD) { - mFMP->childSetText("lod_file", mLODFile[mPreviewLOD]); + mFMP->childSetText("lod_file_" + lod_name[lod], mLODFile[lod]); } else if (lod == LLModel::LOD_PHYSICS) { @@ -3782,21 +3776,21 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_lim U32 lod_mode = 0; - LLCtrlSelectionInterface* iface = mFMP->childGetSelectionInterface("lod_mode"); + LLCtrlSelectionInterface* iface = mFMP->childGetSelectionInterface("lod_mode_" + lod_name[which_lod]); if (iface) { lod_mode = iface->getFirstSelectedIndex(); } mRequestedLoDMode[mPreviewLOD] = lod_mode; - F32 lod_error_threshold = mFMP->childGetValue("lod_error_threshold").asReal(); + F32 lod_error_threshold = mFMP->childGetValue("lod_error_threshold_" + lod_name[which_lod]).asReal(); if (lod_mode == 0) { lod_mode = GLOD_TRIANGLE_BUDGET; if (which_lod != -1) { - limit = mFMP->childGetValue("lod_triangle_limit").asInteger(); + limit = mFMP->childGetValue("lod_triangle_limit_" + lod_name[which_lod]).asInteger(); } } else @@ -3804,89 +3798,7 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_lim lod_mode = GLOD_ERROR_THRESHOLD; } - U32 build_operator = 0; - - iface = mFMP->childGetSelectionInterface("build_operator"); - if (iface) - { - build_operator = iface->getFirstSelectedIndex(); - } - mRequestedBuildOperator[mPreviewLOD] = build_operator; - - if (build_operator == 0) - { - build_operator = GLOD_OPERATOR_EDGE_COLLAPSE; - } - else - { - build_operator = GLOD_OPERATOR_HALF_EDGE_COLLAPSE; - } - - U32 queue_mode=0; - iface = mFMP->childGetSelectionInterface("queue_mode"); - if (iface) - { - queue_mode = iface->getFirstSelectedIndex(); - } - mRequestedQueueMode[mPreviewLOD] = queue_mode; - - if (queue_mode == 0) - { - queue_mode = GLOD_QUEUE_GREEDY; - } - else if (queue_mode == 1) - { - queue_mode = GLOD_QUEUE_LAZY; - } - else - { - queue_mode = GLOD_QUEUE_INDEPENDENT; - } - - U32 border_mode = 0; - - iface = mFMP->childGetSelectionInterface("border_mode"); - if (iface) - { - border_mode = iface->getFirstSelectedIndex(); - } - mRequestedBorderMode[mPreviewLOD] = border_mode; - - if (border_mode == 0) - { - border_mode = GLOD_BORDER_UNLOCK; - } - else - { - border_mode = GLOD_BORDER_LOCK; - } - bool object_dirty = false; - if (border_mode != mBuildBorderMode) - { - mBuildBorderMode = border_mode; - object_dirty = true; - } - - if (queue_mode != mBuildQueueMode) - { - mBuildQueueMode = queue_mode; - object_dirty = true; - } - - if (build_operator != mBuildOperator) - { - mBuildOperator = build_operator; - object_dirty = true; - } - - F32 share_tolerance = mFMP->childGetValue("share_tolerance").asReal(); - if (share_tolerance != mBuildShareTolerance) - { - mBuildShareTolerance = share_tolerance; - object_dirty = true; - } - mRequestedShareTolerance[mPreviewLOD] = share_tolerance; if (mGroup == 0) { @@ -3936,18 +3848,6 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_lim stop_gloderror(); } - glodObjectParameteri(mObject[mdl], GLOD_BUILD_OPERATOR, build_operator); - stop_gloderror(); - - glodObjectParameteri(mObject[mdl], GLOD_BUILD_QUEUE_MODE, queue_mode); - stop_gloderror(); - - glodObjectParameteri(mObject[mdl], GLOD_BUILD_BORDER_MODE, border_mode); - stop_gloderror(); - - glodObjectParameterf(mObject[mdl], GLOD_BUILD_SHARE_TOLERANCE, share_tolerance); - stop_gloderror(); - glodBuildObject(mObject[mdl]); stop_gloderror(); } @@ -4489,147 +4389,140 @@ void LLModelPreview::updateStatusMessages() } } + if (mFMP->childGetValue("physics_lod_combo").asString() == "From file") + { + mFMP->childEnable("physics_file"); + mFMP->childEnable("physics_browse"); + } + else + { + mFMP->childDisable("physics_file"); + mFMP->childDisable("physics_browse"); + } + + LLSpinCtrl* crease = mFMP->getChild("crease_angle"); + + if (mRequestedCreaseAngle[mPreviewLOD] == -1.f) + { + mFMP->childSetColor("crease_label", LLColor4::grey); + crease->forceSetValue(75.f); + } + else + { + mFMP->childSetColor("crease_label", LLColor4::white); + crease->forceSetValue(mRequestedCreaseAngle[mPreviewLOD]); + } + + mModelUpdatedSignal(true); + +} + +void LLModelPreview::updateLodControls(S32 lod) +{ const char* lod_controls[] = { - "lod_mode", - "lod_triangle_limit", - "lod_error_tolerance", - "build_operator_text", - "queue_mode_text", - "border_mode_text", - "share_tolerance_text", - "build_operator", - "queue_mode", - "border_mode", - "share_tolerance" + "lod_mode_", + "lod_triangle_limit_", }; const U32 num_lod_controls = sizeof(lod_controls)/sizeof(char*); const char* file_controls[] = { - "lod_browse", - "lod_file" + "lod_browse_", + "lod_file_", }; const U32 num_file_controls = sizeof(file_controls)/sizeof(char*); - if (fmp) + LLFloaterModelPreview* fmp = LLFloaterModelPreview::sInstance; + if (!fmp) return; + + LLComboBox* lod_combo = mFMP->findChild("lod_source_" + lod_name[lod]); + if (!lod_combo) return; + + S32 lod_mode = lod_combo->getCurrentIndex(); + if (lod_mode == 0) // LoD from file { - //enable/disable controls based on radio groups - if (mFMP->childGetValue("lod_from_file").asBoolean()) - { - fmp->mLODMode[mPreviewLOD] = 0; - for (U32 i = 0; i < num_file_controls; ++i) - { - mFMP->childEnable(file_controls[i]); - } + fmp->mLODMode[lod] = 0; + for (U32 i = 0; i < num_file_controls; ++i) + { + mFMP->childShow(file_controls[i] + lod_name[lod]); + } - for (U32 i = 0; i < num_lod_controls; ++i) - { - mFMP->childDisable(lod_controls[i]); - } + for (U32 i = 0; i < num_lod_controls; ++i) + { + mFMP->childHide(lod_controls[i] + lod_name[lod]); + } + } + else if (lod_mode == 2) // use LoD above + { + fmp->mLODMode[lod] = 2; + for (U32 i = 0; i < num_file_controls; ++i) + { + mFMP->childHide(file_controls[i] + lod_name[lod]); } - else if (mFMP->childGetValue("lod_none").asBoolean()) + + for (U32 i = 0; i < num_lod_controls; ++i) { - fmp->mLODMode[mPreviewLOD] = 2; - for (U32 i = 0; i < num_file_controls; ++i) - { - mFMP->childDisable(file_controls[i]); - } + mFMP->childHide(lod_controls[i] + lod_name[lod]); + } - for (U32 i = 0; i < num_lod_controls; ++i) - { - mFMP->childDisable(lod_controls[i]); - } + if (lod < LLModel::LOD_HIGH) + { + mModel[lod] = mModel[lod + 1]; + mScene[lod] = mScene[lod + 1]; + mVertexBuffer[lod].clear(); - if (!mModel[mPreviewLOD].empty()) + // Also update lower LoD + if (lod > LLModel::LOD_IMPOSTOR) { - mModel[mPreviewLOD].clear(); - mScene[mPreviewLOD].clear(); - mVertexBuffer[mPreviewLOD].clear(); - - //this can cause phasing issues with the UI, so reenter this function and return - updateStatusMessages(); - return; + updateLodControls(lod - 1); } } - else - { // auto generate, also the default case for wizard which has no radio selection - fmp->mLODMode[mPreviewLOD] = 1; + } + else // auto generate, the default case for all LoDs except High + { + fmp->mLODMode[lod] = 1; - //don't actually regenerate lod when refreshing UI - mLODFrozen = true; + //don't actually regenerate lod when refreshing UI + mLODFrozen = true; - for (U32 i = 0; i < num_file_controls; ++i) - { - mFMP->childDisable(file_controls[i]); - } + for (U32 i = 0; i < num_file_controls; ++i) + { + mFMP->childHide(file_controls[i] + lod_name[lod]); + } - for (U32 i = 0; i < num_lod_controls; ++i) - { - mFMP->childEnable(lod_controls[i]); - } + for (U32 i = 0; i < num_lod_controls; ++i) + { + mFMP->childShow(lod_controls[i] + lod_name[lod]); + } - //if (threshold) - { - LLSpinCtrl* threshold = mFMP->getChild("lod_error_threshold"); - LLSpinCtrl* limit = mFMP->getChild("lod_triangle_limit"); - limit->setMaxValue(mMaxTriangleLimit); - limit->forceSetValue(mRequestedTriangleCount[mPreviewLOD]); + LLSpinCtrl* threshold = mFMP->getChild("lod_error_threshold_" + lod_name[lod]); + LLSpinCtrl* limit = mFMP->getChild("lod_triangle_limit_" + lod_name[lod]); - threshold->forceSetValue(mRequestedErrorThreshold[mPreviewLOD]); + limit->setMaxValue(mMaxTriangleLimit); + limit->forceSetValue(mRequestedTriangleCount[lod]); - mFMP->getChild("lod_mode")->selectNthItem(mRequestedLoDMode[mPreviewLOD]); - mFMP->getChild("build_operator")->selectNthItem(mRequestedBuildOperator[mPreviewLOD]); - mFMP->getChild("queue_mode")->selectNthItem(mRequestedQueueMode[mPreviewLOD]); - mFMP->getChild("border_mode")->selectNthItem(mRequestedBorderMode[mPreviewLOD]); - mFMP->getChild("share_tolerance")->setValue(mRequestedShareTolerance[mPreviewLOD]); + threshold->forceSetValue(mRequestedErrorThreshold[lod]); - if (mRequestedLoDMode[mPreviewLOD] == 0) - { - limit->setVisible(true); - threshold->setVisible(false); + mFMP->getChild("lod_mode_" + lod_name[lod])->selectNthItem(mRequestedLoDMode[lod]); - limit->setMaxValue(mMaxTriangleLimit); - limit->setIncrement(mMaxTriangleLimit/32); - } - else - { - limit->setVisible(false); - threshold->setVisible(true); - } - } + if (mRequestedLoDMode[lod] == 0) + { + limit->setVisible(true); + threshold->setVisible(false); - mLODFrozen = false; + limit->setMaxValue(mMaxTriangleLimit); + limit->setIncrement(mMaxTriangleLimit/32); + } + else + { + limit->setVisible(false); + threshold->setVisible(true); } - } - - if (mFMP->childGetValue("physics_lod_combo").asString() == "From file") - { - mFMP->childEnable("physics_file"); - mFMP->childEnable("physics_browse"); - } - else - { - mFMP->childDisable("physics_file"); - mFMP->childDisable("physics_browse"); - } - LLSpinCtrl* crease = mFMP->getChild("crease_angle"); - - if (mRequestedCreaseAngle[mPreviewLOD] == -1.f) - { - mFMP->childSetColor("crease_label", LLColor4::grey); - crease->forceSetValue(75.f); - } - else - { - mFMP->childSetColor("crease_label", LLColor4::white); - crease->forceSetValue(mRequestedCreaseAngle[mPreviewLOD]); + mLODFrozen = false; } - - mModelUpdatedSignal(true); - } void LLModelPreview::setPreviewTarget(F32 distance) @@ -5484,8 +5377,7 @@ void LLModelPreview::setPreviewLOD(S32 lod) LLComboBox* combo_box = mFMP->getChild("preview_lod_combo"); combo_box->setCurrentByIndex((NUM_LOD-1)-mPreviewLOD); // combo box list of lods is in reverse order - mFMP->childSetTextArg("lod_table_footer", "[DETAIL]", mFMP->getString(lod_name[mPreviewLOD])); - mFMP->childSetText("lod_file", mLODFile[mPreviewLOD]); + mFMP->childSetText("lod_file_" + lod_name[mPreviewLOD], mLODFile[mPreviewLOD]); // the wizard has three lod drop downs LLComboBox* combo_box2 = mFMP->getChild("preview_lod_combo2"); @@ -5506,25 +5398,16 @@ void LLModelPreview::setPreviewLOD(S32 lod) mFMP->childSetColor(lod_triangles_name[i], color); mFMP->childSetColor(lod_vertices_name[i], color); } - - LLFloaterModelPreview* fmp = LLFloaterModelPreview::sInstance; - if (fmp) - { - LLRadioGroup* radio = fmp->getChild("lod_file_or_limit"); - radio->selectNthItem(fmp->mLODMode[mPreviewLOD]); - } } refresh(); updateStatusMessages(); } -//static -void LLFloaterModelPreview::onBrowseLOD(void* data) +void LLFloaterModelPreview::onBrowseLOD(S32 lod) { assert_main_thread(); - LLFloaterModelPreview* mp = (LLFloaterModelPreview*) data; - mp->loadModel(mp->mModelPreview->mPreviewLOD); + loadModel(lod); } //static @@ -5566,8 +5449,7 @@ void LLFloaterModelPreview::onUpload(void* user_data) } -//static -void LLFloaterModelPreview::refresh(LLUICtrl* ctrl, void* user_data) +void LLFloaterModelPreview::refresh() { sInstance->toggleCalculateButton(true); sInstance->mModelPreview->mDirty = true; @@ -5588,11 +5470,12 @@ void LLModelPreview::textureLoadedCallback( BOOL success, LLViewerFetchedTexture } } -void LLModelPreview::onLODParamCommit(bool enforce_tri_limit) +void LLModelPreview::onLODParamCommit(S32 lod, bool enforce_tri_limit) { if (!mLODFrozen) { - genLODs(mPreviewLOD, 3, enforce_tri_limit); + genLODs(lod, 3, enforce_tri_limit); + updateLodControls(lod); updateStatusMessages(); refresh(); } @@ -5655,6 +5538,12 @@ void LLFloaterModelPreview::toggleCalculateButton(bool visible) } } +void LLFloaterModelPreview::onLoDSourceCommit(S32 lod) +{ + mModelPreview->updateLodControls(lod); + refresh(); +} + void LLFloaterModelPreview::resetDisplayOptions() { std::map::iterator option_it = mModelPreview->mViewOption.begin(); -- cgit v1.2.3 From 117bd5af1b535f61e1128cead0dcf2503fe24108 Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Tue, 6 Sep 2011 16:23:53 +0300 Subject: SH-2309 FIXED Priority modifications to mesh uploader UI - Replaced magic number with constant - Commented my magic numbers --- indra/newview/llfloatermodelpreview.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index e687b1954c..c2872e7651 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -119,8 +119,20 @@ const S32 PREVIEW_RESIZE_HANDLE_SIZE = S32(RESIZE_HANDLE_WIDTH * OO_SQRT2) + PRE const S32 PREVIEW_HPAD = PREVIEW_RESIZE_HANDLE_SIZE; const S32 PREF_BUTTON_HEIGHT = 16 + 7 + 16; const S32 PREVIEW_TEXTURE_HEIGHT = 300; + +// "Retain%" decomp parameter has values from 0.0 to 1.0 by 0.01 +// But according to the UI spec for upload model floater, this parameter +// should be represented by Retain spinner with values from 1 to 100 by 1. +// To achieve this, RETAIN_COEFFICIENT is used while creating spinner +// and when value is requested from spinner. const double RETAIN_COEFFICIENT = 100; +// "Cosine%" decomp parameter has values from 0.9 to 1 by 0.001 +// But according to the UI spec for upload model floater, this parameter +// should be represented by Smooth combobox with only 10 values. +// So this const is used as a size of Smooth combobox list. +const S32 SMOOTH_VALUES_NUMBER = 10; + void drawBoxOutline(const LLVector3& pos, const LLVector3& size); @@ -1225,15 +1237,14 @@ void LLFloaterModelPreview::initDecompControls() void LLFloaterModelPreview::createSmoothComboBox(LLComboBox* combo_box, float min, float max) { - float combo_list_size = 10; - float delta = (max - min) / combo_list_size; + float delta = (max - min) / SMOOTH_VALUES_NUMBER; int ilabel = 0; combo_box->add("0 (none)", ADD_BOTTOM, true); for(float value = min + delta; value < max; value += delta) { - std::string label = (++ilabel == combo_list_size) ? "10 (max)" : llformat("%.1d", ilabel); + std::string label = (++ilabel == SMOOTH_VALUES_NUMBER) ? "10 (max)" : llformat("%.1d", ilabel); combo_box->add(label, value, ADD_BOTTOM, true); } -- cgit v1.2.3 From f44b44400bf678b71bbbf50b2af7f80e8133a2c3 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Thu, 8 Sep 2011 18:47:37 +0300 Subject: SH-2309 FIXED 'Triangles limit' combo value updating problem. Fixed updating 'Error threshold' spinner control visibility. --- indra/newview/llfloatermodelpreview.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index a19e17778a..7362e56434 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -3806,7 +3806,7 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_lim { lod_mode = iface->getFirstSelectedIndex(); } - mRequestedLoDMode[mPreviewLOD] = lod_mode; + mRequestedLoDMode[which_lod] = lod_mode; F32 lod_error_threshold = mFMP->childGetValue("lod_error_threshold_" + lod_name[which_lod]).asReal(); @@ -4247,6 +4247,8 @@ void LLModelPreview::updateStatusMessages() icon = mFMP->getChild("lod_status_message_icon"); icon->setImage(img); } + + updateLodControls(lod); } @@ -4448,6 +4450,7 @@ void LLModelPreview::updateLodControls(S32 lod) { "lod_mode_", "lod_triangle_limit_", + "lod_error_threshold_" }; const U32 num_lod_controls = sizeof(lod_controls)/sizeof(char*); @@ -5539,8 +5542,6 @@ void LLModelPreview::onLODParamCommit(S32 lod, bool enforce_tri_limit) if (!mLODFrozen) { genLODs(lod, 3, enforce_tri_limit); - updateLodControls(lod); - updateStatusMessages(); refresh(); } } -- cgit v1.2.3 From 2e652ce660e86097ce2b47bb82926005bb0482c8 Mon Sep 17 00:00:00 2001 From: prep Date: Thu, 8 Sep 2011 15:54:52 -0400 Subject: Fix for SH-2210 --- indra/newview/llfloatermodelpreview.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index b424ad45fb..42186aa247 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -2764,6 +2764,7 @@ void LLModelLoader::processElement( daeElement* element, bool& badElement ) //process children daeTArray< daeSmartRef > children = element->getChildren(); + int childCount = children.getCount(); for (S32 i = 0; i < children.getCount(); i++) { processElement(children[i],badElement); @@ -3456,6 +3457,12 @@ void LLModelPreview::setPhysicsFromLOD(S32 lod) void LLModelPreview::clearIncompatible(S32 lod) { + //Don't discard models if specified model is the physic rep + if ( lod == LLModel::LOD_PHYSICS ) + { + return; + } + for (U32 i = 0; i <= LLModel::LOD_HIGH; i++) { //clear out any entries that aren't compatible with this model if (i != lod) -- cgit v1.2.3 From b56e4cf0e428187c5ed4037b843c05610ed0da2a Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Mon, 12 Sep 2011 14:51:22 -0400 Subject: BUILDFIX GCC fixing unused variable --- indra/newview/llfloatermodelpreview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 56d1fc49ee..55c4907a74 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -2841,7 +2841,7 @@ void LLModelLoader::processElement( daeElement* element, bool& badElement ) //process children daeTArray< daeSmartRef > children = element->getChildren(); int childCount = children.getCount(); - for (S32 i = 0; i < children.getCount(); i++) + for (S32 i = 0; i < childCount; i++) { processElement(children[i],badElement); } -- cgit v1.2.3 From f74b7274d23b43b967331bf970cf7810ef4067d9 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Tue, 13 Sep 2011 19:45:04 +0300 Subject: SH-2400 FIXED crash on model upload. Added checks for LoD strings array index bounds. --- indra/newview/llfloatermodelpreview.cpp | 46 ++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 6 deletions(-) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 55c4907a74..bd4abc1f9f 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -3454,6 +3454,13 @@ void LLModelPreview::loadModel(std::string filename, S32 lod, bool force_disable LLMutexLock lock(this); + if (lod < LLModel::LOD_IMPOSTOR || lod > LLModel::NUM_LODS - 1) + { + llwarns << "Invalid level of detail: " << lod << llendl; + assert(lod >= LLModel::LOD_IMPOSTOR && lod < LLModel::NUM_LODS); + return; + } + // This triggers if you bring up the file picker and then hit CANCEL. // Just use the previous model (if any) and ignore that you brought up // the file picker. @@ -3779,6 +3786,14 @@ void LLModelPreview::generateNormals() void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_limit) { + // Allow LoD from -1 to LLModel::LOD_PHYSICS + if (which_lod < -1 || which_lod > LLModel::NUM_LODS - 1) + { + llwarns << "Invalid level of detail: " << which_lod << llendl; + assert(which_lod >= -1 && which_lod < LLModel::NUM_LODS); + return; + } + if (mBaseModel.empty()) { return; @@ -3808,19 +3823,31 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_lim U32 lod_mode = 0; - LLCtrlSelectionInterface* iface = mFMP->childGetSelectionInterface("lod_mode_" + lod_name[which_lod]); - if (iface) + F32 lod_error_threshold = 0; + + // The LoD should be in range from Lowest to High + if (which_lod > -1 && which_lod < NUM_LOD) { - lod_mode = iface->getFirstSelectedIndex(); + LLCtrlSelectionInterface* iface = mFMP->childGetSelectionInterface("lod_mode_" + lod_name[which_lod]); + if (iface) + { + lod_mode = iface->getFirstSelectedIndex(); + } + + lod_error_threshold = mFMP->childGetValue("lod_error_threshold_" + lod_name[which_lod]).asReal(); } - mRequestedLoDMode[which_lod] = lod_mode; - F32 lod_error_threshold = mFMP->childGetValue("lod_error_threshold_" + lod_name[which_lod]).asReal(); + if (which_lod != -1) + { + mRequestedLoDMode[which_lod] = lod_mode; + } if (lod_mode == 0) { lod_mode = GLOD_TRIANGLE_BUDGET; - if (which_lod != -1) + + // The LoD should be in range from Lowest to High + if (which_lod > -1 && which_lod < NUM_LOD) { limit = mFMP->childGetValue("lod_triangle_limit_" + lod_name[which_lod]).asInteger(); } @@ -4453,6 +4480,13 @@ void LLModelPreview::updateStatusMessages() void LLModelPreview::updateLodControls(S32 lod) { + if (lod < LLModel::LOD_IMPOSTOR || lod > LLModel::LOD_HIGH) + { + llwarns << "Invalid level of detail: " << lod << llendl; + assert(lod >= LLModel::LOD_IMPOSTOR && lod <= LLModel::LOD_HIGH); + return; + } + const char* lod_controls[] = { "lod_mode_", -- cgit v1.2.3 From 4efca483d7dc8c8a50ebe247c6c163c263ed20f5 Mon Sep 17 00:00:00 2001 From: prep Date: Wed, 14 Sep 2011 10:41:26 -0400 Subject: Fix for CTS-804. Added support for parsing translations from Blenders(v2.5.9) transform SID's. --- indra/newview/llfloatermodelpreview.cpp | 47 ++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 4 deletions(-) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 55c4907a74..7ef1ff17ea 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -1754,9 +1754,15 @@ bool LLModelLoader::doLoadModel() missingSkeletonOrScene = true; } else + if ( pTranslateElement ) { extractTranslationViaElement( pTranslateElement, workingTransform ); } + else + { + extractTranslationViaSID( pJoint, workingTransform ); + } + } //Store the joint transform w/respect to it's name. @@ -2612,10 +2618,43 @@ void LLModelLoader::extractTranslation( domTranslate* pTranslate, LLMatrix4& tra //----------------------------------------------------------------------------- void LLModelLoader::extractTranslationViaElement( daeElement* pTranslateElement, LLMatrix4& transform ) { - domTranslate* pTranslateChild = dynamic_cast( pTranslateElement ); - domFloat3 translateChild = pTranslateChild->getValue(); - LLVector3 singleJointTranslation( translateChild[0], translateChild[1], translateChild[2] ); - transform.setTranslation( singleJointTranslation ); + if ( pTranslateElement ) + { + domTranslate* pTranslateChild = dynamic_cast( pTranslateElement ); + domFloat3 translateChild = pTranslateChild->getValue(); + LLVector3 singleJointTranslation( translateChild[0], translateChild[1], translateChild[2] ); + transform.setTranslation( singleJointTranslation ); + } +} +//----------------------------------------------------------------------------- +// extractTranslationViaSID() +//----------------------------------------------------------------------------- +void LLModelLoader::extractTranslationViaSID( daeElement* pElement, LLMatrix4& transform ) +{ + if ( pElement ) + { + daeSIDResolver resolver( pElement, "./transform" ); + domMatrix* pMatrix = daeSafeCast( resolver.getElement() ); + //We are only extracting out the translational component atm + LLMatrix4 workingTransform; + if ( pMatrix ) + { + domFloat4x4 domArray = pMatrix->getValue(); + for ( int i = 0; i < 4; i++ ) + { + for( int j = 0; j < 4; j++ ) + { + workingTransform.mMatrix[i][j] = domArray[i + j*4]; + } + } + LLVector3 trans = workingTransform.getTranslation(); + transform.setTranslation( trans ); + } + } + else + { + llwarns<<"Element is nonexistent - empty/unsupported node."< Date: Fri, 16 Sep 2011 15:10:58 -0400 Subject: Fix for sh-2443 --- indra/newview/llfloatermodelpreview.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 75e775072b..6bba430425 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -4351,6 +4351,11 @@ void LLModelPreview::updateStatusMessages() { skinAndRigOk = false; } + else + if ( !getRigWithSceneParity() ) + { + mFMP->childDisable("calculate_btn"); + } } if(upload_ok && mModelLoader) @@ -4954,12 +4959,12 @@ BOOL LLModelPreview::render() if (has_skin_weights) { //model has skin weights, enable view options for skin weights and joint positions - if (fmp) + if (fmp && getRigWithSceneParity() ) { fmp->enableViewOption("show_skin_weight"); fmp->setViewOptionEnabled("show_joint_positions", skin_weight); + mFMP->childEnable("upload_skin"); } - mFMP->childEnable("upload_skin"); } else { -- cgit v1.2.3 From 3f0a2cda29607b1114788f54c1147c3bd5c864f8 Mon Sep 17 00:00:00 2001 From: prep linden Date: Mon, 19 Sep 2011 11:00:11 -0400 Subject: Fix for sh-2443 --- indra/newview/llfloatermodelpreview.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 6bba430425..5869cf6fee 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -4352,7 +4352,7 @@ void LLModelPreview::updateStatusMessages() skinAndRigOk = false; } else - if ( !getRigWithSceneParity() ) + if ( !isLegacyRigValid() ) { mFMP->childDisable("calculate_btn"); } @@ -4959,7 +4959,7 @@ BOOL LLModelPreview::render() if (has_skin_weights) { //model has skin weights, enable view options for skin weights and joint positions - if (fmp && getRigWithSceneParity() ) + if (fmp && isLegacyRigValid() ) { fmp->enableViewOption("show_skin_weight"); fmp->setViewOptionEnabled("show_joint_positions", skin_weight); -- cgit v1.2.3