From d813be4ea0174a22dda907e563022d4dc3cd3bfd Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Tue, 23 Sep 2025 08:41:38 -0500 Subject: [PATCH] allow the addmesh command to take shapeassets as an entry --- Engine/source/ts/tsShapeConstruct.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Engine/source/ts/tsShapeConstruct.cpp b/Engine/source/ts/tsShapeConstruct.cpp index 1db3c9db9..8b38d44e5 100644 --- a/Engine/source/ts/tsShapeConstruct.cpp +++ b/Engine/source/ts/tsShapeConstruct.cpp @@ -1535,9 +1535,27 @@ DefineTSShapeConstructorMethod(addMesh, bool, (const char* meshName, const char* "%this.addMesh( \"SimpleShape10\", \"./testShape.dae\", \"MyMesh2\", "" );\n" "@endtsexample\n") { + const char* targShape = StringTable->EmptyString(); + + bool found = false; + + if (AssetDatabase.isDeclaredAsset(srcShape)) + { + ShapeAsset* assetShape = AssetDatabase.acquireAsset(srcShape); + if (assetShape) + { + targShape = assetShape->getShapeFile(); + //Con::printf("Found assetID %s for assetName %s; shape file path %s", assetShape->getAssetId(), srcShape, targShape); + found = true; + } + } + + if (!found) + targShape = srcShape; + // Load the shape source file char filenameBuf[1024]; - Con::expandScriptFilename(filenameBuf, sizeof(filenameBuf), srcShape); + Con::expandScriptFilename(filenameBuf, sizeof(filenameBuf), targShape); Resource hSrcShape = ResourceManager::get().load(filenameBuf); if (!bool(hSrcShape))