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.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 ++++++++++++++++++++++++++++++++++- indra/newview/llmodelpreview.h | 1 + indra/newview/llvoavatar.cpp | 30 ------------------------------ indra/newview/llvoavatar.h | 1 - 4 files changed, 35 insertions(+), 32 deletions(-) (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() //----------------------------------------------------------------------------- diff --git a/indra/newview/llmodelpreview.h b/indra/newview/llmodelpreview.h index 3664a27a72..60b510e415 100644 --- a/indra/newview/llmodelpreview.h +++ b/indra/newview/llmodelpreview.h @@ -217,6 +217,7 @@ private: LLVOAvatar* getPreviewAvatar(void) { return mPreviewAvatar; } // Count amount of original models, excluding sub-models static U32 countRootModels(LLModelLoader::model_list models); + void renderGroundPlane(float z_offset = 0.0f); protected: friend class LLModelLoader; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 7123c0e3dd..7746af5a58 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1673,36 +1673,6 @@ void LLVOAvatar::renderBones(const std::string &selected_joint) } } -void LLVOAvatar::renderGroundPlane(float z_offset) -{ // Not necesarilly general - beware - but it seems to meet the needs of LLModelPreview::render - const LLVector3 root_pos = mRoot->getPosition(); - const LLVector4a* ext = 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(); -} void LLVOAvatar::renderJoints() { diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index b4d27baf20..74ef589ca4 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -486,7 +486,6 @@ public: void renderCollisionVolumes(); void renderBones(const std::string &selected_joint = std::string()); void renderJoints(); - void renderGroundPlane(float z_offset = 0.0f); static void deleteCachedImages(bool clearAll=true); static void destroyGL(); static void restoreGL(); -- cgit v1.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/llfloatermodelpreview.cpp | 1 - indra/newview/llfloatermodelpreview.h | 1 - indra/newview/llmodelpreview.cpp | 5 +---- 3 files changed, 1 insertion(+), 6 deletions(-) (limited to 'indra/newview/llmodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 165adf4644..64b24d54c3 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -270,7 +270,6 @@ BOOL LLFloaterModelPreview::postBuild() LLPanel *panel = mTabContainer->getPanelByName("rigging_panel"); mAvatarTabIndex = mTabContainer->getIndexForPanel(panel); panel->getChild("joints_list")->setCommitCallback(boost::bind(&LLFloaterModelPreview::onJointListSelection, this)); - mPhysicsTabIndex = mTabContainer->getIndexForPanel(mTabContainer->getPanelByName("physics_panel")); if (LLConvexDecomposition::getInstance() != NULL) { diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h index bb2b00351f..8a01b0c307 100644 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -231,7 +231,6 @@ private: LLTabContainer* mTabContainer; S32 mAvatarTabIndex; // just to avoid any issues in case of xml changes - S32 mPhysicsTabIndex; std::string mSelectedJointName; joint_override_data_map_t mJointOverrides[LLModel::NUM_LODS]; 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.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/llprimitive/llmodel.cpp | 2 +- indra/newview/llmodelpreview.cpp | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'indra/newview/llmodelpreview.cpp') diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index a2514f4e33..a4fd8b3c24 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -834,7 +834,7 @@ LLSD LLModel::writeModel( { LLVector3 pos(face.mPositions[j].getF32ptr()); - weight_list& weights = high->getJointInfluences(pos); + weight_list& weights = model[idx]->getJointInfluences(pos); S32 count = 0; for (weight_list::iterator iter = weights.begin(); iter != weights.end(); ++iter) 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.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.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.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 +++++++++++++++++++++------------------- indra/newview/llmodelpreview.h | 1 + 2 files changed, 23 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(); } diff --git a/indra/newview/llmodelpreview.h b/indra/newview/llmodelpreview.h index 293af4e83e..d3780e1a7e 100644 --- a/indra/newview/llmodelpreview.h +++ b/indra/newview/llmodelpreview.h @@ -217,6 +217,7 @@ private: LLVOAvatar* getPreviewAvatar(void) { return mPreviewAvatar; } // Count amount of original models, excluding sub-models static U32 countRootModels(LLModelLoader::model_list models); + LLVector3 mGroundPlane[4]; void renderGroundPlane(float z_offset = 0.0f); protected: -- cgit v1.3