mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
fix material editor
material editor now handles named targets propertly when loading also update preview image in material editor
This commit is contained in:
parent
16d219769f
commit
e1a2a6d9f9
|
|
@ -2772,6 +2772,7 @@ function AssetBrowser::importLooseFiles(%this)
|
|||
|
||||
function getAssetPreviewImage(%asset)
|
||||
{
|
||||
echo(%asset);
|
||||
if(isFile(%asset))
|
||||
{
|
||||
%aq = new AssetQuery();
|
||||
|
|
@ -2793,7 +2794,7 @@ function getAssetPreviewImage(%asset)
|
|||
%moduleName = AssetDatabase.getAssetModule(%asset).ModuleId;
|
||||
%assetName = AssetDatabase.getAssetName(%asset);
|
||||
%previewAssetName = "ToolsModule:" @ %moduleName @ "_" @ %assetName @ "_PreviewImage";
|
||||
|
||||
echo(%previewAssetName);
|
||||
if(AssetDatabase.isDeclaredAsset(%previewAssetName))
|
||||
{
|
||||
%previewDef = AssetDatabase.acquireAsset(%previewAssetName);
|
||||
|
|
|
|||
|
|
@ -747,8 +747,8 @@ function MaterialEditorGui::setActiveMaterial( %this, %material )
|
|||
|
||||
// we create or recreate a material to hold in a pristine state
|
||||
// or, this crashes the ap. fix properly - BJR
|
||||
// if(isObject(notDirtyMaterial))
|
||||
// notDirtyMaterial.delete();
|
||||
//if(isObject(notDirtyMaterial))
|
||||
// notDirtyMaterial.delete();
|
||||
|
||||
singleton Material(notDirtyMaterial)
|
||||
{
|
||||
|
|
@ -860,16 +860,27 @@ function MaterialEditorGui::convertTextureFields(%this)
|
|||
}
|
||||
|
||||
function MaterialEditorGui::convertMaterialTextureField(%this, %material, %mapName)
|
||||
{
|
||||
{
|
||||
for(%index = 0; %index < 4; %index++)
|
||||
{
|
||||
%mapFile = %material.call("get" @ %mapName, %index);
|
||||
if(%mapFile !$= "" && !isFile(%mapFile))
|
||||
{
|
||||
//see if we can't go finding it
|
||||
%mapFile = MaterialEditorGui.searchForTexture(MaterialEditorGui.currentMaterial, %mapFile);
|
||||
MaterialEditorGui.currentMaterial.call("set" @ %mapName, %mapFile, %index);
|
||||
}
|
||||
{
|
||||
if(isFile(%mapFile))
|
||||
{
|
||||
//see if we can't go finding it
|
||||
%mapFile = MaterialEditorGui.searchForTexture(MaterialEditorGui.currentMaterial, %mapFile);
|
||||
MaterialEditorGui.currentMaterial.call("set" @ %mapName, %mapFile, %index);
|
||||
}
|
||||
else
|
||||
{
|
||||
%assetPtr = %material.call("get" @ %mapName @ "Asset", %index);
|
||||
if(%assetPtr.isNamedTarget())
|
||||
{
|
||||
MaterialEditorGui.currentMaterial.call("set" @ %mapName, %assetPtr, %index);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1088,8 +1099,9 @@ function MaterialEditorGui::guiSync( %this, %material )
|
|||
//Diffuse
|
||||
%diffuseMap = (%material).getDiffuseMap(%layer);
|
||||
%diffuseMapText = %diffuseMap !$= "" && %diffuseMap !$=$MaterialEditor::emptyMaterialImage ? (%material).getDiffuseMapAsset(%layer) : "None";
|
||||
|
||||
MaterialEditorPropertiesWindow-->diffuseMapNameText.setText( %diffuseMapText );
|
||||
MaterialEditorPropertiesWindow-->diffuseMapDisplayBitmap.setBitmap( getAssetPreviewImage(%diffuseMap) );
|
||||
MaterialEditorPropertiesWindow-->diffuseMapDisplayBitmap.setBitmap( getAssetPreviewImage(%diffuseMapText) );
|
||||
|
||||
//Normal
|
||||
%normalMap = (%material).getNormalMap(%layer);
|
||||
|
|
|
|||
Loading…
Reference in a new issue