From ec85e9021c68edb085b6b420a1f675985ddd952b Mon Sep 17 00:00:00 2001 From: Areloch Date: Sat, 28 Aug 2021 18:51:27 -0500 Subject: [PATCH 1/7] Misc Quality of Life and Bug fixes Added handling for if preview images on image assets fails to generate, will fallback to using the full image Added handling for double clicking or drag-n-dropping terrain assets to create them Improved handling of field labels in variable inspector by making the stringtable be case sensitive. Added editor settings for handling of asset double click behavior. Can now select between Edit Asset and Spawn Asset. Support is asset type dependent. Added editor setting for auto-importing loose files when navigating to a folder. If on and the user has flagged to also enable auto-import generally, will auto import all unaffiliated loose files in as assets. Added editor setting for default module to use when creating new assets. Updated various tooling logic so when creating a new material, if this and the 'Always Prompt Module Target' setting is off, it will fill in the target module and target asset path info based on the default module. Fixed issue with editors that use managedData scripts where if the path didn't exist, the script file wouldn't be made. Fixed display issue in terrain editor where if you clear the detail map, the normal/macro/orm maps would disable, but not also clear. Fixed handling of cleared maps in terrain editor so it no longer fills empty maps in with the no image image. Fixed handling of creating new material where it would fill in the diffuse with a no texture image as the default. Fixed issue where canceling out of creating a module would still prompt to create the common default folders. Fixed issue where the Select Module window couldn't be closed via the cancel or x buttons. Based on feedback, reduced default size of the Text Pad window. Fixed issue where the Drop At menu list wouldn't correctly display which item was marked after it was changed. Fixed spawning shape asset handling so it uses whatever the editor's Drop At setting is. Improved themeing of regular bitmap buttons in the editor. Based on feedback, flipped layout of Target Module and Target Path in the Create New Asset window. Improved handling of setting up the Target Path for when creating new assets. If a path is not set, and the user has a Default Module, it will default the path to that module. --- Engine/source/T3D/assets/ImageAsset.cpp | 8 +- Engine/source/T3D/assets/TerrainAsset.cpp | 7 + .../editor/inspector/variableInspector.cpp | 2 +- .../tools/assetBrowser/guis/assetBrowser.gui | 2 +- .../game/tools/assetBrowser/guis/newAsset.gui | 68 +++--- .../tools/assetBrowser/guis/selectModule.gui | 5 +- .../scripts/addModuleWindow.tscript | 7 +- .../assetBrowser/scripts/assetBrowser.tscript | 10 + .../scripts/assetTypes/image.tscript | 15 +- .../scripts/assetTypes/shape.tscript | 13 +- .../scripts/assetTypes/terrain.tscript | 18 +- .../assetBrowser/scripts/editModule.tscript | 6 +- .../assetBrowser/scripts/newAsset.tscript | 45 ++-- .../assetBrowser/scripts/selectModule.tscript | 13 +- .../datablockEditor/datablockEditor.tscript | 6 + .../tools/decalEditor/decalEditorGui.tscript | 5 + .../forestEditor/forestEditorGui.tscript | 6 + .../tools/gui/editorSettingsWindow.ed.tscript | 24 +++ .../game/tools/gui/profiles.ed.tscript | 7 +- .../game/tools/gui/scriptEditorDlg.ed.gui | 204 +++++++++--------- .../scripts/materialEditor.ed.tscript | 6 +- .../particleEmitterEditor.ed.tscript | 5 + .../particleParticleEditor.ed.tscript | 5 + .../scripts/editors/terrainEditor.ed.tscript | 2 +- .../interfaces/terrainMaterialDlg.ed.tscript | 24 ++- .../scripts/menuHandlers.ed.tscript | 7 +- 26 files changed, 332 insertions(+), 188 deletions(-) diff --git a/Engine/source/T3D/assets/ImageAsset.cpp b/Engine/source/T3D/assets/ImageAsset.cpp index 165b103f5..4376614ed 100644 --- a/Engine/source/T3D/assets/ImageAsset.cpp +++ b/Engine/source/T3D/assets/ImageAsset.cpp @@ -438,15 +438,15 @@ ImageAsset::ImageTypes ImageAsset::getImageTypeFromName(const char* name) } DefineEngineMethod(ImageAsset, getImagePath, const char*, (), , - "Creates an instance of the given GameObject given the asset definition.\n" - "@return The GameObject entity created from the asset.") + "Gets the image filepath of this asset.\n" + "@return File path of the image file.") { return object->getImagePath(); } DefineEngineMethod(ImageAsset, getImageInfo, const char*, (), , - "Creates an instance of the given GameObject given the asset definition.\n" - "@return The GameObject entity created from the asset.") + "Gets the info and properties of the image.\n" + "@return The info/properties of the image.") { return object->getImageInfo(); } diff --git a/Engine/source/T3D/assets/TerrainAsset.cpp b/Engine/source/T3D/assets/TerrainAsset.cpp index 997806ed6..da0372097 100644 --- a/Engine/source/T3D/assets/TerrainAsset.cpp +++ b/Engine/source/T3D/assets/TerrainAsset.cpp @@ -429,6 +429,13 @@ void TerrainAsset::copyTo(SimObject* object) Parent::copyTo(object); } +DefineEngineMethod(TerrainAsset, getTerrainFilePath, const char*, (), , + "Gets the terrain filepath of this asset.\n" + "@return File path of the terrain file.") +{ + return object->getTerrainFilePath(); +} + //----------------------------------------------------------------------------- // GuiInspectorTypeAssetId //----------------------------------------------------------------------------- diff --git a/Engine/source/gui/editor/inspector/variableInspector.cpp b/Engine/source/gui/editor/inspector/variableInspector.cpp index e639cad0f..e280cbfb7 100644 --- a/Engine/source/gui/editor/inspector/variableInspector.cpp +++ b/Engine/source/gui/editor/inspector/variableInspector.cpp @@ -150,7 +150,7 @@ void GuiVariableInspector::addField(const char* name, const char* label, const c { VariableField newField; newField.mFieldName = StringTable->insert(name); - newField.mFieldLabel = StringTable->insert(label); + newField.mFieldLabel = StringTable->insert(label, true); newField.mFieldTypeName = StringTable->insert(typeName); newField.mFieldDescription = StringTable->insert(description); newField.mDefaultValue = StringTable->insert(defaultValue); diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/assetBrowser.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/assetBrowser.gui index 92f4358c5..fc815d5cb 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/guis/assetBrowser.gui +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/assetBrowser.gui @@ -247,7 +247,7 @@ tooltip = "Create a new asset in the current directory"; hovertime = "1000"; isContainer = "0"; - internalName = "CreateAssetButton"; + class="CreateAssetButton"; canSave = "1"; canSaveDynamicFields = "0"; }; diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/newAsset.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/newAsset.gui index cd9cc378b..722df448d 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/guis/newAsset.gui +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/newAsset.gui @@ -31,7 +31,7 @@ anchorBottom = "0"; anchorLeft = "1"; anchorRight = "0"; - position = "328 140"; + position = "328 159"; extent = "368 450"; minExtent = "48 92"; horizSizing = "center"; @@ -54,7 +54,7 @@ anchorBottom = "0"; anchorLeft = "1"; anchorRight = "0"; - position = "12 54"; + position = "12 29"; extent = "116 17"; minExtent = "8 2"; horizSizing = "right"; @@ -68,6 +68,35 @@ canSave = "1"; canSaveDynamicFields = "0"; }; + new GuiPopUpMenuCtrlEx(NewAssetTargetModule) { + maxPopupHeight = "200"; + sbUsesNAColor = "0"; + reverseTextList = "0"; + bitmapBounds = "16 16"; + hotTrackCallback = "0"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "135 28"; + extent = "202 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiPopUpMenuProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + internalName = "ModuleList"; + class = "AssetBrowserModuleList"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; new GuiTextCtrl() { text = "Target Path:"; maxLength = "1024"; @@ -77,7 +106,7 @@ anchorBottom = "0"; anchorLeft = "1"; anchorRight = "0"; - position = "12 30"; + position = "12 54"; extent = "116 17"; minExtent = "8 2"; horizSizing = "right"; @@ -104,7 +133,7 @@ anchorBottom = "0"; anchorLeft = "1"; anchorRight = "0"; - position = "135 30"; + position = "135 54"; extent = "201 18"; minExtent = "8 2"; horizSizing = "width"; @@ -128,7 +157,7 @@ groupNum = "-1"; buttonType = "PushButton"; useMouseEvents = "0"; - position = "343 27"; + position = "340 51"; extent = "22 22"; minExtent = "8 2"; horizSizing = "left"; @@ -144,33 +173,6 @@ canSave = "1"; canSaveDynamicFields = "0"; }; - new GuiTextEditCtrl(NewAssetTargetModule) { - historySize = "0"; - tabComplete = "0"; - sinkAllKeyEvents = "0"; - password = "0"; - passwordMask = "*"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "135 53"; - extent = "202 18"; - minExtent = "8 2"; - horizSizing = "width"; - vertSizing = "bottom"; - profile = "ToolsGuiTextEditProfile"; - visible = "1"; - active = "0"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; new GuiScrollCtrl() { willFirstRespond = "1"; hScrollBar = "alwaysOn"; @@ -213,7 +215,7 @@ changeChildSizeToFit = "1"; changeChildPosition = "1"; position = "1 1"; - extent = "337 338"; + extent = "337 56"; minExtent = "16 16"; horizSizing = "width"; vertSizing = "height"; diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/selectModule.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/selectModule.gui index 95bf9b399..7a6bcb337 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/guis/selectModule.gui +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/selectModule.gui @@ -44,6 +44,7 @@ isContainer = "1"; canSave = "1"; canSaveDynamicFields = "0"; + closeCommand="Canvas.popDialog(AssetBrowser_SelectModule);"; new GuiPopUpMenuCtrlEx() { maxPopupHeight = "200"; @@ -95,7 +96,7 @@ tooltipProfile = "GuiToolTipProfile"; hovertime = "1000"; isContainer = "0"; - class = "SelectPackage_NewAssetModuleBtn"; + class = "AssetBrowserSelModuleAddBtn"; canSave = "1"; canSaveDynamicFields = "0"; }; @@ -132,7 +133,7 @@ profile = "ToolsGuiButtonProfile"; visible = "1"; active = "1"; - command = "Canvas.popDialog(AssetBrowser_addModule);"; + command = "Canvas.popDialog(AssetBrowser_SelectModule);"; tooltipProfile = "ToolsGuiToolTipProfile"; hovertime = "1000"; isContainer = "0"; diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/addModuleWindow.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/addModuleWindow.tscript index 7a704613e..833a3031b 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/addModuleWindow.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/addModuleWindow.tscript @@ -32,7 +32,7 @@ function AssetBrowser_addModuleWindow::onGainFirstResponder(%this) function AssetBrowser_addModuleWindow::close() { Canvas.popDialog(AssetBrowser_addModule); - eval(AssetBrowser_addModuleWindow.callbackFunction); + //eval(AssetBrowser_addModuleWindow.callbackFunction); } function AssetBrowser_addModuleWindow::CreateNewModule(%this) @@ -127,4 +127,9 @@ function AssetBrowserModuleList::refresh(%this) %moduleName = getWord(%moduleList, %i); %this.add(%moduleName.ModuleId, %i); } +} + +function AssetBrowserSelModuleAddBtn::onClick(%this) +{ + AssetBrowser.CreateNewModule("AssetBrowser_selectModule.newModuleAdded();"); } \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript index 7ddf13ef3..11047ac29 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript @@ -41,7 +41,10 @@ function AssetBrowser::onWake(%this) new ArrayObject(AssetPreviewArray); if(!isObject(%this.dirHandler)) + { %this.dirHandler = makedirectoryHandler(AssetBrowser-->filterTree, "cache,shaderCache", ""); + %this.dirHandler.currentAddress = "data/"; + } AssetBrowser-->filterTree.buildIconTable( ":tools/classIcons/Prefab:tools/classIcons/Prefab" @ ":tools/classIcons/SimSet:tools/classIcons/SimSet"); @@ -2057,7 +2060,14 @@ function AssetBrowser::navigateTo(%this, %address, %historyNav) if(%this.hasLooseFilesInDir()) { + if(EditorSettings.value("Assets/AutoImportLooseFiles", false) && EditorSettings.value("Assets/AutoImport", false)) + { + AssetBrowser.autoImportSimpleLooseFiles(); + } + else + { %this-->AutoImportAssetButton.visible = true; + } } else { diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/image.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/image.tscript index b306c9300..4a727143b 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/image.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/image.tscript @@ -196,6 +196,8 @@ function AssetBrowser::buildImageAssetPreview(%this, %assetDef, %previewData) %success = saveScaledImage(%assetDef.getImagePath(), %previewFilePath); + if(%success) + { %previewAsset = new ImageAsset() { assetName = %previewAssetName; @@ -203,15 +205,26 @@ function AssetBrowser::buildImageAssetPreview(%this, %assetDef, %previewData) imageFile = fileName(%previewFilePath); }; + %previewAssetName = "ToolsModule:" @ %previewAssetName; %previewImgAssetPath = %previewPath @ %previewAsset.assetName @ ".asset.taml"; %assetImportSuccessful = TAMLWrite(%previewAsset, %previewImgAssetPath); %toolsModuleDef = ModuleDatabase.findModule("ToolsModule",1); %success = AssetDatabase.addDeclaredAsset(%toolsModuleDef, %previewImgAssetPath); + } + else + { + %previewFilePath = %assetDef.getImagePath(); + %previewAssetName = %module.moduleId @ ":" @ %assetDef.assetName; + } hideEditorLoadingGui(); } + else + { + %previewAssetName = "ToolsModule:" @ %previewAssetName; + } //Revalidate. If it didn't work, just use the default placeholder one if(!isFile(%previewFilePath)) @@ -220,7 +233,7 @@ function AssetBrowser::buildImageAssetPreview(%this, %assetDef, %previewData) %previewData.assetName = %assetDef.assetName; %previewData.assetPath = %assetDef.scriptFile; - %previewData.previewImage = "ToolsModule:" @ %previewAssetName;//%assetDef.fileName; + %previewData.previewImage = %previewAssetName; %previewData.assetFriendlyName = %assetDef.assetName; %previewData.assetDesc = %assetDef.description; diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shape.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shape.tscript index e4687faf1..ca4fb784d 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shape.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shape.tscript @@ -318,16 +318,23 @@ function AssetBrowser::buildShapeAssetPreview(%this, %assetDef, %previewData) "Shape File path: " @ %assetDef.getShapeFile(); if(%this.selectMode) + { %previewData.doubleClickCommand = "AssetBrowser.selectAsset( AssetBrowser.selectedAsset );"; + } else + { + if(EditorSettings.value("Assets/Browser/doubleClickAction", "Edit Asset") $= "Edit Asset") %previewData.doubleClickCommand = "AssetBrowser.editAsset( "@%assetDef@" );"; + else + %previewData.doubleClickCommand = "AssetBrowser.onShapeAssetEditorDropped( "@%assetDef@" );"; + } } function AssetBrowser::onShapeAssetEditorDropped(%this, %assetDef, %position) { //echo("DROPPED A SHAPE ON THE EDITOR WINDOW!"); - %targetPosition = EWorldEditor.unproject(%position SPC 1000); + /*%targetPosition = EWorldEditor.unproject(%position SPC 1000); %camPos = LocalClientConnection.camera.getPosition(); %rayResult = containerRayCast(%camPos, %targetPosition, -1); @@ -340,7 +347,7 @@ function AssetBrowser::onShapeAssetEditorDropped(%this, %assetDef, %position) else { %pos = "0 0 0"; - } + }*/ %assetId = %assetDef.getAssetId(); @@ -354,6 +361,8 @@ function AssetBrowser::onShapeAssetEditorDropped(%this, %assetDef, %position) EWorldEditor.clearSelection(); EWorldEditor.selectObject(%newStatic); + + EWorldEditor.dropSelection(); EWorldEditor.isDirty = true; diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/terrain.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/terrain.tscript index 85a9cd9c2..8b3f1bf09 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/terrain.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/terrain.tscript @@ -148,6 +148,11 @@ function AssetBrowser::dragAndDropTerrainAsset(%this, %assetDef, %dropTarget) return; } +function AssetBrowser::onTerrainAssetEditorDropped(%this, %assetDef, %position) +{ + createTerrainBlock(%assetDef.getAssetId()); +} + function AssetBrowser::renameTerrainAsset(%this, %assetDef, %newAssetId, %originalName, %newName) { } @@ -160,7 +165,6 @@ function AssetBrowser::buildTerrainAssetPreview(%this, %assetDef, %previewData) { %previewData.assetName = %assetDef.assetName; %previewData.assetPath = ""; - %previewData.doubleClickCommand = ""; %previewData.previewImage = "ToolsModule:gameObjectIcon_image"; @@ -170,6 +174,18 @@ function AssetBrowser::buildTerrainAssetPreview(%this, %assetDef, %previewData) "\nAsset Type: Terrain Asset" @ "\nAsset Definition ID: " @ %assetDef @ "\nDefinition Path: " @ %assetPath @ %assetDef.getTerrainFilePath(); + + if(%this.selectMode) + { + %previewData.doubleClickCommand = "AssetBrowser.selectAsset( AssetBrowser.selectedAsset );"; + } + else + { + if(EditorSettings.value("Assets/Browser/doubleClickAction", "Edit Asset") $= "Edit Asset") + %previewData.doubleClickCommand = ""; + else + %previewData.doubleClickCommand = "createTerrainBlock(\""@%assetDef.getAssetId()@"\");"; + } } function GuiInspectorTypeTerrainAssetPtr::onClick( %this, %fieldName ) diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/editModule.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/editModule.tscript index 4d5a22ff1..71e248c2c 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/editModule.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/editModule.tscript @@ -10,12 +10,13 @@ function AssetBrowser::ConvertFolderIntoModule(%this, %folderName) AssetBrowser_addModuleWindow.CreateNewModule(); } -function AssetBrowser::CreateNewModule(%this) +function AssetBrowser::CreateNewModule(%this, %callback) { Canvas.pushDialog(AssetBrowser_AddModule); AssetBrowser_addModuleWindow.selectWindow(); AssetBrowser_addModuleWindow.callbackFunction = "AssetBrowser.promptNewModuleFolders();"; + AssetBrowser_addModuleWindow.callbackFallthrough = %callback; } function AssetBrowser::promptNewModuleFolders(%this) @@ -24,6 +25,9 @@ function AssetBrowser::promptNewModuleFolders(%this) "Do you want to create some common folders for organization of your new Module?", "AssetBrowser.makeModuleFolders();", //if yes, make the foldesr "AssetBrowser.loadDirectories();"); //if no, just refresh + + if(AssetBrowser_addModuleWindow.callbackFallthrough !$= "") + eval(AssetBrowser_addModuleWindow.callbackFallthrough); } function AssetBrowser::makeModuleFolders(%this) diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/newAsset.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/newAsset.tscript index dc46dcd2b..f22c6f73d 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/newAsset.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/newAsset.tscript @@ -26,9 +26,22 @@ function CreateAssetButton::onClick(%this) function AssetBrowser_newAsset::onWake(%this) { - NewAssetTargetAddress.text = AssetBrowser.dirHandler.currentAddress; - NewAssetTargetModule.text = AssetBrowser.dirHandler.getModuleFromAddress(AssetBrowser.dirHandler.currentAddress).ModuleId; + %targetModule = AssetBrowser.dirHandler.getModuleFromAddress(AssetBrowser.dirHandler.currentAddress).ModuleId; + if(%targetModule $= "") + %targetModule = EditorSettings.value("Assets/New/defaultModule", ""); + + NewAssetTargetModule.setText(%targetModule); + + %moduleDef = ModuleDatabase.findModule(%targetModule); + + %targetPath = AssetBrowser.dirHandler.currentAddress; + if(!startsWith(%targetPath, %moduleDef.ModulePath)) + { + %targetPath = %moduleDef.ModulePath; + } + + NewAssetTargetAddress.text = %targetPath; } function AssetBrowser_newAssetWindow::onClose(%this) @@ -107,34 +120,6 @@ function AssetBrowser::setupCreateNewAsset(%this, %assetType, %moduleName, %call %command = %this @ ".setupCreateNew"@%assetType @"();"; eval(%command); } - /*if(%assetType $= "ComponentAsset") - { - NewAssetPropertiesInspector.startGroup("Components"); - NewAssetPropertiesInspector.addField("parentClass", "New Asset Parent Class", "String", "Name of the new asset's parent class", "Component", "", %this.newAssetSettings); - NewAssetPropertiesInspector.addField("componentGroup", "Component Group", "String", "Name of the group of components this component asset belongs to", "", "", %this.newAssetSettings); - //NewAssetPropertiesInspector.addField("componentName", "Component Name", "String", "Name of the new component", "", "", %this.newAssetSettings); - NewAssetPropertiesInspector.endGroup(); - }*/ - //Special case, we only do this via internal means like baking - /*else if(%assetType $= "ShapeAsset") - { - NewAssetPropertiesInspector.startGroup("Shape"); - NewAssetPropertiesInspector.addField("isServerScript", "Is Server Script", "bool", "Is this script used on the server?", "1", "", %this.newAssetSettings); - NewAssetPropertiesInspector.endGroup(); - }*/ - /*else if(%assetType $= "ShapeAnimationAsset") - { - NewAssetPropertiesInspector.startGroup("Animation"); - NewAssetPropertiesInspector.addField("sourceFile", "Source File", "filename", "Source file this animation will pull from", "", "", %this.newAssetSettings); - NewAssetPropertiesInspector.addField("animationName", "Animation Name", "string", "Name of the animation clip when used in a shape", "", "", %this.newAssetSettings); - - NewAssetPropertiesInspector.addField("startFrame", "Starting Frame", "int", "Source file this animation will pull from", "", "", %this.newAssetSettings); - NewAssetPropertiesInspector.addField("endFrame", "Ending Frame", "int", "Source file this animation will pull from", "", "", %this.newAssetSettings); - - NewAssetPropertiesInspector.addField("padRotation", "Pad Rotations", "bool", "Source file this animation will pull from", "0", "", %this.newAssetSettings); - NewAssetPropertiesInspector.addField("padTransforms", "Pad Transforms", "bool", "Source file this animation will pull from", "0", "", %this.newAssetSettings); - NewAssetPropertiesInspector.endGroup(); - }*/ } function NewAssetPropertiesInspector::updateNewAssetField(%this) diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/selectModule.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/selectModule.tscript index 54358a8e8..9796ff901 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/selectModule.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/selectModule.tscript @@ -7,6 +7,14 @@ function AssetBrowser_SelectModule::showDialog(%this, %callback) function AssetBrowser_SelectModule::onWake(%this) { AssetBrowser_SelectModuleWindow-->ModuleList.refresh(); + + %defaultModule = EditorSettings.value("Assets/New/defaultModule", ""); + if(%defaultModule !$= "" && + EditorSettings.value("Assets/New/alwaysPromptModuleTarget", false) == false) + { + Canvas.popDialog(AssetBrowser_SelectModule); + eval(%this.callback @ "(" @ %defaultModule @ ");"); + } } function AssetBrowser_SelectModule::moduleSelected(%this) @@ -24,10 +32,7 @@ function AssetBrowser_SelectModule::moduleSelected(%this) function SelectModule_NewAssetModuleBtn::onClick(%this) { - Canvas.pushDialog(AssetBrowser_AddModule); - AssetBrowser_addModuleWindow.selectWindow(); - - AssetBrowser_AddModule.callback = "AssetBrowser_selectModule.newModuleAdded();"; + AssetBrowser.CreateNewModule("AssetBrowser_selectModule.newModuleAdded();"); } function AssetBrowser_selectModule::newModuleAdded(%this) diff --git a/Templates/BaseGame/game/tools/datablockEditor/datablockEditor.tscript b/Templates/BaseGame/game/tools/datablockEditor/datablockEditor.tscript index 6ef48370a..4980dd3c2 100644 --- a/Templates/BaseGame/game/tools/datablockEditor/datablockEditor.tscript +++ b/Templates/BaseGame/game/tools/datablockEditor/datablockEditor.tscript @@ -686,6 +686,12 @@ function DatablockEditorPlugin::pickedNewDBTargetModule(%this, %module) %moduleDef = ModuleDatabase.findModule(%module); $DATABLOCK_EDITOR_DEFAULT_FILENAME = %moduleDef.ModulePath @ "/scripts/managedData/managedDatablocks." @ $TorqueScriptFileExtension; + + if(!isDirectory(filePath($DATABLOCK_EDITOR_DEFAULT_FILENAME))) + { + AssetBrowser.dirHandler.createFolder(filePath($DATABLOCK_EDITOR_DEFAULT_FILENAME)); + } + DatablockEditorPlugin.createDatablock(); } diff --git a/Templates/BaseGame/game/tools/decalEditor/decalEditorGui.tscript b/Templates/BaseGame/game/tools/decalEditor/decalEditorGui.tscript index f3bfc991e..0138d5331 100644 --- a/Templates/BaseGame/game/tools/decalEditor/decalEditorGui.tscript +++ b/Templates/BaseGame/game/tools/decalEditor/decalEditorGui.tscript @@ -167,6 +167,11 @@ function DecalEditorGui::pickedNewDecalTargetModule(%this, %module) %moduleDef = ModuleDatabase.findModule(%module); $decalDataFile = %moduleDef.ModulePath @ "/scripts/managedData/managedDecalData." @ $TorqueScriptFileExtension; + if(!isDirectory(filePath($decalDataFile))) + { + AssetBrowser.dirHandler.createFolder(filePath($decalDataFile)); + } + %name = getUniqueName( "NewDecalData" ); %str = "datablock DecalData( " @ %name @ " ) { Material = \"WarningMaterial\"; };"; diff --git a/Templates/BaseGame/game/tools/forestEditor/forestEditorGui.tscript b/Templates/BaseGame/game/tools/forestEditor/forestEditorGui.tscript index 93e659307..dd88668a1 100644 --- a/Templates/BaseGame/game/tools/forestEditor/forestEditorGui.tscript +++ b/Templates/BaseGame/game/tools/forestEditor/forestEditorGui.tscript @@ -180,6 +180,12 @@ function ForestEditorGui::pickedNewMeshTargetModule(%this, %module) %moduleDef = ModuleDatabase.findModule(%module); ForestEditorGui.forestItemDataPath = %moduleDef.ModulePath @ "/scripts/managedData/managedForestItemData." @ $TorqueScriptFileExtension; + + if(!isDirectory(filePath(ForestEditorGui.forestItemDataPath))) + { + AssetBrowser.dirHandler.createFolder(filePath(ForestEditorGui.forestItemDataPath)); + } + AssetBrowser.showDialog("ShapeAsset", "selectNewForestMesh", "", "", ""); } diff --git a/Templates/BaseGame/game/tools/gui/editorSettingsWindow.ed.tscript b/Templates/BaseGame/game/tools/gui/editorSettingsWindow.ed.tscript index b64d2cb42..8bec1dd9f 100644 --- a/Templates/BaseGame/game/tools/gui/editorSettingsWindow.ed.tscript +++ b/Templates/BaseGame/game/tools/gui/editorSettingsWindow.ed.tscript @@ -493,6 +493,28 @@ function ESettingsWindow::getAssetEditingSettings(%this) { ImportAssetWindow::reloadImportOptionConfigs(); + //First, get our list of modules + %moduleList = ModuleDatabase.findModules(); + %formattedModuleList = ""; + + %count = getWordCount(%moduleList); + for(%i=0; %i < %count; %i++) + { + %module = getWord(%moduleList, %i); + if(%module.group !$= "Tools" && %module.group !$= "Core") + { + if(%formattedModuleList $= "") + %formattedModuleList = %module.moduleId; + else + %formattedModuleList = %formattedModuleList @ "," @ %module.moduleId; + } + } + + SettingsInspector.startGroup("Asset Creation"); + SettingsInspector.addSettingsField("Assets/New/defaultModule", "Default Module", "list", "Default Module for new assets to be created into", %formattedModuleList); + SettingsInspector.addSettingsField("Assets/New/alwaysPromptModuleTarget", "Always Prompt Target Module", "bool", "If off, use the default module"); + SettingsInspector.endGroup(); + for(%i=0; %i < ImportAssetWindow.importConfigsList.Count(); %i++) { %configName = ImportAssetWindow.importConfigsList.getKey(%i); @@ -506,6 +528,7 @@ function ESettingsWindow::getAssetEditingSettings(%this) "will attempt to automatically import any inbound assets"@ "using the default config, without prompting the import window."@ "The window will still display if any issues are detected", ""); + SettingsInspector.addSettingsField("Assets/AutoImportLooseFiles", "Automatically Import Loose Files", "bool", "If on, will automatically import unassociated loose files in assets when navigating the Asset Browser.", ""); SettingsInspector.endGroup(); SettingsInspector.startGroup("Asset Browser"); @@ -516,6 +539,7 @@ function ESettingsWindow::getAssetEditingSettings(%this) SettingsInspector.addSettingsField("Assets/Browser/showEmptyFolders", "Show Empty Folders in Tiles view in Asset Browser", "bool", ""); SettingsInspector.addSettingsField("Assets/Browser/showLooseFiles", "Show Loose Files when viewing in Asset Browser", "bool", ""); SettingsInspector.addSettingsField("AssetManagement/Assets/promptOnRename", "Prompt on Rename", "bool", ""); + SettingsInspector.addSettingsField("Assets/Browser/doubleClickAction", "Double Click Action", "list", "Dictates what sort of action double clicking on an asset in the Browser will invoke", "Edit Asset,Spawn Asset"); SettingsInspector.endGroup(); } diff --git a/Templates/BaseGame/game/tools/gui/profiles.ed.tscript b/Templates/BaseGame/game/tools/gui/profiles.ed.tscript index c95f2bc6a..003bd314d 100644 --- a/Templates/BaseGame/game/tools/gui/profiles.ed.tscript +++ b/Templates/BaseGame/game/tools/gui/profiles.ed.tscript @@ -353,13 +353,18 @@ new GuiControlProfile( ToolsGuiButtonProfile ) { opaque = true; border = true; + fillColor = EditorSettings.value("Theme/tabsColor"); + fillColorHL = EditorSettings.value("Theme/tabsGLColor"); + fillColorSEL = EditorSettings.value("Theme/tabsSELColor"); + fillColorNA = EditorSettings.value("Theme/tabsSELColor"); + fontColor = EditorSettings.value("Theme/fieldTextColor"); fontColorHL = EditorSettings.value("Theme/fieldTextHLColor"); fontColorNA = EditorSettings.value("Theme/fieldTextSELColor"); fixedExtent = false; justify = "center"; canKeyFocus = false; - bitmapAsset = "ToolsModule:button_image"; + //bitmapAsset = "ToolsModule:button_image"; hasBitmapArray = false; category = "Tools"; }; diff --git a/Templates/BaseGame/game/tools/gui/scriptEditorDlg.ed.gui b/Templates/BaseGame/game/tools/gui/scriptEditorDlg.ed.gui index 328a2f525..34cc45762 100644 --- a/Templates/BaseGame/game/tools/gui/scriptEditorDlg.ed.gui +++ b/Templates/BaseGame/game/tools/gui/scriptEditorDlg.ed.gui @@ -1,76 +1,80 @@ //--- OBJECT WRITE BEGIN --- %guiContent = new GuiControl(ScriptEditorDlg,EditorGuiGroup) { - isContainer = "1"; - Profile = "ToolsGuiDefaultNonModalProfile"; - HorizSizing = "width"; - VertSizing = "height"; position = "0 0"; - Extent = "1024 768"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - tooltipprofile = "ToolsGuiToolTipProfile"; + extent = "1024 768"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "height"; + profile = "ToolsGuiDefaultNonModalProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; hovertime = "1000"; - canSaveDynamicFields = "0"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; new GuiWindowCtrl() { + text = "Text Pad"; resizeWidth = "0"; resizeHeight = "0"; canMove = "1"; canClose = "1"; canMinimize = "1"; canMaximize = "1"; - minSize = "50 50"; + canCollapse = "0"; closeCommand = "ScriptEditorDlg.close();"; - EdgeSnap = "1"; - text = "Text Pad"; - Margin = "0 0 0 0"; - Padding = "0 0 0 0"; - AnchorTop = "1"; - AnchorBottom = "0"; - AnchorLeft = "1"; - AnchorRight = "0"; - isContainer = "1"; - Profile = "ToolsGuiWindowProfile"; - HorizSizing = "center"; - VertSizing = "center"; - position = "176 120"; - Extent = "656 464"; - MinExtent = "8 8"; - canSave = "1"; - Visible = "1"; - Command = "ScriptEditorDlg.close();"; - Accelerator = "escape"; - tooltipprofile = "ToolsGuiToolTipProfile"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "219 162"; + extent = "524 373"; + minExtent = "8 8"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "1"; + active = "1"; + command = "ScriptEditorDlg.close();"; + accelerator = "escape"; + tooltipProfile = "ToolsGuiToolTipProfile"; hovertime = "1000"; + isContainer = "1"; + canSave = "1"; canSaveDynamicFields = "0"; new GuiControl() { - isContainer = "1"; - Profile = "ToolsGuiDefaultProfile"; - HorizSizing = "width"; - VertSizing = "height"; position = "8 24"; - Extent = "640 392"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - tooltipprofile = "ToolsGuiToolTipProfile"; + extent = "508 291"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "height"; + profile = "ToolsGuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; hovertime = "1000"; + isContainer = "1"; + canSave = "1"; canSaveDynamicFields = "0"; new GuiControl() { - isContainer = "1"; - Profile = "ToolsGuiDefaultProfile"; - HorizSizing = "width"; - VertSizing = "height"; - position = "8 7"; - Extent = "627 380"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - tooltipprofile = "ToolsGuiToolTipProfile"; + position = "1 7"; + extent = "507 286"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "height"; + profile = "ToolsGuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; hovertime = "1000"; + isContainer = "1"; + canSave = "1"; canSaveDynamicFields = "0"; new GuiScrollCtrl() { @@ -82,23 +86,24 @@ constantThumbHeight = "0"; childMargin = "1 1"; mouseWheelScrollSpeed = "-1"; - Margin = "0 0 0 0"; - Padding = "0 0 0 0"; - AnchorTop = "1"; - AnchorBottom = "0"; - AnchorLeft = "1"; - AnchorRight = "0"; - isContainer = "1"; - Profile = "ToolsGuiScrollProfile"; - HorizSizing = "width"; - VertSizing = "height"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; position = "0 0"; - Extent = "627 380"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - tooltipprofile = "ToolsGuiToolTipProfile"; + extent = "507 286"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "height"; + profile = "ToolsGuiScrollProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; hovertime = "1000"; + isContainer = "1"; + canSave = "1"; canSaveDynamicFields = "0"; new GuiMLTextEditCtrl() { @@ -106,18 +111,19 @@ allowColorChars = "0"; maxChars = "-1"; useURLMouseCursor = "0"; - isContainer = "0"; - Profile = "ToolsGuiTextPadProfile"; - HorizSizing = "width"; - VertSizing = "height"; position = "2 2"; - Extent = "623 380"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - tooltipprofile = "ToolsGuiToolTipProfile"; + extent = "505 286"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "height"; + profile = "ToolsGuiTextPadProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; hovertime = "1000"; + isContainer = "0"; internalName = "TextPad"; + canSave = "1"; canSaveDynamicFields = "0"; }; }; @@ -125,7 +131,7 @@ }; new GuiIconButtonCtrl() { buttonMargin = "4 4"; - bitmapAsset = "ToolsModule:iconCancel_image"; + BitmapAsset = "ToolsModule:iconCancel_image"; iconLocation = "Left"; sizeIconToButton = "0"; makeIconSquare = "0"; @@ -136,23 +142,24 @@ groupNum = "-1"; buttonType = "PushButton"; useMouseEvents = "0"; - isContainer = "0"; - Profile = "ToolsGuiButtonProfile"; - HorizSizing = "left"; - VertSizing = "top"; - position = "460 424"; - Extent = "80 25"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - Command = "ScriptEditorDlg.close();"; - tooltipprofile = "ToolsGuiToolTipProfile"; + position = "335 334"; + extent = "80 25"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "top"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "ScriptEditorDlg.close();"; + tooltipProfile = "ToolsGuiToolTipProfile"; hovertime = "1000"; + isContainer = "0"; + canSave = "1"; canSaveDynamicFields = "0"; }; new GuiIconButtonCtrl() { buttonMargin = "4 4"; - bitmapAsset = "ToolsModule:iconAccept_image"; + BitmapAsset = "ToolsModule:iconAccept_image"; iconLocation = "Left"; sizeIconToButton = "0"; makeIconSquare = "0"; @@ -163,18 +170,19 @@ groupNum = "-1"; buttonType = "PushButton"; useMouseEvents = "0"; - isContainer = "0"; - Profile = "ToolsGuiButtonProfile"; - HorizSizing = "left"; - VertSizing = "top"; - position = "560 424"; - Extent = "80 25"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - Command = "_TextPadOnOk();"; - tooltipprofile = "ToolsGuiToolTipProfile"; + position = "436 334"; + extent = "80 25"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "top"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "_TextPadOnOk();"; + tooltipProfile = "ToolsGuiToolTipProfile"; hovertime = "1000"; + isContainer = "0"; + canSave = "1"; canSaveDynamicFields = "0"; }; }; diff --git a/Templates/BaseGame/game/tools/materialEditor/scripts/materialEditor.ed.tscript b/Templates/BaseGame/game/tools/materialEditor/scripts/materialEditor.ed.tscript index 3d24330c7..56725c8eb 100644 --- a/Templates/BaseGame/game/tools/materialEditor/scripts/materialEditor.ed.tscript +++ b/Templates/BaseGame/game/tools/materialEditor/scripts/materialEditor.ed.tscript @@ -2044,13 +2044,17 @@ function MaterialEditorGui::pickedNewMaterialTargetModule( %this, %module ) PE_EmitterEditor.targetModule = %module; MaterialEditorGui.defaultMaterialFile = %moduleDef.ModulePath @ "/scripts/managedData/materials." @ $TorqueScriptFileExtension; + if(!isDirectory(filePath(MaterialEditorGui.defaultMaterialFile))) + { + AssetBrowser.dirHandler.createFolder(filePath(MaterialEditorGui.defaultMaterialFile)); + } + %action = %this.createUndo(ActionCreateNewMaterial, "Create New Material"); %action.object = ""; %material = getUniqueName( "newMaterial" ); new Material(%material) { - diffuseMap[0] = "core/rendering/images/warnmat"; mapTo = "unmapped_mat"; parentGroup = RootGroup; }; diff --git a/Templates/BaseGame/game/tools/particleEditor/particleEmitterEditor.ed.tscript b/Templates/BaseGame/game/tools/particleEditor/particleEmitterEditor.ed.tscript index ecd6c0209..d68fb936d 100644 --- a/Templates/BaseGame/game/tools/particleEditor/particleEmitterEditor.ed.tscript +++ b/Templates/BaseGame/game/tools/particleEditor/particleEmitterEditor.ed.tscript @@ -563,6 +563,11 @@ function PE_EmitterEditor::pickedNewEmitterTargetModule( %this, %module ) PE_EmitterEditor.targetModule = %module; $PE_EMITTEREDITOR_DEFAULT_FILENAME = %moduleDef.ModulePath @ "/scripts/managedData/managedParticleEmitterData." @ $TorqueScriptFileExtension; + if(!isDirectory(filePath($PE_EMITTEREDITOR_DEFAULT_FILENAME))) + { + AssetBrowser.dirHandler.createFolder(filePath($PE_EMITTEREDITOR_DEFAULT_FILENAME)); + } + // Create a new emitter. %emitter = getUniqueName( "newEmitter" ); datablock ParticleEmitterData( %emitter : DefaultEmitter ) diff --git a/Templates/BaseGame/game/tools/particleEditor/particleParticleEditor.ed.tscript b/Templates/BaseGame/game/tools/particleEditor/particleParticleEditor.ed.tscript index ff6f4cd5f..e1a34fe4b 100644 --- a/Templates/BaseGame/game/tools/particleEditor/particleParticleEditor.ed.tscript +++ b/Templates/BaseGame/game/tools/particleEditor/particleParticleEditor.ed.tscript @@ -498,6 +498,11 @@ function PE_ParticleEditor::pickedNewParticleTargetModule(%this, %module) %moduleDef = ModuleDatabase.findModule(%module); $PE_PARTICLEEDITOR_DEFAULT_FILENAME = %moduleDef.ModulePath @ "/scripts/managedData/managedParticleData." @ $TorqueScriptFileExtension; + if(!isDirectory(filePath($PE_PARTICLEEDITOR_DEFAULT_FILENAME))) + { + AssetBrowser.dirHandler.createFolder(filePath($PE_PARTICLEEDITOR_DEFAULT_FILENAME)); + } + // Create the particle datablock and add to the emitter. %newParticle = getUniqueName( "newParticle" ); diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/editors/terrainEditor.ed.tscript b/Templates/BaseGame/game/tools/worldEditor/scripts/editors/terrainEditor.ed.tscript index 6942a0cf9..e9f39b003 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/editors/terrainEditor.ed.tscript +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/editors/terrainEditor.ed.tscript @@ -159,7 +159,7 @@ function EPainter::updateLayers( %this, %matIndex ) %ctrl = new GuiIconButtonCtrl() { profile = "GuiCreatorIconButtonProfile"; - iconBitmap = "~/worldEditor/images/terrainpainter/new_layer_icon"; + iconBitmapAsset = "ToolsModule:new_layer_icon_image"; iconLocation = "Left"; textLocation = "Right"; extent = %listWidth SPC "46"; diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/interfaces/terrainMaterialDlg.ed.tscript b/Templates/BaseGame/game/tools/worldEditor/scripts/interfaces/terrainMaterialDlg.ed.tscript index 3670c6ada..296fea200 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/interfaces/terrainMaterialDlg.ed.tscript +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/interfaces/terrainMaterialDlg.ed.tscript @@ -246,14 +246,22 @@ function TerrainMaterialDlg::clearTextureMap(%this, %mapName) %targetMap.setBitmap($TerrainMaterialEditor::emptyMaterialImage); %targetMap.asset = ""; + %targetMapName = %this.findObjectByInternalName(%mapName @ "AssetId", true); + %targetMapName.setText("None"); + TerrainMaterialDlg.matDirty = true; if(%mapName $= "DetailMap") { //hide the supplemental maps NormalMapContainer.callOnChildren("setActive", false); + %this.clearTextureMap("NormalMap"); + ORMMapContainer.callOnChildren("setActive", false); + %this.clearTextureMap("ORMMap"); + MacroMapContainer.callOnChildren("setActive", false); + %this.clearTextureMap("MacroMap"); } } @@ -290,6 +298,9 @@ function TerrainMaterialDlg::changeTerrainMatMapAsset(%this) %targetMap.setBitmap( %image ); + %targetMapName = %mapName @ "AssetId"; + %targetMapName.setText(%imgAsset); + TerrainMaterialDlg.matDirty = true; } @@ -546,29 +557,32 @@ function TerrainMaterialDlg::saveDirtyMaterial( %this, %mat ) %newName = %this-->matNameCtrl.getText(); + %blankBitmap = AssetDatabase.acquireAsset($TerrainMaterialEditor::emptyMaterialImage).getImagePath(); + + //--- %newDiffuse = %this-->texBaseMap.getBitmap(); - if(%newDiffuse $= $TerrainMaterialEditor::emptyMaterialImage) + if(%newDiffuse $= $TerrainMaterialEditor::emptyMaterialImage || %newDiffuse $= %blankBitmap) %newDiffuse = ""; //--- %newNormal = %this-->texNormalMap.getBitmap(); - if(%newNormal $= $TerrainMaterialEditor::emptyMaterialImage) + if(%newNormal $= $TerrainMaterialEditor::emptyMaterialImage || %newNormal $= %blankBitmap) %newNormal = ""; //--- %newormConfig = %this-->texORMConfigMap.getBitmap(); - if(%newormConfig $= $TerrainMaterialEditor::emptyMaterialImage) + if(%newormConfig $= $TerrainMaterialEditor::emptyMaterialImage || %newormConfig $= %blankBitmap) %newormConfig = ""; //--- %newDetail = %this-->texDetailMap.getBitmap(); - if(%newDetail $= $TerrainMaterialEditor::emptyMaterialImage) + if(%newDetail $= $TerrainMaterialEditor::emptyMaterialImage || %newDetail $= %blankBitmap) %newDetail = ""; //--- %newMacro = %this-->texMacroMap.getBitmap(); - if(%newMacro $= $TerrainMaterialEditor::emptyMaterialImage) + if(%newMacro $= $TerrainMaterialEditor::emptyMaterialImage || %newMacro $= %blankBitmap) %newMacro = ""; %detailSize = %this-->detSizeCtrl.getText(); diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/menuHandlers.ed.tscript b/Templates/BaseGame/game/tools/worldEditor/scripts/menuHandlers.ed.tscript index ee18a443f..efe33ee45 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/menuHandlers.ed.tscript +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/menuHandlers.ed.tscript @@ -1059,7 +1059,12 @@ function EditorDropTypeMenu::onSelectItem(%this, %id, %text) // a drop type is selected in the menu. EWorldEditor.dropType = getField(%this.item[%id], 2); - %this.checkRadioItem(0, (%this.getItemCount() - 1), %id); + for(%i=0; %i < %this.getItemCount() + 1; %i++) + { + %this.checkItem(%i, false); + } + + %this.checkItem(%id, true); return true; } From 633bc040d0a2695fba6fe7ff42efacc73b50def6 Mon Sep 17 00:00:00 2001 From: Jeff Hutchinson Date: Sun, 29 Aug 2021 20:34:57 -0400 Subject: [PATCH 2/7] Update thread ids for 64bit support. --- Engine/source/platform/threads/thread.h | 22 +++++++++---------- Engine/source/platformSDL/threads/thread.cpp | 10 ++++----- .../source/platformWin32/threads/thread.cpp | 8 +++---- .../source/platformX86UNIX/threads/thread.cpp | 10 ++++----- Engine/source/sfx/sfxInternal.h | 2 +- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Engine/source/platform/threads/thread.h b/Engine/source/platform/threads/thread.h index 0ae5a12b7..9d4b9259c 100644 --- a/Engine/source/platform/threads/thread.h +++ b/Engine/source/platform/threads/thread.h @@ -110,7 +110,7 @@ public: bool isAlive(); /// Returns the platform specific thread id for this thread. - U32 getId(); + dsize_t getId(); }; @@ -122,12 +122,12 @@ class ThreadManager struct MainThreadId { - U32 mId; + dsize_t mId; MainThreadId() { mId = ThreadManager::getCurrentThreadId(); } - U32 get() + dsize_t get() { // Okay, this is a bit soso. The main thread ID may get queried during // global ctor phase before MainThreadId's ctor ran. Since global @@ -152,21 +152,21 @@ public: static bool isMainThread(); /// Returns true if threadId is the same as the calling thread's id. - static bool isCurrentThread(U32 threadId); + static bool isCurrentThread(dsize_t threadId); /// Returns true if the 2 thread ids represent the same thread. Some thread /// APIs return an opaque object as a thread id, so the == operator cannot /// reliably compare thread ids. // this comparator is needed by pthreads and ThreadManager. - static bool compare(U32 threadId_1, U32 threadId_2); + static bool compare(dsize_t threadId_1, dsize_t threadId_2); /// Returns the platform specific thread id of the calling thread. Some /// platforms do not guarantee that this ID stays the same over the life of /// the thread, so use ThreadManager::compare() to compare thread ids. - static U32 getCurrentThreadId(); + static dsize_t getCurrentThreadId(); /// Returns the platform specific thread id ot the main thread. - static U32 getMainThreadId() { return smMainThreadId.get(); } + static dsize_t getMainThreadId() { return smMainThreadId.get(); } /// Each thread should add itself to the thread pool the first time it runs. static void addThread(Thread* thread) @@ -184,7 +184,7 @@ public: ThreadManager &manager = *ManagedSingleton< ThreadManager >::instance(); manager.poolLock.lock(); - U32 threadID = thread->getId(); + dsize_t threadID = thread->getId(); for(U32 i = 0;i < manager.threadPool.size();++i) { if( compare( manager.threadPool[i]->getId(), threadID ) ) @@ -199,7 +199,7 @@ public: /// Searches the pool of known threads for a thread whose id is equivalent to /// the given threadid. Compares thread ids with ThreadManager::compare(). - static Thread* getThreadById(U32 threadid) + static Thread* getThreadById(dsize_t threadid) { AssertFatal(threadid != 0, "ThreadManager::getThreadById() Searching for a bad thread id."); Thread* ret = NULL; @@ -236,9 +236,9 @@ inline bool ThreadManager::isMainThread() return compare( ThreadManager::getCurrentThreadId(), smMainThreadId.get() ); } -inline bool ThreadManager::isCurrentThread(U32 threadId) +inline bool ThreadManager::isCurrentThread(dsize_t threadId) { - U32 current = getCurrentThreadId(); + dsize_t current = getCurrentThreadId(); return compare(current, threadId); } diff --git a/Engine/source/platformSDL/threads/thread.cpp b/Engine/source/platformSDL/threads/thread.cpp index a7de28753..fb0c1f2ab 100644 --- a/Engine/source/platformSDL/threads/thread.cpp +++ b/Engine/source/platformSDL/threads/thread.cpp @@ -134,9 +134,9 @@ bool Thread::isAlive() return ( !mData->mDead ); } -U32 Thread::getId() +dsize_t Thread::getId() { - return (U32)mData->mThreadID; + return (dsize_t)mData->mThreadID; } void Thread::_setName( const char* ) @@ -145,12 +145,12 @@ void Thread::_setName( const char* ) // that one thread you are looking for is just so much fun. } -U32 ThreadManager::getCurrentThreadId() +dsize_t ThreadManager::getCurrentThreadId() { - return (U32)SDL_ThreadID(); + return (dsize_t)SDL_ThreadID(); } -bool ThreadManager::compare(U32 threadId_1, U32 threadId_2) +bool ThreadManager::compare(dsize_t threadId_1, dsize_t threadId_2) { return (threadId_1 == threadId_2); } diff --git a/Engine/source/platformWin32/threads/thread.cpp b/Engine/source/platformWin32/threads/thread.cpp index 8a1e8f3e2..7272ce2ea 100644 --- a/Engine/source/platformWin32/threads/thread.cpp +++ b/Engine/source/platformWin32/threads/thread.cpp @@ -43,7 +43,7 @@ public: Thread* mThread; HANDLE mThreadHnd; Semaphore mGateway; - U32 mThreadID; + dsize_t mThreadID; U32 mDead; PlatformThreadData() @@ -157,7 +157,7 @@ bool Thread::isAlive() return ( !mData->mDead ); } -U32 Thread::getId() +dsize_t Thread::getId() { return mData->mThreadID; } @@ -197,12 +197,12 @@ void Thread::_setName( const char* name ) #endif } -U32 ThreadManager::getCurrentThreadId() +dsize_t ThreadManager::getCurrentThreadId() { return GetCurrentThreadId(); } -bool ThreadManager::compare(U32 threadId_1, U32 threadId_2) +bool ThreadManager::compare(dsize_t threadId_1, dsize_t threadId_2) { return (threadId_1 == threadId_2); } diff --git a/Engine/source/platformX86UNIX/threads/thread.cpp b/Engine/source/platformX86UNIX/threads/thread.cpp index a8c1cf1b1..74e184c91 100644 --- a/Engine/source/platformX86UNIX/threads/thread.cpp +++ b/Engine/source/platformX86UNIX/threads/thread.cpp @@ -137,9 +137,9 @@ bool Thread::isAlive() return ( !mData->mDead ); } -U32 Thread::getId() +dsize_t Thread::getId() { - return (U32)mData->mThreadID; + return (dsize_t)mData->mThreadID; } void Thread::_setName( const char* ) @@ -148,12 +148,12 @@ void Thread::_setName( const char* ) // that one thread you are looking for is just so much fun. } -U32 ThreadManager::getCurrentThreadId() +dsize_t ThreadManager::getCurrentThreadId() { - return (U32)pthread_self(); + return (dsize_t)pthread_self(); } -bool ThreadManager::compare(U32 threadId_1, U32 threadId_2) +bool ThreadManager::compare(dsize_t threadId_1, dsize_t threadId_2) { return pthread_equal((pthread_t)threadId_1, (pthread_t)threadId_2); } diff --git a/Engine/source/sfx/sfxInternal.h b/Engine/source/sfx/sfxInternal.h index 4d0a922f5..212133859 100644 --- a/Engine/source/sfx/sfxInternal.h +++ b/Engine/source/sfx/sfxInternal.h @@ -442,7 +442,7 @@ inline bool isSFXThread() { ThreadSafeRef< SFXUpdateThread > sfxThread = UPDATE_THREAD(); - U32 threadId; + dsize_t threadId; if( sfxThread != NULL ) threadId = sfxThread->getId(); else From 66d7b0c49f9c4ee724e45b0b8f22d7a008cba12e Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Mon, 30 Aug 2021 01:50:47 -0500 Subject: [PATCH 3/7] mini cleanups for ab seems some operating systems don't play nice with setting `extent =` outside of a define{init} block, cleaned up %assetarray using $AssetBrowser::AssetArray cleanup for terrain definition path display --- .../assetBrowser/scripts/assetBrowser.tscript | 49 +++++++++---------- .../scripts/assetTypes/terrain.tscript | 2 +- 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript index 7ddf13ef3..c61520b15 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript @@ -479,13 +479,12 @@ function AssetBrowser::buildAssetPreview( %this, %asset, %moduleName ) { %previewButton.iconLocation = "Left"; %previewButton.textLocation = "Right"; - %previewButton.extent = "120 20"; + %previewButton.setextent(120,20); } else { %size = %previewSize.x * %previewScaleSize; - %previewButton.extent.x = %size; - %previewButton.extent.y = %size + %textBottomPad; + %previewButton.setextent(%size,%size + %textBottomPad); } //%previewButton.extent = %previewSize.x + %previewBounds SPC %previewSize.y + %previewBounds + 24; @@ -1402,10 +1401,10 @@ function AssetBrowser::doRebuildAssetArray(%this) AssetBrowser-->assetList.deleteAllObjects(); AssetPreviewArray.empty(); - if(isObject(%assetArray)) - %assetArray.delete(); + if(isObject($AssetBrowser::AssetArray)) + $AssetBrowser::AssetArray.delete(); - %assetArray = new ArrayObject(); + $AssetBrowser::AssetArray = new ArrayObject(); //First, Query for our assets %assetQuery = new AssetQuery(); @@ -1486,7 +1485,7 @@ function AssetBrowser::doRebuildAssetArray(%this) { if(matchesSearch(%assetName, %assetType)) { - %assetArray.add( %moduleName, %assetId); + $AssetBrowser::AssetArray.add( %moduleName, %assetId); if(%assetType !$= "Folder") %finalAssetCount++; @@ -1500,7 +1499,7 @@ function AssetBrowser::doRebuildAssetArray(%this) { if(AssetBrowser.assetTypeFilter $= %assetType) { - %assetArray.add( %moduleName, %assetId ); + $AssetBrowser::AssetArray.add( %moduleName, %assetId ); if(%assetType !$= "Folder") %finalAssetCount++; @@ -1509,7 +1508,7 @@ function AssetBrowser::doRebuildAssetArray(%this) else { //got it. - %assetArray.add( %moduleName, %assetId ); + $AssetBrowser::AssetArray.add( %moduleName, %assetId ); if(%assetType !$= "Folder") %finalAssetCount++; @@ -1531,7 +1530,7 @@ function AssetBrowser::doRebuildAssetArray(%this) { if(matchesSearch(%folderName, "Folder", "")) { - %assetArray.add( %breadcrumbPath, "Folder" TAB %folderName ); + $AssetBrowser::AssetArray.add( %breadcrumbPath, "Folder" TAB %folderName ); continue; } } @@ -1547,7 +1546,7 @@ function AssetBrowser::doRebuildAssetArray(%this) if(!%this.toolsModulesFilter && %folderName $= "tools" && %breadcrumbPath $= "") continue; - %assetArray.add( %breadcrumbPath, "Folder" TAB %folderName ); + $AssetBrowser::AssetArray.add( %breadcrumbPath, "Folder" TAB %folderName ); } } } @@ -1577,14 +1576,14 @@ function AssetBrowser::doRebuildAssetArray(%this) %dbName = %obj.getName(); if(matchesSearch(%dbName, "Datablock")) { - %assetArray.add( %dbFilename, "Datablock" TAB %dbName ); + $AssetBrowser::AssetArray.add( %dbFilename, "Datablock" TAB %dbName ); } } } else if(%dbFilePath $= %breadcrumbPath) { %dbName = %obj.getName(); - %assetArray.add( %dbFilename, "Datablock" TAB %dbName ); + $AssetBrowser::AssetArray.add( %dbFilename, "Datablock" TAB %dbName ); /*%catItem = AssetBrowser-->filterTree.findItemByName(%obj.category); @@ -1609,7 +1608,7 @@ function AssetBrowser::doRebuildAssetArray(%this) %looseFileName = fileName(%looseFileFullPath); %looseFileExt = fileExt(%looseFileFullPath); - %assetArray.add( %looseFilePath, "LooseFile" TAB %looseFileName ); + $AssetBrowser::AssetArray.add( %looseFilePath, "LooseFile" TAB %looseFileName ); } //Prefabs @@ -1628,13 +1627,13 @@ function AssetBrowser::doRebuildAssetArray(%this) { if(matchesSearch(%prefabName, "Prefab")) { - %assetArray.add( %prefabPath, "Prefab" TAB %prefabName ); + $AssetBrowser::AssetArray.add( %prefabPath, "Prefab" TAB %prefabName ); } } } else if(%prefabPath $= %breadcrumbPath) { - %assetArray.add( %prefabPath, "Prefab" TAB %prefabName ); + $AssetBrowser::AssetArray.add( %prefabPath, "Prefab" TAB %prefabName ); } %fullPrefabPath = findNextFile( %breadcrumbPath @ "/" @ %expr ); @@ -1654,13 +1653,13 @@ function AssetBrowser::doRebuildAssetArray(%this) { if(matchesSearch(%cppName, "Cpp")) { - %assetArray.add( %cppPath, "Cpp" TAB %cppName ); + $AssetBrowser::AssetArray.add( %cppPath, "Cpp" TAB %cppName ); } } } else if(%cppPath $= %breadcrumbPath) { - %assetArray.add( %cppPath, "Cpp" TAB %cppName ); + $AssetBrowser::AssetArray.add( %cppPath, "Cpp" TAB %cppName ); } } @@ -1678,13 +1677,13 @@ function AssetBrowser::doRebuildAssetArray(%this) { if(matchesSearch(%cppName, "Cpp")) { - %assetArray.add( %cppPath, "Cpp" TAB %cppName ); + $AssetBrowser::AssetArray.add( %cppPath, "Cpp" TAB %cppName ); } } } else if(%cppPath $= %breadcrumbPath) { - %assetArray.add( %cppPath, "Cpp" TAB %cppName ); + $AssetBrowser::AssetArray.add( %cppPath, "Cpp" TAB %cppName ); } } @@ -1726,13 +1725,13 @@ function AssetBrowser::doRebuildAssetArray(%this) { if(matchesSearch(%tscriptName, "tscript")) { - %assetArray.add( %tscriptPath, "tscript" TAB %tscriptName ); + $AssetBrowser::AssetArray.add( %tscriptPath, "tscript" TAB %tscriptName ); } } } else if(%tscriptPath $= %breadcrumbPath) { - %assetArray.add( %tscriptPath, "tscript" TAB %tscriptName ); + $AssetBrowser::AssetArray.add( %tscriptPath, "tscript" TAB %tscriptName ); } } } @@ -1754,13 +1753,13 @@ function AssetBrowser::doRebuildAssetArray(%this) %name = %creatorObj.val[1]; %func = %creatorObj.val[2]; - %assetArray.add( %name, "Creator" TAB %creatorObj ); + $AssetBrowser::AssetArray.add( %name, "Creator" TAB %creatorObj ); } } } - for(%i=0; %i < %assetArray.count(); %i++) - AssetBrowser.buildAssetPreview( %assetArray.getValue(%i), %assetArray.getKey(%i) ); + for(%i=0; %i < $AssetBrowser::AssetArray.count(); %i++) + AssetBrowser.buildAssetPreview( $AssetBrowser::AssetArray.getValue(%i), $AssetBrowser::AssetArray.getKey(%i) ); AssetBrowser_FooterText.text = %finalAssetCount @ " Assets"; diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/terrain.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/terrain.tscript index 85a9cd9c2..1c51a7d42 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/terrain.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/terrain.tscript @@ -169,7 +169,7 @@ function AssetBrowser::buildTerrainAssetPreview(%this, %assetDef, %previewData) %previewData.tooltip = "Asset Name: " @ %assetDef.assetName @ "\nAsset Type: Terrain Asset" @ "\nAsset Definition ID: " @ %assetDef @ - "\nDefinition Path: " @ %assetPath @ %assetDef.getTerrainFilePath(); + "\nDefinition Path: " @ %assetDef.getTerrainFilePath(); } function GuiInspectorTypeTerrainAssetPtr::onClick( %this, %fieldName ) From 683c438b098ceb92d4fc10507d07a219c1a157f2 Mon Sep 17 00:00:00 2001 From: Areloch Date: Wed, 1 Sep 2021 01:12:16 -0500 Subject: [PATCH 4/7] Improves handling of rendering guiPopupCtrls where if the height extent is taller than the bitmap array height, it'll adjust the height to recenter the displayed bitmap elements. Streamlined the toolbar for the gui and world editors to utilize a stack, making the behavior and manipulation of toolbar elements significantly more consistent. Added Settings and Asset Browser buttons to both gui and world editor toolbars for easier access. Moved all tool toolbars over to work with the stack system to make them more consistent and better formatting Added saving of asset browser's last position and extent so it remembers it on load. Added editor setting to close the asset browser after completing a drag-n-drop action. Added keybind to editor keybind list, making space toggle the asset browser --- Engine/source/gui/controls/guiPopUpCtrl.cpp | 31 +++ .../tools/VPathEditor/Scripts/Plugin.tscript | 11 +- .../game/tools/assetBrowser/main.tscript | 5 +- .../assetBrowser/scripts/assetBrowser.tscript | 51 +++- .../game/tools/convexEditor/main.tscript | 13 +- .../game/tools/forestEditor/main.tscript | 10 +- .../tools/gui/editorSettingsWindow.ed.tscript | 2 + .../game/tools/guiEditor/gui/guiEditor.ed.gui | 223 +++++++----------- .../game/tools/meshRoadEditor/main.tscript | 12 +- .../meshRoadEditor/meshRoadEditorToolbar.gui | 2 +- .../game/tools/navEditor/main.tscript | 10 +- .../tools/riverEditor/RiverEditorToolbar.gui | 2 +- .../game/tools/riverEditor/main.tscript | 11 +- .../tools/roadEditor/RoadEditorToolbar.gui | 2 +- .../game/tools/roadEditor/main.tscript | 10 +- .../game/tools/shapeEditor/main.tscript | 9 +- .../tools/worldEditor/gui/EditorGui.ed.gui | 94 ++++++++ .../worldEditor/gui/WorldEditorToolbar.ed.gui | 25 -- .../worldEditor/scripts/EditorGui.ed.tscript | 31 ++- .../scripts/editor.keybinds.tscript | 2 + 20 files changed, 341 insertions(+), 215 deletions(-) diff --git a/Engine/source/gui/controls/guiPopUpCtrl.cpp b/Engine/source/gui/controls/guiPopUpCtrl.cpp index c18b10c75..0cd08dfb8 100644 --- a/Engine/source/gui/controls/guiPopUpCtrl.cpp +++ b/Engine/source/gui/controls/guiPopUpCtrl.cpp @@ -881,6 +881,12 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect ) // Do we render a bitmap border or lines? if ( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) { + if (mProfile->mBitmapArrayRects[0].extent.y < baseRect.extent.y) + { + //if our bitmap is smaller than the height of our ctrl, we'll nudge it towards the center + U32 nudge = (baseRect.extent.y - mProfile->mBitmapArrayRects[0].extent.y) / 2; + baseRect.point.y += nudge; + } // Render the fixed, filled in border renderFixedBitmapBordersFilled(baseRect, 3, mProfile ); @@ -926,6 +932,12 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect ) // Do we render a bitmap border or lines? if ( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) { + if (mProfile->mBitmapArrayRects[0].extent.y < baseRect.extent.y) + { + //if our bitmap is smaller than the height of our ctrl, we'll nudge it towards the center + U32 nudge = (baseRect.extent.y - mProfile->mBitmapArrayRects[0].extent.y) / 2; + baseRect.point.y += nudge; + } // Render the fixed, filled in border renderFixedBitmapBordersFilled(baseRect, 2, mProfile ); @@ -957,6 +969,12 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect ) // Do we render a bitmap border or lines? if ( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) { + if (mProfile->mBitmapArrayRects[0].extent.y < baseRect.extent.y) + { + //if our bitmap is smaller than the height of our ctrl, we'll nudge it towards the center + U32 nudge = (baseRect.extent.y - mProfile->mBitmapArrayRects[0].extent.y) / 2; + baseRect.point.y += nudge; + } // Render the fixed, filled in border renderFixedBitmapBordersFilled(baseRect, 1, mProfile ); } @@ -976,6 +994,12 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect ) // Do we render a bitmap border or lines? if ( !( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) ) { + if (mProfile->mBitmapArrayRects[0].extent.y < baseRect.extent.y) + { + //if our bitmap is smaller than the height of our ctrl, we'll nudge it towards the center + U32 nudge = (baseRect.extent.y - mProfile->mBitmapArrayRects[0].extent.y) / 2; + baseRect.point.y += nudge; + } drawUtil->drawRect( baseRect, mProfile->mBorderColorNA ); } } @@ -1095,6 +1119,13 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect ) // If we're rendering a bitmap border, then it will take care of the arrow. if ( !(mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size()) ) { + if (mProfile->mBitmapArrayRects[0].extent.y < baseRect.extent.y) + { + //if our bitmap is smaller than the height of our ctrl, we'll nudge it towards the center + U32 nudge = (baseRect.extent.y - mProfile->mBitmapArrayRects[0].extent.y) / 2; + baseRect.point.y += nudge; + } + // Draw a triangle (down arrow) S32 left = baseRect.point.x + baseRect.extent.x - 12; S32 right = left + 8; diff --git a/Templates/BaseGame/game/tools/VPathEditor/Scripts/Plugin.tscript b/Templates/BaseGame/game/tools/VPathEditor/Scripts/Plugin.tscript index 60bf4ceb9..287b94ec3 100644 --- a/Templates/BaseGame/game/tools/VPathEditor/Scripts/Plugin.tscript +++ b/Templates/BaseGame/game/tools/VPathEditor/Scripts/Plugin.tscript @@ -61,7 +61,8 @@ function VPathEditorPlugin::onWorldEditorStartup( %this ) } // Add Toolbar. - EditorGuiToolbar.add( VPathEditorToolbar ); + //EditorGuiToolbar.add( VPathEditorToolbar ); + // Populate Type Menu. VPathEditorToolbarPathTypeMenu.clear(); @@ -119,7 +120,9 @@ function VPathEditorPlugin::onActivated( %this ) EVPathEditor.setVisible( true ); EVPathEditor.makeFirstResponder( true ); EditorGui.bringToFront( EVPathEditor ); - VPathEditorToolbar.setVisible( true ); + EditorGuiToolbarStack.remove( EWorldEditorToolbar ); + EditorGuiToolbarStack.add( VPathEditorToolbar ); + VPathTreeView.open( GetServerPathSet(), true ); // Sync Gizmo. @@ -147,7 +150,9 @@ function VPathEditorPlugin::onDeactivated( %this ) { // Hide Editor. EVPathEditor.setVisible( false ); - VPathEditorToolbar.setVisible( false ); + + EditorGuiToolbarStack.add( EWorldEditorToolbar ); + EditorGuiToolbarStack.remove( VPathEditorToolbar ); // Disable Map. %this.EditorMap.pop(); diff --git a/Templates/BaseGame/game/tools/assetBrowser/main.tscript b/Templates/BaseGame/game/tools/assetBrowser/main.tscript index 2f284a16d..976383396 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/main.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/main.tscript @@ -156,14 +156,11 @@ function initializeAssetBrowser() AssetBrowser.buildPopupMenus(); //Force everything to initialize if other things need to reference it's behavior before we're displayed(usually other tools) - AssetBrowser.showDialog(); - AssetBrowser.hideDialog(); + AssetBrowser.initialize(); } function AssetBrowserPlugin::onWorldEditorStartup( %this ) { - // Add ourselves to the toolbar. - AssetBrowser.addToolbarButton(); } function AssetBrowserPlugin::initSettings( %this ) diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript index 7ddf13ef3..b3c89feb4 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript @@ -1,5 +1,3 @@ -new SimGroup(AssetBrowserPreviewCache); - //AssetBrowser.addToolbarButton function AssetBrowser::addToolbarButton(%this) { @@ -30,11 +28,8 @@ function AssetBrowser::addToolbarButton(%this) EWToolsToolbar.setExtent((25 + 8) * (ToolsToolbarArray.getCount()) + 12 SPC "33"); } // -function AssetBrowser::onAdd(%this) -{ -} -function AssetBrowser::onWake(%this) +function AssetBrowser::initialize(%this) { // manage preview array if(!isObject(AssetPreviewArray)) @@ -65,6 +60,30 @@ function AssetBrowser::onWake(%this) AssetBrowser-->filterAssetsButton.setActive(true); } +function AssetBrowser::onAdd(%this) +{ +} + +function AssetBrowser::onWake(%this) +{ + %this.initialize(); +} + +function AssetBrowser::onDialogPop(%this) +{ + %lastPosExt = AssetBrowserWindow.position SPC AssetBrowserWindow.extent; + EditorSettings.setValue("Assets/Browser/LastPosExt", %lastPosExt); +} + +function AssetBrowser::restoreLastPosExt(%this) +{ + %lastPosExt = EditorSettings.value("Assets/Browser/LastPosExt", ""); + if(%lastPosExt !$= "") + { + AssetBrowserWindow.resize(getWord(%lastPosExt, 0), getWord(%lastPosExt, 1), getWord(%lastPosExt, 2), getWord(%lastPosExt, 3)); + } +} + function contentTreeTabBook::onTabSelected(%this, %tabText, %tabIndex) { if(%tabText $= "Content") @@ -271,6 +290,7 @@ function AssetBrowser::showDialog( %this, %AssetTypeFilter, %selectCallback, %ta Canvas.popDialog(AssetBrowser); Canvas.pushDialog(AssetBrowser); + AssetBrowser.setVisible(1); AssetBrowserWindow.setVisible(1); AssetBrowserWindow.selectWindow(); @@ -299,6 +319,8 @@ function AssetBrowser::showDialog( %this, %AssetTypeFilter, %selectCallback, %ta } AssetBrowser.loadDirectories(); + + AssetBrowser.restoreLastPosExt(); } function AssetBrowser::hideDialog( %this ) @@ -311,6 +333,18 @@ function AssetBrowser::hideDialog( %this ) Canvas.popDialog(AssetBrowser); } +function AssetBrowser::toggleDialog( %this ) +{ + if(AssetBrowser.isAwake()) + { + AssetBrowser.hideDialog(); + } + else + { + AssetBrowser.showDialog(); + } +} + function AssetBrowser::buildAssetPreview( %this, %asset, %moduleName ) { if(!isObject(%this.previewData)) @@ -2402,6 +2436,11 @@ function EWorldEditor::onControlDropped( %this, %payload, %position ) %buildCommand = AssetBrowser @ ".on" @ %assetType @ "EditorDropped(" @ %assetDef @ ",\"" @ %position @ "\");"; } eval(%buildCommand); + + if(EditorSettings.value("AssetManagement/Assets/closeBrowserOnDragAction", false)) + { + AssetBrowser.hideDialog(); + } } EWorldEditor.isDirty = true; diff --git a/Templates/BaseGame/game/tools/convexEditor/main.tscript b/Templates/BaseGame/game/tools/convexEditor/main.tscript index 6e0a41970..260c955ae 100644 --- a/Templates/BaseGame/game/tools/convexEditor/main.tscript +++ b/Templates/BaseGame/game/tools/convexEditor/main.tscript @@ -34,13 +34,12 @@ function initializeConvexEditor() ConvexEditorGui.setVisible( false ); ConvexEditorOptionsWindow.setVisible( false ); ConvexEditorTreeWindow.setVisible( false ); - ConvexEditorToolbar.setVisible( false ); + ConvexEditorOptionsWindow.setVisible( false ); EditorGui.add( ConvexEditorGui ); EditorGui.add( ConvexEditorOptionsWindow ); EditorGui.add( ConvexEditorTreeWindow ); - EditorGui.add( ConvexEditorToolbar ); EditorGui.add( ConvexEditorOptionsWindow ); new ScriptObject( ConvexEditorPlugin ) @@ -103,7 +102,10 @@ function ConvexEditorPlugin::onActivated( %this ) EditorGui.bringToFront( ConvexEditorGui ); ConvexEditorGui.setVisible( true ); - ConvexEditorToolbar.setVisible( true ); + + EditorGuiToolbarStack.remove( EWorldEditorToolbar ); + EditorGuiToolbarStack.add( ConvexEditorToolbar ); + ConvexEditorOptionsWindow.setVisible( true ); ConvexEditorGui.makeFirstResponder( true ); %this.map.push(); @@ -137,7 +139,10 @@ function ConvexEditorPlugin::onDeactivated( %this ) %this.writeSettings(); ConvexEditorGui.setVisible( false ); - ConvexEditorOptionsWindow.setVisible( false ); + + EditorGuiToolbarStack.add( EWorldEditorToolbar ); + EditorGuiToolbarStack.remove( ConvexEditorToolbar ); + ConvexEditorTreeWindow.setVisible( false ); ConvexEditorOptionsWindow.setVisible( false ); ConvexEditorToolbar.setVisible( false ); diff --git a/Templates/BaseGame/game/tools/forestEditor/main.tscript b/Templates/BaseGame/game/tools/forestEditor/main.tscript index 9f4689622..be2814baa 100644 --- a/Templates/BaseGame/game/tools/forestEditor/main.tscript +++ b/Templates/BaseGame/game/tools/forestEditor/main.tscript @@ -34,12 +34,10 @@ function initializeForestEditor() ForestEditorGui.setVisible( false ); ForestEditorPalleteWindow.setVisible( false ); ForestEditorPropertiesWindow.setVisible( false ); - ForestEditToolbar.setVisible( false ); EditorGui.add( ForestEditorGui ); EditorGui.add( ForestEditorPalleteWindow ); EditorGui.add( ForestEditorPropertiesWindow ); - EditorGui.add( ForestEditToolbar ); new ScriptObject( ForestEditorPlugin ) { @@ -141,7 +139,9 @@ function ForestEditorPlugin::onActivated( %this ) ForestEditorPalleteWindow.setVisible( true ); ForestEditorPropertiesWindow.setVisible( true ); ForestEditorGui.makeFirstResponder( true ); - //ForestEditToolbar.setVisible( true ); + + EditorGuiToolbarStack.remove( EWorldEditorToolbar ); + EditorGuiToolbarStack.add( ForestEditToolbar ); //Get our existing forest object in our current mission if we have one %forestObject = trim(parseMissionGroupForIds("Forest", "")); @@ -210,7 +210,11 @@ function ForestEditorPlugin::onActivated( %this ) function ForestEditorPlugin::onDeactivated( %this ) { + EditorGuiToolbarStack.add( EWorldEditorToolbar ); + EditorGuiToolbarStack.remove( ForestEditToolbar ); + ForestEditorGui.setVisible( false ); + ForestEditorPalleteWindow.setVisible( false ); ForestEditorPropertiesWindow.setVisible( false ); diff --git a/Templates/BaseGame/game/tools/gui/editorSettingsWindow.ed.tscript b/Templates/BaseGame/game/tools/gui/editorSettingsWindow.ed.tscript index b64d2cb42..08f0f5038 100644 --- a/Templates/BaseGame/game/tools/gui/editorSettingsWindow.ed.tscript +++ b/Templates/BaseGame/game/tools/gui/editorSettingsWindow.ed.tscript @@ -516,6 +516,8 @@ function ESettingsWindow::getAssetEditingSettings(%this) SettingsInspector.addSettingsField("Assets/Browser/showEmptyFolders", "Show Empty Folders in Tiles view in Asset Browser", "bool", ""); SettingsInspector.addSettingsField("Assets/Browser/showLooseFiles", "Show Loose Files when viewing in Asset Browser", "bool", ""); SettingsInspector.addSettingsField("AssetManagement/Assets/promptOnRename", "Prompt on Rename", "bool", ""); + + SettingsInspector.addSettingsField("AssetManagement/Assets/closeBrowserOnDragAction", "Close Browser on Drag Action", "bool", "If on, the Asset Browser will automatically close after dragging an asset from it to the editor interface."); SettingsInspector.endGroup(); } diff --git a/Templates/BaseGame/game/tools/guiEditor/gui/guiEditor.ed.gui b/Templates/BaseGame/game/tools/guiEditor/gui/guiEditor.ed.gui index a3fc69c28..baee53ad5 100644 --- a/Templates/BaseGame/game/tools/guiEditor/gui/guiEditor.ed.gui +++ b/Templates/BaseGame/game/tools/guiEditor/gui/guiEditor.ed.gui @@ -22,8 +22,8 @@ Profile = "ToolsGuiFrameSetProfile"; HorizSizing = "width"; VertSizing = "height"; - Position = "0 0"; - Extent = "800 583"; + Position = "-1 -1"; + Extent = "801 584"; MinExtent = "8 2"; canSave = "1"; Visible = "1"; @@ -50,24 +50,28 @@ Visible = "1"; hovertime = "1000"; - new GuiContainer(GHToolBar) { - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - isContainer = "1"; - profile = "ToolsMenubarProfile"; + new GuiStackControl(GuiEditorToolbarStack) { + stackingType = "Horizontal"; + horizStacking = "Left to Right"; + vertStacking = "Top to Bottom"; + padding = "0"; + dynamicSize = "1"; + dynamicNonStackExtent = "0"; + dynamicPos = "0"; + changeChildSizeToFit = "0"; + changeChildPosition = "1"; + position = "0 0"; + extent = "885 32"; + minExtent = "16 16"; horizSizing = "right"; vertSizing = "bottom"; - position = "0 0"; - extent = "16000 32"; - minExtent = "8 2"; - canSave = "1"; + profile = "ToolsGuiDefaultProfile"; visible = "1"; - tooltipProfile = "ToolsGuiToolTipProfile"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; hovertime = "1000"; + isContainer = "1"; + canSave = "1"; canSaveDynamicFields = "0"; new GuiBitmapButtonCtrl(GHWorldEditor) { @@ -136,27 +140,31 @@ canSaveDynamicFields = "0"; }; new GuiBitmapButtonCtrl() { - canSaveDynamicFields = "0"; - internalName = AssetBrowserBtn; - Enabled = "1"; - isContainer = "0"; - Profile = "ToolsGuiButtonProfile"; - HorizSizing = "right"; - VertSizing = "bottom"; - position = "98 3"; - Extent = "29 27"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - Command = "AssetBrowser.ShowDialog();"; - tooltipprofile = "ToolsGuiToolTipProfile"; - ToolTip = "Asset Browser"; - hovertime = "750"; - bitmapAsset = "ToolsModule:menuGrid_image"; + BitmapAsset = "ToolsModule:settings_n_image"; bitmapMode = "Stretched"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; buttonType = "PushButton"; - groupNum = "0"; useMouseEvents = "0"; + position = "150 0"; + extent = "29 27"; + minExtent = "8 8"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "ESettingsWindow.toggleEditorSettings();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + tooltip = "Open Editor Settings"; + hovertime = "1000"; + isContainer = "0"; + internalName = "editorSettingsBtn"; + canSave = "1"; + canSaveDynamicFields = "0"; }; new GuiBitmapCtrl() { bitmapAsset = "ToolsModule:separator_h_image"; @@ -174,21 +182,37 @@ hovertime = "1000"; canSaveDynamicFields = "0"; }; - }; - new GuiControl() { - isContainer = "1"; - profile = "ToolsGuiDefaultProfile"; - horizSizing = "width"; - vertSizing = "bottom"; - position = "131 0"; - extent = "723 32"; - minExtent = "8 2"; - canSave = "1"; - visible = "1"; - tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - canSaveDynamicFields = "0"; - + new GuiBitmapButtonCtrl() { + canSaveDynamicFields = "0"; + internalName = AssetBrowserBtn; + Enabled = "1"; + isContainer = "0"; + Profile = "ToolsGuiButtonProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + position = "98 3"; + Extent = "29 27"; + MinExtent = "8 2"; + canSave = "1"; + Visible = "1"; + Command = "AssetBrowser.toggleDialog();"; + tooltipprofile = "ToolsGuiToolTipProfile"; + ToolTip = "Asset Browser"; + hovertime = "750"; + bitmapAsset = "ToolsModule:menuGrid_image"; + bitmapMode = "Stretched"; + buttonType = "PushButton"; + groupNum = "0"; + useMouseEvents = "0"; + }; + new GuiBitmapCtrl() { + Enabled = "1"; + Profile = "ToolsGuiDefaultProfile"; + position = "160 3"; + Extent = "2 26"; + MinExtent = "1 1"; + bitmapAsset = "ToolsModule:separator_h_image"; + }; new GuiPopUpMenuCtrl(GuiEditorContentList) { maxPopupHeight = "200"; sbUsesNAColor = "0"; @@ -205,9 +229,9 @@ isContainer = "0"; profile = "ToolsGuiPopUpMenuProfile"; horizSizing = "right"; - vertSizing = "bottom"; - position = "8 7"; - extent = "145 18"; + vertSizing = "center"; + position = "8 0"; + extent = "145 27"; minExtent = "8 2"; canSave = "1"; visible = "1"; @@ -231,9 +255,9 @@ isContainer = "0"; profile = "ToolsGuiPopUpMenuProfile"; horizSizing = "right"; - vertSizing = "bottom"; - position = "161 7"; - extent = "136 18"; + vertSizing = "center"; + position = "161 0"; + extent = "136 27"; minExtent = "8 2"; canSave = "1"; visible = "1"; @@ -247,7 +271,7 @@ isContainer = "0"; profile = "ToolsGuiDefaultProfile"; horizSizing = "right"; - vertSizing = "bottom"; + vertSizing = "center"; position = "307 3"; extent = "2 26"; minExtent = "1 1"; @@ -257,20 +281,6 @@ hovertime = "1000"; canSaveDynamicFields = "0"; }; - new GuiControl() { - isContainer = "1"; - profile = "ToolsGuiDefaultProfile"; - horizSizing = "right"; - vertSizing = "bottom"; - position = "312 3"; - extent = "95 27"; - minExtent = "8 2"; - canSave = "1"; - visible = "1"; - tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - canSaveDynamicFields = "0"; - new GuiBitmapButtonCtrl(GuiEditorSnapCheckBox) { bitmapAsset = "ToolsModule:snap_grid_n_image"; bitmapMode = "Stretched"; @@ -302,10 +312,10 @@ isContainer = "0"; profile = "ToolsGuiButtonProfile"; horizSizing = "right"; - vertSizing = "bottom"; + vertSizing = "center"; position = "31 0"; extent = "29 27"; - minExtent = "120 21"; + minExtent = "21 21"; canSave = "1"; visible = "1"; command = "GuiEditor.toggleEdgeSnap();"; @@ -324,10 +334,10 @@ isContainer = "0"; profile = "ToolsGuiButtonProfile"; horizSizing = "right"; - vertSizing = "bottom"; + vertSizing = "center"; position = "62 0"; extent = "29 27"; - minExtent = "120 21"; + minExtent = "21 21"; canSave = "1"; visible = "1"; command = "GuiEditor.toggleCenterSnap();"; @@ -336,7 +346,6 @@ hovertime = "1000"; canSaveDynamicFields = "0"; }; - }; new GuiBitmapCtrl() { bitmapAsset = "ToolsModule:separator_h_image"; wrap = "0"; @@ -353,20 +362,6 @@ hovertime = "1000"; canSaveDynamicFields = "0"; }; - new GuiControl() { - isContainer = "1"; - profile = "ToolsGuiDefaultProfile"; - horizSizing = "right"; - vertSizing = "bottom"; - position = "422 3"; - extent = "95 27"; - minExtent = "8 2"; - canSave = "1"; - visible = "1"; - tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - canSaveDynamicFields = "0"; - new GuiBitmapButtonCtrl() { bitmapAsset = "ToolsModule:align_left_n_image"; bitmapMode = "Stretched"; @@ -380,7 +375,7 @@ vertSizing = "bottom"; position = "0 0"; extent = "29 27"; - minExtent = "120 21"; + minExtent = "21 21"; canSave = "1"; visible = "1"; command = "GuiEditor.Justify(0);"; @@ -433,21 +428,6 @@ hovertime = "1000"; canSaveDynamicFields = "0"; }; - }; - new GuiControl() { - isContainer = "1"; - profile = "ToolsGuiDefaultProfile"; - horizSizing = "right"; - vertSizing = "bottom"; - position = "498 3"; - extent = "95 27"; - minExtent = "8 2"; - canSave = "1"; - visible = "1"; - tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - canSaveDynamicFields = "0"; - new GuiBitmapButtonCtrl() { bitmapAsset = "ToolsModule:align_top_n_image"; bitmapMode = "Stretched"; @@ -461,7 +441,7 @@ vertSizing = "bottom"; position = "0 0"; extent = "29 27"; - minExtent = "120 21"; + minExtent = "21 21"; canSave = "1"; visible = "1"; command = "GuiEditor.Justify(3);"; @@ -514,7 +494,6 @@ hovertime = "1000"; canSaveDynamicFields = "0"; }; - }; new GuiBitmapCtrl() { bitmapAsset = "ToolsModule:separator_h_image"; wrap = "0"; @@ -547,20 +526,6 @@ hovertime = "1000"; canSaveDynamicFields = "0"; }; - new GuiControl() { - isContainer = "1"; - profile = "ToolsGuiDefaultProfile"; - horizSizing = "right"; - vertSizing = "bottom"; - position = "615 3"; - extent = "117 27"; - minExtent = "8 2"; - canSave = "1"; - visible = "1"; - tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - canSaveDynamicFields = "0"; - new GuiBitmapButtonCtrl() { bitmapAsset = "ToolsModule:send_to_back_n_image"; bitmapMode = "Stretched"; @@ -605,21 +570,6 @@ hovertime = "1000"; canSaveDynamicFields = "0"; }; - }; - new GuiControl() { - isContainer = "1"; - profile = "ToolsGuiDefaultProfile"; - horizSizing = "right"; - vertSizing = "bottom"; - position = "583 3"; - extent = "60 27"; - minExtent = "8 2"; - canSave = "1"; - visible = "1"; - tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - canSaveDynamicFields = "0"; - new GuiBitmapButtonCtrl() { bitmapAsset = "ToolsModule:distribute_horizontal_n_image"; bitmapMode = "Stretched"; @@ -663,7 +613,6 @@ ToolTip = "Distribute Vertically"; hovertime = "1000"; canSaveDynamicFields = "0"; - }; }; }; //--------------------- diff --git a/Templates/BaseGame/game/tools/meshRoadEditor/main.tscript b/Templates/BaseGame/game/tools/meshRoadEditor/main.tscript index de5ed8197..438133bef 100644 --- a/Templates/BaseGame/game/tools/meshRoadEditor/main.tscript +++ b/Templates/BaseGame/game/tools/meshRoadEditor/main.tscript @@ -31,12 +31,10 @@ function initializeMeshRoadEditor() MeshRoadEditorGui.setVisible( false ); MeshRoadEditorOptionsWindow.setVisible( false ); - MeshRoadEditorToolbar.setVisible( false ); MeshRoadEditorTreeWindow.setVisible( false ); EditorGui.add( MeshRoadEditorGui ); EditorGui.add( MeshRoadEditorOptionsWindow ); - EditorGui.add( MeshRoadEditorToolbar ); EditorGui.add( MeshRoadEditorTreeWindow ); new ScriptObject( MeshRoadEditorPlugin ) @@ -95,7 +93,10 @@ function MeshRoadEditorPlugin::onActivated( %this ) MeshRoadEditorGui.setVisible( true ); MeshRoadEditorGui.makeFirstResponder( true ); MeshRoadEditorOptionsWindow.setVisible( true ); - MeshRoadEditorToolbar.setVisible( true ); + + EditorGuiToolbarStack.remove( EWorldEditorToolbar ); + EditorGuiToolbarStack.add( MeshRoadEditorToolbar ); + MeshRoadEditorTreeWindow.setVisible( true ); MeshRoadTreeView.open(ServerMeshRoadSet,true); %this.map.push(); @@ -121,7 +122,10 @@ function MeshRoadEditorPlugin::onDeactivated( %this ) MeshRoadEditorGui.setVisible( false ); MeshRoadEditorOptionsWindow.setVisible( false ); - MeshRoadEditorToolbar.setVisible( false ); + + EditorGuiToolbarStack.add( EWorldEditorToolbar ); + EditorGuiToolbarStack.remove( MeshRoadEditorToolbar ); + MeshRoadEditorTreeWindow.setVisible( false ); %this.map.pop(); diff --git a/Templates/BaseGame/game/tools/meshRoadEditor/meshRoadEditorToolbar.gui b/Templates/BaseGame/game/tools/meshRoadEditor/meshRoadEditorToolbar.gui index 08d006a2b..7245c0ca8 100644 --- a/Templates/BaseGame/game/tools/meshRoadEditor/meshRoadEditorToolbar.gui +++ b/Templates/BaseGame/game/tools/meshRoadEditor/meshRoadEditorToolbar.gui @@ -10,7 +10,7 @@ Extent = "800 32"; MinExtent = "8 2"; canSave = "1"; - Visible = "0"; + Visible = "1"; hovertime = "1000"; new GuiTextCtrl() { diff --git a/Templates/BaseGame/game/tools/navEditor/main.tscript b/Templates/BaseGame/game/tools/navEditor/main.tscript index 2aa987baa..e901cb401 100644 --- a/Templates/BaseGame/game/tools/navEditor/main.tscript +++ b/Templates/BaseGame/game/tools/navEditor/main.tscript @@ -42,13 +42,11 @@ function initializeNavEditor() // Add ourselves to EditorGui, where all the other tools reside NavEditorGui.setVisible(false); - NavEditorToolbar.setVisible(false); NavEditorOptionsWindow.setVisible(false); NavEditorTreeWindow.setVisible(false); NavEditorConsoleDlg.setVisible(false); EditorGui.add(NavEditorGui); - EditorGui.add(NavEditorToolbar); EditorGui.add(NavEditorOptionsWindow); EditorGui.add(NavEditorTreeWindow); EditorGui.add(NavEditorConsoleDlg); @@ -123,7 +121,8 @@ function NavEditorPlugin::onActivated(%this) NavEditorGui.setVisible(true); NavEditorGui.makeFirstResponder(true); - NavEditorToolbar.setVisible(true); + EditorGuiToolbarStack.remove( EWorldEditorToolbar ); + EditorGuiToolbarStack.add( NavEditorToolbar ); NavEditorOptionsWindow.setVisible(true); NavEditorTreeWindow.setVisible(true); @@ -167,7 +166,10 @@ function NavEditorPlugin::onDeactivated(%this) $Nav::EditorOpen = false; NavEditorGui.setVisible(false); - NavEditorToolbar.setVisible(false); + + EditorGuiToolbarStack.add( EWorldEditorToolbar ); + EditorGuiToolbarStack.remove( NavEditorToolbar ); + NavEditorOptionsWindow.setVisible(false); NavEditorTreeWindow.setVisible(false); %this.map.pop(); diff --git a/Templates/BaseGame/game/tools/riverEditor/RiverEditorToolbar.gui b/Templates/BaseGame/game/tools/riverEditor/RiverEditorToolbar.gui index 358225ce8..a2fb7574d 100644 --- a/Templates/BaseGame/game/tools/riverEditor/RiverEditorToolbar.gui +++ b/Templates/BaseGame/game/tools/riverEditor/RiverEditorToolbar.gui @@ -10,7 +10,7 @@ Extent = "800 32"; MinExtent = "8 2"; canSave = "1"; - Visible = "0"; + Visible = "1"; hovertime = "1000"; new GuiTextCtrl() { diff --git a/Templates/BaseGame/game/tools/riverEditor/main.tscript b/Templates/BaseGame/game/tools/riverEditor/main.tscript index bbc85b926..b8be4ede9 100644 --- a/Templates/BaseGame/game/tools/riverEditor/main.tscript +++ b/Templates/BaseGame/game/tools/riverEditor/main.tscript @@ -31,12 +31,10 @@ function initializeRiverEditor() // Add ourselves to EditorGui, where all the other tools reside RiverEditorGui.setVisible( false ); - RiverEditorToolbar.setVisible(false); RiverEditorOptionsWindow.setVisible( false ); RiverEditorTreeWindow.setVisible( false ); EditorGui.add( RiverEditorGui ); - EditorGui.add( RiverEditorToolbar ); EditorGui.add( RiverEditorOptionsWindow ); EditorGui.add( RiverEditorTreeWindow ); @@ -97,7 +95,9 @@ function RiverEditorPlugin::onActivated( %this ) RiverEditorGui.setVisible(true); RiverEditorGui.makeFirstResponder( true ); - RiverEditorToolbar.setVisible(true); + + EditorGuiToolbarStack.remove( EWorldEditorToolbar ); + EditorGuiToolbarStack.add( RiverEditorToolbar ); RiverEditorOptionsWindow.setVisible( true ); RiverEditorTreeWindow.setVisible( true ); @@ -130,7 +130,10 @@ function RiverEditorPlugin::onDeactivated( %this ) $River::EditorOpen = false; RiverEditorGui.setVisible(false); - RiverEditorToolbar.setVisible(false); + + EditorGuiToolbarStack.add( EWorldEditorToolbar ); + EditorGuiToolbarStack.remove( RiverEditorToolbar ); + RiverEditorOptionsWindow.setVisible( false ); RiverEditorTreeWindow.setVisible( false ); %this.map.pop(); diff --git a/Templates/BaseGame/game/tools/roadEditor/RoadEditorToolbar.gui b/Templates/BaseGame/game/tools/roadEditor/RoadEditorToolbar.gui index e43257e16..960bdbac2 100644 --- a/Templates/BaseGame/game/tools/roadEditor/RoadEditorToolbar.gui +++ b/Templates/BaseGame/game/tools/roadEditor/RoadEditorToolbar.gui @@ -10,7 +10,7 @@ Extent = "800 32"; MinExtent = "8 2"; canSave = "1"; - Visible = "0"; + Visible = "1"; hovertime = "1000"; new GuiTextCtrl() { diff --git a/Templates/BaseGame/game/tools/roadEditor/main.tscript b/Templates/BaseGame/game/tools/roadEditor/main.tscript index 98fd44286..4f9e7ad7a 100644 --- a/Templates/BaseGame/game/tools/roadEditor/main.tscript +++ b/Templates/BaseGame/game/tools/roadEditor/main.tscript @@ -31,12 +31,10 @@ function initializeRoadEditor() // Add ourselves to EditorGui, where all the other tools reside RoadEditorGui.setVisible( false ); - RoadEditorToolbar.setVisible( false ); RoadEditorOptionsWindow.setVisible( false ); RoadEditorTreeWindow.setVisible( false ); EditorGui.add( RoadEditorGui ); - EditorGui.add( RoadEditorToolbar ); EditorGui.add( RoadEditorOptionsWindow ); EditorGui.add( RoadEditorTreeWindow ); @@ -94,7 +92,8 @@ function RoadEditorPlugin::onActivated( %this ) RoadEditorGui.setVisible( true ); RoadEditorGui.makeFirstResponder( true ); - RoadEditorToolbar.setVisible( true ); + EditorGuiToolbarStack.remove( EWorldEditorToolbar ); + EditorGuiToolbarStack.add( RoadEditorToolbar ); RoadEditorOptionsWindow.setVisible( true ); RoadEditorTreeWindow.setVisible( true ); @@ -115,7 +114,10 @@ function RoadEditorPlugin::onDeactivated( %this ) %this.writeSettings(); RoadEditorGui.setVisible( false ); - RoadEditorToolbar.setVisible( false ); + + EditorGuiToolbarStack.add( EWorldEditorToolbar ); + EditorGuiToolbarStack.remove( RoadEditorToolbar ); + RoadEditorOptionsWindow.setVisible( false ); RoadEditorTreeWindow.setVisible( false ); %this.map.pop(); diff --git a/Templates/BaseGame/game/tools/shapeEditor/main.tscript b/Templates/BaseGame/game/tools/shapeEditor/main.tscript index 76353b548..440deafad 100644 --- a/Templates/BaseGame/game/tools/shapeEditor/main.tscript +++ b/Templates/BaseGame/game/tools/shapeEditor/main.tscript @@ -44,8 +44,6 @@ function initializeShapeEditor() // Add windows to editor gui ShapeEdPreviewGui.setVisible(false); ShapeEdAnimWindow.setVisible(false); - - ShapeEditorToolbar.setVisible(false); ShapeEdSelectWindow.setVisible(false); ShapeEdPropWindow.setVisible(false); @@ -256,6 +254,9 @@ function ShapeEditorPlugin::onActivated(%this) %this.openShapeAssetId(%shapeFile); } } + + EditorGuiToolbarStack.remove( EWorldEditorToolbar ); + EditorGuiToolbarStack.add( ShapeEditorToolbar ); } function ShapeEditorPlugin::initStatusBar(%this) @@ -275,7 +276,9 @@ function ShapeEditorPlugin::onDeactivated(%this) $gfx::wireframe = $wasInWireFrameMode; ShapeEdMaterials.updateSelectedMaterial(false); - ShapeEditorToolbar.setVisible(false); + + EditorGuiToolbarStack.add( EWorldEditorToolbar ); + EditorGuiToolbarStack.remove( ShapeEditorToolbar ); ShapeEdPreviewGui.setVisible(false); ShapeEdSelectWindow.setVisible(false); diff --git a/Templates/BaseGame/game/tools/worldEditor/gui/EditorGui.ed.gui b/Templates/BaseGame/game/tools/worldEditor/gui/EditorGui.ed.gui index 298404b55..93aacceec 100644 --- a/Templates/BaseGame/game/tools/worldEditor/gui/EditorGui.ed.gui +++ b/Templates/BaseGame/game/tools/worldEditor/gui/EditorGui.ed.gui @@ -33,6 +33,29 @@ Visible = "1"; hovertime = "1000"; + new GuiStackControl(EditorGuiToolbarStack) { + stackingType = "Horizontal"; + horizStacking = "Left to Right"; + vertStacking = "Top to Bottom"; + padding = "0"; + dynamicSize = "1"; + dynamicNonStackExtent = "0"; + dynamicPos = "0"; + changeChildSizeToFit = "0"; + changeChildPosition = "1"; + position = "0 0"; + extent = "885 32"; + minExtent = "16 16"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; new GuiBitmapButtonCtrl(EHWorldEditor) { canSaveDynamicFields = "0"; @@ -107,6 +130,76 @@ bitmapAsset = "ToolsModule:separator_h_image"; }; + new GuiBitmapButtonCtrl() { + BitmapAsset = "ToolsModule:settings_n_image"; + bitmapMode = "Stretched"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "572 0"; + extent = "29 27"; + minExtent = "8 8"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "ESettingsWindow.toggleEditorSettings();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + tooltip = "Open Editor Settings"; + hovertime = "1000"; + isContainer = "0"; + internalName = "editorSettingsBtn"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + + new GuiBitmapCtrl() { + Enabled = "1"; + Profile = "ToolsGuiDefaultProfile"; + position = "98 3"; + Extent = "2 26"; + MinExtent = "1 1"; + bitmapAsset = "ToolsModule:separator_h_image"; + }; + + new GuiBitmapButtonCtrl() { + canSaveDynamicFields = "0"; + internalName = AssetBrowserBtn; + Enabled = "1"; + isContainer = "0"; + Profile = "ToolsGuiButtonProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + position = "180 0"; + Extent = "29 27"; + MinExtent = "8 2"; + canSave = "1"; + Visible = "1"; + Command = "AssetBrowser.toggleDialog();"; + tooltipprofile = "ToolsGuiToolTipProfile"; + ToolTip = "Asset Browser"; + hovertime = "750"; + bitmapAsset = "ToolsModule:menuGrid_n_image"; + bitmapMode = "Stretched"; + buttonType = "PushButton"; + groupNum = "0"; + useMouseEvents = "0"; + }; + + new GuiBitmapCtrl() { + Enabled = "1"; + Profile = "ToolsGuiDefaultProfile"; + position = "98 3"; + Extent = "2 26"; + MinExtent = "1 1"; + bitmapAsset = "ToolsModule:separator_h_image"; + }; + new GuiBitmapButtonCtrl(EWorldEditorToggleCamera) { canSaveDynamicFields = "0"; Enabled = "1"; @@ -306,6 +399,7 @@ sbUsesNAColor = "0"; reverseTextList = "0"; bitmapBounds = "16 16"; + }; }; }; diff --git a/Templates/BaseGame/game/tools/worldEditor/gui/WorldEditorToolbar.ed.gui b/Templates/BaseGame/game/tools/worldEditor/gui/WorldEditorToolbar.ed.gui index 0940617c6..cde1ff9c5 100644 --- a/Templates/BaseGame/game/tools/worldEditor/gui/WorldEditorToolbar.ed.gui +++ b/Templates/BaseGame/game/tools/worldEditor/gui/WorldEditorToolbar.ed.gui @@ -520,31 +520,6 @@ useMouseEvents = "0"; }; - new GuiBitmapButtonCtrl() { - canSaveDynamicFields = "0"; - internalName = "editorSettingsBtn"; - Enabled = "1"; - isContainer = "0"; - Profile = "ToolsGuiButtonProfile"; - HorizSizing = "right"; - VertSizing = "bottom"; - Position = "484 3"; - Extent = "29 27"; - MinExtent = "8 8"; - canSave = "1"; - Visible = "1"; - Variable = ""; - Command = "ESettingsWindow.toggleEditorSettings();"; - tooltipprofile = "ToolsGuiToolTipProfile"; - ToolTip = "Open Editor Settings"; - hovertime = "1000"; - bitmapAsset = "ToolsModule:settings_n_image"; - text = ""; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - }; - new GuiContainer(objectCenterDropdown){ Profile = "IconDropdownProfile"; Position = getWord(EWorldEditorToolbar.position, 0)+getWord(ToggleButtonBar.Position, 0)+getWord(EWorldEditorToolbar-->centerObject.position, 0)-5 SPC getWord(EditorGuiToolbar.extent, 1)-1; diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.tscript b/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.tscript index 70e8f9968..4a7f851fe 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.tscript +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.tscript @@ -91,10 +91,10 @@ function EditorGui::init(%this) { // Load Creator/Inspector GUI exec("~/worldEditor/gui/WorldEditorToolbar.ed.gui"); - if( isObject( EWorldEditorToolbar ) ) + if( isObject( EditorGuiToolbarStack ) ) { - %this.add( EWorldEditorToolbar ); - EWorldEditorToolbar.setVisible( false ); + EditorGuiToolbarStack.add( EWorldEditorToolbar ); + //EWorldEditorToolbar.setVisible( false ); } } @@ -102,11 +102,11 @@ function EditorGui::init(%this) { // Load Terrain Edit GUI exec("~/worldEditor/gui/TerrainEditToolbar.ed.gui"); - if( isObject( EWTerrainEditToolbar ) ) + /*if( isObject( EWTerrainEditToolbar ) ) { %this.add( EWTerrainEditToolbar ); EWTerrainEditToolbar.setVisible( false ); - } + }*/ } if( !isObject( %this-->TerrainPainter ) ) @@ -126,11 +126,11 @@ function EditorGui::init(%this) { // Load Terrain Edit GUI exec("~/worldEditor/gui/TerrainPainterToolbar.ed.gui"); - if( isObject( EWTerrainPainterToolbar ) ) + /*if( isObject( EWTerrainPainterToolbar ) ) { %this.add( EWTerrainPainterToolbar ); EWTerrainPainterToolbar.setVisible( false ); - } + }*/ } if( !isObject( %this-->ToolsToolbar ) ) @@ -1082,7 +1082,9 @@ function TerrainEditorPlugin::onActivated( %this ) ETerrainEditor.attachTerrain(); ETerrainEditor.makeFirstResponder( true ); - EWTerrainEditToolbar.setVisible( true ); + EditorGuiToolbarStack.add(EWTerrainEditToolbar); + EditorGuiToolbarStack.remove( EWorldEditorToolbar ); + //EWTerrainEditToolbar.setVisible( true ); ETerrainEditor.onBrushChanged(); ETerrainEditor.setup(); TerrainEditorPlugin.syncBrushInfo(); @@ -1098,7 +1100,9 @@ function TerrainEditorPlugin::onDeactivated( %this ) endToolTime("TerrainEditor"); EditorGui.writeTerrainEditorSettings(); - EWTerrainEditToolbar.setVisible( false ); + EditorGuiToolbarStack.remove(EWTerrainEditToolbar); + EditorGuiToolbarStack.add( EWorldEditorToolbar ); + //EWTerrainEditToolbar.setVisible( false ); ETerrainEditor.setVisible( false ); EditorGui.menuBar.remove( %this.terrainMenu ); @@ -1216,7 +1220,10 @@ function TerrainPainterPlugin::onActivated( %this ) EditorGui-->TerrainPainter.setVisible(true); EditorGui-->TerrainPainterPreview.setVisible(true); - EWTerrainPainterToolbar.setVisible(true); + + EditorGuiToolbarStack.add(EWTerrainPainterToolbar); + EditorGuiToolbarStack.remove( EWorldEditorToolbar ); + //EWTerrainPainterToolbar.setVisible(true); ETerrainEditor.onBrushChanged(); EPainter.setup(); TerrainPainterPlugin.syncBrushInfo(); @@ -1233,7 +1240,9 @@ function TerrainPainterPlugin::onDeactivated( %this ) %this.map.pop(); EditorGui-->TerrainPainter.setVisible(false); EditorGui-->TerrainPainterPreview.setVisible(false); - EWTerrainPainterToolbar.setVisible(false); + EditorGuiToolbarStack.remove(EWTerrainPainterToolbar); + EditorGuiToolbarStack.add( EWorldEditorToolbar ); + //EWTerrainPainterToolbar.setVisible(false); ETerrainEditor.setVisible( false ); } diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/editor.keybinds.tscript b/Templates/BaseGame/game/tools/worldEditor/scripts/editor.keybinds.tscript index b08200869..a077b8611 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/editor.keybinds.tscript +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/editor.keybinds.tscript @@ -78,3 +78,5 @@ GlobalActionMap.bind(keyboard, "ctrl F3", doProfile); GlobalActionMap.bind(keyboard, "tilde", toggleConsole); EditorMap.bind( mouse, "alt zaxis", editorWheelFadeScroll ); + +EditorMap.bindCmd( keyboard, space, "", "AssetBrowser.toggleDialog();" ); From 534d90c002e6720d626d6877d7d070a1e8a5ff22 Mon Sep 17 00:00:00 2001 From: Areloch Date: Wed, 1 Sep 2021 01:19:53 -0500 Subject: [PATCH 5/7] Missed line adding ShapeEditorToolbar to main editor UI needlessly. --- Templates/BaseGame/game/tools/shapeEditor/main.tscript | 2 -- 1 file changed, 2 deletions(-) diff --git a/Templates/BaseGame/game/tools/shapeEditor/main.tscript b/Templates/BaseGame/game/tools/shapeEditor/main.tscript index 440deafad..1fa7626c4 100644 --- a/Templates/BaseGame/game/tools/shapeEditor/main.tscript +++ b/Templates/BaseGame/game/tools/shapeEditor/main.tscript @@ -51,7 +51,6 @@ function initializeShapeEditor() EditorGui.add(ShapeEdAnimWindow); EditorGui.add(ShapeEdAdvancedWindow); - EditorGui.add(ShapeEditorToolbar); EditorGui.add(ShapeEdSelectWindow); EditorGui.add(ShapeEdPropWindow); @@ -187,7 +186,6 @@ function ShapeEditorPlugin::open(%this, %shapeAsset) ShapeEdPropWindow.setVisible(true); ShapeEdAnimWindow.setVisible(true); ShapeEdAdvancedWindow.setVisible(ShapeEditorToolbar-->showAdvanced.getValue()); - ShapeEditorToolbar.setVisible(true); EditorGui.bringToFront(ShapeEdPreviewGui); ToolsPaletteArray->WorldEditorMove.performClick(); From e8a49ef4ca363d5d4a4b4e13ed308a0f44c66ace Mon Sep 17 00:00:00 2001 From: Areloch Date: Wed, 1 Sep 2021 17:57:21 -0500 Subject: [PATCH 6/7] Requested cleanups --- .../scripts/addModuleWindow.tscript | 1 - .../scripts/assetTypes/image.tscript | 20 +++++++++---------- .../scripts/assetTypes/shape.tscript | 6 +++++- .../game/tools/gui/profiles.ed.tscript | 1 - .../scripts/menuHandlers.ed.tscript | 2 +- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/addModuleWindow.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/addModuleWindow.tscript index 833a3031b..ade7dce8e 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/addModuleWindow.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/addModuleWindow.tscript @@ -32,7 +32,6 @@ function AssetBrowser_addModuleWindow::onGainFirstResponder(%this) function AssetBrowser_addModuleWindow::close() { Canvas.popDialog(AssetBrowser_addModule); - //eval(AssetBrowser_addModuleWindow.callbackFunction); } function AssetBrowser_addModuleWindow::CreateNewModule(%this) diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/image.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/image.tscript index 4a727143b..81e0e56cd 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/image.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/image.tscript @@ -198,20 +198,20 @@ function AssetBrowser::buildImageAssetPreview(%this, %assetDef, %previewData) if(%success) { - %previewAsset = new ImageAsset() - { - assetName = %previewAssetName; - versionId = 1; - imageFile = fileName(%previewFilePath); - }; + %previewAsset = new ImageAsset() + { + assetName = %previewAssetName; + versionId = 1; + imageFile = fileName(%previewFilePath); + }; %previewAssetName = "ToolsModule:" @ %previewAssetName; - %previewImgAssetPath = %previewPath @ %previewAsset.assetName @ ".asset.taml"; - %assetImportSuccessful = TAMLWrite(%previewAsset, %previewImgAssetPath); + %previewImgAssetPath = %previewPath @ %previewAsset.assetName @ ".asset.taml"; + %assetImportSuccessful = TAMLWrite(%previewAsset, %previewImgAssetPath); - %toolsModuleDef = ModuleDatabase.findModule("ToolsModule",1); + %toolsModuleDef = ModuleDatabase.findModule("ToolsModule",1); - %success = AssetDatabase.addDeclaredAsset(%toolsModuleDef, %previewImgAssetPath); + %success = AssetDatabase.addDeclaredAsset(%toolsModuleDef, %previewImgAssetPath); } else { diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shape.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shape.tscript index 17fa1c430..4bf17453a 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shape.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shape.tscript @@ -324,9 +324,13 @@ function AssetBrowser::buildShapeAssetPreview(%this, %assetDef, %previewData) else { if(EditorSettings.value("Assets/Browser/doubleClickAction", "Edit Asset") $= "Edit Asset") - %previewData.doubleClickCommand = "AssetBrowser.editAsset( "@%assetDef@" );"; + { + %previewData.doubleClickCommand = "AssetBrowser.editAsset( "@%assetDef@" );"; + } else + { %previewData.doubleClickCommand = "AssetBrowser.onShapeAssetEditorDropped( "@%assetDef@" );"; + } } } diff --git a/Templates/BaseGame/game/tools/gui/profiles.ed.tscript b/Templates/BaseGame/game/tools/gui/profiles.ed.tscript index 003bd314d..e59be8ddf 100644 --- a/Templates/BaseGame/game/tools/gui/profiles.ed.tscript +++ b/Templates/BaseGame/game/tools/gui/profiles.ed.tscript @@ -364,7 +364,6 @@ new GuiControlProfile( ToolsGuiButtonProfile ) fixedExtent = false; justify = "center"; canKeyFocus = false; - //bitmapAsset = "ToolsModule:button_image"; hasBitmapArray = false; category = "Tools"; }; diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/menuHandlers.ed.tscript b/Templates/BaseGame/game/tools/worldEditor/scripts/menuHandlers.ed.tscript index efe33ee45..a674aab8d 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/menuHandlers.ed.tscript +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/menuHandlers.ed.tscript @@ -1059,7 +1059,7 @@ function EditorDropTypeMenu::onSelectItem(%this, %id, %text) // a drop type is selected in the menu. EWorldEditor.dropType = getField(%this.item[%id], 2); - for(%i=0; %i < %this.getItemCount() + 1; %i++) + for(%i=0; %i < %this.getItemCount(); %i++) { %this.checkItem(%i, false); } From 1b55dce613dab6122aa7660d546328e83b103534 Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Wed, 1 Sep 2021 21:12:12 -0400 Subject: [PATCH 7/7] * Workaround: Implement noinline attributes for problematic functions in str.cpp due to what appears to be GCC compiler bugs. --- Engine/source/core/util/str.cpp | 4 ++-- Engine/source/platform/types.gcc.h | 3 +++ Engine/source/platform/types.visualc.h | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Engine/source/core/util/str.cpp b/Engine/source/core/util/str.cpp index c93a95aba..bec26609b 100644 --- a/Engine/source/core/util/str.cpp +++ b/Engine/source/core/util/str.cpp @@ -284,8 +284,8 @@ class String::StringData : protected StringDataImpl delete [] mUTF16; } - void* operator new(size_t size, U32 len); - void* operator new( size_t size, U32 len, DataChunker& chunker ); + void* TORQUE_NOINLINE operator new(size_t size, U32 len); + void* TORQUE_NOINLINE operator new( size_t size, U32 len, DataChunker& chunker ); void operator delete(void *); bool isShared() const diff --git a/Engine/source/platform/types.gcc.h b/Engine/source/platform/types.gcc.h index 53538dd8d..a36759bc0 100644 --- a/Engine/source/platform/types.gcc.h +++ b/Engine/source/platform/types.gcc.h @@ -165,5 +165,8 @@ typedef unsigned long U64; #endif #endif +// Set GCC noinline +#define TORQUE_NOINLINE __attribute__ ((noinline)) + #endif // INCLUDED_TYPES_GCC_H diff --git a/Engine/source/platform/types.visualc.h b/Engine/source/platform/types.visualc.h index 57dabc4dd..4b937ddf8 100644 --- a/Engine/source/platform/types.visualc.h +++ b/Engine/source/platform/types.visualc.h @@ -104,6 +104,8 @@ typedef unsigned _int64 U64; // see msdn.microsoft.com "Compiler Warning (level 1) C4291" for more details #pragma warning(disable: 4291) +// Set MSVC noline attribute +#define TORQUE_NOINLINE __declspec(noinline) #endif // INCLUDED_TYPES_VISUALC_H