Merge pull request #1659 from Azaezel/alpha41/decalInstPreview
Some checks are pending
Linux Build / ${{matrix.config.name}} (map[build_type:Release cc:gcc cxx:g++ generator:Ninja name:Ubuntu Latest GCC]) (push) Waiting to run
MacOSX Build / ${{matrix.config.name}} (map[build_type:Release cc:clang cxx:clang++ generator:Ninja name:MacOSX Latest Clang]) (push) Waiting to run
Windows Build / ${{matrix.config.name}} (map[build_type:Release cc:cl cxx:cl environment_script:C:/Program Files (x86)/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat generator:Visual Studio 17 2022 name:Windows Latest MSVC]) (push) Waiting to run

fix decal instance preview
This commit is contained in:
Brian Roberts 2026-01-19 21:37:15 -06:00 committed by GitHub
commit 6e96c0510d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -350,6 +350,13 @@ function DecalEditorGui::completeGizmoTransform( %this, %decalId, %nodeDetails )
function DecalEditorGui::onSleep( %this )
{
DecalEditorTreeView.clearSelection();
DecalDataList.setSelected( DecalDataList.getSelectedItems(), false );
DecalEditorGui.currentDecalData = "";
DecalPreviewWindow-->decalPreview.setBitmap("");
DecalEditorGui.selDecalInstanceId = "";
DecalPreviewWindow-->instancePreview.setBitmap("");
}
function DecalEditorGui::syncNodeDetails( %this )
@ -629,14 +636,30 @@ function DecalEditorGui::updateInstancePreview( %this, %material )
if( isObject( %material ) )
{
%previewImage = %material.getDiffuseMap(0);
%previewImage = %material.getDiffuseMapAsset(0);
}
else
else if(AssetDatabase.isDeclaredAsset(%material))
{
if(AssetDatabase.isDeclaredAsset(%material))
if(AssetDatabase.getAssetType(%material) $= "MaterialAsset")
{
%matAsset = AssetDatabase.acquireAsset(%material);
%previewImage = %matAsset.materialDefinitionName.getDiffuseMap(0);
}
else if(AssetDatabase.getAssetType(%material) $= "ImageAsset")
{
%previewImage = %material;
}
else
{
error("DecalEditorGui::updateDecalPreview() - Tried to set an invalid asset type for the editor preview!");
return;
}
}
else
{
error("DecalEditorGui::updateDecalPreview() - Tried to set a non material, non asset value for the editor preview!");
return;
}
DecalPreviewWindow-->instancePreview.setBitmap( getAssetPreviewImage(%previewImage) );