Merge pull request #759 from Areloch/Misc20220405

Misc Fixes 2022/04/05
This commit is contained in:
Brian Roberts 2022-04-07 11:48:10 -05:00 committed by GitHub
commit cf68986a32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 207 additions and 111 deletions

View file

@ -60,6 +60,7 @@ RenderMeshExample::RenderMeshExample()
mTypeMask |= StaticObjectType | StaticShapeObjectType;
INIT_ASSET(Material);
mMaterialInst = NULL;
}
RenderMeshExample::~RenderMeshExample()

View file

@ -59,6 +59,7 @@ RenderShapeExample::RenderShapeExample()
mTypeMask |= StaticObjectType | StaticShapeObjectType;
// Make sure to initialize our TSShapeInstance to NULL
INIT_ASSET(Shape);
mShapeInstance = NULL;
}

View file

@ -616,3 +616,9 @@ void ExplodePrefabUndoAction::redo()
name = Sim::getUniqueName( name );
mGroup->assignName( name );
}
DefineEngineMethod(Prefab, getChildGroup, S32, (),,
"")
{
return object->getChildGroup();
}

View file

@ -102,6 +102,13 @@ public:
virtual void getUtilizedAssets(Vector<StringTableEntry>* usedAssetsList);
S32 getChildGroup() {
if (mChildGroup.isValid())
return mChildGroup->getId();
return 0;
}
protected:
void _closeFile( bool removeFileNotify );

View file

@ -557,16 +557,20 @@ void GuiShapeEdPreview::refreshThreadSequences()
//-----------------------------------------------------------------------------
// MOUNTING
bool GuiShapeEdPreview::mountShape(const char* modelName, const char* nodeName, const char* mountType, S32 slot)
bool GuiShapeEdPreview::mountShape(const char* shapeAssetId, const char* nodeName, const char* mountType, S32 slot)
{
if ( !modelName || !modelName[0] )
if ( !shapeAssetId || !shapeAssetId[0] )
return false;
Resource<TSShape> model = ResourceManager::get().load( modelName );
if ( !bool( model ) )
if (!AssetDatabase.isDeclaredAsset(shapeAssetId))
return false;
TSShapeInstance* tsi = new TSShapeInstance( model, true );
ShapeAsset* model = AssetDatabase.acquireAsset<ShapeAsset>(shapeAssetId);
if (model == nullptr || !model->getShapeResource())
return false;
TSShapeInstance* tsi = new TSShapeInstance(model->getShapeResource(), true );
if ( slot == -1 )
{
@ -1864,14 +1868,14 @@ DefineEngineMethod( GuiShapeEdPreview, refreshThreadSequences, void, (),,
//-----------------------------------------------------------------------------
// Mounting
DefineEngineMethod( GuiShapeEdPreview, mountShape, bool, ( const char* shapePath, const char* nodeName, const char* type, S32 slot ),,
DefineEngineMethod( GuiShapeEdPreview, mountShape, bool, ( const char* shapeAssetId, const char* nodeName, const char* type, S32 slot ),,
"Mount a shape onto the main shape at the specified node\n\n"
"@param shapePath path to the shape to mount\n"
"@param shapeAssetId AssetId of the shape to mount\n"
"@param nodeName name of the node on the main shape to mount to\n"
"@param type type of mounting to use (Object, Image or Wheel)\n"
"@param slot mount slot\n" )
{
return object->mountShape( shapePath, nodeName, type, slot );
return object->mountShape(shapeAssetId, nodeName, type, slot );
}
DefineEngineMethod( GuiShapeEdPreview, setMountNode, void, ( S32 slot, const char* nodeName ),,

View file

@ -1212,6 +1212,86 @@ function AssetBrowser::openAssetSettings(%this)
ESettingsWindowList.setSelectedRow( %assetEditIndex );
}
function ESettingsWindow::getAssetManagementSettings(%this)
{
SettingsInspector.startGroup("Modules");
SettingsInspector.addSettingsField("AssetManagement/Modules/coreModulePath", "Core Module Path", "string", "");
SettingsInspector.addSettingsField("AssetManagement/Modules/gameDataModulePath", "Game Data Module Path", "string", "");
SettingsInspector.addSettingsField("AssetManagement/Modules/moduleExtension", "Module Extension", "string", "");
%moduleList = ModuleDatabase.findModules(true);
%moduleList = strreplace(%moduleList, " ", ",");
SettingsInspector.addSettingsField("AssetManagement/Modules/DefaultModule", "Default Module", "list", %moduleList);
SettingsInspector.endGroup();
SettingsInspector.startGroup("Assets");
SettingsInspector.addSettingsField("AssetManagement/Assets/assetExtension", "Asset Extension", "string", "");
SettingsInspector.addSettingsField("AssetManagement/Assets/datablockCaching", "Cache Datablocks", "bool", "");
//SettingsInspector.addSettingsField("AssetManagement/Assets/moduleExtension", "Module Extension", "string", "");
SettingsInspector.endGroup();
}
function ESettingsWindow::getAssetEditingSettings(%this)
{
ImportAssetWindow::reloadImportOptionConfigs();
//First, get our list of modules
%moduleList = ModuleDatabase.findModules();
%formattedModuleList = "";
%count = getWordCount(%moduleList);
for(%i=0; %i < %count; %i++)
{
%module = getWord(%moduleList, %i);
if(%module.group !$= "Tools" && %module.group !$= "Core")
{
if(%formattedModuleList $= "")
%formattedModuleList = %module.moduleId;
else
%formattedModuleList = %formattedModuleList @ "," @ %module.moduleId;
}
}
SettingsInspector.startGroup("Asset Creation");
SettingsInspector.addSettingsField("Assets/New/defaultModule", "Default Module", "list", "Default Module for new assets to be created into", %formattedModuleList);
SettingsInspector.addSettingsField("Assets/New/alwaysPromptModuleTarget", "Always Prompt Target Module", "bool", "If off, use the default module");
SettingsInspector.endGroup();
%formattedConfigList = "";
for(%i=0; %i < ImportAssetWindow.importConfigsList.Count(); %i++)
{
%configName = ImportAssetWindow.importConfigsList.getKey(%i);
%formattedConfigList = %i == 0 ? %configName : %formattedConfigList @ "," @ %configName;
}
SettingsInspector.startGroup("Assets Importing");
SettingsInspector.addField("Edit Import Configs", "Edit Asset Import Configs", "button", "Open Asset Import Config Editor", "", "Canvas.pushDialog(AssetImportConfigEditor);");
SettingsInspector.addSettingsField("Assets/AssetImporDefaultConfig", "Default Asset Import Config", "list", "", %formattedConfigList);
SettingsInspector.addSettingsField("Assets/AutoImport", "Automatically Import using default config", "bool", "If on, the asset importing process" @
"will attempt to automatically import any inbound assets"@
"using the default config, without prompting the import window."@
"The window will still display if any issues are detected", "");
SettingsInspector.addSettingsField("Assets/AutoImportLooseFiles", "Automatically Import Loose Files", "bool", "If on, will automatically import unassociated loose files in assets when navigating the Asset Browser.", "");
SettingsInspector.endGroup();
SettingsInspector.startGroup("Asset Browser");
SettingsInspector.addSettingsField("Assets/Browser/showCoreModule", "Show Core Module in Asset Browser", "bool", "");
SettingsInspector.addSettingsField("Assets/Browser/showToolsModule", "Show Tools Module in Asset Browser", "bool", "");
SettingsInspector.addSettingsField("Assets/Browser/showOnlyPopulatedModule", "Show Only Modules with Assets in Asset Browser", "bool", "");
SettingsInspector.addSettingsField("Assets/Browser/showFolders", "Show Folders in Tiles view in Asset Browser", "bool", "");
SettingsInspector.addSettingsField("Assets/Browser/showEmptyFolders", "Show Empty Folders in Tiles view in Asset Browser", "bool", "");
SettingsInspector.addSettingsField("Assets/Browser/showLooseFiles", "Show Loose Files when viewing in Asset Browser", "bool", "");
SettingsInspector.addSettingsField("AssetManagement/Assets/promptOnRename", "Prompt on Rename", "bool", "");
SettingsInspector.addSettingsField("Assets/Browser/doubleClickAction", "Double Click Action", "list", "Dictates what sort of action double clicking on an asset in the Browser will invoke", "Edit Asset,Spawn Asset");
SettingsInspector.addSettingsField("AssetManagement/Assets/closeBrowserOnDragAction", "Close Browser on Drag Action", "bool", "If on, the Asset Browser will automatically close after dragging an asset from it to the editor interface.");
SettingsInspector.endGroup();
}
//
//
//
function AssetBrowser::showVisibiltyOptions(%this)
{
BrowserVisibilityPopup.showPopup(Canvas);

View file

@ -50,9 +50,9 @@ function AssetBrowser::loadCreatorClasses(%this)
%this.addCreatorClass("MissionArea", "Mission Area" );
%this.addCreatorClass("NotesObject", "Note" );
%this.addCreatorClass("Path" );
%this.addCreatorClass("SpawnSphere", "General Spawn Sphere" );
%this.addCreatorClass("SpawnSphere", "Player Spawn Sphere"/*, "PlayerDropPoint"*/ );
%this.addCreatorClass("SpawnSphere", "Observer Spawn Sphere"/*, "ObserverDropPoint"*/ );
%this.addCreatorClass("SpawnSphere", "General Spawn Sphere", "GeneralDropPoint" );
%this.addCreatorClass("SpawnSphere", "Player Spawn Sphere", "PlayerDropPoint" );
%this.addCreatorClass("SpawnSphere", "Observer Spawn Sphere", "ObserverDropPoint" );
%this.addCreatorClass("VPath", "Verve Path" );
%this.endCreatorGroup();
@ -168,6 +168,7 @@ function AssetBrowser::addCreatorClass(%this, %class, %name, %buildfunc)
return;
}
%cmd = "";
if(%buildfunc $= "")
{
%method = "build" @ %buildfunc;
@ -178,9 +179,13 @@ function AssetBrowser::addCreatorClass(%this, %class, %name, %buildfunc)
%cmd = "new " @ %class @ "();";
else
%cmd = "ObjectBuilderGui." @ %method @ "();";
%buildfunc = "ObjectBuilderGui.newObjectCallback = \"AssetBrowser.onFinishCreateObject\"; ObjectCreator.createObject( \"" @ %cmd @ "\" );";
}
else
{
%cmd = "ObjectBuilderGui.build" @ %buildfunc @ "();";
}
%buildfunc = "ObjectBuilderGui.newObjectCallback = \"AssetBrowser.onFinishCreateObject\"; ObjectCreator.createObject( \"" @ %cmd @ "\" );";
%args = new ScriptObject();
%args.val[0] = %class;

View file

@ -476,4 +476,54 @@ function AssetBrowser::updateAssetReference(%this, %targetPath, %oldAssetId, %ne
lineCache.delete();
%fileObj.delete();
}
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);
}
}
}

View file

@ -34,7 +34,9 @@ function AssetBrowser::buildPopupMenus(%this)
item[ 8 ] = "-";
item[ 9 ] = "Re-Import Asset" TAB "" TAB "AssetBrowser.reImportAsset();";
item[ 10 ] = "-";
item[ 11 ] = "Delete Asset" TAB "" TAB "AssetBrowser.deleteAsset();";
item[ 11 ] = "Open File Location" TAB "" TAB "AssetBrowser.openFileLocation();";
item[ 12 ] = "-";
item[ 13 ] = "Delete Asset" TAB "" TAB "AssetBrowser.deleteAsset();";
jumpFileName = "";
jumpLineNumber = "";
@ -57,9 +59,9 @@ function AssetBrowser::buildPopupMenus(%this)
item[ 5 ] = "-";
Item[ 6 ] = "Duplicate Asset" TAB "" TAB "AssetBrowser.duplicateAsset();";
item[ 7 ] = "-";
//item[ 8 ] = "Re-Import Asset" TAB "" TAB "AssetBrowser.reImportAsset();";
//item[ 9 ] = "-";
item[ 8 ] = "Delete Asset" TAB "" TAB "AssetBrowser.deleteAsset();";
item[ 8 ] = "Open File Location" TAB "" TAB "AssetBrowser.openFileLocation();";
item[ 9 ] = "-";
item[ 10 ] = "Delete Asset" TAB "" TAB "AssetBrowser.deleteAsset();";
jumpFileName = "";
jumpLineNumber = "";
@ -80,7 +82,9 @@ function AssetBrowser::buildPopupMenus(%this)
item[ 3 ] = "-";
Item[ 4 ] = "Duplicate Asset" TAB "" TAB "AssetBrowser.duplicateAsset();";
item[ 5 ] = "-";
item[ 6 ] = "Delete Asset" TAB "" TAB "AssetBrowser.deleteAsset();";
item[ 6 ] = "Open File Location" TAB "" TAB "AssetBrowser.openFileLocation();";
item[ 7 ] = "-";
item[ 8 ] = "Delete Asset" TAB "" TAB "AssetBrowser.deleteAsset();";
jumpFileName = "";
jumpLineNumber = "";
@ -185,6 +189,9 @@ function AssetBrowser::buildPopupMenus(%this)
item[10] = "Create New Module" TAB "" TAB "AssetBrowser.CreateNewModule();";
item[11] = "-";
item[12] = "View Loose Files" TAB "" TAB "AssetBrowser.importLooseFiles();";
Item[ 13 ] = "-";
item[ 14 ] = "Open Folder Location" TAB "" TAB "AssetBrowser.openFolderLocation();";
};
}
@ -203,11 +210,13 @@ function AssetBrowser::buildPopupMenus(%this)
Item[ 3 ] = "-";
Item[ 4 ] = "Module Properties" TAB "" TAB "AssetBrowser.editModuleInfo();";
Item[ 5 ] = "-";
Item[ 6 ] = "Duplicate Module" TAB "" TAB "AssetBrowser.copyModule();";
Item[ 7 ] = "-";
Item[ 8 ] = "Delete Module" TAB "" TAB "AssetBrowser.deleteModule();";
item[ 9 ] = "-";
item[ 10 ] = "Import Loose Files" TAB "" TAB "AssetBrowser.importLooseFiles();";
item[ 6 ] = "Open Folder Location" TAB "" TAB "AssetBrowser.openFolderLocation();";
item[ 7 ] = "-";
Item[ 8 ] = "Duplicate Module" TAB "" TAB "AssetBrowser.copyModule();";
Item[ 9 ] = "-";
Item[ 10 ] = "Delete Module" TAB "" TAB "AssetBrowser.deleteModule();";
item[ 11 ] = "-";
item[ 12 ] = "Import Loose Files" TAB "" TAB "AssetBrowser.importLooseFiles();";
};
}

View file

@ -473,83 +473,6 @@ function ESettingsWindow::getUISettings(%this)
SettingsInspector.endGroup();
}
function ESettingsWindow::getAssetManagementSettings(%this)
{
SettingsInspector.startGroup("Modules");
SettingsInspector.addSettingsField("AssetManagement/Modules/coreModulePath", "Core Module Path", "string", "");
SettingsInspector.addSettingsField("AssetManagement/Modules/gameDataModulePath", "Game Data Module Path", "string", "");
SettingsInspector.addSettingsField("AssetManagement/Modules/moduleExtension", "Module Extension", "string", "");
%moduleList = ModuleDatabase.findModules(true);
%moduleList = strreplace(%moduleList, " ", ",");
SettingsInspector.addSettingsField("AssetManagement/Modules/DefaultModule", "Default Module", "list", %moduleList);
SettingsInspector.endGroup();
SettingsInspector.startGroup("Assets");
SettingsInspector.addSettingsField("AssetManagement/Assets/assetExtension", "Asset Extension", "string", "");
SettingsInspector.addSettingsField("AssetManagement/Assets/datablockCaching", "Cache Datablocks", "bool", "");
//SettingsInspector.addSettingsField("AssetManagement/Assets/moduleExtension", "Module Extension", "string", "");
SettingsInspector.endGroup();
}
function ESettingsWindow::getAssetEditingSettings(%this)
{
ImportAssetWindow::reloadImportOptionConfigs();
//First, get our list of modules
%moduleList = ModuleDatabase.findModules();
%formattedModuleList = "";
%count = getWordCount(%moduleList);
for(%i=0; %i < %count; %i++)
{
%module = getWord(%moduleList, %i);
if(%module.group !$= "Tools" && %module.group !$= "Core")
{
if(%formattedModuleList $= "")
%formattedModuleList = %module.moduleId;
else
%formattedModuleList = %formattedModuleList @ "," @ %module.moduleId;
}
}
SettingsInspector.startGroup("Asset Creation");
SettingsInspector.addSettingsField("Assets/New/defaultModule", "Default Module", "list", "Default Module for new assets to be created into", %formattedModuleList);
SettingsInspector.addSettingsField("Assets/New/alwaysPromptModuleTarget", "Always Prompt Target Module", "bool", "If off, use the default module");
SettingsInspector.endGroup();
%formattedConfigList = "";
for(%i=0; %i < ImportAssetWindow.importConfigsList.Count(); %i++)
{
%configName = ImportAssetWindow.importConfigsList.getKey(%i);
%formattedConfigList = %i == 0 ? %configName : %formattedConfigList @ "," @ %configName;
}
SettingsInspector.startGroup("Assets Importing");
SettingsInspector.addField("Edit Import Configs", "Edit Asset Import Configs", "button", "Open Asset Import Config Editor", "", "Canvas.pushDialog(AssetImportConfigEditor);");
SettingsInspector.addSettingsField("Assets/AssetImporDefaultConfig", "Default Asset Import Config", "list", "", %formattedConfigList);
SettingsInspector.addSettingsField("Assets/AutoImport", "Automatically Import using default config", "bool", "If on, the asset importing process" @
"will attempt to automatically import any inbound assets"@
"using the default config, without prompting the import window."@
"The window will still display if any issues are detected", "");
SettingsInspector.addSettingsField("Assets/AutoImportLooseFiles", "Automatically Import Loose Files", "bool", "If on, will automatically import unassociated loose files in assets when navigating the Asset Browser.", "");
SettingsInspector.endGroup();
SettingsInspector.startGroup("Asset Browser");
SettingsInspector.addSettingsField("Assets/Browser/showCoreModule", "Show Core Module in Asset Browser", "bool", "");
SettingsInspector.addSettingsField("Assets/Browser/showToolsModule", "Show Tools Module in Asset Browser", "bool", "");
SettingsInspector.addSettingsField("Assets/Browser/showOnlyPopulatedModule", "Show Only Modules with Assets in Asset Browser", "bool", "");
SettingsInspector.addSettingsField("Assets/Browser/showFolders", "Show Folders in Tiles view in Asset Browser", "bool", "");
SettingsInspector.addSettingsField("Assets/Browser/showEmptyFolders", "Show Empty Folders in Tiles view in Asset Browser", "bool", "");
SettingsInspector.addSettingsField("Assets/Browser/showLooseFiles", "Show Loose Files when viewing in Asset Browser", "bool", "");
SettingsInspector.addSettingsField("AssetManagement/Assets/promptOnRename", "Prompt on Rename", "bool", "");
SettingsInspector.addSettingsField("Assets/Browser/doubleClickAction", "Double Click Action", "list", "Dictates what sort of action double clicking on an asset in the Browser will invoke", "Edit Asset,Spawn Asset");
SettingsInspector.addSettingsField("AssetManagement/Assets/closeBrowserOnDragAction", "Close Browser on Drag Action", "bool", "If on, the Asset Browser will automatically close after dragging an asset from it to the editor interface.");
SettingsInspector.endGroup();
}
function ESettingsWindow::getGameplaySettings(%this)
{
SettingsInspector.startGroup("Game Modes");

View file

@ -1581,8 +1581,19 @@ function ShapeEdSequences::onEditSequenceSource( %this, %from )
%from = rtrim( getFields( %oldSource, 0, 0 ) );
if ( getFields( %oldSource, 0, 3 ) !$= ( %from TAB "" TAB %start TAB %end ) )
{
%aq = new AssetQuery();
%foundAssets = AssetDatabase.findAssetLooseFile(%aq, %from);
if(%foundAssets != 0)
{
//if we have an assetId associated to the file, we're gunna just pass that
//through for the edit actions
%from = %aq.getAsset(0);
}
%aq.delete();
ShapeEditor.doEditSeqSource( %seqName, %from, %start, %end );
}
}
}
function ShapeEdSequences::onToggleCyclic( %this )
@ -3339,8 +3350,9 @@ function ShapeEdMountShapeMenu::onSelect( %this, %id, %text )
{
if ( %text $= "Browse..." )
{
// Allow the user to browse for an external model file
getLoadFormatFilename( %this @ ".onBrowseSelect", %this.lastPath );
if(%this.lastPath !$= "")
AssetBrowser.dirHandler.currentAddress = %this.lastPath;
AssetBrowser.showDialog("ShapeAsset", %this @ ".onBrowseSelect");
}
else
{
@ -3349,15 +3361,14 @@ function ShapeEdMountShapeMenu::onSelect( %this, %id, %text )
}
}
function ShapeEdMountShapeMenu::onBrowseSelect( %this, %path )
function ShapeEdMountShapeMenu::onBrowseSelect( %this, %shapeAssetId )
{
%path = makeRelativePath( %path, getMainDotCSDir() );
%this.lastPath = %path;
%this.setText( %path );
%this.lastPath = AssetBrowser.dirHandler.currentAddress;
%this.setText( %shapeAssetId );
// Add entry if unique
if ( %this.findText( %path ) == -1 )
%this.add( %path );
if ( %this.findText( %shapeAssetId ) == -1 )
%this.add( %shapeAssetId );
ShapeEdMountWindow.updateSelectedMount();
}
@ -3369,11 +3380,11 @@ function ShapeEdMountWindow::mountShape( %this, %slot )
%type = %this-->mountType.getText();
if ( %model $= "Browse..." )
%model = "core/gameObjects/shapes/octahedron.dts";
%model = "Core_GameObjects:octahedron.dts";
if ( ShapeEdShapeView.mountShape( %model, %node, %type, %slot ) )
{
%rowText = %model TAB fileName( %model ) TAB %node TAB %type;
%rowText = %model TAB %node TAB %type;
if ( %slot == -1 )
{
%id = %this.mounts++;

View file

@ -301,7 +301,6 @@ function ActionEditNodeTransform::undo( %this )
// Add sequence
function onAddAnimationAssetShapeEditor(%selectedAnimation)
{
echo("SELECTED MUH ASSET");
ShapeEditor.doAddSequence(%selectedAnimation, 0, 0, 0);
}