summaryrefslogtreecommitdiff
path: root/indra/llprimitive/llmodelloader.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2025-07-17 11:23:10 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2025-07-17 11:23:51 +0300
commit6e186befad1eafd091a38c9e4d6b58cc09926e57 (patch)
treec128d6fcbd9482dbe31092ac34bb9d31f69f6255 /indra/llprimitive/llmodelloader.cpp
parent58420b8e63d2f5ac6a0ebe858a34061b16c9c16b (diff)
Reapply "Merge develop into glTF mesh import"
To simplify merging into mesh import branch This reverts commit b0c951ffe348f478f27a85720cc7aeffea32fe73.
Diffstat (limited to 'indra/llprimitive/llmodelloader.cpp')
-rw-r--r--indra/llprimitive/llmodelloader.cpp54
1 files changed, 54 insertions, 0 deletions
diff --git a/indra/llprimitive/llmodelloader.cpp b/indra/llprimitive/llmodelloader.cpp
index 7facd53a72..f97ac16a83 100644
--- a/indra/llprimitive/llmodelloader.cpp
+++ b/indra/llprimitive/llmodelloader.cpp
@@ -150,6 +150,8 @@ void LLModelLoader::run()
{
mWarningsArray.clear();
doLoadModel();
+ // todo: we are inside of a thread, push this into main thread worker,
+ // not into doOnIdleOneTime that laks tread safety
doOnIdleOneTime(boost::bind(&LLModelLoader::loadModelCallback,this));
}
@@ -466,6 +468,58 @@ bool LLModelLoader::isRigSuitableForJointPositionUpload( const std::vector<std::
return true;
}
+void LLModelLoader::dumpDebugData()
+{
+ std::string log_file = mFilename + "_importer.txt";
+ LLStringUtil::toLower(log_file);
+ llofstream file;
+ file.open(log_file.c_str());
+ if (!file)
+ {
+ LL_WARNS() << "dumpDebugData failed to open file " << log_file << LL_ENDL;
+ return;
+ }
+ file << "Importing: " << mFilename << "\n";
+
+ std::map<std::string, LLMatrix4a> inv_bind;
+ std::map<std::string, LLMatrix4a> alt_bind;
+ for (LLPointer<LLModel>& mdl : mModelList)
+ {
+
+ file << "Model name: " << mdl->mLabel << "\n";
+ const LLMeshSkinInfo& skin_info = mdl->mSkinInfo;
+ file << "Shape Bind matrix: " << skin_info.mBindShapeMatrix << "\n";
+ file << "Skin Weights count: " << (S32)mdl->mSkinWeights.size() << "\n";
+
+ // some objects might have individual bind matrices,
+ // but for now it isn't accounted for
+ size_t joint_count = skin_info.mJointNames.size();
+ for (size_t i = 0; i< joint_count;i++)
+ {
+ const std::string& joint = skin_info.mJointNames[i];
+ if (skin_info.mInvBindMatrix.size() > i)
+ {
+ inv_bind[joint] = skin_info.mInvBindMatrix[i];
+ }
+ if (skin_info.mAlternateBindMatrix.size() > i)
+ {
+ alt_bind[joint] = skin_info.mAlternateBindMatrix[i];
+ }
+ }
+ }
+
+ file << "Inv Bind matrices.\n";
+ for (auto& bind : inv_bind)
+ {
+ file << "Joint: " << bind.first << " Matrix: " << bind.second << "\n";
+ }
+
+ file << "Alt Bind matrices.\n";
+ for (auto& bind : alt_bind)
+ {
+ file << "Joint: " << bind.first << " Matrix: " << bind.second << "\n";
+ }
+}
//called in the main thread
void LLModelLoader::loadTextures()