Implements material asset handling for GroundPlane object

Adds handling for finding material asset akin to shape and image assets
Updates the material asset inspector field to follow the current standard
Updates prototyping material assets to correctly have materialDefinitionName assigned
Fixed material asset import step to properly assign materialDefinitionName
Fixed typo in material editor icon name
Added logic to editAsset function call so it can also parse assetIds
Changed DefaultEditorLevel to utilize FloorGray material
Adds proper NoMaterial asset for fallback purposes
This commit is contained in:
Areloch 2020-11-01 23:32:34 -06:00
parent 302a64edd1
commit 388a700a53
26 changed files with 279 additions and 127 deletions

View file

@ -0,0 +1,6 @@
<MaterialAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="NoMaterial"
scriptFile="@assetFile=NoMaterial.cs"
materialDefinitionName="NoMaterial" />

View file

@ -0,0 +1,6 @@
//--- OBJECT WRITE BEGIN ---
singleton Material(NoMaterial) {
mapTo="NoMaterial";
DiffuseMap = "core/rendering/images/warnMat";
};
//--- OBJECT WRITE END ---

View file

@ -3,5 +3,6 @@
canSaveDynamicFields="true"
AssetName="DetailBlue"
scriptFile="@assetFile=DetailBlue.cs"
materialDefinitionName="DetailBlue"
imageMap0="@Asset=Prototyping:DetailBlue_ALBEDO"
originalFilePath="D:/Gamedev/art/Blockout/DetailBlue.png" />

View file

@ -3,5 +3,6 @@
canSaveDynamicFields="true"
AssetName="FloorGray"
scriptFile="@assetFile=FloorGray.cs"
materialDefinitionName="FloorGray"
imageMap0="@Asset=Prototyping:FloorGray_ALBEDO"
originalFilePath="D:/Gamedev/art/Blockout/FloorGray.png" />

View file

@ -3,5 +3,6 @@
canSaveDynamicFields="true"
AssetName="InteractiveRed"
scriptFile="@assetFile=InteractiveRed.cs"
materialDefinitionName="InteractiveRed"
imageMap0="@Asset=Prototyping:InteractiveRed_ALBEDO"
originalFilePath="D:/Gamedev/art/Blockout/InteractiveRed.png" />

View file

@ -3,5 +3,6 @@
canSaveDynamicFields="true"
AssetName="NatureBrown"
scriptFile="@assetFile=NatureBrown.cs"
materialDefinitionName="NatureBrown"
imageMap0="@Asset=Prototyping:NatureBrown_ALBEDO"
originalFilePath="D:/Gamedev/art/Blockout/NatureBrown.png" />

View file

@ -3,5 +3,6 @@
canSaveDynamicFields="true"
AssetName="NatureGreen"
scriptFile="@assetFile=NatureGreen.cs"
materialDefinitionName="NatureGreen"
imageMap0="@Asset=Prototyping:NatureGreen_ALBEDO"
originalFilePath="D:/Gamedev/art/Blockout/NatureGreen.png" />

View file

@ -3,5 +3,6 @@
canSaveDynamicFields="true"
AssetName="NullPink"
scriptFile="@assetFile=NullPink.cs"
materialDefinitionName="NullPink"
imageMap0="@Asset=Prototyping:NullPink_ALBEDO"
originalFilePath="D:/Gamedev/art/Blockout/NullPink.png" />

View file

@ -3,5 +3,6 @@
canSaveDynamicFields="true"
AssetName="TrimYellow"
scriptFile="@assetFile=TrimYellow.cs"
materialDefinitionName="TrimYellow"
imageMap0="@Asset=Prototyping:TrimYellow_ALBEDO"
originalFilePath="D:/Gamedev/art/Blockout/TrimYellow.png" />

View file

@ -3,5 +3,6 @@
canSaveDynamicFields="true"
AssetName="WallOrange"
scriptFile="@assetFile=WallOrange.cs"
materialDefinitionName="WallOrange"
imageMap0="@Asset=Prototyping:WallOrange_ALBEDO"
originalFilePath="D:/Gamedev/art/Blockout/WallOrange.png" />

View file

@ -3,5 +3,6 @@
canSaveDynamicFields="true"
AssetName="WaterBlue"
scriptFile="@assetFile=WaterBlue.cs"
materialDefinitionName="WaterBlue"
imageMap0="@Asset=Prototyping:WaterBlue_ALBEDO"
originalFilePath="D:/Gamedev/art/Blockout/WaterBlue.png" />

View file

@ -3,5 +3,6 @@
canSaveDynamicFields="true"
AssetName="kork_chan"
scriptFile="@assetFile=kork_chan.cs"
materialDefinitionName="kork_chan"
imageMap0="@Asset=Prototyping:kork_chan_ALBEDO"
originalFilePath="D:/Gamedev/T3DMIT/Resources/Prototyping/Shapes" />

View file

@ -458,7 +458,7 @@ function AssetBrowser::buildMaterialAssetPreview(%this, %assetDef, %previewData)
else if(%assetDef.materialDefinitionName.diffuseMapAsset[0] !$= "")
{
%imgAsset = AssetDatabase.acquireAsset(%assetDef.materialDefinitionName.diffuseMapAsset[0]);
%previewData.previewImage = %imgAsset.getImageFilename();
%previewData.previewImage = %imgAsset.getImagePath();
}
else
%previewData.previewImage = "tools/assetBrowser/art/materialIcon";

View file

@ -28,6 +28,12 @@ function AssetBrowser::editAsset(%this, %assetDef)
}
}
}
else if(!isObject(%assetDef) && strchrpos(%assetDef, ":") != -1)
{
//Turns out we were passed an assetid, not an asset definition.
//Grab the asset def from that
%assetDef = AssetDatabase.acquireAsset(%assetDef);
}
%assetType = %assetDef.getClassName();

View file

@ -6,5 +6,5 @@
LevelName="DefaultEditorLevel"
isSubScene="false"
description="An empty room"
staticObjectAssetDependency0="@Asset=FPSGameplay:station01"
staticObjectAssetDependency0="@Asset=Prototyping:FloorGray"
VersionId="1" />

View file

@ -5,6 +5,7 @@ new Scene(EditorTemplateLevel) {
isSubScene = "0";
isEditing = "0";
isDirty = "0";
EditPostEffects = "0";
cdTrack = "2";
CTF_scoreLimit = "5";
Enabled = "1";
@ -35,6 +36,7 @@ new Scene(EditorTemplateLevel) {
Material = "BlankSkyMat";
drawBottom = "0";
fogBandHeight = "0";
dirtyGameObject = "0";
position = "0 0 0";
rotation = "1 0 0 0";
scale = "1 1 1";
@ -48,8 +50,6 @@ new Scene(EditorTemplateLevel) {
ambient = "0.337255 0.533333 0.619608 1";
brightness = "1";
castShadows = "1";
staticRefreshFreq = "250";
dynamicRefreshFreq = "8";
coronaEnabled = "1";
coronaScale = "0.5";
coronaTint = "1 1 1 1";
@ -68,6 +68,7 @@ new Scene(EditorTemplateLevel) {
representedInLightmap = "0";
shadowDarkenColor = "0 0 0 -1";
includeLightmappedGeometryInShadow = "0";
dirtyGameObject = "0";
position = "0 0 0";
rotation = "1 0 0 0";
scale = "1 1 1";
@ -75,6 +76,7 @@ new Scene(EditorTemplateLevel) {
canSaveDynamicFields = "1";
bias = "0.1";
Blur = "1";
dynamicRefreshFreq = "8";
Enabled = "1";
height = "1024";
lightBleedFactor = "0.8";
@ -82,13 +84,15 @@ new Scene(EditorTemplateLevel) {
pointShadowType = "PointShadowType_Paraboloid";
shadowBox = "-100 -100 -100 100 100 100";
splitFadeDistances = "1 1 1 1";
staticRefreshFreq = "250";
width = "3072";
};
new GroundPlane() {
squareSize = "128";
scaleU = "25";
scaleV = "25";
Material = "Grid_512_Grey";
MaterialAsset = "Prototyping:FloorGray";
dirtyGameObject = "0";
canSave = "1";
canSaveDynamicFields = "1";
Enabled = "1";
@ -99,6 +103,7 @@ new Scene(EditorTemplateLevel) {
new Skylight() {
Enabled = "1";
ReflectionMode = "Baked Cubemap";
dirtyGameObject = "0";
position = "1.37009 -5.23561 46.5817";
rotation = "1 0 0 0";
canSave = "1";

View file

@ -64,7 +64,7 @@ function MaterialEditorPlugin::onWorldEditorStartup( %this )
// Add ourselves to the ToolsToolbar
%tooltip = "Material Editor (" @ %accel @ ")";
EditorGui.addToToolsToolbar( "MaterialEditorPlugin", "MaterialEditorPalette", expandFilename("tools/worldEditor/images/toolbar/matterial-editor"), %tooltip );
EditorGui.addToToolsToolbar( "MaterialEditorPlugin", "MaterialEditorPalette", expandFilename("tools/worldEditor/images/toolbar/material-editor"), %tooltip );
//connect editor windows
GuiWindowCtrl::attach( MaterialEditorPropertiesWindow, MaterialEditorPreviewWindow);

View file

@ -1353,7 +1353,7 @@
buttonType = "PushButton";
useMouseEvents = "0";
buttonMargin = "0 4";
iconBitmap = "tools/worldEditor/images/toolbar/matterial-editor_n";
iconBitmap = "tools/worldEditor/images/toolbar/material-editor_n";
textMargin = "25";
};
new GuiCheckBoxCtrl() {