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

Method updatePreviewImage

Engine/source/T3D/assets/ShapeAsset.cpp:873–898  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

871}
872
873void GuiInspectorTypeShapeAssetPtr::updatePreviewImage()
874{
875 const char* previewImage;
876 if (mInspector->getInspectObject() != nullptr)
877 previewImage = mInspector->getInspectObject()->getDataField(mCaption, NULL);
878 else
879 previewImage = Con::getVariable(mVariableName);
880
881 //if what we're working with isn't even a valid asset, don't present like we found a good one
882 if (!AssetDatabase.isDeclaredAsset(previewImage))
883 {
884 mPreviewImage->_setBitmap(StringTable->EmptyString());
885 return;
886 }
887
888 String shpPreviewAssetId = String(previewImage) + "_PreviewImage";
889 shpPreviewAssetId.replace(":", "_");
890 shpPreviewAssetId = "ToolsModule:" + shpPreviewAssetId;
891 if (AssetDatabase.isDeclaredAsset(shpPreviewAssetId.c_str()))
892 {
893 mPreviewImage->setBitmap(StringTable->insert(shpPreviewAssetId.c_str()));
894 }
895
896 if (mPreviewImage->getBitmapAsset().isNull())
897 mPreviewImage->_setBitmap(StringTable->insert("ToolsModule:genericAssetIcon_image"));
898}
899
900void GuiInspectorTypeShapeAssetPtr::setPreviewImage(StringTableEntry assetId)
901{

Callers

nothing calls this directly

Calls 11

getVariableFunction · 0.85
getDataFieldMethod · 0.80
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
isNullMethod · 0.45

Tested by

no test coverage detected