Browse Source

set preview image

set the image asset preview image for namedTargets
marauder2k7 6 months ago
parent
commit
16d219769f

+ 8 - 0
Engine/source/T3D/assets/ImageAsset.cpp

@@ -649,6 +649,14 @@ DefineEngineMethod(ImageAsset, getImageInfo, const char*, (), ,
    return object->getImageInfo();
    return object->getImageInfo();
 }
 }
 
 
+DefineEngineMethod(ImageAsset, isNamedTarget, bool, (), ,
+   "Gets whether this image is a named target.\n"
+   "@return bool for isNamedTarget.")
+{
+   return object->isNamedTarget();
+}
+
+
 #ifdef TORQUE_TOOLS
 #ifdef TORQUE_TOOLS
 DefineEngineStaticMethod(ImageAsset, getAssetIdByFilename, const char*, (const char* filePath), (""),
 DefineEngineStaticMethod(ImageAsset, getAssetIdByFilename, const char*, (const char* filePath), (""),
    "Queries the Asset Database to see if any asset exists that is associated with the provided file path.\n"
    "Queries the Asset Database to see if any asset exists that is associated with the provided file path.\n"

+ 2 - 2
Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/image.tscript

@@ -179,8 +179,8 @@ function AssetBrowser::buildImageAssetPreview(%this, %assetDef, %previewData)
 {
 {
    //%module = %this.dirHandler.getModuleFromAddress(makeRelativePath(filePath(%assetDef.getImagePath())));
    //%module = %this.dirHandler.getModuleFromAddress(makeRelativePath(filePath(%assetDef.getImagePath())));
       
       
-   %previewData.previewImage = "ToolsModule:genericAssetIcon_image";
-   %previewData.previewLoaded = false; //this marks it for loading progressively later
+   %previewData.previewImage = %assetDef.isNamedTarget() ? "Core_Rendering:namedTarget_image" : "ToolsModule:genericAssetIcon_image";
+   %previewData.previewLoaded = %assetDef.isNamedTarget() ? true : false; //if image target we are loaded, else mark for loading later.
    
    
    %previewData.assetName = %assetDef.assetName;
    %previewData.assetName = %assetDef.assetName;
    %previewData.assetPath = %assetDef.scriptFile;
    %previewData.assetPath = %assetDef.scriptFile;