2018-01-28 21:30:17 +00:00
function AssetBrowser_editAsset::saveAsset(%this)
{
%file = AssetDatabase.getAssetFilePath(%this.editedAssetId);
%success = TamlWrite(AssetBrowser_editAsset.editedAsset, %file);
2021-09-04 07:27:21 +00:00
AssetBrowser.reloadAsset(%this.editedAssetId);
AssetBrowser.refresh();
2021-09-05 08:43:41 +00:00
%assetType = AssetDatabase.getAssetType(%this.editedAssetId);
%assetDef = AssetDatabase.acquireAsset(%this.editedAssetId);
AssetBrowser.call("on" @ %assetType @ "Changed", %assetDef);
AssetDatabase.releaseAsset(%this.editedAssetId);
2018-01-28 21:30:17 +00:00
Canvas.popDialog(AssetBrowser_editAsset);
}
2019-05-04 16:49:42 +00:00
function AssetBrowser::editAsset(%this, %assetDef)
2018-01-28 21:30:17 +00:00
{
//Find out what type it is
2019-05-04 16:49:42 +00:00
//If the passed-in definition param is blank, then we're likely called via a popup
if(%assetDef $= "")
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
{
if(AssetDatabase.isDeclaredAsset(EditAssetPopup.assetId))
{
%assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId);
}
else
{
//if it's not a valid asset at all, then it's probably a folder
%folder = strreplace(EditAssetPopup.assetId, ":", "/");
if(isDirectory(%folder))
{
AssetBrowser.navigateTo(%folder);
}
}
}
2021-07-21 01:05:49 +00:00
else if(AssetDatabase.isDeclaredAsset(%assetDef))
2020-11-02 05:32:34 +00:00
{
//Turns out we were passed an assetid, not an asset definition.
//Grab the asset def from that
%assetDef = AssetDatabase.acquireAsset(%assetDef);
}
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
2018-01-28 21:30:17 +00:00
2019-05-04 16:49:42 +00:00
%assetType = %assetDef.getClassName();
//Build out the edit command
%buildCommand = %this @ ".edit" @ %assetType @ "(" @ %assetDef @ ");";
eval(%buildCommand);
}
function AssetBrowser::appendSubLevel(%this)
{
%assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId);
%assetType = %assetDef.getClassName();
2018-01-28 21:30:17 +00:00
2019-05-04 16:49:42 +00:00
schedule( 1, 0, "EditorOpenSceneAppend", %assetDef);
2018-01-28 21:30:17 +00:00
}
function AssetBrowser::editAssetInfo(%this)
{
Canvas.pushDialog(AssetBrowser_editAsset);
%assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId);
eval("AssetBrowser.tempAsset = new " @ %assetDef.getClassName() @ "();");
AssetBrowser.tempAsset.assignFieldsFrom(%assetDef);
AssetEditInspector.inspect(AssetBrowser.tempAsset);
AssetBrowser_editAsset.editedAssetId = EditAssetPopup.assetId;
AssetBrowser_editAsset.editedAsset = AssetBrowser.tempAsset;
//remove some of the groups we don't need:
for(%i=0; %i < AssetEditInspector.getCount(); %i++)
{
%caption = AssetEditInspector.getObject(%i).caption;
if(%caption $= "Ungrouped" || %caption $= "Object" || %caption $= "Editing"
|| %caption $= "Persistence" || %caption $= "Dynamic Fields")
{
AssetEditInspector.remove(AssetEditInspector.getObject(%i));
%i--;
}
}
}
//------------------------------------------------------------
2021-09-04 07:27:21 +00:00
function AssetBrowser::reloadAsset(%this, %assetId)
{
%moduleName = getToken(%assetId, ":", 0);
%moduleDef = ModuleDatabase.findModule(%moduleName);
%assetName = getToken(%assetId, ":", 1);
%assetFilePath = AssetDatabase.getAssetFilePath(%assetId);
AssetDatabase.removeDeclaredAsset(%assetId);
AssetDatabase.addDeclaredAsset(%moduleDef, %assetFilePath);
}
2018-01-28 21:30:17 +00:00
function AssetBrowser::refreshAsset(%this, %assetId)
{
if(%assetId $= "")
{
//if we have no passed-in asset ID, we're probably going through the popup menu, so get our edit popup id
%assetId = EditAssetPopup.assetId;
}
AssetDatabase.refreshAsset(%assetId);
2019-12-03 06:09:18 +00:00
%this.refresh();
2018-01-28 21:30:17 +00:00
}
//------------------------------------------------------------
2022-04-04 01:00:30 +00:00
function AssetBrowser::regeneratePreviewImage(%this)
{
%assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId);
%dummyObj = new ScriptObject();
%regenCommand = "AssetBrowser.build" @ EditAssetPopup.assetType @
"Preview(" @%assetDef @ "," @ %dummyObj @ ", true);";
eval(%regenCommand);
2018-01-28 21:30:17 +00:00
2022-04-04 01:00:30 +00:00
%dummyObj.delete();
AssetDatabase.releaseAsset(EditAssetPopup.assetId);
}
//------------------------------------------------------------
2018-01-28 21:30:17 +00:00
function AssetBrowser::renameAsset(%this)
{
//Find out what type it is
2019-10-20 07:47:15 +00:00
//%assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId);
2018-01-28 21:30:17 +00:00
%curFirstResponder = AssetBrowser.getFirstResponder();
if(%curFirstResponder != 0)
%curFirstResponder.clearFirstResponder();
2019-12-23 18:37:55 +00:00
if(EditFolderPopup.visible == false)
{
AssetBrowser.selectedAssetPreview-->AssetNameLabel.setActive(true);
AssetBrowser.selectedAssetPreview-->AssetNameLabel.setFirstResponder();
}
2018-01-28 21:30:17 +00:00
}
2019-05-04 16:49:42 +00:00
function AssetBrowser::performRenameAsset(%this, %originalAssetName, %newName)
2018-01-28 21:30:17 +00:00
{
//if the name is different to the asset's original name, rename it!
2019-05-04 16:49:42 +00:00
if(%originalAssetName !$= %newName)
2018-01-28 21:30:17 +00:00
{
2019-12-23 18:37:55 +00:00
%moduleName = AssetBrowser.selectedModule;
2019-10-20 07:47:15 +00:00
if(EditAssetPopup.assetType !$= "Folder")
2018-01-28 21:30:17 +00:00
{
2019-12-23 18:37:55 +00:00
if(%this.isMethod("rename" @ EditAssetPopup.assetType))
2019-10-20 07:47:15 +00:00
{
2019-12-23 18:37:55 +00:00
%oldAssetId = %moduleName @ ":" @ %originalAssetName;
%assetDef = AssetDatabase.acquireAsset(%oldAssetId);
2019-10-20 07:47:15 +00:00
//Do the rename command
2019-12-23 18:37:55 +00:00
%buildCommand = %this @ ".rename" @ EditAssetPopup.assetType @ "(" @ %assetDef @ "," @ %newName @ ");";
2019-10-20 07:47:15 +00:00
eval(%buildCommand);
}
}
else
{
%buildCommand = %this @ ".renameFolder(\"" @ EditAssetPopup.assetId @ "\",\"" @ %newName @ "\");";
eval(%buildCommand);
2018-01-28 21:30:17 +00:00
}
}
2019-05-04 16:49:42 +00:00
//Make sure everything is refreshed
2019-12-03 06:09:18 +00:00
%this.refresh();
2019-10-20 07:47:15 +00:00
//Update the selection to immediately jump to the new asset
AssetBrowser-->filterTree.clearSelection();
%ModuleItem = AssetBrowser-->filterTree.findItemByName(%moduleName);
2021-05-05 02:49:19 +00:00
// TODO is this correct?
2022-03-27 08:05:48 +00:00
/*%assetType = %ModuleItem.getClassName();
2021-05-05 02:49:19 +00:00
2019-10-20 07:47:15 +00:00
%assetTypeId = AssetBrowser-->filterTree.findChildItemByName(%ModuleItem, %assetType);
AssetBrowser-->filterTree.selectItem(%assetTypeId);
%selectedItem = AssetBrowser-->filterTree.getSelectedItem();
AssetBrowser-->filterTree.scrollVisibleByObjectId(%selectedItem);
2022-03-27 08:05:48 +00:00
AssetBrowser-->filterTree.buildVisibleTree();*/
2019-05-04 16:49:42 +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 renameAssetFile(%assetDef, %newName)
{
%assetId = %assetDef.getAssetID();
%module = AssetDatabase.getAssetModule(%assetId);
%moduleId = %module.moduleId;
%assetPath = AssetDatabase.getAssetFilePath(%assetId);
%newPath = filePath(%assetPath) @ "/" @ %newName @ ".asset.taml";
%copiedSuccess = pathCopy(%assetPath, %newPath);
if(!%copiedSuccess)
return "";
%deleteSuccess = fileDelete(%assetPath);
if(!%deleteSuccess)
return "";
//Remove the old declaration
AssetDatabase.removeDeclaredAsset(%assetId);
//Add with the new file
AssetDatabase.addDeclaredAsset(%module, %newPath);
//Perform the rename in the file/system itself
AssetDatabase.renameDeclaredAsset(%assetId, %moduleId @ ":" @ %newName);
}
function renameAssetLooseFile(%file, %newName)
{
%newPath = filePath(%file) @ "/" @ %newName @ fileExt(%file);
%copiedSuccess = pathCopy(%file, %newPath);
if(!%copiedSuccess)
return "";
%deleteSuccess = fileDelete(%file);
if(!%deleteSuccess)
return "";
return fileName(%newPath);
}
2019-05-04 16:49:42 +00:00
function AssetNameField::onReturn(%this)
{
2018-01-28 21:30:17 +00:00
%this.clearFirstResponder();
%this.setActive(false);
2019-05-04 16:49:42 +00:00
AssetBrowser.performRenameAsset(%this.originalAssetName, %this.getText());
2018-01-28 21:30:17 +00:00
}
2019-10-20 07:47:15 +00:00
//------------------------------------------------------------
2019-11-24 12:52:34 +00:00
function AssetBrowser::moveAsset(%this, %assetId, %destination)
2019-10-20 07:47:15 +00:00
{
if(EditAssetPopup.assetType $= "Folder")
{
//Do any cleanup required given the type
if(%this.isMethod("moveFolder"))
2019-12-23 18:37:55 +00:00
eval(%this @ ".moveFolder("@%assetId@",\""@%destination@"\");");
2019-10-20 07:47:15 +00:00
}
else
{
2019-11-24 12:52:34 +00:00
%assetDef = AssetDatabase.acquireAsset(%assetId);
%assetType = AssetDatabase.getAssetType(%assetId);
2019-10-20 07:47:15 +00:00
//Do any cleanup required given the type
if(%this.isMethod("move"@%assetType))
2019-11-24 12:52:34 +00:00
{
%command = %this @ ".move" @ %assetType @ "(" @ %assetDef @ ",\"" @ %destination @ "\");";
eval(%this @ ".move" @ %assetType @ "(" @ %assetDef @ ",\"" @ %destination @ "\");");
}
2019-10-20 07:47:15 +00:00
}
2019-12-03 06:09:18 +00:00
%this.refresh();
2019-10-20 07:47:15 +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 moveAssetFile(%assetDef, %destinationPath)
{
%assetPath = makeFullPath(AssetDatabase.getAssetFilePath(%assetDef.getAssetId()));
%assetFilename = fileName(%assetPath);
2021-05-05 02:49:19 +00:00
%newAssetPath = %destinationPath @ "/" @ %assetFilename;
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
2021-05-05 02:49:19 +00:00
%copiedSuccess = pathCopy(%assetPath, %destinationPath @ "/" @ %assetFilename);
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
if(!%copiedSuccess)
return "";
%deleteSuccess = fileDelete(%assetPath);
if(!%deleteSuccess)
return "";
return %newAssetPath;
}
function moveAssetLooseFile(%file, %destinationPath)
{
%filename = fileName(%file);
%copiedSuccess = pathCopy(%file, %destinationPath @ "/" @ %filename);
if(!%copiedSuccess)
return false;
%deleteSuccess = fileDelete(%file);
return %deleteSuccess;
}
2018-01-28 21:30:17 +00:00
//------------------------------------------------------------
2020-04-05 06:28:34 +00:00
function AssetBrowser::duplicateAsset(%this)
2018-01-28 21:30:17 +00:00
{
2020-04-05 06:28:34 +00:00
%assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId);
%assetType = AssetDatabase.getAssetType(EditAssetPopup.assetId);
%trailingNum = getTrailingNumber(%assetDef.assetName);
if(%trailingNum != -1)
{
%trailingNum++;
%newName = stripTrailingNumber(%assetDef.assetName) @ (%trailingNum);
}
else
2019-05-04 16:49:42 +00:00
{
2020-04-05 06:28:34 +00:00
%newName = stripTrailingNumber(%assetDef.assetName) @ "1";
2019-05-04 16:49:42 +00:00
}
2020-04-05 06:28:34 +00:00
AssetBrowser_assetNameEditTxt.text = %newName;
AssetBrowser_assetNameEdit.callback = "AssetBrowser.doDuplicateAsset();";
if(EditorSettings.value("AssetManagement/Assets/promptOnRename", "1") == 1)
Canvas.pushDialog(AssetBrowser_assetNameEdit);
else
eval(AssetBrowser_assetNameEdit.callback);
}
function AssetBrowser::doDuplicateAsset(%this)
{
2018-01-28 21:30:17 +00:00
%assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId);
2019-05-04 16:49:42 +00:00
%assetType = AssetDatabase.getAssetType(EditAssetPopup.assetId);
2018-01-28 21:30:17 +00:00
2020-04-05 06:28:34 +00:00
if(AssetBrowser_assetNameEditTxt.text !$= "" && AssetBrowser_assetNameEditTxt.text !$= %assetDef.assetName)
{
//this acts as a redirect based on asset type and will enact the appropriate function
//so for a GameObjectAsset, it'll become %this.duplicateGameObjectAsset(%assetDef, %targetModule);
2020-12-12 15:54:16 +00:00
//and call to the tools/assetBrowser/scripts/assetTypes/gameObject.tscript file for implementation
2020-04-05 06:28:34 +00:00
if(%this.isMethod("duplicate"@%assetType))
eval(%this @ ".duplicate"@%assetType@"("@%assetDef@","@AssetBrowser_assetNameEditTxt.text@");");
AssetBrowser.refresh();
}
}
function duplicateAssetFile(%assetDef, %newAssetName)
{
%assetPath = makeFullPath(AssetDatabase.getAssetFilePath(%assetDef.getAssetId()));
%assetFilepath = filePath(%assetPath);
%assetFileExt = fileExt(%assetPath);
%newAssetPath = %assetFilepath @ "/" @ %newAssetName @ ".asset.taml";
%copiedSuccess = pathCopy(%assetPath, %newAssetPath);
if(!%copiedSuccess)
return "";
replaceInFile(%newAssetPath, %assetDef.assetName, %newAssetName);
%module = AssetBrowser.dirHandler.getModuleFromAddress(%newAssetPath);
//Add with the new file
AssetDatabase.addDeclaredAsset(%module, %newAssetPath);
return %newAssetPath;
2018-01-28 21:30:17 +00:00
}
2020-04-05 06:28:34 +00:00
function duplicateAssetLooseFile(%file, %newFilename)
{
%filePath = filePath(%file);
%fileExt = fileExt(%file);
%newPath = %filePath @ "/" @ %newFilename @ %fileExt;
%copiedSuccess = pathCopy(%file, %newPath);
if(!%copiedSuccess)
return "";
return %newPath;
}
//------------------------------------------------------------
2018-01-28 21:30:17 +00:00
function AssetBrowser::deleteAsset(%this)
{
//Find out what type it is
2019-10-20 07:47:15 +00:00
//%assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId);
//%assetType = %assetDef.getClassName();
2018-01-28 21:30:17 +00:00
2020-07-24 05:40:03 +00:00
toolsMessageBoxOKCancel("Warning!", "This will delete the selected content and the files associated to it, do you wish to continue?",
2018-01-28 21:30:17 +00:00
"AssetBrowser.confirmDeleteAsset();", "");
}
function AssetBrowser::confirmDeleteAsset(%this)
{
%currentSelectedItem = AssetBrowserFilterTree.getSelectedItem();
%currentItemParent = AssetBrowserFilterTree.getParentItem(%currentSelectedItem);
2019-12-03 06:09:18 +00:00
if(EditFolderPopup.visible)
2019-10-20 07:47:15 +00:00
{
2019-12-03 06:09:18 +00:00
if(EditFolderPopup.dirPath !$= "")
%folderPath = EditFolderPopup.dirPath;
else
%folderPath = AssetBrowserFilterTree.getItemValue(%currentSelectedItem) @ "/" @ AssetBrowserFilterTree.getItemText(%currentSelectedItem);
2019-10-20 07:47:15 +00:00
if(%this.isMethod("deleteFolder"))
2019-12-03 06:09:18 +00:00
eval(%this @ ".deleteFolder(\""@%folderPath@"\");");
}
2019-10-20 07:47:15 +00:00
else
{
%assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId);
%assetType = AssetDatabase.getAssetType(EditAssetPopup.assetType);
2019-12-03 06:09:18 +00:00
if(!isObject(%assetDef))
return;
2019-10-20 07:47:15 +00:00
//Do any cleanup required given the type
if(%this.isMethod("delete"@%assetType))
eval(%this @ ".delete"@%assetType@"("@%assetDef@");");
2019-12-03 06:09:18 +00:00
AssetDatabase.deleteAsset(EditAssetPopup.assetId, true, false);
2019-10-20 07:47:15 +00:00
}
2019-05-04 16:49:42 +00:00
2019-12-03 06:09:18 +00:00
%this.refresh();
2018-01-28 21:30:17 +00:00
}
2019-12-08 21:54:37 +00:00
//------------------------------------------------------------
function AssetBrowser::updateAssetReference(%this, %targetPath, %oldAssetId, %newAssetId)
{
//assetbrowser.updateAssetReference("data/pbr/levels", "pbr:material_ball", "TreeTest:TestTree");
//this will go through every file in the game directory and swap the assetIDs to update the reference in the event something was renamed, or something was moved
//This is potentially disastrous and break a lot of things if done hapazardly, so be careful
%fullPath = makeFullPath(%targetPath);
//First, wipe out any files inside the folder first
%file = findFirstFileMultiExpr( %fullPath @ "/*.*", true);
%fileObj = new FileObject();
new ArrayObject(lineCache);
while( %file !$= "" )
{
lineCache.empty();
%fileModified = false;
if(%fileObj.openForRead(%file))
{
while( !%fileObj.isEOF() )
{
%unModLine = %fileObj.readLine();
%line = strreplace( %unModLine, %oldAssetId, %newAssetId );
if(%unModLine !$= %line)
%fileModified = true;
lineCache.add(%line);
}
}
if(%fileModified && %fileObj.openForWrite(%file))
{
for(%i=0; %i<lineCache.count(); %i++)
{
%line = lineCache.getKey(%i);
%fileObj.writeline(%line);
}
%fileObj.close();
}
%file = findNextFileMultiExpr( %fullPath @ "/*.*" );
}
lineCache.delete();
%fileObj.delete();
2022-04-06 06:08:20 +00:00
}
function AssetBrowser::openFileLocation(%this)
{
%filePath = "";
if(EditAssetPopup.assetId !$= "")
{
%filePath = AssetDatabase.getAssetPath(EditAssetPopup.assetId);
}
else if(EditLevelAssetPopup.assetId !$= "")
{
%filePath = AssetDatabase.getAssetPath(EditAssetPopup.assetId);
}
else if(EditTerrainAssetPopup.assetId !$= "")
{
%filePath = AssetDatabase.getAssetPath(EditAssetPopup.assetId);
}
if(%filePath !$= "")
{
if($platform $= "windows")
{
%cmd = "cd \"" @ makeFullPath(%filePath) @ "\" && start .";
systemCommand(%cmd);
}
else
{
%cmd = "open \"" @ makeFullPath(%filePath) @ "\"";
systemCommand(%cmd);
}
}
}
function AssetBrowser::openFolderLocation(%this)
{
%filePath = AssetBrowser.dirHandler.currentAddress;
if(%filePath !$= "")
{
if($platform $= "windows")
{
%cmd = "cd \"" @ makeFullPath(%filePath) @ "\" && start .";
systemCommand(%cmd);
}
else
{
%cmd = "open \"" @ makeFullPath(%filePath) @ "\"";
systemCommand(%cmd);
}
}
2019-12-08 21:54:37 +00:00
}