mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 06:34:36 +00:00
Parametrize script extension, default to 'tscript'
This commit is contained in:
parent
b8b62292bd
commit
099dd4f1f3
542 changed files with 774 additions and 783 deletions
234
Templates/BaseGame/game/tools/VerveEditor/main.tscript
Normal file
234
Templates/BaseGame/game/tools/VerveEditor/main.tscript
Normal file
|
|
@ -0,0 +1,234 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function InitializeVerveEditor()
|
||||
{
|
||||
$Verve::UseSeparateWindow = true;
|
||||
|
||||
// Preferences.
|
||||
exec( "./DefaultPrefs.tscript" );
|
||||
|
||||
// GUI.
|
||||
exec( "./GUI/GuiProfiles.tscript" );
|
||||
exec( "./GUI/VerveEditorGroupBuilder.gui" );
|
||||
exec( "./GUI/VerveEditorImportPathNodes.gui" );
|
||||
|
||||
// Scripts.
|
||||
exec( "./Scripts/Plugin.tscript" );
|
||||
exec( "./Scripts/Utility.tscript" );
|
||||
|
||||
exec( "./Scripts/EditorControls.tscript" );
|
||||
exec( "./Scripts/EditorHistory.tscript" );
|
||||
exec( "./Scripts/EditorMenu.tscript" );
|
||||
exec( "./Scripts/EditorPreferences.tscript" );
|
||||
exec( "./Scripts/EditorWindow.tscript" );
|
||||
exec( "./Scripts/Persistence.tscript" );
|
||||
exec( "./Scripts/ScrollNotify.tscript" );
|
||||
exec( "./Scripts/VObject.tscript" );
|
||||
|
||||
exec( "./Scripts/Inspector/main.tscript" );
|
||||
|
||||
exec( "./Scripts/Controller/main.tscript" );
|
||||
exec( "./Scripts/Groups/main.tscript" );
|
||||
exec( "./Scripts/Tracks/main.tscript" );
|
||||
exec( "./Scripts/Events/main.tscript" );
|
||||
|
||||
exec( "./Torque/main.tscript" );
|
||||
|
||||
// Register Events.
|
||||
VerveEditor::RegisterEvent( "VGroupObjectUpdate" );
|
||||
}
|
||||
|
||||
function DestroyVerveEditor()
|
||||
{
|
||||
// Ensure the Editor has Shutdown.
|
||||
if ( isObject( VerveEditorWindow ) )
|
||||
{
|
||||
// Prompt for Save.
|
||||
VerveEditor::SavePrompt();
|
||||
|
||||
// Reset.
|
||||
VerveEditor::Reset();
|
||||
|
||||
// Delete the Window.
|
||||
VerveEditorWindow.delete();
|
||||
}
|
||||
}
|
||||
|
||||
function ToggleVerveEditor( %value )
|
||||
{
|
||||
if ( %value && $Verve::UseSeparateWindow )
|
||||
{
|
||||
if ( !isObject( VerveEditorWindow ) )
|
||||
{
|
||||
VerveEditor::LaunchEditor();
|
||||
}
|
||||
else
|
||||
{
|
||||
VerveEditorWindow.onWindowClose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function VerveEditor::LaunchEditor()
|
||||
{
|
||||
// Launch Window.
|
||||
%mainScreen = VerveEditorWindow::Open();
|
||||
|
||||
if ( !isObject( VerveEditorGui ) )
|
||||
{
|
||||
// Load the GUI.
|
||||
exec ( "./GUI/VerveEditor.gui" );
|
||||
}
|
||||
|
||||
// Apply GUI.
|
||||
if($Verve::UseSeparateWindow)
|
||||
%mainScreen.setContent( VerveEditorGUI );
|
||||
else
|
||||
{
|
||||
%mainScreen.add(VerveEditorGUI);
|
||||
VerveEditorGUI.position.y = VerveEditorGUI.Position.y + 20;
|
||||
EditorGUI.add(%mainScreen);
|
||||
}
|
||||
|
||||
// Clear History.
|
||||
VerveEditor::ClearHistory();
|
||||
|
||||
// Update Window Title.
|
||||
if($Verve::UseSeparateWindow)
|
||||
VerveEditorWindow.UpdateWindowTitle();
|
||||
|
||||
// Update Selection.
|
||||
VerveEditor::OnSelectionUpdate();
|
||||
|
||||
// Update Sizes.
|
||||
VerveEditor::UpdateSizes();
|
||||
}
|
||||
|
||||
function VerveEditor::ResetController()
|
||||
{
|
||||
// Delete.
|
||||
VerveEditor::DeleteController();
|
||||
// Create.
|
||||
return VerveEditor::CreateController();
|
||||
}
|
||||
|
||||
function VerveEditor::DeleteController()
|
||||
{
|
||||
// Current Controller?
|
||||
if ( isObject( $VerveEditor::Controller ) )
|
||||
{
|
||||
// Stop but do not Reset.
|
||||
$VerveEditor::Controller.stop( false );
|
||||
// Delete the Controller.
|
||||
$VerveEditor::Controller.delete();
|
||||
// Deleted?
|
||||
return !isObject( $VerveEditor::Controller );
|
||||
}
|
||||
|
||||
// No Deletion.
|
||||
return false;
|
||||
}
|
||||
|
||||
function VerveEditor::CreateController()
|
||||
{
|
||||
// Current Controller?
|
||||
if ( !isObject( VerveEditorController ) )
|
||||
{
|
||||
// Create Controller.
|
||||
$VerveEditor::Controller = new VController( VerveEditorController );
|
||||
}
|
||||
|
||||
// Return ID.
|
||||
return $VerveEditor::Controller;
|
||||
}
|
||||
|
||||
function VerveEditor::Refresh()
|
||||
{
|
||||
if ( !isObject( $VerveEditor::Controller ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear Selection.
|
||||
VerveEditor::ClearSelection();
|
||||
|
||||
// Delete Existing Controls.
|
||||
VerveEditor::DeleteControls();
|
||||
|
||||
// Sort Groups & Tracks.
|
||||
$VerveEditor::Controller.sortGroups();
|
||||
$VerveEditor::Controller.sortTracks();
|
||||
|
||||
%groupSet = $VerveEditor::Controller;
|
||||
%groupCount = %groupSet.getCount();
|
||||
for ( %i = 0; %i < %groupCount; %i++ )
|
||||
{
|
||||
// Update Controls.
|
||||
%groupSet.getObject( %i ).Refresh();
|
||||
}
|
||||
|
||||
// Update Window Title.
|
||||
VerveEditorWindow.UpdateWindowTitle();
|
||||
|
||||
// Update Duration.
|
||||
VerveEditor::UpdateDuration();
|
||||
|
||||
// Update Sizes.
|
||||
VerveEditor::UpdateSizes();
|
||||
|
||||
// Update Selection.
|
||||
VerveEditor::OnSelectionUpdate();
|
||||
}
|
||||
|
||||
function VerveEditor::UpdateSizes()
|
||||
{
|
||||
VerveEditorGroupNotify.UpdateSize();
|
||||
VerveEditorTrackNotify.UpdateSize();
|
||||
VerveEditorTimeNotify.UpdateSize();
|
||||
}
|
||||
|
||||
function VerveEditor::UpdateDuration( %duration )
|
||||
{
|
||||
if ( %duration !$= "" )
|
||||
{
|
||||
// Update Duration.
|
||||
$VerveEditor::Controller.setFieldValue( "Duration", %duration );
|
||||
}
|
||||
|
||||
// Update Duration.
|
||||
VerveEditorTimeLine.updateDuration();
|
||||
VerveEditorTrackTimeLine.updateDuration();
|
||||
|
||||
// Update Sizes.
|
||||
VerveEditorGroupNotify.UpdateSize();
|
||||
VerveEditorTrackNotify.UpdateSize();
|
||||
VerveEditorTimeNotify.UpdateSize();
|
||||
}
|
||||
|
||||
package VerveEditorSaveIntercept
|
||||
{
|
||||
function EditorSaveMission()
|
||||
{
|
||||
// Reset.
|
||||
VerveEditor::Reset();
|
||||
|
||||
// Perform the Save.
|
||||
Parent::EditorSaveMission();
|
||||
}
|
||||
};
|
||||
|
||||
function VerveEditor::Reset()
|
||||
{
|
||||
// Valid Controller?
|
||||
if ( isObject( $VerveEditor::Controller ) )
|
||||
{
|
||||
// Reset.
|
||||
$VerveEditor::Controller.Reset();
|
||||
|
||||
// Stop.
|
||||
$VerveEditor::Controller.Stop();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue