Merge pull request #997 from Areloch/ExpandedEditorToolstuffs

Adds expanded ability to create and insert specialized script-based inspector fields
This commit is contained in:
Brian Roberts 2023-03-18 15:03:20 -05:00 committed by GitHub
commit 3529a31d0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 137 additions and 7 deletions

View file

@ -184,6 +184,10 @@ function AssetBrowserPlugin::initSettings( %this )
EditorSettings.setDefaultValue( "AssetImporDefaultConfig", "DefaultConfig" );
EditorSettings.setDefaultValue( "AutoImport", 1 );
EditorSettings.beginGroup( "New" );
EditorSettings.setDefaultValue( "alwaysPromptModuleTarget", 0 );
EditorSettings.endGroup();
EditorSettings.beginGroup( "Browser" );

View file

@ -100,12 +100,12 @@ function onStart()
$editors[%i] = getWord( $Tools::loadFirst, %i );
}
%pattern = $Tools::resourcePath @ "/*/main." @ $TorqueScriptFileExtension;
%pattern = $Tools::resourcePath @ "/*/main." @ $TorqueScriptFileExtension @ ".dso";
%folder = findFirstFile( %pattern );
if ( %folder $= "")
{
// if we have absolutely no matches for main.tscript, we look for main.tscript.dso
%pattern = $Tools::resourcePath @ "/*/main." @ $TorqueScriptFileExtension @ ".dso";
%pattern = $Tools::resourcePath @ "/*/main." @ $TorqueScriptFileExtension;
%folder = findFirstFile( %pattern );
}
while ( %folder !$= "" )
@ -126,13 +126,49 @@ function onStart()
}
%folder = findNextFile( %pattern );
}
//Next, scrape through modules and scan for tools subfolders there
%pattern = "data/*/editor." @ $TorqueScriptFileExtension @ ".dso";
%folder = findFirstFile( %pattern );
if ( %folder $= "")
{
// if we have absolutely no matches for main.tscript, we look for main.tscript.dso
%pattern = "data/*/editor." @ $TorqueScriptFileExtension;
%folder = findFirstFile( %pattern );
}
while ( %folder !$= "" )
{
if( filePath( %folder ) !$= "tools" ) // Skip the actual 'tools' folder...we want the children
{
%folder = filePath( %folder );
%editor = fileName( %folder );
if ( IsDirectory( %folder ) )
{
// Yes, this sucks and should be done better
if ( strstr( $Tools::loadFirst, %editor ) == -1 )
{
$editors[$editors[count]] = %editor;
$editorsPath[$editors[count]] = %folder;
$editors[count]++;
}
}
}
%folder = findNextFile( %pattern );
}
// initialize every editor
new SimSet( EditorPluginSet );
%count = $editors[count];
for ( %i = 0; %i < %count; %i++ )
{
exec( "./" @ $editors[%i] @ "/main." @ $TorqueScriptFileExtension );
%editorFilename = "./" @ $editors[%i] @ "/main." @ $TorqueScriptFileExtension;
if(isFile(%editorFilename))
exec( "./" @ $editors[%i] @ "/main." @ $TorqueScriptFileExtension );
else
{
if($editorsPath[%i] !$= "")
exec( $editorsPath[%i] @ "/editor." @ $TorqueScriptFileExtension );
}
%initializeFunction = "initialize" @ $editors[%i];
if( isFunction( %initializeFunction ) )

View file

@ -49,6 +49,8 @@
</Group>
<Group
name="New">
<Setting
name="alwaysPromptModuleTarget">1</Setting>
<Setting
name="defaultModule">ExampleModule</Setting>
</Group>