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

Method setPreviewImage

Engine/source/T3D/assets/ImageAsset.cpp:712–742  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

710}
711
712void GuiInspectorTypeImageAssetPtr::setPreviewImage(StringTableEntry assetId)
713{
714 //if what we're working with isn't even a valid asset, don't present like we found a good one
715 if (!AssetDatabase.isDeclaredAsset(assetId))
716 {
717 mPreviewImage->_setBitmap(StringTable->EmptyString());
718 return;
719 }
720
721 String imgPreviewAssetId = String(assetId) + "_PreviewImage";
722 imgPreviewAssetId.replace(":", "_");
723 imgPreviewAssetId = "ToolsModule:" + imgPreviewAssetId;
724 if (AssetDatabase.isDeclaredAsset(imgPreviewAssetId.c_str()))
725 {
726 mPreviewImage->setBitmap(StringTable->insert(imgPreviewAssetId.c_str()));
727 }
728 else
729 {
730 if (AssetDatabase.isDeclaredAsset(assetId))
731 {
732 ImageAsset* imgAsset = AssetDatabase.acquireAsset<ImageAsset>(assetId);
733 if (imgAsset && imgAsset->isAssetValid())
734 {
735 mPreviewImage->_setBitmap(imgAsset->getAssetId());
736 }
737 }
738 }
739
740 if (mPreviewImage->getBitmapAsset().isNull())
741 mPreviewImage->_setBitmap(StringTable->insert("ToolsModule:genericAssetIcon_image"));
742}
743
744IMPLEMENT_CONOBJECT(GuiInspectorTypeImageAssetId);
745

Callers

nothing calls this directly

Calls 11

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

Tested by

no test coverage detected