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

@ -261,13 +261,13 @@ GuiControl* GuiInspectorTypeGUIAssetPtr::constructEditControl()
dSprintf(szBuffer, sizeof(szBuffer), "echo(\"Game Object Editor not implemented yet!\");", retCtrl->getId());
mSMEdButton->setField("Command", szBuffer);
char bitmapName[512] = "tools/worldEditor/images/toolbar/shape-editor";
char bitmapName[512] = "ToolsModule:GameTSCtrl_image";
mSMEdButton->setBitmap(StringTable->insert(bitmapName));
mSMEdButton->setDataField(StringTable->insert("Profile"), NULL, "GuiButtonProfile");
mSMEdButton->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile");
mSMEdButton->setDataField(StringTable->insert("hovertime"), NULL, "1000");
mSMEdButton->setDataField(StringTable->insert("tooltip"), NULL, "Open this file in the State Machine Editor");
mSMEdButton->setDataField(StringTable->insert("tooltip"), NULL, "Open this file in the GUI Editor");
mSMEdButton->registerObject();
addObject(mSMEdButton);

View file

@ -508,7 +508,7 @@ GuiControl* GuiInspectorTypeImageAssetPtr::constructEditControl()
dSprintf(szBuffer, sizeof(szBuffer), "ShapeEditorPlugin.openShapeAssetId(%d.getText());", retCtrl->getId());
mImageEdButton->setField("Command", szBuffer);
char bitmapName[512] = "tools/worldEditor/images/toolbar/shape-editor";
char bitmapName[512] = "ToolsModule:GameTSCtrl_image";
mImageEdButton->setBitmap(StringTable->insert(bitmapName));
mImageEdButton->setDataField(StringTable->insert("Profile"), NULL, "GuiButtonProfile");

View file

@ -388,13 +388,13 @@ GuiControl* GuiInspectorTypeMaterialAssetPtr::constructEditControl()
dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.editAsset(%d.getText());", retCtrl->getId());
mEditButton->setField("Command", szBuffer);
char bitmapName[512] = "tools/worldEditor/images/toolbar/material-editor";
char bitmapName[512] = "ToolsModule:material_editor_n_image";
mEditButton->setBitmap(StringTable->insert(bitmapName));
mEditButton->setDataField(StringTable->insert("Profile"), NULL, "GuiButtonProfile");
mEditButton->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile");
mEditButton->setDataField(StringTable->insert("hovertime"), NULL, "1000");
mEditButton->setDataField(StringTable->insert("tooltip"), NULL, "Open this file in the Material Editor");
mEditButton->setDataField(StringTable->insert("tooltip"), NULL, "Open this asset in the Material Editor");
mEditButton->registerObject();
addObject(mEditButton);

View file

@ -612,7 +612,7 @@ GuiControl* GuiInspectorTypeShapeAssetPtr::constructEditControl()
dSprintf(szBuffer, sizeof(szBuffer), "ShapeEditorPlugin.openShapeAssetId(%d.getText());", retCtrl->getId());
mShapeEdButton->setField("Command", szBuffer);
char bitmapName[512] = "tools/worldEditor/images/toolbar/shape-editor";
char bitmapName[512] = "ToolsModule:shape_editor_n_image";
mShapeEdButton->setBitmap(StringTable->insert(bitmapName));
mShapeEdButton->setDataField(StringTable->insert("Profile"), NULL, "GuiButtonProfile");

View file

@ -467,7 +467,7 @@ GuiControl* GuiInspectorTypeTerrainAssetPtr::constructEditControl()
mShapeEdButton->setField("Command", "EditorGui.setEditor(TerrainEditorPlugin);");
char bitmapName[512] = "tools/worldEditor/images/toolbar/shape-editor";
char bitmapName[512] = "ToolsModule:TerrainBlock_image";
mShapeEdButton->setBitmap(StringTable->insert(bitmapName));
mShapeEdButton->setDataField(StringTable->insert("Profile"), NULL, "GuiButtonProfile");

View file

@ -244,7 +244,7 @@ GuiControl* GuiInspectorTypeTerrainMaterialAssetPtr::constructEditControl()
TerrainMaterial* materialDef = nullptr;
char bitmapName[512] = "tools/worldEditor/images/toolbar/shape-editor";
char bitmapName[512] = "ToolsModule:material_editor_n_image";
/*if (!Sim::findObject(matAsset->getMaterialDefinitionName(), materialDef))
{
@ -271,7 +271,7 @@ GuiControl* GuiInspectorTypeTerrainMaterialAssetPtr::constructEditControl()
StringBuilder strbld;
strbld.append(matAsset->getMaterialDefinitionName());
strbld.append("\n");
strbld.append("Open this file in the Material Editor");
strbld.append("Open this asset in the Material Editor");
mMatPreviewButton->setDataField(StringTable->insert("tooltip"), NULL, strbld.data());

View file

@ -53,7 +53,7 @@ DefineNewEngineMethod(SimObject, InspectPreApply, void, (), , "")
object->inspectPreApply();
}
DefineNewEngineMethod(SimObject, InspectPostApply, void, (), , "")
DefineEngineMethod(SimObject, InspectPostApply, void, (), , "")
{
object->inspectPostApply();
}

View file

@ -84,7 +84,7 @@ GuiConvexEditorCtrl::GuiConvexEditorCtrl()
mCtrlDown( false ),
mGridSnap(false)
{
mMaterialName = StringTable->insert("Grid512_OrangeLines_Mat");
mMaterialName = StringTable->insert("Prototyping:WallOrange");
}
GuiConvexEditorCtrl::~GuiConvexEditorCtrl()
@ -115,7 +115,7 @@ void GuiConvexEditorCtrl::onRemove()
void GuiConvexEditorCtrl::initPersistFields()
{
addField( "isDirty", TypeBool, Offset( mIsDirty, GuiConvexEditorCtrl ) );
addField( "materialName", TypeString, Offset(mMaterialName, GuiConvexEditorCtrl) );
addField( "materialName", TypeMaterialAssetId, Offset(mMaterialName, GuiConvexEditorCtrl) );
Parent::initPersistFields();
}
@ -249,13 +249,13 @@ void GuiConvexEditorCtrl::setVisible( bool val )
//Set the texture to a representatory one so we know what's what
if (isTrigger)
proxyShape->mMaterialName = "TriggerProxyMaterial";
proxyShape->mMaterialName = "ToolsModule:TriggerProxyMaterial";
else if (isPortal)
proxyShape->mMaterialName = "PortalProxyMaterial";
proxyShape->mMaterialName = "ToolsModule:PortalProxyMaterial";
else if (isZone)
proxyShape->mMaterialName = "ZoneProxyMaterial";
proxyShape->mMaterialName = "ToolsModule:ZoneProxyMaterial";
else if (isOccluder)
proxyShape->mMaterialName = "OccluderProxyMaterial";
proxyShape->mMaterialName = "ToolsModule:OccluderProxyMaterial";
proxyShape->_updateMaterial();
@ -1459,7 +1459,7 @@ bool GuiConvexEditorCtrl::isShapeValid( ConvexShape *shape )
void GuiConvexEditorCtrl::setupShape( ConvexShape *shape )
{
shape->setField( "material", mMaterialName );
shape->setField( "materialAsset", mMaterialName );
shape->registerObject();
updateShape( shape );
@ -2284,7 +2284,7 @@ ConvexEditorTool::EventResult ConvexEditorCreateTool::on3DMouseDown( const Gui3D
mNewConvex->setTransform( objMat );
mNewConvex->setField( "material", Parent::mEditor->mMaterialName );
mNewConvex->setField( "materialAsset", Parent::mEditor->mMaterialName );
mNewConvex->registerObject();
mPlaneSizes.set( 0.1f, 0.1f, 0.1f );
@ -2509,7 +2509,7 @@ ConvexShape* ConvexEditorCreateTool::extrudeShapeFromFace( ConvexShape *inShape,
}
//newShape->setField( "material", Parent::mEditor->mMaterialName );
newShape->setField("material", inShape->getMaterialName());
newShape->setField("materialAsset", inShape->getMaterialName());
newShape->registerObject();
mEditor->updateShape( newShape );

View file

@ -264,7 +264,7 @@ void TSMesh::innerRender( TSMaterialList *materials, const TSRenderState &rdata,
// If we don't have a material instance after the overload then
// there is nothing to render... skip this primitive.
matInst = state->getOverrideMaterial( matInst );
if ( !matInst || !matInst->isValid())
if ( !matInst || !matInst->isValid() || !matInst->getMaterial())
continue;
// If the material needs lights then gather them

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()