Adds function for sceneObjects to report utilized assets

Add reporting of used assets to tsStatics and TerrData
When saving a Scene, it will write static object asset dependencies to it's levelAsset
Shifted level loader logic to pass up the levelAsset rather than full level path
Made it so when level is loading, the levelAsset loads its dependencies. When the level is ended, as part of cleanup, they are unloaded
Shifts defaultEditorLevel to be an actual asset and made the ToolsModule load assets
Fixes the Save As action to correctly save out to the new level asset
Fixed the autoLoadAssets logic to be cleaner and not manually check types
Removed extra, unused DefaultEditorFile file
This commit is contained in:
Areloch 2020-08-19 18:30:42 -05:00
parent f7dbfff42d
commit 40dd926873
21 changed files with 263 additions and 255 deletions

View file

@ -16,7 +16,7 @@ function ToolsModule::onCreate(%this)
// to find exactly which subsystems should be readied before kicking things off.
// ----------------------------------------------------------------------------
ModuleDatabase.LoadExplicit( "MainEditor" );
//ModuleDatabase.LoadExplicit( "MainEditor" );
//ModuleDatabase.LoadExplicit( "Tools_ObjectViewer" );
}

View file

@ -5,4 +5,10 @@
ScriptFile="Tools.cs"
CreateFunction="onCreate"
DestroyFunction="onDestroy"
Group="Tools"/>
Group="Tools">
<DeclaredAssets
canSave="true"
canSaveDynamicFields="true"
Extension="asset.taml"
Recurse="true" />
</ModuleDefinition>

View file

@ -1,141 +0,0 @@
//--- OBJECT WRITE BEGIN ---
new Scene(EditorTemplateLevel) {
canSave = "1";
canSaveDynamicFields = "1";
isSubScene = "0";
isEditing = "0";
isDirty = "0";
cdTrack = "2";
CTF_scoreLimit = "5";
Enabled = "1";
musicTrack = "lush";
new LevelInfo(theLevelInfo) {
nearClip = "0.1";
visibleDistance = "1000";
visibleGhostDistance = "0";
decalBias = "0.0015";
fogColor = "0.6 0.6 0.7 1";
fogDensity = "0";
fogDensityOffset = "700";
fogAtmosphereHeight = "0";
canvasClearColor = "0 0 0 255";
ambientLightBlendPhase = "1";
ambientLightBlendCurve = "0 0 -1 -1";
soundAmbience = "AudioAmbienceDefault";
soundDistanceModel = "Linear";
canSave = "1";
canSaveDynamicFields = "1";
advancedLightmapSupport = "0";
desc0 = "A blank room template that acts as a starting point.";
Enabled = "1";
LevelName = "Blank Room Template";
};
new SkyBox(theSky) {
Material = "BlankSkyMat";
drawBottom = "0";
fogBandHeight = "0";
dirtyGameObject = "0";
position = "0 0 0";
rotation = "1 0 0 0";
scale = "1 1 1";
canSave = "1";
canSaveDynamicFields = "1";
};
new Sun(theSun) {
azimuth = "230.396";
elevation = "45";
color = "0.968628 0.901961 0.901961 1";
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";
coronaUseLightColor = "1";
flareScale = "1";
attenuationRatio = "0 1 1";
shadowType = "PSSM";
texSize = "2048";
overDarkFactor = "3000 1500 750 250";
shadowDistance = "200";
shadowSoftness = "0.25";
numSplits = "4";
logWeight = "0.9";
fadeStartDistance = "0";
lastSplitTerrainOnly = "0";
representedInLightmap = "0";
shadowDarkenColor = "0 0 0 -1";
includeLightmappedGeometryInShadow = "0";
dirtyGameObject = "0";
position = "0 0 0";
rotation = "1 0 0 0";
scale = "1 1 1";
canSave = "1";
canSaveDynamicFields = "1";
bias = "0.1";
Blur = "1";
Enabled = "1";
height = "1024";
lightBleedFactor = "0.8";
minVariance = "0";
pointShadowType = "PointShadowType_Paraboloid";
shadowBox = "-100 -100 -100 100 100 100";
splitFadeDistances = "1 1 1 1";
width = "3072";
};
new GroundPlane() {
squareSize = "128";
scaleU = "25";
scaleV = "25";
Material = "Grid_512_Grey";
dirtyGameObject = "0";
canSave = "1";
canSaveDynamicFields = "1";
Enabled = "1";
position = "0 0 0";
rotation = "1 0 0 0";
scale = "1 1 1";
};
new Skylight() {
Enabled = "1";
ReflectionMode = "Baked Cubemap";
dirtyGameObject = "0";
position = "1.37009 -5.23561 46.5817";
rotation = "1 0 0 0";
canSave = "1";
canSaveDynamicFields = "1";
persistentId = "d5eb3afb-dced-11e9-a423-bb0e346e3870";
reflectionPath = "tools/levels/BlankRoom/probes/";
};
new TSStatic() {
ShapeAsset = "pbr:material_ball";
playAmbient = "1";
meshCulling = "0";
originSort = "0";
overrideColor = "0 0 0 0";
collisionType = "Collision Mesh";
decalType = "Collision Mesh";
allowPlayerStep = "0";
alphaFadeEnable = "0";
alphaFadeStart = "100";
alphaFadeEnd = "150";
alphaFadeInverse = "0";
renderNormals = "0";
forceDetail = "-1";
ignoreZodiacs = "0";
useGradientRange = "0";
gradientRange = "0 180";
invertGradientRange = "0";
dirtyGameObject = "0";
position = "-0.000554562 -0.0734091 1.05277";
rotation = "1 0 0 0";
scale = "1 1 1";
canSave = "1";
canSaveDynamicFields = "1";
materialSlot0 = "base_material_ball";
};
};
//--- OBJECT WRITE END ---

View file

@ -0,0 +1,10 @@
<LevelAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="DefaultEditorLevel"
LevelFile="@assetFile=DefaultEditorLevel.mis"
LevelName="DefaultEditorLevel"
isSubScene="false"
description="An empty room"
staticObjectAssetDependency0="@Asset=FPSGameplay:station01"
VersionId="1" />

View file

@ -272,7 +272,7 @@ function fastLoadWorldEdit(%val)
if( !$missionRunning )
{
EditorNewLevel("tools/levels/DefaultEditorLevel.mis");
EditorNewLevel("ToolsModule:DefaultEditorLevel");
}
else
{

View file

@ -199,7 +199,7 @@ function EditorOpenDeclarationInTorsion( %object )
EditorOpenFileInTorsion( makeFullPath( %fileName ), %object.getDeclarationLine() );
}
function EditorNewLevel( %file )
function EditorNewLevel( %level )
{
%saveFirst = false;
if ( EditorIsDirty() )
@ -219,18 +219,18 @@ function EditorNewLevel( %file )
Editor.getUndoManager().clearAll();
}
if( %file $= "" )
if( %level $= "" )
{
%file = "tools/levels/DefaultEditorLevel.mis";
%level = "ToolsModule:DefaultEditorLevel";
}
if( !$missionRunning )
{
activatePackage( "BootEditor" );
StartGame( %file );
StartGame( %level );
}
else
EditorOpenMission(%file);
EditorOpenMission(%level);
//EWorldEditor.isDirty = true;
//ETerrainEditor.isDirty = true;
@ -360,6 +360,15 @@ function EditorSaveMissionAs( %levelAsset )
if( fileExt( %missionName ) !$= ".mis" )
%missionName = %missionName @ ".mis";
//Update to be our active
$Server::MissionFile = %missionName;
%Server::LevelAsset = %levelAssetDef;
//Do the save
EditorSaveMission();
//TODO: doublecheck that we rename the scene properly
//Make sure we have a selected module so we can create our module
//if(AssetBrowser.selectedModule $= "")
// Canvas.pushDialog(