Removed unneeded duplicate of blank sky skybox

Fixed various inspector field editor button icons
Fixed drag-n-drop apply logic for material assets
Fixed up some convex shape editor material references
Fixed tools overlay gui profile opaqueness flag
Fixed uvEditor image asset binding/lookups
Fixed decal editor preview display
Fixed shape editor would you like to save your changes prompt
Added additional sanity check for bad material reference in tsMesh
Fixed saving of terrain asset when working in editor default level
This commit is contained in:
Areloch 2021-08-06 01:06:36 -05:00
parent c5d0310bc3
commit c76c5f7ee1
31 changed files with 109 additions and 121 deletions

View file

@ -492,6 +492,12 @@ function AssetBrowser::onMaterialAssetEditorDropped(%this, %assetDef, %position)
%obj.materialSlot0 = %assetDef.getAssetId();
echo("MaterialSlot0 set to " @ %assetDef.getAssetId());
}
else if(%obj.isField("materialAsset"))
{
%obj.materialAsset = %assetDef.getAssetId();
echo("materialAsset set to " @ %assetDef.getAssetId());
}
%obj.inspectPostApply();
}
EWorldEditor.isDirty = true;
@ -512,9 +518,9 @@ function GuiInspectorTypeMaterialAssetPtr::onControlDropped( %this, %payload, %p
if(%assetType $= "MaterialAsset")
{
//%assetDef = AssetDatabase.acquireAsset(%module @ ":" @ %assetName);
%this.setMaterialAsset(%module @ ":" @ %assetName);
%cmd = %this @ ".apply(\""@ %module @ ":" @ %assetName @ "\");";
echo("Changing asset via the " @ %cmd @ " command");
eval(%cmd);
}
EWorldEditor.isDirty = true;

View file

@ -3,21 +3,6 @@
// Copyright GarageGames, LLC 2011
//-----------------------------------------------------------------------------
singleton CubemapData( BlankSkyCubemap )
{
cubeFace[0] = "./skybox_1";
cubeFace[1] = "./skybox_2";
cubeFace[2] = "./skybox_3";
cubeFace[3] = "./skybox_4";
cubeFace[4] = "./skybox_5";
cubeFace[5] = "./skybox_6";
};
singleton Material( BlankSkyMat )
{
cubemap = BlankSkyCubemap;
};
singleton Material(White)
{
diffuseMapAsset[0] = "ToolsModule:white_image";

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

View file

@ -1,8 +0,0 @@
<ImageAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="skybox_1_image"
imageFile="@assetFile=skybox_1.jpg"
UseMips="true"
isHDRImage="false"
imageType="Albedo" />

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

View file

@ -1,8 +0,0 @@
<ImageAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="skybox_2_image"
imageFile="@assetFile=skybox_2.jpg"
UseMips="true"
isHDRImage="false"
imageType="Albedo" />

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

View file

@ -1,8 +0,0 @@
<ImageAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="skybox_3_image"
imageFile="@assetFile=skybox_3.jpg"
UseMips="true"
isHDRImage="false"
imageType="Albedo" />

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

View file

@ -1,8 +0,0 @@
<ImageAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="skybox_4_image"
imageFile="@assetFile=skybox_4.jpg"
UseMips="true"
isHDRImage="false"
imageType="Albedo" />

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

View file

@ -1,8 +0,0 @@
<ImageAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="skybox_5_image"
imageFile="@assetFile=skybox_5.jpg"
UseMips="true"
isHDRImage="false"
imageType="Albedo" />

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

View file

@ -1,8 +0,0 @@
<ImageAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="skybox_6_image"
imageFile="@assetFile=skybox_6.jpg"
UseMips="true"
isHDRImage="false"
imageType="Albedo" />

View file

@ -209,14 +209,14 @@ function ConvexEditorPlugin::onSaveMission( %this, %missionFile )
function ConvexEditorPlugin::initSettings( %this )
{
EditorSettings.beginGroup( "ConvexEditor", true );
EditorSettings.setDefaultValue( "MaterialName", "Grid_512_Orange" );
EditorSettings.setDefaultValue( "MaterialName", "Prototyping:WallOrange" );
EditorSettings.endGroup();
}
function ESettingsWindow::getConvexEditorSettings(%this)
{
SettingsInspector.startGroup("General");
SettingsInspector.addSettingsField("ConvexEditor/MaterialName", "Default Material Name", "string", "");
SettingsInspector.addSettingsField("ConvexEditor/MaterialName", "Default Material Asset Name", "TypeMaterialAssetId", "");
SettingsInspector.endGroup();
}

View file

@ -100,7 +100,7 @@ function DecalEditorGui::syncNodeDetails( %this )
return;
%lookupName = DecalEditorGui.getDecalLookupName( %decalId );
DecalEditorGui.updateInstancePreview( %lookupName.material );
DecalEditorGui.updateInstancePreview( %lookupName.materialAsset );
DecalEditorDetailContainer-->instanceId.setText(%decalId @ " " @ %lookupName);
%transformData = DecalEditorGui.getDecalTransform(%decalId);
@ -131,7 +131,7 @@ function DecalDataList::onSelect( %this, %id, %text )
//Canvas.pushDialog( DecalEditDlg );
DecalInspector.inspect( %data );
DecalEditorGui.updateDecalPreview( %data.material );
DecalEditorGui.updateDecalPreview( %data.materialAsset );
}
function RetargetDecalButton::onClick( %this )
@ -295,7 +295,7 @@ function DecalEditorTreeView::addNodeTree(%this, %nodeName, %parentName)
function DecalInspector::onInspectorFieldModified( %this, %object, %fieldName, %arrayIndex, %oldValue, %newValue )
{
if( %fieldName $= "Material" )
if( %fieldName $= "Material" || %fieldName $= "MaterialAsset")
DecalEditorGui.updateDecalPreview( %newValue );
// Same work to do as for the regular WorldEditor Inspector.
@ -322,17 +322,50 @@ function DecalInspector::removeDirty()
function DecalEditorGui::updateDecalPreview( %this, %material )
{
if( isObject( %material ) )
DecalPreviewWindow-->decalPreview.setBitmap( MaterialEditorGui.searchForTexture( %material.getId(), %material.diffuseMap[0]) );
{
DecalPreviewWindow-->decalPreview.setBitmap( %material.getDiffuseMap(0) );
}
else
DecalPreviewWindow-->decalPreview.setBitmap("tools/materialEditor/gui/unknownImage");
{
if(AssetDatabase.isDeclaredAsset(%material))
{
%assetDef = AssetDatabase.acquireAsset(%material);
%difMap = %assetDef.materialDefinitionName.getDiffuseMap(0);
AssetDatabase.acquireAsset(%material);
if(%difMap !$= "" && %difMap !$= "Core_Rendering:missingTexture")
{
DecalPreviewWindow-->decalPreview.setBitmap( %difMap );
return;
}
}
DecalPreviewWindow-->decalPreview.setBitmap("ToolsModule:unknownImage_image");
}
}
function DecalEditorGui::updateInstancePreview( %this, %material )
{
if( isObject( %material ) )
DecalPreviewWindow-->instancePreview.setBitmap( MaterialEditorGui.searchForTexture( %material.getId(), %material.diffuseMap[0]) );
{
DecalPreviewWindow-->instancePreview.setBitmap( %material.getDiffuseMap(0) );
}
else
DecalPreviewWindow-->instancePreview.setBitmap("tools/materialEditor/gui/unknownImage");
{
if(AssetDatabase.isDeclaredAsset(%material))
{
%assetDef = AssetDatabase.acquireAsset(%material);
%difMap = %assetDef.materialDefinitionName.getDiffuseMap(0);
AssetDatabase.acquireAsset(%material);
if(%difMap !$= "" && %difMap !$= "Core_Rendering:missingTexture")
{
DecalPreviewWindow-->instancePreview.setBitmap( %difMap );
return;
}
}
DecalPreviewWindow-->instancePreview.setBitmap("ToolsModule:unknownImage_image");
}
}
function DecalEditorGui::rebuildInstanceTree( %this )

View file

@ -479,7 +479,7 @@ new GuiControlProfile( ToolsGuiScrollProfile )
if( !isObject( ToolsGuiOverlayProfile ) )
new GuiControlProfile( ToolsGuiOverlayProfile )
{
opaque = true;
opaque = false;
fillColor = EditorSettings.value("Theme/windowBackgroundColor");
fontColor = EditorSettings.value("Theme/fieldTextColor");
fontColorHL = EditorSettings.value("Theme/fieldTextGLColor");

View file

@ -499,37 +499,19 @@ function UVEditor::showDialog( %this, %applyCallback, %obj, %uv)
// Get the preview bitmap. Code copied from Material Selector.
%material = %obj.material;
if( %material.toneMap[0] $= "" && %material.diffuseMap[0] $= "" && !isObject(%material.cubemap) )
if( %material.getToneMap(0) $= "" && %material.getDiffuseMap(0) $= "" && !isObject(%material.cubemap) )
{
%previewImage = "core/images/warnmat";
}
else
{
if( %material.toneMap[0] !$= "" )
%previewImage = %material.toneMap[0];
else if( %material.diffuseMap[0] !$= "" )
%previewImage = %material.diffuseMap[0];
%previewImage = %material.getToneMap(0);
else if( %material.getDiffuseMap(0) !$= "" )
%previewImage = %material.getDiffuseMap(0);
else if( %material.cubemap.cubeFace[0] !$= "" )
%previewImage = %material.cubemap.cubeFace[0];
%materialDiffuse = %previewImage;
%materialPath = %material.getFilename();
if( strchr( %materialDiffuse, "/") $= "" )
{
%k = 0;
while( strpos( %materialPath, "/", %k ) != -1 )
{
%foo = strpos( %materialPath, "/", %k );
%k = %foo + 1;
}
%foobar = getSubStr( %materialPath , %k , 99 );
%previewImage = strreplace( %materialPath, %foobar, %previewImage );
}
else
%previewImage = strreplace( %materialPath, %materialPath, %previewImage );
}
UVEditor-->bitmapPreview.setBitmap(%previewImage);
// Set up the color popup

View file

@ -4748,7 +4748,7 @@
tooltip = "Create New Material";
buttonType = "PushButton";
useMouseEvents = "0";
bitmap = "tools/gui/images/new";
bitmap = "ToolsModule:new_n_image";
};
// Save Button
new GuiBitmapButtonCtrl() {

View file

@ -589,6 +589,14 @@ function MaterialEditorGui::searchForTexture(%this,%material, %texture)
{
if( %texture !$= "" )
{
if(AssetDatabase.isDeclaredAsset(%texture))
{
%assetDef = AssetDatabase.acquireAsset(%texture);
%imagePath = %assetDef.getImagePath();
AssetDatabase.releaseAsset(%texture);
return %imagePath;
}
// set the find signal as false to start out with
%isFile = false;
// sete the formats we're going to be looping through if need be

View file

@ -270,8 +270,9 @@ function ShapeEdSelectWindow::onSelect( %this, %path )
// Prompt user to save the old shape if it is dirty
if ( ShapeEditor.isDirty() )
{
%cmd = "showImportDialog( \"" @ %path @ "\", \"ShapeEditor.selectShape( \\\"" @ %path @ "\\\", ";
toolsMessageBoxYesNoCancel( "Shape Modified", "Would you like to save your changes?", %cmd @ "true );\" );", %cmd @ "false );\" );" );
%cmdY = "showImportDialog( \"" @ %path @ "\", \"ShapeEditor.selectShape( \"" @ %path @ "\", true)\" );";
%cmdN = "showImportDialog( \"" @ %path @ "\", \"ShapeEditor.selectShape( \"" @ %path @ "\", false)\" );";
toolsMessageBoxYesNoCancel( "Shape Modified", "Would you like to save your changes?", %cmdY, %cmdN,"" );
}
else
{

View file

@ -246,6 +246,27 @@ function EditorSaveAsDefaultLevel()
function doEditorSaveAsDefaultLevel()
{
%success = getScene(0).save("tools/levels/DefaultEditorLevel.mis");
if(ETerrainEditor.isDirty)
{
// Find all of the terrain files
initContainerTypeSearch($TypeMasks::TerrainObjectType);
while ((%terrainObject = containerSearchNext()) != 0)
{
if(%terrainObject.terrainAsset !$= "")
{
//we utilize a terrain asset, so we'll update our dependencies while we're at it
%terrainObject.saveAsset();
}
else
{
%terrainObject.save(%terrainObject.terrainFile);
}
}
}
ETerrainPersistMan.saveDirty();
}
function EditorResetDefaultLevel()