2018-01-28 21:30:17 +00:00
|
|
|
//
|
Updated path handling for loose asset files for CPP, Image, Level, Material, PostFX, Shape, Terrain, TerrainMat and StateMachine assets to be more predictable in when and how they expando the loose file path into a full, useable path
Fixed loose file bindings for all associated slots in level asset, such as postFX file, decals, etc
Expanded TSStatic onInspect testcase to parse materialSlots and hook-in a specialized material field for editing/quick reference from the inspector
Adjusted expand behavior of guiTree to be more reliable
Added internal name 'stack' to inspectorGroup's stack child objects for easier access to add programatic fields
Removed redundant PreMult translucency type code
Added setting of feature so probes work when in forward/basic lit mode
Corrected indexing error in SQLiteObject class so it properly parses with the updated console API
Tweaked the FOV setting logic in GameConnection::onControlObjectChange to not be spammy
Fixed var when trying to bind the camera to the client
Added project setting field to dictate the default render mode between Forward or Deferred
Integrated MotionBlur PostFX into updated PostFX Editor paradigm and exposed the samples uniform as an editable field
Integrated DOF PostFX into updated PostFX Editor paradigm
Updated setting group name for vignette postFX
Shifted shaderCache to be in data/cache along with other cached files
Added helper function to replace strings in a file
Fixed ExampleCppObject asset to have correct loose file references
Adjusted editor default level logic so it can be modifed and then stored, as well as reset back to the original default
Fixed verve reference to root scene group
Adjusted location of a nonmodal gui profile so it loads at the correct time
Reorganized AssetBrowser loading and refresh logic so it doesn't stack multiple refresh requests back-to-back causing lag
Updated the search behavior to search not just the current address, but all child folders as well, making it far more useful
Initial work into zip and folder drag-and-drop asset importing support
Removed the import config setting for 'always display material maps' as it is redundant with the new importer context menu actions
Updated example asset type file
Ensured all asset types have proper handling for move, rename and delete actions
Fixed double-click behavior on folders in the AB
Fixed CPP asset preview
Added better logic to discern if a top-level folder belongs to a module or not in the AB directory browser
Added ability to convert a non-module top-level folder in the AB into a module
Added initial hooks for being able to generate a new Editor Tool, similar to how the AB can generate modules
Renamed CPP asset template files to have the .template so they aren't accidentally picked up by cmake
Fixed convex editor's material handling to work with AB and reference back properly
Updated AB images for folder up/down navigation buttons, and the breadcrumb divider arrow
Made PostFX Editor properly allow for input pass-through so you can still edit the level with it open
Added some additional common text gui profiles
Disabled calls to old editor settings logic in various editors to remove spam
Added callOnModules call so tools can initialize properly when the world editor is opened
Fixed logic test for visualizers
Added ability for cmake to scan tools directory for any tools that add source files
2020-02-04 07:47:28 +00:00
|
|
|
function AssetBrowser::ConvertFolderIntoModule(%this, %folderName)
|
|
|
|
|
{
|
|
|
|
|
if(!isDirectory("data/" @ %folderName))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
AssetBrowser_AddModule-->moduleName.text = %folderName;
|
|
|
|
|
AssetBrowser_addModuleWindow.callbackFunction = "AssetBrowser.loadDirectories();";
|
|
|
|
|
|
|
|
|
|
AssetBrowser_addModuleWindow.CreateNewModule();
|
|
|
|
|
}
|
|
|
|
|
|
Misc Quality of Life and Bug fixes
Added handling for if preview images on image assets fails to generate, will fallback to using the full image
Added handling for double clicking or drag-n-dropping terrain assets to create them
Improved handling of field labels in variable inspector by making the stringtable be case sensitive.
Added editor settings for handling of asset double click behavior. Can now select between Edit Asset and Spawn Asset. Support is asset type dependent.
Added editor setting for auto-importing loose files when navigating to a folder. If on and the user has flagged to also enable auto-import generally, will auto import all unaffiliated loose files in as assets.
Added editor setting for default module to use when creating new assets. Updated various tooling logic so when creating a new material, if this and the 'Always Prompt Module Target' setting is off, it will fill in the target module and target asset path info based on the default module.
Fixed issue with editors that use managedData scripts where if the path didn't exist, the script file wouldn't be made.
Fixed display issue in terrain editor where if you clear the detail map, the normal/macro/orm maps would disable, but not also clear.
Fixed handling of cleared maps in terrain editor so it no longer fills empty maps in with the no image image.
Fixed handling of creating new material where it would fill in the diffuse with a no texture image as the default.
Fixed issue where canceling out of creating a module would still prompt to create the common default folders.
Fixed issue where the Select Module window couldn't be closed via the cancel or x buttons.
Based on feedback, reduced default size of the Text Pad window.
Fixed issue where the Drop At menu list wouldn't correctly display which item was marked after it was changed.
Fixed spawning shape asset handling so it uses whatever the editor's Drop At setting is.
Improved themeing of regular bitmap buttons in the editor.
Based on feedback, flipped layout of Target Module and Target Path in the Create New Asset window.
Improved handling of setting up the Target Path for when creating new assets. If a path is not set, and the user has a Default Module, it will default the path to that module.
2021-08-28 23:51:27 +00:00
|
|
|
function AssetBrowser::CreateNewModule(%this, %callback)
|
2018-01-28 21:30:17 +00:00
|
|
|
{
|
|
|
|
|
Canvas.pushDialog(AssetBrowser_AddModule);
|
|
|
|
|
AssetBrowser_addModuleWindow.selectWindow();
|
|
|
|
|
|
2020-07-11 21:49:06 +00:00
|
|
|
AssetBrowser_addModuleWindow.callbackFunction = "AssetBrowser.promptNewModuleFolders();";
|
Misc Quality of Life and Bug fixes
Added handling for if preview images on image assets fails to generate, will fallback to using the full image
Added handling for double clicking or drag-n-dropping terrain assets to create them
Improved handling of field labels in variable inspector by making the stringtable be case sensitive.
Added editor settings for handling of asset double click behavior. Can now select between Edit Asset and Spawn Asset. Support is asset type dependent.
Added editor setting for auto-importing loose files when navigating to a folder. If on and the user has flagged to also enable auto-import generally, will auto import all unaffiliated loose files in as assets.
Added editor setting for default module to use when creating new assets. Updated various tooling logic so when creating a new material, if this and the 'Always Prompt Module Target' setting is off, it will fill in the target module and target asset path info based on the default module.
Fixed issue with editors that use managedData scripts where if the path didn't exist, the script file wouldn't be made.
Fixed display issue in terrain editor where if you clear the detail map, the normal/macro/orm maps would disable, but not also clear.
Fixed handling of cleared maps in terrain editor so it no longer fills empty maps in with the no image image.
Fixed handling of creating new material where it would fill in the diffuse with a no texture image as the default.
Fixed issue where canceling out of creating a module would still prompt to create the common default folders.
Fixed issue where the Select Module window couldn't be closed via the cancel or x buttons.
Based on feedback, reduced default size of the Text Pad window.
Fixed issue where the Drop At menu list wouldn't correctly display which item was marked after it was changed.
Fixed spawning shape asset handling so it uses whatever the editor's Drop At setting is.
Improved themeing of regular bitmap buttons in the editor.
Based on feedback, flipped layout of Target Module and Target Path in the Create New Asset window.
Improved handling of setting up the Target Path for when creating new assets. If a path is not set, and the user has a Default Module, it will default the path to that module.
2021-08-28 23:51:27 +00:00
|
|
|
AssetBrowser_addModuleWindow.callbackFallthrough = %callback;
|
2020-07-11 21:49:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function AssetBrowser::promptNewModuleFolders(%this)
|
|
|
|
|
{
|
2020-07-24 05:40:03 +00:00
|
|
|
toolsMessageBoxYesNo("Create Folders?",
|
2020-07-11 21:49:06 +00:00
|
|
|
"Do you want to create some common folders for organization of your new Module?",
|
|
|
|
|
"AssetBrowser.makeModuleFolders();", //if yes, make the foldesr
|
|
|
|
|
"AssetBrowser.loadDirectories();"); //if no, just refresh
|
Misc Quality of Life and Bug fixes
Added handling for if preview images on image assets fails to generate, will fallback to using the full image
Added handling for double clicking or drag-n-dropping terrain assets to create them
Improved handling of field labels in variable inspector by making the stringtable be case sensitive.
Added editor settings for handling of asset double click behavior. Can now select between Edit Asset and Spawn Asset. Support is asset type dependent.
Added editor setting for auto-importing loose files when navigating to a folder. If on and the user has flagged to also enable auto-import generally, will auto import all unaffiliated loose files in as assets.
Added editor setting for default module to use when creating new assets. Updated various tooling logic so when creating a new material, if this and the 'Always Prompt Module Target' setting is off, it will fill in the target module and target asset path info based on the default module.
Fixed issue with editors that use managedData scripts where if the path didn't exist, the script file wouldn't be made.
Fixed display issue in terrain editor where if you clear the detail map, the normal/macro/orm maps would disable, but not also clear.
Fixed handling of cleared maps in terrain editor so it no longer fills empty maps in with the no image image.
Fixed handling of creating new material where it would fill in the diffuse with a no texture image as the default.
Fixed issue where canceling out of creating a module would still prompt to create the common default folders.
Fixed issue where the Select Module window couldn't be closed via the cancel or x buttons.
Based on feedback, reduced default size of the Text Pad window.
Fixed issue where the Drop At menu list wouldn't correctly display which item was marked after it was changed.
Fixed spawning shape asset handling so it uses whatever the editor's Drop At setting is.
Improved themeing of regular bitmap buttons in the editor.
Based on feedback, flipped layout of Target Module and Target Path in the Create New Asset window.
Improved handling of setting up the Target Path for when creating new assets. If a path is not set, and the user has a Default Module, it will default the path to that module.
2021-08-28 23:51:27 +00:00
|
|
|
|
|
|
|
|
if(AssetBrowser_addModuleWindow.callbackFallthrough !$= "")
|
|
|
|
|
eval(AssetBrowser_addModuleWindow.callbackFallthrough);
|
2020-07-11 21:49:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function AssetBrowser::makeModuleFolders(%this)
|
|
|
|
|
{
|
|
|
|
|
%moduleId = AssetBrowser.newModuleId;
|
|
|
|
|
%moduleDef = ModuleDatabase.findModule(%moduleId);
|
|
|
|
|
%modulePath = %moduleDef.ModulePath;
|
|
|
|
|
|
|
|
|
|
%count = 0;
|
|
|
|
|
%defaultModuleFolders[%count++] = "datablocks";
|
|
|
|
|
%defaultModuleFolders[%count++] = "terrains";
|
|
|
|
|
%defaultModuleFolders[%count++] = "postFXs";
|
|
|
|
|
%defaultModuleFolders[%count++] = "levels";
|
|
|
|
|
%defaultModuleFolders[%count++] = "shapes";
|
|
|
|
|
%defaultModuleFolders[%count++] = "guis";
|
|
|
|
|
%defaultModuleFolders[%count++] = "scripts";
|
|
|
|
|
%defaultModuleFolders[%count++] = "scripts/client";
|
|
|
|
|
%defaultModuleFolders[%count++] = "scripts/server";
|
|
|
|
|
|
|
|
|
|
for(%i=0; %i <= %count; %i++)
|
|
|
|
|
{
|
|
|
|
|
%this.dirHandler.createFolder(%modulePath @ "/" @ %defaultModuleFolders[%i]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AssetBrowser.loadDirectories();
|
Updated path handling for loose asset files for CPP, Image, Level, Material, PostFX, Shape, Terrain, TerrainMat and StateMachine assets to be more predictable in when and how they expando the loose file path into a full, useable path
Fixed loose file bindings for all associated slots in level asset, such as postFX file, decals, etc
Expanded TSStatic onInspect testcase to parse materialSlots and hook-in a specialized material field for editing/quick reference from the inspector
Adjusted expand behavior of guiTree to be more reliable
Added internal name 'stack' to inspectorGroup's stack child objects for easier access to add programatic fields
Removed redundant PreMult translucency type code
Added setting of feature so probes work when in forward/basic lit mode
Corrected indexing error in SQLiteObject class so it properly parses with the updated console API
Tweaked the FOV setting logic in GameConnection::onControlObjectChange to not be spammy
Fixed var when trying to bind the camera to the client
Added project setting field to dictate the default render mode between Forward or Deferred
Integrated MotionBlur PostFX into updated PostFX Editor paradigm and exposed the samples uniform as an editable field
Integrated DOF PostFX into updated PostFX Editor paradigm
Updated setting group name for vignette postFX
Shifted shaderCache to be in data/cache along with other cached files
Added helper function to replace strings in a file
Fixed ExampleCppObject asset to have correct loose file references
Adjusted editor default level logic so it can be modifed and then stored, as well as reset back to the original default
Fixed verve reference to root scene group
Adjusted location of a nonmodal gui profile so it loads at the correct time
Reorganized AssetBrowser loading and refresh logic so it doesn't stack multiple refresh requests back-to-back causing lag
Updated the search behavior to search not just the current address, but all child folders as well, making it far more useful
Initial work into zip and folder drag-and-drop asset importing support
Removed the import config setting for 'always display material maps' as it is redundant with the new importer context menu actions
Updated example asset type file
Ensured all asset types have proper handling for move, rename and delete actions
Fixed double-click behavior on folders in the AB
Fixed CPP asset preview
Added better logic to discern if a top-level folder belongs to a module or not in the AB directory browser
Added ability to convert a non-module top-level folder in the AB into a module
Added initial hooks for being able to generate a new Editor Tool, similar to how the AB can generate modules
Renamed CPP asset template files to have the .template so they aren't accidentally picked up by cmake
Fixed convex editor's material handling to work with AB and reference back properly
Updated AB images for folder up/down navigation buttons, and the breadcrumb divider arrow
Made PostFX Editor properly allow for input pass-through so you can still edit the level with it open
Added some additional common text gui profiles
Disabled calls to old editor settings logic in various editors to remove spam
Added callOnModules call so tools can initialize properly when the world editor is opened
Fixed logic test for visualizers
Added ability for cmake to scan tools directory for any tools that add source files
2020-02-04 07:47:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function AssetBrowser::createNewEditorTool(%this)
|
|
|
|
|
{
|
|
|
|
|
Canvas.pushDialog(AssetBrowser_AddModule);
|
|
|
|
|
AssetBrowser_addModuleWindow.selectWindow();
|
|
|
|
|
|
|
|
|
|
AssetBrowser_addModuleWindow.callbackFunction = "AssetBrowser.loadDirectories();";
|
|
|
|
|
|
|
|
|
|
AssetBrowser_addModuleWindow.CreateNewModule();
|
2018-01-28 21:30:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function AssetBrowser_editModule::saveModule(%this)
|
|
|
|
|
{
|
|
|
|
|
//Check what special actions we may need to do, such as renames
|
|
|
|
|
%moduleDef = ModuleDatabase.findModule(AssetBrowser.selectedModule, 1);
|
|
|
|
|
|
|
|
|
|
%oldModuleName = %moduleDef.ModuleID;
|
|
|
|
|
|
|
|
|
|
if(%oldModuleName !$= AssetBrowser.tempModule.ModuleID)
|
|
|
|
|
{
|
|
|
|
|
//rename the script file and script namespaces
|
|
|
|
|
%oldScriptFilePath = "data/" @ %oldModuleName @ "/" @ %moduleDef.scriptFile;
|
|
|
|
|
%newscriptFilePath = "data/" @ AssetBrowser.tempModule.ModuleID @ "/";
|
|
|
|
|
%scriptExt = fileExt(%moduleDef.scriptFile);
|
|
|
|
|
|
|
|
|
|
%newScriptFileName = %newscriptFilePath @ "/" @ AssetBrowser.tempModule.ModuleID @ %scriptExt;
|
|
|
|
|
%newScriptFileOldName = %newscriptFilePath @ "/" @ %oldModuleName @ %scriptExt;
|
|
|
|
|
|
|
|
|
|
%moduleDef.ModuleId = AssetBrowser.tempModule.ModuleID;
|
|
|
|
|
%moduleDef.scriptFile = AssetBrowser.tempModule.ModuleID @ %scriptExt;
|
|
|
|
|
|
|
|
|
|
ModuleDatabase.copyModule(%moduleDef, AssetBrowser.tempModule.ModuleID, "data/" @ AssetBrowser.tempModule.ModuleID);
|
|
|
|
|
|
|
|
|
|
//Go through our scriptfile and replace the old namespace with the new
|
|
|
|
|
%editedFileContents = "";
|
|
|
|
|
|
|
|
|
|
%file = new FileObject();
|
|
|
|
|
if ( %file.openForRead( %newScriptFileOldName ) )
|
|
|
|
|
{
|
|
|
|
|
while ( !%file.isEOF() )
|
|
|
|
|
{
|
|
|
|
|
%line = %file.readLine();
|
|
|
|
|
%line = trim( %line );
|
|
|
|
|
|
|
|
|
|
%editedFileContents = %editedFileContents @ strreplace(%line, %oldModuleName, AssetBrowser.tempModule.ModuleID) @ "\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
%file.close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(%editedFileContents !$= "")
|
|
|
|
|
{
|
|
|
|
|
%file.openForWrite(%newScriptFileName);
|
|
|
|
|
|
|
|
|
|
%file.writeline(%editedFileContents);
|
|
|
|
|
|
|
|
|
|
%file.close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
%success = fileDelete(%newScriptFileOldName);
|
|
|
|
|
|
|
|
|
|
ModuleDatabase.unloadExplicit(%oldModuleName);
|
|
|
|
|
|
|
|
|
|
%success = fileDelete("data/" @ %oldModuleName);
|
|
|
|
|
|
|
|
|
|
ModuleDatabase.loadExplicit(AssetBrowser.tempModule.ModuleID);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Now, update the module file itself
|
|
|
|
|
//%file = ModuleDatabase.getAssetFilePath(%moduleDef.ModuleID);
|
|
|
|
|
//%success = TamlWrite(AssetBrowser_editAsset.editedAsset, %file);
|
|
|
|
|
|
|
|
|
|
AssetBrowser.loadFilters();
|
|
|
|
|
|
|
|
|
|
Canvas.popDialog(AssetBrowser_editModule);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function AssetBrowser::editModuleInfo(%this)
|
|
|
|
|
{
|
|
|
|
|
Canvas.pushDialog(AssetBrowser_editModule);
|
|
|
|
|
|
|
|
|
|
%moduleDef = ModuleDatabase.findModule(AssetBrowser.selectedModule, 1);
|
|
|
|
|
|
|
|
|
|
AssetBrowser.tempModule = new ModuleDefinition();
|
|
|
|
|
AssetBrowser.tempModule.assignFieldsFrom(%moduleDef);
|
|
|
|
|
|
|
|
|
|
AssetBrowser_editModule.editedModuleId = AssetBrowser.selectedModule;
|
|
|
|
|
AssetBrowser_editModule.editedModule = AssetBrowser.tempModule;
|
|
|
|
|
|
2019-09-29 11:44:43 +00:00
|
|
|
/// Module configuration.
|
|
|
|
|
ModuleEditInspector.startGroup("General");
|
|
|
|
|
ModuleEditInspector.addField("ModuleId", "ModuleId", "string", "", AssetBrowser.tempModule.ModuleId, "", AssetBrowser.tempModule);
|
|
|
|
|
ModuleEditInspector.addField("VersionId", "VersionId", "string", "", AssetBrowser.tempModule.VersionId, "", AssetBrowser.tempModule);
|
|
|
|
|
ModuleEditInspector.addField("BuildId", "BuildId", "string", "", AssetBrowser.tempModule.BuildId, "", AssetBrowser.tempModule);
|
|
|
|
|
ModuleEditInspector.addField("enabled", "enabled", "bool", "", AssetBrowser.tempModule.enabled, "", AssetBrowser.tempModule);
|
|
|
|
|
ModuleEditInspector.addField("Description", "Description", "command", "", AssetBrowser.tempModule.Description, "", AssetBrowser.tempModule);
|
|
|
|
|
ModuleEditInspector.addField("Group", "Group", "string", "", AssetBrowser.tempModule.Group, "", AssetBrowser.tempModule);
|
|
|
|
|
ModuleEditInspector.endGroup();
|
|
|
|
|
|
|
|
|
|
ModuleEditInspector.startGroup("Management");
|
|
|
|
|
ModuleEditInspector.addField("Synchronized", "Synchronized", "bool", "", AssetBrowser.tempModule.Synchronized, "", AssetBrowser.tempModule);
|
|
|
|
|
ModuleEditInspector.addField("Deprecated", "Deprecated", "bool", "", AssetBrowser.tempModule.Deprecated, "", AssetBrowser.tempModule);
|
|
|
|
|
ModuleEditInspector.addField("CriticalMerge", "CriticalMerge", "bool", "", AssetBrowser.tempModule.CriticalMerge, "", AssetBrowser.tempModule);
|
|
|
|
|
ModuleEditInspector.addField("OverrideExistingObjects", "OverrideExistingObjects", "bool", "", AssetBrowser.tempModule.OverrideExistingObjects, "", AssetBrowser.tempModule);
|
|
|
|
|
ModuleEditInspector.endGroup();
|
|
|
|
|
|
|
|
|
|
ModuleEditInspector.startGroup("Meta");
|
|
|
|
|
ModuleEditInspector.addField("Author", "Author", "string", "", AssetBrowser.tempModule.Author, "", AssetBrowser.tempModule);
|
|
|
|
|
ModuleEditInspector.addField("Type", "Type", "string", "", AssetBrowser.tempModule.Type, "", AssetBrowser.tempModule);
|
|
|
|
|
ModuleEditInspector.endGroup();
|
|
|
|
|
|
|
|
|
|
ModuleEditInspector.startGroup("Script");
|
|
|
|
|
ModuleEditInspector.addField("ScriptFile", "ScriptFile", "string", "", AssetBrowser.tempModule.ScriptFile, "", AssetBrowser.tempModule);
|
|
|
|
|
ModuleEditInspector.addField("CreateFunction", "CreateFunction", "string", "", AssetBrowser.tempModule.CreateFunction, "", AssetBrowser.tempModule);
|
|
|
|
|
ModuleEditInspector.addField("DestroyFunction", "DestroyFunction", "string", "", AssetBrowser.tempModule.DestroyFunction, "", AssetBrowser.tempModule);
|
|
|
|
|
ModuleEditInspector.endGroup();
|
|
|
|
|
|
|
|
|
|
ModuleEditInspector.startGroup("Dependencies");
|
|
|
|
|
ModuleEditInspector.addField("ModuleDependencies", "Module Dependencies", "ModuleDependenciesButton", "", "", "", AssetBrowser.tempModule);
|
|
|
|
|
ModuleEditInspector.endGroup();
|
2018-01-28 21:30:17 +00:00
|
|
|
}
|
|
|
|
|
|
2020-03-19 14:47:38 +00:00
|
|
|
function AssetBrowser::editModuleScript(%this)
|
|
|
|
|
{
|
|
|
|
|
%moduleDef = ModuleDatabase.findModule(AssetBrowser.selectedModule, 1);
|
|
|
|
|
|
|
|
|
|
%scriptFile = %moduleDef.ModuleScriptFilePath;
|
|
|
|
|
|
|
|
|
|
EditorOpenFileInTorsion(makeFullPath(%scriptFile), 0);
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-28 21:30:17 +00:00
|
|
|
function AssetBrowser::renameModule(%this)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function AssetBrowser::reloadModule(%this)
|
|
|
|
|
{
|
|
|
|
|
ModuleDatabase.unregisterModule(AssetBrowser.SelectedModule, 1);
|
|
|
|
|
ModuleDatabase.loadExplicit(AssetBrowser.SelectedModule);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function AssetBrowser::deleteModule(%this)
|
|
|
|
|
{
|
2020-12-03 06:15:24 +00:00
|
|
|
%moduleDef = ModuleDatabase.findModule(AssetBrowser.selectedModule, 1);
|
|
|
|
|
|
|
|
|
|
toolsMessageBoxYesNo("Delete Module?",
|
|
|
|
|
"This will permanently delete the module " @ %moduleDef.moduleId @ " and all it's contents. <br><br> Do you wish to continue?",
|
|
|
|
|
"AssetBrowser.doDeleteModule();",
|
|
|
|
|
"");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function AssetBrowser::doDeleteModule(%this)
|
|
|
|
|
{
|
|
|
|
|
//First, get the module path
|
|
|
|
|
%moduleDef = ModuleDatabase.findModule(AssetBrowser.selectedModule, 1);
|
|
|
|
|
%modulePath = %moduleDef.ModulePath;
|
|
|
|
|
|
|
|
|
|
//Next, unregister the module
|
|
|
|
|
ModuleDatabase.unregisterModule(AssetBrowser.SelectedModule, 1);
|
|
|
|
|
|
|
|
|
|
//Then, delete it
|
|
|
|
|
%this.deleteFolder(%modulePath);
|
|
|
|
|
|
|
|
|
|
//Remove the module def
|
|
|
|
|
%moduleDef.delete();
|
2018-01-28 21:30:17 +00:00
|
|
|
|
2020-12-03 06:15:24 +00:00
|
|
|
//And refresh the browser
|
|
|
|
|
%this.loadDirectories();
|
2018-01-28 21:30:17 +00:00
|
|
|
}
|
|
|
|
|
|
2019-12-08 21:54:37 +00:00
|
|
|
function AssetBrowser::RefreshModuleDependencies(%this, %moduleDef)
|
2018-01-28 21:30:17 +00:00
|
|
|
{
|
|
|
|
|
//Iterate through all our modules
|
|
|
|
|
|
|
|
|
|
//then, iterate through the module's assets
|
|
|
|
|
|
|
|
|
|
//if an asset has a module that isn't us, queue that into the dependencies list
|
2019-12-08 21:54:37 +00:00
|
|
|
|
|
|
|
|
//AssetBrowser.RefreshModuleDependencies(16823);
|
|
|
|
|
%modulePath = filePath(%moduleDef.ModuleFilePath);
|
|
|
|
|
|
2021-01-07 11:01:09 +00:00
|
|
|
%filePattern = "*." @ $TorqueScriptFileExtension TAB "*.taml" TAB "*.mis";
|
2019-12-08 21:54:37 +00:00
|
|
|
|
|
|
|
|
//First, wipe out any files inside the folder first
|
|
|
|
|
%file = makeFullPath(findFirstFileMultiExpr( %filePattern, true));
|
|
|
|
|
%fileObj = new FileObject();
|
|
|
|
|
|
|
|
|
|
%modulesList = ModuleDatabase.findModules(false);
|
|
|
|
|
|
|
|
|
|
new ArrayObject(moduleDepList);
|
|
|
|
|
|
|
|
|
|
while( %file !$= "" )
|
|
|
|
|
{
|
|
|
|
|
if(startsWith(%file, %modulePath))
|
|
|
|
|
{
|
|
|
|
|
if(%fileObj.openForRead(%file))
|
|
|
|
|
{
|
|
|
|
|
while( !%fileObj.isEOF() )
|
|
|
|
|
{
|
|
|
|
|
%line = %fileObj.readLine();
|
|
|
|
|
|
|
|
|
|
if(%line $= "")
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
for(%i=0; %i < getWordCount(%modulesList); %i++)
|
|
|
|
|
{
|
|
|
|
|
%moduleName = getWord(%modulesList, %i).moduleID;
|
|
|
|
|
|
|
|
|
|
//if(%moduleName $= %moduleDef.moduleID)
|
|
|
|
|
// continue;
|
|
|
|
|
|
|
|
|
|
%hasMatch = strIsMatchExpr( "*"@%moduleName@":*", %line );
|
|
|
|
|
|
|
|
|
|
if(%hasMatch)
|
|
|
|
|
{
|
|
|
|
|
moduleDepList.add(%moduleName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
%file = makeFullPath(findNextFileMultiExpr( %filePattern ));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
%fileObj.delete();
|
2018-01-28 21:30:17 +00:00
|
|
|
}
|