diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/setAssetTarget.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/setAssetTarget.gui new file mode 100644 index 000000000..700058f74 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/setAssetTarget.gui @@ -0,0 +1,220 @@ +//--- OBJECT WRITE BEGIN --- +$guiContent = new GuiControl(AssetBrowser_setAssetTarget) { + position = "0 0"; + extent = "1024 768"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultNonModalProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + + new GuiWindowCtrl(AssetBrowser_setAssetTargetWindow) { + text = "Set Asset Destination"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "1"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + closeCommand = "Canvas.popDialog(AssetBrowser_setAssetTarget);"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "328 311"; + extent = "368 118"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTextCtrl() { + text = "Target Module:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 29"; + extent = "116 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiPopUpMenuCtrlEx() { + maxPopupHeight = "200"; + sbUsesNAColor = "0"; + reverseTextList = "0"; + bitmapBounds = "16 16"; + hotTrackCallback = "0"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "135 28"; + extent = "202 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiPopUpMenuProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + internalName = "ModuleList"; + class = "AssetBrowserModuleList"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Target Path:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 54"; + extent = "116 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextEditCtrl() { + historySize = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + password = "0"; + passwordMask = "*"; + text = "data/"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "135 54"; + extent = "201 18"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "ToolsGuiTextEditProfile"; + visible = "1"; + active = "0"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + internalName = "targetPath"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl() { + BitmapAsset = "ToolsModule:iconOpen_image"; + bitmapMode = "Centered"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "340 51"; + extent = "22 22"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "SelectAssetPath.showDialog(AssetBrowser.dirHandler.currentAddress, \"setAssetTargetUpdatePath\");\nSelectAssetPathWindow.selectWindow();"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "New Module"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Done"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "227 87"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "top"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "setAssetTarget();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "295 87"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "top"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser_setAssetTargetWindow.onClose();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/tools/assetBrowser/main.tscript b/Templates/BaseGame/game/tools/assetBrowser/main.tscript index dc41eacb9..8f6ca92dd 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/main.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/main.tscript @@ -69,6 +69,7 @@ function initializeAssetBrowser() exec("./guis/looseFileAudit.gui"); exec("./guis/assetNameEdit.gui"); exec("./guis/createNewCollectionSet.gui"); + exec("./guis/setAssetTarget.gui"); exec("./scripts/assetBrowser." @ $TorqueScriptFileExtension); exec("./scripts/popupMenus." @ $TorqueScriptFileExtension); @@ -85,6 +86,7 @@ function initializeAssetBrowser() exec("./scripts/selectPath." @ $TorqueScriptFileExtension); exec("./scripts/looseFileAudit." @ $TorqueScriptFileExtension); exec("./scripts/creator." @ $TorqueScriptFileExtension); + exec("./scripts/setAssetTarget." @ $TorqueScriptFileExtension); //Processing for the different asset types exec("./scripts/assetTypes/component." @ $TorqueScriptFileExtension); diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/addModuleWindow.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/addModuleWindow.tscript index ade7dce8e..ff085835b 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/addModuleWindow.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/addModuleWindow.tscript @@ -95,7 +95,7 @@ function AssetBrowser_addModuleWindow::CreateNewModule(%this) //force a refresh of our modules list ModuleDatabase.ignoreLoadedGroups(true); - ModuleDatabase.scanModules(); + ModuleDatabase.registerModule(%moduleFilePath, %newModuleName @ ".module"); %success = ModuleDatabase.loadExplicit(%newModuleName, 1); ModuleDatabase.ignoreLoadedGroups(false); @@ -123,8 +123,9 @@ function AssetBrowserModuleList::refresh(%this) %count = getWordCount(%moduleList); for(%i=0; %i < %count; %i++) { - %moduleName = getWord(%moduleList, %i); - %this.add(%moduleName.ModuleId, %i); + %moduleDef = getWord(%moduleList, %i); + %moduleName = %moduleDef.ModuleId; + %this.add(%moduleName, %i); } } diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.tscript index a65a0af7b..1b42f482f 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.tscript @@ -165,8 +165,14 @@ function getAssetTypeByFilename(%filePath) function AssetBrowser::onBeginDropFiles( %this ) { - if(!AssetBrowser.isAwake()) + if(!AssetBrowser.isAwake() || !AssetBrowser.isVisible()) + { + if(GuiEditorIsActive()) + GuiEditor.onBeginDropFiles(); + else if(EditorIsActive()) + EWorldEditor.onBeginDropFiles(); return; + } error("% DragDrop - Beginning files dropping."); if(!ImportAssetWindow.isAwake()) @@ -175,45 +181,28 @@ function AssetBrowser::onBeginDropFiles( %this ) function AssetBrowser::onDropFile( %this, %filePath ) { - if(!%this.isVisible()) + if(!AssetBrowser.isAwake() || !AssetBrowser.isVisible()) + { + if(GuiEditorIsActive()) + GuiEditor.onDropFile(%filePath); + else if(EditorIsActive()) + EWorldEditor.onDropFile(%filePath); return; + } ImportAssetWindow.importer.addImportingFile(%filePath); - - /*%fileExt = fileExt( %filePath ); - //add it to our array! - if(isImageFormat(%fileExt)) - %assetItem = %this.addImportingAsset("ImageAsset", %filePath); - else if( isShapeFormat(%fileExt)) - %assetItem = %this.addImportingAsset("ShapeAsset", %filePath); - else if( isSoundFormat(%fileExt)) - %assetItem = %this.addImportingAsset("SoundAsset", %filePath); - else if( %fileExt $= "." @ $TorqueScriptFileExtension || %fileExt $= "." @ $TorqueScriptFileExtension @ ".dso" ) - %assetItem = %this.addImportingAsset("ScriptAsset", %filePath); - else if( %fileExt $= ".gui" || %fileExt $= ".gui.dso" ) - %assetItem = %this.addImportingAsset("GUIAsset", %filePath); - else if (%fileExt $= ".zip") - %this.onDropZipFile(%filePath); - else if( %fileExt $= "") - %this.onDropFolder(%filePath); - - if(%assetItem !$= "") - { - SessionImportAssetItems.add(%assetItem); - ImportAssetItems.add(%assetItem); - }*/ - - //Used to keep tabs on what files we were trying to import, used mainly in the event of - //adjusting configs and needing to completely reprocess the import - //ensure we're not doubling-up on files by accident - //if(ImportAssetWindow.importingFilesArray.getIndexFromKey(%filePath) == -1) - // ImportAssetWindow.importingFilesArray.add(%filePath); } function AssetBrowser::onDropZipFile(%this, %filePath) { - if(!%this.isVisible()) + if(!AssetBrowser.isAwake() || !AssetBrowser.isVisible()) + { + if(GuiEditorIsActive()) + GuiEditor.onDropZipFile(%filePath); + else if(EditorIsActive()) + EWorldEditor.onDropZipFile(%filePath); return; + } %zip = new ZipObject(); %zip.openArchive(%filePath); @@ -226,27 +215,6 @@ function AssetBrowser::onDropZipFile(%this, %filePath) %fileEntry = %zip.getFileEntry(%i); %fileFrom = getField(%fileEntry, 0); - //First, we wanna scan to see if we have modules to contend with. If we do, we'll just plunk them in wholesale - //and not process their contents. - - //If not modules, it's likely an art pack or other mixed files, so we'll import them as normal - /*if( (%fileExt $= ".png") || (%fileExt $= ".jpg") || (%fileExt $= ".bmp") || (%fileExt $= ".dds") ) - %this.importAssetListArray.add("ImageAsset", %filePath); - else if( (%fileExt $= ".dae") || (%fileExt $= ".dts")) - %this.importAssetListArray.add("ShapeAsset", %filePath); - else if( (%fileExt $= ".ogg") || (%fileExt $= ".wav") || (%fileExt $= ".mp3")) - %this.importAssetListArray.add("SoundAsset", %filePath); - else if( (%fileExt $= ".gui") || (%fileExt $= ".gui.dso")) - %this.importAssetListArray.add("GUIAsset", %filePath); - //else if( (%fileExt $= "." @ $TorqueScriptFileExtension) || (%fileExt $= ".dso")) - // %this.importAssetListArray.add("Script", %filePath); - else if( (%fileExt $= ".mis")) - %this.importAssetListArray.add("LevelAsset", %filePath);*/ - - // For now, if it's a .tscript file, we'll assume it's a behavior. - //if (fileExt(%fileFrom) !$= "." @ $TorqueScriptFileExtension) - // continue; - %fileTo = expandFilename("^tools/assetBrowser/importTemp/") @ %fileFrom; %zip.extractFile(%fileFrom, %fileTo); //exec(%fileTo); @@ -259,8 +227,14 @@ function AssetBrowser::onDropZipFile(%this, %filePath) function AssetBrowser::onDropFolder(%this, %filePath) { - if(!%this.isVisible()) + if(!AssetBrowser.isAwake() || !AssetBrowser.isVisible()) + { + if(GuiEditorIsActive()) + GuiEditor.onDropFolder(%filePath); + else if(EditorIsActive()) + EWorldEditor.onDropFolder(%filePath); return; + } %zip = new ZipObject(); %zip.openArchive(%filePath); @@ -306,8 +280,14 @@ function AssetBrowser::onDropFolder(%this, %filePath) function AssetBrowser::onEndDropFiles( %this ) { - if(!%this.isVisible()) + if(!AssetBrowser.isAwake() || !AssetBrowser.isVisible()) + { + if(GuiEditorIsActive()) + GuiEditor.onEndDropFiles(); + else if(EditorIsActive()) + EWorldEditor.onEndDropFiles(); return; + } ImportAssetWindow.refresh(); } diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/datablockObjects.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/datablockObjects.tscript index ea77f8b1a..a0aad9382 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/datablockObjects.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/datablockObjects.tscript @@ -63,7 +63,22 @@ function AssetBrowser::buildDatablockPreview(%this, %assetDef, %previewData) "\nDatablock Type: " @ %assetDef.getClassName() @ "\nDefinition Path: " @ %assetDef.getFilename(); - %previewData.doubleClickCommand = "AssetBrowser.schedule(10, \"spawnDatablockObject\",\""@ %assetDef @"\");";//browseTo %assetDef.dirPath / %assetDef.assetName + + if(%this.selectMode) + { + %previewData.doubleClickCommand = "AssetBrowser.selectAsset( AssetBrowser.selectedAsset );"; + } + else + { + if(EditorSettings.value("Assets/Browser/doubleClickAction", "Edit Asset") $= "Edit Asset") + { + %previewData.doubleClickCommand = "DatablockEditorPlugin.openDatablock( "@%assetDef@" );"; + } + else + { + %previewData.doubleClickCommand = "AssetBrowser.onDatablockEditorDropped( "@%assetDef@" );"; + } + } } function spawnDatablockObject(%datablock) diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/creator.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/creator.tscript index d2254ee12..15dc88d0a 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/creator.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/creator.tscript @@ -106,8 +106,6 @@ function AssetBrowser::loadCreatorClasses(%this) %guiClasses.sortk(true); - %guiClasses.echo(); - %currentCat = ""; for(%i=0; %i < %guiClasses.count(); %i++) { diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/setAssetTarget.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/setAssetTarget.tscript new file mode 100644 index 000000000..f2440e873 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/setAssetTarget.tscript @@ -0,0 +1,43 @@ +function AssetBrowser_setAssetTarget::showDialog(%this, %callback) +{ + AssetBrowser_setAssetTarget.callback = %callback; + Canvas.pushDialog(AssetBrowser_setAssetTarget); +} + +function AssetBrowser_setAssetTarget::onWake(%this) +{ + %targetModule = AssetBrowser.dirHandler.getModuleFromAddress(AssetBrowser.dirHandler.currentAddress).ModuleId; + + if(%targetModule $= "") + %targetModule = EditorSettings.value("Assets/New/defaultModule", ""); + + AssetBrowser_setAssetTarget-->moduleList.setText(%targetModule); + + %moduleDef = ModuleDatabase.findModule(%targetModule); + + %targetPath = AssetBrowser.dirHandler.currentAddress; + if(!startsWith(%targetPath, %moduleDef.ModulePath)) + { + %targetPath = %moduleDef.ModulePath; + } + + AssetBrowser_setAssetTarget-->targetPath.text = %targetPath; +} + +function AssetBrowser_setAssetTargetWindow::onClose(%this) +{ + Canvas.popDialog(AssetBrowser_setAssetTarget); +} + +function setAssetTargetUpdatePath(%targetPath) +{ + AssetBrowser_setAssetTarget-->targetPath.text = %targetPath; +} + +function setAssetTarget() +{ + AssetBrowser.dirHandler.currentAddress = AssetBrowser_setAssetTarget-->targetPath.text; + eval(AssetBrowser_setAssetTarget.callback); + + Canvas.popDialog(AssetBrowser_setAssetTarget); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/datablockEditor/DatablockEditorCreatePrompt.ed.gui b/Templates/BaseGame/game/tools/datablockEditor/DatablockEditorCreatePrompt.ed.gui index 5f1783390..29b3afb9e 100644 --- a/Templates/BaseGame/game/tools/datablockEditor/DatablockEditorCreatePrompt.ed.gui +++ b/Templates/BaseGame/game/tools/datablockEditor/DatablockEditorCreatePrompt.ed.gui @@ -5,7 +5,6 @@ $guiContent = new GuiControl(DatablockEditorCreatePrompt,EditorGuiGroup) { minExtent = "8 2"; horizSizing = "right"; vertSizing = "bottom"; - fixedAspectRatio = "0"; profile = "ToolsGuiDefaultProfile"; visible = "1"; active = "1"; @@ -14,6 +13,7 @@ $guiContent = new GuiControl(DatablockEditorCreatePrompt,EditorGuiGroup) { isContainer = "1"; canSave = "1"; canSaveDynamicFields = "1"; + fixedAspectRatio = "0"; new GuiWindowCtrl() { text = "Create New Datablock"; @@ -32,18 +32,18 @@ $guiContent = new GuiControl(DatablockEditorCreatePrompt,EditorGuiGroup) { anchorBottom = "0"; anchorLeft = "1"; anchorRight = "0"; - position = "389 252"; - extent = "207 167"; + position = "374 252"; + extent = "309 167"; minExtent = "8 2"; horizSizing = "right"; vertSizing = "bottom"; - fixedAspectRatio = "0"; profile = "ToolsGuiWindowProfile"; visible = "1"; active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; hovertime = "1000"; isContainer = "1"; + internalName = "promptWindow"; canSave = "1"; canSaveDynamicFields = "0"; @@ -61,7 +61,6 @@ $guiContent = new GuiControl(DatablockEditorCreatePrompt,EditorGuiGroup) { minExtent = "8 2"; horizSizing = "right"; vertSizing = "bottom"; - fixedAspectRatio = "0"; profile = "ToolsGuiTextProfile"; visible = "1"; active = "1"; @@ -86,11 +85,10 @@ $guiContent = new GuiControl(DatablockEditorCreatePrompt,EditorGuiGroup) { anchorLeft = "1"; anchorRight = "0"; position = "7 45"; - extent = "191 17"; + extent = "294 18"; minExtent = "8 2"; horizSizing = "right"; vertSizing = "bottom"; - fixedAspectRatio = "0"; profile = "ToolsGuiTextEditProfile"; visible = "1"; active = "1"; @@ -106,12 +104,11 @@ $guiContent = new GuiControl(DatablockEditorCreatePrompt,EditorGuiGroup) { groupNum = "-1"; buttonType = "PushButton"; useMouseEvents = "0"; - position = "7 137"; + position = "111 137"; extent = "122 22"; minExtent = "8 2"; horizSizing = "right"; vertSizing = "bottom"; - fixedAspectRatio = "0"; profile = "ToolsGuiButtonProfile"; visible = "1"; active = "1"; @@ -128,12 +125,11 @@ $guiContent = new GuiControl(DatablockEditorCreatePrompt,EditorGuiGroup) { groupNum = "-1"; buttonType = "PushButton"; useMouseEvents = "0"; - position = "135 137"; + position = "239 137"; extent = "63 22"; minExtent = "8 2"; horizSizing = "right"; vertSizing = "bottom"; - fixedAspectRatio = "0"; profile = "ToolsGuiButtonProfile"; visible = "1"; active = "1"; @@ -159,7 +155,6 @@ $guiContent = new GuiControl(DatablockEditorCreatePrompt,EditorGuiGroup) { minExtent = "8 2"; horizSizing = "right"; vertSizing = "bottom"; - fixedAspectRatio = "0"; profile = "ToolsGuiTextProfile"; visible = "1"; active = "1"; @@ -182,11 +177,10 @@ $guiContent = new GuiControl(DatablockEditorCreatePrompt,EditorGuiGroup) { anchorLeft = "1"; anchorRight = "0"; position = "7 87"; - extent = "191 19"; + extent = "294 19"; minExtent = "8 2"; horizSizing = "right"; vertSizing = "bottom"; - fixedAspectRatio = "0"; profile = "ToolsGuiPopUpMenuProfile"; visible = "1"; active = "1"; @@ -198,7 +192,6 @@ $guiContent = new GuiControl(DatablockEditorCreatePrompt,EditorGuiGroup) { canSaveDynamicFields = "0"; }; new GuiCheckBoxCtrl() { - useInactiveState = "0"; text = "Client-Side Datablock"; groupNum = "-1"; buttonType = "ToggleButton"; @@ -208,10 +201,9 @@ $guiContent = new GuiControl(DatablockEditorCreatePrompt,EditorGuiGroup) { minExtent = "8 2"; horizSizing = "right"; vertSizing = "bottom"; - fixedAspectRatio = "0"; profile = "ToolsGuiCheckBoxProfile"; visible = "1"; - active = "1"; + active = "0"; tooltipProfile = "ToolsGuiToolTipProfile"; hovertime = "1000"; isContainer = "0"; diff --git a/Templates/BaseGame/game/tools/datablockEditor/DatablockEditorTreeWindow.ed.gui b/Templates/BaseGame/game/tools/datablockEditor/DatablockEditorTreeWindow.ed.gui index 95ba4a277..8f0d0eaee 100644 --- a/Templates/BaseGame/game/tools/datablockEditor/DatablockEditorTreeWindow.ed.gui +++ b/Templates/BaseGame/game/tools/datablockEditor/DatablockEditorTreeWindow.ed.gui @@ -259,7 +259,7 @@ $guiContent = new GuiControl() { tooltipprofile = "ToolsGuiToolTipProfile"; hovertime = "1000"; canSaveDynamicFields = "0"; - altCommand = "DatablockEditorPlugin.createDatablock();"; + altCommand = "DatablockEditorPlugin.pickDatablockPath();"; }; }; }; diff --git a/Templates/BaseGame/game/tools/datablockEditor/datablockEditor.tscript b/Templates/BaseGame/game/tools/datablockEditor/datablockEditor.tscript index ca9373416..d780731ef 100644 --- a/Templates/BaseGame/game/tools/datablockEditor/datablockEditor.tscript +++ b/Templates/BaseGame/game/tools/datablockEditor/datablockEditor.tscript @@ -666,6 +666,7 @@ function DatablockEditorPlugin::createDatablock(%this) // Show the dialog. canvas.pushDialog( DatablockEditorCreatePrompt, 0, true ); + DatablockEditorCreatePrompt-->promptWindow.text = "Create New Datablock in module: " @ DatablockEditorPlugin.targetCreationModule; } } @@ -679,6 +680,7 @@ function DatablockEditorPlugin::pickDatablockPath(%this) function DatablockEditorPlugin::pickedNewDBTargetModule(%this, %module) { + DatablockEditorPlugin.targetCreationModule = %module; %moduleDef = ModuleDatabase.findModule(%module); $DATABLOCK_EDITOR_DEFAULT_FILENAME = %moduleDef.ModulePath @ "/scripts/managedData/managedDatablocks." @ $TorqueScriptFileExtension; diff --git a/Templates/BaseGame/game/tools/editorClasses/scripts/input/dragDropEvents.ed.tscript b/Templates/BaseGame/game/tools/editorClasses/scripts/input/dragDropEvents.ed.tscript index 70582bd20..5e4405282 100644 --- a/Templates/BaseGame/game/tools/editorClasses/scripts/input/dragDropEvents.ed.tscript +++ b/Templates/BaseGame/game/tools/editorClasses/scripts/input/dragDropEvents.ed.tscript @@ -39,7 +39,6 @@ function onDropFile( %filePath ) } function onDropEnd( %fileCount ) { - //error("% DragDrop - Completed file dropping"); Input::GetEventManager().postEvent( "EndDropFiles" ); } diff --git a/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditor.ed.tscript b/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditor.ed.tscript index 9436283d4..e9eabea7e 100644 --- a/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditor.ed.tscript +++ b/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditor.ed.tscript @@ -722,6 +722,64 @@ function GuiEditor::onMouseModeChange( %this ) GuiEditorStatusBar.setText( GuiEditorStatusBar.getMouseModeHelp() ); } +// +function GuiEditor::onBeginDropFiles( %this ) +{ + if(!%this.isVisible()) + return; + + AssetBrowser_setAssetTarget.showDialog("EWorldEditor.doFileDropProcessing();"); + + if(!isObject($EditorImportFileList)) + $EditorImportFileList = new ArrayObject(); + + $EditorImportFileList.empty(); +} + +function GuiEditor::onDropFile( %this, %filePath ) +{ + if(!%this.isVisible()) + return; + + $EditorImportFileList.add(%filePath); +} + +function GuiEditor::onDropZipFile(%this, %filePath) +{ + if(!%this.isVisible()) + return; +} + +function GuiEditor::onDropFolder(%this, %filePath) +{ + if(!%this.isVisible()) + return; +} + +function GuiEditor::onEndDropFiles( %this ) +{ + if(!%this.isVisible()) + return; +} + +function GuiEditor::doFileDropProcessing(%this) +{ + if(!ImportAssetWindow.isAwake()) + ImportAssetWindow.showDialog(); + + for(%i=0; %i < $EditorImportFileList.Count(); %i++) + { + %file = $EditorImportFileList.getKey(%i); + ImportAssetWindow.importer.addImportingFile(%file); + } + + $EditorImportFileList.empty(); + + ImportAssetWindow.refresh(); +} + +// + //============================================================================================= // Resolution List. //============================================================================================= diff --git a/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorUndo.ed.tscript b/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorUndo.ed.tscript index f28a26109..ba75ee7a0 100644 --- a/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorUndo.ed.tscript +++ b/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorUndo.ed.tscript @@ -599,4 +599,4 @@ function GuiEditor::onFitIntoParents( %this ) { %selected = %this.getSelection(); //TODO -} +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/worldEditor/gui/objectBuilderGui.ed.gui b/Templates/BaseGame/game/tools/worldEditor/gui/objectBuilderGui.ed.gui index 755227156..dc757dc54 100644 --- a/Templates/BaseGame/game/tools/worldEditor/gui/objectBuilderGui.ed.gui +++ b/Templates/BaseGame/game/tools/worldEditor/gui/objectBuilderGui.ed.gui @@ -375,7 +375,7 @@ function ObjectBuilderGui::createImageAssetType(%this, %index) modal = "1"; command = %this @ ".getImageAsset(" @ %index @ ");"; }; - %button.setBitmap("tools/materialEditor/gui/change-material-btn"); + %button.setBitmap("ToolsModule:change_material_btn_n_image"); %this.controls[%this.numControls].addGuiControl(%button); %this.numControls++; @@ -466,7 +466,7 @@ function ObjectBuilderGui::createMaterialNameType(%this, %index) modal = "1"; command = %this @ ".getMaterialName(" @ %index @ ");"; }; - %button.setBitmap("tools/materialEditor/gui/change-material-btn"); + %button.setBitmap("ToolsModule:change_material_btn_n_image"); %this.controls[%this.numControls].addGuiControl(%button); //%val = %this.field[%index, value]; @@ -869,7 +869,6 @@ function ObjectBuilderGui::buildCloudLayer(%this) OBObjectName.setValue( "" ); %this.objectClassName = "CloudLayer"; %this.addField( "textureAsset", "TypeImageAsset", "Image", "Core_Rendering:clouds_normal_displacement_image" ); - //%this.addField( "textureFile", "TypeImageFilename", "Texture", "core/rendering/images/clouds_normal_displacement" ); %this.process(); } @@ -881,9 +880,10 @@ function ObjectBuilderGui::buildBasicClouds(%this) // This is a trick... any fields added after process won't show // up as controls, but will be applied to the created object. - %this.addField( "texture[0]", "TypeImageFilename", "Texture", "core/rendering/images/cloud1" ); - %this.addField( "texture[1]", "TypeImageFilename", "Texture", "core/rendering/images/cloud2" ); - %this.addField( "texture[2]", "TypeImageFilename", "Texture", "core/rendering/images/cloud3" ); + %this.addField( "textureAsset[0]", "TypeImageAssetId", "TextureAsset", "Core_Rendering:cloud1_image" ); + %this.addField( "textureAsset[1]", "TypeImageAssetId", "TextureAsset", "Core_Rendering:cloud2_image" ); + %this.addField( "textureAsset[2]", "TypeImageAssetId", "TextureAsset", "Core_Rendering:cloud3_image" ); + } function ObjectBuilderGui::checkExists( %this, %classname ) @@ -994,9 +994,9 @@ function ObjectBuilderGui::addWaterObjectFields(%this) %this.addField("waveSpeed[2]", "TypeFloat", "Wave Speed", "1"); %this.addField("overallWaveMagnitude", "TypeFloat", "Overall Wave Magnitude", "1.0"); - %this.addField("rippleTex", "TypeImageFilename", "Ripple Texture", "core/rendering/images/ripple" ); - %this.addField("depthGradientTex", "TypeImageFilename", "Depth Gradient Texture", "core/rendering/images/depthcolor_ramp" ); - %this.addField("foamTex", "TypeImageFilename", "Foam Texture", "core/rendering/images/foam" ); + %this.addField("rippleTexAsset", "TypeImageAssetId", "Ripple Texture", "Core_Rendering:ripple_image" ); + %this.addField("depthGradientTexAsset", "TypeImageAssetId", "Depth Gradient Texture", "Core_Rendering:depthcolor_ramp_imag" ); + %this.addField("foamTexAsset", "TypeImageAssetId", "Foam Texture", "Core_Rendering:foam_image" ); } function ObjectBuilderGui::buildWaterBlock(%this) @@ -1410,4 +1410,15 @@ function PrecipitationData::create(%datablock) parentGroup = EWCreatorWindow.objectGroup; }; return %obj; +} + +function TriggerData::create(%datablock) +{ + %obj = new Trigger() + { + dataBlock = %datablock; + parentGroup = EWCreatorWindow.objectGroup; + polyhedron = "-0.5 0.5 0.0 1.0 0.0 0.0 0.0 -1.0 0.0 0.0 0.0 1.0"; + }; + return %obj; } \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/editors/worldEditor.ed.tscript b/Templates/BaseGame/game/tools/worldEditor/scripts/editors/worldEditor.ed.tscript index 08b65c716..3ff1a1075 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/editors/worldEditor.ed.tscript +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/editors/worldEditor.ed.tscript @@ -321,6 +321,64 @@ function WorldEditor::onWorldEditorUndo( %this ) Inspector.refresh(); } +// +function WorldEditor::onBeginDropFiles( %this ) +{ + if(!%this.isVisible()) + return; + + AssetBrowser_setAssetTarget.showDialog("EWorldEditor.doFileDropProcessing();"); + + if(!isObject($EditorImportFileList)) + $EditorImportFileList = new ArrayObject(); + + $EditorImportFileList.empty(); +} + +function WorldEditor::onDropFile( %this, %filePath ) +{ + if(!%this.isVisible()) + return; + + $EditorImportFileList.add(%filePath); +} + +function WorldEditor::onDropZipFile(%this, %filePath) +{ + if(!%this.isVisible()) + return; +} + +function WorldEditor::onDropFolder(%this, %filePath) +{ + if(!%this.isVisible()) + return; +} + +function WorldEditor::onEndDropFiles( %this ) +{ + if(!%this.isVisible()) + return; +} + +function WorldEditor::doFileDropProcessing(%this) +{ + if(!ImportAssetWindow.isAwake()) + ImportAssetWindow.showDialog(); + + for(%i=0; %i < $EditorImportFileList.Count(); %i++) + { + %file = $EditorImportFileList.getKey(%i); + ImportAssetWindow.importer.addImportingFile(%file); + } + + $EditorImportFileList.empty(); + + ImportAssetWindow.refresh(); +} + +// + function Inspector::onInspectorFieldModified( %this, %object, %fieldName, %arrayIndex, %oldValue, %newValue ) { // The instant group will try to add our