Add getScriptPath console function to GUIAsset

Shifted tracking of importing asset status to an enum for more robust handling
Added logic to properly init freshly created shapeConstructors with the newly imported shapeAsset
Fixed handling of assets that have been marked to be skipped, but needed to fill in the parent's dependencies(UseForDependencies enum value)
Cleaned up redundant recursive logic for importing assets
Disable Create Game Objects button in inspector
Fixed material assignment for convex proxies
Updated asset icons for AB with WIP images to be more clear
Fixed issue where type-generic icons in the creator items in the AB weren't showing correctly.
Force AB to show creator entries in list mode for efficiency and avoid icon scaling issues
Moved creator functions for AB to separate file for convenience
Filled out GUIControls in the AB's creator mode, and context world editor and GUI creator entries based on active editor
Added drag-n-drop handling for guiControls via AB creator in guiEditor mode
Added more types' profiles in the AB gui profiles to give more unique border colors for better visual clarity of asset type
Added editor setting to indicate if the editor should load into the last edited level, or the editor default scene
Fixed setting of highlight material overlay in shapeEditor
Added global keybind for GUIEditor so space also toggles assetbrowser
Fixed up binding/finding of shapeConstructor by assetId, which also fixed displaying of shape's material listing
This commit is contained in:
Areloch 2021-09-10 02:13:56 -05:00
parent ce476f5e07
commit 8781f2ab55
44 changed files with 695 additions and 748 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View file

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.8 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 9 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View file

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Before After
Before After

View file

@ -84,6 +84,7 @@ function initializeAssetBrowser()
exec("./scripts/directoryHandling." @ $TorqueScriptFileExtension);
exec("./scripts/selectPath." @ $TorqueScriptFileExtension);
exec("./scripts/looseFileAudit." @ $TorqueScriptFileExtension);
exec("./scripts/creator." @ $TorqueScriptFileExtension);
//Processing for the different asset types
exec("./scripts/assetTypes/component." @ $TorqueScriptFileExtension);
@ -152,6 +153,9 @@ function initializeAssetBrowser()
ImportAssetWindow.importingFilesArray = new ArrayObject();
ImportAssetWindow.importer = new AssetImporter();
if(!isObject(AssetBrowserCreatorGroupsList))
new ArrayObject(AssetBrowserCreatorGroupsList);
AssetBrowser.buildPopupMenus();

View file

@ -512,7 +512,7 @@ function AssetBrowser::buildAssetPreview( %this, %asset, %moduleName )
AssetBrowser-->previewSlider.setValue(1);
}
if(%previewScaleSize == 0)
if(%previewScaleSize == 0 || startsWith(AssetBrowser.dirHandler.currentAddress, "Creator"))
{
%previewButton.iconLocation = "Left";
%previewButton.textLocation = "Right";
@ -830,137 +830,6 @@ function AssetBrowser::setTagActive(%this, %tag)
%this.rebuildAssetArray();
}
function AssetBrowser::loadCreatorClasses(%this)
{
// Just so we can recall this method for testing changes
// without restarting.
if ( isObject( %this.creatorClassArray ) )
%this.creatorClassArray.delete();
%this.creatorClassArray = new ArrayObject();
%this.creatorClassArray.caseSensitive = true;
//%this.setListView( true );
%this.beginCreatorGroup( "Environment" );
// Removed Prefab as there doesn't really seem to be a point in creating a blank one
//%this.addCreatorClass( "Prefab", "Prefab" );
%this.addCreatorClass( "SkyBox", "Sky Box" );
%this.addCreatorClass( "CloudLayer", "Cloud Layer" );
%this.addCreatorClass( "BasicClouds", "Basic Clouds" );
%this.addCreatorClass( "ScatterSky", "Scatter Sky" );
%this.addCreatorClass( "Sun", "Basic Sun" );
%this.addCreatorClass( "Lightning" );
%this.addCreatorClass( "WaterBlock", "Water Block" );
%this.addCreatorClass( "SFXEmitter", "Sound Emitter" );
%this.addCreatorClass( "Precipitation" );
%this.addCreatorClass( "ParticleEmitterNode", "Particle Emitter" );
// Legacy features. Users should use Ground Cover and the Forest Editor.
//%this.addCreatorClass( "fxShapeReplicator", "Shape Replicator" );
//%this.addCreatorClass( "fxFoliageReplicator", "Foliage Replicator" );
%this.addCreatorClass( "PointLight", "Point Light" );
%this.addCreatorClass( "SpotLight", "Spot Light" );
%this.addCreatorClass( "GroundCover", "Ground Cover" );
%this.addCreatorClass( "TerrainBlock", "Terrain Block" );
%this.addCreatorClass( "GroundPlane", "Ground Plane" );
%this.addCreatorClass( "WaterPlane", "Water Plane" );
%this.addCreatorClass( "PxCloth", "Cloth" );
%this.addCreatorClass( "ForestWindEmitter", "Wind Emitter" );
%this.addCreatorClass( "DustEmitter", "Dust Emitter" );
%this.addCreatorClass( "DustSimulation", "Dust Simulation" );
%this.addCreatorClass( "DustEffecter", "Dust Effecter" );
%this.endCreatorGroup();
%this.beginCreatorGroup( "Level" );
%this.addCreatorClass("MissionArea", "Mission Area" );
%this.addCreatorClass("Path" );
%this.addCreatorClass("Marker", "Path Node" );
%this.addCreatorClass("Trigger" );
%this.addCreatorClass("PhysicalZone", "Physical Zone" );
%this.addCreatorClass("Camera" );
%this.addCreatorClass( "LevelInfo", "Level Info" );
%this.addCreatorClass( "TimeOfDay", "Time of Day" );
%this.addCreatorClass( "Zone", "Zone" );
%this.addCreatorClass( "Portal", "Zone Portal" );
%this.addCreatorClass( "SpawnSphere", "Player Spawn Sphere"/*, "PlayerDropPoint"*/ );
%this.addCreatorClass( "SpawnSphere", "Observer Spawn Sphere"/*, "ObserverDropPoint"*/ );
%this.addCreatorClass( "SFXSpace", "Sound Space" );
%this.addCreatorClass( "OcclusionVolume", "Occlusion Volume" );
%this.endCreatorGroup();
%this.beginCreatorGroup( "System" );
%this.addCreatorClass( "SimGroup" );
%this.addCreatorClass( "AIPathGroup" );
%this.endCreatorGroup();
%this.beginCreatorGroup( "ExampleObjects" );
%this.addCreatorClass( "RenderObjectExample" );
%this.addCreatorClass( "RenderMeshExample" );
%this.addCreatorClass( "RenderShapeExample" );
%this.endCreatorGroup();
%this.creatorClassArray.sortk();
}
function AssetBrowser::beginCreatorGroup(%this, %group)
{
AssetBrowser-->filterTree.insertItem(AssetBrowser-->filterTree.creatorIdx, %group);
%this.currentCreatorGroup = %group;
}
function AssetBrowser::endCreatorGroup(%this, %group)
{
%this.currentCreatorGroup = "";
}
function AssetBrowser::addCreatorClass(%this, %class, %name, %buildfunc)
{
if( !isClass(%class) )
return;
if ( %name $= "" )
%name = %class;
if ( %this.currentCreatorGroup !$= "" && %group $= "" )
%group = %this.currentCreatorGroup;
if ( %class $= "" || %group $= "" )
{
warn( "AssetBrowser::addCreatorClass, invalid parameters!" );
return;
}
if(%buildfunc $= "")
{
%method = "build" @ %buildfunc;
if( !ObjectBuilderGui.isMethod( %method ) )
%method = "build" @ %class;
if( !ObjectBuilderGui.isMethod( %method ) )
%cmd = "return new " @ %class @ "();";
else
%cmd = "ObjectBuilderGui." @ %method @ "();";
%buildfunc = "ObjectBuilderGui.newObjectCallback = \"AssetBrowser.onFinishCreateObject\"; EWCreatorWindow.createObject( \"" @ %cmd @ "\" );";
}
%args = new ScriptObject();
%args.val[0] = %class;
%args.val[1] = %name;
%args.val[2] = %buildfunc;
%this.creatorClassArray.push_back( %group, %args );
}
//
//needs to be deleted with the persistence manager and needs to be blanked out of the matmanager
//also need to update instances... i guess which is the tricky part....
@ -1474,47 +1343,6 @@ function AssetBrowser::doRebuildAssetArray(%this)
%assetType = AssetDatabase.getAssetType(%assetId);
}
/*%validType = false;
if(AssetBrowser.assetTypeFilter $= "")
{
if(AssetTypeListPopup.isItemChecked(0))
{
%validType = true;
}
else
{
for(%f=1; %f < AssetFilterTypeList.Count(); %f++)
{
%isChecked = AssetTypeListPopup.isItemChecked(%f+1);
if(%isChecked)
{
%filterTypeName = AssetFilterTypeList.getKey(%f);
if(%activeTypeFilterList $= "")
%activeTypeFilterList = %filterTypeName;
else
%activeTypeFilterList = %activeTypeFilterList @ ", " @ %filterTypeName;
if(%filterTypeName @ "Asset" $= %assetType)
{
%validType = true;
break;
}
}
}
}
if(!%validType)
continue;
}
else
{
if(%assetType !$= AssetBrowser.assetTypeFilter)
continue;
}*/
//stop adding after previewsPerPage is hit
%assetName = AssetDatabase.getAssetName(%assetId);
@ -1589,7 +1417,7 @@ function AssetBrowser::doRebuildAssetArray(%this)
}
//Add Non-Asset Scripted Objects. Datablock, etc based
if(AssetBrowser.assetTypeFilter $= "" && %breadcrumbPath !$= "" && !startsWith(%breadcrumbPath, "Creator/"))
if(AssetBrowser.assetTypeFilter $= "" && %breadcrumbPath !$= "" && isDirectory(%breadcrumbPath))
{
%category = getWord( %breadcrumbPath, 1 );
%dataGroup = "DataBlockGroup";
@ -1779,11 +1607,28 @@ function AssetBrowser::doRebuildAssetArray(%this)
//One of the creator folders was selected
%creatorGroup = AssetBrowserFilterTree.getItemText(AssetBrowserFilterTree.getSelectedItem(0));
if(%creatorGroup $= "Creator")
{
//add folders for the groups
%placeholderVar = "";
}
else
{
for ( %i = 0; %i < AssetBrowser.creatorClassArray.count(); %i++ )
{
%group = AssetBrowser.creatorClassArray.getKey( %i );
if ( %group $= %creatorGroup )
//Do some filter logic do skip out of groups if we're in the wrong editor mode for it
%creatorEditorFilter = "WorldEditor";
if(GuiEditorIsActive())
{
%creatorEditorFilter = "GuiEditor";
}
%creatorGroupIndex = AssetBrowserCreatorGroupsList.getIndexFromValue(%group);
%creatorGroupKey = AssetBrowserCreatorGroupsList.getKey(%creatorGroupIndex);
if ( %group $= %creatorGroup && %creatorGroupKey $= %creatorEditorFilter )
{
%creatorObj = AssetBrowser.creatorClassArray.getValue( %i );
%class = %creatorObj.val[0];
@ -1794,6 +1639,7 @@ function AssetBrowser::doRebuildAssetArray(%this)
}
}
}
}
for(%i=0; %i < $AssetBrowser::AssetArray.count(); %i++)
AssetBrowser.buildAssetPreview( $AssetBrowser::AssetArray.getValue(%i), $AssetBrowser::AssetArray.getKey(%i) );
@ -2519,6 +2365,9 @@ function AssetBrowserFilterTree::onDragDropped( %this )
function AssetBrowser::hasLooseFilesInDir(%this)
{
if(!isDirectory(%this.dirHandler.currentAddress))
return false;
//First, wipe out any files inside the folder first
%file = findFirstFileMultiExpr( %this.dirHandler.currentAddress @ "/*.*", false);

View file

@ -410,63 +410,6 @@ function ImportAssetWindow::reloadImportOptionConfigs(%this)
//ImportAssetConfigList.setSelected(%importConfigIdx);
}
//
/*function importLooseFile(%filePath, %forceAutoImport)
{
%assetType = getAssetTypeByFilename(%filePath);
if(%forceAutoImport)
{
//If we're attempting to fast-track the import, check that that's even an option
if(ImportAssetWindow.importConfigsList.count() == 0 ||
EditorSettings.value("Assets/AssetImporDefaultConfig") $= "" ||
EditorSettings.value("Assets/AutoImport", false) == false)
{
toolsMessageBoxOK("Unable to AutoImport", "Attempted to import a loose file " @ %filePath @ " with AutoImport but was unable to either due to lacking a valid import config, or the editor settings are not set to auto import.");
return false;
}
if(%assetType $= "folder" || %assetType $= "zip")
{
toolsMessageBoxOK("Unable to AutoImport", "Unable to auto import folders or zips at this time");
return false;
}
if(%assetType $= "")
{
toolsMessageBoxOK("Unable to AutoImport", "Unable to auto import unknown file type for file " @ %filePath);
return false;
}
}
%assetItem = AssetBrowser.addImportingAsset(%assetType, %filePath, "", "");
ImportAssetItems.add(%assetItem);
if(%forceAutoImport)
{
%targetModule = AssetBrowser.dirHandler.getModuleFromAddress(filePath(%filePath)).ModuleId;
AssetImportTargetModule.text = %targetModule;
%assetItem.moduleName = %targetModule;
%assetName = %assetItem.assetName;
AssetBrowser.dirHandler.currentAddress = filePath(%filePath);
//skip the refresh delay, we'll force it here
ImportAssetWindow.doRefresh();
ImportAssetItems.empty();
if(ImportAssetWindow.hasImportIssues)
return false;
}
$importedLooseFileAsset = %assetItem.moduleName @ ":" @ %assetItem.assetName;
return true;
}*/
//
function assetImportUpdatePath(%newPath)
{
@ -475,91 +418,6 @@ function assetImportUpdatePath(%newPath)
AssetImportTargetModule.text = AssetBrowser.dirHandler.getModuleFromAddress(AssetBrowser.dirHandler.currentAddress).ModuleId;
}
//
/*function ImportAssetWindow::processImportAssets(%this, %assetItem)
{
if(!isObject(%assetItem))
{
//Zero this out
ImportAssetWindow.assetHeirarchyChanged = false;
for(%i=0; %i < ImportAssetItems.count(); %i++)
{
%assetItem = ImportAssetItems.getKey(%i);
if(!isObject(%assetItem) || %assetItem.skip )
return;
if(%assetItem.processed == false)
{
//sanetize before modifying our asset name(suffix additions, etc)
if(%assetItem.assetName !$= %assetItem.cleanAssetName)
%assetItem.assetName = %assetItem.cleanAssetName;
if(%assetItem.assetType $= "AnimationAsset")
{
//if we don't have our own file, that means we're gunna be using our parent shape's file so reference that
if(!isFile(%assetItem.filePath))
{
%assetItem.filePath = %assetItem.parentAssetItem.filePath;
}
}
if(AssetBrowser.isMethod("prepareImport" @ %assetItem.assetType))
{
%command = AssetBrowser @ ".prepareImport" @ %assetItem.assetType @ "(" @ %assetItem @ ");";
eval(%command);
}
%assetItem.processed = true;
}
%this.processImportAssets(%assetItem);
}
}
else
{
for(%i=0; %i < %assetItem.childAssetItems.count(); %i++)
{
%childAssetItem = %assetItem.childAssetItems.getKey(%i);
if(!isObject(%childAssetItem) || %childAssetItem.skip)
return;
if(%childAssetItem.processed == false)
{
//sanetize before modifying our asset name(suffix additions, etc)
if(%childAssetItem.assetName !$= %childAssetItem.cleanAssetName)
%childAssetItem.assetName = %childAssetItem.cleanAssetName;
if(%childAssetItem.assetType $= "AnimationAsset")
{
//if we don't have our own file, that means we're gunna be using our parent shape's file so reference that
if(!isFile(%childAssetItem.filePath))
{
%childAssetItem.filePath = %childAssetItem.parentAssetItem.filePath;
}
}
if(AssetBrowser.isMethod("prepareImport" @ %childAssetItem.assetType))
{
%command = AssetBrowser @ ".prepareImport" @ %childAssetItem.assetType @ "(" @ %childAssetItem @ ");";
eval(%command);
}
%childAssetItem.processed = true;
}
%this.processImportAssets(%childAssetItem);
}
}
//If our hierarchy changed, it's because we did so during processing
//so we'll loop back through again until everything has been processed
if(ImportAssetWindow.assetHeirarchyChanged)
%this.processImportAssets();
}*/
function ImportAssetWindow::findImportingAssetByName(%this, %assetName, %assetItem)
{
if(!isObject(%assetItem))

View file

@ -11,6 +11,19 @@ function AssetBrowser::buildCppPreview(%this, %assetDef, %previewData)
%previewData.tooltip = %assetDef.assetName;
}
function AssetBrowser::buildCppAssetPreview(%this, %assetDef, %previewData)
{
%previewData.assetName = %assetDef.assetName;
%previewData.assetPath = %assetDef.codeFilePath;
%previewData.doubleClickCommand = "echo(\"Not yet implemented to edit C++ files from the editor\");";//"EditorOpenFileInTorsion( "@%previewData.assetPath@", 0 );";
%previewData.previewImage = "ToolsModule:cppIcon_image";
%previewData.assetFriendlyName = %assetDef.assetName;
%previewData.assetDesc = %assetDef.description;
%previewData.tooltip = %assetDef.assetName;
}
function AssetBrowser::createCpp(%this)
{
%moduleName = AssetBrowser.newAssetSettings.moduleName;

View file

@ -9,6 +9,14 @@ function AssetBrowser::buildCreatorPreview(%this, %assetDef, %previewData)
%previewData.previewImage = "ToolsModule:" @ %class @ "_image";
if(!AssetDatabase.isDeclaredAsset(%previewData.previewImage))
{
if(EditorIsActive())
%previewData.previewImage = "ToolsModule:SceneObject_image";
else if(GuiEditorIsActive())
%previewData.previewImage = "ToolsModule:GuiControl_image";
}
//%previewData.assetFriendlyName = %assetDef.assetName;
%previewData.assetDesc = %assetDef;
%previewData.tooltip = "This creates a new object of the class " @ %class;
@ -22,6 +30,8 @@ function AssetBrowser::onFinishCreateObject(%this, %objId)
function AssetBrowser::onCreatorEditorDropped(%this, %assetDef, %position)
{
if(EditorIsActive())
{
%targetPosition = EWorldEditor.unproject(%position SPC 1000);
%camPos = LocalClientConnection.camera.getPosition();
%rayResult = containerRayCast(%camPos, %targetPosition, -1);
@ -41,4 +51,9 @@ function AssetBrowser::onCreatorEditorDropped(%this, %assetDef, %position)
%this.createdObjectPos = %pos;
%newObj = eval(%func);
}
else if(GuiEditorIsActive())
{
%placeholderVar = "";
}
}

View file

@ -434,10 +434,20 @@ function AssetBrowser::buildMaterialAssetPreview(%this, %assetDef, %previewData)
%generatePreview = false;
%previewFilePath = %previewPath @ %assetDef.assetName @ "_Preview.png";
if(!isFile(%previewFilePath) || (compareFileTimes(%assetDef.getImagePath(), %previewFilePath) == 1))
if(!isFile(%previewFilePath))
{
%generatePreview = true;
}
else
{
if(isObject(%assetDef.materialDefinitionName))
{
if(compareFileTimes(%assetDef.materialDefinitionName.getDiffuseMap(0), %previewFilePath) == 1 ||
compareFileTimes(%assetDef.materialDefinitionName.getFilename(), %previewFilePath) == 1)
%generatePreview = true;
}
}
%previewAssetName = %module.moduleId @ "_" @ %assetDef.assetName @ "_PreviewImage";
@ -479,7 +489,7 @@ function AssetBrowser::buildMaterialAssetPreview(%this, %assetDef, %previewData)
//Revalidate. If it didn't work, just use the default placeholder one
if(!isFile(%previewFilePath))
%previewAssetName = "ToolsModule:genericAssetIcon_image";
%previewAssetName = "ToolsModule:materialIcon_image";
%previewData.assetName = %assetDef.assetName;
%previewData.assetPath = %assetDef.scriptFile;

View file

@ -21,7 +21,7 @@ function AssetBrowser::buildPrefabPreview(%this, %assetDef, %previewData)
%previewData.assetName = %assetDef.assetName;
%previewData.assetPath = %fullPath;
%previewData.previewImage = "ToolsModule:genericAssetIcon_image";
%previewData.previewImage = "ToolsModule:prefabIcon_image";
//%previewData.assetFriendlyName = %assetDef.assetName;
%previewData.assetDesc = %assetDef.description;

View file

@ -90,6 +90,22 @@ function AssetBrowser::moveScriptAsset(%this, %assetDef, %destination)
AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath);
}
function AssetBrowser::buildScriptAssetPreview(%this, %assetDef, %previewData)
{
%previewData.assetName = %assetDef.assetName;
%previewData.assetPath = %assetDef.scriptFile;
%previewData.doubleClickCommand = "EditorOpenFileInTorsion( \""@%previewData.assetPath@"\", 0 );";
if(%assetDef.isServerSide)
%previewData.previewImage = "ToolsModule:serverScriptIcon_image";
else
%previewData.previewImage = "ToolsModule:clientScriptIcon_image";
%previewData.assetFriendlyName = %assetDef.assetName;
%previewData.assetDesc = %assetDef.description;
%previewData.tooltip = "Asset Name: " @ %assetDef.assetName @ "\nDefinition Path: " @ %assetDef.getFilename();
}
function AssetBrowser::buildTScriptPreview(%this, %assetDef, %previewData)
{
%previewData.assetName = %assetDef.assetName;

View file

@ -353,6 +353,7 @@ function AssetBrowser::onShapeAssetEditorDropped(%this, %assetDef, %position)
EWorldEditor.isDirty = true;
MECreateUndoAction::submit(%newStatic );
}
function GuiInspectorTypeShapeAssetPtr::onControlDropped( %this, %payload, %position )
@ -367,15 +368,15 @@ function GuiInspectorTypeShapeAssetPtr::onControlDropped( %this, %payload, %posi
if(%assetType $= "ShapeAsset")
{
//echo("DROPPED A SHAPE ON A SHAPE ASSET COMPONENT FIELD!");
%module = %payload.moduleName;
%asset = %payload.assetName;
%targetComponent = %this.targetObject;
%targetComponent.shapeAsset = %module @ ":" @ %asset;
%oldValue = %targetObject.shapeAsset;
%arrayIndex = "";
//Inspector.refresh();
%targetObject = %this.targetObject;
%targetObject.shapeAsset = %module @ ":" @ %asset;
}
EWorldEditor.isDirty = true;

View file

@ -166,7 +166,7 @@ function AssetBrowser::buildTerrainAssetPreview(%this, %assetDef, %previewData)
%previewData.assetName = %assetDef.assetName;
%previewData.assetPath = "";
%previewData.previewImage = "ToolsModule:gameObjectIcon_image";
%previewData.previewImage = "ToolsModule:terrainIcon_image";
%previewData.assetFriendlyName = %assetDef.gameObjectName;
%previewData.assetDesc = %assetDef.description;

View file

@ -0,0 +1,194 @@
function AssetBrowser::loadCreatorClasses(%this)
{
// Just so we can recall this method for testing changes
// without restarting.
if ( isObject( %this.creatorClassArray ) )
%this.creatorClassArray.delete();
AssetBrowserCreatorGroupsList.empty();
%this.creatorClassArray = new ArrayObject();
%this.creatorClassArray.caseSensitive = true;
//%this.setListView( true );
//World Editor Creator Groups
%this.beginCreatorGroup( "Environment" );
%this.addCreatorClass( "BasicClouds", "Basic Clouds" );
%this.addCreatorClass( "PxCloth", "Cloth" );
%this.addCreatorClass( "CloudLayer", "Cloud Layer" );
%this.addCreatorClass( "GroundCover", "Ground Cover" );
%this.addCreatorClass( "Lightning" );
%this.addCreatorClass( "ParticleEmitterNode","Particle Emitter" );
%this.addCreatorClass( "Precipitation" );
// Legacy features. Users should use Ground Cover and the Forest Editor.
//%this.addCreatorClass( "fxShapeReplicator", "Shape Replicator" );
//%this.addCreatorClass( "fxFoliageReplicator", "Foliage Replicator" );
%this.addCreatorClass( "RibbonNode", "Ribbon Emitter" );
%this.addCreatorClass( "ScatterSky", "Scatter Sky" );
%this.addCreatorClass( "SkyBox", "Sky Box" );
%this.addCreatorClass( "SFXEmitter", "Sound Emitter" );
%this.addCreatorClass( "TerrainBlock", "Terrain Block" );
%this.addCreatorClass( "VolumetricFog", "Volumetric Fog" );
%this.addCreatorClass( "TimeOfDay", "Time of Day" );
%this.addCreatorClass( "WaterBlock", "Water Block" );
%this.addCreatorClass( "WaterPlane", "Water Plane" );
%this.addCreatorClass( "ForestWindEmitter", "Wind Emitter" );
%this.endCreatorGroup();
%this.beginCreatorGroup( "ExampleObjects" );
%this.addCreatorClass( "RenderMeshExample" );
%this.addCreatorClass( "RenderObjectExample" );
%this.addCreatorClass( "RenderShapeExample" );
%this.endCreatorGroup();
%this.beginCreatorGroup( "Level" );
%this.addCreatorClass("Camera" );
%this.addCreatorClass("GroundPlane", "Ground Plane" );
%this.addCreatorClass("LevelInfo", "Level Info" );
%this.addCreatorClass("Marker", "Path Node" );
%this.addCreatorClass("MissionArea", "Mission Area" );
%this.addCreatorClass("Note", "Note" );
%this.addCreatorClass("Path" );
%this.addCreatorClass("SpawnSphere", "General Spawn Sphere" );
%this.addCreatorClass("SpawnSphere", "Player Spawn Sphere"/*, "PlayerDropPoint"*/ );
%this.addCreatorClass("SpawnSphere", "Observer Spawn Sphere"/*, "ObserverDropPoint"*/ );
%this.addCreatorClass("VPath", "Verve Path" );
%this.endCreatorGroup();
%this.beginCreatorGroup( "Lighting" );
%this.addCreatorClass( "BoxEnvironmentProbe", "Box Env. Probe" );
%this.addCreatorClass( "PointLight", "Point Light" );
%this.addCreatorClass( "Skylight", "Skylight" );
%this.addCreatorClass( "SphereEnvironmentProbe", "Sphere Env. Probe" );
%this.addCreatorClass( "SpotLight", "Spot Light" );
%this.addCreatorClass( "Sun", "Basic Sun" );
%this.endCreatorGroup();
%this.beginCreatorGroup( "Navigation" );
%this.addCreatorClass( "AIPathGroup" );
%this.addCreatorClass( "CoverPoint", "Cover Point" );
%this.addCreatorClass( "NavMesh", "Navigation Mesh" );
%this.addCreatorClass( "NavPath", "Navigation Path" );
%this.endCreatorGroup();
%this.beginCreatorGroup( "System" );
%this.addCreatorClass( "SimGroup" );
%this.endCreatorGroup();
%this.beginCreatorGroup( "Volumes" );
%this.addCreatorClass("AccumulationVolume", "Accumulation Volume" );
%this.addCreatorClass("OcclusionVolume", "Occlusion Volume" );
%this.addCreatorClass("PhysicalZone", "Physical Zone" );
%this.addCreatorClass("Portal", "Zone Portal" );
%this.addCreatorClass("SFXSpace", "Sound Space" );
%this.addCreatorClass("Trigger" );
%this.addCreatorClass("Zone", "Zone" );
%this.endCreatorGroup();
//Gui Editor Creator Groups
%controls = enumerateConsoleClassesByCategory( "Gui" );
%guiClasses = new ArrayObject();
foreach$( %className in %controls )
{
if( GuiEditor.isFilteredClass( %className )
|| !isMemberOfClass( %className, "GuiControl" ) )
continue;
%category = getWord( getCategoryOfClass( %className ), 1 );
if( %category $= "" )
continue;
%guiClasses.add(%category, %className);
}
%guiCats.sortk(true);
%guiClasses.sortk(true);
%guiClasses.echo();
%currentCat = "";
for(%i=0; %i < %guiClasses.count(); %i++)
{
%guiCat = %guiClasses.getKey(%i);
if(%currentCat !$= %guiCat)
{
if(%currentCat !$= "")
%this.endCreatorGroup();
%this.beginCreatorGroup( %guiCat, "GuiEditor" );
%currentCat = %guiCat;
}
%guiClass = %guiClasses.getValue(%i);
%this.addCreatorClass( %guiClass );
}
%this.endCreatorGroup();
%this.creatorClassArray.sortk(true);
%this.creatorClassArray.sort(true);
%guiClasses.delete();
}
function AssetBrowser::beginCreatorGroup(%this, %group, %editor)
{
if(%editor $= "")
%editor = "WorldEditor";
if((GuiEditorIsActive() && %editor $= "GuiEditor") || (EditorIsActive() && %editor $= "WorldEditor"))
{
AssetBrowser-->filterTree.insertItem(AssetBrowser-->filterTree.creatorIdx, %group);
}
%this.currentCreatorGroup = %group;
AssetBrowserCreatorGroupsList.add(%editor, %group);
}
function AssetBrowser::endCreatorGroup(%this, %group)
{
%this.currentCreatorGroup = "";
}
function AssetBrowser::addCreatorClass(%this, %class, %name, %buildfunc)
{
if( !isClass(%class) )
return;
if ( %name $= "" )
%name = %class;
if ( %this.currentCreatorGroup !$= "" && %group $= "" )
%group = %this.currentCreatorGroup;
if ( %class $= "" || %group $= "" )
{
warn( "AssetBrowser::addCreatorClass, invalid parameters!" );
return;
}
if(%buildfunc $= "")
{
%method = "build" @ %buildfunc;
if( !ObjectBuilderGui.isMethod( %method ) )
%method = "build" @ %class;
if( !ObjectBuilderGui.isMethod( %method ) )
%cmd = "return new " @ %class @ "();";
else
%cmd = "ObjectBuilderGui." @ %method @ "();";
%buildfunc = "ObjectBuilderGui.newObjectCallback = \"AssetBrowser.onFinishCreateObject\"; EWCreatorWindow.createObject( \"" @ %cmd @ "\" );";
}
%args = new ScriptObject();
%args.val[0] = %class;
%args.val[1] = %name;
%args.val[2] = %buildfunc;
%this.creatorClassArray.push_back( %group, %args );
}

View file

@ -24,4 +24,67 @@ singleton GuiControlProfile(AssetBrowserPreviewShapeAsset : ToolsGuiDefaultProfi
border = true;
borderColor = "0 0 200 255";
borderColorNA = "0 0 200 255";
};
singleton GuiControlProfile(AssetBrowserPreviewShapeAnimationAsset : ToolsGuiDefaultProfile)
{
fillColor = "128 128 128 255"; //hovered/selected
border = true;
borderColor = "0 0 200 255";
borderColorNA = "0 0 200 255";
};
singleton GuiControlProfile(AssetBrowserPreviewSoundAsset : ToolsGuiDefaultProfile)
{
fillColor = "128 128 128 255"; //hovered/selected
border = true;
borderColor = "75 101 135 255";
borderColorNA = "75 101 135 255";
};
singleton GuiControlProfile(AssetBrowserPreviewTerrainAsset : ToolsGuiDefaultProfile)
{
fillColor = "128 128 128 255"; //hovered/selected
border = true;
borderColor = "200 198 198 255";
borderColorNA = "200 198 198 255";
};
singleton GuiControlProfile(AssetBrowserPreviewTerrainMaterialAsset : ToolsGuiDefaultProfile)
{
fillColor = "128 128 128 255"; //hovered/selected
border = true;
borderColor = "200 198 198 255";
borderColorNA = "200 198 198 255";
};
singleton GuiControlProfile(AssetBrowserPreviewStateMachineAsset : ToolsGuiDefaultProfile)
{
fillColor = "128 128 128 255"; //hovered/selected
border = true;
borderColor = "0 76 135 255";
borderColorNA = "0 76 135 255";
};
singleton GuiControlProfile(AssetBrowserPreviewGUIAsset : ToolsGuiDefaultProfile)
{
fillColor = "128 128 128 255"; //hovered/selected
border = true;
borderColor = "17 5 44 255";
borderColorNA = "17 5 44 255";
};
singleton GuiControlProfile(AssetBrowserPreviewLevelAsset : ToolsGuiDefaultProfile)
{
fillColor = "128 128 128 255"; //hovered/selected
border = true;
borderColor = "0 208 186 255";
borderColorNA = "0 208 186 255";
};

View file

@ -289,6 +289,11 @@ function ESettingsWindow::getAxisSettings(%this)
function ESettingsWindow::getGeneralSettings(%this)
{
SettingsInspector.startGroup("Level Load");
SettingsInspector.addSettingsField("WorldEditor/LevelLoad/LoadMode", "Editor Startup Scene", "list", "When the editor loads, this setting dictates what scene is loaded first",
"Last Edited Level,Editor Default Scene");
SettingsInspector.endGroup();
SettingsInspector.startGroup("Autosave");
SettingsInspector.addSettingsField("WorldEditor/AutosaveInterval", "Autosave Interval(in minutes)", "int", "");
SettingsInspector.endGroup();

View file

Before

Width:  |  Height:  |  Size: 276 B

After

Width:  |  Height:  |  Size: 276 B

Before After
Before After

View file

@ -2,7 +2,7 @@
canSave="true"
canSaveDynamicFields="true"
AssetName="tab_border_image"
imageFile="@assetFile=tab-border.png"
imageFile="@assetFile=tab_border.png"
UseMips="true"
isHDRImage="false"
imageType="Albedo" />

View file

@ -670,16 +670,21 @@ function GuiEditor::onControlDropped(%this, %payload, %position)
{
// Make sure we have the right kind of D&D.
if( !%payload.parentGroup.isInNamespaceHierarchy( "GuiDragAndDropControlType_GuiControl" ) )
if( !%payload.parentGroup.isInNamespaceHierarchy( "GuiDragAndDropControlType_GuiControl" ) &&
!%payload.parentGroup.isInNamespaceHierarchy( "AssetPreviewControlType_AssetDrop" ))
return;
%pos = %payload.getGlobalPosition();
%x = getWord(%pos, 0);
%y = getWord(%pos, 1);
%this.addNewCtrl(%payload);
%asset = %payload.assetName;
%cmd = "return new " @ %asset @ "();";
%ctrl = eval( %cmd );
%this.addNewCtrl(%ctrl);
%payload.setPositionGlobal(%x, %y);
%ctrl.setPositionGlobal(%x, %y);
%this.setFirstResponder();
}
@ -844,6 +849,8 @@ function GuiEditorTabBook::onWake( %this )
item[ 0 ] = "Alphabetical View" TAB "" TAB "GuiEditorToolbox.setViewType( \"Alphabetical\" );";
item[ 1 ] = "Categorized View" TAB "" TAB "GuiEditorToolbox.setViewType( \"Categorized\" );";
};
GlobalActionMap.bindCmd( keyboard, space, "", "AssetBrowser.toggleDialog();" );
}
//---------------------------------------------------------------------------------------------
@ -1008,6 +1015,8 @@ function GuiEditorGui::onWake( %this )
function GuiEditorGui::onSleep( %this)
{
GlobalActionMap.unbind( keyboard, space );
// If we are editing a control, store its guide state.
%content = GuiEditor.getContentControl();

View file

@ -278,7 +278,35 @@ function fastLoadWorldEdit(%val)
if( !$missionRunning )
{
if(EditorSettings.value("WorldEditor/LevelLoad/LoadMode", "Editor Default Scene") $= "Editor Default Scene")
{
EditorNewLevel("ToolsModule:DefaultEditorLevel");
}
else
{
//go back through our recent levels list to find the most recent valid editor level.
//if NONE work, then just load the default editor scene
%recentLevels = EditorSettings.value("WorldEditor/recentLevelsList");
%recentCount = getTokenCount(%recentLevels, ",");
%loadedScene = false;
for(%i=0; %i < %recentCount; %i++)
{
%recentEntry = getToken(%recentLevels, ",", %i);
if(AssetDatabase.isDeclaredAsset(%recentEntry))
{
EditorOpenMission(%recentEntry);
%loadedScene = true;
break;
}
}
if(!%loadedScene)
{
EditorNewLevel("ToolsModule:DefaultEditorLevel");
}
}
}
else
{

View file

@ -315,7 +315,7 @@ function ShapeEditor::selectShape( %this, %shapeAsset, %saveOld )
ShapeEditor.shape = findShapeConstructorByAssetId( %shapeAsset.getAssetId() );
if ( ShapeEditor.shape <= 0 )
{
ShapeEditor.shape = %this.createConstructor( %shapeAsset );
ShapeEditor.shape = %this.createConstructor( %shapeAsset.getAssetId() );
if ( ShapeEditor.shape <= 0 )
{
error( "ShapeEditor: Error - could not select " @ %shapeAsset.getAssetId() );
@ -2336,7 +2336,7 @@ function ShapeEdMaterials::updateSelectedMaterial( %this, %highlight )
%this.savedMap = %this.selectedMaterial.diffuseMap[1];
if ( %highlight && isObject( %this.selectedMaterial ) )
{
%this.selectedMaterial.diffuseMap[1] = "tools/shapeEditor/images/highlight_material";
%this.selectedMaterial.setDiffuseMap("ToolsModule:highlight_material_image", 1);
%this.selectedMaterial.reload();
}
}
@ -3066,7 +3066,7 @@ function ShapeEditor::addLODFromFile( %this, %dest, %assetId, %size, %allowUnmat
%source = findShapeConstructorByAssetId( %assetId );
if ( %source == -1 )
%source = ShapeEditor.createConstructor( %filename );
%source = ShapeEditor.createConstructor( %assetId );
%source.lodType = "SingleSize";
%source.singleDetailSize = %size;