MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / setPreviewImage

Method setPreviewImage

Engine/source/T3D/assets/MaterialAsset.cpp:639–669  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

637}
638
639void GuiInspectorTypeMaterialAssetPtr::setPreviewImage(StringTableEntry assetId)
640{
641 //if what we're working with isn't even a valid asset, don't present like we found a good one
642 if (!AssetDatabase.isDeclaredAsset(assetId))
643 {
644 mPreviewImage->_setBitmap(StringTable->EmptyString());
645 return;
646 }
647
648 String matPreviewAssetId = String(assetId) + "_PreviewImage";
649 matPreviewAssetId.replace(":", "_");
650 matPreviewAssetId = "ToolsModule:" + matPreviewAssetId;
651 if (AssetDatabase.isDeclaredAsset(matPreviewAssetId.c_str()))
652 {
653 mPreviewImage->setBitmap(StringTable->insert(matPreviewAssetId.c_str()));
654 }
655 else
656 {
657 if (AssetDatabase.isDeclaredAsset(assetId))
658 {
659 MaterialAsset* matAsset = AssetDatabase.acquireAsset<MaterialAsset>(assetId);
660 if (matAsset && matAsset->getMaterialDefinition())
661 {
662 mPreviewImage->_setBitmap(matAsset->getMaterialDefinition()->mDiffuseMapAssetId[0]);
663 }
664 }
665 }
666
667 if (mPreviewImage->getBitmapAsset().isNull())
668 mPreviewImage->_setBitmap(StringTable->insert("ToolsModule:genericAssetIcon_image"));
669}
670
671IMPLEMENT_CONOBJECT(GuiInspectorTypeMaterialAssetId);
672

Callers

nothing calls this directly

Calls 10

isDeclaredAssetMethod · 0.80
_setBitmapMethod · 0.80
EmptyStringMethod · 0.80
replaceMethod · 0.80
StringClass · 0.50
c_strMethod · 0.45
setBitmapMethod · 0.45
insertMethod · 0.45
getMaterialDefinitionMethod · 0.45
isNullMethod · 0.45

Tested by

no test coverage detected