Corrected the logic for the GenerateComposite import config rule so it only applies if there's any of the ORM maps detected

Added new import config rule: AlwaysPresentImageMaps so it will add entries for the regular map inputs on a material, even if they weren't actually found
Disabled a number of inactive popup menu items
Added Create New Module to normal add asset popup for more obvious/simplified use-flow
Adjusted the editor loading logic so it will properly display the loading splash to inform loading is happening instead of just lagging
Adjusted the assimp shape loader code so if it doesn't find a texture, and thus just sets a material value as the material color, it has a more parsable formatting
This commit is contained in:
Areloch 2019-10-06 01:29:12 -05:00
parent 388b568739
commit ec63be32e3
11 changed files with 322 additions and 269 deletions

View file

@ -346,7 +346,7 @@ bool AssimpShapeLoader::fillGuiTreeView(const char* sourceShapePath, GuiTreeView
{ {
aiColor3D read_color(1.f, 1.f, 1.f); aiColor3D read_color(1.f, 1.f, 1.f);
if (AI_SUCCESS == aiMat->Get(AI_MATKEY_COLOR_DIFFUSE, read_color)) if (AI_SUCCESS == aiMat->Get(AI_MATKEY_COLOR_DIFFUSE, read_color))
texName = String::ToString("Color: (%0.3f, %0.3f, %0.3f)", (F32)read_color.r, (F32)read_color.g, (F32)read_color.b); texName = String::ToString("Color: %0.3f %0.3f %0.3f", (F32)read_color.r, (F32)read_color.g, (F32)read_color.b); //formatted as words for easy parsing
else else
texName = "No Texture"; texName = "No Texture";
} }

View file

@ -16,9 +16,6 @@ function ToolsModule::onCreate(%this)
// to find exactly which subsystems should be readied before kicking things off. // to find exactly which subsystems should be readied before kicking things off.
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
new Settings(EditorSettings) { file = "tools/settings.xml"; };
EditorSettings.read();
ModuleDatabase.LoadExplicit( "MainEditor" ); ModuleDatabase.LoadExplicit( "MainEditor" );
ModuleDatabase.LoadExplicit( "Tools_ObjectViewer" ); ModuleDatabase.LoadExplicit( "Tools_ObjectViewer" );
} }

View file

@ -1064,7 +1064,7 @@ function ImportAssetWindow::refreshChildItem(%this, %id)
{ {
position = %filePathBtnPos SPC "0"; position = %filePathBtnPos SPC "0";
extent = %height SPC %height; extent = %height SPC %height;
command = "ImportAssetOptionsWindow.findMissingFile(" @ %assetItem @ ");"; command = "ImportAssetWindow.findMissingFile(" @ %assetItem @ ");";
text = "..."; text = "...";
internalName = "InputPathButton"; internalName = "InputPathButton";
tooltip = %toolTip; tooltip = %toolTip;

View file

@ -45,6 +45,8 @@ function setupImportConfigSettingsList()
ImportAssetConfigSettingsList.addNewConfigSetting("Materials/UseDiffuseSuffixOnOriginImage", "Use Diffuse Suffix for Origin Image", "bool", "", "1", ""); ImportAssetConfigSettingsList.addNewConfigSetting("Materials/UseDiffuseSuffixOnOriginImage", "Use Diffuse Suffix for Origin Image", "bool", "", "1", "");
ImportAssetConfigSettingsList.addNewConfigSetting("Materials/UseExistingMaterials", "Use Existing Materials", "bool", "", "1", ""); ImportAssetConfigSettingsList.addNewConfigSetting("Materials/UseExistingMaterials", "Use Existing Materials", "bool", "", "1", "");
ImportAssetConfigSettingsList.addNewConfigSetting("Materials/IgnoreMaterials", "Ignore Materials", "command", "", "", ""); ImportAssetConfigSettingsList.addNewConfigSetting("Materials/IgnoreMaterials", "Ignore Materials", "command", "", "", "");
ImportAssetConfigSettingsList.addNewConfigSetting("Materials/AlwaysPresentImageMaps", "Always Present Image Maps", "bool",
"Wether to always display all normal material map fields, even if an image isn't detected.", "", "");
//Animations //Animations
ImportAssetConfigSettingsList.addNewConfigSetting("Animations/ImportAnimations", "Import Animations", "bool", "", "1", ""); ImportAssetConfigSettingsList.addNewConfigSetting("Animations/ImportAnimations", "Import Animations", "bool", "", "1", "");
@ -289,6 +291,7 @@ function ImportAssetConfigEditorWindow::addNewConfig(%this)
AssetImportSettings.setValue("Materials/CreateComposites", "1"); AssetImportSettings.setValue("Materials/CreateComposites", "1");
AssetImportSettings.setValue("Materials/UseDiffuseSuffixOnOriginImage", "1"); AssetImportSettings.setValue("Materials/UseDiffuseSuffixOnOriginImage", "1");
AssetImportSettings.setValue("Materials/UseExistingMaterials", "1"); AssetImportSettings.setValue("Materials/UseExistingMaterials", "1");
AssetImportSettings.setValue("Materials/AlwaysPresentImageMaps", "0");
//Animations //Animations
AssetImportSettings.setValue("Animations/ImportAnimations", "1"); AssetImportSettings.setValue("Animations/ImportAnimations", "1");

View file

@ -33,8 +33,6 @@ function AssetBrowser::createMaterialAsset(%this)
function AssetBrowser::editMaterialAsset(%this, %assetDef) function AssetBrowser::editMaterialAsset(%this, %assetDef)
{ {
//if(EditorSettings.materialEditMode $= "MaterialEditor")
//{
%assetDef.materialDefinitionName.reload(); %assetDef.materialDefinitionName.reload();
EditorGui.setEditor(MaterialEditorPlugin); EditorGui.setEditor(MaterialEditorPlugin);
@ -43,13 +41,6 @@ function AssetBrowser::editMaterialAsset(%this, %assetDef)
MaterialEditorGui.setActiveMaterial( %assetDef.materialDefinitionName ); MaterialEditorGui.setActiveMaterial( %assetDef.materialDefinitionName );
AssetBrowser.hideDialog(); AssetBrowser.hideDialog();
/*}
else
{
Canvas.pushDialog(ShaderEditor);
ShaderEditorGraph.loadGraph(%assetDef.shaderGraph);
$ShaderGen::targetShaderFile = filePath(%assetDef.shaderGraph) @"/"@fileBase(%assetDef.shaderGraph);
//} */
} }
function AssetBrowser::prepareImportMaterialAsset(%this, %assetItem) function AssetBrowser::prepareImportMaterialAsset(%this, %assetItem)
@ -93,6 +84,13 @@ function AssetBrowser::prepareImportMaterialAsset(%this, %assetItem)
%diffuseAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem); %diffuseAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem);
%assetItem.diffuseImageAsset = %diffuseAsset; %assetItem.diffuseImageAsset = %diffuseAsset;
} }
else if(getAssetImportConfigValue("Materials/AlwaysPresentImageMaps", "0") == 1)
{
//In the event we don't have this image asset, but we DO wish to always display the field(affording when names don't aline with
//the material name), then we go ahead and create a blank entry
%suff = getTokenCount(%diffuseTypeSuffixes, ",;") == 0 ? "_albedo" : getToken(%diffuseTypeSuffixes, ",;", 0);
%diffuseAsset = AssetBrowser.addImportingAsset("Image", %assetItem.AssetName @ %suff, %assetItem);
}
} }
//Now, iterate over our comma-delimited suffixes to see if we have any matches. We'll use the first match in each case, if any. //Now, iterate over our comma-delimited suffixes to see if we have any matches. We'll use the first match in each case, if any.
@ -108,28 +106,14 @@ function AssetBrowser::prepareImportMaterialAsset(%this, %assetItem)
%normalAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem); %normalAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem);
%assetItem.normalImageAsset = %normalAsset; %assetItem.normalImageAsset = %normalAsset;
} }
} else if(getAssetImportConfigValue("Materials/AlwaysPresentImageMaps", "0") == 1)
/*if(%assetItem.specularImageAsset $= "")
{ {
//Specular //In the event we don't have this image asset, but we DO wish to always display the field(affording when names don't aline with
%listCount = getTokenCount(ImportAssetWindow.activeImportConfig.SpecularTypeSuffixes, ",;"); //the material name), then we go ahead and create a blank entry
%suff = getTokenCount(%normalTypeSuffixes, ",;") == 0 ? "_normal" : getToken(%normalTypeSuffixes, ",;", 0);
%foundFile = 0; %normalAsset = AssetBrowser.addImportingAsset("Image", %assetItem.AssetName @ %suff, %assetItem);
for(%i=0; %i < %listCount; %i++)
{
%entryText = getToken(ImportAssetWindow.activeImportConfig.SpecularTypeSuffixes, ",;", %i);
%targetFilePath = %fileDir @ "/" @ %filename @ %entryText @ %fileExt;
%foundFile = isFile(%targetFilePath);
if(%foundFile)
{
%specularAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem);
%assetItem.specularImageAsset = %specularAsset;
break;
} }
} }
}*/
if(%assetItem.metalImageAsset $= "") if(%assetItem.metalImageAsset $= "")
{ {
@ -142,6 +126,13 @@ function AssetBrowser::prepareImportMaterialAsset(%this, %assetItem)
%metalAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem); %metalAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem);
%assetItem.metalImageAsset = %metalAsset; %assetItem.metalImageAsset = %metalAsset;
} }
else if(getAssetImportConfigValue("Materials/AlwaysPresentImageMaps", "0") == 1)
{
//In the event we don't have this image asset, but we DO wish to always display the field(affording when names don't aline with
//the material name), then we go ahead and create a blank entry
%suff = getTokenCount(%metalnessTypeSuffixes, ",;") == 0 ? "_metalness" : getToken(%metalnessTypeSuffixes, ",;", 0);
%metalAsset = AssetBrowser.addImportingAsset("Image", %assetItem.AssetName @ %suff, %assetItem);
}
} }
if(%assetItem.roughnessImageAsset $= "") if(%assetItem.roughnessImageAsset $= "")
@ -155,6 +146,13 @@ function AssetBrowser::prepareImportMaterialAsset(%this, %assetItem)
%roughnessAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem); %roughnessAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem);
%assetItem.roughnessImageAsset = %roughnessAsset; %assetItem.roughnessImageAsset = %roughnessAsset;
} }
else if(getAssetImportConfigValue("Materials/AlwaysPresentImageMaps", "0") == 1)
{
//In the event we don't have this image asset, but we DO wish to always display the field(affording when names don't aline with
//the material name), then we go ahead and create a blank entry
%suff = getTokenCount(%roughnessTypeSuffixes, ",;") == 0 ? "_roughness" : getToken(%roughnessTypeSuffixes, ",;", 0);
%roughnessAsset = AssetBrowser.addImportingAsset("Image", %assetItem.AssetName @ %suff, %assetItem);
}
} }
if(%assetItem.smoothnessImageAsset $= "") if(%assetItem.smoothnessImageAsset $= "")
@ -168,6 +166,13 @@ function AssetBrowser::prepareImportMaterialAsset(%this, %assetItem)
%smoothnessAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem); %smoothnessAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem);
%assetItem.SmoothnessImageAsset = %smoothnessAsset; %assetItem.SmoothnessImageAsset = %smoothnessAsset;
} }
else if(getAssetImportConfigValue("Materials/AlwaysPresentImageMaps", "0") == 1)
{
//In the event we don't have this image asset, but we DO wish to always display the field(affording when names don't aline with
//the material name), then we go ahead and create a blank entry
%suff = getTokenCount(%smoothnessTypeSuffixes, ",;") == 0 ? "_smoothness" : getToken(%smoothnessTypeSuffixes, ",;", 0);
%smoothnessAsset = AssetBrowser.addImportingAsset("Image", %assetItem.AssetName @ %suff, %assetItem);
}
} }
if(%assetItem.AOImageAsset $= "") if(%assetItem.AOImageAsset $= "")
@ -181,6 +186,13 @@ function AssetBrowser::prepareImportMaterialAsset(%this, %assetItem)
%AOAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem); %AOAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem);
%assetItem.AOImageAsset = %AOAsset; %assetItem.AOImageAsset = %AOAsset;
} }
else if(getAssetImportConfigValue("Materials/AlwaysPresentImageMaps", "0") == 1)
{
//In the event we don't have this image asset, but we DO wish to always display the field(affording when names don't aline with
//the material name), then we go ahead and create a blank entry
%suff = getTokenCount(%aoTypeSuffixes, ",;") == 0 ? "_AO" : getToken(%aoTypeSuffixes, ",;", 0);
%AOAsset = AssetBrowser.addImportingAsset("Image", %assetItem.AssetName @ %suff, %assetItem);
}
} }
if(%assetItem.compositeImageAsset $= "") if(%assetItem.compositeImageAsset $= "")
@ -194,10 +206,20 @@ function AssetBrowser::prepareImportMaterialAsset(%this, %assetItem)
%compositeAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem); %compositeAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem);
%assetItem.compositeImageAsset = %compositeAsset; %assetItem.compositeImageAsset = %compositeAsset;
} }
else if(getAssetImportConfigValue("Materials/AlwaysPresentImageMaps", "0") == 1)
{
//In the event we don't have this image asset, but we DO wish to always display the field(affording when names don't aline with
//the material name), then we go ahead and create a blank entry
%suff = getTokenCount(%compositeTypeSuffixes, ",;") == 0 ? "_composite" : getToken(%compositeTypeSuffixes, ",;", 0);
%compositeAsset = AssetBrowser.addImportingAsset("Image", %assetItem.AssetName @ %suff, %assetItem);
}
} }
//If after the above we didn't find any, check to see if we should be generating one //If after the above we didn't find any, check to see if we should be generating one
if(%assetItem.compositeImageAsset $= "" && getAssetImportConfigValue("Materials/CreateComposites", "1") == 1) if(%assetItem.compositeImageAsset $= "" &&
(%assetItem.roughnessImageAsset !$= "" || %assetItem.AOImageAsset !$= "" || %assetItem.metalnessImageAsset !$= "") &&
getAssetImportConfigValue("Materials/CreateComposites", "1") == 1 &&
getAssetImportConfigValue("Materials/AlwaysPresentImageMaps", "0") == 0)
{ {
%assetItem.roughnessImageAsset.skip = true; %assetItem.roughnessImageAsset.skip = true;
%assetItem.AOImageAsset.skip = true; %assetItem.AOImageAsset.skip = true;

View file

@ -113,6 +113,13 @@ function AssetBrowser::prepareImportShapeAsset(%this, %assetItem)
AssetBrowser.addImportingAsset("Material", %filePath, %assetItem); AssetBrowser.addImportingAsset("Material", %filePath, %assetItem);
} }
else else
{
//check to see if it's actually just a flat color
if(getWordCount(%filePath) == 4 && getWord(%filePath, 0) $= "Color:")
{
AssetBrowser.addImportingAsset("Material", %matName, %assetItem);
}
else
{ {
//we need to try and find our material, since the shapeInfo wasn't able to find it automatically //we need to try and find our material, since the shapeInfo wasn't able to find it automatically
%filePath = findImageFile(filePath(%assetItem.filePath), %matName); %filePath = findImageFile(filePath(%assetItem.filePath), %matName);
@ -121,6 +128,7 @@ function AssetBrowser::prepareImportShapeAsset(%this, %assetItem)
else else
AssetBrowser.addImportingAsset("Material", filePath(%assetItem.filePath) @ "/" @ %matName, %assetItem); AssetBrowser.addImportingAsset("Material", filePath(%assetItem.filePath) @ "/" @ %matName, %assetItem);
} }
}
%materialItem = %assetItem.shapeInfo.getNextSibling(%materialItem); %materialItem = %assetItem.shapeInfo.getNextSibling(%materialItem);
while(%materialItem != 0) while(%materialItem != 0)
@ -132,6 +140,13 @@ function AssetBrowser::prepareImportShapeAsset(%this, %assetItem)
AssetBrowser.addImportingAsset("Material", %filePath, %assetItem); AssetBrowser.addImportingAsset("Material", %filePath, %assetItem);
} }
else else
{
//check to see if it's actually just a flat color
if(getWordCount(%filePath) == 4 && getWord(%filePath, 0) $= "Color:")
{
AssetBrowser.addImportingAsset("Material", %matName, %assetItem);
}
else
{ {
//we need to try and find our material, since the shapeInfo wasn't able to find it automatically //we need to try and find our material, since the shapeInfo wasn't able to find it automatically
%filePath = findImageFile(filePath(%assetItem.filePath), %matName); %filePath = findImageFile(filePath(%assetItem.filePath), %matName);
@ -140,6 +155,7 @@ function AssetBrowser::prepareImportShapeAsset(%this, %assetItem)
else else
AssetBrowser.addImportingAsset("Material", filePath(%assetItem.filePath) @ "/" @ %matName, %assetItem); AssetBrowser.addImportingAsset("Material", filePath(%assetItem.filePath) @ "/" @ %matName, %assetItem);
} }
}
%materialItem = %assetItem.shapeInfo.getNextSibling(%materialItem); %materialItem = %assetItem.shapeInfo.getNextSibling(%materialItem);
} }

View file

@ -11,6 +11,8 @@ function AssetBrowser::buildPopupMenus(%this)
item[ 0 ] = "Create New Module" TAB "" TAB "AssetBrowser.CreateNewModule();"; item[ 0 ] = "Create New Module" TAB "" TAB "AssetBrowser.CreateNewModule();";
item[ 1 ] = "Refresh Module Dependencies" TAB "" TAB "AssetBrowser.RefreshModuleDependencies();"; item[ 1 ] = "Refresh Module Dependencies" TAB "" TAB "AssetBrowser.RefreshModuleDependencies();";
}; };
AddNewModulePopup.enableItem(1, false);
} }
if( !isObject( EditAssetPopup ) ) if( !isObject( EditAssetPopup ) )
@ -153,6 +155,8 @@ function AssetBrowser::buildPopupMenus(%this)
item[4] = "Create Level" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"LevelAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewLevelAsset(\"NewLevel\", AssetBrowser.selectedModule);"; item[4] = "Create Level" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"LevelAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewLevelAsset(\"NewLevel\", AssetBrowser.selectedModule);";
item[5] = "-"; item[5] = "-";
item[6] = "Create C++ Asset" TAB AddNewCppAssetPopup; item[6] = "Create C++ Asset" TAB AddNewCppAssetPopup;
item[7] = "-";
item[8] = "Create New Module" TAB "" TAB "AssetBrowser.CreateNewModule();";
}; };
} }

View file

@ -1,53 +1,56 @@
//--- OBJECT WRITE BEGIN --- //--- OBJECT WRITE BEGIN ---
%guiContent = new GuiControl(EditorLoadingGui, EditorGuiGroup) { %guiContent = new GuiControl(EditorLoadingGui,EditorGuiGroup) {
isContainer = "1";
Profile = "GuiOverlayProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "0 0"; position = "0 0";
Extent = "800 600"; extent = "1024 768";
MinExtent = "8 2"; minExtent = "8 2";
canSave = "1"; horizSizing = "right";
Visible = "1"; vertSizing = "bottom";
tooltipprofile = "ToolsGuiToolTipProfile"; profile = "GuiOverlayProfile";
visible = "1";
active = "1";
tooltipProfile = "ToolsGuiToolTipProfile";
hovertime = "1000"; hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "1"; canSaveDynamicFields = "1";
new GuiControl() { new GuiControl() {
isContainer = "1"; position = "389 355";
Profile = "editorMenu_wBorderProfile"; extent = "245 57";
HorizSizing = "center"; minExtent = "8 2";
VertSizing = "center"; horizSizing = "center";
position = "277 271"; vertSizing = "center";
Extent = "245 57"; profile = "ToolsGuiDefaultProfile";
MinExtent = "8 2"; visible = "1";
canSave = "1"; active = "1";
Visible = "1"; tooltipProfile = "ToolsGuiToolTipProfile";
tooltipprofile = "ToolsGuiToolTipProfile";
hovertime = "1000"; hovertime = "1000";
isContainer = "1";
internalName = "Dialog"; internalName = "Dialog";
canSave = "1";
canSaveDynamicFields = "0"; canSaveDynamicFields = "0";
new GuiTextCtrl() { new GuiTextCtrl() {
text = "Loading the World Editor..."; text = "Loading the Editor...";
maxLength = "1024"; maxLength = "1024";
Margin = "0 0 0 0"; margin = "0 0 0 0";
Padding = "0 0 0 0"; padding = "0 0 0 0";
AnchorTop = "1"; anchorTop = "1";
AnchorBottom = "0"; anchorBottom = "0";
AnchorLeft = "1"; anchorLeft = "1";
AnchorRight = "0"; anchorRight = "0";
isContainer = "0";
Profile = "ToolsGuiTextBoldCenterProfile";
HorizSizing = "width";
VertSizing = "center";
position = "5 19"; position = "5 19";
Extent = "236 18"; extent = "236 18";
MinExtent = "8 2"; minExtent = "8 2";
canSave = "1"; horizSizing = "width";
Visible = "1"; vertSizing = "center";
tooltipprofile = "ToolsGuiToolTipProfile"; profile = "ToolsGuiTextBoldCenterProfile";
visible = "1";
active = "1";
tooltipProfile = "ToolsGuiToolTipProfile";
hovertime = "1000"; hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0"; canSaveDynamicFields = "0";
}; };
}; };

View file

@ -29,7 +29,6 @@ exec("./colorPicker.ed.gui");
exec("./materialSelector.ed.gui"); exec("./materialSelector.ed.gui");
exec("./scriptEditorDlg.ed.gui"); exec("./scriptEditorDlg.ed.gui");
exec("./colladaImport.ed.gui"); exec("./colladaImport.ed.gui");
exec("./EditorLoadingGui.gui");
exec("./GuiEaseEditDlg.ed.gui"); exec("./GuiEaseEditDlg.ed.gui");
exec("./GuiEaseEditDlg.ed.cs"); exec("./GuiEaseEditDlg.ed.cs");
exec("./guiObjectInspector.ed.cs"); exec("./guiObjectInspector.ed.cs");

View file

@ -33,19 +33,33 @@ $Tools::loadFirst = "editorClasses base worldEditor";
//--------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------
$Tools::materialEditorList = ""; $Tools::materialEditorList = "";
//--------------------------------------------------------------------------------------------- if(!$Tools::loaded)
// Tools Package.
//---------------------------------------------------------------------------------------------
package Tools
{ {
function loadKeybindings() new Settings(EditorSettings) { file = "tools/settings.xml"; };
{ EditorSettings.read();
Parent::loadKeybindings();
}
// Start-up. exec( "tools/gui/profiles.ed.cs" );
function onStart() exec("tools/gui/EditorLoadingGui.gui");
{ }
function EditorIsActive()
{
return ( isObject(EditorGui) && Canvas.getContent() == EditorGui.getId() );
}
function GuiEditorIsActive()
{
return ( isObject(GuiEditorGui) && Canvas.getContent() == GuiEditorGui.getId() );
}
function loadKeybindings()
{
Parent::loadKeybindings();
}
// Start-up.
function onStart()
{
//First, we want to ensure we don't inadvertently clean up our editor objects by leaving them in the MissionCleanup group, so lets change that real fast //First, we want to ensure we don't inadvertently clean up our editor objects by leaving them in the MissionCleanup group, so lets change that real fast
$instantGroup = ""; $instantGroup = "";
pushInstantGroup(); pushInstantGroup();
@ -60,7 +74,6 @@ package Tools
// Common GUI stuff. // Common GUI stuff.
exec( "./gui/cursors.ed.cs" ); exec( "./gui/cursors.ed.cs" );
exec( "./gui/profiles.ed.cs" );
exec( "./gui/messageBoxes/messageBox.ed.cs" ); exec( "./gui/messageBoxes/messageBox.ed.cs" );
exec( "./editorClasses/gui/panels/navPanelProfiles.ed.cs" ); exec( "./editorClasses/gui/panels/navPanelProfiles.ed.cs" );
@ -141,10 +154,10 @@ package Tools
pushInstantGroup(); pushInstantGroup();
$Tools::loaded = true; $Tools::loaded = true;
} }
function startToolTime(%tool) function startToolTime(%tool)
{ {
if($toolDataToolCount $= "") if($toolDataToolCount $= "")
$toolDataToolCount = 0; $toolDataToolCount = 0;
@ -158,10 +171,10 @@ package Tools
$toolDataStartTime[%tool] = getSimTime(); $toolDataStartTime[%tool] = getSimTime();
$toolDataClickCount[%tool]++; $toolDataClickCount[%tool]++;
} }
function endToolTime(%tool) function endToolTime(%tool)
{ {
%startTime = 0; %startTime = 0;
if($toolDataStartTime[%tool] !$= "") if($toolDataStartTime[%tool] !$= "")
@ -171,10 +184,10 @@ package Tools
$toolDataTotalTime[%tool] = 0; $toolDataTotalTime[%tool] = 0;
$toolDataTotalTime[%tool] += getSimTime() - %startTime; $toolDataTotalTime[%tool] += getSimTime() - %startTime;
} }
function dumpToolData() function dumpToolData()
{ {
%count = $toolDataToolCount; %count = $toolDataToolCount;
for(%i=0; %i<%count; %i++) for(%i=0; %i<%count; %i++)
{ {
@ -189,11 +202,11 @@ package Tools
echo("Activated: " @ %clickCount); echo("Activated: " @ %clickCount);
echo("---"); echo("---");
} }
} }
// Shutdown. // Shutdown.
function onExit() function onExit()
{ {
if( EditorGui.isInitialized ) if( EditorGui.isInitialized )
EditorGui.shutdown(); EditorGui.shutdown();
@ -211,13 +224,9 @@ package Tools
call( %destroyFunction ); call( %destroyFunction );
} }
// Call Parent.
Parent::onExit();
// write out our settings xml file // write out our settings xml file
EditorSettings.write(); EditorSettings.write();
} }
};
function EditorCreateFakeGameSession(%fileName) function EditorCreateFakeGameSession(%fileName)
{ {
@ -248,7 +257,12 @@ function fastLoadWorldEdit(%val)
{ {
if(!$Tools::loaded) if(!$Tools::loaded)
{ {
canvas.pushDialog( EditorLoadingGui );
canvas.repaint();
onStart(); onStart();
canvas.popDialog(EditorLoadingGui);
} }
%timerId = startPrecisionTimer(); %timerId = startPrecisionTimer();
@ -318,7 +332,12 @@ function fastLoadGUIEdit(%val)
{ {
if(!$Tools::loaded) if(!$Tools::loaded)
{ {
canvas.pushDialog( EditorLoadingGui );
canvas.repaint();
onStart(); onStart();
canvas.popDialog(EditorLoadingGui);
} }
toggleGuiEditor(true); toggleGuiEditor(true);
@ -339,21 +358,7 @@ function Tools::LoadResources( %path )
} }
} }
//-----------------------------------------------------------------------------
// Activate Package.
//-----------------------------------------------------------------------------
activatePackage(Tools);
//This lets us fast-load the editor from the menu //This lets us fast-load the editor from the menu
GlobalActionMap.bind(keyboard, "F11", fastLoadWorldEdit); GlobalActionMap.bind(keyboard, "F11", fastLoadWorldEdit);
GlobalActionMap.bind(keyboard, "F10", fastLoadGUIEdit); GlobalActionMap.bind(keyboard, "F10", fastLoadGUIEdit);
function EditorIsActive()
{
return ( isObject(EditorGui) && Canvas.getContent() == EditorGui.getId() );
}
function GuiEditorIsActive()
{
return ( isObject(GuiEditorGui) && Canvas.getContent() == GuiEditorGui.getId() );
}

View file

@ -105,6 +105,7 @@ function setupEditorVisibilityMenu()
item[ 6 ] = "Show Texel Density" TAB "" TAB "toggleTexelDensityViz();"; item[ 6 ] = "Show Texel Density" TAB "" TAB "toggleTexelDensityViz();";
}; };
%probespopup.enableItem(5, false);
%probespopup.enableItem(6, false); %probespopup.enableItem(6, false);
// //
@ -135,6 +136,9 @@ function setupEditorVisibilityMenu()
item[ 3 ] = "Show Diffuse Light" TAB "" TAB ""; item[ 3 ] = "Show Diffuse Light" TAB "" TAB "";
}; };
%lightspopup.enableItem(2, false);
%lightspopup.enableItem(3, false);
// //
//Probes //Probes
%probespopup = new PopupMenu(EVisibilityProbesOptions) %probespopup = new PopupMenu(EVisibilityProbesOptions)