mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 23:24:41 +00:00
Merge branch 'MiscQOLFixes20210828' of https://github.com/Areloch/Torque3D into Preview4_0
This commit is contained in:
commit
25a32cba2a
26 changed files with 330 additions and 204 deletions
|
|
@ -32,7 +32,7 @@ function AssetBrowser_addModuleWindow::onGainFirstResponder(%this)
|
|||
function AssetBrowser_addModuleWindow::close()
|
||||
{
|
||||
Canvas.popDialog(AssetBrowser_addModule);
|
||||
eval(AssetBrowser_addModuleWindow.callbackFunction);
|
||||
//eval(AssetBrowser_addModuleWindow.callbackFunction);
|
||||
}
|
||||
|
||||
function AssetBrowser_addModuleWindow::CreateNewModule(%this)
|
||||
|
|
@ -127,4 +127,9 @@ function AssetBrowserModuleList::refresh(%this)
|
|||
%moduleName = getWord(%moduleList, %i);
|
||||
%this.add(%moduleName.ModuleId, %i);
|
||||
}
|
||||
}
|
||||
|
||||
function AssetBrowserSelModuleAddBtn::onClick(%this)
|
||||
{
|
||||
AssetBrowser.CreateNewModule("AssetBrowser_selectModule.newModuleAdded();");
|
||||
}
|
||||
|
|
@ -36,7 +36,10 @@ function AssetBrowser::initialize(%this)
|
|||
new ArrayObject(AssetPreviewArray);
|
||||
|
||||
if(!isObject(%this.dirHandler))
|
||||
{
|
||||
%this.dirHandler = makedirectoryHandler(AssetBrowser-->filterTree, "cache,shaderCache", "");
|
||||
%this.dirHandler.currentAddress = "data/";
|
||||
}
|
||||
|
||||
AssetBrowser-->filterTree.buildIconTable( ":tools/classIcons/Prefab:tools/classIcons/Prefab" @
|
||||
":tools/classIcons/SimSet:tools/classIcons/SimSet");
|
||||
|
|
@ -2090,7 +2093,14 @@ function AssetBrowser::navigateTo(%this, %address, %historyNav)
|
|||
|
||||
if(%this.hasLooseFilesInDir())
|
||||
{
|
||||
if(EditorSettings.value("Assets/AutoImportLooseFiles", false) && EditorSettings.value("Assets/AutoImport", false))
|
||||
{
|
||||
AssetBrowser.autoImportSimpleLooseFiles();
|
||||
}
|
||||
else
|
||||
{
|
||||
%this-->AutoImportAssetButton.visible = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -196,6 +196,8 @@ function AssetBrowser::buildImageAssetPreview(%this, %assetDef, %previewData)
|
|||
|
||||
%success = saveScaledImage(%assetDef.getImagePath(), %previewFilePath);
|
||||
|
||||
if(%success)
|
||||
{
|
||||
%previewAsset = new ImageAsset()
|
||||
{
|
||||
assetName = %previewAssetName;
|
||||
|
|
@ -203,15 +205,26 @@ function AssetBrowser::buildImageAssetPreview(%this, %assetDef, %previewData)
|
|||
imageFile = fileName(%previewFilePath);
|
||||
};
|
||||
|
||||
%previewAssetName = "ToolsModule:" @ %previewAssetName;
|
||||
%previewImgAssetPath = %previewPath @ %previewAsset.assetName @ ".asset.taml";
|
||||
%assetImportSuccessful = TAMLWrite(%previewAsset, %previewImgAssetPath);
|
||||
|
||||
%toolsModuleDef = ModuleDatabase.findModule("ToolsModule",1);
|
||||
|
||||
%success = AssetDatabase.addDeclaredAsset(%toolsModuleDef, %previewImgAssetPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
%previewFilePath = %assetDef.getImagePath();
|
||||
%previewAssetName = %module.moduleId @ ":" @ %assetDef.assetName;
|
||||
}
|
||||
|
||||
hideEditorLoadingGui();
|
||||
}
|
||||
else
|
||||
{
|
||||
%previewAssetName = "ToolsModule:" @ %previewAssetName;
|
||||
}
|
||||
|
||||
//Revalidate. If it didn't work, just use the default placeholder one
|
||||
if(!isFile(%previewFilePath))
|
||||
|
|
@ -220,7 +233,7 @@ function AssetBrowser::buildImageAssetPreview(%this, %assetDef, %previewData)
|
|||
%previewData.assetName = %assetDef.assetName;
|
||||
%previewData.assetPath = %assetDef.scriptFile;
|
||||
|
||||
%previewData.previewImage = "ToolsModule:" @ %previewAssetName;//%assetDef.fileName;
|
||||
%previewData.previewImage = %previewAssetName;
|
||||
|
||||
%previewData.assetFriendlyName = %assetDef.assetName;
|
||||
%previewData.assetDesc = %assetDef.description;
|
||||
|
|
|
|||
|
|
@ -318,30 +318,20 @@ function AssetBrowser::buildShapeAssetPreview(%this, %assetDef, %previewData)
|
|||
"Shape File path: " @ %assetDef.getShapeFile();
|
||||
|
||||
if(%this.selectMode)
|
||||
{
|
||||
%previewData.doubleClickCommand = "AssetBrowser.selectAsset( AssetBrowser.selectedAsset );";
|
||||
}
|
||||
else
|
||||
{
|
||||
if(EditorSettings.value("Assets/Browser/doubleClickAction", "Edit Asset") $= "Edit Asset")
|
||||
%previewData.doubleClickCommand = "AssetBrowser.editAsset( "@%assetDef@" );";
|
||||
else
|
||||
%previewData.doubleClickCommand = "AssetBrowser.onShapeAssetEditorDropped( "@%assetDef@" );";
|
||||
}
|
||||
}
|
||||
|
||||
function AssetBrowser::onShapeAssetEditorDropped(%this, %assetDef, %position)
|
||||
{
|
||||
//echo("DROPPED A SHAPE ON THE EDITOR WINDOW!");
|
||||
|
||||
%targetPosition = EWorldEditor.unproject(%position SPC 1000);
|
||||
%camPos = LocalClientConnection.camera.getPosition();
|
||||
%rayResult = containerRayCast(%camPos, %targetPosition, -1);
|
||||
|
||||
%pos = EWCreatorWindow.getCreateObjectPosition();
|
||||
|
||||
if(%rayResult != 0)
|
||||
{
|
||||
%pos = getWords(%rayResult, 1, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
%pos = "0 0 0";
|
||||
}
|
||||
|
||||
%assetId = %assetDef.getAssetId();
|
||||
|
||||
%newStatic = new TSStatic()
|
||||
|
|
@ -354,6 +344,8 @@ function AssetBrowser::onShapeAssetEditorDropped(%this, %assetDef, %position)
|
|||
|
||||
EWorldEditor.clearSelection();
|
||||
EWorldEditor.selectObject(%newStatic);
|
||||
|
||||
EWorldEditor.dropSelection();
|
||||
|
||||
EWorldEditor.isDirty = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -148,6 +148,11 @@ function AssetBrowser::dragAndDropTerrainAsset(%this, %assetDef, %dropTarget)
|
|||
return;
|
||||
}
|
||||
|
||||
function AssetBrowser::onTerrainAssetEditorDropped(%this, %assetDef, %position)
|
||||
{
|
||||
createTerrainBlock(%assetDef.getAssetId());
|
||||
}
|
||||
|
||||
function AssetBrowser::renameTerrainAsset(%this, %assetDef, %newAssetId, %originalName, %newName)
|
||||
{
|
||||
}
|
||||
|
|
@ -160,7 +165,6 @@ function AssetBrowser::buildTerrainAssetPreview(%this, %assetDef, %previewData)
|
|||
{
|
||||
%previewData.assetName = %assetDef.assetName;
|
||||
%previewData.assetPath = "";
|
||||
%previewData.doubleClickCommand = "";
|
||||
|
||||
%previewData.previewImage = "ToolsModule:gameObjectIcon_image";
|
||||
|
||||
|
|
@ -170,6 +174,18 @@ function AssetBrowser::buildTerrainAssetPreview(%this, %assetDef, %previewData)
|
|||
"\nAsset Type: Terrain Asset" @
|
||||
"\nAsset Definition ID: " @ %assetDef @
|
||||
"\nDefinition Path: " @ %assetDef.getTerrainFilePath();
|
||||
|
||||
if(%this.selectMode)
|
||||
{
|
||||
%previewData.doubleClickCommand = "AssetBrowser.selectAsset( AssetBrowser.selectedAsset );";
|
||||
}
|
||||
else
|
||||
{
|
||||
if(EditorSettings.value("Assets/Browser/doubleClickAction", "Edit Asset") $= "Edit Asset")
|
||||
%previewData.doubleClickCommand = "";
|
||||
else
|
||||
%previewData.doubleClickCommand = "createTerrainBlock(\""@%assetDef.getAssetId()@"\");";
|
||||
}
|
||||
}
|
||||
|
||||
function GuiInspectorTypeTerrainAssetPtr::onClick( %this, %fieldName )
|
||||
|
|
|
|||
|
|
@ -10,12 +10,13 @@ function AssetBrowser::ConvertFolderIntoModule(%this, %folderName)
|
|||
AssetBrowser_addModuleWindow.CreateNewModule();
|
||||
}
|
||||
|
||||
function AssetBrowser::CreateNewModule(%this)
|
||||
function AssetBrowser::CreateNewModule(%this, %callback)
|
||||
{
|
||||
Canvas.pushDialog(AssetBrowser_AddModule);
|
||||
AssetBrowser_addModuleWindow.selectWindow();
|
||||
|
||||
AssetBrowser_addModuleWindow.callbackFunction = "AssetBrowser.promptNewModuleFolders();";
|
||||
AssetBrowser_addModuleWindow.callbackFallthrough = %callback;
|
||||
}
|
||||
|
||||
function AssetBrowser::promptNewModuleFolders(%this)
|
||||
|
|
@ -24,6 +25,9 @@ function AssetBrowser::promptNewModuleFolders(%this)
|
|||
"Do you want to create some common folders for organization of your new Module?",
|
||||
"AssetBrowser.makeModuleFolders();", //if yes, make the foldesr
|
||||
"AssetBrowser.loadDirectories();"); //if no, just refresh
|
||||
|
||||
if(AssetBrowser_addModuleWindow.callbackFallthrough !$= "")
|
||||
eval(AssetBrowser_addModuleWindow.callbackFallthrough);
|
||||
}
|
||||
|
||||
function AssetBrowser::makeModuleFolders(%this)
|
||||
|
|
|
|||
|
|
@ -26,9 +26,22 @@ function CreateAssetButton::onClick(%this)
|
|||
|
||||
function AssetBrowser_newAsset::onWake(%this)
|
||||
{
|
||||
NewAssetTargetAddress.text = AssetBrowser.dirHandler.currentAddress;
|
||||
NewAssetTargetModule.text = AssetBrowser.dirHandler.getModuleFromAddress(AssetBrowser.dirHandler.currentAddress).ModuleId;
|
||||
%targetModule = AssetBrowser.dirHandler.getModuleFromAddress(AssetBrowser.dirHandler.currentAddress).ModuleId;
|
||||
|
||||
if(%targetModule $= "")
|
||||
%targetModule = EditorSettings.value("Assets/New/defaultModule", "");
|
||||
|
||||
NewAssetTargetModule.setText(%targetModule);
|
||||
|
||||
%moduleDef = ModuleDatabase.findModule(%targetModule);
|
||||
|
||||
%targetPath = AssetBrowser.dirHandler.currentAddress;
|
||||
if(!startsWith(%targetPath, %moduleDef.ModulePath))
|
||||
{
|
||||
%targetPath = %moduleDef.ModulePath;
|
||||
}
|
||||
|
||||
NewAssetTargetAddress.text = %targetPath;
|
||||
}
|
||||
|
||||
function AssetBrowser_newAssetWindow::onClose(%this)
|
||||
|
|
@ -107,34 +120,6 @@ function AssetBrowser::setupCreateNewAsset(%this, %assetType, %moduleName, %call
|
|||
%command = %this @ ".setupCreateNew"@%assetType @"();";
|
||||
eval(%command);
|
||||
}
|
||||
/*if(%assetType $= "ComponentAsset")
|
||||
{
|
||||
NewAssetPropertiesInspector.startGroup("Components");
|
||||
NewAssetPropertiesInspector.addField("parentClass", "New Asset Parent Class", "String", "Name of the new asset's parent class", "Component", "", %this.newAssetSettings);
|
||||
NewAssetPropertiesInspector.addField("componentGroup", "Component Group", "String", "Name of the group of components this component asset belongs to", "", "", %this.newAssetSettings);
|
||||
//NewAssetPropertiesInspector.addField("componentName", "Component Name", "String", "Name of the new component", "", "", %this.newAssetSettings);
|
||||
NewAssetPropertiesInspector.endGroup();
|
||||
}*/
|
||||
//Special case, we only do this via internal means like baking
|
||||
/*else if(%assetType $= "ShapeAsset")
|
||||
{
|
||||
NewAssetPropertiesInspector.startGroup("Shape");
|
||||
NewAssetPropertiesInspector.addField("isServerScript", "Is Server Script", "bool", "Is this script used on the server?", "1", "", %this.newAssetSettings);
|
||||
NewAssetPropertiesInspector.endGroup();
|
||||
}*/
|
||||
/*else if(%assetType $= "ShapeAnimationAsset")
|
||||
{
|
||||
NewAssetPropertiesInspector.startGroup("Animation");
|
||||
NewAssetPropertiesInspector.addField("sourceFile", "Source File", "filename", "Source file this animation will pull from", "", "", %this.newAssetSettings);
|
||||
NewAssetPropertiesInspector.addField("animationName", "Animation Name", "string", "Name of the animation clip when used in a shape", "", "", %this.newAssetSettings);
|
||||
|
||||
NewAssetPropertiesInspector.addField("startFrame", "Starting Frame", "int", "Source file this animation will pull from", "", "", %this.newAssetSettings);
|
||||
NewAssetPropertiesInspector.addField("endFrame", "Ending Frame", "int", "Source file this animation will pull from", "", "", %this.newAssetSettings);
|
||||
|
||||
NewAssetPropertiesInspector.addField("padRotation", "Pad Rotations", "bool", "Source file this animation will pull from", "0", "", %this.newAssetSettings);
|
||||
NewAssetPropertiesInspector.addField("padTransforms", "Pad Transforms", "bool", "Source file this animation will pull from", "0", "", %this.newAssetSettings);
|
||||
NewAssetPropertiesInspector.endGroup();
|
||||
}*/
|
||||
}
|
||||
|
||||
function NewAssetPropertiesInspector::updateNewAssetField(%this)
|
||||
|
|
|
|||
|
|
@ -7,6 +7,14 @@ function AssetBrowser_SelectModule::showDialog(%this, %callback)
|
|||
function AssetBrowser_SelectModule::onWake(%this)
|
||||
{
|
||||
AssetBrowser_SelectModuleWindow-->ModuleList.refresh();
|
||||
|
||||
%defaultModule = EditorSettings.value("Assets/New/defaultModule", "");
|
||||
if(%defaultModule !$= "" &&
|
||||
EditorSettings.value("Assets/New/alwaysPromptModuleTarget", false) == false)
|
||||
{
|
||||
Canvas.popDialog(AssetBrowser_SelectModule);
|
||||
eval(%this.callback @ "(" @ %defaultModule @ ");");
|
||||
}
|
||||
}
|
||||
|
||||
function AssetBrowser_SelectModule::moduleSelected(%this)
|
||||
|
|
@ -24,10 +32,7 @@ function AssetBrowser_SelectModule::moduleSelected(%this)
|
|||
|
||||
function SelectModule_NewAssetModuleBtn::onClick(%this)
|
||||
{
|
||||
Canvas.pushDialog(AssetBrowser_AddModule);
|
||||
AssetBrowser_addModuleWindow.selectWindow();
|
||||
|
||||
AssetBrowser_AddModule.callback = "AssetBrowser_selectModule.newModuleAdded();";
|
||||
AssetBrowser.CreateNewModule("AssetBrowser_selectModule.newModuleAdded();");
|
||||
}
|
||||
|
||||
function AssetBrowser_selectModule::newModuleAdded(%this)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue