From cba14c035f6c23408dc4d1d04f2c83c12ccf0160 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 20 Oct 2019 02:47:15 -0500 Subject: [PATCH] Change Asset Browser logic to utilize folder heirarchy instead of strict Asset Type filtration Added navigation history to AB, as well as ability to navigate via forward and backward buttons and breadcrumb buttons Added folder 'asset type', allowing you to create, rename, delete and move folders via the asset browser for better organization Adjusted various behaviors to work with the address-driven navigation/organization of the AB Expanded visibility options for the AB and integrated them into editor settings so they are retained Added Search field for searching the folder structure, in addition to the existing preview tiles search Adjusted drag-n-drop behavior of the platform code so it accepts dropping folders Added ability to dump active PostEffects list to see what is currently running Added ability to mark specific items in GuiTreeViewCtrl as hidden Made reflection probe bounds boxes translucent rather than wireframe to improve editing visibility Added expanded loose file references to LevelAsset for common companion files like decals and posteffect scrips Added editor setting for Editor Layout Mode, allowing you to set the editor into 'Modern' layout. Added editor settings to set default import config ruleset, and also ability to set auto-import. If both of these are set, then as long as the importing assets have no errors, they will auto-process and the user doesn't need to manually check and confirm them via the asset import window --- Engine/source/T3D/assets/LevelAsset.cpp | 13 + Engine/source/T3D/assets/LevelAsset.h | 12 + .../source/T3D/lighting/reflectionProbe.cpp | 3 +- .../source/gui/controls/guiTreeViewCtrl.cpp | 36 + Engine/source/gui/controls/guiTreeViewCtrl.h | 3 + Engine/source/postFx/postEffectManager.cpp | 73 ++ Engine/source/postFx/postEffectManager.h | 4 +- .../source/windowManager/sdl/sdlWindowMgr.cpp | 2 +- .../BaseGame/game/core/postFX/scripts/glow.cs | 2 +- .../BaseGame/game/core/postFX/scripts/hdr.cs | 2 +- .../game/core/postFX/scripts/postFx.cs | 2 - .../tools/assetBrowser/assetImportConfigs.xml | 66 +- .../tools/assetBrowser/guis/assetBrowser.gui | 508 +++++----- .../tools/assetBrowser/guis/assetImport.gui | 2 +- .../BaseGame/game/tools/assetBrowser/main.cs | 27 + .../assetBrowser/scripts/assetBrowser.cs | 882 +++++++++++++++--- .../tools/assetBrowser/scripts/assetImport.cs | 176 +--- .../assetBrowser/scripts/assetImportConfig.cs | 9 +- .../scripts/assetTypes/component.cs | 2 +- .../assetBrowser/scripts/assetTypes/gui.cs | 8 +- .../assetBrowser/scripts/assetTypes/image.cs | 2 +- .../assetBrowser/scripts/assetTypes/level.cs | 14 +- .../scripts/assetTypes/material.cs | 8 +- .../assetBrowser/scripts/assetTypes/script.cs | 8 +- .../assetBrowser/scripts/assetTypes/shape.cs | 6 +- .../tools/assetBrowser/scripts/editAsset.cs | 115 ++- .../tools/assetBrowser/scripts/newAsset.cs | 12 + .../tools/assetBrowser/scripts/popupMenus.cs | 88 +- .../game/tools/gui/editorSettingsWindow.ed.cs | 39 +- .../BaseGame/game/tools/gui/profiles.ed.cs | 2 +- Templates/BaseGame/game/tools/settings.xml | 302 +++--- .../tools/worldEditor/scripts/EditorGui.ed.cs | 3 + .../tools/worldEditor/scripts/editor.ed.cs | 2 +- 33 files changed, 1633 insertions(+), 800 deletions(-) diff --git a/Engine/source/T3D/assets/LevelAsset.cpp b/Engine/source/T3D/assets/LevelAsset.cpp index 32e7175d2..088b80045 100644 --- a/Engine/source/T3D/assets/LevelAsset.cpp +++ b/Engine/source/T3D/assets/LevelAsset.cpp @@ -87,6 +87,10 @@ LevelAsset::LevelAsset() : AssetBase(), mIsSubLevel(false) mLevelName = StringTable->EmptyString(); mLevelFile = StringTable->EmptyString(); mPreviewImage = StringTable->EmptyString(); + mPostFXPresetFile = StringTable->EmptyString(); + mDecalsFile = StringTable->EmptyString(); + mForestFile = StringTable->EmptyString(); + mNavmeshFile = StringTable->EmptyString(); mGamemodeName = StringTable->EmptyString(); mMainLevelAsset = StringTable->EmptyString(); @@ -115,6 +119,15 @@ void LevelAsset::initPersistFields() addProtectedField("PreviewImage", TypeAssetLooseFilePath, Offset(mPreviewImage, LevelAsset), &setPreviewImageFile, &getPreviewImageFile, "Path to the image used for selection preview."); + addProtectedField("PostFXPresetFile", TypeAssetLooseFilePath, Offset(mPostFXPresetFile, LevelAsset), + &setLevelFile, &getLevelFile, "Path to the level's postFXPreset."); + addProtectedField("DecalsFile", TypeAssetLooseFilePath, Offset(mDecalsFile, LevelAsset), + &setLevelFile, &getLevelFile, "Path to the decals cache file."); + addProtectedField("ForestFile", TypeAssetLooseFilePath, Offset(mForestFile, LevelAsset), + &setLevelFile, &getLevelFile, "Path to the Forest cache file."); + addProtectedField("NavmeshFile", TypeAssetLooseFilePath, Offset(mNavmeshFile, LevelAsset), + &setLevelFile, &getLevelFile, "Path to the navmesh file."); + addField("isSubScene", TypeBool, Offset(mIsSubLevel, LevelAsset), "Is this a sublevel to another Scene"); addField("gameModeName", TypeString, Offset(mGamemodeName, LevelAsset), "Name of the Game Mode to be used with this level"); } diff --git a/Engine/source/T3D/assets/LevelAsset.h b/Engine/source/T3D/assets/LevelAsset.h index e271d1c91..17aff3fc9 100644 --- a/Engine/source/T3D/assets/LevelAsset.h +++ b/Engine/source/T3D/assets/LevelAsset.h @@ -46,6 +46,10 @@ class LevelAsset : public AssetBase StringTableEntry mLevelName; StringTableEntry mLevelFile; + StringTableEntry mPostFXPresetFile; + StringTableEntry mDecalsFile; + StringTableEntry mForestFile; + StringTableEntry mNavmeshFile; StringTableEntry mPreviewImage; bool mIsSubLevel; @@ -66,6 +70,14 @@ public: void setLevelFile(const char* pImageFile); inline StringTableEntry getLevelFile(void) const { return mLevelFile; }; + void setPostFXPresetFile(const char* pPostFXPresetFile); + inline StringTableEntry getPostFXPresetFile(void) const { return mPostFXPresetFile; }; + void setDecalsFile(const char* pDecalsFile); + inline StringTableEntry getDecalsFile(void) const { return mDecalsFile; }; + void setForestFile(const char* pForestFile); + inline StringTableEntry getForestFile(void) const { return mForestFile; }; + void setNavmeshFile(const char* pNavmeshFile); + inline StringTableEntry getNavmeshFile(void) const { return mNavmeshFile; }; void setImageFile(const char* pImageFile); inline StringTableEntry getImageFile(void) const { return mPreviewImage; }; diff --git a/Engine/source/T3D/lighting/reflectionProbe.cpp b/Engine/source/T3D/lighting/reflectionProbe.cpp index b0606a62a..cdf948cc1 100644 --- a/Engine/source/T3D/lighting/reflectionProbe.cpp +++ b/Engine/source/T3D/lighting/reflectionProbe.cpp @@ -963,7 +963,8 @@ void ReflectionProbe::_onRenderViz(ObjectRenderInst *ri, desc.setZReadWrite(true, false); desc.setCullMode(GFXCullNone); desc.setBlend(true); - desc.fillMode = GFXFillWireframe; + //desc.fillMode = GFXFillWireframe; + // Base the sphere color on the light color. ColorI color = ColorI(255, 0, 255, 63); diff --git a/Engine/source/gui/controls/guiTreeViewCtrl.cpp b/Engine/source/gui/controls/guiTreeViewCtrl.cpp index a1fa30412..6bb33a198 100644 --- a/Engine/source/gui/controls/guiTreeViewCtrl.cpp +++ b/Engine/source/gui/controls/guiTreeViewCtrl.cpp @@ -1176,6 +1176,10 @@ void GuiTreeViewCtrl::_buildItem( Item* item, U32 tabLevel, bool bForceFullUpdat else item->mState.clear( Item::Filtered ); + //If the item should be hidden from view, check now + if (mHiddenItemsList.contains(item->mId)) + item->mState.set(Item::Filtered); + // Is this the root item? const bool isRoot = item == mRoot; @@ -4477,6 +4481,18 @@ void GuiTreeViewCtrl::setItemFilterException(U32 item, bool isExempted) } } +void GuiTreeViewCtrl::setItemHidden(U32 item, bool isHidden) +{ + if (isHidden) + { + mHiddenItemsList.push_back(item); + } + else + { + mHiddenItemsList.remove(item); + } +} + void GuiTreeViewCtrl::reparentItems(Vector selectedItems, Item* newParent) { for (S32 i = 0; i < selectedItems.size(); i++) @@ -5651,6 +5667,26 @@ DefineEngineMethod(GuiTreeViewCtrl, setItemFilterException, void, (U32 item, boo { object->setItemFilterException(item, isExempt); } + +DefineEngineMethod(GuiTreeViewCtrl, setItemHidden, void, (U32 item, bool hidden), (0, true), + "Set the pattern by which to filter items in the tree. Only items in the tree whose text " + "matches this pattern are displayed.\n\n" + "@param pattern New pattern based on which visible items in the tree should be filtered. If empty, all items become visible.\n\n" + "@see getFilterText\n" + "@see clearFilterText") +{ + object->setItemHidden(item, hidden); +} + +DefineEngineMethod(GuiTreeViewCtrl, clearHiddenItems, void, (),, + "Set the pattern by which to filter items in the tree. Only items in the tree whose text " + "matches this pattern are displayed.\n\n" + "@param pattern New pattern based on which visible items in the tree should be filtered. If empty, all items become visible.\n\n" + "@see getFilterText\n" + "@see clearFilterText") +{ + object->clearHiddenItems(); +} //----------------------------------------------------------------------------- DefineEngineMethod( GuiTreeViewCtrl, clearFilterText, void, (),, diff --git a/Engine/source/gui/controls/guiTreeViewCtrl.h b/Engine/source/gui/controls/guiTreeViewCtrl.h index 23de96b27..256a2c30f 100644 --- a/Engine/source/gui/controls/guiTreeViewCtrl.h +++ b/Engine/source/gui/controls/guiTreeViewCtrl.h @@ -360,6 +360,7 @@ class GuiTreeViewCtrl : public GuiArrayCtrl bool mDoFilterChildren; Vector mItemFilterExceptionList; + Vector mHiddenItemsList; /// If true, a trace of actions taken by the control is logged to the console. Can /// be turned on with the setDebug() script method. @@ -578,6 +579,8 @@ class GuiTreeViewCtrl : public GuiArrayCtrl void setFilterChildren(bool doFilter) { mDoFilterChildren = doFilter; } void setItemFilterException(U32 item, bool isExempt); + void setItemHidden(U32 item, bool isHidden); + void clearHiddenItems() { mHiddenItemsList.clear(); } /// Clear the current item filtering pattern. void clearFilterText() { setFilterText( String::EmptyString ); } diff --git a/Engine/source/postFx/postEffectManager.cpp b/Engine/source/postFx/postEffectManager.cpp index dc37723bb..7904c522d 100644 --- a/Engine/source/postFx/postEffectManager.cpp +++ b/Engine/source/postFx/postEffectManager.cpp @@ -314,3 +314,76 @@ S32 PostEffectManager::_effectPrioritySort( PostEffect* const *e1, PostEffect* c return 0; } + +void PostEffectManager::dumpActivePostFX() +{ + EffectVector effects; + + for (U32 i = 0; i < mEndOfFrameList.size(); i++) + { + PostEffect* effect = mEndOfFrameList[i]; + + if(effect->isEnabled()) + effects.push_back(effect); + } + + for (U32 i = 0; i < mAfterDiffuseList.size(); i++) + { + PostEffect* effect = mAfterDiffuseList[i]; + + if (effect->isEnabled()) + effects.push_back(effect); + } + + + // Now check the bin maps. + EffectMap::Iterator mapIter = mAfterBinMap.begin(); + for (; mapIter != mAfterBinMap.end(); mapIter++) + { + EffectVector& ef = mapIter->value; + + for (U32 i = 0; i < ef.size(); i++) + { + PostEffect* effect = ef[i]; + + if (effect->isEnabled()) + effects.push_back(effect); + } + } + + mapIter = mBeforeBinMap.begin(); + for (; mapIter != mBeforeBinMap.end(); mapIter++) + { + EffectVector& ef = mapIter->value; + + for (U32 i = 0; i < ef.size(); i++) + { + PostEffect* effect = ef[i]; + + if (effect->isEnabled()) + effects.push_back(effect); + } + } + + // Resort the effects by priority. + effects.sort(&_effectPrioritySort); + + Con::printf("PostEffectManager::dumpActivePostFX() - Beginning Dump"); + + for (U32 i = 0; i < effects.size(); i++) + { + PostEffect* effect = effects[i]; + + if (effect->isEnabled()) + { + Con::printf("%s", effect->getName()); + } + } + + Con::printf("PostEffectManager::dumpActivePostFX() - Ending Dump"); +} + +DefineEngineFunction(dumpActivePostFX, void, (),, "") +{ + PFXMGR->dumpActivePostFX(); +} diff --git a/Engine/source/postFx/postEffectManager.h b/Engine/source/postFx/postEffectManager.h index f06e6b76a..e8c55c0d7 100644 --- a/Engine/source/postFx/postEffectManager.h +++ b/Engine/source/postFx/postEffectManager.h @@ -132,9 +132,11 @@ public: // For ManagedSingleton. static const char* getSingletonName() { return "PostEffectManager"; } + + void dumpActivePostFX(); }; /// Returns the PostEffectManager singleton. #define PFXMGR ManagedSingleton::instance() -#endif // _POSTEFFECTMANAGER_H_ \ No newline at end of file +#endif // _POSTEFFECTMANAGER_H_ diff --git a/Engine/source/windowManager/sdl/sdlWindowMgr.cpp b/Engine/source/windowManager/sdl/sdlWindowMgr.cpp index 5be1ae53d..f937ba97e 100644 --- a/Engine/source/windowManager/sdl/sdlWindowMgr.cpp +++ b/Engine/source/windowManager/sdl/sdlWindowMgr.cpp @@ -353,7 +353,7 @@ void PlatformWindowManagerSDL::_process() char* fileName = evt.drop.file; - if (!Platform::isFile(fileName)) + if (!Platform::isDirectory(fileName) && !Platform::isFile(fileName)) break; Con::executef("onDropFile", StringTable->insert(fileName)); diff --git a/Templates/BaseGame/game/core/postFX/scripts/glow.cs b/Templates/BaseGame/game/core/postFX/scripts/glow.cs index 0f062f6f7..c4e7a9595 100644 --- a/Templates/BaseGame/game/core/postFX/scripts/glow.cs +++ b/Templates/BaseGame/game/core/postFX/scripts/glow.cs @@ -146,7 +146,7 @@ singleton PostEffect( VolFogGlowPostFx ) texture[0] = "$backbuffer"; target = "$outTex"; targetScale = "0.5 0.5"; - isEnabled = true; + isEnabled = false; // Blur vertically new PostEffect() { diff --git a/Templates/BaseGame/game/core/postFX/scripts/hdr.cs b/Templates/BaseGame/game/core/postFX/scripts/hdr.cs index 99afc2256..f74fbcd0c 100644 --- a/Templates/BaseGame/game/core/postFX/scripts/hdr.cs +++ b/Templates/BaseGame/game/core/postFX/scripts/hdr.cs @@ -328,7 +328,7 @@ function HDRPostFX::onAdd( %this ) PostFXManager.registerPostEffect(%this); //HDR should really be on at all times - %this.enable(); + //%this.enable(); $HDRPostFX::enableToneMapping = 1; } diff --git a/Templates/BaseGame/game/core/postFX/scripts/postFx.cs b/Templates/BaseGame/game/core/postFX/scripts/postFx.cs index fe931a994..2d92a7ea7 100644 --- a/Templates/BaseGame/game/core/postFX/scripts/postFx.cs +++ b/Templates/BaseGame/game/core/postFX/scripts/postFx.cs @@ -35,8 +35,6 @@ singleton ShaderData( PFX_PassthruShader ) function postFXInit() { - exec("core/postFX/guis/postFxManager.gui"); - //Load the core postFX files themselves if (!$Server::Dedicated) { diff --git a/Templates/BaseGame/game/tools/assetBrowser/assetImportConfigs.xml b/Templates/BaseGame/game/tools/assetBrowser/assetImportConfigs.xml index 67ce2c5d6..b5ffe874e 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/assetImportConfigs.xml +++ b/Templates/BaseGame/game/tools/assetBrowser/assetImportConfigs.xml @@ -1,56 +1,56 @@ - - 0 - 0 - 1 - 0 - 0 - 0 - Z_AXIS - TrailingNumber + + 1 + 1 - 1 - 1 - 1 - 1 ColorEffect*, + 1 + 1 + 1 + 1 + + + 0 + 0 + 0 + Z_AXIS + 1 + TrailingNumber + 0 + 0 - _AO,_AMBIENT,_AMBIENTOCCLUSION - _METAL,_MET,_METALNESS,_METALLIC - 1 - 1 - 1 - Bilinear - 1 - _ROUGH,_ROUGHNESS - 0 1.0 - _ALBEDO,_DIFFUSE,_ALB,_DIF,_COLOR,_COL,_baseColor, - _COMP,_COMPOSITE - N/A - _SMOOTH,_SMOOTHNESS + 1 + Bilinear + 0 + _METAL,_MET,_METALNESS,_METALLIC _NORMAL,_NORM + _AO,_AMBIENT,_AMBIENTOCCLUSION + N/A + 1 + _ROUGH,_ROUGHNESS + _SMOOTH,_SMOOTHNESS + _ALBEDO,_DIFFUSE,_ALB,_DIF,_COLOR,_COL,_baseColor,_a, + 1 + 1 + _COMP,_COMPOSITE 1 - 1 - LOS Col CollisionMesh + 1 + LOS CollisionMesh - - 1 - 1 - 1.0 - 0 1.0 + 0 AutoPrune diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/assetBrowser.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/assetBrowser.gui index 20500af05..1bf2eff3c 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/guis/assetBrowser.gui +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/assetBrowser.gui @@ -13,13 +13,23 @@ isContainer = "1"; canSave = "1"; canSaveDynamicFields = "1"; - AddNewArtAssetPopup = "18222"; - AddNewAssetPopup = "18223"; - AddNewScriptAssetPopup = "18221"; + AddNewArtAssetPopup = "18110"; + AddNewAssetPopup = "18112"; + AddNewCppAssetPopup = "18111"; + AddNewScriptAssetPopup = "18109"; coreModulesFilter = "0"; currentPreviewPage = "0"; - enabled = "1"; + Enabled = "1"; + importAssetFinalListArray = "20689"; + ImportAssetResolutionsPopup = "18119"; + importAssetUnprocessedListArray = "20688"; + importingFilesArray = "20687"; isReImportingAsset = "0"; + navigationHistoryIdx = "0"; + onlyShowModulesWithAssets = "0"; + previewData = "19953"; + previewSize = "80"; + templateFilesPath = "tools/assetBrowser/scripts/templateFiles/"; totalPages = "1"; treeFilterMode = "list"; @@ -201,7 +211,7 @@ groupNum = "-1"; buttonType = "PushButton"; useMouseEvents = "0"; - position = "50 22"; + position = "52 22"; extent = "45 19"; minExtent = "8 2"; horizSizing = "right"; @@ -215,97 +225,107 @@ canSave = "1"; canSaveDynamicFields = "0"; }; - new GuiWindowCtrl(TagFilterWindow) { - text = "New Window"; - resizeWidth = "1"; - resizeHeight = "1"; - canMove = "1"; - canClose = "0"; - canMinimize = "0"; - canMaximize = "0"; - canCollapse = "0"; - edgeSnap = "1"; - docking = "None"; - margin = "4 4 4 4"; - padding = "0 0 0 0"; - anchorTop = "0"; - anchorBottom = "0"; - anchorLeft = "0"; - anchorRight = "0"; - position = "129 62"; - extent = "161 250"; - minExtent = "161 86"; - horizSizing = "windowRelative"; - vertSizing = "windowRelative"; - profile = "ToolsGuiToolbarWindowProfile"; - visible = "0"; + new GuiBitmapButtonCtrl(AssetBrowser_NavigateBackBtn) { + bitmap = "tools/gui/images/folderUp.png"; + bitmapMode = "Centered"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "98 21"; + extent = "22 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser.navigateHistoryBack();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl(AssetBrowser_NavigateForwardBtn) { + bitmap = "tools/gui/images/folderDown.png"; + bitmapMode = "Centered"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "120 21"; + extent = "22 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser.navigateHistoryForward();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiStackControl(AssetBrowser_BreadcrumbBar) { + stackingType = "Horizontal"; + horizStacking = "Left to Right"; + vertStacking = "Top to Bottom"; + padding = "0"; + dynamicSize = "0"; + dynamicNonStackExtent = "0"; + dynamicPos = "0"; + changeChildSizeToFit = "0"; + changeChildPosition = "1"; + position = "156 21"; + extent = "326 23"; + minExtent = "16 16"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; active = "1"; tooltipProfile = "GuiToolTipProfile"; hovertime = "1000"; isContainer = "1"; - internalName = "VisibilityLayerWindow"; - hidden = "1"; canSave = "1"; canSaveDynamicFields = "0"; - - new GuiScrollCtrl() { - willFirstRespond = "1"; - hScrollBar = "alwaysOff"; - vScrollBar = "dynamic"; - lockHorizScroll = "1"; - lockVertScroll = "0"; - constantThumbHeight = "0"; - childMargin = "2 0"; - mouseWheelScrollSpeed = "-1"; - docking = "Client"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "1 9"; - extent = "159 238"; - minExtent = "8 2"; - horizSizing = "width"; - vertSizing = "height"; - profile = "ToolsGuiScrollProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; - - new GuiStackControl(TagFilterList) { - stackingType = "Vertical"; - horizStacking = "Left to Right"; - vertStacking = "Top to Bottom"; - padding = "-2"; - dynamicSize = "1"; - dynamicNonStackExtent = "0"; - dynamicPos = "0"; - changeChildSizeToFit = "1"; - changeChildPosition = "1"; - position = "3 1"; - extent = "153 16"; - minExtent = "16 16"; - horizSizing = "width"; - vertSizing = "bottom"; - profile = "ToolsGuiDefaultProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - internalName = "theVisOptionsList"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - }; }; - new GuiSplitContainer() { + new GuiBitmapButtonCtrl(AssetBrowser_VisibilityOptions) { + bitmap = "tools/gui/images/visible"; + bitmapMode = "Centered"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "487 21"; + extent = "23 23"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser.showVisibiltyOptions();"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Visibility Options"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSplitContainer(AssetBrowser_MainSplit) { orientation = "Vertical"; splitterSize = "2"; splitPoint = "149 100"; @@ -332,7 +352,7 @@ canSave = "1"; canSaveDynamicFields = "0"; - new GuiPanel() { + new GuiPanel(AssetBrowser_FoldersPanel) { docking = "Client"; margin = "0 0 0 0"; padding = "0 0 0 0"; @@ -342,7 +362,7 @@ anchorRight = "0"; position = "0 0"; extent = "147 509"; - minExtent = "16 16"; + minExtent = "0 0"; horizSizing = "right"; vertSizing = "bottom"; profile = "ToolsGuiDefaultProfile"; @@ -376,8 +396,13 @@ canSave = "1"; canSaveDynamicFields = "0"; - new GuiTextCtrl() { - text = "Filters"; + new GuiTextEditCtrl(AssetBrowserFolderSearchFilter) { + historySize = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + password = "0"; + passwordMask = "*"; + text = "Search Folders..."; maxLength = "1024"; margin = "0 0 0 0"; padding = "0 0 0 0"; @@ -385,23 +410,24 @@ anchorBottom = "0"; anchorLeft = "1"; anchorRight = "0"; - position = "5 0"; - extent = "30 16"; + position = "0 0"; + extent = "148 18"; minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "ToolsGuiDefaultProfile"; + horizSizing = "width"; + vertSizing = "height"; + profile = "ToolsGuiTextEditProfile"; visible = "1"; active = "1"; tooltipProfile = "GuiToolTipProfile"; hovertime = "1000"; isContainer = "1"; + class = "AssetBrowserSearchFilterTxt"; canSave = "1"; canSaveDynamicFields = "0"; }; - new GuiBitmapButtonCtrl() { - bitmap = "tools/gui/images/visible"; - bitmapMode = "Stretched"; + new GuiBitmapButtonCtrl(AssetBrowser_ClearFolderFilterBtn) { + bitmap = "tools/gui/images/clear-icon"; + bitmapMode = "Centered"; autoFitExtents = "0"; useModifiers = "0"; useStates = "1"; @@ -409,17 +435,15 @@ groupNum = "-1"; buttonType = "PushButton"; useMouseEvents = "0"; - position = "128 -1"; - extent = "18 19"; + position = "132 0"; + extent = "15 15"; minExtent = "8 2"; - horizSizing = "right"; + horizSizing = "left"; vertSizing = "bottom"; - profile = "ToolsGuiDefaultProfile"; + profile = "GuiDefaultProfile"; visible = "1"; active = "1"; - command = "AssetBrowser.showFilterPopup();"; tooltipProfile = "GuiToolTipProfile"; - tooltip = "Views assets via module-oriented list tree."; hovertime = "1000"; isContainer = "0"; canSave = "1"; @@ -500,7 +524,7 @@ canRenameObjects = "1"; renameInternal = "0"; position = "1 1"; - extent = "145 252"; + extent = "145 147"; minExtent = "8 2"; horizSizing = "right"; vertSizing = "bottom"; @@ -517,7 +541,7 @@ }; }; }; - new GuiPanel() { + new GuiPanel(AssetBrowser_AssetsPanel) { docking = "Client"; margin = "0 0 0 0"; padding = "0 0 0 0"; @@ -548,7 +572,7 @@ anchorLeft = "1"; anchorRight = "0"; position = "1 0"; - extent = "354 41"; + extent = "354 19"; minExtent = "8 2"; horizSizing = "width"; vertSizing = "bottom"; @@ -561,65 +585,13 @@ canSave = "1"; canSaveDynamicFields = "0"; - new GuiBitmapButtonCtrl() { - bitmap = "tools/gui/images/new"; - bitmapMode = "Stretched"; - autoFitExtents = "0"; - useModifiers = "0"; - useStates = "1"; - masked = "0"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "42 22"; - extent = "15 15"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "ToolsGuiDefaultProfile"; - visible = "1"; - active = "1"; - command = "AssetBrowser.createNewAsset();"; - tooltipProfile = "GuiToolTipProfile"; - tooltip = "Create New Asset"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiBitmapButtonCtrl() { - bitmap = "tools/gui/images/delete"; - bitmapMode = "Stretched"; - autoFitExtents = "0"; - useModifiers = "0"; - useStates = "1"; - masked = "0"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "23 22"; - extent = "15 15"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "ToolsGuiDefaultProfile"; - visible = "1"; - active = "1"; - command = "AssetBrowser.showDeleteDialog();"; - tooltipProfile = "GuiToolTipProfile"; - tooltip = "Delete Asset"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; new GuiTextEditCtrl(AssetBrowserSearchFilter) { historySize = "0"; tabComplete = "0"; sinkAllKeyEvents = "0"; password = "0"; passwordMask = "*"; - text = "\c2Filter..."; + text = "Search Assets..."; maxLength = "1024"; margin = "0 0 0 0"; padding = "0 0 0 0"; @@ -627,8 +599,8 @@ anchorBottom = "0"; anchorLeft = "1"; anchorRight = "0"; - position = "62 19"; - extent = "273 18"; + position = "21 1"; + extent = "314 18"; minExtent = "8 2"; horizSizing = "width"; vertSizing = "bottom"; @@ -638,12 +610,12 @@ tooltipProfile = "GuiToolTipProfile"; hovertime = "1000"; isContainer = "1"; - class = "AssetBrowserSearchFilterText"; + class = "AssetBrowserSearchFilterTxt"; canSave = "1"; canSaveDynamicFields = "0"; }; - new GuiBitmapButtonCtrl(TagFilterButton) { - bitmap = "tools/gui/images/visible"; + new GuiBitmapButtonCtrl(AssetBrowser_ClearAssetFilterBtn) { + bitmap = "tools/gui/images/clear-icon"; bitmapMode = "Stretched"; autoFitExtents = "0"; useModifiers = "0"; @@ -652,55 +624,7 @@ groupNum = "-1"; buttonType = "PushButton"; useMouseEvents = "0"; - position = "4 19"; - extent = "20 20"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "ToolsGuiDefaultProfile"; - visible = "1"; - active = "1"; - command = "AssetBrowser.toggleTagFilterPopup();"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiTextCtrl() { - text = "Assets"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "5 0"; - extent = "53 16"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "ToolsGuiDefaultProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiBitmapButtonCtrl() { - bitmap = "tools/gui/images/delete"; - bitmapMode = "Stretched"; - autoFitExtents = "0"; - useModifiers = "0"; - useStates = "1"; - masked = "0"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "337 22"; + position = "321 1"; extent = "15 15"; minExtent = "8 2"; horizSizing = "left"; @@ -708,9 +632,60 @@ profile = "ToolsGuiDefaultProfile"; visible = "1"; active = "1"; - command = "AssetBrowser.showDeleteDialog();"; tooltipProfile = "GuiToolTipProfile"; - tooltip = "Delete Asset"; + tooltip = "Create New Asset"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl(AssetBrowser_ToggleFolderPanel) { + bitmap = "tools/gui/images/iconList.png"; + bitmapMode = "Centered"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "1 1"; + extent = "15 15"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser.toggleFolderCollapseButton();"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Toggles the display of the folders panel"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl(AssetBrowser_FilterOptionsBtn) { + bitmap = "tools/gui/images/filter.png"; + bitmapMode = "Stretched"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "337 1"; + extent = "15 15"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser.showFilterOptions();"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Filter Options"; hovertime = "1000"; isContainer = "0"; canSave = "1"; @@ -724,8 +699,8 @@ anchorBottom = "0"; anchorLeft = "1"; anchorRight = "1"; - position = "1 40"; - extent = "354 468"; + position = "1 17"; + extent = "354 487"; minExtent = "8 2"; horizSizing = "width"; vertSizing = "height"; @@ -755,7 +730,7 @@ anchorLeft = "1"; anchorRight = "0"; position = "0 0"; - extent = "354 448"; + extent = "354 467"; minExtent = "8 8"; horizSizing = "width"; vertSizing = "height"; @@ -768,6 +743,22 @@ canSave = "1"; canSaveDynamicFields = "0"; + new GuiMouseEventCtrl(AssetListPanelInputs) { + lockMouse = "0"; + position = "1 0"; + extent = "339 467"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "height"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; new GuiStackControl() { stackingType = "Vertical"; horizStacking = "Left to Right"; @@ -778,8 +769,8 @@ dynamicPos = "0"; changeChildSizeToFit = "1"; changeChildPosition = "0"; - position = "1 1"; - extent = "352 254"; + position = "2 1"; + extent = "339 124"; minExtent = "16 16"; horizSizing = "width"; vertSizing = "bottom"; @@ -792,25 +783,10 @@ canSave = "1"; canSaveDynamicFields = "0"; - new GuiControl() { - position = "0 0"; - extent = "352 4"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "ToolsGuiDefaultProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; new GuiDynamicCtrlArrayControl() { colCount = "3"; colSize = "100"; - rowCount = "2"; + rowCount = "1"; rowSize = "124"; rowSpacing = "2"; colSpacing = "2"; @@ -819,8 +795,8 @@ fillRowFirst = "1"; dynamicSize = "1"; padding = "0 0 0 0"; - position = "3 4"; - extent = "352 250"; + position = "3 0"; + extent = "339 124"; minExtent = "8 8"; horizSizing = "width"; vertSizing = "bottom"; @@ -830,7 +806,7 @@ tooltipProfile = "GuiToolTipProfile"; hovertime = "1000"; isContainer = "1"; - internalName = "materialSelection"; + internalName = "assetList"; canSave = "1"; canSaveDynamicFields = "0"; }; @@ -844,7 +820,7 @@ anchorBottom = "0"; anchorLeft = "1"; anchorRight = "0"; - position = "0 448"; + position = "0 467"; extent = "354 20"; minExtent = "8 2"; horizSizing = "width"; @@ -859,13 +835,35 @@ canSave = "1"; canSaveDynamicFields = "0"; }; + new GuiTextCtrl(AssetBrowser_FooterText) { + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "0 470"; + extent = "269 23"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "top"; + profile = "ToolsGuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; }; new GuiButtonCtrl() { text = "Select"; groupNum = "-1"; buttonType = "PushButton"; useMouseEvents = "0"; - position = "242 491"; + position = "301 488"; extent = "53 19"; minExtent = "8 2"; horizSizing = "left"; @@ -882,26 +880,6 @@ canSave = "1"; canSaveDynamicFields = "0"; }; - new GuiButtonCtrl() { - text = "Cancel"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "300 491"; - extent = "52 19"; - minExtent = "8 2"; - horizSizing = "left"; - vertSizing = "top"; - profile = "ToolsGuiButtonProfile"; - visible = "1"; - active = "1"; - command = "AssetBrowser.hideDialog();"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; }; }; }; diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/assetImport.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/assetImport.gui index a6002f35e..a89b344c5 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/guis/assetImport.gui +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/assetImport.gui @@ -224,7 +224,7 @@ canSave = "1"; canSaveDynamicFields = "0"; }; - new GuiScrollCtrl() { + new GuiScrollCtrl(ImportAssetConfigEditorScroll) { willFirstRespond = "1"; hScrollBar = "dynamic"; vScrollBar = "dynamic"; diff --git a/Templates/BaseGame/game/tools/assetBrowser/main.cs b/Templates/BaseGame/game/tools/assetBrowser/main.cs index 9ba71c91b..d35a3d6b6 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/main.cs +++ b/Templates/BaseGame/game/tools/assetBrowser/main.cs @@ -30,6 +30,32 @@ function initializeAssetBrowser() { echo(" % - Initializing Asset Browser"); + $AssetBrowser::importConfigsFile = "tools/assetBrowser/assetImportConfigs.xml"; + $AssetBrowser::currentImportConfig = ""; + + if(!isObject(AssetFilterTypeList)) + { + new ArrayObject(AssetFilterTypeList); + + AssetFilterTypeList.add("Component"); + AssetFilterTypeList.add("Cpp"); + AssetFilterTypeList.add("Cubemap"); + AssetFilterTypeList.add("GameObjects"); + AssetFilterTypeList.add("GUIs"); + AssetFilterTypeList.add("Images"); + AssetFilterTypeList.add("Levels"); + AssetFilterTypeList.add("Materials"); + AssetFilterTypeList.add("Particles"); + AssetFilterTypeList.add("PostFXs"); + AssetFilterTypeList.add("Scripts"); + AssetFilterTypeList.add("Shapes"); + AssetFilterTypeList.add("ShapeAnimations"); + AssetFilterTypeList.add("Sounds"); + AssetFilterTypeList.add("StateMachines"); + AssetFilterTypeList.add("Terrains"); + AssetFilterTypeList.add("TerrainMaterials"); + } + exec("./guis/assetBrowser.gui"); exec("./guis/addModuleWindow.gui"); exec("./guis/gameObjectCreator.gui"); @@ -67,6 +93,7 @@ function initializeAssetBrowser() exec("./scripts/assetTypes/sound.cs"); exec("./scripts/assetTypes/stateMachine.cs"); exec("./scripts/assetTypes/cubemap.cs"); + exec("./scripts/assetTypes/folder.cs"); exec("./scripts/fieldTypes/fieldTypes.cs"); exec("./scripts/fieldTypes/listField.cs"); diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.cs index ebe1e2b44..2de51f4e1 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.cs +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.cs @@ -44,15 +44,28 @@ function AssetBrowser::onWake(%this) if(!isObject(ImportAssetTree)) new GuiTreeViewCtrl(ImportAssetTree); + if(!isObject(AssetBrowser_NavPrevHistoryList)) + { + new ArrayObject(AssetBrowser_NavPrevHistoryList); + } + if(!isObject(AssetBrowser_NavForeHistoryList)) + { + new ArrayObject(AssetBrowser_NavForeHistoryList); + } + %this.importingFilesArray = new ArrayObject(); %this.importAssetUnprocessedListArray = new ArrayObject(); %this.importAssetFinalListArray = new ArrayObject(); %this.isReImportingAsset = false; %this.coreModulesFilter = false; + %this.toolsModulesFilter = false; %this.onlyShowModulesWithAssets = false; %this.treeFilterMode = "list"; + %this.folderPanelState = true; + %this.folderPanelSplit = 0; + %this.templateFilesPath = "tools/assetBrowser/scripts/templateFiles/"; //First, build our our list of active modules @@ -77,6 +90,8 @@ function AssetBrowser::onWake(%this) "You have no modules or content. Do you want to import a module from the template content?", "AssetBrowser.ImportTemplateModules();", "" ); } + + %this.setPreviewSize(EditorSettings.value("Assets/Browser/previewTileSize", "small")); } //Filters @@ -87,18 +102,60 @@ function AssetBrowser::showFilterPopup(%this) function AssetBrowser::viewCoreModulesFilter(%this) { - %this.coreModulesFilter = !%this.coreModulesFilter; + %oldVal = EditorSettings.value("Assets/Browser/showCoreModule", false); + %newVal = !%oldVal; - BrowserVisibilityPopup.checkItem(0,%this.coreModulesFilter); + BrowserVisibilityPopup.checkItem(0,%newVal); + + EditorSettings.setValue("Assets/Browser/showCoreModule", %newVal); + + AssetBrowser.loadFilters(); +} + +function AssetBrowser::viewToolsModulesFilter(%this) +{ + %oldVal = EditorSettings.value("Assets/Browser/showToolsModule", false); + %newVal = !%oldVal; + + BrowserVisibilityPopup.checkItem(1,%newVal); + + EditorSettings.setValue("Assets/Browser/showToolsModule", %newVal); AssetBrowser.loadFilters(); } function AssetBrowser::viewPopulatedModulesFilter(%this) { - %this.onlyShowModulesWithAssets = !%this.onlyShowModulesWithAssets; + %oldVal = EditorSettings.value("Assets/Browser/showOnlyPopulatedModule", false); + %newVal = !%oldVal; - BrowserVisibilityPopup.checkItem(1,%this.onlyShowModulesWithAssets); + BrowserVisibilityPopup.checkItem(2,%newVal); + + EditorSettings.setValue("Assets/Browser/showOnlyPopulatedModule", %newVal); + + AssetBrowser.loadFilters(); +} + +function AssetBrowser::toggleShowingFolders(%this) +{ + %oldVal = EditorSettings.value("Assets/Browser/showFolders", false); + %newVal = !%oldVal; + + BrowserVisibilityPopup.checkItem(4,%newVal); + + EditorSettings.setValue("Assets/Browser/showFolders", %newVal); + + AssetBrowser.loadFilters(); +} + +function AssetBrowser::toggleShowingEmptyFolders(%this) +{ + %oldVal = EditorSettings.value("Assets/Browser/showEmptyFolders", false); + %newVal = !%oldVal; + + BrowserVisibilityPopup.checkItem(5,%newVal); + + EditorSettings.setValue("Assets/Browser/showEmptyFolders", %newVal); AssetBrowser.loadFilters(); } @@ -115,7 +172,12 @@ function AssetBrowser::viewTagsFilter(%this) AssetBrowser.loadFilters(); } -//Drag-Drop functionality +function AssetBrowser::toggleAssetTypeFilter(%assetTypeIdx) +{ + %isChecked = AssetTypeListPopup.isItemChecked(%assetTypeIdx); + AssetTypeListPopup.checkItem(%assetTypeIdx, !%isChecked); +} + function AssetBrowser::selectAsset( %this, %asset ) { if(AssetBrowser.selectCallback !$= "") @@ -189,20 +251,43 @@ function AssetBrowser::buildPreviewArray( %this, %asset, %moduleName ) %this.previewData = new ScriptObject(); } - %assetDesc = AssetDatabase.acquireAsset(%asset); - %assetName = AssetDatabase.getAssetName(%asset); + AssetPreviewArray.empty(); + %previewImage = "core/art/warnmat"; - AssetPreviewArray.empty(); + if(ModuleDatabase.findModule(%moduleName, 1) !$= "") + { + %assetDesc = AssetDatabase.acquireAsset(%asset); + %assetName = AssetDatabase.getAssetName(%asset); + %assetType = AssetDatabase.getAssetType(%asset); + + } + else + { + %fullPath = %moduleName !$= "" ? %moduleName @ "/" @ %asset : %asset; + %fullPath = strreplace(%fullPath, "/", "_"); + + if(isObject(%fullPath)) + %assetDesc = %fullPath; + else + %assetDesc = new ScriptObject(%fullPath); + + %assetDesc.dirPath = %moduleName; + %assetDesc.assetName = %asset; + %assetDesc.description = %moduleName @ "/" @ %asset; + %assetDesc.assetType = "Folder"; + + %assetName = %asset; + %assetType = "Folder"; + } // it may seem goofy why the checkbox can't be instanciated inside the container // reason being its because we need to store the checkbox ctrl in order to make changes // on it later in the function. - - %previewSize = "80 80"; - %previewBounds = 20; - %assetType = AssetDatabase.getAssetType(%asset); + + %previewSize = %this.previewSize SPC %this.previewSize; + %previewBounds = 20; %container = new GuiControl(){ profile = "ToolsGuiDefaultProfile"; @@ -310,6 +395,12 @@ function AssetBrowser::buildPreviewArray( %this, %asset, %moduleName ) %buildCommand = %this @ ".build" @ %assetType @ "Preview(" @ %assetDesc @ "," @ %this.previewData @ ");"; eval(%buildCommand); + //debug dump + %tooltip = %this.previewData.tooltip; + %assetName = %this.previewData.assetName; + %previewImage = %this.previewData.previewImage; + %doubleClickCommand = %this.previewData.doubleClickCommand; + %previewButton = new GuiBitmapButtonCtrl() { className = "AssetPreviewControl"; @@ -376,23 +467,198 @@ function AssetBrowser::buildPreviewArray( %this, %asset, %moduleName ) %container.add(%previewNameCtrl); // add to the gui control array - AssetBrowser-->materialSelection.add(%container); + AssetBrowser-->assetList.add(%container); // add to the array object for reference later AssetPreviewArray.add( %previewButton, %this.previewData.previewImage ); } +// +// +function AssetPreviewButton::onClick(%this) +{ + echo("CLICKED AN ASSET PREVIEW BUTTON"); +} + +function AssetPreviewButton::onDoubleClick(%this) +{ + echo("DOUBLE CLICKED AN ASSET PREVIEW BUTTON"); +} +// +// + +function AssetBrowser::loadFolders(%this, %path, %parentId) +{ + //utilize home dir project setting here + %paths = getDirectoryList(%path); + for(%i=0; %i < getFieldCount(%paths); %i++) + { + %childPath = getField(%paths, %i); + + %folderCount = getTokenCount(%childPath, "/"); + + for(%f=0; %f < %folderCount; %f++) + { + %folderName = getToken(%childPath, "/", %f); + + //we don't need to display the shadercache folder + if(%parentId == 1 && %folderName $= "shaderCache") + continue; + + %iconIdx = 1; + + if(ModuleDatabase.findModule(%folderName) !$= "") + %iconIdx = 0; + + %searchFoldersText = AssetBrowserFolderSearchFilter.getText(); + if(%searchFoldersText !$= "Search Folders...") + { + if(strstr(strlwr(%folderName), strlwr(%searchFoldersText)) != -1) + { + %folderID = AssetBrowser-->filterTree.insertItem(%parentId, %folderName, %path, "", %iconIdx, %iconIdx); + + %this.loadFolders(%path @ "/" @ %folderName, %folderID); + } + } + else + { + %folderID = AssetBrowser-->filterTree.insertItem(%parentId, %folderName, %path, "", %iconIdx, %iconIdx); + + %this.loadFolders(%path @ "/" @ %folderName, %folderID); + } + } + } +} + function AssetBrowser::loadFilters( %this ) { AssetBrowser-->filterTree.clear(); - AssetBrowser-->filterTree.buildIconTable(":tools/classIcons/prefab"); + AssetBrowser-->filterTree.buildIconTable( "tools/classIcons/Prefab" @ + ":tools/classIcons/SimSet"); + + %dataItem = AssetBrowser-->filterTree.insertItem(0, "Data"); + %this.loadFolders("Data", %dataItem); + + //If set to, show core + if(%this.coreModulesFilter) + { + %coreItem = AssetBrowser-->filterTree.insertItem(0, "Core"); + %this.loadFolders("Core", %coreItem); + } + + //If set to, show tools + if(%this.toolsModulesFilter) + { + %toolsItem = AssetBrowser-->filterTree.insertItem(0, "Tools"); + %this.loadFolders("Tools", %toolsItem); + } - AssetBrowser-->filterTree.insertItem(0, "Assets"); + //AssetBrowser-->filterTree.insertItem(0, "Data"); + + //get it alllll + /*%directoryDump = getDirectoryList("data", -1); + + %dirs = getFieldCount(%directoryDump); + + for(%i=0; %i < %dirs; %i++) + { + %folderName = getToken(%assetBasePath, "/", %f); + + %folderID = AssetBrowser-->filterTree.findChildItemByName(%prevFolderID, %folderName); + + if(%folderID == -1 || %folderID == 0) + { + %pathCache = ""; + + for(%c=0; %c < %f; %c++) + { + %pathCache = %c == 0 ? getToken(%assetBasePath, "/", %c) : %pathCache @ "/" @ getToken(%assetBasePath, "/", %c); + } + + %folderID = AssetBrowser-->filterTree.insertItem(%prevFolderID, %folderName, %pathCache, "", 1, 1); + } + }*/ AssetPreviewArray.empty(); - if(%this.treeFilterMode $= "list") + /*%assetQuery = new AssetQuery(); + %numAssetsFound = AssetDatabase.findAllAssets(%assetQuery); + + for( %i=0; %i < %numAssetsFound; %i++) + { + %assetId = %assetQuery.getAsset(%i); + + %assetPath = makeRelativePath(AssetDatabase.getAssetFilePath(%assetId)); + + //clean up the path + %assetPath = strreplace(%assetPath, "\\\\", "\\"); + %assetPath = strreplace(%assetPath, "\\", "\\"); + %assetPath = strreplace(%assetPath, "//", "\\"); + + %assetBasePath = filePath(%assetPath); + + %foldersCount = getTokenCount(%assetBasePath, "/"); + + //Build our directory structure + %prevFolderID = 0; + for(%f=0; %f < %foldersCount; %f++) + { + %folderName = getToken(%assetBasePath, "/", %f); + + %folderID = AssetBrowser-->filterTree.findChildItemByName(%prevFolderID, %folderName); + + if(%folderID == -1 || %folderID == 0) + { + %pathCache = ""; + + for(%c=0; %c < %f; %c++) + { + %pathCache = %c == 0 ? getToken(%assetBasePath, "/", %c) : %pathCache @ "/" @ getToken(%assetBasePath, "/", %c); + } + + %folderID = AssetBrowser-->filterTree.insertItem(%prevFolderID, %folderName, %pathCache, "", 1, 1); + } + + %prevFolderID = %folderID; + } + + //first, get the asset's module, as our major categories + %module = AssetDatabase.getAssetModule(%assetId); + + %moduleName = %module.moduleId; + + %moduleGroup = %module.Group; + if((%moduleGroup $= "Core" || %moduleGroup $= "Tools") && !%this.coreModulesFilter) + continue; + + //first, see if this module Module is listed already + /*%moduleItemId = AssetBrowser-->filterTree.findItemByName(%moduleName); + + //if(%moduleItemId == 0) + // %moduleItemId = AssetBrowser-->filterTree.insertItem(1, %moduleName, "", "", 1, 1); + + %assetType = AssetDatabase.getAssetCategory(%assetId); + + if(%assetType $= "") + { + %assetType = AssetDatabase.getAssetType(%assetId); + if(%assetType $= "") + %assetType = "Misc"; + } + + if(AssetBrowser.assetTypeFilter !$= "" && AssetBrowser.assetTypeFilter !$= %assetType) + continue; + + %assetTypeId = AssetBrowser-->filterTree.findChildItemByName(%moduleItemId, %assetType); + + if(%assetTypeId == 0) + %assetTypeId = AssetBrowser-->filterTree.insertItem(%moduleItemId, %assetType);*/ + //} + + AssetBrowser-->filterTree.buildVisibleTree(true); + + /*if(%this.treeFilterMode $= "list") { //First, build our our list of active modules %modulesList = ModuleDatabase.findModules(true); @@ -457,9 +723,9 @@ function AssetBrowser::loadFilters( %this ) else if(%this.treeFilterMode $= "tags") { - } + }*/ - %this.collapseTree(); + //%this.collapseTree(); //Remove any modules that have no assets if we have that filter on if(%this.onlyShowModulesWithAssets) @@ -484,7 +750,12 @@ function AssetBrowser::loadFilters( %this ) AssetBrowser.newModuleId = ""; } - %selectedItem = AssetBrowser-->filterTree.getSelectedItem(); + %dataItem = AssetBrowser-->filterTree.findItemByName("Data"); + AssetBrowser-->filterTree.expandItem(%dataItem); + + AssetBrowser.expandTreeToAddress(AssetBrowser.currentAddress); + + %selectedItem = AssetBrowser.getFolderTreeItemFromAddress(AssetBrowser.currentAddress); AssetBrowser-->filterTree.scrollVisibleByObjectId(%selectedItem); AssetBrowser-->filterTree.buildVisibleTree(); @@ -541,9 +812,12 @@ function AssetBrowser::createFilter( %this, %filter ) function AssetBrowser::updateSelection( %this, %asset, %moduleName ) { - // the material selector will visually update per material information - // after we move away from the material. eg: if we remove a field from the material, - // the empty checkbox will still be there until you move fro and to the material again + //If we're navigating a folder, just nav to it and be done + /*if(isDirectory(%moduleName)) + { + AssetBrowser.navigateTo(%moduleName @ "/" @ %asset); + return; + }*/ %isAssetBorder = 0; eval("%isAssetBorder = isObject(AssetBrowser-->"@%asset@"Border);"); @@ -786,11 +1060,14 @@ function AssetBrowser::reImportAsset(%this) } } -//------------------------------------------------------------------------------ +// +// +// RMB context popups function AssetPreviewButton::onRightClick(%this) { AssetBrowser.selectedAssetPreview = %this.getParent(); EditAssetPopup.assetId = %this.getParent().moduleName @ ":" @ %this.getParent().assetName; + EditAssetPopup.assetType = %this.getParent().assetType; %assetType = %this.getParent().assetType; //Do some enabling/disabling of options depending on asset type @@ -813,123 +1090,23 @@ function AssetPreviewButton::onRightClick(%this) if(%assetType $= "LevelAsset") EditLevelAssetPopup.showPopup(Canvas); + else if(%assetType $= "Folder") + EditFolderPopup.showPopup(Canvas); else EditAssetPopup.showPopup(Canvas); + + if(%assetType $= "Folder") + { + EditAssetPopup.assetId = %this.getParent().moduleName @ "/" @ %this.getParent().assetName; + } } -function AssetListPanel::onRightMouseDown(%this) +//function AssetListPanel::onRightMouseDown(%this) +function AssetListPanelInputs::onRightMouseDown(%this) { AddNewAssetPopup.showPopup(Canvas); } -//------------------------------------------------------------------------------ -function AssetBrowser::refreshPreviews(%this) -{ - AssetBrowserFilterTree.onSelect(AssetBrowser.selectedItem); -} - -function AssetBrowserFilterTree::onSelect(%this, %itemId) -{ - if(%itemId == 1) - //can't select root - return; - - //Make sure we have an actual module selected! - %parentId = %this.getParentItem(%itemId); - - if(%parentId != 1) - AssetBrowser.selectedModule = %this.getItemText(%parentId);//looks like we have one of the categories selected, not the module. Nab the parent so we have the correct thing! - else - AssetBrowser.selectedModule = %this.getItemText(%itemId); - - AssetBrowser.selectedItem = %itemId; - - //alright, we have a module or sub-filter selected, so now build our asset list based on that filter! - echo("Asset Browser Filter Tree selected filter #:" @ %itemId); - - // manage schedule array properly - if(!isObject(MatEdScheduleArray)) - new ArrayObject(MatEdScheduleArray); - - // if we select another list... delete all schedules that were created by - // previous load - for( %i = 0; %i < MatEdScheduleArray.count(); %i++ ) - cancel(MatEdScheduleArray.getKey(%i)); - - // we have to empty out the list; so when we create new schedules, these dont linger - MatEdScheduleArray.empty(); - - // we have to empty out the list; so when we create new guicontrols, these dont linger - AssetPreviewArray.empty(); - AssetBrowser-->materialSelection.deleteAllObjects(); - //AssetBrowser-->materialPreviewPagesStack.deleteAllObjects(); - - %assetArray = new ArrayObject(); - - //First, Query for our assets - %assetQuery = new AssetQuery(); - %numAssetsFound = AssetDatabase.findAllAssets(%assetQuery); - - //module name per our selected filter: - %moduleItemId = %this.getParentItem(%itemId); - - //check if we've selected a Module - if(%moduleItemId == 1) - { - %FilterModuleName = %this.getItemText(%itemId); - } - else - { - %FilterModuleName = %this.getItemText(%moduleItemId); - } - - //now, we'll iterate through, and find the assets that are in this module, and this category - for( %i=0; %i < %numAssetsFound; %i++) - { - %assetId = %assetQuery.getAsset(%i); - - //first, get the asset's module, as our major categories - %module = AssetDatabase.getAssetModule(%assetId); - - %moduleName = %module.moduleId; - - if(%FilterModuleName $= %moduleName) - { - //it's good, so test that the category is right! - %assetType = AssetDatabase.getAssetCategory(%assetId); - if(%assetType $= "") - { - %assetType = AssetDatabase.getAssetType(%assetId); - } - - if(%this.getItemText(%itemId) $= %assetType || (%assetType $= "" && %this.getItemText(%itemId) $= "Misc") - || %moduleItemId == 1) - { - //stop adding after previewsPerPage is hit - %assetName = AssetDatabase.getAssetName(%assetId); - - %searchText = AssetBrowserSearchFilter.getText(); - if(%searchText !$= "\c2Filter...") - { - if(strstr(strlwr(%assetName), strlwr(%searchText)) != -1) - %assetArray.add( %moduleName, %assetId); - } - else - { - //got it. - %assetArray.add( %moduleName, %assetId ); - } - } - } - } - - AssetBrowser.currentPreviewPage = 0; - AssetBrowser.totalPages = 1; - - for(%i=0; %i < %assetArray.count(); %i++) - AssetBrowser.buildPreviewArray( %assetArray.getValue(%i), %assetArray.getKey(%i) ); -} - function AssetBrowserFilterTree::onRightMouseDown(%this, %itemId) { if( %this.getSelectedItemsCount() > 0 && %itemId != 1) @@ -973,7 +1150,166 @@ function AssetBrowserFilterTree::onRightMouseDown(%this, %itemId) // // -function AssetBrowserSearchFilterText::onWake( %this ) +// +function AssetBrowser::showVisibiltyOptions(%this) +{ + BrowserVisibilityPopup.showPopup(Canvas); +} + +function AssetBrowser::showFilterOptions(%this) +{ + +} + +// +// +// Preview tile handling +function AssetBrowser::setPreviewSize(%this, %size) +{ + AssetPreviewSizePopup.checkItem(0, false); + AssetPreviewSizePopup.checkItem(1, false); + AssetPreviewSizePopup.checkItem(2, false); + + %this.previewSize = 80; //default to small + + if(%size $= "Small") + { + %this.previewSize = 80; + AssetPreviewSizePopup.checkItem(0, true); + } + else if(%size $= "Medium") + { + %this.previewSize = 120; + AssetPreviewSizePopup.checkItem(1, true); + } + else if(%size $= "Large") + { + %this.previewSize = 160; + AssetPreviewSizePopup.checkItem(2, false); + } + + EditorSettings.setValue("Assets/Browser/previewTileSize", %size); + + %this.refreshPreviews(); +} + +function AssetBrowser::refreshPreviews(%this) +{ + AssetBrowserFilterTree.onSelect(AssetBrowser.selectedItem); +} + +function AssetBrowserFilterTree::onSelect(%this, %itemId) +{ + if(%itemId == 1) + //can't select root + return; + + //Make sure we have an actual module selected! + %parentId = %this.getParentItem(%itemId); + + %breadcrumbPath = %this.getItemValue(%itemId); + if(%breadcrumbPath !$= "") + %breadcrumbPath = %breadcrumbPath @ "/" @ %this.getItemText(%itemId); + else + %breadcrumbPath = %this.getItemText(%itemId); + + AssetBrowser.navigateTo(%breadcrumbPath); +} + +function AssetBrowser::rebuildAssetArray(%this) +{ + %breadcrumbPath = AssetBrowser.currentAddress; + + // we have to empty out the list; so when we create new guicontrols, these dont linger + AssetBrowser-->assetList.deleteAllObjects(); + AssetPreviewArray.empty(); + + %assetArray = new ArrayObject(); + + //First, Query for our assets + %assetQuery = new AssetQuery(); + %numAssetsFound = AssetDatabase.findAllAssets(%assetQuery); + + //now, we'll iterate through, and find the assets that are in this module, and this category + for( %i=0; %i < %numAssetsFound; %i++) + { + %assetId = %assetQuery.getAsset(%i); + + %assetPath = makeRelativePath(AssetDatabase.getAssetFilePath(%assetId)); + %assetBasePath = filePath(%assetPath); + + //clean up the path + %assetBasePath = strreplace(%assetBasePath, "//", "/"); + + if(%assetBasePath $= %breadcrumbPath) + { + //first, get the asset's module, as our major categories + %module = AssetDatabase.getAssetModule(%assetId); + %moduleName = %module.moduleId; + + //it's good, so test that the category is right! + %assetType = AssetDatabase.getAssetCategory(%assetId); + if(%assetType $= "") + { + %assetType = AssetDatabase.getAssetType(%assetId); + } + + /*if(%this.getItemText(%itemId) $= %assetType || (%assetType $= "" && %this.getItemText(%itemId) $= "Misc") + || %moduleItemId == 1) + {*/ + //stop adding after previewsPerPage is hit + %assetName = AssetDatabase.getAssetName(%assetId); + + %searchText = AssetBrowserSearchFilter.getText(); + if(%searchText !$= "Search Assets...") + { + if(strstr(strlwr(%assetName), strlwr(%searchText)) != -1) + %assetArray.add( %moduleName, %assetId); + } + else + { + //got it. + %assetArray.add( %moduleName, %assetId ); + } + //} + } + } + + //Add folders + if(EditorSettings.value("Assets/Browser/showFolders", true) == true) + { + %folders = getDirectoryList(%breadcrumbPath); + for(%f=0; %f < getFieldCount(%folders); %f++) + { + %folderName = getField(%folders, %f); + + %searchText = AssetBrowserSearchFilter.getText(); + if(%searchText !$= "Search Assets...") + { + if(strstr(strlwr(%folderName), strlwr(%searchText)) != -1) + %assetArray.add( %breadcrumbPath, %folderName ); + } + else + { + //got it. + %assetArray.add( %breadcrumbPath, %folderName ); + } + } + } + + AssetBrowser.currentPreviewPage = 0; + AssetBrowser.totalPages = 1; + + for(%i=0; %i < %assetArray.count(); %i++) + AssetBrowser.buildPreviewArray( %assetArray.getValue(%i), %assetArray.getKey(%i) ); + + AssetBrowser_FooterText.text = %assetArray.count() @ " Assets"; +} + +// +// +// Search Filters +function AssetBrowserSearchFilterTxt::onWake( %this ) { /*%filter = %this.treeView.getFilterText(); if( %filter $= "" ) @@ -982,45 +1318,175 @@ function AssetBrowserSearchFilterText::onWake( %this ) %this.setText( %filter );*/ } -//------------------------------------------------------------------------------ - -function AssetBrowserSearchFilterText::onGainFirstResponder( %this ) +function AssetBrowserSearchFilterTxt::onGainFirstResponder( %this ) { %this.selectAllText(); } -//--------------------------------------------------------------------------------------------- - // When Enter is pressed in the filter text control, pass along the text of the control // as the treeview's filter. -function AssetBrowserSearchFilterText::onReturn( %this ) +function AssetBrowserFolderSearchFilter::onReturn( %this ) { %text = %this.getText(); if( %text $= "" ) %this.reset(); - else + + AssetBrowser.loadFilters(); +} + +function AssetBrowserSearchFilter::onReturn( %this ) +{ + %text = %this.getText(); + if( %text $= "" ) + %this.reset(); + + AssetBrowser.rebuildAssetArray(); +} + +function AssetBrowserFolderSearchFilter::reset( %this ) +{ + %this.setText( "Search Folders..." ); + + AssetBrowser.loadFilters(); +} + +function AssetBrowserSearchFilter::reset( %this ) +{ + %this.setText( "Search Assets..." ); + + AssetBrowser.rebuildAssetArray(); +} + +function AssetBrowser_ClearFolderFilterBtn::onClick( %this ) +{ + AssetBrowserFolderSearchFilter.reset(); +} + +function AssetBrowser_ClearAssetFilterBtn::onClick( %this ) +{ + AssetBrowserSearchFilter.reset(); +} +// +// +// Navigation +function AssetBrowser::navigateTo(%this, %address, %historyNav) +{ + //Don't bother navigating if it's to the place we already are + if(AssetBrowser.currentAddress $= %address) + return; + + //clear the breadcrumb bar + AssetBrowser_BreadcrumbBar.clear(); + + //break down the address + %folderCount = getTokenCount(%address, "/"); + + %rebuiltPath = ""; + for(%f=0; %f < %folderCount; %f++) { - //%this.treeView.setFilterText( %text ); - %curItem = AssetBrowserFilterTree.getSelectedItem(); - AssetBrowserFilterTree.onSelect(%curItem); + %folderName = getToken(%address, "/", %f); + + %rebuiltPath = %f == 0 ? %folderName : %rebuiltPath @ "/" @ %folderName; + + %folderNavButton = new GuiButtonCtrl() + { + profile = ToolsGuiButtonProfile; + text = %folderName; + command = "AssetBrowser.navigateTo(\"" @ %rebuiltPath @ "\");"; + extent = "100" SPC AssetBrowser_BreadcrumbBar.extent.y; + }; + + AssetBrowser_BreadcrumbBar.add(%folderNavButton); + + if(%f != %folderCount-1) + { + %folderSpacerButton = new GuiBitmapButtonCtrl() + { + profile = ToolsGuiButtonProfile; + bitmap = "tools/gui/images/rightArrowWhite"; + bitmapMode = "Centered"; + extent = "25" SPC AssetBrowser_BreadcrumbBar.extent.y; + //command = "AssetBrowser.navigateTo(\"" @ %rebuiltPath @ "\");"; + }; + + AssetBrowser_BreadcrumbBar.add(%folderSpacerButton); + } } + + //find our folder tree and action on it tree + %folderId = AssetBrowser.getFolderTreeItemFromAddress(%address); + + %oldAddress = AssetBrowser.currentAddress; + AssetBrowser.currentAddress = %address; + AssetBrowser.selectedItem = %folderId; + + AssetBrowser-->filterTree.clearSelection(); + AssetBrowser-->filterTree.selectItem(%folderId); + + //remove any history records that are 'newer' than this one + if(%historyNav $= "") + { + AssetBrowser_NavForeHistoryList.empty(); + + if(%oldAddress !$= "") + AssetBrowser_NavPrevHistoryList.push_front(%oldAddress); + } + + //refresh the nav buttons to display the history + %backButtonHistory = ""; + for(%i=0; %i < AssetBrowser_NavPrevHistoryList.Count(); %i++) + { + %prevAddress = AssetBrowser_NavPrevHistoryList.getKey(%i); + %backButtonHistory = %i==0 ? %prevAddress @ "\n" : %backButtonHistory @ %prevAddress @ "\n"; + } + + AssetBrowser_NavigateBackBtn.tooltip = %backButtonHistory; + + %foreButtonHistory = ""; + for(%i=0; %i < AssetBrowser_NavForeHistoryList.Count(); %i++) + { + %prevAddress = AssetBrowser_NavForeHistoryList.getKey(%i); + %foreButtonHistory = %i==0 ? %prevAddress @ "\n" : %foreButtonHistory @ %prevAddress @ "\n"; + } + + AssetBrowser_NavigateForwardBtn.tooltip = %foreButtonHistory; + + %module = AssetBrowser.getModuleFromAddress(%address); + if(%module !$= "") + { + //legit module, so set it as current target + AssetBrowser.SelectedModule = %module.moduleId; + } + + %this.rebuildAssetArray(); } -//--------------------------------------------------------------------------------------------- - -function AssetBrowserSearchFilterText::reset( %this ) +function AssetBrowser::navigateHistoryForward(%this) { - %this.setText( "\c2Filter..." ); - //%this.treeView.clearFilterText(); - %curItem = AssetBrowserFilterTree.getSelectedItem(); - AssetBrowserFilterTree.onSelect(%curItem); + if(AssetBrowser_NavForeHistoryList.count() == 0) + return; + + %newAddress = AssetBrowser_NavForeHistoryList.getKey(0); + %prevHistory = AssetBrowser.currentAddress; + + AssetBrowser_NavPrevHistoryList.push_front(%prevHistory); + AssetBrowser_NavForeHistoryList.pop_front(); + + %this.navigateTo(%newAddress, true); } -//--------------------------------------------------------------------------------------------- - -function AssetBrowserSearchFilterText::onClick( %this ) +function AssetBrowser::navigateHistoryBack(%this) { - %this.textCtrl.reset(); + if(AssetBrowser_NavPrevHistoryList.count() == 0) + return; + + %newAddress = AssetBrowser_NavPrevHistoryList.getKey(0); + %foreHistory = AssetBrowser.currentAddress; + + AssetBrowser_NavForeHistoryList.push_front(%foreHistory); + AssetBrowser_NavPrevHistoryList.pop_front(); + + %this.navigateTo(%newAddress, true); } // @@ -1054,8 +1520,114 @@ function AssetBrowser::reloadModules(%this) //ModuleDatabase.loadGroup("Game"); } -// +function AssetBrowser::getModuleFromAddress(%this, %address) +{ + //break down the address + %folderCount = getTokenCount(%address, "/"); + + for(%f=0; %f < %folderCount; %f++) + { + %folderName = getToken(%address, "/", %f); + + %module = ModuleDatabase.findModule(%folderName); + if(%module !$= "") + return %module; + } + + return ""; +} + +//AssetBrowser.getFolderTreeItemFromAddress(AssetBrowser.currentAddress); +function AssetBrowser::getFolderTreeItemFromAddress(%this, %address) +{ + //break down the address + %folderCount = getTokenCount(%address, "/"); + + %curItem = 0; + %rebuiltPath = ""; + for(%f=0; %f < %folderCount; %f++) + { + %folderName = getToken(%address, "/", %f); + %curItem = AssetBrowser-->filterTree.findChildItemByName(%curItem, %folderName); + } + + return %curItem; +} + +function AssetBrowser::expandTreeToAddress(%this, %address) +{ + //break down the address + %folderCount = getTokenCount(%address, "/"); + AssetBrowser-->filterTree.expandItem(0); + + %curItem = 0; + %rebuiltPath = ""; + for(%f=0; %f < %folderCount; %f++) + { + %folderName = getToken(%address, "/", %f); + %curItem = AssetBrowser-->filterTree.findChildItemByName(%curItem, %folderName); + AssetBrowser-->filterTree.expandItem(%curItem); + } +} +// +// +// +function AssetBrowser::createNewFolder(%this) +{ + %newFolderIdx = ""; + %matched = true; + %newFolderPath = ""; + while(%matched == true) + { + %newFolderPath = AssetBrowser.currentAddress @ "/NewFolder" @ %newFolderIdx; + if(!isDirectory(%newFolderPath)) + { + %matched = false; + } + else + { + %newFolderIdx++; + } + } + + //make a dummy file + %file = new FileObject(); + %file.openForWrite(%newFolderPath @ "/test"); + %file.close(); + + fileDelete(%newFolderPath @ "/test"); + + //refresh the directory + %this.loadFilters(); + %this.rebuildAssetArray(); +} + +// +// +// +function AssetBrowser::toggleFolderCollapseButton(%this) +{ + %this.folderPanelState = !%this.folderPanelState; + + //If we're collapsing + if(!%this.folderPanelState) + { + //Store the original + %this.folderPanelSplit = AssetBrowser_MainSplit.splitPoint.x; + + //collapse it + AssetBrowser_MainSplit.setSplitPoint(AssetBrowser_MainSplit.splitterSize SPC AssetBrowser_MainSplit.splitPoint.y); + } + else + { + //restore the original + AssetBrowser_MainSplit.setSplitPoint(%this.folderPanelSplit SPC AssetBrowser_MainSplit.splitPoint.y); + } +} +// +// +// Drag n drop function AssetPreviewButton::onMouseDragged(%this) { %payload = new GuiBitmapButtonCtrl(); diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.cs index 0a66779da..ab5e1832d 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.cs +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.cs @@ -85,6 +85,7 @@ function AssetBrowser::onBeginDropFiles( %this ) //prep the import control Canvas.pushDialog(AssetImportCtrl); AssetImportCtrl.setHidden(true); + ImportAssetTree.clear(); ImportAssetTree.insertItem(0, "Importing Assets"); AssetBrowser.unprocessedAssetsCount = 0; @@ -161,136 +162,39 @@ function AssetBrowser::onDropZipFile(%this, %filePath) } } -function AssetBrowser::onDropImageFile(%this, %filePath) -{ - if(!%this.isVisible()) - return; - - // File Information madness - %fileName = %filePath; - %fileOnlyName = fileName( %fileName ); - %fileBase = validateDatablockName(fileBase( %fileName ) @ "ImageMap"); - - // [neo, 5/17/2007 - #3117] - // Check if the file being dropped is already in data/images or a sub dir by checking if - // the file path up to length of check path is the same as check path. - %defaultPath = EditorSettings.value( "WorldEditor/defaultMaterialsPath" ); - - %checkPath = expandFilename( "^"@%defaultPath ); - %fileOnlyPath = expandFileName( %filePath ); //filePath( expandFileName( %filePath ) ); - %fileBasePath = getSubStr( %fileOnlyPath, 0, strlen( %checkPath ) ); - - if( %checkPath !$= %fileBasePath ) - { - // No match so file is from outside images directory and we need to copy it in - %fileNewLocation = expandFilename("^"@%defaultPath) @ "/" @ fileBase( %fileName ) @ fileExt( %fileName ); - - // Move to final location - if( !pathCopy( %filePath, %fileNewLocation ) ) - return; - } - else - { - // Already in images path somewhere so just link to it - %fileNewLocation = %filePath; - } - - addResPath( filePath( %fileNewLocation ) ); - - %matName = fileBase( %fileName ); - - // Create Material - %imap = new Material(%matName) - { - mapTo = fileBase( %matName ); - diffuseMap[0] = %defaultPath @ "/" @ fileBase( %fileName ) @ fileExt( %fileName ); - }; - //%imap.setName( %fileBase ); - //%imap.imageName = %fileNewLocation; - //%imap.imageMode = "FULL"; - //%imap.filterPad = false; - //%imap.compile(); - - %diffusecheck = %imap.diffuseMap[0]; - - // Bad Creation! - if( !isObject( %imap ) ) - return; - - %this.addDatablock( %fileBase, false ); -} - -function AssetBrowser::onDropSoundFile(%this, %filePath) -{ - if(!%this.isVisible()) - return; - - // File Information madness - %fileName = %filePath; - %fileOnlyName = fileName( %fileName ); - %fileBase = validateDatablockName(fileBase( %fileName ) @ "ImageMap"); - - // [neo, 5/17/2007 - #3117] - // Check if the file being dropped is already in data/images or a sub dir by checking if - // the file path up to length of check path is the same as check path. - %defaultPath = EditorSettings.value( "WorldEditor/defaultMaterialsPath" ); - - %checkPath = expandFilename( "^"@%defaultPath ); - %fileOnlyPath = expandFileName( %filePath ); //filePath( expandFileName( %filePath ) ); - %fileBasePath = getSubStr( %fileOnlyPath, 0, strlen( %checkPath ) ); - - if( %checkPath !$= %fileBasePath ) - { - // No match so file is from outside images directory and we need to copy it in - %fileNewLocation = expandFilename("^"@%defaultPath) @ "/" @ fileBase( %fileName ) @ fileExt( %fileName ); - - // Move to final location - if( !pathCopy( %filePath, %fileNewLocation ) ) - return; - } - else - { - // Already in images path somewhere so just link to it - %fileNewLocation = %filePath; - } - - addResPath( filePath( %fileNewLocation ) ); - - %matName = fileBase( %fileName ); - - // Create Material - %imap = new Material(%matName) - { - mapTo = fileBase( %matName ); - diffuseMap[0] = %defaultPath @ "/" @ fileBase( %fileName ) @ fileExt( %fileName ); - }; - //%imap.setName( %fileBase ); - //%imap.imageName = %fileNewLocation; - //%imap.imageMode = "FULL"; - //%imap.filterPad = false; - //%imap.compile(); - - %diffusecheck = %imap.diffuseMap[0]; - - // Bad Creation! - if( !isObject( %imap ) ) - return; - - %this.addDatablock( %fileBase, false ); -} - function AssetBrowser::onEndDropFiles( %this ) { if(!%this.isVisible()) return; - - //we have assets to import, so go ahead and display the window for that now - AssetImportCtrl.setHidden(false); - ImportAssetWindow.visible = true; - //ImportAssetWindow.validateAssets(); + ImportAssetWindow.refresh(); - ImportAssetWindow.selectWindow(); + %hasIssues = ImportAssetWindow.validateAssets(); + + //If we have a valid config file set and we've set to auto-import, and we have no + //issues for importing, then go ahead and run the import immediately, don't + //bother showing the window. + //If any of these conditions fail, we'll display the import window so it can be handled + //by the user + if(ImportAssetWindow.importConfigsList.count() != 0 && + EditorSettings.value("Assets/AssetImporDefaultConfig") !$= "" && + EditorSettings.value("Assets/AutoImport", false) == true + && %hasIssues == false) + { + AssetImportCtrl.setHidden(true); + ImportAssetWindow.visible = false; + + //Go ahead and check if we have any issues, and if not, run the import! + ImportAssetWindow.ImportAssets(); + } + else + { + //we have assets to import, so go ahead and display the window for that now + AssetImportCtrl.setHidden(false); + ImportAssetWindow.visible = true; + ImportAssetWindow.selectWindow(); + } + // Update object library GuiFormManager::SendContentMessage($LBCreateSiderBar, %this, "refreshAll 1"); @@ -503,9 +407,6 @@ function ImportAssetWindow::onWake(%this) //Lets refresh our list if(!ImportAssetWindow.isVisible()) return; - - $AssetBrowser::importConfigsFile = "tools/assetBrowser/assetImportConfigs.xml"; - $AssetBrowser::currentImportConfig = ""; if(!isObject(AssetImportSettings)) { @@ -526,7 +427,11 @@ function ImportAssetWindow::onWake(%this) function ImportAssetWindow::reloadImportOptionConfigs(%this) { - ImportAssetWindow.importConfigsList = new ArrayObject(); + if(!isObject(ImportAssetWindow.importConfigsList)) + ImportAssetWindow.importConfigsList = new ArrayObject(); + else + ImportAssetWindow.importConfigsList.empty(); + ImportAssetConfigList.clear(); %xmlDoc = new SimXMLDocument(); @@ -1168,10 +1073,12 @@ function ImportAssetWindow::validateAssets(%this) //Clear any status %this.resetAssetsValidationStatus(); + ImportAssetWindow.importIssues = false; + %id = ImportAssetTree.getChild(1); %hasIssues = %this.validateAsset(%id); - if(%hasIssues) + if(ImportAssetWindow.importIssues == false) return false; else return true; @@ -1179,6 +1086,7 @@ function ImportAssetWindow::validateAssets(%this) function ImportAssetWindow::validateAsset(%this, %id) { + %moduleName = ImportAssetModuleList.getText(); while (%id > 0) @@ -1229,21 +1137,17 @@ function ImportAssetWindow::validateAsset(%this, %id) { %foundCollision = true; - %assetItem.status = "Warning"; + %assetItem.status = "error"; %assetItem.statusType = "DuplicateAsset"; %assetItem.statusInfo = "Duplicate asset names found with the target module!\nAsset \"" @ %assetItem.assetName @ "\" of type \"" @ %assetItem.assetType @ "\" has a matching name.\nPlease rename it and try again!"; - //Clean up our queries - %assetQuery.delete(); break; } } if(%foundCollision == true) { - %hasIssues = true; - //yup, a collision, prompt for the change and bail out /*MessageBoxOK( "Error!", "Duplicate asset names found with the target module!\nAsset \"" @ %assetItemA.assetName @ "\" of type \"" @ %assetItemA.assetType @ "\" has a matching name.\nPlease rename it and try again!");*/ @@ -1259,7 +1163,6 @@ function ImportAssetWindow::validateAsset(%this, %id) //Check if we were given a file path(so not generated) but somehow isn't a valid file if(%assetItem.filePath !$= "" && !%assetItem.generatedAsset && !isFile(%assetItem.filePath)) { - %hasIssues = true; %assetItem.status = "error"; %assetItem.statusType = "MissingFile"; %assetItem.statusInfo = "Unable to find file to be imported. Please select asset file."; @@ -1273,6 +1176,9 @@ function ImportAssetWindow::validateAsset(%this, %id) } } + if(%assetItem.status $= "error") + ImportAssetWindow.importIssues = true; + if(ImportAssetTree.isParentItem(%id)) { %childItem = ImportAssetTree.getChild(%id); diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImportConfig.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImportConfig.cs index f81ef5e04..842f442f9 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImportConfig.cs +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImportConfig.cs @@ -9,7 +9,9 @@ function ImportAssetConfigList::onSelect( %this, %id, %text ) ImportAssetWindow.activeImportConfigIndex = %id; ImportAssetWindow.activeImportConfig = ImportAssetWindow.importConfigsList.getKey(%id); - AssetBrowser.reloadImportingFiles(); + //If we were trying to import anything, refresh it with the new config + if( AssetBrowser.importingFilesArray.count() != 0) + AssetBrowser.reloadImportingFiles(); } function setupImportConfigSettingsList() @@ -428,8 +430,9 @@ function ImportOptionsConfigList::changeEditorSetting(%this, %varName, %value) if(%oldValue !$= %value) { - %id = %this.getSelectedRow(); - %this.setSelectedRow(%id); + %scollPos = ImportAssetConfigEditorScroll.getScrollPosition(); + ImportAssetConfigEditorWindow.populateConfigList(ImportAssetWindow.activeImportConfig); + ImportAssetConfigEditorScroll.setScrollPosition(%scollPos.x, %scollPos.y); } } diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/component.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/component.cs index f0ba4d228..8c6ea6809 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/component.cs +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/component.cs @@ -76,7 +76,7 @@ function AssetBrowser::duplicateComponentAsset(%this, %assetId) } -function AssetBrowser::renameGameObjectAsset(%this, %assetDef, %newAssetId, %originalName, %newName) +function AssetBrowser::renameComponentAsset(%this, %assetDef, %newAssetId, %originalName, %newName) { %assetPath = AssetDatabase.getAssetFilePath(%newAssetId); diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/gui.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/gui.cs index 1a5075afb..d6c7dbdc6 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/gui.cs +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/gui.cs @@ -5,9 +5,11 @@ function AssetBrowser::createGUIAsset(%this) %assetName = AssetBrowser.newAssetSettings.assetName; - %tamlpath = %modulePath @ "/GUIs/" @ %assetName @ ".asset.taml"; - %guipath = %modulePath @ "/GUIs/" @ %assetName @ ".gui"; - %scriptPath = %modulePath @ "/GUIs/" @ %assetName @ ".cs"; + %assetPath = AssetBrowser.currentAddress @ "/"; + + %tamlpath = %assetPath @ %assetName @ ".asset.taml"; + %guipath = %assetPath @ %assetName @ ".gui"; + %scriptPath = %assetPath @ %assetName @ ".cs"; %asset = new GUIAsset() { diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/image.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/image.cs index f5dbd9f76..7b65619cf 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/image.cs +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/image.cs @@ -117,7 +117,7 @@ function AssetBrowser::importImageAsset(%this, %assetItem) %assetImportSuccessful = false; %assetId = %moduleName@":"@%assetName; - %assetPath = "data/" @ %moduleName @ "/Images"; + %assetPath = AssetBrowser.currentAddress @ "/"; %assetFullPath = %assetPath @ "/" @ fileName(%filePath); %newAsset = new ImageAsset() diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/level.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/level.cs index ba8b92b5a..4ea263cf6 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/level.cs +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/level.cs @@ -5,14 +5,20 @@ function AssetBrowser::createLevelAsset(%this) %assetName = AssetBrowser.newAssetSettings.assetName; - %tamlpath = %modulePath @ "/levels/" @ %assetName @ ".asset.taml"; - %levelPath = %modulePath @ "/levels/" @ %assetName @ ".mis"; + %assetPath = AssetBrowser.currentAddress @ "/"; + + %tamlpath = %assetPath @ %assetName @ ".asset.taml"; + %levelPath = %assetPath @ %assetName @ ".mis"; %asset = new LevelAsset() { AssetName = %assetName; versionId = 1; LevelFile = %assetName @ ".mis"; + DecalsFile = %assetName @ ".mis.decals"; + PostFXPresetFile = %assetName @ ".postfxpreset.cs"; + ForestFile = %assetName @ ".forest"; + NavmeshFile = %assetName @ ".nav"; LevelName = AssetBrowser.newAssetSettings.levelName; AssetDescription = AssetBrowser.newAssetSettings.description; PreviewImage = AssetBrowser.newAssetSettings.levelPreviewImage; @@ -24,6 +30,10 @@ function AssetBrowser::createLevelAsset(%this) { echo("Unable to copy template level file!"); } + + //Generate the associated files + DecalManagerSave( %assetPath @ %asset.DecalsFile ); + PostFXManager::savePresetHandler( %assetPath @ %asset.PostFXPresetFile ); %moduleDef = ModuleDatabase.findModule(%moduleName, 1); AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath); diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/material.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/material.cs index b5a95865a..6463da6e4 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/material.cs +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/material.cs @@ -278,10 +278,10 @@ function AssetBrowser::importMaterialAsset(%this, %assetItem) %assetImportSuccessful = false; %assetId = %moduleName@":"@%assetName; - %assetPath = "data/" @ %moduleName @ "/materials"; - %tamlpath = %assetPath @ "/" @ %assetName @ ".asset.taml"; - %sgfPath = %assetPath @ "/" @ %assetName @ ".sgf"; - %scriptPath = %assetPath @ "/" @ %assetName @ ".cs"; + %assetPath = AssetBrowser.currentAddress @ "/"; + %tamlpath = %assetPath @ %assetName @ ".asset.taml"; + %sgfPath = %assetPath @ %assetName @ ".sgf"; + %scriptPath = %assetPath @ %assetName @ ".cs"; %newAsset = new MaterialAsset() { diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/script.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/script.cs index a11373a20..c6cf48e09 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/script.cs +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/script.cs @@ -3,10 +3,12 @@ function AssetBrowser::createScriptAsset(%this) %moduleName = AssetBrowser.newAssetSettings.moduleName; %modulePath = "data/" @ %moduleName; - %assetName = AssetBrowser.newAssetSettings.assetName; + %assetName = AssetBrowser.newAssetSettings.assetName; - %tamlpath = %modulePath @ "/scripts/" @ %assetName @ ".asset.taml"; - %scriptPath = %modulePath @ "/scripts/" @ %assetName @ ".cs"; + %assetPath = AssetBrowser.currentAddress @ "/"; + + %tamlpath = %assetPath @ %assetName @ ".asset.taml"; + %scriptPath = %assetPath @ %assetName @ ".cs"; %asset = new ScriptAsset() { diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shape.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shape.cs index 90f3bc4cb..35a2f4343 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shape.cs +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shape.cs @@ -5,8 +5,10 @@ function AssetBrowser::createShapeAsset(%this) %assetName = AssetBrowser.newAssetSettings.assetName; - %tamlpath = %modulePath @ "/shapes/" @ %assetName @ ".asset.taml"; - %shapeFilePath = %modulePath @ "/shapes/" @ %assetName @ ".dae"; + %assetPath = AssetBrowser.currentAddress @ "/"; + + %tamlpath = %assetPath @ %assetName @ ".asset.taml"; + %shapeFilePath = %assetPath @ %assetName @ ".dae"; %asset = new ShapeAsset() { diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/editAsset.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/editAsset.cs index b207f0c7a..a8cfb9701 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/editAsset.cs +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/editAsset.cs @@ -76,7 +76,7 @@ function AssetBrowser::refreshAsset(%this, %assetId) function AssetBrowser::renameAsset(%this) { //Find out what type it is - %assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId); + //%assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId); %curFirstResponder = AssetBrowser.getFirstResponder(); @@ -92,36 +92,56 @@ function AssetBrowser::performRenameAsset(%this, %originalAssetName, %newName) //if the name is different to the asset's original name, rename it! if(%originalAssetName !$= %newName) { - %moduleName = AssetBrowser.selectedModule; - - //do a rename! - %success = AssetDatabase.renameDeclaredAsset(%moduleName @ ":" @ %originalAssetName, %moduleName @ ":" @ %newName); - - if(%success) - echo("AssetBrowser - renaming of asset " @ %moduleName @ ":" @ %originalAssetName @ " to " @ %moduleName @ ":" @ %newName @ " was a success."); - else - echo("AssetBrowser - renaming of asset " @ %moduleName @ ":" @ %originalAssetName @ " to " @ %moduleName @ ":" @ %newName @ " was a failure."); - - if(%success) + if(EditAssetPopup.assetType !$= "Folder") { - %newAssetId = %moduleName @ ":" @ %newName; - %assetPath = AssetDatabase.getAssetFilePath(%newAssetId); + %moduleName = AssetBrowser.selectedModule; - //Rename any associated files as well - %assetDef = AssetDatabase.acquireAsset(%newAssetId); - %assetType = %assetDef.getClassName(); + //do a rename! + %success = AssetDatabase.renameDeclaredAsset(%moduleName @ ":" @ %originalAssetName, %moduleName @ ":" @ %newName); - //rename the file to match - %path = filePath(%assetPath); + if(%success) + echo("AssetBrowser - renaming of asset " @ %moduleName @ ":" @ %originalAssetName @ " to " @ %moduleName @ ":" @ %newName @ " was a success."); + else + echo("AssetBrowser - renaming of asset " @ %moduleName @ ":" @ %originalAssetName @ " to " @ %moduleName @ ":" @ %newName @ " was a failure."); - //Do the rename command - %buildCommand = %this @ ".rename" @ %assetType @ "(" @ %assetDef @ "," @ %newAssetId @ ");"; - eval(%buildCommand); + if(%success) + { + %newAssetId = %moduleName @ ":" @ %newName; + %assetPath = AssetDatabase.getAssetFilePath(%newAssetId); + + //Rename any associated files as well + %assetDef = AssetDatabase.acquireAsset(%newAssetId); + %assetType = %assetDef.getClassName(); + + //rename the file to match + %path = filePath(%assetPath); + + //Do the rename command + %buildCommand = %this @ ".rename" @ %assetType @ "(" @ %assetDef @ "," @ %newAssetId @ ");"; + eval(%buildCommand); + } + } + else + { + %buildCommand = %this @ ".renameFolder(\"" @ EditAssetPopup.assetId @ "\",\"" @ %newName @ "\");"; + eval(%buildCommand); } } //Make sure everything is refreshed AssetBrowser.loadFilters(); + + //Update the selection to immediately jump to the new asset + AssetBrowser-->filterTree.clearSelection(); + %ModuleItem = AssetBrowser-->filterTree.findItemByName(%moduleName); + %assetTypeId = AssetBrowser-->filterTree.findChildItemByName(%ModuleItem, %assetType); + + AssetBrowser-->filterTree.selectItem(%assetTypeId); + + %selectedItem = AssetBrowser-->filterTree.getSelectedItem(); + AssetBrowser-->filterTree.scrollVisibleByObjectId(%selectedItem); + + AssetBrowser-->filterTree.buildVisibleTree(); } function AssetNameField::onReturn(%this) @@ -132,6 +152,26 @@ function AssetNameField::onReturn(%this) AssetBrowser.performRenameAsset(%this.originalAssetName, %this.getText()); } +//------------------------------------------------------------ +function AssetBrowser::moveAsset(%this, %destination) +{ + if(EditAssetPopup.assetType $= "Folder") + { + //Do any cleanup required given the type + if(%this.isMethod("moveFolder")) + eval(%this @ ".moveFolder("@EditAssetPopup.assetId@",\""@%destination@"\");"); + } + else + { + %assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId); + %assetType = AssetDatabase.getAssetType(EditAssetPopup.assetType); + + //Do any cleanup required given the type + if(%this.isMethod("move"@%assetType)) + eval(%this @ ".move"@%assetType@"("@%assetDef@");"); + } +} + //------------------------------------------------------------ function AssetBrowser::duplicateAsset(%this, %targetModule) @@ -157,10 +197,10 @@ function AssetBrowser::duplicateAsset(%this, %targetModule) function AssetBrowser::deleteAsset(%this) { //Find out what type it is - %assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId); - %assetType = %assetDef.getClassName(); + //%assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId); + //%assetType = %assetDef.getClassName(); - MessageBoxOKCancel("Warning!", "This will delete the selected asset and the files associated to it, do you wish to continue?", + MessageBoxOKCancel("Warning!", "This will delete the selected content and the files associated to it, do you wish to continue?", "AssetBrowser.confirmDeleteAsset();", ""); } @@ -169,14 +209,23 @@ function AssetBrowser::confirmDeleteAsset(%this) %currentSelectedItem = AssetBrowserFilterTree.getSelectedItem(); %currentItemParent = AssetBrowserFilterTree.getParentItem(%currentSelectedItem); - %assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId); - %assetType = AssetDatabase.getAssetType(EditAssetPopup.assetId); - - //Do any cleanup required given the type - if(%this.isMethod("delete"@%assetType)) - eval(%this @ ".delete"@%assetType@"("@%assetDef@");"); - - AssetDatabase.deleteAsset(EditAssetPopup.assetId, false); + if(EditAssetPopup.assetType $= "Folder") + { + //Do any cleanup required given the type + if(%this.isMethod("deleteFolder")) + eval(%this @ ".deleteFolder(\""@EditAssetPopup.assetId@"\");"); + } + else + { + %assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId); + %assetType = AssetDatabase.getAssetType(EditAssetPopup.assetType); + + //Do any cleanup required given the type + if(%this.isMethod("delete"@%assetType)) + eval(%this @ ".delete"@%assetType@"("@%assetDef@");"); + + AssetDatabase.deleteAsset(EditAssetPopup.assetId, false); + } %this.loadFilters(); diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/newAsset.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/newAsset.cs index c12a4020e..602f6ce52 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/newAsset.cs +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/newAsset.cs @@ -191,6 +191,18 @@ function CreateNewAsset() %callbackCommand = "" @ AssetBrowser_newAsset.callbackFunc @ "(\"" @ %moduleName @ ":" @ %assetName @ "\");"; eval(%callbackCommand); } + + //Update the selection to immediately jump to the new asset + AssetBrowser-->filterTree.clearSelection(); + %ModuleItem = AssetBrowser-->filterTree.findItemByName(%moduleName); + %assetTypeId = AssetBrowser-->filterTree.findChildItemByName(%ModuleItem, %assetType); + + AssetBrowser-->filterTree.selectItem(%assetTypeId); + + %selectedItem = AssetBrowser-->filterTree.getSelectedItem(); + AssetBrowser-->filterTree.scrollVisibleByObjectId(%selectedItem); + + AssetBrowser-->filterTree.buildVisibleTree(); } function ParentComponentList::onWake(%this) diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/popupMenus.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/popupMenus.cs index 704c6daa0..31d317d38 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/popupMenus.cs +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/popupMenus.cs @@ -55,15 +55,31 @@ function AssetBrowser::buildPopupMenus(%this) item[ 5 ] = "-"; Item[ 6 ] = "Duplicate Asset" TAB "" TAB "AssetBrowser.duplicateAsset();"; item[ 7 ] = "-"; - item[ 8 ] = "Re-Import Asset" TAB "" TAB "AssetBrowser.reImportAsset();"; - item[ 9 ] = "-"; - item[ 10 ] = "Delete Asset" TAB "" TAB "AssetBrowser.deleteAsset();"; + //item[ 8 ] = "Re-Import Asset" TAB "" TAB "AssetBrowser.reImportAsset();"; + //item[ 9 ] = "-"; + item[ 8 ] = "Delete Asset" TAB "" TAB "AssetBrowser.deleteAsset();"; jumpFileName = ""; jumpLineNumber = ""; }; } + if( !isObject( EditFolderPopup ) ) + { + new PopupMenu( EditFolderPopup ) + { + superClass = "MenuBuilder"; + class = "EditorWorldMenu"; + //isPopup = true; + + item[ 0 ] = "Rename Folder" TAB "" TAB "AssetBrowser.renameAsset();"; + item[ 1 ] = "-"; + Item[ 2 ] = "Duplicate Folder" TAB "" TAB "AssetBrowser.duplicateAsset();"; + item[ 3 ] = "-"; + item[ 4 ] = "Delete Folder" TAB "" TAB "AssetBrowser.deleteAsset();"; + }; + } + if( !isObject( AddNewComponentAssetPopup ) ) { new PopupMenu( AddNewComponentAssetPopup ) @@ -148,15 +164,17 @@ function AssetBrowser::buildPopupMenus(%this) superClass = "MenuBuilder"; class = "EditorWorldMenu"; - item[0] = "Create Code Asset" TAB AddNewScriptAssetPopup; + item[0] = "Create Folder" TAB "" TAB "AssetBrowser.CreateNewFolder();"; item[1] = "-"; - item[2] = "Create Art Asset" TAB AddNewArtAssetPopup; + item[2] = "Create Code Asset" TAB AddNewScriptAssetPopup; item[3] = "-"; - item[4] = "Create Level" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"LevelAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewLevelAsset(\"NewLevel\", AssetBrowser.selectedModule);"; + item[4] = "Create Art Asset" TAB AddNewArtAssetPopup; item[5] = "-"; - item[6] = "Create C++ Asset" TAB AddNewCppAssetPopup; + item[6] = "Create Level" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"LevelAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewLevelAsset(\"NewLevel\", AssetBrowser.selectedModule);"; item[7] = "-"; - item[8] = "Create New Module" TAB "" TAB "AssetBrowser.CreateNewModule();"; + item[8] = "Create C++ Asset" TAB AddNewCppAssetPopup; + item[9] = "-"; + item[10] = "Create New Module" TAB "" TAB "AssetBrowser.CreateNewModule();"; }; } @@ -198,6 +216,38 @@ function AssetBrowser::buildPopupMenus(%this) }; } + //Asset Preview size presets + if( !isObject( AssetPreviewSizePopup ) ) + { + new PopupMenu( AssetPreviewSizePopup ) + { + superClass = "MenuBuilder"; + class = "EditorWorldMenu"; + + item[ 0 ] = "Small" TAB "" TAB "AssetBrowser.setPreviewSize(\"Small\");"; + item[ 1 ] = "Medium" TAB "" TAB "AssetBrowser.setPreviewSize(\"Medium\");"; + Item[ 2 ] = "Large" TAB "" TAB "AssetBrowser.setPreviewSize(\"Large\");"; + }; + + AssetPreviewSizePopup.checkItem(0, true); + } + + if( !isObject( AssetTypeListPopup ) ) + { + new PopupMenu( AssetTypeListPopup ) + { + superClass = "MenuBuilder"; + class = "EditorWorldMenu"; + //isPopup = true; + }; + + /*for(%i=0; %i < AssetFilterTypeList.Count(); %i++) + { + %assetTypeName = AssetFilterTypeList.getKey(%i); + AssetTypeListPopup.insertItem(%i, %assetTypeName, "", "AssetBrowser.toggleAssetTypeFilter(" @ %i @ ");"); + }*/ + } + //Browser visibility menu if( !isObject( BrowserVisibilityPopup ) ) { @@ -208,13 +258,26 @@ function AssetBrowser::buildPopupMenus(%this) //isPopup = true; item[ 0 ] = "Toggle Show Core Modules" TAB "" TAB "AssetBrowser.viewCoreModulesFilter();"; - item[ 1 ] = "Toggle Only Show Modules with Assets" TAB "" TAB "AssetBrowser.viewPopulatedModulesFilter();"; - Item[ 2 ] = "-"; - item[ 3 ] = "Show Assets as list" TAB "" TAB "AssetBrowser.viewListFilter();"; - Item[ 4 ] = "Show Assets with tags" TAB "" TAB "AssetBrowser.viewTagsFilter();"; + item[ 1 ] = "Toggle Show Tools Modules" TAB "" TAB "AssetBrowser.viewToolsModulesFilter();"; + item[ 2 ] = "Toggle Only Show Modules with Assets" TAB "" TAB "AssetBrowser.viewPopulatedModulesFilter();"; + Item[ 3 ] = "-"; + item[ 4 ] = "Show Folders" TAB "" TAB "AssetBrowser.toggleShowingFolders();"; + item[ 5 ] = "Show Empty Folders" TAB "" TAB "AssetBrowser.toggleShowingEmptyFolders();"; + item[ 6 ] = "-"; + item[ 7 ] = "Filter by Asset Type" TAB AssetTypeListPopup; + item[ 8 ] = "-"; + item[ 9 ] = "Enable Auto-refresh" TAB "" TAB "AssetBrowser.toggleAutorefresh();"; + Item[ 10 ] = "-"; + Item[ 11 ] = "Asset Preview Size" TAB AssetPreviewSizePopup; }; + + BrowserVisibilityPopup.enableItem(5, false); + BrowserVisibilityPopup.enableItem(7, false); + BrowserVisibilityPopup.enableItem(9, false); } + // + //Import Legacy menus if( !isObject( ImportAssetsPopup ) ) { @@ -266,6 +329,7 @@ function AssetBrowser::buildPopupMenus(%this) }; } + } function AddNewScriptAssetPopupMenu::onSelectItem(%this, %id, %text) diff --git a/Templates/BaseGame/game/tools/gui/editorSettingsWindow.ed.cs b/Templates/BaseGame/game/tools/gui/editorSettingsWindow.ed.cs index 7a673d64d..6137b0f64 100644 --- a/Templates/BaseGame/game/tools/gui/editorSettingsWindow.ed.cs +++ b/Templates/BaseGame/game/tools/gui/editorSettingsWindow.ed.cs @@ -32,6 +32,7 @@ function ESettingsWindow::startup( %this ) %this.addEditorSettingsPage("ShapeEditor", "Shape Editor"); %this.addEditorSettingsPage("NavEditor", "Navigation Editor"); %this.addEditorSettingsPage("Theme", "Theme"); + %this.addEditorSettingsPage("AssetEditing", "Asset Editing"); %this.addGameSettingsPage("GameGeneral", "General"); %this.addGameSettingsPage("Gameplay", "Gameplay"); @@ -185,7 +186,7 @@ function SettingsInspector::changeEditorSetting(%this, %varName, %value) %success = ProjectSettings.write(); if(%oldValue !$= %value) - ESettingsWindow.refresh(); + ESettingsWindow.schedule(15,"refresh"); } function GuiInspectorVariableGroup::buildOptionsSettingField(%this, %fieldName, %fieldLabel, %fieldDesc, %fieldDefaultVal, %fieldDataVals, %ownerObj) @@ -292,6 +293,12 @@ function ESettingsWindow::getGeneralSettings(%this) SettingsInspector.addSettingsField("WorldEditor/Theme/windowTitleFontColor", "Window Title Text Color", "colorI", ""); SettingsInspector.addSettingsField("WorldEditor/Theme/mainTextColor", "Main Text Color", "colorI", ""); SettingsInspector.endGroup(); + + SettingsInspector.startGroup("Layout"); + SettingsInspector.addSettingsField("WorldEditor/Layout/LayoutMode", "Editor Layout Mode", "list", "This dictates which layout style the editor should use." @ + "WARNING - Modern layout is highlight experimental." @ + "Updating this requires a restart of the program", "Classic,Modern"); + SettingsInspector.endGroup(); } function ESettingsWindow::getCameraSettings(%this) @@ -380,6 +387,7 @@ function ESettingsWindow::getThemeSettings(%this) SettingsInspector.addSettingsField("Theme/fieldTextColor", "Field Text Color", "ColorI", ""); SettingsInspector.addSettingsField("Theme/fieldTextHLColor", "Field Text Highlight Color", "ColorI", ""); SettingsInspector.addSettingsField("Theme/fieldTextSELColor", "Field Text Selected Color", "ColorI", ""); + SettingsInspector.addSettingsField("Theme/fieldTextNAColor", "Field Text N/A Color", "ColorI", ""); SettingsInspector.addSettingsField("Theme/fieldBGColor", "Field Background Color", "ColorI", ""); SettingsInspector.addSettingsField("Theme/fieldBGHLColor", "Field Background Highlight Color", "ColorI", ""); @@ -431,9 +439,38 @@ function ESettingsWindow::getAssetManagementSettings(%this) SettingsInspector.addSettingsField("AssetManagement/Assets/assetExtension", "Asset Extension", "string", ""); SettingsInspector.addSettingsField("AssetManagement/Assets/datablockCaching", "Cache Datablocks", "bool", ""); //SettingsInspector.addSettingsField("AssetManagement/Assets/moduleExtension", "Module Extension", "string", ""); + SettingsInspector.endGroup(); } +function ESettingsWindow::getAssetEditingSettings(%this) +{ + ImportAssetWindow::reloadImportOptionConfigs(); + + for(%i=0; %i < ImportAssetWindow.importConfigsList.Count(); %i++) + { + %configName = ImportAssetWindow.importConfigsList.getKey(%i); + %formattedConfigList = %i == 0 ? %configName : %formattedConfigList @ "," @ %configName; + } + + SettingsInspector.startGroup("Assets Importing"); + SettingsInspector.addSettingsField("Assets/AssetImporDefaultConfig", "Default Asset Import Config", "list", "", %formattedConfigList); + SettingsInspector.addSettingsField("Assets/AutoImport", "Automatically Import using default config", "bool", "If on, the asset importing process" @ + "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.endGroup(); + + SettingsInspector.startGroup("Asset Browser"); + SettingsInspector.addSettingsField("Assets/Browser/showCoreModule", "Show Core Module in Asset Browser", "bool", ""); + SettingsInspector.addSettingsField("Assets/Browser/showToolsModule", "Show Tools Module in Asset Browser", "bool", ""); + SettingsInspector.addSettingsField("Assets/Browser/showOnlyPopulatedModule", "Show Only Modules with Assets in Asset Browser", "bool", ""); + SettingsInspector.addSettingsField("Assets/Browser/showFolders", "Show Folders in Tiles view in Asset Browser", "bool", ""); + SettingsInspector.addSettingsField("Assets/Browser/showEmptyFolders", "Show Empty Folders in Tiles view in Asset Browser", "bool", ""); + SettingsInspector.addSettingsField("Assets/Browser/previewTileSize", "Asset Preview Tile Size", "bool", ""); + SettingsInspector.endGroup(); +} + function ESettingsWindow::getGameplaySettings(%this) { SettingsInspector.startGroup("Game Modes"); diff --git a/Templates/BaseGame/game/tools/gui/profiles.ed.cs b/Templates/BaseGame/game/tools/gui/profiles.ed.cs index b094a4c4e..b14de3db0 100644 --- a/Templates/BaseGame/game/tools/gui/profiles.ed.cs +++ b/Templates/BaseGame/game/tools/gui/profiles.ed.cs @@ -1109,7 +1109,7 @@ singleton GuiControlProfile( ToolsGuiMenuBarProfile ) fontColor = EditorSettings.value("Theme/headerTextColor"); fontColorSEL = EditorSettings.value("Theme/fieldTextSELColor"); fontColorHL = EditorSettings.value("Theme/fieldTextHLColor"); - fontColorNA = EditorSettings.value("Theme/fieldTextSELColor"); + fontColorNA = EditorSettings.value("Theme/fieldTextNAColor"); border = 0; borderThickness = 1; opaque = true; diff --git a/Templates/BaseGame/game/tools/settings.xml b/Templates/BaseGame/game/tools/settings.xml index 7b5338057..73307a503 100644 --- a/Templates/BaseGame/game/tools/settings.xml +++ b/Templates/BaseGame/game/tools/settings.xml @@ -1,219 +1,247 @@ - - data/FPSGameplay/levels - - - 25 - - - 5 - - - - 0 0 1 - 10 255 0 0 255 - DefaultRoadMaterialOther + 10 DefaultRoadMaterialTop + 0 0 1 + DefaultRoadMaterialOther 0 255 0 255 - 234 232 230 255 72 70 68 255 - 255 255 255 255 - 50 49 48 255 - 100 98 96 255 - 50 49 48 255 - 17 16 15 255 - 96 94 92 255 - 72 70 68 255 + 59 58 57 255 255 255 255 255 43 43 43 255 - 32 31 30 255 - 50 49 48 255 - 178 175 172 255 - 59 58 57 255 + 17 16 15 255 37 36 35 255 - 59 58 57 255 + 32 31 30 255 + 50 49 48 255 + 255 255 255 255 236 234 232 255 + 178 175 172 255 + 72 70 68 255 + 50 49 48 255 + 100 98 96 255 + 59 58 57 255 + 96 94 92 255 + 234 232 230 255 + 77 77 77 255 + 50 49 48 255 - - 1 - 0.8 - 0 - 0 - 100 - 0.8 - 15 - - 0 - 500 - 0 - 10 10 10 - 255 255 255 20 - 0 - + + 1 + 1 + 0 0 0 100 + 1 + 0 + 255 255 255 255 + 135 + 180 180 180 255 + 1 + 1 + 1 + 40 40 + 0 + 45 + 0.1 tools/gui 1024 768 - 0 0 + 0 0 - - Categorized + + 0 - 1 1 + 2 + 1 8 + 1 + 1 0 1 - 1 - 2 - 1 - ../../../Documentation/Torque 3D - Script Manual.chm - ../../../Documentation/Official Documentation.html http://www.garagegames.com/products/torque-3d/documentation/user + ../../../Documentation/Official Documentation.html + ../../../Documentation/Torque 3D - Script Manual.chm 1 1 - - 0 + + Categorized + + + + 0.8 + 0.8 + 0 + 15 + 0 + 1 + 100 + + 0 + 1 + 0 + 1 1 1 + 255 255 255 20 + 500 - 50 - 1 AssetWork_Debug.exe - 0 - 6 - WorldEditorInspectorPlugin - screenCenter 40 - - 1 - 1 - 1 - 1 - 1 - - - 100 100 100 255 - 255 255 255 255 - 255 255 0 255 - 0 255 0 255 - 255 255 0 255 - 255 0 0 255 - 0 0 255 255 - + screenCenter + 6 + 0 + 50 + Modern + 1 + WorldEditorInspectorPlugin 51 51 51 100 102 102 102 100 1 255 255 255 100 - 0 + 1 + + + 1 + 1 + 1 + 1 + 1 - 20 8 - 1 - 0 255 + 20 + 0 + 1 - - ../../../Documentation/Torque 3D - Script Manual.chm - ../../../Documentation/Official Documentation.html - http://www.garagegames.com/products/torque-3d/forums - http://www.garagegames.com/products/torque-3d/documentation/user - - - 0 - 1 - 1 - 100 - 2 - 0 - 0 + + 255 255 0 255 + 255 255 0 255 + 0 0 255 255 + 255 0 0 255 + 255 255 255 255 + 100 100 100 255 + 0 255 0 255 255 255 255 255 - 50 50 50 255 - 48 48 48 255 215 215 215 255 + 48 48 48 255 180 180 180 255 + 50 50 50 255 + + + 0 + 2 + 0 + 1 + 100 + 0 + 1 + + + http://www.garagegames.com/products/torque-3d/documentation/user + http://www.garagegames.com/products/torque-3d/forums + ../../../Documentation/Torque 3D - Script Manual.chm + ../../../Documentation/Official Documentation.html + tools/worldEditor/images/DefaultHandle tools/worldEditor/images/LockedHandle tools/worldEditor/images/SelectHandle - tools/worldEditor/images/DefaultHandle + + + Classic - - 180 180 180 255 - 0 - 0 - 1 - 0.1 - 135 - 1 - 1 - 1 - 255 255 255 255 - 0 0 0 100 - 1 - 45 - 1 - 40 40 + + <AssetType>/<SpecialAssetTag>/ + 1 + <AssetType>/ + <AssetType>/OtherFolder/ + <AssetType>/ + <AssetType>/<AssetName>/ + TestConfig + <AssetType>/ + <AssetType>/ + <AssetType>/ + <AssetType>/<SpecialAssetTag>/ lowerHeight - - 1 - 40 40 - 40 40 - 1 - ellipse - + 1.000000 0.833333 0.666667 0.500000 0.333333 0.166667 0.000000 + 1 + 90 + 50 + 0 + 1.000000 0.833333 0.666667 0.500000 0.333333 0.166667 0.000000 + 0.1 + 10 100 1 - 0 - 10 - 50 - 90 - 1.000000 0.833333 0.666667 0.500000 0.333333 0.166667 0.000000 - 1.000000 0.833333 0.666667 0.500000 0.333333 0.166667 0.000000 - 1 - 0.1 + + + 1 + ellipse + 40 40 + 40 40 + 1 - - 0 0 1 - 255 255 255 255 - 255 0 0 255 + 0 255 0 255 + 255 255 255 255 + DefaultDecalRoadMaterial 10 - 5 + + + TestConfig + 0 + + small + + DefaultPlayerData 1 AIPlayer - DefaultPlayerData - - 255 255 255 255 + + 255 0 0 255 10 - DefaultDecalRoadMaterial + 0 0 1 0 255 0 255 + 255 255 255 255 + 5 + + + data/FPSGameplay/levels + + + 5 + + + 25 + + + + + Small Grid_512_Orange diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.cs b/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.cs index 5e7d32893..a3a883b64 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.cs +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.cs @@ -1885,6 +1885,9 @@ function Editor::open(%this) Canvas.setContent(EditorGui); $isFirstPersonVar = true; EditorGui.syncCameraGui(); + + if(EditorSettings.value("WorldEditor/Layout/LayoutMode", "Classic") $= "Modern") + togglePanelLayout(); } function Editor::close(%this, %gui) diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/editor.ed.cs b/Templates/BaseGame/game/tools/worldEditor/scripts/editor.ed.cs index 98acd2d75..1a05008eb 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/editor.ed.cs +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/editor.ed.cs @@ -164,7 +164,7 @@ function toggleEditor(%make) //------------------------------------------------------------------------------ // The editor action maps are defined in editor.bind.cs -GlobalActionMap.bind(keyboard, "f11", toggleEditor); +GlobalActionMap.bind(keyboard, "f11", fastLoadWorldEdit); // The scenario: