From 57a7f63dcce6eb20a05dbc42bfdc9ac51072cb7e Mon Sep 17 00:00:00 2001 From: Howard Stearns Date: Fri, 4 Feb 2022 09:55:05 -0800 Subject: SL-98 - Render a "ground plane" in the model upload preview, so users can see any added offset --- indra/newview/llmodelpreview.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'indra/newview/llmodelpreview.cpp') diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index a9e80ab5da..88ef88d297 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -3404,7 +3404,10 @@ BOOL LLModelPreview::render() { gDebugProgram.bind(); } - getPreviewAvatar()->renderCollisionVolumes(); + if (fmp->mTabContainer->getCurrentPanelIndex() == fmp->mPhysicsTabIndex) + { // Physics collision volumes obscure a lot, so only show them when on the physics tab. + getPreviewAvatar()->renderCollisionVolumes(); + } if (fmp->mTabContainer->getCurrentPanelIndex() == fmp->mAvatarTabIndex) { getPreviewAvatar()->renderBones(fmp->mSelectedJointName); @@ -3413,6 +3416,7 @@ BOOL LLModelPreview::render() { getPreviewAvatar()->renderBones(); } + getPreviewAvatar()->renderGroundPlane(mPelvisZOffset); if (shader) { shader->bind(); -- cgit v1.2.3 From f1df486208f94c649f09dc2dc0cce393208d3771 Mon Sep 17 00:00:00 2001 From: Howard Stearns Date: Fri, 4 Feb 2022 13:55:08 -0800 Subject: SL-98 - move new renderGroundPlane from LLVOAvatar to LLModelPreview --- indra/newview/llmodelpreview.cpp | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'indra/newview/llmodelpreview.cpp') diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index 88ef88d297..8e487484fd 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -3416,7 +3416,7 @@ BOOL LLModelPreview::render() { getPreviewAvatar()->renderBones(); } - getPreviewAvatar()->renderGroundPlane(mPelvisZOffset); + renderGroundPlane(mPelvisZOffset); if (shader) { shader->bind(); @@ -3441,6 +3441,39 @@ BOOL LLModelPreview::render() return TRUE; } +void LLModelPreview::renderGroundPlane(float z_offset) +{ // Not necesarilly general - beware - but it seems to meet the needs of LLModelPreview::render + const LLVOAvatar* avatarp = getPreviewAvatar(); + const LLVector3 root_pos = avatarp->mRoot->getPosition(); + const LLVector4a* ext = avatarp->mDrawable->getSpatialExtents(); + const LLVector4a min = ext[0], max = ext[1]; + const F32 center = (max[2] - min[2]) * 0.5f; + const F32 ground = root_pos[2] - center - z_offset; + + const LLVector3 vA{min[0], min[1], ground}; + const LLVector3 vB{max[0], min[1], ground}; + const LLVector3 vC{max[0], max[1], ground}; + const LLVector3 vD{min[0], max[1], ground}; + + gGL.diffuseColor3f( 1.0f, 0.0f, 1.0f ); + + gGL.begin(LLRender::LINES); + gGL.vertex3fv(vA.mV); + gGL.vertex3fv(vB.mV); + + gGL.vertex3fv(vB.mV); + gGL.vertex3fv(vC.mV); + + gGL.vertex3fv(vC.mV); + gGL.vertex3fv(vD.mV); + + gGL.vertex3fv(vD.mV); + gGL.vertex3fv(vA.mV); + + gGL.end(); +} + + //----------------------------------------------------------------------------- // refresh() //----------------------------------------------------------------------------- -- cgit v1.2.3 From ca43cc2305502ec4f6a8d75ea2e4303b655ff0ce Mon Sep 17 00:00:00 2001 From: Howard Stearns Date: Fri, 4 Feb 2022 14:13:19 -0800 Subject: SL-98 - Remove special new tab-specific display behavior --- indra/newview/llmodelpreview.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'indra/newview/llmodelpreview.cpp') diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index 8e487484fd..f12ddb1745 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -3404,10 +3404,7 @@ BOOL LLModelPreview::render() { gDebugProgram.bind(); } - if (fmp->mTabContainer->getCurrentPanelIndex() == fmp->mPhysicsTabIndex) - { // Physics collision volumes obscure a lot, so only show them when on the physics tab. - getPreviewAvatar()->renderCollisionVolumes(); - } + getPreviewAvatar()->renderCollisionVolumes(); if (fmp->mTabContainer->getCurrentPanelIndex() == fmp->mAvatarTabIndex) { getPreviewAvatar()->renderBones(fmp->mSelectedJointName); -- cgit v1.2.3 From a5f06a1b8136f0cdfc520e94166de202f3925505 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Sat, 12 Feb 2022 23:12:36 +0200 Subject: SL-4488 Fixed ambiguity mapped weights to vertices in uploader Were not displaying and uploading correctly. --- indra/newview/llmodelpreview.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'indra/newview/llmodelpreview.cpp') diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index f12ddb1745..5ee236e07d 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -2400,7 +2400,6 @@ void LLModelPreview::genBuffers(S32 lod, bool include_skin_weights) continue; } - LLModel* base_mdl = *base_iter; base_iter++; S32 num_faces = mdl->getNumVolumeFaces(); @@ -2475,7 +2474,7 @@ void LLModelPreview::genBuffers(S32 lod, bool include_skin_weights) //find closest weight to vf.mVertices[i].mPosition LLVector3 pos(vf.mPositions[i].getF32ptr()); - const LLModel::weight_list& weight_list = base_mdl->getJointInfluences(pos); + const LLModel::weight_list& weight_list = mdl->getJointInfluences(pos); llassert(weight_list.size()>0 && weight_list.size() <= 4); // LLModel::loadModel() should guarantee this LLVector4 w(0, 0, 0, 0); -- cgit v1.2.3 From 9210ec8a82226bd0786d309fcf9e056d08ed1b0f Mon Sep 17 00:00:00 2001 From: Howard Stearns Date: Fri, 25 Feb 2022 18:32:55 -0800 Subject: SL-9748 - Apply explicitly given physics shape only if the usual rules do not. --- indra/newview/llmodelpreview.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'indra/newview/llmodelpreview.cpp') diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index a9e80ab5da..a1420fba17 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -529,6 +529,16 @@ void LLModelPreview::rebuildUploadData() LLFloaterModelPreview::addStringToLog(out, false); } } + if (!mLastSpecifiedPhysicsModelOriginalName.empty() && !lod_model && (i == LLModel::LOD_PHYSICS)) + { + // Despite the various strategies above, if we don't now have a physics model, we're going to end up with decomposition. + // That's ok, but in the case where someone supplied a physics file, that's probably not what they wanted. + std::ostringstream out; + out << "Reusing previously matched physics model " << mLastSpecifiedPhysicsModelOriginalName; + LL_INFOS() << out.str() << LL_ENDL; + LLFloaterModelPreview::addStringToLog(out, false); + lod_model = mLastSpecifiedPhysicsP; + } if (lod_model) { @@ -1185,7 +1195,11 @@ void LLModelPreview::loadModelCallback(S32 loaded_lod) LL_WARNS() << out.str() << LL_ENDL; LLFloaterModelPreview::addStringToLog(out, false); } - + if (loaded_lod == LLModel::LOD_PHYSICS) + { + mLastSpecifiedPhysicsModelOriginalName = loaded_name; + mLastSpecifiedPhysicsP = mModel[loaded_lod][idx]; + } mModel[loaded_lod][idx]->mLabel = name; } } -- cgit v1.2.3 From 932b7de5309bc8599655ebb77666c41f5a81cfa9 Mon Sep 17 00:00:00 2001 From: Howard Stearns Date: Mon, 28 Feb 2022 15:47:56 -0800 Subject: SL-9748 - Handle submesh case of resuseable physics model. --- indra/newview/llmodelpreview.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'indra/newview/llmodelpreview.cpp') diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index a1420fba17..f3b6207488 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -529,12 +529,12 @@ void LLModelPreview::rebuildUploadData() LLFloaterModelPreview::addStringToLog(out, false); } } - if (!mLastSpecifiedPhysicsModelOriginalName.empty() && !lod_model && (i == LLModel::LOD_PHYSICS)) + if (mLastSpecifiedPhysicsP && !lod_model && (i == LLModel::LOD_PHYSICS)) { // Despite the various strategies above, if we don't now have a physics model, we're going to end up with decomposition. // That's ok, but in the case where someone supplied a physics file, that's probably not what they wanted. std::ostringstream out; - out << "Reusing previously matched physics model " << mLastSpecifiedPhysicsModelOriginalName; + out << "Reusing physics model " << mLastSpecifiedPhysicsModelOriginalName << " for " << instance.mLabel; LL_INFOS() << out.str() << LL_ENDL; LLFloaterModelPreview::addStringToLog(out, false); lod_model = mLastSpecifiedPhysicsP; @@ -1204,6 +1204,11 @@ void LLModelPreview::loadModelCallback(S32 loaded_lod) } } } + else if ((loaded_lod == LLModel::LOD_PHYSICS) && (mModel[loaded_lod].size() == 1)) + { + mLastSpecifiedPhysicsModelOriginalName = stripSuffix(mModel[loaded_lod][0]->mLabel); + mLastSpecifiedPhysicsP = mModel[loaded_lod][0]; + } } } } -- cgit v1.2.3 From 239a29ab5c67bef8ffc773b0f405d8cc4542cf34 Mon Sep 17 00:00:00 2001 From: Howard Stearns Date: Wed, 2 Mar 2022 17:39:12 -0800 Subject: SL-9748 - more cases --- indra/newview/llmodelpreview.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llmodelpreview.cpp') diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index 54a0c1a5bb..4e3b4c5c41 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -470,8 +470,8 @@ void LLModelPreview::rebuildUploadData() // Despite the various strategies above, if we don't now have a physics model, we're going to end up with decomposition. // That's ok, but in the case where someone supplied a physics file, that's probably not what they wanted. std::ostringstream out; - out << "Reusing physics model " << mLastSpecifiedPhysicsModelOriginalName << " for " << instance.mLabel; - LL_INFOS() << out.str() << LL_ENDL; + out << "No physics model specified for " << instance.mLabel << ". Reusing physics model " << mLastSpecifiedPhysicsModelOriginalName << "."; + LL_WARNS() << out.str() << LL_ENDL; LLFloaterModelPreview::addStringToLog(out, false); lod_model = mLastSpecifiedPhysicsP; } @@ -1140,7 +1140,7 @@ void LLModelPreview::loadModelCallback(S32 loaded_lod) } } } - else if ((loaded_lod == LLModel::LOD_PHYSICS) && (mModel[loaded_lod].size() == 1)) + else if ((loaded_lod == LLModel::LOD_PHYSICS) && !mLastSpecifiedPhysicsP) { mLastSpecifiedPhysicsModelOriginalName = stripSuffix(mModel[loaded_lod][0]->mLabel); mLastSpecifiedPhysicsP = mModel[loaded_lod][0]; -- cgit v1.2.3 From 340213b3023ec1dcc58587f35d270a3ad1a1e83d Mon Sep 17 00:00:00 2001 From: Howard Stearns Date: Thu, 3 Mar 2022 18:56:52 -0800 Subject: SL-9748 - Only supply a default physics shape if it is named default_physics_shape --- indra/newview/llmodelpreview.cpp | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'indra/newview/llmodelpreview.cpp') diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index 4e3b4c5c41..7578d3b9bb 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -86,6 +86,7 @@ static const LLColor4 PREVIEW_DEG_FILL_COL(1.f, 0.f, 0.f, 0.5f); static const F32 PREVIEW_DEG_EDGE_WIDTH(3.f); static const F32 PREVIEW_DEG_POINT_SIZE(8.f); static const F32 PREVIEW_ZOOM_LIMIT(10.f); +static const std::string DEFAULT_PHYSICS_MESH_NAME = "default_physics_shape"; const F32 SKIN_WEIGHT_CAMERA_DISTANCE = 16.f; @@ -465,15 +466,19 @@ void LLModelPreview::rebuildUploadData() LLFloaterModelPreview::addStringToLog(out, false); } } - if (mLastSpecifiedPhysicsP && !lod_model && (i == LLModel::LOD_PHYSICS)) + if (mWarnOfUnmatchedPhyicsMeshes && !lod_model && (i == LLModel::LOD_PHYSICS)) { // Despite the various strategies above, if we don't now have a physics model, we're going to end up with decomposition. - // That's ok, but in the case where someone supplied a physics file, that's probably not what they wanted. + // That's ok, but might not what they wanted. Use default_physics_shape if found. std::ostringstream out; - out << "No physics model specified for " << instance.mLabel << ". Reusing physics model " << mLastSpecifiedPhysicsModelOriginalName << "."; + out << "No physics model specified for " << instance.mLabel; + if (mDefaultPhysicsShapeP) + { + out << " - using: " << DEFAULT_PHYSICS_MESH_NAME; + lod_model = mDefaultPhysicsShapeP; + } LL_WARNS() << out.str() << LL_ENDL; - LLFloaterModelPreview::addStringToLog(out, false); - lod_model = mLastSpecifiedPhysicsP; + LLFloaterModelPreview::addStringToLog(out, !mDefaultPhysicsShapeP); // Flash log tab if no default. } if (lod_model) @@ -1061,6 +1066,13 @@ void LLModelPreview::loadModelCallback(S32 loaded_lod) } else { + if (loaded_lod == LLModel::LOD_PHYSICS) + { // Explicitly loading physics. See if there is a default mesh. + LLMatrix4 ignored_transform; // Each mesh that uses this will supply their own. + mDefaultPhysicsShapeP = nullptr; + FindModel(mScene[loaded_lod], DEFAULT_PHYSICS_MESH_NAME + getLodSuffix(loaded_lod), mDefaultPhysicsShapeP, ignored_transform); + mWarnOfUnmatchedPhyicsMeshes = true; + } BOOL legacyMatching = gSavedSettings.getBOOL("ImporterLegacyMatching"); if (!legacyMatching) { @@ -1131,20 +1143,10 @@ void LLModelPreview::loadModelCallback(S32 loaded_lod) LL_WARNS() << out.str() << LL_ENDL; LLFloaterModelPreview::addStringToLog(out, false); } - if (loaded_lod == LLModel::LOD_PHYSICS) - { - mLastSpecifiedPhysicsModelOriginalName = loaded_name; - mLastSpecifiedPhysicsP = mModel[loaded_lod][idx]; - } mModel[loaded_lod][idx]->mLabel = name; } } } - else if ((loaded_lod == LLModel::LOD_PHYSICS) && !mLastSpecifiedPhysicsP) - { - mLastSpecifiedPhysicsModelOriginalName = stripSuffix(mModel[loaded_lod][0]->mLabel); - mLastSpecifiedPhysicsP = mModel[loaded_lod][0]; - } } } } -- cgit v1.2.3 From 5e89e26554bfb4668f63c82cb7d869c15cca79c5 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Wed, 9 Mar 2022 17:32:22 +0200 Subject: SL-16980 FIXED Uploading model preview disappeared after changing the Triangle limit --- indra/newview/llmodelpreview.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llmodelpreview.cpp') diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index 31eb00df40..039063c711 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -3529,6 +3529,7 @@ void LLModelPreview::onLODParamCommit(S32 lod, bool enforce_tri_limit) { genLODs(lod, 3, enforce_tri_limit); refresh(); + mDirty = true; } } -- cgit v1.2.3 From c58c308d2163db1040acabe5a85c3853ef4edb44 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Tue, 15 Mar 2022 16:13:24 +0200 Subject: SL-17002 FIXED The "include joint positions" checkbox is displayed inactive --- indra/newview/llmodelpreview.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/newview/llmodelpreview.cpp') diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index 039063c711..0fddbd6326 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -2745,6 +2745,9 @@ BOOL LLModelPreview::render() // (note: all these UI updates need to be somewhere that is not render) fmp->childSetValue("upload_skin", true); mFirstSkinUpdate = false; + upload_skin = true; + skin_weight = true; + mViewOption["show_skin_weight"] = true; } fmp->enableViewOption("show_skin_weight"); -- cgit v1.2.3 From 87e7b732ba3760ba1585b290d3171ea87437d2fa Mon Sep 17 00:00:00 2001 From: Howard Stearns Date: Mon, 16 May 2022 11:39:04 -0700 Subject: SL-98-a - fix jumping ground plane --- indra/newview/llmodelpreview.cpp | 41 +++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) (limited to 'indra/newview/llmodelpreview.cpp') diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index b78bec5c04..39bfcbc9b7 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -2533,6 +2533,20 @@ void LLModelPreview::loadedCallback( { pPreview->lookupLODModelFiles(lod); } + + const LLVOAvatar* avatarp = pPreview->getPreviewAvatar(); + if (avatarp) { // set up ground plane for possible rendering + const LLVector3 root_pos = avatarp->mRoot->getPosition(); + const LLVector4a* ext = avatarp->mDrawable->getSpatialExtents(); + const LLVector4a min = ext[0], max = ext[1]; + const F32 center = (max[2] - min[2]) * 0.5f; + const F32 ground = root_pos[2] - center; + auto plane = pPreview->mGroundPlane; + plane[0] = {min[0], min[1], ground}; + plane[1] = {max[0], min[1], ground}; + plane[2] = {max[0], max[1], ground}; + plane[3] = {min[0], max[1], ground}; + } } } @@ -3375,32 +3389,21 @@ BOOL LLModelPreview::render() void LLModelPreview::renderGroundPlane(float z_offset) { // Not necesarilly general - beware - but it seems to meet the needs of LLModelPreview::render - const LLVOAvatar* avatarp = getPreviewAvatar(); - const LLVector3 root_pos = avatarp->mRoot->getPosition(); - const LLVector4a* ext = avatarp->mDrawable->getSpatialExtents(); - const LLVector4a min = ext[0], max = ext[1]; - const F32 center = (max[2] - min[2]) * 0.5f; - const F32 ground = root_pos[2] - center - z_offset; - - const LLVector3 vA{min[0], min[1], ground}; - const LLVector3 vB{max[0], min[1], ground}; - const LLVector3 vC{max[0], max[1], ground}; - const LLVector3 vD{min[0], max[1], ground}; gGL.diffuseColor3f( 1.0f, 0.0f, 1.0f ); gGL.begin(LLRender::LINES); - gGL.vertex3fv(vA.mV); - gGL.vertex3fv(vB.mV); + gGL.vertex3fv(mGroundPlane[0].mV); + gGL.vertex3fv(mGroundPlane[1].mV); - gGL.vertex3fv(vB.mV); - gGL.vertex3fv(vC.mV); + gGL.vertex3fv(mGroundPlane[1].mV); + gGL.vertex3fv(mGroundPlane[2].mV); - gGL.vertex3fv(vC.mV); - gGL.vertex3fv(vD.mV); + gGL.vertex3fv(mGroundPlane[2].mV); + gGL.vertex3fv(mGroundPlane[3].mV); - gGL.vertex3fv(vD.mV); - gGL.vertex3fv(vA.mV); + gGL.vertex3fv(mGroundPlane[3].mV); + gGL.vertex3fv(mGroundPlane[0].mV); gGL.end(); } -- cgit v1.2.3 From 076a89506243e8d4037f34c2a78278ff6ee0f1f7 Mon Sep 17 00:00:00 2001 From: Maxim Nikolenko Date: Tue, 21 Jun 2022 17:55:29 +0300 Subject: SL-17635 remove unused variables --- indra/newview/llmodelpreview.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'indra/newview/llmodelpreview.cpp') diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index d012a9b328..d64f1a36f5 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -2583,8 +2583,6 @@ void LLModelPreview::clearBuffers() void LLModelPreview::genBuffers(S32 lod, bool include_skin_weights) { - U32 tri_count = 0; - U32 vertex_count = 0; U32 mesh_count = 0; @@ -2720,10 +2718,7 @@ void LLModelPreview::genBuffers(S32 lod, bool include_skin_weights) mVertexBuffer[lod][mdl].push_back(vb); - vertex_count += num_vertices; - tri_count += num_indices / 3; ++mesh_count; - } } } -- cgit v1.2.3