mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 07:04:36 +00:00
(Mostly) updated verve implementation.
This commit is contained in:
parent
e0627973fb
commit
5a7f0f0b23
538 changed files with 68727 additions and 49 deletions
|
|
@ -0,0 +1,362 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VControllerPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
|
||||
Group[0] = "VController";
|
||||
Field[0, 0] = "Duration";
|
||||
Field[0, 1] = "TimeScale";
|
||||
|
||||
Field[0, 2] = "SPACER 6";
|
||||
|
||||
Field[0, 3] = "Loop";
|
||||
Field[0, 4] = "LoopBackwards";
|
||||
Field[0, 5] = "LoopCount";
|
||||
Field[0, 6] = "LoopDelay";
|
||||
|
||||
Field[0, 7] = "SPACER 6";
|
||||
|
||||
Field[0, 8] = "ResetOnCompletion";
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VerveEditor::TogglePlay()
|
||||
{
|
||||
if ( !isObject( $VerveEditor::Controller ) )
|
||||
{
|
||||
// No Controller.
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !$VerveEditor::Controller.isPlaying() )
|
||||
{
|
||||
// Play.
|
||||
VerveEditor::Play();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Pause.
|
||||
VerveEditor::Pause();
|
||||
}
|
||||
}
|
||||
|
||||
function VerveEditor::Play()
|
||||
{
|
||||
// Start Playing.
|
||||
$VerveEditor::Controller.play();
|
||||
}
|
||||
|
||||
function VerveEditor::Pause()
|
||||
{
|
||||
// Stop but do not Reset.
|
||||
$VerveEditor::Controller.stop( false );
|
||||
}
|
||||
|
||||
function VerveEditor::StepF()
|
||||
{
|
||||
// Determine the time to step towards.
|
||||
%time = mClamp( $VerveEditor::Controller.Time + ( 32 * $VerveEditor::Controller.TimeScale ), 0.0, $VerveEditor::Controller.Duration );
|
||||
// Reset.
|
||||
$VerveEditor::Controller.reset( %time );
|
||||
}
|
||||
|
||||
function VerveEditor::StepB()
|
||||
{
|
||||
// Switch TimeScale.
|
||||
$VerveEditor::Controller.TimeScale *= -1.0;
|
||||
// Step.
|
||||
VerveEditor::StepF();
|
||||
// Switch Back TimeScale.
|
||||
$VerveEditor::Controller.TimeScale *= -1.0;
|
||||
}
|
||||
|
||||
function VerveEditor::Rewind()
|
||||
{
|
||||
if ( $VerveEditor::Controller.TimeScale > 0 )
|
||||
{
|
||||
// Front.
|
||||
$VerveEditor::Controller.reset( 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Back.
|
||||
$VerveEditor::Controller.reset( $VerveEditor::Controller.Duration );
|
||||
}
|
||||
}
|
||||
|
||||
function VerveEditor::Forward()
|
||||
{
|
||||
if ( $VerveEditor::Controller.TimeScale < 0 )
|
||||
{
|
||||
// Front.
|
||||
$VerveEditor::Controller.reset( 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Back.
|
||||
$VerveEditor::Controller.reset( $VerveEditor::Controller.Duration );
|
||||
}
|
||||
}
|
||||
|
||||
function VerveEditor::InsertTimeFront()
|
||||
{
|
||||
%time = 0;
|
||||
%length = 1000;
|
||||
|
||||
VerveEditor::InsertTime( %time, %length );
|
||||
}
|
||||
|
||||
function VerveEditor::InsertTimeBack()
|
||||
{
|
||||
%time = $VerveEditor::Controller.Duration;
|
||||
%length = 1000;
|
||||
|
||||
VerveEditor::InsertTime( %time, %length );
|
||||
}
|
||||
|
||||
function VerveEditor::InsertTime( %time, %length )
|
||||
{
|
||||
if ( %length <= 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Group History Actions.
|
||||
VerveEditor::ToggleHistoryGroup();
|
||||
|
||||
// Increase Duration.
|
||||
$VerveEditor::Controller.setFieldValue( "Duration", $VerveEditor::Controller.Duration + %length );
|
||||
|
||||
%groupSet = $VerveEditor::Controller;
|
||||
%groupCount = %groupSet.getCount();
|
||||
for ( %i = 0; %i < %groupCount; %i++ )
|
||||
{
|
||||
%trackSet = %groupSet.getObject( %i );
|
||||
%trackCount = %trackSet.getCount();
|
||||
for ( %j = 0; %j < %trackCount; %j++ )
|
||||
{
|
||||
%eventSet = %trackSet.getObject( %j );
|
||||
%eventCount = %eventSet.getCount();
|
||||
for ( %k = 0; %k < %eventCount; %k++ )
|
||||
{
|
||||
%eventSet.getObject( %k ).InsertTime( %time, %length );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( %time < $VerveEditor::Controller.Time )
|
||||
{
|
||||
// Update Time.
|
||||
$VerveEditor::Controller.setFieldValue( "Time", $VerveEditor::Controller.Time + %length );
|
||||
}
|
||||
|
||||
// Finish Up.
|
||||
VerveEditor::ToggleHistoryGroup();
|
||||
}
|
||||
|
||||
function VerveEditor::DeleteTime( %time, %length )
|
||||
{
|
||||
if ( %length <= 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Group History Actions.
|
||||
VerveEditor::ToggleHistoryGroup();
|
||||
|
||||
%groupSet = $VerveEditor::Controller;
|
||||
%groupCount = %groupSet.getCount();
|
||||
for ( %i = 0; %i < %groupCount; %i++ )
|
||||
{
|
||||
%trackSet = %groupSet.getObject( %i );
|
||||
%trackCount = %trackSet.getCount();
|
||||
for ( %j = 0; %j < %trackCount; %j++ )
|
||||
{
|
||||
%eventSet = %trackSet.getObject( %j );
|
||||
%eventCount = %eventSet.getCount();
|
||||
for ( %k = 0; %k < %eventCount; %k++ )
|
||||
{
|
||||
%eventObject = %eventSet.getObject( %k );
|
||||
if ( %eventObject.DeleteTime( %time, %length ) )
|
||||
{
|
||||
// Delete.
|
||||
%eventObject.delete();
|
||||
|
||||
// Backstep.
|
||||
%k -= 1;
|
||||
%eventCount -= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Decrease Duration.
|
||||
$VerveEditor::Controller.setFieldValue( "Duration", $VerveEditor::Controller.Duration - %length );
|
||||
|
||||
if ( $VerveEditor::Controller.Time > %time && $VerveEditor::Controller.Time < ( %time + %length ) )
|
||||
{
|
||||
// Clamp.
|
||||
$VerveEditor::Controller.setFieldValue( "Time", %time );
|
||||
}
|
||||
else if ( $VerveEditor::Controller.Time >= ( %time + %length ) )
|
||||
{
|
||||
// Push Back.
|
||||
$VerveEditor::Controller.setFieldValue( "Time", $VerveEditor::Controller.Time - %length );
|
||||
}
|
||||
|
||||
// Finish Up.
|
||||
VerveEditor::ToggleHistoryGroup();
|
||||
|
||||
// Refresh Editor.
|
||||
VerveEditor::Refresh();
|
||||
}
|
||||
|
||||
function VEvent::InsertTime( %this, %time, %length )
|
||||
{
|
||||
%triggerTime = %this.getFieldValue( "TriggerTime" );
|
||||
%triggerDuration = %this.getFieldValue( "Duration" );
|
||||
|
||||
if ( %time <= %triggerTime )
|
||||
{
|
||||
%this.setFieldValue( "TriggerTime", %triggerTime + %length );
|
||||
}
|
||||
else if ( %time > %triggerTime && %time < %triggerTime + %triggerDuration )
|
||||
{
|
||||
%this.setFieldValue( "Duration", %triggerDuration + %length );
|
||||
}
|
||||
}
|
||||
|
||||
function VEvent::DeleteTime( %this, %time, %length )
|
||||
{
|
||||
%triggerTime = %this.getFieldValue( "TriggerTime" );
|
||||
%triggerDuration = %this.getFieldValue( "Duration" );
|
||||
|
||||
if ( %triggerTime >= %time && %triggerTime <= ( %time + %length ) )
|
||||
{
|
||||
%tail = ( %triggerTime + %triggerDuration ) - ( %time + %length );
|
||||
if ( %tail > 0 )
|
||||
{
|
||||
// Trim Duration.
|
||||
%this.setFieldValue( "TriggerTime", %time );
|
||||
%this.setFieldValue( "Duration", %tail );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Delete This Event.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if ( %triggerTime > %time )
|
||||
{
|
||||
// Shuffle Back.
|
||||
%this.setFieldValue( "TriggerTime", %triggerTime - %length );
|
||||
}
|
||||
else if ( %triggerTime < %time && ( %triggerTime + %triggerDuration ) > %time )
|
||||
{
|
||||
// Trim Duration.
|
||||
%this.setFieldValue( "Duration", ( %triggerTime + %triggerDuration ) - %time );
|
||||
}
|
||||
|
||||
// No Delete.
|
||||
return false;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
function VerveEditorController::CanPaste( %this, %targetObject )
|
||||
{
|
||||
if ( !isObject( %targetObject ) )
|
||||
{
|
||||
// Nope!
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( !%this.CanAdd( %targetObject.getClassName() ) )
|
||||
{
|
||||
// Nope!
|
||||
return false;
|
||||
}
|
||||
|
||||
return %targetObject.isMemberOfClass( "VGroup" );
|
||||
}
|
||||
|
||||
function VerveEditorController::CanAdd( %this, %targetClass )
|
||||
{
|
||||
if ( !isWordInList( %targetClass, $VerveEditor::UniqueGroupList ) )
|
||||
{
|
||||
// Not a Unique Group.
|
||||
return true;
|
||||
}
|
||||
|
||||
%groupCount = %this.getCount();
|
||||
for ( %i = 0; %i < %groupCount; %i++ )
|
||||
{
|
||||
%groupObject = %this.getObject( %i );
|
||||
if ( %groupObject.isMemberOfClass( %targetClass ) )
|
||||
{
|
||||
// Invalid.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// All Good.
|
||||
return true;
|
||||
}
|
||||
|
||||
function VerveEditorController::onPlay( %this )
|
||||
{
|
||||
// Update Play Button.
|
||||
VerveEditorPlayButton.setBitmap( "tools/VerveEditor/GUI/Images/btn_Pause" );
|
||||
|
||||
// Start Update Event.
|
||||
VerveEditorTimeLine.ControllerUpdate();
|
||||
}
|
||||
|
||||
function VerveEditorController::onPause( %this )
|
||||
{
|
||||
// Update Play Button.
|
||||
VerveEditorPlayButton.setBitmap( "tools/VerveEditor/GUI/Images/btn_Play" );
|
||||
|
||||
// Stop Update Event.
|
||||
VerveEditorTimeLine.StopUpdate();
|
||||
}
|
||||
|
||||
function VerveEditorController::onStop( %this )
|
||||
{
|
||||
// Update Play Button.
|
||||
VerveEditorPlayButton.setBitmap( "tools/VerveEditor/GUI/Images/btn_Play" );
|
||||
|
||||
// Stop Update Event.
|
||||
VerveEditorTimeLine.StopUpdate();
|
||||
}
|
||||
|
||||
function VerveEditorController::OnFieldChange( %this, %fieldName, %oldValue, %newValue )
|
||||
{
|
||||
if ( !VerveEditorHistoryManager.Locked )
|
||||
{
|
||||
// Add History Item.
|
||||
%historyObject = new UndoScriptAction()
|
||||
{
|
||||
Class = "VerveEditorHistoryChangeProperty";
|
||||
SuperClass = "VerveEditorHistoryObject";
|
||||
|
||||
ActionName = "Change Property (" @ %fieldName @ ")";
|
||||
|
||||
// Store References.
|
||||
Object = %this;
|
||||
FieldName = %fieldName;
|
||||
OldValue = %oldValue;
|
||||
NewValue = %newValue;
|
||||
};
|
||||
}
|
||||
|
||||
switch$ ( %fieldName )
|
||||
{
|
||||
case "Duration" : VerveEditor::UpdateDuration();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,217 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VControllerPropertyList::CreateInspectorGroup( %this, %targetStack )
|
||||
{
|
||||
%baseGroup = Parent::CreateInspectorGroup( %this, %targetStack );
|
||||
if ( %baseGroup.getClassName() !$= "ScriptGroup" )
|
||||
{
|
||||
// Temp Store.
|
||||
%temp = %baseGroup;
|
||||
|
||||
// Create SimSet.
|
||||
%baseGroup = new SimSet();
|
||||
|
||||
// Add Original Control.
|
||||
%baseGroup.add( %temp );
|
||||
}
|
||||
|
||||
// Create Data Table Group.
|
||||
%groupRollout = %targetStack.CreatePropertyRollout( "VController DataTable" );
|
||||
%propertyStack = %groupRollout.Stack;
|
||||
|
||||
// Reference.
|
||||
%propertyStack.InternalName = "DataTableStack";
|
||||
|
||||
// Store.
|
||||
%baseGroup.add( %groupRollout );
|
||||
|
||||
// Return.
|
||||
return %baseGroup;
|
||||
}
|
||||
|
||||
function VControllerPropertyList::InspectObject( %this, %object )
|
||||
{
|
||||
if ( !%object.isMemberOfClass( "VController" ) )
|
||||
{
|
||||
// Invalid Object.
|
||||
return;
|
||||
}
|
||||
|
||||
// Default Inspect.
|
||||
Parent::InspectObject( %this, %object );
|
||||
|
||||
// Update Data Table.
|
||||
%dataTableStack = %this.ControlCache.findObjectByInternalName( "DataTableStack", true );
|
||||
if ( !isObject( %dataTableStack ) )
|
||||
{
|
||||
// Invalid Table.
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear Stack.
|
||||
while ( %dataTableStack.getCount() > 1 )
|
||||
{
|
||||
// Delete Object.
|
||||
%dataTableStack.getObject( 1 ).delete();
|
||||
}
|
||||
|
||||
%dataFieldCount = %object.getDataFieldCount();
|
||||
for ( %i = 0; %i < %dataFieldCount; %i++ )
|
||||
{
|
||||
// Add To List.
|
||||
%dataFieldList = trim( %dataFieldList SPC %object.getDataFieldName( %i ) );
|
||||
}
|
||||
|
||||
// Sort Word List.
|
||||
%dataFieldList = sortWordList( %dataFieldList );
|
||||
|
||||
for ( %i = 0; %i < %dataFieldCount; %i++ )
|
||||
{
|
||||
// Fetch Field Name.
|
||||
%dataFieldName = getWord( %dataFieldList, %i );
|
||||
|
||||
// Create Field.
|
||||
VerveEditor::CreateField( %dataTableStack, %dataFieldName, "Data" );
|
||||
}
|
||||
|
||||
// Create Add Field.
|
||||
VerveEditor::CreateAddDataField( %dataTableStack );
|
||||
|
||||
// Update.
|
||||
%dataTableStack.InspectObject( %object );
|
||||
}
|
||||
|
||||
function VController::DisplayContextMenu( %this, %x, %y )
|
||||
{
|
||||
%contextMenu = $VerveEditor::VController::ContextMenu;
|
||||
if ( !isObject( %contextMenu ) )
|
||||
{
|
||||
%contextMenu = new PopupMenu()
|
||||
{
|
||||
SuperClass = "VerveWindowMenu";
|
||||
|
||||
IsPopup = true;
|
||||
|
||||
Label = "VControllerContextMenu";
|
||||
Position = 0;
|
||||
|
||||
Item[0] = "Add Group" TAB "";
|
||||
|
||||
Item[1] = "" TAB "";
|
||||
|
||||
Item[2] = "Cu&t" TAB "" TAB "";
|
||||
Item[3] = "&Copy" TAB "" TAB "";
|
||||
Item[4] = "&Paste" TAB "" TAB "VerveEditor::Paste();";
|
||||
|
||||
Item[5] = "" TAB "";
|
||||
|
||||
Item[6] = "&Delete" TAB "" TAB "";
|
||||
|
||||
PasteIndex = 4;
|
||||
};
|
||||
%contextMenu.Init();
|
||||
|
||||
// Disable Cut, Copy & Delete.
|
||||
%contextMenu.enableItem( 2, false );
|
||||
%contextMenu.enableItem( 3, false );
|
||||
%contextMenu.enableItem( 6, false );
|
||||
|
||||
// Cache.
|
||||
$VerveEditor::VController::ContextMenu = %contextMenu;
|
||||
}
|
||||
|
||||
// Remove Add Menu.
|
||||
%contextMenu.removeItem( %contextMenu.AddIndex );
|
||||
|
||||
// Insert Menu.
|
||||
%contextMenu.insertSubMenu( %contextMenu.AddIndex, getField( %contextMenu.Item[0], 0 ), %this.GetAddGroupMenu() );
|
||||
|
||||
// Enable/Disable Pasting.
|
||||
%contextMenu.enableItem( %contextMenu.PasteIndex, VerveEditor::CanPaste() );
|
||||
|
||||
if ( %x $= "" || %y $= "" )
|
||||
{
|
||||
%position = %this.getGlobalPosition();
|
||||
%extent = %this.getExtent();
|
||||
|
||||
%x = getWord( %position, 0 ) + getWord( %extent, 0 );
|
||||
%y = getWord( %position, 1 );
|
||||
}
|
||||
|
||||
// Display.
|
||||
if($Verve::UseSeparateWindow)
|
||||
%contextMenu.showPopup( VerveEditorWindow, %x, %y );
|
||||
else
|
||||
%contextMenu.showPopup( Canvas, %x, %y );
|
||||
}
|
||||
|
||||
function VController::GetAddGroupMenu( %this )
|
||||
{
|
||||
%contextMenu = $VerveEditor::VController::ContextMenu[%this.getClassName()];
|
||||
if ( !isObject( %contextMenu ) )
|
||||
{
|
||||
%customTemplateMenu = new PopupMenu()
|
||||
{
|
||||
Class = "VerveCustomTemplateMenu";
|
||||
SuperClass = "VerveWindowMenu";
|
||||
|
||||
IsPopup = true;
|
||||
|
||||
Label = "VGroupAddGroupMenu";
|
||||
Position = 0;
|
||||
};
|
||||
%customTemplateMenu.Init();
|
||||
|
||||
%contextMenu = new PopupMenu()
|
||||
{
|
||||
SuperClass = "VerveWindowMenu";
|
||||
|
||||
IsPopup = true;
|
||||
|
||||
Label = "VGroupAddGroupMenu";
|
||||
Position = 0;
|
||||
|
||||
Item[0] = "Add Camera Group" TAB "" TAB "VerveEditor::AddGroup(\"VCameraGroup\");";
|
||||
Item[1] = "Add Director Group" TAB "" TAB "VerveEditor::AddGroup(\"VDirectorGroup\");";
|
||||
Item[2] = "Add Light Object Group" TAB "" TAB "VerveEditor::AddGroup(\"VLightObjectGroup\");";
|
||||
Item[3] = "Add Particle Effect Group" TAB "" TAB "VerveEditor::AddGroup(\"VParticleEffectGroup\");";
|
||||
Item[4] = "Add Scene Object Group" TAB "" TAB "VerveEditor::AddGroup(\"VSceneObjectGroup\");";
|
||||
Item[5] = "Add Spawn Sphere Group" TAB "" TAB "VerveEditor::AddGroup(\"VSpawnSphereGroup\");";
|
||||
|
||||
Item[6] = "" TAB "";
|
||||
|
||||
Item[7] = "Add Custom Group" TAB %customTemplateMenu;
|
||||
|
||||
DirectorIndex = 1;
|
||||
CustomIndex = 7;
|
||||
CustomMenu = %customTemplateMenu;
|
||||
};
|
||||
%contextMenu.Init();
|
||||
|
||||
// Refresh Menu.
|
||||
%customTemplateMenu = %contextMenu.CustomMenu;
|
||||
if ( %customTemplateMenu.getItemCount() == 0 )
|
||||
{
|
||||
// Remove Item.
|
||||
%contextMenu.removeItem( %contextMenu.CustomIndex );
|
||||
|
||||
// Add Dummy.
|
||||
%contextMenu.insertItem( %contextMenu.CustomIndex, getField( %contextMenu.Item[%contextMenu.CustomIndex], 0 ) );
|
||||
|
||||
// Disable Custom Menu.
|
||||
%contextMenu.enableItem( %contextMenu.CustomIndex, false );
|
||||
}
|
||||
|
||||
// Cache.
|
||||
$VerveEditor::VController::ContextMenu[%this.getClassName()] = %contextMenu;
|
||||
}
|
||||
|
||||
// Enable / Disable Director Group.
|
||||
%contextMenu.enableItem( %contextMenu.DirectorIndex, %this.CanAdd( "VDirectorGroup" ) );
|
||||
|
||||
// Return Menu.
|
||||
return %contextMenu;
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VerveEditor::InitControllerScripts()
|
||||
{
|
||||
// Core.
|
||||
exec( "./VController.cs" );
|
||||
exec( "./VControllerProperties.cs" );
|
||||
|
||||
// Custom.
|
||||
// Exec Custom Controller Scripts.
|
||||
}
|
||||
VerveEditor::InitControllerScripts();
|
||||
|
|
@ -0,0 +1,241 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VerveEditor::DeleteControls()
|
||||
{
|
||||
while ( VerveEditorGroupStack.getCount() > 0 )
|
||||
{
|
||||
VerveEditorGroupStack.getObject( 0 ).delete();
|
||||
}
|
||||
|
||||
while ( VerveEditorTrackStack.getCount() > 0 )
|
||||
{
|
||||
VerveEditorTrackStack.getObject( 0 ).delete();
|
||||
}
|
||||
}
|
||||
|
||||
function VerveEditorStack::FindControl( %this, %object )
|
||||
{
|
||||
%trackCount = %this.getCount();
|
||||
for ( %i = 0; %i < %trackCount; %i++ )
|
||||
{
|
||||
%track = %this.getObject( %i );
|
||||
if ( %track.Proxy.getId() == %object.getId() )
|
||||
{
|
||||
return %track;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
function VerveEditorStack::FindControlIndex( %this, %object )
|
||||
{
|
||||
%trackCount = %this.getCount();
|
||||
for ( %i = 0; %i < %trackCount; %i++ )
|
||||
{
|
||||
%track = %this.getObject( %i );
|
||||
if ( %track.Proxy.getId() == %object.getId() )
|
||||
{
|
||||
return %i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
function VerveEditorTimeLine::onLoseFirstResponder( %this )
|
||||
{
|
||||
// Clear Selection.
|
||||
%this.setSelection( false );
|
||||
|
||||
// Force OnSelectionUpdate.
|
||||
%this.onSelectionUpdate();
|
||||
}
|
||||
|
||||
function VerveEditorTimeLine::StopUpdate( %this )
|
||||
{
|
||||
// Cancel Event.
|
||||
cancel( $VerveEditor::Controller::TickEvent );
|
||||
}
|
||||
|
||||
function VerveEditorTimeLine::ControllerUpdate( %this )
|
||||
{
|
||||
// Cancel Event.
|
||||
cancel( $VerveEditor::Controller::TickEvent );
|
||||
|
||||
%scrollParent = %this.getParentOfType( "VEditorScrollControl" );
|
||||
if ( !isObject( %scrollParent ) )
|
||||
{
|
||||
// Woops!
|
||||
return;
|
||||
}
|
||||
|
||||
// Fetch Point.
|
||||
%point = %this.toPoint( $VerveEditor::Controller.Time );
|
||||
|
||||
// Fetch Scroll Point.
|
||||
%scrollPoint = %scrollParent.getScrollPositionX();
|
||||
%scrollWidth = getWord( %scrollParent.getExtent(), 0 ) - 19;
|
||||
|
||||
if ( ( %point < %scrollPoint ) || ( %point > ( %scrollPoint + %scrollWidth ) ) )
|
||||
{
|
||||
// Scroll To View Time.
|
||||
%scrollParent.setScrollPosition( %point - %scrollWidth * 0.50, 0 );
|
||||
}
|
||||
|
||||
// Schedule Next Event.
|
||||
$VerveEditor::Controller::TickEvent = %this.schedule( 100, "ControllerUpdate" );
|
||||
}
|
||||
|
||||
function VerveEditorTimeLine::onSelectionUpdate( %this )
|
||||
{
|
||||
// Fetch Selection.
|
||||
%selectionString = %this.getSelection();
|
||||
|
||||
%selectionActive = getWord( %selectionString, 0 );
|
||||
if ( !%selectionActive )
|
||||
{
|
||||
// Clear Selection.
|
||||
VerveEditorTrackTimeLine.setSelection( false );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !getWord( VerveEditorTrackTimeLine.getSelection(), 0 ) )
|
||||
{
|
||||
// Clear Editor Selection.
|
||||
VerveEditor::ClearSelection();
|
||||
}
|
||||
|
||||
// Set Selection.
|
||||
VerveEditorTrackTimeLine.setSelection( true, getWord( %selectionString, 1 ), getWord( %selectionString, 2 ) );
|
||||
}
|
||||
}
|
||||
|
||||
function VerveEditorTimeLine::onSelectionRightClick( %this, %point, %modifiers, %clickCount )
|
||||
{
|
||||
%this.DisplayContextMenu( getWord( %point, 0 ), getWord( %point, 1 ) );
|
||||
}
|
||||
|
||||
function VerveEditorTimeLine::DisplayContextMenu( %this, %x, %y )
|
||||
{
|
||||
%contextMenu = $VerveEditor::VTimeLine::ContextMenu;
|
||||
if ( !isObject( %contextMenu ) )
|
||||
{
|
||||
%contextMenu = new PopupMenu()
|
||||
{
|
||||
SuperClass = "VerveWindowMenu";
|
||||
|
||||
IsPopup = true;
|
||||
|
||||
Label = "VTimeLineMenu";
|
||||
Position = 0;
|
||||
|
||||
Item[0] = "Insert Time Before" TAB "" TAB "VerveEditorTimeLine.InsertTimeBefore();";
|
||||
Item[1] = "Insert Time After" TAB "" TAB "VerveEditorTimeLine.InsertTimeAfter();";
|
||||
|
||||
Item[2] = "" TAB "";
|
||||
|
||||
Item[3] = "Delete Time" TAB "" TAB "VerveEditorTimeLine.DeleteTime();";
|
||||
|
||||
};
|
||||
%contextMenu.Init();
|
||||
|
||||
// Cache.
|
||||
$VerveEditor::VTimeLine::ContextMenu = %contextMenu;
|
||||
}
|
||||
|
||||
// Display.
|
||||
if($Verve::UseSeparateWindow)
|
||||
%contextMenu.showPopup( VerveEditorWindow, %x, %y );
|
||||
else
|
||||
%contextMenu.showPopup( Canvas, %x, %y );
|
||||
|
||||
}
|
||||
|
||||
function VerveEditorTimeLine::InsertTimeBefore( %this )
|
||||
{
|
||||
// Fetch Selection.
|
||||
%selectionString = %this.getSelection();
|
||||
%selectionActive = getWord( %selectionString, 0 );
|
||||
if ( !%selectionActive )
|
||||
{
|
||||
// Woops!
|
||||
return;
|
||||
}
|
||||
|
||||
// Determine Position.
|
||||
%selectionPosition = getWord( %selectionString, 1 );
|
||||
|
||||
// Insert Time.
|
||||
VerveEditor::InsertTime( %selectionPosition, getWord( %selectionString, 2 ) );
|
||||
}
|
||||
|
||||
function VerveEditorTimeLine::InsertTimeAfter( %this )
|
||||
{
|
||||
// Fetch Selection.
|
||||
%selectionString = %this.getSelection();
|
||||
%selectionActive = getWord( %selectionString, 0 );
|
||||
if ( !%selectionActive )
|
||||
{
|
||||
// Woops!
|
||||
return;
|
||||
}
|
||||
|
||||
// Determine Position.
|
||||
%selectionPosition = getWord( %selectionString, 1 ) + getWord( %selectionString, 2 );
|
||||
|
||||
// Insert Time.
|
||||
VerveEditor::InsertTime( %selectionPosition, getWord( %selectionString, 2 ) );
|
||||
}
|
||||
|
||||
function VerveEditorTimeLine::DeleteTime( %this )
|
||||
{
|
||||
// Fetch Selection.
|
||||
%selectionString = %this.getSelection();
|
||||
%selectionActive = getWord( %selectionString, 0 );
|
||||
if ( !%selectionActive )
|
||||
{
|
||||
// Woops!
|
||||
return;
|
||||
}
|
||||
|
||||
// Determine Position.
|
||||
%selectionPosition = getWord( %selectionString, 1 );
|
||||
|
||||
// Delete Time.
|
||||
VerveEditor::DeleteTime( %selectionPosition, getWord( %selectionString, 2 ) );
|
||||
|
||||
// Clear Selection.
|
||||
%this.setSelection( false );
|
||||
|
||||
// Force OnSelectionUpdate.
|
||||
%this.onSelectionUpdate();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
function VerveEditorTimeLineBackground::onMouseUp( %this, %point, %modifiers, %clickCount )
|
||||
{
|
||||
// Clear Selection.
|
||||
VerveEditor::ClearSelection();
|
||||
}
|
||||
|
||||
function VerveEditorTimeLineBackground::onRightMouseUp( %this, %point, %modifiers, %clickCount )
|
||||
{
|
||||
// Clear Selection.
|
||||
VerveEditor::ClearSelection();
|
||||
|
||||
if ( !%this.Context )
|
||||
{
|
||||
// Return.
|
||||
return;
|
||||
}
|
||||
|
||||
// Display Context Menu.
|
||||
$VerveEditor::Controller.schedule( 32, "DisplayContextMenu", getWord( %point, 0 ), getWord( %point, 1 ) );
|
||||
}
|
||||
|
|
@ -0,0 +1,265 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
$VerveEditor::HistoryManager = new UndoManager( VerveEditorHistoryManager );
|
||||
$VerveEditor::UndoCount = 0;
|
||||
$VerveEditor::RedoCount = 0;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VerveEditor::IsDirty()
|
||||
{
|
||||
if ( !isObject( VerveEditorHistoryManager ) )
|
||||
{
|
||||
// Woops!
|
||||
return false;
|
||||
}
|
||||
|
||||
return !( ( VerveEditorHistoryManager.getUndoCount() == $VerveEditor::UndoCount )
|
||||
&& ( VerveEditorHistoryManager.getRedoCount() == $VerveEditor::RedoCount ) );
|
||||
}
|
||||
|
||||
function VerveEditor::ClearDirty()
|
||||
{
|
||||
// Reset.
|
||||
$VerveEditor::UndoCount = VerveEditorHistoryManager.getUndoCount();
|
||||
$VerveEditor::RedoCount = VerveEditorHistoryManager.getRedoCount();
|
||||
}
|
||||
|
||||
function VerveEditor::ClearHistory()
|
||||
{
|
||||
// Clear History.
|
||||
VerveEditorHistoryManager.clearAll();
|
||||
|
||||
// Clear Dirty.
|
||||
VerveEditor::ClearDirty();
|
||||
}
|
||||
|
||||
function VerveEditor::CanUndo()
|
||||
{
|
||||
return ( VerveEditorHistoryManager.getUndoCount() > 0 );
|
||||
}
|
||||
|
||||
function VerveEditor::Undo()
|
||||
{
|
||||
VerveEditorHistoryManager.Undo();
|
||||
|
||||
// Refresh.
|
||||
VerveEditor::Refresh();
|
||||
}
|
||||
|
||||
function VerveEditor::CanRedo()
|
||||
{
|
||||
return ( VerveEditorHistoryManager.getRedoCount() > 0 );
|
||||
}
|
||||
|
||||
function VerveEditor::Redo()
|
||||
{
|
||||
VerveEditorHistoryManager.Redo();
|
||||
|
||||
// Refresh.
|
||||
VerveEditor::Refresh();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
function VerveEditorHistoryObject::onAdd( %this )
|
||||
{
|
||||
%historyManager = VerveEditorHistoryManager;
|
||||
if ( %historyManager.Locked )
|
||||
{
|
||||
// Delete.
|
||||
%this.schedule( 0, delete );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( isObject( %historyManager.HistoryGroup ) )
|
||||
{
|
||||
// Add To Group.
|
||||
%historyManager.HistoryGroup.Group.add( %this );
|
||||
return;
|
||||
}
|
||||
|
||||
// Add To Manager.
|
||||
%this.addToManager( %historyManager );
|
||||
|
||||
// Update Window.
|
||||
VerveEditorWindow.UpdateWindowTitle();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
function VerveEditor::ToggleHistoryGroup()
|
||||
{
|
||||
%historyManager = VerveEditorHistoryManager;
|
||||
if ( isObject( %historyManager.HistoryGroup ) )
|
||||
{
|
||||
// Clear.
|
||||
%historyManager.HistoryGroup = 0;
|
||||
|
||||
// Update Window.
|
||||
VerveEditorWindow.UpdateWindowTitle();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ( VerveEditorHistoryManager.Locked )
|
||||
{
|
||||
// Locked.
|
||||
return;
|
||||
}
|
||||
|
||||
%historyManager.HistoryGroup = new UndoScriptAction()
|
||||
{
|
||||
Class = "VerveEditorHistoryGroup";
|
||||
|
||||
ActionName = "History Group";
|
||||
|
||||
// Store Object References.
|
||||
Group = new SimGroup();
|
||||
};
|
||||
|
||||
// Add To Manager.
|
||||
%historyManager.HistoryGroup.addToManager( %historyManager );
|
||||
}
|
||||
|
||||
function VerveEditorHistoryGroup::onRemove( %this )
|
||||
{
|
||||
if ( isObject( %this.Group ) )
|
||||
{
|
||||
// Delete Group.
|
||||
%this.Group.delete();
|
||||
}
|
||||
}
|
||||
|
||||
function VerveEditorHistoryGroup::Undo( %this )
|
||||
{
|
||||
// Undo In Reverse Order.
|
||||
|
||||
%undoCount = %this.Group.getCount();
|
||||
for ( %i = ( %undoCount - 1 ); %i >= 0; %i-- )
|
||||
{
|
||||
%this.Group.getObject( %i ).Undo();
|
||||
}
|
||||
}
|
||||
|
||||
function VerveEditorHistoryGroup::Redo( %this )
|
||||
{
|
||||
%undoCount = %this.Group.getCount();
|
||||
for ( %i = 0; %i < %undoCount; %i++ )
|
||||
{
|
||||
%this.Group.getObject( %i ).Redo();
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
function VerveEditorHistoryCreateObject::Undo( %this )
|
||||
{
|
||||
// Undo Delete.
|
||||
%parentObject = %this.Parent;
|
||||
%object = %this.Object;
|
||||
|
||||
// Detach Object.
|
||||
%parentObject.removeObject( %object );
|
||||
}
|
||||
|
||||
function VerveEditorHistoryCreateObject::Redo( %this )
|
||||
{
|
||||
// Redo Delete.
|
||||
%parentObject = %this.Parent;
|
||||
%object = %this.Object;
|
||||
|
||||
// Attach Object.
|
||||
%parentObject.addObject( %object );
|
||||
}
|
||||
|
||||
function VerveEditorHistoryCreateObject::onRemove( %this )
|
||||
{
|
||||
/*
|
||||
if ( !isObject( %this.Object.getParent() ) || %this.Object.getParent().getId() != %this.Parent.getId() )
|
||||
{
|
||||
SimObject::Delete( %this.Object );
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
function VerveEditorHistoryDeleteObject::Undo( %this )
|
||||
{
|
||||
// Undo Delete.
|
||||
%parentObject = %this.Parent;
|
||||
%object = %this.Object;
|
||||
|
||||
// Attach Object.
|
||||
%parentObject.addObject( %object );
|
||||
}
|
||||
|
||||
function VerveEditorHistoryDeleteObject::Redo( %this )
|
||||
{
|
||||
// Redo Delete.
|
||||
%parentObject = %this.Parent;
|
||||
%object = %this.Object;
|
||||
|
||||
// Detach Object.
|
||||
%parentObject.removeObject( %object );
|
||||
}
|
||||
|
||||
function VerveEditorHistoryDeleteObject::onRemove( %this )
|
||||
{
|
||||
/*
|
||||
if ( !isObject( %this.Object.getParent() ) || %this.Object.getParent().getId() != %this.Parent.getId() )
|
||||
{
|
||||
SimObject::Delete( %this.Object );
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
function VerveEditorHistoryChangeProperty::Undo( %this )
|
||||
{
|
||||
// Undo Change.
|
||||
%object = %this.Object;
|
||||
%fieldName = %this.FieldName;
|
||||
%oldValue = %this.OldValue;
|
||||
|
||||
// Lock History.
|
||||
VerveEditorHistoryManager.Locked = true;
|
||||
|
||||
// Attach Object.
|
||||
%object.setFieldValue( %fieldName, %oldValue, false );
|
||||
|
||||
// Unlock History.
|
||||
VerveEditorHistoryManager.Locked = false;
|
||||
}
|
||||
|
||||
function VerveEditorHistoryChangeProperty::Redo( %this )
|
||||
{
|
||||
// Redo Change.
|
||||
%object = %this.Object;
|
||||
%fieldName = %this.FieldName;
|
||||
%newValue = %this.NewValue;
|
||||
|
||||
// Lock History.
|
||||
VerveEditorHistoryManager.Locked = true;
|
||||
|
||||
// Attach Object.
|
||||
%object.setFieldValue( %fieldName, %newValue, false );
|
||||
|
||||
// Unlock History.
|
||||
VerveEditorHistoryManager.Locked = false;
|
||||
}
|
||||
|
||||
function VerveEditorHistoryManager::Lock( %this )
|
||||
{
|
||||
%this.Locked = true;
|
||||
}
|
||||
|
||||
function VerveEditorHistoryManager::UnLock( %this )
|
||||
{
|
||||
%this.Locked = false;
|
||||
}
|
||||
261
Templates/BaseGame/game/tools/VerveEditor/Scripts/EditorMenu.cs
Normal file
261
Templates/BaseGame/game/tools/VerveEditor/Scripts/EditorMenu.cs
Normal file
|
|
@ -0,0 +1,261 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VerveWindowMenu::Clear( %this )
|
||||
{
|
||||
while ( %this.getItemCount() > 0 )
|
||||
{
|
||||
%this.removeItem( 0 );
|
||||
}
|
||||
}
|
||||
|
||||
function VerveWindowMenu::Init( %this )
|
||||
{
|
||||
// Clear Items.
|
||||
%this.Clear();
|
||||
|
||||
%i = 0;
|
||||
while ( %this.Item[%i] !$= "" )
|
||||
{
|
||||
%itemString = %this.Item[%i];
|
||||
%itemLabel = getField( %itemString, 0 );
|
||||
%itemAccel = getField( %itemString, 1 );
|
||||
%itemMethod = getField( %itemString, 2 );
|
||||
%itemMap = getField( %itemString, 3 );
|
||||
|
||||
if ( !isObject( %itemMap ) )
|
||||
{
|
||||
%itemMap = VerveEditorMap;
|
||||
}
|
||||
|
||||
if ( isObject( %itemAccel ) )
|
||||
{
|
||||
%this.insertSubMenu( %i, %itemLabel, %itemAccel );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Insert Item.
|
||||
%this.insertItem( %i, %itemLabel, %itemAccel );
|
||||
|
||||
if ( !%this.IsPopup && %itemAccel !$= "" && isObject( %itemMap ) )
|
||||
{
|
||||
// Label Hack...
|
||||
switch$( %itemAccel )
|
||||
{
|
||||
case "DEL" : %itemAccel = "DELETE";
|
||||
case "ESC" : %itemAccel = "ESCAPE";
|
||||
}
|
||||
|
||||
// Perform Keybind.
|
||||
%itemMap.bindCmd( "keyboard", strreplace( %itemAccel, "+", " " ), %itemMethod, "" );
|
||||
}
|
||||
}
|
||||
|
||||
%i++;
|
||||
}
|
||||
}
|
||||
|
||||
function VerveWindowMenu::onSelectItem( %this, %id, %text )
|
||||
{
|
||||
%command = getField( %this.item[%id], 2 );
|
||||
if ( %command !$= "" )
|
||||
{
|
||||
eval( %command );
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
function VerveEditorWindow::onCreateMenu( %this )
|
||||
{
|
||||
// Store Menu Bars.
|
||||
if ( !isObject( %this.MenuSet ) )
|
||||
{
|
||||
%this.MenuSet = new SimSet();
|
||||
}
|
||||
|
||||
// CMD Key.
|
||||
%cmdKey = $platform $= "macos" ? "Cmd" : "Ctrl";
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
//
|
||||
// File Menu
|
||||
//
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
%recentSequenceMenu = new PopupMenu()
|
||||
{
|
||||
Class = "VerveRecentFileMenu";
|
||||
SuperClass = "VerveWindowMenu";
|
||||
|
||||
Label = "Recent Files";
|
||||
Position = 0;
|
||||
|
||||
Item[0] = "None";
|
||||
};
|
||||
|
||||
%fileMenu = new PopupMenu()
|
||||
{
|
||||
SuperClass = "VerveWindowMenu";
|
||||
|
||||
Label = "&File";
|
||||
Position = 0;
|
||||
|
||||
Item[0] = "&New" TAB %cmdKey @ "+N" TAB "VerveEditor::NewFile();";
|
||||
Item[1] = "&Open" TAB %cmdKey @ "+O" TAB "VerveEditor::LoadFile();";
|
||||
Item[2] = "" TAB "";
|
||||
Item[3] = "&Save" TAB %cmdKey @ "+S" TAB "VerveEditor::SaveFile();";
|
||||
Item[4] = "Save &As" TAB %cmdKey @ "-Shift+S" TAB "VerveEditor::SaveFile( true );";
|
||||
Item[5] = "" TAB "";
|
||||
Item[6] = "Recent Files" TAB %recentSequenceMenu;
|
||||
};
|
||||
%this.MenuSet.add( %fileMenu );
|
||||
|
||||
if ( $platform !$= "macos" )
|
||||
{
|
||||
%fileMenu.Item[7] = "" TAB "";
|
||||
%fileMenu.Item[8] = "&Close" TAB %cmdKey @ "+F4" TAB "ToggleVerveEditor( true );";
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
//
|
||||
// Edit Menu
|
||||
//
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
%editMenu = new PopupMenu()
|
||||
{
|
||||
Class = "VerveWindowEditMenu";
|
||||
SuperClass = "VerveWindowMenu";
|
||||
|
||||
Label = "&Edit";
|
||||
Position = 1;
|
||||
|
||||
Item[0] = "&Undo" TAB %cmdKey @ "+Z" TAB "VerveEditor::Undo();";
|
||||
Item[1] = "&Redo" TAB %cmdKey @ "+Y" TAB "VerveEditor::Redo();";
|
||||
Item[2] = "" TAB "";
|
||||
Item[3] = "Cu&t" TAB %cmdKey @ "+X" TAB "VerveEditor::CutSelection();" TAB VerveEditorEditMap;
|
||||
Item[4] = "&Copy" TAB %cmdKey @ "+C" TAB "VerveEditor::CopySelection();" TAB VerveEditorEditMap;
|
||||
Item[5] = "&Paste" TAB %cmdKey @ "+V" TAB "VerveEditor::Paste();" TAB VerveEditorEditMap;
|
||||
|
||||
Item[6] = "" TAB "";
|
||||
Item[7] = "&Delete" TAB "Del" TAB "VerveEditor::DeleteSelection();" TAB VerveEditorEditMap;
|
||||
|
||||
Item[8] = "" TAB "";
|
||||
Item[9] = "&Clear Selection" TAB "Esc" TAB "VerveEditor::ClearSelection();";
|
||||
|
||||
Item[10] = "" TAB "";
|
||||
Item[11] = "&Preferences" TAB %cmdKey @ "+P" TAB "VerveEditor::LaunchEditorPreferences();";
|
||||
};
|
||||
%this.MenuSet.add( %editMenu );
|
||||
|
||||
// Init Popups.
|
||||
%fileMenu.Init();
|
||||
%editMenu.Init();
|
||||
|
||||
// Attach.
|
||||
%fileMenu.attachToMenuBar( %this, %fileMenu.Position, %fileMenu.Label );
|
||||
%editMenu.attachToMenuBar( %this, %editMenu.Position, %editMenu.Label );
|
||||
}
|
||||
|
||||
function VerveEditorWindow::ClearMenu( %this )
|
||||
{
|
||||
if ( isObject( %this.MenuSet ) )
|
||||
{
|
||||
while( %this.MenuSet.getCount() > 0 )
|
||||
{
|
||||
// Fetch Object.
|
||||
%menuObject = %this.MenuSet.getObject( 0 );
|
||||
|
||||
// Detach.
|
||||
%menuObject.removeFromMenuBar();
|
||||
|
||||
// Delete.
|
||||
%menuObject.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function VerveEditorWindow::onDestroyMenu( %this )
|
||||
{
|
||||
// Clear the Menu.
|
||||
%this.ClearMenu();
|
||||
|
||||
// Delete the Menu Set.
|
||||
if ( isObject( %this.MenuSet ) )
|
||||
{
|
||||
%this.MenuSet.delete();
|
||||
}
|
||||
}
|
||||
|
||||
function VerveRecentFileMenu::onMenuSelect( %this )
|
||||
{
|
||||
%this.Refresh();
|
||||
}
|
||||
|
||||
function VerveRecentFileMenu::onSelectItem( %this, %index, %text )
|
||||
{
|
||||
// Load the File.
|
||||
VerveEditor::LoadFile( $Pref::VerveEditor::RecentFile[ %index ] );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function VerveRecentFileMenu::Refresh( %this )
|
||||
{
|
||||
// Clear The List.
|
||||
%this.Clear();
|
||||
|
||||
// Populate Menu.
|
||||
if ( $Pref::VerveEditor::RecentFileSize == 0 || $Pref::VerveEditor::RecentFile[0] $= "" )
|
||||
{
|
||||
// Insert Default Item.
|
||||
%this.insertItem( 0, %this.Item[0], "" );
|
||||
|
||||
// Disable.
|
||||
%this.enableItem( 0, false );
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( %i = 0; %i < $Pref::VerveEditor::RecentFileSize; %i++ )
|
||||
{
|
||||
// Valid?
|
||||
if ( $Pref::VerveEditor::RecentFile[%i] $= "" )
|
||||
{
|
||||
// Nope!
|
||||
break;
|
||||
}
|
||||
|
||||
// Insert Item.
|
||||
%this.insertItem( %i, makeRelativePath( $Pref::VerveEditor::RecentFile[%i], $VerveEditor::FilePath ), "" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function VerveWindowEditMenu::onMenuSelect( %this )
|
||||
{
|
||||
%this.Refresh();
|
||||
}
|
||||
|
||||
function VerveWindowEditMenu::Refresh( %this )
|
||||
{
|
||||
// Undo & Redo.
|
||||
%this.enableItem( 0, VerveEditor::CanUndo() );
|
||||
%this.enableItem( 1, VerveEditor::CanRedo() );
|
||||
|
||||
// Cut, Copy & Paste.
|
||||
%this.enableItem( 3, VerveEditor::CanCopy() );
|
||||
%this.enableItem( 4, VerveEditor::CanCopy() );
|
||||
%this.enableItem( 5, VerveEditor::CanPaste() );
|
||||
|
||||
// Delete.
|
||||
%this.enableItem( 7, VerveEditor::CanCopy() );
|
||||
|
||||
// Clear Selection.
|
||||
%this.enableItem( 9, VerveEditor::CanCopy() );
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VerveEditor::LaunchEditorPreferences()
|
||||
{
|
||||
if ( !isObject( VerveEditorPreferenceGui ) )
|
||||
{
|
||||
// Load the GUI.
|
||||
exec ( "~/VerveEditor/GUI/VerveEditorPreferences.gui" );
|
||||
}
|
||||
|
||||
// Awake?
|
||||
if ( VerveEditorPreferenceGui.isAwake() )
|
||||
{
|
||||
// Sanity!.
|
||||
return;
|
||||
}
|
||||
|
||||
// Launch.
|
||||
VerveEditorWindow.pushDialog( VerveEditorPreferenceGui );
|
||||
}
|
||||
|
||||
function VerveEditor::CloseEditorPreferences()
|
||||
{
|
||||
// Close.
|
||||
VerveEditorWindow.popDialog( VerveEditorPreferenceGui );
|
||||
}
|
||||
|
|
@ -0,0 +1,215 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
$VerveEditor::MapStore = new SimSet();
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VerveEditorWindow::Open()
|
||||
{
|
||||
if ( isObject( VerveEditorWindow ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Create the Controller.
|
||||
VerveEditor::CreateController();
|
||||
|
||||
// Create ActionMap.
|
||||
%actionMap = new ActionMap( VerveEditorMap );
|
||||
%actionMap.pop();
|
||||
|
||||
// Create Edit ActionMap.
|
||||
%editActionMap = new ActionMap( VerveEditorEditMap );
|
||||
%editActionMap.pop();
|
||||
|
||||
// Create Window.
|
||||
if($Verve::UseSeparateWindow)
|
||||
{
|
||||
%editorWindow = new VEditorWindow( VerveEditorWindow );
|
||||
|
||||
// Init Window?
|
||||
if ( $Pref::VerveEditor::WindowSize $= "" )
|
||||
{
|
||||
// Default Window Size.
|
||||
%editorWindow.setVideoMode( 800, 253, false );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Last Known Window Size.
|
||||
%editorWindow.setVideoMode( getWord( $Pref::VerveEditor::WindowSize, 0 ),
|
||||
getWord( $Pref::VerveEditor::WindowSize, 1 ),
|
||||
false );
|
||||
}
|
||||
|
||||
return %editorWindow;
|
||||
}
|
||||
else
|
||||
{
|
||||
%editorWindow = new guiWindowCtrl(VerveEditorWindow)
|
||||
{
|
||||
position = "0 0";
|
||||
extent = "1024 768";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
};
|
||||
return %editorWindow;
|
||||
}
|
||||
}
|
||||
|
||||
function VerveEditorWindow::UpdateWindowTitle( %this )
|
||||
{
|
||||
%fileName = fileName( $VerveEditor::Controller.FileName );
|
||||
if ( %fileName $= "" )
|
||||
{
|
||||
%fileName = "Untitled.vsf";
|
||||
}
|
||||
|
||||
if ( VerveEditor::IsDirty() )
|
||||
{
|
||||
// Signify Unsaved Work.
|
||||
%fileName = %fileName @ "*";
|
||||
}
|
||||
|
||||
// Set Title.
|
||||
%this.setWindowTitle( %fileName SPC "- Verve" );
|
||||
}
|
||||
|
||||
function VerveEditorWindow::onGainFocus( %this )
|
||||
{
|
||||
if($Verve::UseSeparateWindow)
|
||||
return;
|
||||
|
||||
%activeSet = ActiveActionMapSet;
|
||||
while ( %activeSet.getCount() > 0 )
|
||||
{
|
||||
// Get Object.
|
||||
%activeMap = %activeSet.getObject( 0 );
|
||||
|
||||
// Pop It.
|
||||
%activeMap.pop();
|
||||
|
||||
if ( %activeMap != GlobalActionMap.getId() )
|
||||
{
|
||||
// Store It.
|
||||
$VerveEditor::MapStore.add( %activeMap );
|
||||
}
|
||||
}
|
||||
|
||||
// Give Our Commands Preference.
|
||||
GlobalActionMap.pop();
|
||||
VerveEditorMap.push();
|
||||
VerveEditorEditMap.push();
|
||||
GlobalActionMap.push();
|
||||
|
||||
// Reset Cursor.
|
||||
%this.resetCursor();
|
||||
}
|
||||
|
||||
function VerveEditorWindow::onLoseFocus( %this )
|
||||
{
|
||||
%activeSet = $VerveEditor::MapStore;
|
||||
// Active Set?
|
||||
if ( isObject( %activeSet ) )
|
||||
{
|
||||
while ( %activeSet.getCount() > 0 )
|
||||
{
|
||||
// Get Object.
|
||||
%activeMap = %activeSet.getObject( 0 );
|
||||
|
||||
// Push It.
|
||||
%activeMap.push();
|
||||
|
||||
// Remove It.
|
||||
$VerveEditor::MapStore.remove( %activeMap );
|
||||
}
|
||||
}
|
||||
|
||||
// Valid Map?
|
||||
if ( isObject( VerveEditorMap ) )
|
||||
{
|
||||
VerveEditorMap.pop();
|
||||
}
|
||||
|
||||
// Valid Map?
|
||||
if ( isObject( VerveEditorEditMap ) )
|
||||
{
|
||||
VerveEditorEditMap.pop();
|
||||
}
|
||||
}
|
||||
|
||||
function VerveEditorWindow::onRemove( %this )
|
||||
{
|
||||
// Save?
|
||||
// Note: This crashes the game!
|
||||
// At this stage, if the editor is dirty a save prompt should have
|
||||
// been made already... Lets hope!
|
||||
//VerveEditor::SavePrompt();
|
||||
|
||||
// Clear Inspector.
|
||||
VerveEditorPropertyStack.ClearStack();
|
||||
|
||||
if ( isObject( VerveEditorMap ) )
|
||||
{
|
||||
VerveEditorMap.delete();
|
||||
}
|
||||
|
||||
if ( isObject( VerveEditorEditMap ) )
|
||||
{
|
||||
VerveEditorEditMap.delete();
|
||||
}
|
||||
|
||||
// Clear the Menu.
|
||||
%this.ClearMenu();
|
||||
|
||||
// Force Reset.
|
||||
%this.onLoseFocus();
|
||||
|
||||
// Store the Window Extents on Shutdown.
|
||||
$Pref::VerveEditor::WindowSize = getWords( %this.getVideoMode(), 0, 1 );
|
||||
|
||||
// Playing?
|
||||
if ( $VerveEditor::Controller.isPlaying() )
|
||||
{
|
||||
// Stop, but do not reset.
|
||||
$VerveEditor::Controller.stop( false );
|
||||
}
|
||||
|
||||
// Clear the Current Sequence.
|
||||
$VerveEditor::Controller.clear();
|
||||
// Clear the File Name.
|
||||
$VerveEditor::Controller.FileName = "";
|
||||
|
||||
/*
|
||||
// Delete the Controller.
|
||||
VerveEditor::DeleteController();
|
||||
*/
|
||||
|
||||
if ( isFile( $VerveEditor::TemplateVClipboard ) )
|
||||
{
|
||||
// Clear Clipboard.
|
||||
fileDelete( $VerveEditor::TemplateVClipboard );
|
||||
}
|
||||
|
||||
// World Editor Initialised?
|
||||
if ( isObject( VerveEditorPlugin.ToolbarButton ) )
|
||||
{
|
||||
// Toggle Off the Plugin Button.
|
||||
VerveEditorPlugin.ToolbarButton.setStateOn( false );
|
||||
}
|
||||
}
|
||||
|
||||
function VerveEditorWindow::onWindowClose( %this )
|
||||
{
|
||||
if ( !VerveEditor::SavePromptCancel() )
|
||||
{
|
||||
// Don't Close.
|
||||
return;
|
||||
}
|
||||
|
||||
// Delete Window.
|
||||
%this.schedule( 0, delete );
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VCameraShakeEventPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
Parent = "VEventDPropertyList";
|
||||
|
||||
Group[0] = "VCameraShakeEvent";
|
||||
Field[0, 0] = "Falloff";
|
||||
Field[0, 1] = "Amplitude";
|
||||
Field[0, 2] = "Frequency";
|
||||
};
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VDirectorEventPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
Parent = "VEventPropertyList";
|
||||
|
||||
Group[0] = "VDirectorEvent";
|
||||
Field[0, 0] = "Label";
|
||||
Field[0, 1] = "Target";
|
||||
Type[0, 1] = "VCameraGroupEnum";
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VDirectorEvent::onRemove( %this )
|
||||
{
|
||||
// Schedule Update.
|
||||
%this.getParent().schedule( 0, "update" );
|
||||
}
|
||||
|
||||
function VDirectorEvent::Refresh( %this, %trackContainer )
|
||||
{
|
||||
// Create Control.
|
||||
%eventButton = Parent::Refresh( %this, %trackContainer );
|
||||
|
||||
// Reference Label.
|
||||
%eventButton.LabelField = "EventLabel";
|
||||
|
||||
// Add Field Notify.
|
||||
%this.AddFieldNotify( "EventLabel", %eventButton );
|
||||
|
||||
// Update Label.
|
||||
%this.UpdateLabel();
|
||||
}
|
||||
|
||||
function VDirectorEvent::OnFieldChange( %this, %fieldName, %oldValue, %newValue )
|
||||
{
|
||||
// Parent Callback.
|
||||
Parent::OnFieldChange( %this, %fieldName, %oldValue, %newValue );
|
||||
|
||||
// Fetch Parent.
|
||||
%parent = %this.getParent();
|
||||
if ( !isObject( %parent ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch$( %fieldName )
|
||||
{
|
||||
case "TriggerTime" : %parent.Update();
|
||||
|
||||
case "Duration" : %parent.Update();
|
||||
|
||||
case "Target" : %this.UpdateLabel();
|
||||
|
||||
case "Label" : %this.UpdateLabel();
|
||||
}
|
||||
}
|
||||
|
||||
function VDirectorEvent::UpdateLabel( %this )
|
||||
{
|
||||
// Valid Target Camera?
|
||||
%targetLabel = %this.Target;
|
||||
if ( %targetLabel $= "" )
|
||||
{
|
||||
%targetLabel = "Invalid Target";
|
||||
}
|
||||
|
||||
// Valid Scene Label?
|
||||
if ( %this.Label !$= "" )
|
||||
{
|
||||
%eventLabel = %this.Label @ ": " @ %targetLabel;
|
||||
}
|
||||
else
|
||||
{
|
||||
%eventLabel = %targetLabel;
|
||||
}
|
||||
|
||||
// Set Value.
|
||||
%this.setFieldValue( "EventLabel", %eventLabel );
|
||||
}
|
||||
|
||||
function VDirectorEvent::getSnapTime( %this, %targetTime )
|
||||
{
|
||||
// Don't Snap to Other Events.
|
||||
|
||||
if ( $VerveEditor::Event::SnapTime > 0 )
|
||||
{
|
||||
// Snap.
|
||||
return mRound( %targetTime, $VerveEditor::Event::SnapTime );
|
||||
}
|
||||
|
||||
// No Snap!
|
||||
return %targetTime;
|
||||
}
|
||||
|
|
@ -0,0 +1,314 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VEventPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
//Parent = "VObjectPropertyList";
|
||||
|
||||
Group[0] = "VEvent";
|
||||
Field[0, 0] = "TriggerTime";
|
||||
};
|
||||
|
||||
new ScriptObject( VEventDPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
//Parent = "VObjectPropertyList";
|
||||
|
||||
Group[0] = "VEvent";
|
||||
Field[0, 0] = "TriggerTime";
|
||||
Field[0, 1] = "Duration";
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VEvent::CanCopy( %this, %targetObject )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
function VEvent::CanPaste( %this, %targetObject )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
function VEvent::Refresh( %this, %trackContainer )
|
||||
{
|
||||
// Store Container Reference.
|
||||
%this.TrackContainer = %trackContainer;
|
||||
|
||||
// Create Control.
|
||||
return VerveEditor::CreateEventControl( %this );
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
function VerveEditor::CreateEventControl( %object )
|
||||
{
|
||||
%eventButton = new VEditorButton()
|
||||
{
|
||||
SuperClass = "VEditorSelectable";
|
||||
Class = "VEditorSelectableEvent";
|
||||
Profile = "VEditorEventProfile";
|
||||
|
||||
HorizSizing = "right";
|
||||
VertSizing = "center";
|
||||
Position = "0 2";
|
||||
Extent = "5 22";
|
||||
MinExtent = "1 22";
|
||||
|
||||
ButtonType = "ToggleButton";
|
||||
GroupNum = "-1";
|
||||
|
||||
// No Text.
|
||||
Text = "";
|
||||
|
||||
// Draggable.
|
||||
IsDraggable = "1";
|
||||
};
|
||||
%object.TrackContainer.add( %eventButton );
|
||||
|
||||
// Reference Proxy.
|
||||
%eventButton.Proxy = %object;
|
||||
|
||||
// Reference Control.
|
||||
%object.Control = %eventButton;
|
||||
|
||||
// Field Notify.
|
||||
%object.AddFieldNotify( "TriggerTime", %eventButton );
|
||||
%object.AddFieldNotify( "Duration", %eventButton );
|
||||
|
||||
return %eventButton;
|
||||
}
|
||||
|
||||
function VEditorSelectableEvent::onMouseDown( %this, %point, %modifiers, %clickCount )
|
||||
{
|
||||
// Fetch Global Position.
|
||||
%globalPosition = %this.getGlobalPosition();
|
||||
|
||||
// Get Local Points.
|
||||
%x = getWord( %point, 0 ) - getWord( %globalPosition, 0 );
|
||||
%y = getWord( %point, 1 ) - getWord( %globalPosition, 1 );
|
||||
|
||||
// Store Mouse Down Point.
|
||||
%this.MouseDown = %x SPC %y;
|
||||
|
||||
// Reset.
|
||||
%this.Proxy.DragModify = false;
|
||||
}
|
||||
|
||||
function VEditorSelectableEvent::onMouseDragged( %this, %point, %modifiers, %clickCount )
|
||||
{
|
||||
if ( !%this.Proxy.DragModify )
|
||||
{
|
||||
// Store Original Time.
|
||||
%this.Proxy.DragTime = %this.Proxy.TriggerTime;
|
||||
|
||||
// Set Selection.
|
||||
VerveEditor::SetSelection( %this );
|
||||
}
|
||||
|
||||
// Fetch Track.
|
||||
%trackControl = %this.Proxy.getParent().Control.SiblingControl;
|
||||
|
||||
// Mouse Position.
|
||||
%mousePosition = getWord( %point, 0 ) - getWord( %trackControl.getGlobalPosition(), 0 ) - getWord( %this.MouseDown, 0 );
|
||||
|
||||
// Fetch Time.
|
||||
%time = mClamp( VerveEditorTimeLine.toTime( %mousePosition ), 0, $VerveEditor::Controller.Duration );
|
||||
|
||||
// Apply.
|
||||
%this.Proxy.SnapToTime( %time, true );
|
||||
}
|
||||
|
||||
function VEditorSelectableEvent::onMouseUp( %this, %point, %modifiers, %clickCount )
|
||||
{
|
||||
Parent::onMouseUp( %this, %point, %modifiers, %clickCount );
|
||||
|
||||
if ( %this.Proxy.DragModify )
|
||||
{
|
||||
// Store New Time.
|
||||
%newTime = %this.Proxy.TriggerTime;
|
||||
|
||||
// Reset Value.
|
||||
%this.Proxy.TriggerTime = %this.Proxy.DragTime;
|
||||
|
||||
// Set Value.
|
||||
%this.Proxy.setFieldValue( "TriggerTime", %newTime );
|
||||
|
||||
// Clear Modify.
|
||||
%this.Proxy.DragModify = false;
|
||||
}
|
||||
}
|
||||
|
||||
function VEvent::getSnapTime( %this, %targetTime )
|
||||
{
|
||||
if ( $Pref::VerveEditor::Event::SnapToSiblings && $Pref::VerveEditor::Event::SnapToSiblingThreshold > 0 )
|
||||
{
|
||||
// Iterate Over Sibling Events.
|
||||
%trackObject = %this.getParent();
|
||||
%eventCount = %trackObject.getCount();
|
||||
for ( %i = 0; %i < %eventCount; %i++ )
|
||||
{
|
||||
%eventObject = %trackObject.getObject( %i );
|
||||
if ( %eventObject.getId() == %this.getId() )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Snap Back -> Front.
|
||||
%snapTime = %eventObject.TriggerTime - %this.Duration;
|
||||
if ( mAbs( %targetTime - %snapTime ) < $Pref::VerveEditor::Event::SnapToSiblingThreshold / 2 )
|
||||
{
|
||||
// Snap.
|
||||
return %snapTime;
|
||||
}
|
||||
|
||||
/*
|
||||
// Overlaping?
|
||||
if ( ( %this.TriggerTime + %this.Duration ) > %eventObject.TriggerTime )
|
||||
{
|
||||
// Snap.
|
||||
return %snapTime;
|
||||
}
|
||||
*/
|
||||
|
||||
// Snap Front -> Back
|
||||
%snapTime = %eventObject.TriggerTime + %eventObject.Duration;
|
||||
if ( mAbs( %targetTime - %snapTime ) < $Pref::VerveEditor::Event::SnapToSiblingThreshold / 2 )
|
||||
{
|
||||
// Snap.
|
||||
return %snapTime;
|
||||
}
|
||||
|
||||
/*
|
||||
// Overlaping?
|
||||
if ( %this.TriggerTime < ( %eventObject.TriggerTime + %eventObject.Duration ) )
|
||||
{
|
||||
// Snap.
|
||||
return %snapTime;
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
if ( $Pref::VerveEditor::Event::SnapToTime && $Pref::VerveEditor::Event::SnapToTimeThreshold > 0 )
|
||||
{
|
||||
// Snap.
|
||||
return mRound( %targetTime, $Pref::VerveEditor::Event::SnapToTimeThreshold );
|
||||
}
|
||||
|
||||
// No Snap!
|
||||
return %targetTime;
|
||||
}
|
||||
|
||||
function VEvent::SnapToTime( %this, %targetTime, %dragged )
|
||||
{
|
||||
// Fetch Duration.
|
||||
%duration = %this.Duration;
|
||||
|
||||
// Nasty Hack.
|
||||
if ( %this.isMemberOfClass( "VDirectorEvent" )
|
||||
|| %this.isMemberOfClass( "VShapeAnimationEvent" ) )
|
||||
{
|
||||
// Clear Duration.
|
||||
%duration = 0;
|
||||
}
|
||||
|
||||
// Snap.
|
||||
%targetTime = %this.getSnapTime( %targetTime );
|
||||
|
||||
if ( %dragged )
|
||||
{
|
||||
if ( %targetTime != %this.TriggerTime )
|
||||
{
|
||||
// Flag Modified.
|
||||
%this.DragModify = true;
|
||||
}
|
||||
|
||||
// Lock History.
|
||||
VerveEditorHistoryManager.Locked = true;
|
||||
|
||||
// Set Time.
|
||||
%this.setFieldValue( "TriggerTime", %targetTime );
|
||||
|
||||
// UnLock History.
|
||||
VerveEditorHistoryManager.Locked = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set Time.
|
||||
%this.setFieldValue( "TriggerTime", %targetTime );
|
||||
}
|
||||
}
|
||||
|
||||
function VEditorSelectableEvent::Update( %this, %fieldName, %fieldValue )
|
||||
{
|
||||
if ( %this.LabelField !$= "" && %this.LabelField $= %fieldName )
|
||||
{
|
||||
// Apply Text.
|
||||
%this.Text = %fieldValue;
|
||||
|
||||
// Return.
|
||||
return;
|
||||
}
|
||||
|
||||
%eventTime = %this.Proxy.getFieldValue( "TriggerTime" );
|
||||
%eventDuration = %this.Proxy.getFieldValue( "Duration" );
|
||||
switch$ ( %fieldName )
|
||||
{
|
||||
case "TriggerTime" : %eventTime = %fieldValue;
|
||||
|
||||
case "Duration" : %eventDuration = %fieldValue;
|
||||
}
|
||||
|
||||
// Update Position
|
||||
%controlPositionX = VerveEditorTimeLine.toPoint( %eventTime );
|
||||
%controlPositionX += ( %eventDuration == 0 ) ? ( -2 ) : 0;
|
||||
|
||||
// Update Extent.
|
||||
%controlExtentX = ( %eventDuration == 0 ) ? 5 : ( VerveEditorTimeLine.toPoint( %eventTime + %eventDuration ) - %controlPositionX );
|
||||
|
||||
%this.setPosition( %controlPositionX, getWord( %this.getPosition(), 1 ) );
|
||||
%this.setExtent( %controlExtentX, getWord( %this.getExtent(), 1 ) );
|
||||
}
|
||||
|
||||
function VEvent::DisplayContextMenu( %this, %x, %y )
|
||||
{
|
||||
%contextMenu = $VerveEditor::VEvent::ContextMenu;
|
||||
if ( !isObject( %contextMenu ) )
|
||||
{
|
||||
%contextMenu = new PopupMenu()
|
||||
{
|
||||
SuperClass = "VerveWindowMenu";
|
||||
|
||||
IsPopup = true;
|
||||
|
||||
Label = "VEventContextMenu";
|
||||
Position = 0;
|
||||
|
||||
Item[0] = "Cu&t" TAB "" TAB "VerveEditor::CutSelection();";
|
||||
Item[1] = "&Copy" TAB "" TAB "VerveEditor::CopySelection( true );";
|
||||
|
||||
Item[2] = "" TAB "";
|
||||
|
||||
Item[3] = "&Delete" TAB "" TAB "VerveEditor::DeleteSelection();";
|
||||
};
|
||||
%contextMenu.Init();
|
||||
|
||||
// Cache.
|
||||
$VerveEditor::VEvent::ContextMenu = %contextMenu;
|
||||
}
|
||||
|
||||
// Enable/Disable Cut & Copy.
|
||||
%contextMenu.enableItem( 0, VerveEditor::CanCopy() );
|
||||
%contextMenu.enableItem( 1, VerveEditor::CanCopy() );
|
||||
|
||||
// Display.
|
||||
if($Verve::UseSeparateWindow)
|
||||
%contextMenu.showPopup( VerveEditorWindow, %x, %y );
|
||||
else
|
||||
%contextMenu.showPopup( Canvas, %x, %y );
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VFadeEventPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
Parent = "VEventDPropertyList";
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VFadeEvent::OnFieldChange( %this, %fieldName, %oldValue, %newValue )
|
||||
{
|
||||
// Parent Callback.
|
||||
Parent::OnFieldChange( %this, %fieldName, %oldValue, %newValue );
|
||||
|
||||
// Fetch Parent.
|
||||
%parent = %this.getParent();
|
||||
if ( !isObject( %parent ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch$( %fieldName )
|
||||
{
|
||||
case "TriggerTime" : %parent.Update();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VLightObjectAnimationEventPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
Parent = "VEventDPropertyList";
|
||||
|
||||
Group[0] = "VLightObjectAnimationEvent";
|
||||
Field[0, 0] = "AnimationData";
|
||||
Type[0, 0] = "VLightAnimationDataEnum";
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VLightObjectAnimationEvent::Refresh( %this, %trackContainer )
|
||||
{
|
||||
// Create Control.
|
||||
%eventButton = Parent::Refresh( %this, %trackContainer );
|
||||
|
||||
// Reference Label.
|
||||
%eventButton.LabelField = "AnimationData";
|
||||
|
||||
// Add Field Notify.
|
||||
%this.AddFieldNotify( "AnimationData", %eventButton );
|
||||
|
||||
// Return Button.
|
||||
return %eventButton;
|
||||
}
|
||||
|
||||
function VLightObjectAnimationEvent::OnFieldChange( %this, %fieldName, %oldValue, %newValue )
|
||||
{
|
||||
// Parent Callback.
|
||||
Parent::OnFieldChange( %this, %fieldName, %oldValue, %newValue );
|
||||
|
||||
// Fetch Parent.
|
||||
%parent = %this.getParent();
|
||||
if ( !isObject( %parent ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch$( %fieldName )
|
||||
{
|
||||
case "AnimationData" : %parent.Update();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VLightObjectToggleEventPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
Parent = "VEventPropertyList";
|
||||
|
||||
Group[0] = "VLightObjectToggleEvent";
|
||||
Field[0, 0] = "Action";
|
||||
Type[0, 0] = "ToggleEnum";
|
||||
};
|
||||
|
|
@ -0,0 +1,183 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VMotionEventPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
Parent = "VEventPropertyList";
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VMotionEvent::CreatePathNode( %this, %transform )
|
||||
{
|
||||
// Fetch Track & Group.
|
||||
%track = %this.getParent();
|
||||
%group = %track.getParent();
|
||||
|
||||
// Fetch Object References.
|
||||
%object = %group.getSceneObject();
|
||||
%path = %track.getPath();
|
||||
|
||||
// Fetch Index.
|
||||
%nodeIndex = %this.getIndex();
|
||||
|
||||
// Create New Node.
|
||||
%path.addNode( %transform, 10, %nodeIndex );
|
||||
|
||||
// Update Transform.
|
||||
%object.setTransform( %transform );
|
||||
|
||||
if ( !VerveEditorHistoryManager.Locked )
|
||||
{
|
||||
// Add History Item.
|
||||
%historyObject = new UndoScriptAction()
|
||||
{
|
||||
Class = "VerveEditorHistoryCreateMotionEvent";
|
||||
SuperClass = "VerveEditorHistoryCreateObject";
|
||||
|
||||
ActionName = "Create Object";
|
||||
|
||||
// Store Object References.
|
||||
Parent = %track;
|
||||
Object = %this;
|
||||
|
||||
// Store Node Information.
|
||||
PathObject = %path;
|
||||
NodeIndex = %nodeIndex;
|
||||
NodeTransform = %path.getNodeWorldTransform( %nodeIndex );
|
||||
NodeWeight = %path.getNodeWeight( %nodeIndex );
|
||||
};
|
||||
|
||||
// Force OnAdd.
|
||||
VerveEditorHistoryObject::onAdd( %historyObject );
|
||||
}
|
||||
|
||||
// Reset the Controller.
|
||||
$VerveEditor::Controller.reset( $VerveEditor::Controller.Time );
|
||||
}
|
||||
|
||||
function VMotionEvent::Delete( %this )
|
||||
{
|
||||
// Fetch Parent.
|
||||
%parentObject = %this.getParent();
|
||||
%rootObject = %this.getRoot();
|
||||
if ( !%parentObject || ( %rootObject.getId() != $VerveEditor::Controller.getId() ) )
|
||||
{
|
||||
// Not Editing, Delete.
|
||||
Parent::delete( %this );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !VerveEditorHistoryManager.Locked )
|
||||
{
|
||||
%path = %parentObject.getPath();
|
||||
%nodeIndex = %this.getIndex();
|
||||
|
||||
// Add History Item.
|
||||
%historyObject = new UndoScriptAction()
|
||||
{
|
||||
Class = "VerveEditorHistoryDeleteMotionEvent";
|
||||
SuperClass = "VerveEditorHistoryDeleteObject";
|
||||
|
||||
ActionName = "Delete Object";
|
||||
|
||||
// Store Object References.
|
||||
Parent = %parentObject;
|
||||
Object = %this;
|
||||
|
||||
// Store Node Information.
|
||||
PathObject = %path;
|
||||
NodeIndex = %nodeIndex;
|
||||
NodeTransform = %path.getNodeWorldTransform( %nodeIndex );
|
||||
NodeWeight = %path.getNodeWeight( %nodeIndex );
|
||||
};
|
||||
|
||||
// Force OnAdd.
|
||||
VerveEditorHistoryObject::onAdd( %historyObject );
|
||||
}
|
||||
|
||||
// Detach Object.
|
||||
%parentObject.removeObject( %this );
|
||||
}
|
||||
|
||||
function VMotionEvent::OnRemove( %this )
|
||||
{
|
||||
// Fetch Path.
|
||||
%path = %this.getParent().getPath();
|
||||
if ( !isObject( %path ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Delete Node.
|
||||
%path.deleteNode( %this.getIndex() );
|
||||
}
|
||||
|
||||
function VMotionEvent::OnSelect( %this )
|
||||
{
|
||||
// Fetch Path.
|
||||
%path = %this.getParent().getPath();
|
||||
if ( !isObject( EVPathEditor ) || !isObject( %path ) )
|
||||
{
|
||||
// No Editor.
|
||||
return;
|
||||
}
|
||||
|
||||
// Update Selection.
|
||||
EVPathEditor.setSelection( %path, %this.getIndex() );
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
function VerveEditorHistoryCreateMotionEvent::Undo( %this )
|
||||
{
|
||||
// Delete Node.
|
||||
%this.PathObject.DeleteNode( %this.NodeIndex );
|
||||
|
||||
// Dirty.
|
||||
EVPathEditor.isDirty = true;
|
||||
|
||||
// Regular Undo.
|
||||
Parent::Undo( %this );
|
||||
}
|
||||
|
||||
function VerveEditorHistoryCreateMotionEvent::Redo( %this )
|
||||
{
|
||||
// Create Node.
|
||||
%this.PathObject.AddNode( %this.NodeTransform, %this.NodeWeight, %this.NodeIndex );
|
||||
|
||||
// Dirty.
|
||||
EVPathEditor.isDirty = true;
|
||||
|
||||
// Regular Redo.
|
||||
Parent::Redo( %this );
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
function VerveEditorHistoryDeleteMotionEvent::Undo( %this )
|
||||
{
|
||||
// Create Node.
|
||||
%this.PathObject.AddNode( %this.NodeTransform, %this.NodeWeight, %this.NodeIndex );
|
||||
|
||||
// Dirty.
|
||||
EVPathEditor.isDirty = true;
|
||||
|
||||
// Regular Undo.
|
||||
Parent::Undo( %this );
|
||||
}
|
||||
|
||||
function VerveEditorHistoryDeleteMotionEvent::Redo( %this )
|
||||
{
|
||||
// Delete Node.
|
||||
%this.PathObject.DeleteNode( %this.NodeIndex );
|
||||
|
||||
// Dirty.
|
||||
EVPathEditor.isDirty = true;
|
||||
|
||||
// Regular Redo.
|
||||
Parent::Redo( %this );
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VParticleEffectToggleEventPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
Parent = "VEventPropertyList";
|
||||
|
||||
Group[0] = "VParticleEffectToggleEvent";
|
||||
Field[0, 0] = "Action";
|
||||
Type[0, 0] = "ToggleEnum";
|
||||
};
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VPostEffectToggleEventPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
Parent = "VEventPropertyList";
|
||||
|
||||
Group[0] = "VPostEffectToggleEvent";
|
||||
Field[0, 0] = "Action";
|
||||
Type[0, 0] = "ToggleEnum";
|
||||
};
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VSceneJumpEventPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
Parent = "VEventPropertyList";
|
||||
|
||||
Group[0] = "VSceneJumpEvent";
|
||||
Field[0, 0] = "Target";
|
||||
Type[0, 0] = "VSceneEnum";
|
||||
};
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VScriptEventPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
Parent = "VEventPropertyList";
|
||||
|
||||
Group[0] = "VScriptEvent";
|
||||
Field[0, 0] = "CommandType";
|
||||
Type[0, 0] = "VCommandEnum";
|
||||
Field[0, 1] = "Command";
|
||||
};
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VShapeAnimationEventPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
Parent = "VEventDPropertyList";
|
||||
|
||||
Group[0] = "VShapeAnimationEvent";
|
||||
Field[0, 0] = "AnimationData";
|
||||
Type[0, 0] = "VShapeAnimationEnum";
|
||||
Field[0, 1] = "AutoDuration";
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VShapeAnimationEvent::Refresh( %this, %trackContainer )
|
||||
{
|
||||
// Create Control.
|
||||
%eventButton = Parent::Refresh( %this, %trackContainer );
|
||||
|
||||
// Reference Label.
|
||||
%eventButton.LabelField = "AnimationData";
|
||||
|
||||
// Add Field Notify.
|
||||
%this.AddFieldNotify( "AnimationData", %eventButton );
|
||||
%this.AddFieldNotify( "AutoDuration", %eventButton );
|
||||
|
||||
// Return Button.
|
||||
return %eventButton;
|
||||
}
|
||||
|
||||
function VShapeAnimationEvent::OnFieldChange( %this, %fieldName, %oldValue, %newValue )
|
||||
{
|
||||
// Parent Callback.
|
||||
Parent::OnFieldChange( %this, %fieldName, %oldValue, %newValue );
|
||||
|
||||
// Fetch Parent.
|
||||
%parent = %this.getParent();
|
||||
if ( !isObject( %parent ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch$( %fieldName )
|
||||
{
|
||||
case "AnimationData" : %parent.Update();
|
||||
|
||||
case "AutoDuration" : %parent.Update();
|
||||
|
||||
case "TriggerTime" : %parent.Update();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VSlowMoEventPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
Parent = "VEventDPropertyList";
|
||||
|
||||
Group[0] = "VSlowMoEvent";
|
||||
Field[0, 0] = "TimeScale";
|
||||
};
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VSoundEffectEventPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
Parent = "VEventPropertyList";
|
||||
|
||||
Group[0] = "VSoundEffectEvent";
|
||||
Field[0, 0] = "SoundEffect";
|
||||
Type[0, 0] = "VSFXProfileEnum";
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VSoundEffectEvent::Refresh( %this, %trackContainer )
|
||||
{
|
||||
// Create Control.
|
||||
%eventButton = Parent::Refresh( %this, %trackContainer );
|
||||
|
||||
// Reference Label.
|
||||
%eventButton.LabelField = "SoundEffect";
|
||||
|
||||
// Add Field Notify.
|
||||
%this.AddFieldNotify( "SoundEffect", %eventButton );
|
||||
|
||||
// Return Button.
|
||||
return %eventButton;
|
||||
}
|
||||
|
||||
function VSoundEffectEvent::OnFieldChange( %this, %fieldName, %oldValue, %newValue )
|
||||
{
|
||||
switch$ ( %fieldName )
|
||||
{
|
||||
case "SoundEffect" : %this.NotifyFieldChange( "Duration", 0 );
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VSpawnSphereSpawnTargetEventPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
Parent = "VEventPropertyList";
|
||||
};
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VerveEditor::InitEventScripts()
|
||||
{
|
||||
// Core.
|
||||
exec( "./VEvent.cs" );
|
||||
|
||||
// Built-In.
|
||||
exec( "./VCameraShakeEvent.cs" );
|
||||
exec( "./VDirectorEvent.cs" );
|
||||
exec( "./VFadeEvent.cs" );
|
||||
exec( "./VLightObjectAnimationEvent.cs" );
|
||||
exec( "./VLightObjectToggleEvent.cs" );
|
||||
exec( "./VMotionEvent.cs" );
|
||||
exec( "./VParticleEffectToggleEvent.cs" );
|
||||
exec( "./VPostEffectToggleEvent.cs" );
|
||||
exec( "./VSceneJumpEvent.cs" );
|
||||
exec( "./VScriptEvent.cs" );
|
||||
exec( "./VShapeAnimationEvent.cs" );
|
||||
exec( "./VSlowMoEvent.cs" );
|
||||
exec( "./VSoundEffectEvent.cs" );
|
||||
exec( "./VSpawnSphereSpawnTargetEvent.cs" );
|
||||
|
||||
// Custom.
|
||||
// Exec Custom Event Scripts.
|
||||
}
|
||||
VerveEditor::InitEventScripts();
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VCameraGroupPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
Parent = "VSceneObjectGroupPropertyList";
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VCameraGroup::GetAddTrackMenu( %this )
|
||||
{
|
||||
%contextMenu = $VerveEditor::VGroup::ContextMenu[%this.getClassName()];
|
||||
if ( !isObject( %contextMenu ) )
|
||||
{
|
||||
%contextMenu = new PopupMenu()
|
||||
{
|
||||
SuperClass = "VerveWindowMenu";
|
||||
|
||||
IsPopup = true;
|
||||
|
||||
Label = "VCameraGroupAddTrackMenu";
|
||||
Position = 0;
|
||||
|
||||
Item[0] = "Add Animation Track" TAB "" TAB "VerveEditor::AddTrack( \"VShapeAnimationTrack\" );";
|
||||
Item[1] = "Add Camera Shake Track" TAB "" TAB "VerveEditor::AddTrack( \"VCameraShakeTrack\" );";
|
||||
Item[2] = "Add Motion Track" TAB "" TAB "VerveEditor::AddTrack( \"VMotionTrack\" );";
|
||||
Item[3] = "Add Post Effect Track" TAB "" TAB "VerveEditor::AddTrack( \"VPostEffectToggleTrack\" );";
|
||||
Item[4] = "Add Script Event Track" TAB "" TAB "VerveEditor::AddTrack( \"VScriptEventTrack\" );";
|
||||
Item[5] = "Add Sound Effect Track" TAB "" TAB "VerveEditor::AddTrack( \"VSoundEffectTrack\" );";
|
||||
};
|
||||
%contextMenu.Init();
|
||||
|
||||
// Cache.
|
||||
$VerveEditor::VGroup::ContextMenu[%this.getClassName()] = %contextMenu;
|
||||
}
|
||||
|
||||
// Enable/Disable Adding Tracks.
|
||||
%contextMenu.enableItem( 0, %this.CanAdd( "VShapeAnimationTrack" ) );
|
||||
%contextMenu.enableItem( 1, %this.CanAdd( "VCameraShakeTrack" ) );
|
||||
%contextMenu.enableItem( 2, %this.CanAdd( "VMotionTrack" ) );
|
||||
%contextMenu.enableItem( 3, %this.CanAdd( "VPostEffectToggleTrack" ) );
|
||||
%contextMenu.enableItem( 4, %this.CanAdd( "VScriptEventTrack" ) );
|
||||
%contextMenu.enableItem( 5, %this.CanAdd( "VSoundEffectTrack" ) );
|
||||
|
||||
// Return Menu.
|
||||
return %contextMenu;
|
||||
}
|
||||
|
||||
function VCameraGroup::isValid( %this )
|
||||
{
|
||||
// Valid?
|
||||
return VTorque::isCameraObject( %this.getSceneObject() );
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VDirectorGroupPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
Parent = "VGroupPropertyList";
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VDirectorGroup::PopulateBuildStack( %this, %stack )
|
||||
{
|
||||
Parent::PopulateBuildStack( %this, %stack );
|
||||
|
||||
// Create Director Track Checkbox.
|
||||
%directorTrackCheckBox = %stack.CreateCheckbox( "DirectorTrackToggle", "Add Director Track:" );
|
||||
%directorTrackCheckBox.setStateOn( true );
|
||||
}
|
||||
|
||||
function VDirectorGroup::ResolveBuildStack( %this, %stack )
|
||||
{
|
||||
Parent::ResolveBuildStack( %this, %stack, %groupObject );
|
||||
|
||||
// Find the Track Toggle.
|
||||
%directorTrackCheckBox = %stack.findObjectByInternalName( "DirectorTrackToggle", true );
|
||||
if ( isObject( %directorTrackCheckBox ) && %directorTrackCheckBox.getValue() == true )
|
||||
{
|
||||
// Create the Director Track.
|
||||
%directorTrackCheckBox = VerveEditor::AddTrack( "VDirectorTrack", %this, false );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VDirectorGroup::GetAddTrackMenu( %this )
|
||||
{
|
||||
%contextMenu = $VerveEditor::VGroup::ContextMenu[%this.getClassName()];
|
||||
if ( !isObject( %contextMenu ) )
|
||||
{
|
||||
%contextMenu = new PopupMenu()
|
||||
{
|
||||
SuperClass = "VerveWindowMenu";
|
||||
|
||||
IsPopup = true;
|
||||
|
||||
Label = "VGroupAddTrackMenu";
|
||||
Position = 0;
|
||||
|
||||
Item[0] = "Add Director Track" TAB "" TAB "VerveEditor::AddTrack( \"VDirectorTrack\" );";
|
||||
Item[1] = "Add Fade Track" TAB "" TAB "VerveEditor::AddTrack( \"VFadeTrack\" );";
|
||||
Item[2] = "Add Scene Jump Track" TAB "" TAB "VerveEditor::AddTrack( \"VSceneJumpTrack\" );";
|
||||
Item[3] = "Add Script Event Track" TAB "" TAB "VerveEditor::AddTrack( \"VScriptEventTrack\" );";
|
||||
Item[4] = "Add Slow Mo Track" TAB "" TAB "VerveEditor::AddTrack( \"VSlowMoTrack\" );";
|
||||
Item[5] = "Add Sound Effect Track" TAB "" TAB "VerveEditor::AddTrack( \"VSoundEffectTrack\" );";
|
||||
};
|
||||
%contextMenu.Init();
|
||||
|
||||
// Cache.
|
||||
$VerveEditor::VGroup::ContextMenu[%this.getClassName()] = %contextMenu;
|
||||
}
|
||||
|
||||
// Enable/Disable Adding Tracks.
|
||||
%contextMenu.enableItem( 0, %this.CanAdd( "VDirectorTrack" ) );
|
||||
%contextMenu.enableItem( 1, %this.CanAdd( "VFadeTrack" ) );
|
||||
%contextMenu.enableItem( 2, %this.CanAdd( "VSceneJumpTrack" ) );
|
||||
%contextMenu.enableItem( 3, %this.CanAdd( "VScriptEventTrack" ) );
|
||||
%contextMenu.enableItem( 4, %this.CanAdd( "VSlowMoTrack" ) );
|
||||
%contextMenu.enableItem( 5, %this.CanAdd( "VSoundEffectTrack" ) );
|
||||
|
||||
// Return Menu.
|
||||
return %contextMenu;
|
||||
}
|
||||
|
|
@ -0,0 +1,360 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VGroupPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
Parent = "VObjectPropertyList";
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VGroup::OnAdd( %this )
|
||||
{
|
||||
%ourClass = %this.getClassName();
|
||||
if ( isWordInList( %ourClass, $VerveEditor::UniqueGroupList ) )
|
||||
{
|
||||
%controller = $VerveEditor::Controller;
|
||||
%groupCount = %controller.getCount();
|
||||
for ( %i = 0; %i < %groupCount; %i++ )
|
||||
{
|
||||
%groupObject = %controller.getObject( %i );
|
||||
if ( %groupObject.getId() == %this.getId() )
|
||||
{
|
||||
// Skip.
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( %groupObject.isMemberOfClass( %ourClass ) )
|
||||
{
|
||||
// Alert Message.
|
||||
messageBox( "Verve Editor", "You cannot have more than one \"" @ %ourClass @ "\" in your sequence.", "Ok", "Warning" );
|
||||
|
||||
// Invalid.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Regular Add.
|
||||
return Parent::OnAdd( %this );
|
||||
}
|
||||
|
||||
function VGroup::OnAttach( %this )
|
||||
{
|
||||
// Add Event Notify.
|
||||
VerveEditor::AddEventNotify( %this, "VGroupObjectUpdate", "OnGroupObjectUpdate" );
|
||||
}
|
||||
|
||||
function VGroup::OnDetach( %this )
|
||||
{
|
||||
// Remove Event Notify.
|
||||
VerveEditor::RemoveEventNotify( %this, "VGroupObjectUpdate" );
|
||||
}
|
||||
|
||||
function VGroup::CanPaste( %this, %targetObject )
|
||||
{
|
||||
if ( !isObject( %targetObject ) )
|
||||
{
|
||||
// Nope!
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( !%this.CanAdd( %targetObject.getClassName() ) )
|
||||
{
|
||||
// Nope!
|
||||
return false;
|
||||
}
|
||||
|
||||
return %targetObject.isMemberOfClass( "VTrack" );
|
||||
}
|
||||
|
||||
function VGroup::CanAdd( %this, %targetClass )
|
||||
{
|
||||
if ( isWordInList( %targetClass, $VerveEditor::NonUniqueTrackList ) )
|
||||
{
|
||||
// Non-Unique Class.
|
||||
return true;
|
||||
}
|
||||
|
||||
// All Tracks are Unique.
|
||||
%trackCount = %this.getCount();
|
||||
for ( %i = 0; %i < %trackCount; %i++ )
|
||||
{
|
||||
%trackObject = %this.getObject( %i );
|
||||
if ( %trackObject.isMemberOfClass( %targetClass ) )
|
||||
{
|
||||
// Invalid.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// All Good.
|
||||
return true;
|
||||
}
|
||||
|
||||
function VGroup::isValid( %this )
|
||||
{
|
||||
// Yup.
|
||||
return true;
|
||||
}
|
||||
|
||||
function VGroup::Refresh( %this )
|
||||
{
|
||||
// Create Control.
|
||||
%groupControl = VerveEditor::CreateGroupControl( %this );
|
||||
|
||||
// Update Validity.
|
||||
%this.OnGroupObjectUpdate();
|
||||
|
||||
%trackCount = %this.getCount();
|
||||
for ( %i = 0; %i < %trackCount; %i++ )
|
||||
{
|
||||
%this.getObject( %i ).Refresh();
|
||||
}
|
||||
|
||||
// Return Control.
|
||||
return %groupControl;
|
||||
}
|
||||
|
||||
function VGroup::OnFieldChange( %this, %fieldName, %oldValue, %newValue )
|
||||
{
|
||||
// Parent Callback.
|
||||
Parent::OnFieldChange( %this, %fieldName, %oldValue, %newValue );
|
||||
|
||||
switch$ ( %fieldName )
|
||||
{
|
||||
case "Reference" :
|
||||
|
||||
if ( $VerveEditor::InspectorObject.getId() == %this.getId() )
|
||||
{
|
||||
// Post Event.
|
||||
VerveEditor::PostEvent( "VGroupObjectUpdate", %this );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function VGroup::OnGroupObjectUpdate( %this, %refObject )
|
||||
{
|
||||
if ( !isObject( %this.Control ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Update Validity.
|
||||
if ( %this.isValid() )
|
||||
{
|
||||
// Valid.
|
||||
%this.Control.setProfile( "VEditorGroupHeaderProfile" );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Invalid.
|
||||
%this.Control.setProfile( "VEditorGroupHeaderErrorProfile" );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VGroup::PopulateBuildStack( %this, %stack )
|
||||
{
|
||||
// Void.
|
||||
}
|
||||
|
||||
function VGroup::ResolveBuildStack( %this, %stack )
|
||||
{
|
||||
// Void.
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VGroup::DisplayContextMenu( %this, %x, %y )
|
||||
{
|
||||
%contextMenu = $VerveEditor::VGroup::ContextMenu;
|
||||
if ( !isObject( %contextMenu ) )
|
||||
{
|
||||
%contextMenu = new PopupMenu()
|
||||
{
|
||||
SuperClass = "VerveWindowMenu";
|
||||
|
||||
IsPopup = true;
|
||||
|
||||
Label = "VGroupContextMenu";
|
||||
Position = 0;
|
||||
|
||||
Item[0] = "Add Track" TAB "";
|
||||
|
||||
Item[1] = "" TAB "";
|
||||
|
||||
Item[2] = "Cu&t" TAB "" TAB "VerveEditor::CutSelection();";
|
||||
Item[3] = "&Copy" TAB "" TAB "VerveEditor::CopySelection();";
|
||||
Item[4] = "&Paste" TAB "" TAB "VerveEditor::Paste();";
|
||||
|
||||
Item[5] = "" TAB "";
|
||||
|
||||
Item[6] = "&Delete" TAB "" TAB "VerveEditor::DeleteSelection();";
|
||||
|
||||
AddIndex = 0;
|
||||
PasteIndex = 4;
|
||||
};
|
||||
%contextMenu.Init();
|
||||
|
||||
// Cache.
|
||||
$VerveEditor::VGroup::ContextMenu = %contextMenu;
|
||||
}
|
||||
|
||||
// Remove Add Menu.
|
||||
%contextMenu.removeItem( %contextMenu.AddIndex );
|
||||
|
||||
// Available Tracks Menu.
|
||||
%groupMenu = 0;
|
||||
if ( %this.isMethod( "GetAddTrackMenu" ) )
|
||||
{
|
||||
%groupMenu = %this.GetAddTrackMenu();
|
||||
}
|
||||
|
||||
if ( isObject( %groupMenu ) )
|
||||
{
|
||||
// Insert Menu.
|
||||
%contextMenu.insertSubMenu( %contextMenu.AddIndex, getField( %contextMenu.Item[0], 0 ), %groupMenu );
|
||||
|
||||
// Enable.
|
||||
%contextMenu.enableItem( %contextMenu.AddIndex, true );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add Dummy.
|
||||
%contextMenu.insertItem( %contextMenu.AddIndex, getField( %contextMenu.Item[0], 0 ) );
|
||||
|
||||
// Disable.
|
||||
%contextMenu.enableItem( %contextMenu.AddIndex, false );
|
||||
}
|
||||
|
||||
// Enable/Disable Pasting.
|
||||
%contextMenu.enableItem( %contextMenu.PasteIndex, VerveEditor::CanPaste() );
|
||||
|
||||
// Display.
|
||||
%contextMenu.showPopup( VerveEditorWindow, %x, %y );
|
||||
}
|
||||
|
||||
function VGroup::GetAddTrackMenu( %this )
|
||||
{
|
||||
%contextMenu = $VerveEditor::VGroup::ContextMenu[%this.getClassName()];
|
||||
if ( !isObject( %contextMenu ) )
|
||||
{
|
||||
%contextMenu = new PopupMenu()
|
||||
{
|
||||
SuperClass = "VerveWindowMenu";
|
||||
|
||||
IsPopup = true;
|
||||
|
||||
Label = "VGroupAddTrackMenu";
|
||||
Position = 0;
|
||||
|
||||
Item[0] = "Add Track" TAB "" TAB "VerveEditor::AddTrack( \"VTrack\" );";
|
||||
};
|
||||
%contextMenu.Init();
|
||||
|
||||
// Cache.
|
||||
$VerveEditor::VGroup::ContextMenu[%this.getClassName()] = %contextMenu;
|
||||
}
|
||||
|
||||
// Enable/Disable Adding Tracks.
|
||||
%contextMenu.enableItem( 0, %this.CanAdd( "VTrack" ) );
|
||||
|
||||
// Return Menu.
|
||||
return %contextMenu;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VerveEditor::CreateGroupControl( %object )
|
||||
{
|
||||
%groupWidth = getWord( VerveEditorGroupStack.getExtent(), 0 );
|
||||
%groupHeight = 26;
|
||||
%trackWidth = getWord( VerveEditorTrackStack.getExtent(), 0 );
|
||||
%trackHeight = %groupHeight;
|
||||
|
||||
%groupContainer = new VEditorButton()
|
||||
{
|
||||
SuperClass = "VEditorSelectable";
|
||||
Class = "VEditorSelectableGroup";
|
||||
Profile = "VEditorGroupHeaderProfile";
|
||||
|
||||
Bitmap = "~/VerveEditor/GUI/Images/GroupBackground";
|
||||
|
||||
HorizSizing = "width";
|
||||
VertSizing = "bottom";
|
||||
Position = "0 0";
|
||||
Extent = %groupWidth SPC %groupHeight;
|
||||
|
||||
ButtonType = "ToggleButton";
|
||||
GroupNum = "-1";
|
||||
|
||||
IsContainer = "1";
|
||||
};
|
||||
VerveEditorGroupStack.add( %groupContainer );
|
||||
|
||||
%groupCheckbox = new GuiCheckBoxCtrl()
|
||||
{
|
||||
Class = "VEditorBoolPropertyField";
|
||||
InternalName = "Enabled";
|
||||
Profile = "VEditorCheckBoxProfile";
|
||||
|
||||
HorizSizing = "width";
|
||||
VertSizing = "bottom";
|
||||
Position = "4 0";
|
||||
Extent = "14" SPC %groupHeight;
|
||||
|
||||
Object = %object;
|
||||
FieldName = "Enabled";
|
||||
Command = "$ThisControl.ApplyValue();";
|
||||
|
||||
Text = "";
|
||||
};
|
||||
%groupContainer.add( %groupCheckbox );
|
||||
|
||||
%trackContainer = new VEditorButton()
|
||||
{
|
||||
SuperClass = "VEditorSelectable";
|
||||
Class = "VEditorSelectableGroup";
|
||||
Profile = "VEditorGroupTrackProfile";
|
||||
|
||||
Bitmap = "~/VerveEditor/GUI/Images/GroupBackground";
|
||||
|
||||
HorizSizing = "width";
|
||||
VertSizing = "bottom";
|
||||
Position = "0 0";
|
||||
Extent = %trackWidth SPC %trackHeight;
|
||||
|
||||
ButtonType = "ToggleButton";
|
||||
GroupNum = "-1";
|
||||
|
||||
IsContainer = "1";
|
||||
};
|
||||
VerveEditorTrackStack.add( %trackContainer );
|
||||
|
||||
// Field Notify.
|
||||
%object.AddFieldNotify( "Label", %groupContainer );
|
||||
%object.AddFieldNotify( "Enabled", %groupCheckbox );
|
||||
|
||||
// Reference Siblings.
|
||||
%trackContainer.SiblingControl = %groupContainer;
|
||||
%groupContainer.SiblingControl = %trackContainer;
|
||||
|
||||
// Reference Proxy.
|
||||
%groupContainer.Proxy = %object;
|
||||
%trackContainer.Proxy = %object;
|
||||
|
||||
// Reference Control.
|
||||
%object.Control = %groupContainer;
|
||||
|
||||
return %trackContainer;
|
||||
}
|
||||
|
||||
function VEditorSelectableGroup::Update( %this, %fieldName, %fieldValue )
|
||||
{
|
||||
%this.setText( %fieldValue );
|
||||
}
|
||||
|
|
@ -0,0 +1,120 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VLightObjectGroupPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
Parent = "VSceneObjectGroupPropertyList";
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VLightObjectGroup::PopulateBuildStack( %this, %stack )
|
||||
{
|
||||
// Ignore Parent Fields.
|
||||
//Parent::PopulateBuildStack( %this, %stack );
|
||||
|
||||
// Object Reference.
|
||||
%lightObjectList = %stack.CreateObjectList( VTorque::getLightObjectClass(), "LightObjectList", "Light Object:" );
|
||||
|
||||
if ( VTorque::GetSelectedCount() )
|
||||
{
|
||||
%selection = VTorque::GetSelectedObject();
|
||||
if ( %selection.getName() !$= "" && VTorque::isLightObject( %selection ) )
|
||||
{
|
||||
// Select Object.
|
||||
%lightObjectList.setText( %selection.getName() );
|
||||
}
|
||||
}
|
||||
|
||||
// Create Toggle Track Checkbox.
|
||||
%toggleTrackCheckBox = %stack.CreateCheckbox( "ToggleTrackToggle", "Add Toggle Track:" );
|
||||
%toggleTrackCheckBox.setStateOn( true );
|
||||
}
|
||||
|
||||
function VLightObjectGroup::ResolveBuildStack( %this, %stack )
|
||||
{
|
||||
// Ignore Parent Fields.
|
||||
//Parent::ResolveBuildStack( %this, %stack, %groupObject );
|
||||
|
||||
// Fetch the Controller.
|
||||
%controller = %this.getRoot();
|
||||
|
||||
// Find the Particle Effect List.
|
||||
%lightObjectList = %stack.findObjectByInternalName( "LightObjectList", true );
|
||||
if ( isObject( %lightObjectList ) )
|
||||
{
|
||||
// Fetch Selected Object.
|
||||
%lightObject = %lightObjectList.getText();
|
||||
|
||||
// Data Field Name.
|
||||
%dataFieldName = strreplace( %this.Label, " ", "_" );
|
||||
|
||||
// Create a New Data Field.
|
||||
%controller.addDataField( "STATIC", %dataFieldName );
|
||||
|
||||
if ( %lightObject !$= "" )
|
||||
{
|
||||
// Set the Field Value.
|
||||
%controller.setFieldValue( %dataFieldName, %lightObject );
|
||||
}
|
||||
|
||||
// Reference the Data Field.
|
||||
%this.Reference = %dataFieldName;
|
||||
}
|
||||
|
||||
// Find the Track Toggle.
|
||||
%toggleTrackCheckBox = %stack.findObjectByInternalName( "ToggleTrackToggle", true );
|
||||
if ( %toggleTrackCheckBox.getValue() )
|
||||
{
|
||||
// Create the Toggle Track.
|
||||
%toggleTrackCheckBox = VerveEditor::AddTrack( "VLightObjectToggleTrack", %this, false );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VLightObjectGroup::GetAddTrackMenu( %this )
|
||||
{
|
||||
%contextMenu = $VerveEditor::VGroup::ContextMenu[%this.getClassName()];
|
||||
if ( !isObject( %contextMenu ) )
|
||||
{
|
||||
%contextMenu = new PopupMenu()
|
||||
{
|
||||
SuperClass = "VerveWindowMenu";
|
||||
|
||||
IsPopup = true;
|
||||
|
||||
Label = "VLightObjectGroupAddTrackMenu";
|
||||
Position = 0;
|
||||
|
||||
Item[0] = "Add Animation Track" TAB "" TAB "VerveEditor::AddTrack( \"VLightObjectAnimationTrack\" );";
|
||||
Item[1] = "Add Motion Track" TAB "" TAB "VerveEditor::AddTrack( \"VMotionTrack\" );";
|
||||
Item[2] = "Add Script Event Track" TAB "" TAB "VerveEditor::AddTrack( \"VScriptEventTrack\" );";
|
||||
Item[3] = "Add Sound Effect Track" TAB "" TAB "VerveEditor::AddTrack( \"VSoundEffectTrack\" );";
|
||||
Item[4] = "Add Toggle Track" TAB "" TAB "VerveEditor::AddTrack( \"VLightObjectToggleTrack\" );";
|
||||
};
|
||||
%contextMenu.Init();
|
||||
|
||||
// Cache.
|
||||
$VerveEditor::VGroup::ContextMenu[%this.getClassName()] = %contextMenu;
|
||||
}
|
||||
|
||||
// Enable/Disable Adding Tracks.
|
||||
%contextMenu.enableItem( 0, %this.CanAdd( "VLightObjectAnimationTrack" ) );
|
||||
%contextMenu.enableItem( 1, %this.CanAdd( "VMotionTrack" ) );
|
||||
%contextMenu.enableItem( 2, %this.CanAdd( "VScriptEventTrack" ) );
|
||||
%contextMenu.enableItem( 3, %this.CanAdd( "VSoundEffectTrack" ) );
|
||||
%contextMenu.enableItem( 4, %this.CanAdd( "VLightObjectToggleTrack" ) );
|
||||
|
||||
// Return Menu.
|
||||
return %contextMenu;
|
||||
}
|
||||
|
||||
function VLightObjectGroup::isValid( %this )
|
||||
{
|
||||
// Valid?
|
||||
return VTorque::isLightObject( %this.getSceneObject() );
|
||||
}
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VParticleEffectGroupPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
Parent = "VSceneObjectGroupPropertyList";
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VParticleEffectGroup::PopulateBuildStack( %this, %stack )
|
||||
{
|
||||
// Ignore Parent Fields.
|
||||
//Parent::PopulateBuildStack( %this, %stack );
|
||||
|
||||
// Object Reference.
|
||||
%particleEffectList = %stack.CreateObjectList( VTorque::getParticleEffectClass(), "ParticleEffectList", "Particle Effect:" );
|
||||
|
||||
if ( VTorque::GetSelectedCount() )
|
||||
{
|
||||
%selection = VTorque::GetSelectedObject();
|
||||
if ( %selection.getName() !$= "" && VTorque::isParticleEffect( %selection ) )
|
||||
{
|
||||
// Select Object.
|
||||
%particleEffectList.setText( %selection.getName() );
|
||||
}
|
||||
}
|
||||
|
||||
// Create Toggle Track Checkbox.
|
||||
%toggleTrackCheckBox = %stack.CreateCheckbox( "ToggleTrackToggle", "Add Toggle Track:" );
|
||||
%toggleTrackCheckBox.setStateOn( true );
|
||||
}
|
||||
|
||||
function VParticleEffectGroup::ResolveBuildStack( %this, %stack )
|
||||
{
|
||||
// Ignore Parent Fields.
|
||||
//Parent::ResolveBuildStack( %this, %stack, %groupObject );
|
||||
|
||||
// Fetch the Controller.
|
||||
%controller = %this.getRoot();
|
||||
|
||||
// Find the Particle Effect List.
|
||||
%particleEffectList = %stack.findObjectByInternalName( "ParticleEffectList", true );
|
||||
if ( isObject( %particleEffectList ) )
|
||||
{
|
||||
// Fetch Selected Object.
|
||||
%particlEffect = %particleEffectList.getText();
|
||||
|
||||
// Data Field Name.
|
||||
%dataFieldName = strreplace( %this.Label, " ", "_" );
|
||||
|
||||
// Create a New Data Field.
|
||||
%controller.addDataField( "STATIC", %dataFieldName );
|
||||
|
||||
if ( %particlEffect !$= "" )
|
||||
{
|
||||
// Set the Field Value.
|
||||
%controller.setFieldValue( %dataFieldName, %particlEffect );
|
||||
}
|
||||
|
||||
// Reference the Data Field.
|
||||
%this.Reference = %dataFieldName;
|
||||
}
|
||||
|
||||
// Find the Track Toggle.
|
||||
%toggleTrackCheckBox = %stack.findObjectByInternalName( "ToggleTrackToggle", true );
|
||||
if ( %toggleTrackCheckBox.getValue() )
|
||||
{
|
||||
// Create the Toggle Track.
|
||||
%toggleTrackCheckBox = VerveEditor::AddTrack( "VParticleEffectToggleTrack", %this, false );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VParticleEffectGroup::GetAddTrackMenu( %this )
|
||||
{
|
||||
%contextMenu = $VerveEditor::VGroup::ContextMenu[%this.getClassName()];
|
||||
if ( !isObject( %contextMenu ) )
|
||||
{
|
||||
%contextMenu = new PopupMenu()
|
||||
{
|
||||
SuperClass = "VerveWindowMenu";
|
||||
|
||||
IsPopup = true;
|
||||
|
||||
Label = "VParticleEffectGroupAddTrackMenu";
|
||||
Position = 0;
|
||||
|
||||
Item[0] = "Add Motion Track" TAB "" TAB "VerveEditor::AddTrack( \"VMotionTrack\" );";
|
||||
Item[1] = "Add Script Event Track" TAB "" TAB "VerveEditor::AddTrack( \"VScriptEventTrack\" );";
|
||||
Item[2] = "Add Sound Effect Track" TAB "" TAB "VerveEditor::AddTrack( \"VSoundEffectTrack\" );";
|
||||
Item[3] = "Add Toggle Track" TAB "" TAB "VerveEditor::AddTrack( \"VParticleEffectToggleTrack\" );";
|
||||
};
|
||||
%contextMenu.Init();
|
||||
|
||||
// Cache.
|
||||
$VerveEditor::VGroup::ContextMenu[%this.getClassName()] = %contextMenu;
|
||||
}
|
||||
|
||||
// Enable/Disable Adding Tracks.
|
||||
%contextMenu.enableItem( 0, %this.CanAdd( "VMotionTrack" ) );
|
||||
%contextMenu.enableItem( 1, %this.CanAdd( "VScriptEventTrack" ) );
|
||||
%contextMenu.enableItem( 2, %this.CanAdd( "VSoundEffectTrack" ) );
|
||||
%contextMenu.enableItem( 3, %this.CanAdd( "VParticleEffectToggleTrack" ) );
|
||||
|
||||
// Return Menu.
|
||||
return %contextMenu;
|
||||
}
|
||||
|
||||
function VParticleEffectGroup::isValid( %this )
|
||||
{
|
||||
// Valid?
|
||||
return VTorque::isParticleEffect( %this.getSceneObject() );
|
||||
}
|
||||
|
|
@ -0,0 +1,159 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VSceneObjectGroupPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
Parent = "VGroupPropertyList";
|
||||
|
||||
Group[0] = "VGroup";
|
||||
Field[0, 0] = "Reference";
|
||||
Type[0, 0] = "VControllerDataEnum";
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VSceneObjectGroup::OnSelect( %this )
|
||||
{
|
||||
if ( !%this.isValid() )
|
||||
{
|
||||
// Invalid Object.
|
||||
return;
|
||||
}
|
||||
|
||||
// Update Selection.
|
||||
VTorque::SetSelectedObject( %this.getSceneObject() );
|
||||
}
|
||||
|
||||
function VSceneObjectGroup::isValid( %this )
|
||||
{
|
||||
// Valid?
|
||||
return VTorque::isSceneObject( %this.getSceneObject() );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VSceneObjectGroup::PopulateBuildStack( %this, %stack )
|
||||
{
|
||||
Parent::PopulateBuildStack( %this, %stack );
|
||||
|
||||
// Object Reference.
|
||||
%sceneObjectList = %stack.CreateObjectList( "SceneObject", "SceneObjectList", "Scene Object:" );
|
||||
|
||||
if ( VTorque::GetSelectedCount() )
|
||||
{
|
||||
%selection = VTorque::GetSelectedObject();
|
||||
if ( %selection.getName() !$= "" && %selection.isMemberOfClass( "SceneObject" ) )
|
||||
{
|
||||
// Select Object.
|
||||
%sceneObjectList.setText( %selection.getName() );
|
||||
}
|
||||
}
|
||||
|
||||
// Create Motion Track Checkbox.
|
||||
%motionTrackCheckBox = %stack.CreateCheckbox( "MotionTrackToggle", "Add Motion Track:" );
|
||||
%motionTrackCheckBox.setStateOn( true );
|
||||
|
||||
// Object Reference.
|
||||
%pathObjectList = %stack.CreateObjectList( "VPath", "PathObjectList", "Path Object:" );
|
||||
}
|
||||
|
||||
function VSceneObjectGroup::ResolveBuildStack( %this, %stack )
|
||||
{
|
||||
Parent::ResolveBuildStack( %this, %stack, %groupObject );
|
||||
|
||||
// Fetch the Controller.
|
||||
%controller = %this.getRoot();
|
||||
|
||||
// Find the Scene Object List.
|
||||
%sceneObjectList = %stack.findObjectByInternalName( "SceneObjectList", true );
|
||||
if ( isObject( %sceneObjectList ) )
|
||||
{
|
||||
// Fetch Selected Object.
|
||||
%sceneObject = %sceneObjectList.getText();
|
||||
|
||||
// Data Field Name.
|
||||
%dataFieldName = strreplace( %this.Label, " ", "_" );
|
||||
|
||||
// Create a New Data Field.
|
||||
%controller.addDataField( "STATIC", %dataFieldName );
|
||||
|
||||
if ( %sceneObject !$= "" )
|
||||
{
|
||||
// Set the Field Value.
|
||||
%controller.setFieldValue( %dataFieldName, %sceneObject );
|
||||
}
|
||||
|
||||
// Reference the Data Field.
|
||||
%this.Reference = %dataFieldName;
|
||||
}
|
||||
|
||||
// Find the Path Toggle.
|
||||
%motionTrackCheckBox = %stack.findObjectByInternalName( "MotionTrackToggle", true );
|
||||
if ( %motionTrackCheckBox.getValue() )
|
||||
{
|
||||
// Create the Motion Track.
|
||||
%motionTrack = VerveEditor::AddTrack( "VMotionTrack", %this, false );
|
||||
|
||||
%pathObjectList = %stack.findObjectByInternalName( "PathObjectList", true );
|
||||
if ( isObject( %pathObjectList ) )
|
||||
{
|
||||
// Fetch Selected Object.
|
||||
%pathObject = %pathObjectList.getText();
|
||||
|
||||
// Data Field Name.
|
||||
%dataFieldName = strreplace( %this.Label @ "Path", " ", "_" );
|
||||
|
||||
// Create a New Data Field.
|
||||
%controller.addDataField( "STATIC", %dataFieldName );
|
||||
|
||||
if ( %pathObject !$= "" )
|
||||
{
|
||||
// Set the Field Value.
|
||||
%controller.setFieldValue( %dataFieldName, %pathObject );
|
||||
}
|
||||
|
||||
// Reference the Data Field.
|
||||
%motionTrack.Reference = %dataFieldName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VSceneObjectGroup::GetAddTrackMenu( %this )
|
||||
{
|
||||
%contextMenu = $VerveEditor::VGroup::ContextMenu[%this.getClassName()];
|
||||
if ( !isObject( %contextMenu ) )
|
||||
{
|
||||
%contextMenu = new PopupMenu()
|
||||
{
|
||||
SuperClass = "VerveWindowMenu";
|
||||
|
||||
IsPopup = true;
|
||||
|
||||
Label = "VSceneObjectGroupAddTrackMenu";
|
||||
Position = 0;
|
||||
|
||||
Item[0] = "Add Animation Track" TAB "" TAB "VerveEditor::AddTrack( \"VShapeAnimationTrack\" );";
|
||||
Item[1] = "Add Motion Track" TAB "" TAB "VerveEditor::AddTrack( \"VMotionTrack\" );";
|
||||
Item[2] = "Add Script Event Track" TAB "" TAB "VerveEditor::AddTrack( \"VScriptEventTrack\" );";
|
||||
Item[3] = "Add Sound Effect Track" TAB "" TAB "VerveEditor::AddTrack( \"VSoundEffectTrack\" );";
|
||||
};
|
||||
%contextMenu.Init();
|
||||
|
||||
// Cache.
|
||||
$VerveEditor::VGroup::ContextMenu[%this.getClassName()] = %contextMenu;
|
||||
}
|
||||
|
||||
// Enable/Disable Adding Tracks.
|
||||
%contextMenu.enableItem( 0, %this.CanAdd( "VShapeAnimationTrack" ) );
|
||||
%contextMenu.enableItem( 1, %this.CanAdd( "VMotionTrack" ) );
|
||||
%contextMenu.enableItem( 2, %this.CanAdd( "VScriptEventTrack" ) );
|
||||
%contextMenu.enableItem( 3, %this.CanAdd( "VSoundEffectTrack" ) );
|
||||
|
||||
// Return Menu.
|
||||
return %contextMenu;
|
||||
}
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VSpawnSphereGroupPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
Parent = "VSceneObjectGroupPropertyList";
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VSceneObjectGroup::PopulateBuildStack( %this, %stack )
|
||||
{
|
||||
VGroup::PopulateBuildStack( %this, %stack );
|
||||
|
||||
// Object Reference.
|
||||
%sceneObjectList = %stack.CreateObjectList( "SceneObject", "SceneObjectList", "Scene Object:" );
|
||||
|
||||
if ( VTorque::GetSelectedCount() )
|
||||
{
|
||||
%selection = VTorque::GetSelectedObject();
|
||||
if ( %selection.getName() !$= "" && %selection.isMemberOfClass( "SceneObject" ) )
|
||||
{
|
||||
// Select Object.
|
||||
%sceneObjectList.setText( %selection.getName() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function VSceneObjectGroup::ResolveBuildStack( %this, %stack )
|
||||
{
|
||||
VGroup::ResolveBuildStack( %this, %stack, %groupObject );
|
||||
|
||||
// Fetch the Controller.
|
||||
%controller = %this.getRoot();
|
||||
|
||||
// Find the Scene Object List.
|
||||
%sceneObjectList = %stack.findObjectByInternalName( "SceneObjectList", true );
|
||||
if ( isObject( %sceneObjectList ) )
|
||||
{
|
||||
// Fetch Selected Object.
|
||||
%sceneObject = %sceneObjectList.getText();
|
||||
|
||||
// Data Field Name.
|
||||
%dataFieldName = strreplace( %this.Label, " ", "_" );
|
||||
|
||||
// Create a New Data Field.
|
||||
%controller.addDataField( "STATIC", %dataFieldName );
|
||||
|
||||
if ( %sceneObject !$= "" )
|
||||
{
|
||||
// Set the Field Value.
|
||||
%controller.setFieldValue( %dataFieldName, %sceneObject );
|
||||
}
|
||||
|
||||
// Reference the Data Field.
|
||||
%this.Reference = %dataFieldName;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VSpawnSphereGroup::GetAddTrackMenu( %this )
|
||||
{
|
||||
%contextMenu = $VerveEditor::VGroup::ContextMenu[%this.getClassName()];
|
||||
if ( !isObject( %contextMenu ) )
|
||||
{
|
||||
%contextMenu = new PopupMenu()
|
||||
{
|
||||
SuperClass = "VerveWindowMenu";
|
||||
|
||||
IsPopup = true;
|
||||
|
||||
Label = "VSpawnSphereGroupAddTrackMenu";
|
||||
Position = 0;
|
||||
|
||||
Item[0] = "Add Script Event Track" TAB "" TAB "VerveEditor::AddTrack( \"VScriptEventTrack\" );";
|
||||
Item[1] = "Add Spawn Target Track" TAB "" TAB "VerveEditor::AddTrack( \"VSpawnSphereSpawnTargetTrack\" );";
|
||||
};
|
||||
%contextMenu.Init();
|
||||
|
||||
// Cache.
|
||||
$VerveEditor::VGroup::ContextMenu[%this.getClassName()] = %contextMenu;
|
||||
}
|
||||
|
||||
// Enable/Disable Adding Tracks.
|
||||
%contextMenu.enableItem( 0, %this.CanAdd( "VScriptEventTrack" ) );
|
||||
%contextMenu.enableItem( 1, %this.CanAdd( "VSpawnSphereSpawnTargetTrack" ) );
|
||||
|
||||
// Return Menu.
|
||||
return %contextMenu;
|
||||
}
|
||||
|
||||
function VSpawnSphereGroup::isValid( %this )
|
||||
{
|
||||
// Valid?
|
||||
return VTorque::isSpawnSphereObject( %this.getSceneObject() );
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VerveEditor::InitGroupScripts()
|
||||
{
|
||||
// Core.
|
||||
exec( "./VGroup.cs" );
|
||||
|
||||
// Built In.
|
||||
exec( "./VCameraGroup.cs" );
|
||||
exec( "./VDirectorGroup.cs" );
|
||||
exec( "./VLightObjectGroup.cs" );
|
||||
exec( "./VParticleEffectGroup.cs" );
|
||||
exec( "./VSceneObjectGroup.cs" );
|
||||
exec( "./VSpawnSphereGroup.cs" );
|
||||
|
||||
// Custom.
|
||||
// Exec Custom Group Scripts.
|
||||
|
||||
// Unique Group List.
|
||||
$VerveEditor::UniqueGroupList = "VDirectorGroup";
|
||||
}
|
||||
VerveEditor::InitGroupScripts();
|
||||
|
|
@ -0,0 +1,163 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VerveEditorPropertyStack::ClearStack( %this )
|
||||
{
|
||||
while ( %this.getCount() > 0 )
|
||||
{
|
||||
// Remove Object.
|
||||
%this.remove( %this.getObject( 0 ) );
|
||||
}
|
||||
}
|
||||
|
||||
function VerveEditorPropertyStack::CreatePropertyRollout( %this, %groupLabel )
|
||||
{
|
||||
%groupWidth = getWord( %this.getExtent(), 0 );
|
||||
%groupHeight = 32;
|
||||
|
||||
%propertyRollout = new GuiRolloutCtrl()
|
||||
{
|
||||
Class = "VEditorPropertyRollout";
|
||||
Profile = "VEditorPropertyRolloutProfile";
|
||||
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
Position = "0 0";
|
||||
Extent = %groupWidth SPC 18;
|
||||
|
||||
Caption = %groupLabel;
|
||||
};
|
||||
|
||||
%propertyStack = new GuiStackControl()
|
||||
{
|
||||
Class = "VEditorPropertyStack";
|
||||
Profile = "GuiTransparentProfile";
|
||||
|
||||
HorizSizing = "width";
|
||||
VertSizing = "bottom";
|
||||
Position = "0 0";
|
||||
Extent = %groupWidth SPC %groupHeight;
|
||||
|
||||
StackingType = "Vertical";
|
||||
HorizStacking = "Left to Right";
|
||||
VertStacking = "Top to Bottom";
|
||||
Padding = "0";
|
||||
};
|
||||
%propertyRollout.add( %propertyStack );
|
||||
|
||||
// Add Spacer.
|
||||
VerveEditor::CreateSpacer( %propertyStack, 4 );
|
||||
|
||||
// Reference Stack.
|
||||
%propertyRollout.Stack = %propertyStack;
|
||||
|
||||
return %propertyRollout;
|
||||
}
|
||||
|
||||
function VEditorPropertyRollout::InspectObject( %this, %object )
|
||||
{
|
||||
%this.Stack.InspectObject( %object );
|
||||
}
|
||||
|
||||
function VEditorPropertyStack::InspectObject( %this, %object )
|
||||
{
|
||||
%fieldCount = %this.getCount();
|
||||
for ( %i = 1; %i < %fieldCount; %i++ )
|
||||
{
|
||||
%fieldContainer = %this.getObject( %i );
|
||||
%fieldControl = %fieldContainer.findObjectByInternalName( "FieldControl" );
|
||||
if ( !isObject( %fieldControl ) )
|
||||
{
|
||||
// Nothing to Update.
|
||||
continue;
|
||||
}
|
||||
|
||||
// Store Object.
|
||||
%fieldControl.Object = %object;
|
||||
|
||||
// Get Values.
|
||||
%fieldName = %fieldControl.FieldName;
|
||||
%fieldValue = %object.getFieldValue( %fieldName );
|
||||
|
||||
// Update Control?
|
||||
if ( %fieldControl.isMethod( "Update" ) )
|
||||
{
|
||||
// Update.
|
||||
%fieldControl.Update( %fieldName, %fieldValue );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function VerveEditor::CreateField( %targetStack, %fieldName, %fieldType )
|
||||
{
|
||||
%fieldWidth = getWord( %targetStack.getExtent(), 0 );
|
||||
%fieldHeight = 20;
|
||||
|
||||
%fieldContainer = new GuiControl()
|
||||
{
|
||||
Profile = "VEditorTransparentProfile";
|
||||
|
||||
HorizSizing = "width";
|
||||
VertSizing = "bottom";
|
||||
Position = "0 0";
|
||||
Extent = %fieldWidth SPC %fieldHeight;
|
||||
};
|
||||
%targetStack.add( %fieldContainer );
|
||||
|
||||
%fieldLabel = new GuiTextCtrl()
|
||||
{
|
||||
Profile = "VEditorTextProfile";
|
||||
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
Position = "6 2";
|
||||
Extent = %fieldWidth SPC 18;
|
||||
|
||||
Text = %fieldName;
|
||||
MaxLength = "1024";
|
||||
};
|
||||
%fieldContainer.add( %fieldLabel );
|
||||
|
||||
if ( isMethod( "VerveEditor", "Create" @ %fieldType @ "Field" ) )
|
||||
{
|
||||
// Create the Input Control.
|
||||
eval( "%fieldInput = VerveEditor::Create" @ %fieldType @ "Field( %fieldContainer, %fieldName );" );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Default To String Control.
|
||||
%fieldInput = VerveEditor::CreateStringField( %fieldContainer, %fieldName );
|
||||
}
|
||||
|
||||
return %fieldContainer;
|
||||
}
|
||||
|
||||
function VEditorPropertyField::ApplyValue( %this, %fieldName, %fieldValue )
|
||||
{
|
||||
// Apply Value.
|
||||
%this.Object.setFieldValue( %fieldName, %fieldValue );
|
||||
|
||||
// Update Control.
|
||||
%this.Update( %fieldName, %this.Object.getFieldValue( %fieldName ) );
|
||||
}
|
||||
|
||||
function VerveEditor::CreateSpacer( %targetStack, %spacerHeight )
|
||||
{
|
||||
%fieldWidth = getWord( %targetStack.getExtent(), 0 );
|
||||
%fieldHeight = %spacerHeight;
|
||||
|
||||
%fieldContainer = new GuiControl()
|
||||
{
|
||||
Profile = "VEditorTransparentProfile";
|
||||
|
||||
HorizSizing = "width";
|
||||
VertSizing = "bottom";
|
||||
Position = "0 0";
|
||||
Extent = %fieldWidth SPC %fieldHeight;
|
||||
};
|
||||
%targetStack.add( %fieldContainer );
|
||||
|
||||
return %fieldContainer;
|
||||
}
|
||||
|
|
@ -0,0 +1,152 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VerveEditor::CanCut()
|
||||
{
|
||||
return VerveEditor::CanCopy();
|
||||
}
|
||||
|
||||
function VerveEditor::CutSelection()
|
||||
{
|
||||
if ( !isObject( $VerveEditor::Controller ) || !VerveEditor::HasSelection() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
%targetObject = $VerveEditor::InspectorObject;
|
||||
if ( isObject( %targetObject ) )
|
||||
{
|
||||
// Write To File.
|
||||
%targetObject.writeFile( $VerveEditor::TemplateVClipboard );
|
||||
|
||||
// Store Object Type.
|
||||
$VerveEditor::TemplateVClipboardObject = %targetObject;
|
||||
|
||||
// Delete Object.
|
||||
%targetObject.Delete();
|
||||
|
||||
// Refresh Editor.
|
||||
VerveEditor::Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
function VerveEditor::CanCopy()
|
||||
{
|
||||
if ( VerveEditor::HasSelection() )
|
||||
{
|
||||
if ( $VerveEditor::InspectorObject == $VerveEditor::Controller )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $VerveEditor::InspectorObject.isMethod( "CanCopy" ) )
|
||||
{
|
||||
if ( !$VerveEditor::InspectorObject.CanCopy() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return ActiveActionMapSet.isMember( VerveEditorEditMap );
|
||||
}
|
||||
|
||||
function VerveEditor::CopySelection()
|
||||
{
|
||||
if ( !isObject( $VerveEditor::Controller ) || !VerveEditor::CanCopy() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
%targetObject = $VerveEditor::InspectorObject;
|
||||
if ( isObject( %targetObject ) )
|
||||
{
|
||||
// Write To File.
|
||||
%targetObject.writeFile( $VerveEditor::TemplateVClipboard );
|
||||
|
||||
// Reference Object.
|
||||
$VerveEditor::TemplateVClipboardObject = %targetObject;
|
||||
}
|
||||
}
|
||||
|
||||
function VerveEditor::CanPaste()
|
||||
{
|
||||
if ( !VerveEditor::HasSelection() || !isFile( $VerveEditor::TemplateVClipboard ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return $VerveEditor::InspectorObject.CanPaste( $VerveEditor::TemplateVClipboardObject );
|
||||
}
|
||||
|
||||
function VerveEditor::Paste()
|
||||
{
|
||||
if ( !isObject( $VerveEditor::Controller ) || !VerveEditor::CanPaste() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( $VerveEditor::InspectorObject.getId() == $VerveEditor::Controller.getId() )
|
||||
{
|
||||
// Special Paste.
|
||||
VerveEditor::AddTemplateGroup( $VerveEditor::TemplateVClipboard );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ( isObject( $VerveEditor::InspectorObject ) )
|
||||
{
|
||||
// Group History Actions.
|
||||
VerveEditor::ToggleHistoryGroup();
|
||||
|
||||
// Read From File.
|
||||
$VerveEditor::InspectorObject.readFile( $VerveEditor::TemplateVClipboard );
|
||||
|
||||
// Finish Up.
|
||||
VerveEditor::ToggleHistoryGroup();
|
||||
|
||||
// Refresh Editor.
|
||||
VerveEditor::Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
function VerveEditor::DeleteSelection()
|
||||
{
|
||||
if ( !isObject( $VerveEditor::Controller ) || !VerveEditor::HasSelection() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
%selectionSet = $VerveEditor::SelectionSet;
|
||||
while ( %selectionSet.getCount() > 0 )
|
||||
{
|
||||
%selection = %selectionSet.getObject( 0 );
|
||||
|
||||
if ( isObject( %selection.SiblingControl ) )
|
||||
{
|
||||
// Delete Sibling Control.
|
||||
%selection.SiblingControl.delete();
|
||||
}
|
||||
|
||||
if ( isObject( %selection.Proxy ) )
|
||||
{
|
||||
// Do Callback?
|
||||
if ( %selection.Proxy.isMethod( "onRemove" ) )
|
||||
{
|
||||
// Quick Callback.
|
||||
%selection.Proxy.onRemove();
|
||||
}
|
||||
|
||||
// Delete Reference Object.
|
||||
%selection.Proxy.delete();
|
||||
}
|
||||
|
||||
// Delete Control.
|
||||
%selection.delete();
|
||||
}
|
||||
|
||||
// Refresh.
|
||||
VerveEditor::Refresh();
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VerveEditor::GetEventManager()
|
||||
{
|
||||
if ( !isObject( $VerveEditor::EventManager ) )
|
||||
{
|
||||
$VerveEditor::EventManager = new EventManager()
|
||||
{
|
||||
Queue = "ProjectEventManager";
|
||||
};
|
||||
}
|
||||
|
||||
return $VerveEditor::EventManager;
|
||||
}
|
||||
|
||||
function VerveEditor::RegisterEvent( %eventName )
|
||||
{
|
||||
if ( !VerveEditor::GetEventManager().isRegisteredEvent( %eventName ) )
|
||||
{
|
||||
// Register Event.
|
||||
VerveEditor::GetEventManager().RegisterEvent( %eventName );
|
||||
}
|
||||
}
|
||||
|
||||
function VerveEditor::AddEventNotify( %object, %eventName, %callback )
|
||||
{
|
||||
if ( isObject( $VerveEditor::EventManager ) )
|
||||
{
|
||||
// Subscribe To Event.
|
||||
$VerveEditor::EventManager.SubScribe( %object, %eventName, %callback );
|
||||
}
|
||||
}
|
||||
|
||||
function VerveEditor::RemoveEventNotify( %object, %eventName )
|
||||
{
|
||||
if ( isObject( $VerveEditor::EventManager ) )
|
||||
{
|
||||
// Remove Event.
|
||||
$VerveEditor::EventManager.Remove( %object, %eventName );
|
||||
}
|
||||
}
|
||||
|
||||
function VerveEditor::PostEvent( %eventName, %refObject )
|
||||
{
|
||||
if ( isObject( $VerveEditor::EventManager ) )
|
||||
{
|
||||
// Notify Event.
|
||||
$VerveEditor::EventManager.PostEvent( %eventName, %refObject );
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,248 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VerveEditor::AddGroup( %groupType )
|
||||
{
|
||||
if ( !isObject( $VerveEditor::Controller ) )
|
||||
{
|
||||
// No Controller.
|
||||
return;
|
||||
}
|
||||
|
||||
if ( %groupType $= "" )
|
||||
{
|
||||
// Default.
|
||||
%groupType = "VGroup";
|
||||
}
|
||||
|
||||
/*
|
||||
// Add Template Group.
|
||||
VerveEditor::AddTemplateGroup( $VerveEditor::TemplateFolder @ "/" @ %groupType @ ".vsf" );
|
||||
*/
|
||||
|
||||
// Get the Name of the Target Group.
|
||||
VerveEditorGroupBuilderGUI.Build( %groupType, "VerveEditor::_AddGroup" );
|
||||
}
|
||||
|
||||
function VerveEditor::_AddGroup( %groupType, %groupLabel )
|
||||
{
|
||||
// Group History Actions.
|
||||
VerveEditor::ToggleHistoryGroup();
|
||||
|
||||
// Create the Group.
|
||||
%groupObject = new ( %groupType )();
|
||||
|
||||
// Add to Group.
|
||||
$VerveEditor::Controller.addObject( %groupObject );
|
||||
|
||||
// Apply the Label.
|
||||
%groupObject.setLabelUnique( %groupLabel );
|
||||
|
||||
// Callback.
|
||||
if ( !%groupObject.OnAdd() )
|
||||
{
|
||||
// Remove Object.
|
||||
$VerveEditor::Controller.removeObject( %groupObject );
|
||||
|
||||
// Delete Object.
|
||||
%groupObject.delete();
|
||||
|
||||
// Finish Up.
|
||||
VerveEditor::ToggleHistoryGroup();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Resolve the Field Stack.
|
||||
%groupObject.ResolveBuildStack( VerveEditorGroupBuilderFieldStack );
|
||||
|
||||
// Finish Up.
|
||||
VerveEditor::ToggleHistoryGroup();
|
||||
|
||||
// Refresh Editor.
|
||||
VerveEditor::Refresh();
|
||||
|
||||
// Set Selection.
|
||||
VerveEditor::SetSelection( %groupObject.Control );
|
||||
}
|
||||
|
||||
function VerveEditor::AddTemplateGroup( %templateFile )
|
||||
{
|
||||
if ( !isObject( $VerveEditor::Controller ) || !isFile( %templateFile ) )
|
||||
{
|
||||
// No Controller.
|
||||
return;
|
||||
}
|
||||
|
||||
// Fetch Current Count.
|
||||
%groupCount = $VerveEditor::Controller.getCount();
|
||||
|
||||
// Group History Actions.
|
||||
VerveEditor::ToggleHistoryGroup();
|
||||
|
||||
// Load Template.
|
||||
$VerveEditor::Controller.readTemplate( %templateFile );
|
||||
|
||||
// Finish Up.
|
||||
VerveEditor::ToggleHistoryGroup();
|
||||
|
||||
%newCount = $VerveEditor::Controller.getCount();
|
||||
if ( %groupCount != %newCount )
|
||||
{
|
||||
if ( %newCount > %groupCount )
|
||||
{
|
||||
// Select New Object.
|
||||
%selectedObject = $VerveEditor::Controller.getObject( %newCount - 1 );
|
||||
}
|
||||
|
||||
// Refresh Editor.
|
||||
VerveEditor::Refresh();
|
||||
|
||||
if ( isObject( %selectedObject ) )
|
||||
{
|
||||
// Set Selection.
|
||||
VerveEditor::SetSelection( %selectedObject.Control );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function VerveEditor::AddTrack( %trackType, %targetGroup, %refresh )
|
||||
{
|
||||
if ( !isObject( $VerveEditor::Controller ) )
|
||||
{
|
||||
// No Controller.
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !isObject( %targetGroup ) )
|
||||
{
|
||||
if ( !isObject( $VerveEditor::InspectorObject ) )
|
||||
{
|
||||
// No Controller or Selection.
|
||||
return;
|
||||
}
|
||||
|
||||
// Use Current Selection.
|
||||
%targetGroup = $VerveEditor::InspectorObject;
|
||||
}
|
||||
|
||||
if ( !%targetGroup.isMemberOfClass( "VGroup" ) )
|
||||
{
|
||||
// Invalid Target.
|
||||
return;
|
||||
}
|
||||
|
||||
if ( %trackType $= "" )
|
||||
{
|
||||
// Default.
|
||||
%trackType = "VTrack";
|
||||
}
|
||||
|
||||
// Create Track.
|
||||
%trackObject = new ( %trackType )();
|
||||
|
||||
// Add to Group.
|
||||
%targetGroup.addObject( %trackObject );
|
||||
|
||||
// Refresh Label.
|
||||
%trackObject.setLabelUnique( %trackObject.Label );
|
||||
|
||||
// Callback.
|
||||
if ( !%trackObject.OnAdd() )
|
||||
{
|
||||
// Remove Object.
|
||||
%targetGroup.removeObject( %trackObject );
|
||||
|
||||
// Delete Object.
|
||||
%trackObject.delete();
|
||||
|
||||
// Return.
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( %refresh $= "" || %refresh == true )
|
||||
{
|
||||
// Refresh.
|
||||
VerveEditor::Refresh();
|
||||
|
||||
// Select New Object.
|
||||
VerveEditor::SetSelection( %trackObject.Control );
|
||||
}
|
||||
|
||||
// Return Track.
|
||||
return %trackObject;
|
||||
}
|
||||
|
||||
function VerveEditor::AddEvent( %targetTrack, %targetTime, %refresh )
|
||||
{
|
||||
if ( !isObject( $VerveEditor::Controller ) )
|
||||
{
|
||||
// No Controller.
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !isObject( %targetTrack ) )
|
||||
{
|
||||
if ( !isObject( $VerveEditor::InspectorObject ) )
|
||||
{
|
||||
// No Controller or Selection.
|
||||
return;
|
||||
}
|
||||
|
||||
// Use Current Selection.
|
||||
%targetTrack = $VerveEditor::InspectorObject;
|
||||
}
|
||||
|
||||
if ( !%targetTrack.isMemberOfClass( "VTrack" ) )
|
||||
{
|
||||
// Invalid Target.
|
||||
return;
|
||||
}
|
||||
|
||||
// Create Event.
|
||||
%eventObject = %targetTrack.CreateEvent();
|
||||
if ( !isObject( %eventObject ) )
|
||||
{
|
||||
// Return.
|
||||
return;
|
||||
}
|
||||
|
||||
// Add to Track.
|
||||
%targetTrack.addObject( %eventObject );
|
||||
|
||||
if ( %targetTime $= "" )
|
||||
{
|
||||
// User Controller Time.
|
||||
%targetTime = $VerveEditor::Controller.Time;
|
||||
}
|
||||
|
||||
// Apply Time.
|
||||
%eventObject.SnapToTime( %targetTime, true );
|
||||
|
||||
// Callback.
|
||||
if ( !%eventObject.OnAdd() )
|
||||
{
|
||||
// Remove Object.
|
||||
%targetTrack.removeObject( %eventObject );
|
||||
|
||||
// Delete Object.
|
||||
%eventObject.delete();
|
||||
|
||||
// Return.
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( %refresh $= "" || %refresh == true )
|
||||
{
|
||||
// Refresh.
|
||||
VerveEditor::Refresh();
|
||||
|
||||
// Select Existing Track.
|
||||
VerveEditor::SetSelection( %targetTrack.Control );
|
||||
}
|
||||
|
||||
// Return Event.
|
||||
return %eventObject;
|
||||
}
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
$VerveEditor::TemplateFolder = getMainDotCsDir() @ "/" @ expandFileName( "tools/VerveEditor/Templates" );
|
||||
$VerveEditor::TemplateCustomFolder = $VerveEditor::TemplateFolder @ "/Custom";
|
||||
$VerveEditor::TemplateVClipboard = $VerveEditor::TemplateFolder @ "/VClipboard.vsf";
|
||||
$VerveEditor::TemplateVClipboardObject = "";
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VerveCustomTemplateMenu::Init( %this )
|
||||
{
|
||||
%fieldCount = 0;
|
||||
%fileSpec = $VerveEditor::TemplateCustomFolder @ "/*.vsf";
|
||||
for ( %file = findFirstFile( %fileSpec ); %file !$= ""; %file = findNextFile( %fileSpec ) )
|
||||
{
|
||||
// Create Item.
|
||||
%this.Item[%fieldCount] = "Add" SPC fileBase( %file ) TAB "" TAB "VerveEditor::AddTemplateGroup(\"" @ %file @ "\");";
|
||||
|
||||
// Increment.
|
||||
%fieldCount += 1;
|
||||
}
|
||||
|
||||
// Sort By File Name.
|
||||
for ( %j = 0; %j < %fieldCount; %j++ )
|
||||
{
|
||||
for ( %i = %fieldCount - 1; %i > %j; %i-- )
|
||||
{
|
||||
%itemA = getField( %this.Item[%i - 0], 0 );
|
||||
%itemB = getField( %this.Item[%i - 1], 0 );
|
||||
|
||||
if ( strcmp( strlwr( %itemA ), strlwr( %itemB ) ) < 0 )
|
||||
{
|
||||
// Swap.
|
||||
%itemTmp = %this.Item[%i];
|
||||
%this.Item[%i - 0] = %this.Item[%i - 1];
|
||||
%this.Item[%i - 1] = %itemTmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Parent Init.
|
||||
Parent::Init( %this );
|
||||
}
|
||||
|
||||
function VEditorAddGroupButton::DisplayContextMenu( %this, %x, %y )
|
||||
{
|
||||
// Use Current Controller.
|
||||
%targetController = $VerveEditor::Controller;
|
||||
|
||||
// Get Context Menu.
|
||||
%contextMenu = %targetController.GetAddGroupMenu();
|
||||
if ( !isObject( %contextMenu ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( %x $= "" || %y $= "" )
|
||||
{
|
||||
%position = %this.getGlobalPosition();
|
||||
%extent = %this.getExtent();
|
||||
|
||||
%x = getWord( %position, 0 ) + getWord( %extent, 0 );
|
||||
%y = getWord( %position, 1 );
|
||||
}
|
||||
|
||||
// Display.
|
||||
if($Verve::UseSeparateWindow)
|
||||
%contextMenu.showPopup( VerveEditorWindow, %x, %y );
|
||||
else
|
||||
%contextMenu.showPopup( Canvas, %x, %y );
|
||||
}
|
||||
|
||||
function VEditorAddTrackButton::DisplayContextMenu( %this, %x, %y )
|
||||
{
|
||||
if ( !isObject( $VerveEditor::InspectorObject ) )
|
||||
{
|
||||
// No Controller or Selection.
|
||||
return;
|
||||
}
|
||||
|
||||
// Use Current Selection.
|
||||
%targetGroup = $VerveEditor::InspectorObject;
|
||||
|
||||
if ( !%targetGroup.isMemberOfClass( "VGroup" ) )
|
||||
{
|
||||
// Invalid Target.
|
||||
return;
|
||||
}
|
||||
|
||||
// Get Context Menu.
|
||||
%contextMenu = %targetGroup.GetAddTrackMenu();
|
||||
if ( !isObject( %contextMenu ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( %x $= "" || %y $= "" )
|
||||
{
|
||||
%position = %this.getGlobalPosition();
|
||||
%extent = %this.getExtent();
|
||||
|
||||
%x = getWord( %position, 0 ) + getWord( %extent, 0 );
|
||||
%y = getWord( %position, 1 );
|
||||
}
|
||||
|
||||
// Display.
|
||||
// Display.
|
||||
if($Verve::UseSeparateWindow)
|
||||
%contextMenu.showPopup( VerveEditorWindow, %x, %y );
|
||||
else
|
||||
%contextMenu.showPopup( Canvas, %x, %y );
|
||||
}
|
||||
|
|
@ -0,0 +1,136 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VerveEditor::AddInspectorFieldNotify( %fieldName, %refObject )
|
||||
{
|
||||
if ( !isObject( $VerveEditor::InspectorFieldNotifySet ) )
|
||||
{
|
||||
$VerveEditor::InspectorFieldNotifySet = new SimSet();
|
||||
}
|
||||
|
||||
%inspectorSet = $VerveEditor::InspectorFieldNotifySet;
|
||||
if ( isObject( %refObject ) && !%inspectorSet.isMember( %refObject ) )
|
||||
{
|
||||
// Add The Object.
|
||||
%inspectorSet.add( %refObject );
|
||||
}
|
||||
|
||||
// Add Field Reference.
|
||||
%refObject.InspectorFieldNotifyList = rtrim( %fieldName SPC %refObject.InspectorFieldNotifyList );
|
||||
}
|
||||
|
||||
function VObject::AddFieldNotify( %this, %fieldName, %refObject )
|
||||
{
|
||||
if ( isObject( %refObject ) )
|
||||
{
|
||||
// Store.
|
||||
%this.FieldNotify[%fieldName] = trim( %this.FieldNotify[%fieldName] SPC %refObject );
|
||||
|
||||
// Update.
|
||||
%refObject.Update( %fieldName, %this.getFieldValue( %fieldName ) );
|
||||
}
|
||||
}
|
||||
|
||||
function VObject::setFieldValue( %this, %fieldName, %fieldValue )
|
||||
{
|
||||
// Fetch Old Value.
|
||||
%oldValue = %this.getFieldValue( %fieldName );
|
||||
|
||||
if ( stricmp( %oldValue , %fieldValue ) == 0 )
|
||||
{
|
||||
// No Update.
|
||||
return;
|
||||
}
|
||||
|
||||
// Update Value.
|
||||
Parent::setFieldValue( %this, %fieldName, %fieldValue );
|
||||
|
||||
// Notify Change.
|
||||
%this.NotifyFieldChange( %fieldName, %oldValue );
|
||||
}
|
||||
|
||||
function VObject::NotifyFieldChange( %this, %fieldName, %oldValue )
|
||||
{
|
||||
// Get Field Value.
|
||||
%newValue = %this.getFieldValue( %fieldName );
|
||||
|
||||
%controlList = %this.FieldNotify[%fieldName];
|
||||
%controlCount = getWordCount( %controlList );
|
||||
for ( %i = 0; %i < %controlCount; %i++ )
|
||||
{
|
||||
// Fetch the Control.
|
||||
%control = getWord( %controlList, %i );
|
||||
|
||||
if ( !isObject( %control ) )
|
||||
{
|
||||
// Remove Deleted Controls.
|
||||
%controlList = removeWord( %controlList, %i );
|
||||
%controlCount -= 1;
|
||||
|
||||
%i -= 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Update.
|
||||
%control.Update( %fieldName, %newValue );
|
||||
}
|
||||
|
||||
// Updated List?
|
||||
%this.FieldNotify[%fieldName] = %controlList;
|
||||
|
||||
// Update Inspector Fields?
|
||||
if ( isObject( $VerveEditor::InspectorObject ) && $VerveEditor::InspectorObject.getId() == %this.getId() )
|
||||
{
|
||||
%refObjectSet = $VerveEditor::InspectorFieldNotifySet;
|
||||
%refObjectCount = %refObjectSet.getCount();
|
||||
for ( %i = 0; %i < %controlCount; %i++ )
|
||||
{
|
||||
// Fetch the Object.
|
||||
%refObject = %refObjectSet.getObject( %i );
|
||||
if ( !isWordInList( %fieldName, %refObject.InspectorFieldNotifyList ) )
|
||||
{
|
||||
// Skip.
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( %refObject.isMethod( "Update" ) )
|
||||
{
|
||||
// Update.
|
||||
%refObject.Update( %fieldName, %newValue );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update Object?
|
||||
if ( %this.isMethod( "onFieldChange" ) )
|
||||
{
|
||||
// Notify.
|
||||
%this.onFieldChange( %fieldName, %oldValue, %newValue );
|
||||
}
|
||||
}
|
||||
|
||||
function VController::setFieldValue( %this, %fieldName, %fieldValue )
|
||||
{
|
||||
// Fetch Old Value.
|
||||
%oldValue = %this.getFieldValue( %fieldName );
|
||||
|
||||
if ( stricmp( %oldValue , %fieldValue ) == 0 )
|
||||
{
|
||||
// No Update.
|
||||
return;
|
||||
}
|
||||
|
||||
// Update Value.
|
||||
Parent::setFieldValue( %this, %fieldName, %fieldValue );
|
||||
|
||||
// Notify Change.
|
||||
%this.NotifyFieldChange( %fieldName, %oldValue );
|
||||
}
|
||||
|
||||
function VController::NotifyFieldChange( %this, %fieldName, %oldValue )
|
||||
{
|
||||
// Use Default Callback.
|
||||
VObject::NotifyFieldChange( %this, %fieldName, %oldValue );
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VerveEditor::CreateBoolField( %fieldContainer, %fieldName )
|
||||
{
|
||||
%fieldWidth = getWord( %fieldContainer.getExtent(), 0 );
|
||||
|
||||
%fieldInput = new GuiCheckBoxCtrl()
|
||||
{
|
||||
Class = "VEditorBoolPropertyField";
|
||||
InternalName = "FieldControl";
|
||||
Profile = "VEditorCheckBoxProfile";
|
||||
|
||||
HorizSizing = "width";
|
||||
VertSizing = "center";
|
||||
Position = %fieldWidth - 156 SPC 0;
|
||||
Extent = "150 18";
|
||||
|
||||
Text = "";
|
||||
|
||||
Command = "$ThisControl.ApplyValue();";
|
||||
|
||||
// Store Field Properties.
|
||||
FieldName = %fieldName;
|
||||
};
|
||||
%fieldContainer.add( %fieldInput );
|
||||
|
||||
// Field Notify.
|
||||
VerveEditor::AddInspectorFieldNotify( %fieldName, %fieldInput );
|
||||
|
||||
return %fieldInput;
|
||||
}
|
||||
|
||||
function VEditorBoolPropertyField::ApplyValue( %this )
|
||||
{
|
||||
VEditorPropertyField::ApplyValue( %this, %this.FieldName, %this.getValue() );
|
||||
}
|
||||
|
||||
function VEditorBoolPropertyField::Update( %this, %fieldName, %fieldValue )
|
||||
{
|
||||
if ( %this.getValue() !$= %fieldValue )
|
||||
{
|
||||
%this.setValue( %fieldValue );
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,336 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VerveEditor::CreateDataField( %fieldContainer, %fieldName )
|
||||
{
|
||||
%fieldWidth = getWord( %fieldContainer.getExtent(), 0 );
|
||||
|
||||
%fieldType = new GuiPopUpMenuCtrl()
|
||||
{
|
||||
Class = "VEditorDataTypePropertyField";
|
||||
Profile = "VEditorPopupMenuProfile";
|
||||
|
||||
HorizSizing = "left";
|
||||
VertSizing = "center";
|
||||
Position = %fieldWidth - 72 SPC 0;
|
||||
Extent = 44 SPC 18;
|
||||
|
||||
Command = "$ThisControl.ApplyValue();";
|
||||
|
||||
// Store Field Properties.
|
||||
FieldName = %fieldName;
|
||||
};
|
||||
%fieldContainer.add( %fieldType );
|
||||
|
||||
%fieldInput = new GuiTextEditCtrl()
|
||||
{
|
||||
Class = "VEditorDataPropertyField";
|
||||
SuperClass = "VEditorStringPropertyField";
|
||||
InternalName = "FieldControl";
|
||||
Profile = "VEditorTextEditProfile";
|
||||
|
||||
HorizSizing = "left";
|
||||
VertSizing = "center";
|
||||
Position = %fieldWidth - 156 SPC 0;
|
||||
Extent = 80 SPC 18;
|
||||
|
||||
AltCommand = "$ThisControl.ApplyValue();";
|
||||
Validate = "$ThisControl.ApplyValue();";
|
||||
|
||||
// Store Field Properties.
|
||||
FieldName = %fieldName;
|
||||
FieldType = %fieldType;
|
||||
};
|
||||
%fieldContainer.add( %fieldInput );
|
||||
|
||||
%fieldButton = new GuiBitmapButtonCtrl()
|
||||
{
|
||||
Class = "VEditorDataPropertyButton";
|
||||
InternalName = "FieldButton";
|
||||
Profile = "VEditorBitmapButtonProfile";
|
||||
|
||||
HorizSizing = "left";
|
||||
VertSizing = "bottom";
|
||||
Position = %fieldWidth - 24 SPC 0;
|
||||
Extent = "18 18";
|
||||
|
||||
Bitmap = "tools/VerveEditor/GUI/Images/btn_DeleteSml";
|
||||
|
||||
Command = %fieldInput @ ".Remove();";
|
||||
};
|
||||
%fieldContainer.add( %fieldButton );
|
||||
|
||||
// Apply Enum Content.
|
||||
%fieldType.add( "EXP", 0 );
|
||||
%fieldType.add( "STA", 1 );
|
||||
%fieldType.add( "VAR", 2 );
|
||||
|
||||
return %fieldInput;
|
||||
}
|
||||
|
||||
function VEditorDataPropertyField::Update( %this, %fieldName, %fieldValue )
|
||||
{
|
||||
// Fetch Object.
|
||||
%controller = $VerveEditor::Controller;
|
||||
if ( !isObject( %controller ) )
|
||||
{
|
||||
// No Object!
|
||||
return;
|
||||
}
|
||||
|
||||
if ( %fieldName $= "" )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Parent::Update( %this, %fieldName, %fieldValue );
|
||||
|
||||
// Update Type.
|
||||
%fieldType = %controller.getDataFieldType( %fieldName );
|
||||
switch$( %fieldType )
|
||||
{
|
||||
case "EXPRESSION" : %fieldType = "EXP";
|
||||
case "STATIC" : %fieldType = "STA";
|
||||
case "VARIABLE" : %fieldType = "VAR";
|
||||
}
|
||||
|
||||
// Apply.
|
||||
%this.FieldType.setText( %fieldType );
|
||||
}
|
||||
|
||||
function VEditorDataPropertyField::ApplyValue( %this )
|
||||
{
|
||||
// Fetch Object.
|
||||
%controller = $VerveEditor::Controller;
|
||||
if ( !isObject( %controller ) )
|
||||
{
|
||||
// No Object!
|
||||
return;
|
||||
}
|
||||
|
||||
// Update?
|
||||
%update = stricmp( %controller.getFieldValue( %this.FieldName ), %this.getText() );
|
||||
|
||||
// Parent Update.
|
||||
Parent::ApplyValue( %this );
|
||||
|
||||
if ( %update )
|
||||
{
|
||||
// Post Event.
|
||||
VerveEditor::PostEvent( "VGroupObjectUpdate", %controller );
|
||||
}
|
||||
}
|
||||
|
||||
function VEditorDataTypePropertyField::ApplyValue( %this )
|
||||
{
|
||||
// Fetch Object.
|
||||
%controller = $VerveEditor::Controller;
|
||||
if ( !isObject( %controller ) )
|
||||
{
|
||||
// No Object!
|
||||
return;
|
||||
}
|
||||
|
||||
// Update Type.
|
||||
%fieldType = %this.getText();
|
||||
switch$( %fieldType )
|
||||
{
|
||||
case "EXP" : %fieldType = "EXPRESSION";
|
||||
case "STA" : %fieldType = "STATIC";
|
||||
case "VAR" : %fieldType = "VARIABLE";
|
||||
}
|
||||
|
||||
if ( %controller.getDataFieldType( %this.FieldName ) !$= %fieldType )
|
||||
{
|
||||
// Apply.
|
||||
%controller.addDataField( %fieldType, %this.FieldName );
|
||||
|
||||
// Post Event.
|
||||
VerveEditor::PostEvent( "VGroupObjectUpdate", %controller );
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
function VEditorDataPropertyField::Insert( %fieldType, %fieldName, %fieldValue )
|
||||
{
|
||||
%controller = $VerveEditor::Controller;
|
||||
if ( !isObject( %controller ) )
|
||||
{
|
||||
// No Object!
|
||||
return;
|
||||
}
|
||||
|
||||
if ( %fieldName $= "" )
|
||||
{
|
||||
// Invalid Field Name.
|
||||
return;
|
||||
}
|
||||
|
||||
switch$( %fieldType )
|
||||
{
|
||||
case "EXP" : %fieldType = "EXPRESSION";
|
||||
case "STA" : %fieldType = "STATIC";
|
||||
case "VAR" : %fieldType = "VARIABLE";
|
||||
}
|
||||
|
||||
// Add Data Field.
|
||||
%controller.addDataField( %fieldType, strReplace( %fieldName, " ", "" ) );
|
||||
|
||||
// Apply Value.
|
||||
%controller.setFieldValue( %fieldName, %fieldValue );
|
||||
|
||||
// Refresh Inspection.
|
||||
schedule( 0, 0, "VerveEditor::OnSelectionUpdate" );
|
||||
}
|
||||
|
||||
function VEditorDataPropertyField::Remove( %this )
|
||||
{
|
||||
%controller = $VerveEditor::Controller;
|
||||
if ( !isObject( %controller ) )
|
||||
{
|
||||
// No Object!
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear Data.
|
||||
%controller.removeDataField( %this.FieldName );
|
||||
|
||||
// Refresh Inspection.
|
||||
schedule( 0, 0, "VerveEditor::OnSelectionUpdate" );
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
function VerveEditor::CreateAddDataField( %targetStack )
|
||||
{
|
||||
%fieldWidth = getWord( %targetStack.getExtent(), 0 );
|
||||
%fieldHeight = 18;
|
||||
|
||||
%fieldContainer = new GuiControl()
|
||||
{
|
||||
Profile = "VEditorTransparentProfile";
|
||||
|
||||
HorizSizing = "width";
|
||||
VertSizing = "bottom";
|
||||
Position = "0 0";
|
||||
Extent = %fieldWidth SPC %fieldHeight;
|
||||
};
|
||||
%targetStack.add( %fieldContainer );
|
||||
|
||||
%fieldName = new GuiTextEditCtrl()
|
||||
{
|
||||
Class = "VEditorAddDataNameField";
|
||||
InternalName = "FieldControl";
|
||||
Profile = "VEditorTextEditProfile";
|
||||
|
||||
HorizSizing = "right";
|
||||
VertSizing = "center";
|
||||
Position = "6 0";
|
||||
Extent = "106" SPC 18;
|
||||
|
||||
Text = "FieldName";
|
||||
};
|
||||
%fieldContainer.add( %fieldName );
|
||||
|
||||
%fieldValue = new GuiTextEditCtrl()
|
||||
{
|
||||
Class = "VEditorAddDataValueField";
|
||||
InternalName = "FieldValue";
|
||||
Profile = "VEditorTextEditProfile";
|
||||
|
||||
HorizSizing = "left";
|
||||
VertSizing = "center";
|
||||
Position = %fieldWidth - 156 SPC 0;
|
||||
Extent = 80 SPC 18;
|
||||
|
||||
Text = "FieldValue";
|
||||
};
|
||||
%fieldContainer.add( %fieldValue );
|
||||
|
||||
%fieldType = new GuiPopUpMenuCtrl()
|
||||
{
|
||||
Class = "VEditorDataTypePropertyField";
|
||||
InternalName = "FieldType";
|
||||
Profile = "VEditorPopupMenuProfile";
|
||||
|
||||
HorizSizing = "left";
|
||||
VertSizing = "center";
|
||||
Position = %fieldWidth - 72 SPC 0;
|
||||
Extent = 44 SPC 18;
|
||||
};
|
||||
%fieldContainer.add( %fieldType );
|
||||
|
||||
%fieldButton = new GuiBitmapButtonCtrl()
|
||||
{
|
||||
Class = "VEditorDataPropertyButton";
|
||||
InternalName = "FieldButton";
|
||||
Profile = "VEditorBitmapButtonProfile";
|
||||
|
||||
HorizSizing = "left";
|
||||
VertSizing = "bottom";
|
||||
Position = %fieldWidth - 24 SPC 0;
|
||||
Extent = "18 18";
|
||||
|
||||
Bitmap = "tools/VerveEditor/GUI/Images/btn_AddSml";
|
||||
|
||||
Command = "VEditorDataPropertyField::Insert(" @ %fieldType @ ".getText(), " @ %fieldName @ ".getText(), " @ %fieldValue @ ".getText() );";
|
||||
};
|
||||
%fieldContainer.add( %fieldButton );
|
||||
|
||||
// Apply Enum Content.
|
||||
%fieldType.add( "EXP", 0 );
|
||||
%fieldType.add( "STA", 1 );
|
||||
%fieldType.add( "VAR", 2 );
|
||||
|
||||
// Set Default.
|
||||
%fieldType.setFirstSelected();
|
||||
|
||||
return %fieldContainer;
|
||||
}
|
||||
|
||||
function VEditorAddDataNameField::onGainFirstResponder( %this )
|
||||
{
|
||||
VEditorStringPropertyField::onGainFirstResponder( %this );
|
||||
|
||||
if ( %this.getText() $= "FieldName" )
|
||||
{
|
||||
// Clear.
|
||||
%this.setText( "" );
|
||||
}
|
||||
}
|
||||
|
||||
function VEditorAddDataNameField::onLoseFirstResponder( %this )
|
||||
{
|
||||
VEditorStringPropertyField::onLoseFirstResponder( %this );
|
||||
|
||||
if ( %this.getText() $= "" )
|
||||
{
|
||||
// Clear.
|
||||
%this.setText( "FieldName" );
|
||||
}
|
||||
}
|
||||
|
||||
function VEditorAddDataValueField::onGainFirstResponder( %this )
|
||||
{
|
||||
VEditorStringPropertyField::onGainFirstResponder( %this );
|
||||
|
||||
if ( %this.getText() $= "FieldValue" )
|
||||
{
|
||||
// Clear.
|
||||
%this.setText( "" );
|
||||
}
|
||||
}
|
||||
|
||||
function VEditorAddDataValueField::onLoseFirstResponder( %this )
|
||||
{
|
||||
VEditorStringPropertyField::onLoseFirstResponder( %this );
|
||||
|
||||
if ( %this.getText() $= "" )
|
||||
{
|
||||
// Clear.
|
||||
%this.setText( "FieldValue" );
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VerveEditor::CreateEnumField( %fieldContainer, %fieldName, %class )
|
||||
{
|
||||
%fieldWidth = getWord( %fieldContainer.getExtent(), 0 );
|
||||
|
||||
%fieldInput = new GuiPopupMenuCtrl()
|
||||
{
|
||||
Class = %class;
|
||||
SuperClass = "VEditorEnumPropertyField";
|
||||
InternalName = "FieldControl";
|
||||
Profile = "VEditorPopupMenuProfile";
|
||||
|
||||
HorizSizing = "left";
|
||||
VertSizing = "center";
|
||||
Position = %fieldWidth - 156 SPC 0;
|
||||
Extent = "150 18";
|
||||
|
||||
Command = "$ThisControl.ApplyValue();";
|
||||
|
||||
// Store Field Properties.
|
||||
FieldName = %fieldName;
|
||||
};
|
||||
%fieldContainer.add( %fieldInput );
|
||||
|
||||
// Field Notify.
|
||||
VerveEditor::AddInspectorFieldNotify( %fieldName, %fieldInput );
|
||||
|
||||
return %fieldInput;
|
||||
}
|
||||
|
||||
function VEditorEnumPropertyField::ApplyValue( %this )
|
||||
{
|
||||
// Apply Value.
|
||||
VEditorPropertyField::ApplyValue( %this, %this.FieldName, %this.getText() );
|
||||
}
|
||||
|
||||
function VEditorEnumPropertyField::Update( %this, %fieldName, %fieldValue )
|
||||
{
|
||||
if ( %this.getText() !$= %fieldValue )
|
||||
{
|
||||
// Apply Text.
|
||||
%this.setText( %fieldValue );
|
||||
}
|
||||
}
|
||||
|
||||
function VEditorEnumPropertyField::PopulateFromDatablockGroup( %this, %className )
|
||||
{
|
||||
// Clear List.
|
||||
%this.clear();
|
||||
|
||||
// Iterate Over Datablocks.
|
||||
%dataSet = DataBlockGroup;
|
||||
%dataCount = %dataSet.getCount();
|
||||
for ( %i = 0; %i < %dataCount; %i++ )
|
||||
{
|
||||
// Fetch Item.
|
||||
%dataObject = %dataSet.getObject( %i );
|
||||
if ( %dataObject.isMemberOfClass( %className ) )
|
||||
{
|
||||
// Add Item.
|
||||
%this.add( %dataObject.getName(), %i );
|
||||
}
|
||||
}
|
||||
|
||||
// Sort.
|
||||
%this.sort();
|
||||
}
|
||||
|
||||
function VEditorEnumPropertyField::PopulateFromRootGroup( %this, %className )
|
||||
{
|
||||
// Clear List.
|
||||
%this.clear();
|
||||
|
||||
// Iterate Over RootGroup.
|
||||
%dataSet = RootGroup;
|
||||
%dataCount = %dataSet.getCount();
|
||||
for ( %i = 0; %i < %dataCount; %i++ )
|
||||
{
|
||||
// Fetch Item.
|
||||
%dataObject = %dataSet.getObject( %i );
|
||||
if ( %dataObject.isMemberOfClass( %className ) )
|
||||
{
|
||||
// Add Item.
|
||||
%this.add( %dataObject.getName(), %i );
|
||||
}
|
||||
}
|
||||
|
||||
// Sort.
|
||||
%this.sort();
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VerveEditor::CreateStringField( %fieldContainer, %fieldName )
|
||||
{
|
||||
%fieldWidth = getWord( %fieldContainer.getExtent(), 0 );
|
||||
|
||||
%fieldInput = new GuiTextEditCtrl()
|
||||
{
|
||||
Class = "VEditorStringPropertyField";
|
||||
InternalName = "FieldControl";
|
||||
Profile = "VEditorTextEditProfile";
|
||||
|
||||
HorizSizing = "left";
|
||||
VertSizing = "center";
|
||||
Position = %fieldWidth - 156 SPC 0;
|
||||
Extent = "150 18";
|
||||
|
||||
AltCommand = "$ThisControl.ApplyValue();";
|
||||
Validate = "$ThisControl.ApplyValue();";
|
||||
|
||||
// Store Field Properties.
|
||||
FieldName = %fieldName;
|
||||
};
|
||||
%fieldContainer.add( %fieldInput );
|
||||
|
||||
// Field Notify.
|
||||
VerveEditor::AddInspectorFieldNotify( %fieldName, %fieldInput );
|
||||
|
||||
return %fieldInput;
|
||||
}
|
||||
|
||||
function VEditorStringPropertyField::ApplyValue( %this )
|
||||
{
|
||||
VEditorPropertyField::ApplyValue( %this, %this.FieldName, %this.getText() );
|
||||
}
|
||||
|
||||
function VEditorStringPropertyField::Update( %this, %fieldName, %fieldValue )
|
||||
{
|
||||
if ( %this.getText() !$= %fieldValue )
|
||||
{
|
||||
%this.setText( %fieldValue );
|
||||
}
|
||||
}
|
||||
|
||||
function VEditorStringPropertyField::onGainFirstResponder( %this )
|
||||
{
|
||||
// Disable Cut, Copy & Paste.
|
||||
VerveEditorEditMap.pop();
|
||||
}
|
||||
|
||||
function VEditorStringPropertyField::onLoseFirstResponder( %this )
|
||||
{
|
||||
// Enable Cut, Copy & Paste.
|
||||
VerveEditorEditMap.push();
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VerveEditor::CreateToggleEnumField( %fieldContainer, %fieldName, %class )
|
||||
{
|
||||
// Create Enum Menu.
|
||||
%fieldInput = VerveEditor::CreateEnumField( %fieldContainer, %fieldName );
|
||||
|
||||
// Populate Menu.
|
||||
%fieldInput.add( "On", 0 );
|
||||
%fieldInput.add( "Off", 1 );
|
||||
|
||||
return %fieldInput;
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VerveEditor::CreateVCameraGroupEnumField( %fieldContainer, %fieldName )
|
||||
{
|
||||
// Create Enum Menu.
|
||||
return VerveEditor::CreateEnumField( %fieldContainer, %fieldName, "VEditorVCameraGroupEnumPropertyField" );
|
||||
}
|
||||
|
||||
function VEditorVCameraGroupEnumPropertyField::OnWake( %this )
|
||||
{
|
||||
// Clear List.
|
||||
%this.clear();
|
||||
|
||||
// Iterate Over Groups.
|
||||
%groupSet = $VerveEditor::Controller;
|
||||
%groupCount = %groupSet.getCount();
|
||||
for ( %i = 0; %i < %groupCount; %i++ )
|
||||
{
|
||||
%group = %groupSet.getObject( %i );
|
||||
if ( %group.isMemberOfClass( "VCameraGroup" ) )
|
||||
{
|
||||
// Add Item.
|
||||
%this.add( %group.Label, %i );
|
||||
}
|
||||
}
|
||||
|
||||
// Sort.
|
||||
%this.sort();
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VerveEditor::CreateVCommandEnumField( %fieldContainer, %fieldName )
|
||||
{
|
||||
// Create Enum Menu.
|
||||
%fieldInput = VerveEditor::CreateEnumField( %fieldContainer, %fieldName, "VEditorVCommandEnumPropertyField" );
|
||||
|
||||
// Populate Menu.
|
||||
%fieldInput.add( "EXPRESSION", 0 );
|
||||
%fieldInput.add( "METHOD", 1 );
|
||||
|
||||
return %fieldInput;
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VerveEditor::CreateVControllerDataEnumField( %fieldContainer, %fieldName )
|
||||
{
|
||||
// Create Enum Menu.
|
||||
return VerveEditor::CreateEnumField( %fieldContainer, %fieldName, "VEditorVControllerDataEnumPropertyField" );
|
||||
}
|
||||
|
||||
function VEditorVControllerDataEnumPropertyField::OnWake( %this, %eventName )
|
||||
{
|
||||
// Clear List.
|
||||
%this.clear();
|
||||
|
||||
// Iterate Over Data Items.
|
||||
%dataObject = $VerveEditor::Controller;
|
||||
%dataFieldCount = %dataObject.getDataFieldCount();
|
||||
for ( %i = 0; %i < %dataFieldCount; %i++ )
|
||||
{
|
||||
// Add Field Name.
|
||||
%this.add( %dataObject.getDataFieldName( %i ), %i );
|
||||
}
|
||||
|
||||
// Sort.
|
||||
%this.sort();
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VerveEditor::CreateVGroupEnumField( %fieldContainer, %fieldName )
|
||||
{
|
||||
// Create Enum Menu.
|
||||
return VerveEditor::CreateEnumField( %fieldContainer, %fieldName, "VEditorVGroupEnumPropertyField" );
|
||||
}
|
||||
|
||||
function VEditorVGroupEnumPropertyField::OnWake( %this )
|
||||
{
|
||||
// Clear List.
|
||||
%this.clear();
|
||||
|
||||
// Iterate Over Groups.
|
||||
%groupSet = $VerveEditor::Controller;
|
||||
%groupCount = %groupSet.getCount();
|
||||
for ( %i = 0; %i < %groupCount; %i++ )
|
||||
{
|
||||
// Add Item.
|
||||
%this.add( %groupSet.getObject( %i ).Label, %i );
|
||||
}
|
||||
|
||||
// Sort.
|
||||
%this.sort();
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VerveEditor::CreateVLightAnimationDataEnumField( %fieldContainer, %fieldName )
|
||||
{
|
||||
// Create Enum List.
|
||||
%fieldInput = VerveEditor::CreateEnumField( %fieldContainer, %fieldName );
|
||||
|
||||
// Populate Enum.
|
||||
%fieldInput.PopulateFromDatablockGroup( "LightAnimData" );
|
||||
|
||||
return %fieldInput;
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VerveEditor::CreateVPathOrientationModeEnumField( %fieldContainer, %fieldName )
|
||||
{
|
||||
// Create Enum Menu.
|
||||
%fieldInput = VerveEditor::CreateEnumField( %fieldContainer, %fieldName, "VEditorVPathOrientationModeEnumPropertyField" );
|
||||
|
||||
// Populate Menu.
|
||||
%fieldInput.add( "FREE", 0 );
|
||||
%fieldInput.add( "INTERPOLATE", 1 );
|
||||
%fieldInput.add( "TOOBJECT", 2 );
|
||||
%fieldInput.add( "TOPATH", 3 );
|
||||
%fieldInput.add( "TOPOINT", 4 );
|
||||
|
||||
return %fieldInput;
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VerveEditor::CreateVPostEffectEnumField( %fieldContainer, %fieldName )
|
||||
{
|
||||
// Create Enum List.
|
||||
%fieldInput = VerveEditor::CreateEnumField( %fieldContainer, %fieldName );
|
||||
|
||||
// Populate Enum.
|
||||
%fieldInput.PopulateFromRootGroup( "PostEffect" );
|
||||
|
||||
return %fieldInput;
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VerveEditor::CreateVSFXProfileEnumField( %fieldContainer, %fieldName )
|
||||
{
|
||||
// Create Enum List.
|
||||
%fieldInput = VerveEditor::CreateEnumField( %fieldContainer, %fieldName );
|
||||
|
||||
// Populate Enum.
|
||||
%fieldInput.PopulateFromDatablockGroup( "SFXProfile" );
|
||||
|
||||
return %fieldInput;
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VerveEditor::CreateVSceneEnumField( %fieldContainer, %fieldName )
|
||||
{
|
||||
// Create Enum Menu.
|
||||
return VerveEditor::CreateEnumField( %fieldContainer, %fieldName, "VEditorVSceneEnumPropertyField" );
|
||||
}
|
||||
|
||||
function VEditorVSceneEnumPropertyField::OnWake( %this )
|
||||
{
|
||||
// Clear List.
|
||||
%this.clear();
|
||||
|
||||
// Iterate Over Groups.
|
||||
%groupSet = $VerveEditor::Controller;
|
||||
%groupCount = %groupSet.getCount();
|
||||
for ( %i = 0; %i < %groupCount; %i++ )
|
||||
{
|
||||
%groupObject = %groupSet.getObject( %i );
|
||||
if ( %groupObject.isMemberOfClass( "VDirectorGroup" ) )
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// Clear.
|
||||
%groupObject = 0;
|
||||
}
|
||||
|
||||
if ( !isObject( %groupObject ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
%trackSet = %groupObject;
|
||||
%trackCount = %trackSet.getCount();
|
||||
for ( %i = 0; %i < %trackCount; %i++ )
|
||||
{
|
||||
%trackObject = %trackSet.getObject( %i );
|
||||
if ( %trackObject.isMemberOfClass( "VDirectorTrack" ) )
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// Clear.
|
||||
%trackObject = 0;
|
||||
}
|
||||
|
||||
if ( !isObject( %groupObject ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
%eventSet = %trackObject;
|
||||
%eventCount = %eventSet.getCount();
|
||||
for ( %i = 0; %i < %eventCount; %i++ )
|
||||
{
|
||||
%eventObject = %eventSet.getObject( %i );
|
||||
if ( %eventObject.Label !$= "" && %this.findText( %eventObject.Label ) == -1 )
|
||||
{
|
||||
%this.add( %eventObject.Label, %this.Size() );
|
||||
}
|
||||
}
|
||||
|
||||
// Sort.
|
||||
%this.sort();
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VerveEditor::CreateVShapeAnimationEnumField( %fieldContainer, %fieldName )
|
||||
{
|
||||
// Create Enum Menu.
|
||||
return VerveEditor::CreateEnumField( %fieldContainer, %fieldName, "VEditorVShapeAnimationEnumPropertyField" );
|
||||
}
|
||||
|
||||
function VEditorVShapeAnimationEnumPropertyField::OnWake( %this )
|
||||
{
|
||||
// Clear List.
|
||||
%this.clear();
|
||||
|
||||
// Valid Target?
|
||||
if ( !$VerveEditor::InspectorObject.isMethod( "getSceneObject" ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Fetch Scene Object.
|
||||
%objectReference = $VerveEditor::InspectorObject.getSceneObject();
|
||||
|
||||
// Valid Object?
|
||||
if ( !isObject( %objectReference ) || !%objectReference.isMemberOfClass( "ShapeBase" ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Find the Constructor for this Shape.
|
||||
%objectConstructor = %this.FindConstructor( %objectReference );
|
||||
if ( !isObject( %objectConstructor ) )
|
||||
{
|
||||
// Invalid Shape Constructor.
|
||||
return;
|
||||
}
|
||||
|
||||
// Iterate Over Sequences.
|
||||
%sequenceCount = %objectConstructor.getSequenceCount();
|
||||
for ( %i = 0; %i < %sequenceCount; %i++ )
|
||||
{
|
||||
%sequenceName = %objectConstructor.getSequenceName( %i );
|
||||
if ( %this.FindText( %sequenceName ) == -1 )
|
||||
{
|
||||
// Add Item.
|
||||
%this.add( %sequenceName, %this.Size() );
|
||||
}
|
||||
}
|
||||
|
||||
// Sort.
|
||||
%this.sort();
|
||||
}
|
||||
|
||||
function VEditorVShapeAnimationEnumPropertyField::FindConstructor( %this, %objectReference )
|
||||
{
|
||||
%datablock = %objectReference.getDataBlock();
|
||||
if ( !isObject( %datablock ) )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Fetch the Shape File.
|
||||
%shapeFile = %datablock.shapeFile;
|
||||
|
||||
%count = TSShapeConstructorGroup.getCount();
|
||||
for ( %i = 0; %i < %count; %i++ )
|
||||
{
|
||||
%obj = TSShapeConstructorGroup.getObject(%i);
|
||||
if ( %obj.baseShape $= %shapeFile )
|
||||
{
|
||||
return %obj;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VerveEditor::InitInspectorFieldScripts()
|
||||
{
|
||||
exec( "./TypeBool.cs" );
|
||||
exec( "./TypeData.cs" );
|
||||
exec( "./TypeEnum.cs" );
|
||||
exec( "./TypeString.cs" );
|
||||
|
||||
exec( "./TypeVCameraGroupEnum.cs" );
|
||||
exec( "./TypeVCommandEnum.cs" );
|
||||
exec( "./TypeVControllerDataEnum.cs" );
|
||||
exec( "./TypeVGroupEnum.cs" );
|
||||
exec( "./TypeVLightAnimationDataEnum.cs" );
|
||||
exec( "./TypeVPathOrientationModeEnum.cs" );
|
||||
exec( "./TypeVPostEffectEnum.cs" );
|
||||
exec( "./TypeVSceneEnum.cs" );
|
||||
exec( "./TypeVSFXProfileEnum.cs" );
|
||||
exec( "./TypeVShapeAnimationEnum.cs" );
|
||||
exec( "./TypeToggleEnum.cs" );
|
||||
}
|
||||
VerveEditor::InitInspectorFieldScripts();
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VEditorPropertyList::onAdd( %this )
|
||||
{
|
||||
if ( !VEditorObjectPropertySet.isMember( %this ) )
|
||||
{
|
||||
// Add Reference List.
|
||||
VEditorObjectPropertySet.add( %this );
|
||||
}
|
||||
}
|
||||
|
||||
function VEditorPropertyList::onRemove( %this )
|
||||
{
|
||||
if ( isObject( %this.ControlCache ) )
|
||||
{
|
||||
if ( %this.ControlCache.getClassName() !$= "SimSet" )
|
||||
{
|
||||
// Clear Set.
|
||||
while ( %this.ControlCache.getCount() > 0 )
|
||||
{
|
||||
// Delete Control.
|
||||
%this.ControlCache.getObject( 0 ).delete();
|
||||
}
|
||||
}
|
||||
|
||||
// Delete Cache.
|
||||
%this.ControlCache.delete();
|
||||
}
|
||||
}
|
||||
|
||||
new ScriptGroup( VEditorObjectPropertySet )
|
||||
{
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// VObject
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VObjectPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
|
||||
Group[0] = "VObject";
|
||||
Field[0, 0] = "Label";
|
||||
Field[0, 1] = "Enabled";
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,144 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VEditorPropertyList::CreateInspector( %this )
|
||||
{
|
||||
// Target Stack.
|
||||
%targetStack = VerveEditorPropertyStack;
|
||||
|
||||
// Clear Stack.
|
||||
%targetStack.ClearStack();
|
||||
|
||||
%propertyList = %this;
|
||||
while ( isObject( %propertyList ) )
|
||||
{
|
||||
if ( !isObject( %propertyList.ControlCache ) )
|
||||
{
|
||||
// Create and Store Cache.
|
||||
%propertyList.ControlCache = %propertyList.CreateInspectorGroup( %targetStack );
|
||||
}
|
||||
|
||||
if ( %propertyList.ControlCache.getClassName() !$= "SimSet" )
|
||||
{
|
||||
// Single Control.
|
||||
%targetStack.add( %propertyList.ControlCache );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Multiple Controls.
|
||||
%controlSet = %propertyList.ControlCache;
|
||||
%controlCount = %controlSet.getCount();
|
||||
for ( %i = 0; %i < %controlCount; %i++ )
|
||||
{
|
||||
%targetStack.add( %controlSet.getObject( %i ) );
|
||||
}
|
||||
}
|
||||
|
||||
// Get the Parent.
|
||||
%propertyList = %propertyList.Parent;
|
||||
}
|
||||
}
|
||||
|
||||
function VEditorPropertyList::CreateInspectorGroup( %this, %targetStack )
|
||||
{
|
||||
%controlSet = new SimSet();
|
||||
|
||||
%i = 0;
|
||||
while ( %this.Group[%i] !$= "" )
|
||||
{
|
||||
%groupName = %this.Group[%i];
|
||||
%groupRollout = %targetStack.CreatePropertyRollout( %groupName );
|
||||
%propertyStack = %groupRollout.Stack;
|
||||
|
||||
%j = 0;
|
||||
while ( %this.Field[%i, %j] !$= "" )
|
||||
{
|
||||
%fieldName = %this.Field[%i, %j];
|
||||
%fieldType = %this.Type[%i, %j];
|
||||
|
||||
if ( %fieldType $= "" )
|
||||
{
|
||||
// Use ConsoleObject Field Type.
|
||||
%fieldType = $VerveEditor::InspectorObject.getFieldType( %fieldName );
|
||||
%fieldType = getSubStr( %fieldType, 4, strlen( %fieldType ) - 4 );
|
||||
}
|
||||
|
||||
if ( getWordCount( %fieldName ) == 1 )
|
||||
{
|
||||
VerveEditor::CreateField( %propertyStack, %fieldName, %fieldType );
|
||||
}
|
||||
else
|
||||
{
|
||||
%fieldType = getWord( %fieldName, 0 );
|
||||
switch$ ( %fieldType )
|
||||
{
|
||||
case "SPACER" : VerveEditor::CreateSpacer( %propertyStack, getWord( %fieldName, 1 ) );
|
||||
}
|
||||
}
|
||||
|
||||
// Next Field.
|
||||
%j++;
|
||||
}
|
||||
|
||||
// Store.
|
||||
%controlSet.add( %groupRollout );
|
||||
|
||||
// Next Group.
|
||||
%i++;
|
||||
}
|
||||
|
||||
%controlCount = %controlSet.getCount();
|
||||
if ( %controlCount == 1 )
|
||||
{
|
||||
%control = %controlSet.getObject( 0 );
|
||||
%controlSet.delete();
|
||||
|
||||
return %control;
|
||||
}
|
||||
|
||||
return %controlSet;
|
||||
}
|
||||
|
||||
function VEditorPropertyList::InspectObject( %this, %object )
|
||||
{
|
||||
if ( %this.InspectorLocked )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Prevent Infinite Loops.
|
||||
%this.InspectorLocked = true;
|
||||
|
||||
%propertyList = %this;
|
||||
while ( isObject( %propertyList ) )
|
||||
{
|
||||
if ( !isObject( %propertyList.ControlCache ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( %propertyList.ControlCache.getClassName() !$= "SimSet" )
|
||||
{
|
||||
// Single Control.
|
||||
%targetStack = %propertyList.ControlCache.InspectObject( %object );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Multiple Controls.
|
||||
%controlSet = %propertyList.ControlCache;
|
||||
%controlCount = %controlSet.getCount();
|
||||
for ( %i = 0; %i < %controlCount; %i++ )
|
||||
{
|
||||
%controlSet.getObject( %i ).InspectObject( %object );
|
||||
}
|
||||
}
|
||||
|
||||
// Get the Parent.
|
||||
%propertyList = %propertyList.Parent;
|
||||
}
|
||||
|
||||
// All Done.
|
||||
%this.InspectorLocked = false;
|
||||
}
|
||||
|
|
@ -0,0 +1,224 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
$VerveEditor::InspectorObject = 0;
|
||||
$VerveEditor::SelectionSet = new SimSet();
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VerveEditor::HasSelection()
|
||||
{
|
||||
return ( isObject( $VerveEditor::InspectorObject ) || $VerveEditor::SelectionSet.getCount() > 0 );
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
function VerveEditor::OnSelectionUpdate()
|
||||
{
|
||||
// Clear Inspector.
|
||||
VerveEditorPropertyStack.ClearStack();
|
||||
|
||||
%selectionSet = $VerveEditor::SelectionSet;
|
||||
%selectionCount = %selectionSet.getCount();
|
||||
if ( %selectionCount == 1 )
|
||||
{
|
||||
// Fetch Object.
|
||||
%selection = %selectionSet.getObject( 0 );
|
||||
|
||||
// Highlight
|
||||
%selection.setStateOn( true );
|
||||
if ( isObject( %selection.SiblingControl ) )
|
||||
{
|
||||
%selection.SiblingControl.setStateOn( true );
|
||||
}
|
||||
|
||||
if ( isObject( %selection.Proxy ) )
|
||||
{
|
||||
// Change Selection.
|
||||
%selection = %selection.Proxy;
|
||||
}
|
||||
|
||||
if ( isObject( %selection ) )
|
||||
{
|
||||
// Inspector Property List.
|
||||
%selectionList = %selection.getClassName() @ "PropertyList";
|
||||
if ( isObject( %selectionList ) )
|
||||
{
|
||||
// Inspect Object.
|
||||
VerveEditor::InspectObject( %selection, %selectionList );
|
||||
}
|
||||
|
||||
// Callback?
|
||||
if ( %selection.isMethod( "onSelect" ) )
|
||||
{
|
||||
%selection.onSelect();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
%selection = $VerveEditor::InspectorObject;
|
||||
if ( isObject( %selection ) )
|
||||
{
|
||||
// Callback?
|
||||
if ( %selection.isMethod( "onDeselect" ) )
|
||||
{
|
||||
%selection.onDeselect();
|
||||
}
|
||||
}
|
||||
|
||||
// Clear Inspector Object.
|
||||
$VerveEditor::InspectorObject = 0;
|
||||
|
||||
if ( %selectionCount == 0 )
|
||||
{
|
||||
// Inspect Controller.
|
||||
VerveEditor::InspectObject( $VerveEditor::Controller, VControllerPropertyList );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function VerveEditor::InspectObject( %object, %propertyList )
|
||||
{
|
||||
// Reference Inspected Object.
|
||||
$VerveEditor::InspectorObject = %object;
|
||||
|
||||
// Create Lists.
|
||||
%propertyList.CreateInspector();
|
||||
|
||||
// Update Fields.
|
||||
%propertyList.InspectObject( %object );
|
||||
}
|
||||
|
||||
function VEditorSelectable::OnMouseEnter( %this, %position, %modifiers, %clickCount )
|
||||
{
|
||||
if ( isObject( %this.SiblingControl ) )
|
||||
{
|
||||
%this.SiblingControl.setStateOn( true );
|
||||
}
|
||||
}
|
||||
|
||||
function VEditorSelectable::OnMouseLeave( %this, %position, %modifiers, %clickCount )
|
||||
{
|
||||
if ( isObject( %this.SiblingControl ) )
|
||||
{
|
||||
%this.SiblingControl.setStateOn( %this.getState() );
|
||||
}
|
||||
}
|
||||
|
||||
function VEditorSelectable::OnRightMouseUp( %this, %position, %modifiers, %clickCount )
|
||||
{
|
||||
// Set Selection.
|
||||
VerveEditor::SetSelection( %this );
|
||||
|
||||
// Repaint.
|
||||
VerveEditorWindow.Repaint();
|
||||
|
||||
if ( %this.Proxy.isMethod( "DisplayContextMenu" ) )
|
||||
{
|
||||
// Display Context Menu.
|
||||
%this.Proxy.schedule( 32, "DisplayContextMenu", getWord( %position, 0 ), getWord( %position, 1 ) );
|
||||
}
|
||||
}
|
||||
|
||||
function VEditorSelectable::OnMouseUp( %this, %position, %modifiers, %clickCount )
|
||||
{
|
||||
switch ( %modifiers )
|
||||
{
|
||||
case 0 : VerveEditor::SetSelection( %this );
|
||||
|
||||
case 4 : VerveEditor::ToggleSelection( %this );
|
||||
}
|
||||
}
|
||||
|
||||
function VEditorSelectable::OnAddSelection( %this )
|
||||
{
|
||||
%this.setStateOn( true );
|
||||
|
||||
if ( isObject( %this.SiblingControl ) )
|
||||
{
|
||||
%this.SiblingControl.setStateOn( true );
|
||||
}
|
||||
|
||||
// Set First Responder.
|
||||
%this.setFirstResponder();
|
||||
}
|
||||
|
||||
function VEditorSelectable::OnRemoveSelection( %this )
|
||||
{
|
||||
%this.setStateOn( false );
|
||||
|
||||
if ( isObject( %this.SiblingControl ) )
|
||||
{
|
||||
%this.SiblingControl.setStateOn( false );
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
function VerveEditor::SetSelection( %object )
|
||||
{
|
||||
VerveEditor::ClearSelection();
|
||||
|
||||
VerveEditor::AddSelection( %object );
|
||||
}
|
||||
|
||||
function VerveEditor::ClearSelection()
|
||||
{
|
||||
$VerveEditor::Selection::SurpressCallback = true;
|
||||
while ( $VerveEditor::SelectionSet.getCount() > 0 )
|
||||
{
|
||||
VerveEditor::RemoveSelection( $VerveEditor::SelectionSet.getObject( 0 ) );
|
||||
}
|
||||
|
||||
if ( $VerveEditor::Selection::SurpressCallback )
|
||||
{
|
||||
VerveEditor::OnSelectionUpdate();
|
||||
}
|
||||
|
||||
$VerveEditor::Selection::SurpressCallback = false;
|
||||
}
|
||||
|
||||
function VerveEditor::AddSelection( %object )
|
||||
{
|
||||
$VerveEditor::SelectionSet.add( %object );
|
||||
|
||||
if ( %object.isMethod( "OnAddSelection" ) )
|
||||
{
|
||||
%object.OnAddSelection();
|
||||
}
|
||||
|
||||
if ( !$VerveEditor::Selection::SurpressCallback )
|
||||
{
|
||||
VerveEditor::OnSelectionUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
function VerveEditor::RemoveSelection( %object )
|
||||
{
|
||||
$VerveEditor::SelectionSet.remove( %object );
|
||||
|
||||
if ( %object.isMethod( "OnRemoveSelection" ) )
|
||||
{
|
||||
%object.OnRemoveSelection();
|
||||
}
|
||||
|
||||
if ( !$VerveEditor::Selection::SurpressCallback )
|
||||
{
|
||||
VerveEditor::OnSelectionUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
function VerveEditor::ToggleSelection( %object )
|
||||
{
|
||||
if ( !$VerveEditor::SelectionSet.isMember( %object ) )
|
||||
{
|
||||
VerveEditor::AddSelection( %object );
|
||||
}
|
||||
else
|
||||
{
|
||||
VerveEditor::RemoveSelection( %object );
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VerveEditor::InitInspectorScripts()
|
||||
{
|
||||
exec( "./Controls.cs" );
|
||||
exec( "./CutCopyPaste.cs" );
|
||||
exec( "./EventNotify.cs" );
|
||||
exec( "./Factory.cs" );
|
||||
exec( "./FactoryControls.cs" );
|
||||
exec( "./FieldNotify.cs" );
|
||||
exec( "./Lists.cs" );
|
||||
exec( "./Properties.cs" );
|
||||
exec( "./Selection.cs" );
|
||||
|
||||
exec( "./Fields/main.cs" );
|
||||
}
|
||||
VerveEditor::InitInspectorScripts();
|
||||
232
Templates/BaseGame/game/tools/VerveEditor/Scripts/Persistence.cs
Normal file
232
Templates/BaseGame/game/tools/VerveEditor/Scripts/Persistence.cs
Normal file
|
|
@ -0,0 +1,232 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
$VerveEditor::FilePath = "sequences";
|
||||
$VerveEditor::FileSpec = "Verve Sequence Files (*.vsf)|*.vsf|All Files (*.*)|*.*|";
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VerveEditor::GetFileTarget( %type )
|
||||
{
|
||||
%filePath = $VerveEditor::FilePath;
|
||||
if ( strlen( $Pref::VerveEditor::FilePath ) > 0 )
|
||||
{
|
||||
%filePath = $Pref::VerveEditor::FilePath;
|
||||
}
|
||||
|
||||
%fileDialog = new ( %type @ "FileDialog" )()
|
||||
{
|
||||
Filters = $VerveEditor::FileSpec;
|
||||
DefaultPath = %filePath;
|
||||
ChangePath = false;
|
||||
MustExist = true;
|
||||
};
|
||||
|
||||
// Record the file name
|
||||
%filename = "";
|
||||
if ( %fileDialog.Execute() )
|
||||
{
|
||||
%filename = %fileDialog.FileName;
|
||||
|
||||
// Store the preference
|
||||
$Pref::VerveEditor::FilePath = makeRelativePath( filePath( %filename ), getMainDotCsDir() );
|
||||
}
|
||||
|
||||
// Delete the dialog
|
||||
%fileDialog.delete();
|
||||
|
||||
// Return the filename
|
||||
return %filename;
|
||||
}
|
||||
|
||||
function VerveEditor::NewFile()
|
||||
{
|
||||
if ( !isObject( $VerveEditor::Controller ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Save?
|
||||
if ( !VerveEditor::SavePrompt() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear Sequence Lists.
|
||||
$VerveEditor::Controller.clear();
|
||||
|
||||
// Clear File.
|
||||
$VerveEditor::Controller.FileName = "";
|
||||
|
||||
// Reset Properties.
|
||||
$VerveEditor::Controller.Time = 0;
|
||||
$VerveEditor::Controller.Duration = 5000;
|
||||
$VerveEditor::Controller.TimeScale = 1.0;
|
||||
|
||||
// Clear Editor History.
|
||||
VerveEditor::ClearHistory();
|
||||
|
||||
// Refresh Editor.
|
||||
VerveEditor::Refresh();
|
||||
}
|
||||
|
||||
function VerveEditor::LoadFile( %fileName )
|
||||
{
|
||||
if ( !isObject( $VerveEditor::Controller ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Save?
|
||||
if ( !VerveEditor::SavePrompt() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( %fileName $= "" )
|
||||
{
|
||||
%fileName = VerveEditor::GetFileTarget( "Open" );
|
||||
}
|
||||
|
||||
// Clear File.
|
||||
$VerveEditor::Controller.FileName = "";
|
||||
|
||||
if ( $VerveEditor::Controller.readFile( %fileName ) )
|
||||
{
|
||||
// Pause.
|
||||
VerveEditor::Pause();
|
||||
|
||||
// Store the File.
|
||||
$VerveEditor::Controller.FileName = %fileName;
|
||||
|
||||
// Update File History.
|
||||
VerveEditor::UpdateFileHistory( %fileName );
|
||||
|
||||
// Clear Editor History.
|
||||
VerveEditor::ClearHistory();
|
||||
|
||||
// Refresh Editor.
|
||||
VerveEditor::Refresh();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Argh!
|
||||
// Attempting to load a file which results in failure means the existing
|
||||
// sequence is messed up, ouch! Do something better than creating a new
|
||||
// sequence...
|
||||
VerveEditor::NewFile();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function VerveEditor::SaveFile( %forceSaveAs )
|
||||
{
|
||||
if ( !isObject( $VerveEditor::Controller ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
%fileName = $VerveEditor::Controller.FileName;
|
||||
if ( %forceSaveAs || %fileName $= "" )
|
||||
{
|
||||
%fileName = VerveEditor::GetFileTarget( "Save" );
|
||||
if ( %fileName $= "" )
|
||||
{
|
||||
// No Save.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ( fileExt( fileName( %fileName ) ) $= "" )
|
||||
{
|
||||
// Add Extension.
|
||||
%fileName = %fileName @ ".vsf";
|
||||
}
|
||||
|
||||
// Write.
|
||||
$VerveEditor::Controller.writeFile( %fileName );
|
||||
|
||||
// Store the File.
|
||||
$VerveEditor::Controller.FileName = %fileName;
|
||||
|
||||
// Update File History.
|
||||
VerveEditor::UpdateFileHistory( %fileName );
|
||||
|
||||
// Clear Dirty.
|
||||
VerveEditor::ClearDirty();
|
||||
|
||||
// Update Window Title.
|
||||
VerveEditorWindow.UpdateWindowTitle();
|
||||
|
||||
// Valid Save.
|
||||
return true;
|
||||
}
|
||||
|
||||
function VerveEditor::SavePrompt()
|
||||
{
|
||||
if ( !VerveEditor::IsDirty() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
%result = messageBox( "Verve Editor", "Save Changes to your sequence?", "SaveDontSave", "Warning" );
|
||||
if ( %result $= $MROk )
|
||||
{
|
||||
// Save.
|
||||
return VerveEditor::SaveFile();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function VerveEditor::SavePromptCancel()
|
||||
{
|
||||
if ( !VerveEditor::IsDirty() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
%result = messageBox( "Verve Editor", "Save Changes to your sequence?", "SaveDontSaveCancel", "Warning" );
|
||||
if ( %result $= $MRCancel )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( %result $= $MROk )
|
||||
{
|
||||
// Save.
|
||||
return VerveEditor::SaveFile();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function VerveEditor::UpdateFileHistory( %filePath )
|
||||
{
|
||||
// Make Relative.
|
||||
%fileLabel = makeRelativePath( %filePath, getMainDotCsDir() );
|
||||
|
||||
// Select an Index.
|
||||
%initIndex = $Pref::VerveEditor::RecentFileSize;
|
||||
for ( %i = 0; %i < %initIndex; %i++ )
|
||||
{
|
||||
%prefFile = $Pref::VerveEditor::RecentFile[%i];
|
||||
if ( %prefFile $= %fileLabel )
|
||||
{
|
||||
%initIndex = %i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Push Others Down.
|
||||
for ( %i = %initIndex; %i > 0; %i-- )
|
||||
{
|
||||
$Pref::VerveEditor::RecentFile[%i] = $Pref::VerveEditor::RecentFile[%i - 1];
|
||||
}
|
||||
|
||||
// Push to the Front.
|
||||
$Pref::VerveEditor::RecentFile[0] = %fileLabel;
|
||||
}
|
||||
63
Templates/BaseGame/game/tools/VerveEditor/Scripts/Plugin.cs
Normal file
63
Templates/BaseGame/game/tools/VerveEditor/Scripts/Plugin.cs
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Verve Editor
|
||||
new ScriptObject( VerveEditorPlugin )
|
||||
{
|
||||
SuperClass = "EditorPlugin";
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VerveEditorPlugin::onWorldEditorStartup( %this )
|
||||
{
|
||||
//----------------------------------------------------------------------
|
||||
//
|
||||
// Editor Toggles
|
||||
//
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// Add ourselves to the window menu.
|
||||
%accel = EditorGui.addToEditorsMenu( "Verve Editor", "", VerveEditorPlugin );
|
||||
|
||||
// Add ourselves to the ToolsToolbar
|
||||
%tooltip = "Verve Editor (" @ %accel @ ")";
|
||||
|
||||
// Add ourselves to the ToolsToolbar
|
||||
EditorGui.addToToolsToolbar( "VerveEditorPlugin", "VerveEditorPluginPalette", expandFilename( "tools/VerveEditor/GUI/Images/btn_Palette" ), %tooltip );
|
||||
|
||||
// Find and Store the Button.
|
||||
%this.ToolbarButton = ToolsToolbarArray.findObjectByInternalName( "VerveEditorPluginPalette", false );
|
||||
%this.ToolbarButton.ButtonType = "ToggleButton";
|
||||
|
||||
// Extend Width.
|
||||
%extent = EWToolsToolbar.getExtent();
|
||||
EWToolsToolbar.setExtent( ( getWord( %extent, 0 ) + 33 ) SPC getWord( %extent, 1 ) );
|
||||
}
|
||||
|
||||
function VerveEditorPlugin::setEditorFunction( %this )
|
||||
{
|
||||
if ( %this.ToolbarButton.getValue() )
|
||||
{
|
||||
// Launch Editor.
|
||||
VerveEditor::LaunchEditor();
|
||||
}
|
||||
else
|
||||
{
|
||||
VerveEditorWindow.onWindowClose();
|
||||
}
|
||||
|
||||
// Maintain Last Editor.
|
||||
return false;
|
||||
}
|
||||
|
||||
function VerveEditorPlugin::onDeactivated( %this )
|
||||
{
|
||||
// Unchecked Box?
|
||||
if ( %this.ToolbarButton.getValue() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,154 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VEditorScrollControl::onScroll( %this )
|
||||
{
|
||||
%notifyObj = %this.getObject( 0 );
|
||||
if ( %notifyObj.isMethod( "onScroll" ) )
|
||||
{
|
||||
%notifyObj.onScroll();
|
||||
}
|
||||
}
|
||||
|
||||
function VerveEditorScrollNotify::onWake( %this )
|
||||
{
|
||||
VerveEditorScrollNotifyV::onWake( %this );
|
||||
VerveEditorScrollNotifyH::onWake( %this );
|
||||
}
|
||||
|
||||
function VerveEditorScrollNotify::onScroll( %this )
|
||||
{
|
||||
%this.onResize();
|
||||
}
|
||||
|
||||
function VerveEditorScrollNotify::onResize( %this )
|
||||
{
|
||||
VerveEditorScrollNotifyV::onResize( %this );
|
||||
VerveEditorScrollNotifyH::onResize( %this );
|
||||
}
|
||||
|
||||
function VerveEditorScrollNotify::onParentResized( %this )
|
||||
{
|
||||
%this.schedule( 32, "updateSize" );
|
||||
}
|
||||
|
||||
function VerveEditorScrollNotify::updateSize( %this )
|
||||
{
|
||||
VerveEditorScrollNotifyH::updateSize( %this );
|
||||
VerveEditorScrollNotifyV::updateSize( %this );
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
function VerveEditorScrollNotifyV::onWake( %this )
|
||||
{
|
||||
if ( !isObject( $VerveEditor::ScrollNotifyVSet ) )
|
||||
{
|
||||
$VerveEditor::ScrollNotifyVSet = new SimSet();
|
||||
}
|
||||
|
||||
$VerveEditor::ScrollNotifyVSet.add( %this );
|
||||
}
|
||||
|
||||
function VerveEditorScrollNotifyV::onScroll( %this )
|
||||
{
|
||||
%this.onResize();
|
||||
}
|
||||
|
||||
function VerveEditorScrollNotifyV::onResize( %this )
|
||||
{
|
||||
if ( !isObject( $VerveEditor::ScrollNotifyVSet ) )
|
||||
{
|
||||
// Not Awake Yet!
|
||||
return;
|
||||
}
|
||||
|
||||
%scrollPosition = %this.getParent().getScrollPositionY();
|
||||
if ( !%this.SurpressUpdate )
|
||||
{
|
||||
%refSet = $VerveEditor::ScrollNotifyVSet;
|
||||
%refCount = %refSet.getCount();
|
||||
for ( %i = 0; %i < %refCount; %i++ )
|
||||
{
|
||||
%refObject = %refSet.getObject( %i ).getParent();
|
||||
%refObject.SurpressUpdate = true;
|
||||
%refObject.setScrollPosition( %refObject.getScrollPositionX(), %scrollPosition );
|
||||
%refObject.SurpressUpdate = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function VerveEditorScrollNotifyV::onParentResized( %this )
|
||||
{
|
||||
%this.schedule( 32, "updateSize" );
|
||||
}
|
||||
|
||||
function VerveEditorScrollNotifyV::updateSize( %this )
|
||||
{
|
||||
%minX = getWord( %this.getObject( 0 ).MinExtent, 0 );
|
||||
%minY = getWord( %this.getParent().getExtent(), 1 ) - 3;
|
||||
%this.MinExtent = %minX SPC %minY;
|
||||
|
||||
%newX = getWord( %this.getExtent(), 0 );
|
||||
%newY = getWord( VerveEditorTrackStack.getExtent(), 1 );
|
||||
%this.setExtent( %newX, %newY );
|
||||
|
||||
// The onResize callback isn't called if all we did was move around
|
||||
%this.onResize();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
function VerveEditorScrollNotifyH::onWake( %this )
|
||||
{
|
||||
if ( !isObject( $VerveEditor::ScrollNotifyHSet ) )
|
||||
{
|
||||
$VerveEditor::ScrollNotifyHSet = new SimSet();
|
||||
}
|
||||
|
||||
$VerveEditor::ScrollNotifyHSet.add( %this );
|
||||
}
|
||||
|
||||
function VerveEditorScrollNotifyH::onScroll( %this )
|
||||
{
|
||||
%this.onResize();
|
||||
}
|
||||
|
||||
function VerveEditorScrollNotifyH::onResize( %this )
|
||||
{
|
||||
if ( !isObject( $VerveEditor::ScrollNotifyHSet ) )
|
||||
{
|
||||
// Not Awake Yet!
|
||||
return;
|
||||
}
|
||||
|
||||
%scrollPosition = %this.getParent().getScrollPositionX();
|
||||
if ( !%this.SurpressUpdate )
|
||||
{
|
||||
%refSet = $VerveEditor::ScrollNotifyHSet;
|
||||
%refCount = %refSet.getCount();
|
||||
for ( %i = 0; %i < %refCount; %i++ )
|
||||
{
|
||||
%refObject = %refSet.getObject( %i ).getParent();
|
||||
%refObject.SurpressUpdate = true;
|
||||
%refObject.setScrollPosition( %scrollPosition, %refObject.getScrollPositionY() );
|
||||
%refObject.SurpressUpdate = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function VerveEditorScrollNotifyH::onParentResized( %this )
|
||||
{
|
||||
%this.schedule( 32, "updateSize" );
|
||||
}
|
||||
|
||||
function VerveEditorScrollNotifyH::updateSize( %this )
|
||||
{
|
||||
%this.MinExtent = %this.getObject( 0 ).MinExtent;
|
||||
%this.setExtent( getWord( %this.getParent().getExtent(), 0 ) - 19, getWord( %this.getExtent(), 1 ) );
|
||||
|
||||
// The onResize callback isn't called if all we did was move around
|
||||
%this.onResize();
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VCameraShakeTrackPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
Parent = "VObjectPropertyList";
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VCameraShakeTrack::CreateEvent( %this )
|
||||
{
|
||||
// Create Event.
|
||||
return new VCameraShakeEvent();
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VDirectorTrackPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
Parent = "VObjectPropertyList";
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VDirectorTrack::Refresh( %this )
|
||||
{
|
||||
// Create Control.
|
||||
%trackControl = Parent::Refresh( %this );
|
||||
|
||||
// Add Field Notify.
|
||||
VObject::AddFieldNotify( $VerveEditor::Controller, "Duration", %this );
|
||||
|
||||
// Return Control.
|
||||
return %trackControl;
|
||||
}
|
||||
|
||||
function VDirectorTrack::CreateEvent( %this )
|
||||
{
|
||||
// Create Event.
|
||||
return new VDirectorEvent();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
function VDirectorTrack::Update( %this )
|
||||
{
|
||||
// Root Update.
|
||||
%this.UpdateTrack();
|
||||
|
||||
%trackControl = %this.Control.SiblingControl;
|
||||
if ( !isObject( %trackControl ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Update GUI Elements.
|
||||
%eventCount = %trackControl.getCount();
|
||||
for ( %i = 0; %i < %eventCount; %i++ )
|
||||
{
|
||||
// Get Control.
|
||||
%eventControl = %trackControl.getObject( %i );
|
||||
|
||||
// Update.
|
||||
%eventControl.Update();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VFadeTrackPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
Parent = "VObjectPropertyList";
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VFadeTrack::CreateEvent( %this )
|
||||
{
|
||||
// Create Event.
|
||||
return new VFadeEvent();
|
||||
}
|
||||
|
||||
function VFadeTrack::Refresh( %this )
|
||||
{
|
||||
// Create Control.
|
||||
%trackControl = Parent::Refresh( %this );
|
||||
|
||||
// Update Labels.
|
||||
%this.Update();
|
||||
|
||||
// Return Track.
|
||||
return %trackControl;
|
||||
}
|
||||
|
||||
function VFadeTrack::Update( %this )
|
||||
{
|
||||
%eventCount = %this.getCount();
|
||||
for ( %i = 0; %i < %eventCount; %i++ )
|
||||
{
|
||||
%eventObject = %this.getObject( %i );
|
||||
%eventButton = %eventObject.Control;
|
||||
|
||||
// Set The Label.
|
||||
%eventButton.Text = ( ( %i % 2 ) == 0 ) ? "Fade In" : "Fade Out";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VLightObjectAnimationTrackPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
Parent = "VObjectPropertyList";
|
||||
|
||||
Group[0] = "Animation Track";
|
||||
Field[0, 0] = "AnimationData";
|
||||
Type[0, 0] = "VLightAnimationDataEnum";
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VLightObjectAnimationTrack::CreateEvent( %this )
|
||||
{
|
||||
// Create Event.
|
||||
return new VLightObjectAnimationEvent();
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VLightObjectToggleTrackPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
Parent = "VObjectPropertyList";
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VLightObjectToggleTrack::CreateEvent( %this )
|
||||
{
|
||||
// Create Event.
|
||||
return new VLightObjectToggleEvent();
|
||||
}
|
||||
|
|
@ -0,0 +1,264 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VMotionTrackPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
Parent = "VObjectPropertyList";
|
||||
|
||||
Group[0] = "VMotionTrack";
|
||||
Field[0, 0] = "Reference";
|
||||
Type[0, 0] = "VControllerDataEnum";
|
||||
Field[0, 1] = "OrientationMode";
|
||||
Type[0, 1] = "VPathOrientationModeEnum";
|
||||
Field[0, 2] = "OrientationData";
|
||||
Field[0, 3] = "Relative";
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VMotionTrack::CreateEvent( %this, %canCreateNode )
|
||||
{
|
||||
if ( %canCreateNode $= "" ) %canCreateNode = true;
|
||||
|
||||
// Fetch Object References.
|
||||
%object = %this.getParent().getSceneObject();
|
||||
%path = %this.getPath();
|
||||
|
||||
if ( isObject( %object ) && isObject( %path ) )
|
||||
{
|
||||
// Create Event.
|
||||
%event = new VMotionEvent();
|
||||
|
||||
// Create a Node?
|
||||
%createNode = ( %this.getCount() >= %path.getNodeCount() );
|
||||
if ( !%canCreateNode || !%createNode )
|
||||
{
|
||||
// Return Event.
|
||||
return %event;
|
||||
}
|
||||
|
||||
// Use Transform.
|
||||
%transform = %object.getTransform();
|
||||
|
||||
// Object Attached?
|
||||
if ( %path.isObjectAttached( %object ) )
|
||||
{
|
||||
// Get Offset.
|
||||
%positionOffset = %path.getPathObjectOffset( %object );
|
||||
|
||||
// Determine Real Position.
|
||||
%newPosition = VectorSub( %object.getPosition(), %positionOffset );
|
||||
|
||||
// Set Transform.
|
||||
%transform = %newPosition SPC getWords( %transform, 3 );
|
||||
}
|
||||
else if ( %this.Relative && %path.getNodeCount() > 0 )
|
||||
{
|
||||
// Fetch Node Position.
|
||||
%nodePosition = %path.getNodeWorldPosition( 0 );
|
||||
|
||||
// Set Position.
|
||||
%object.setTransform( %nodePosition SPC getWords( %transform, 3 ) );
|
||||
}
|
||||
|
||||
// Create New Node.
|
||||
%event.schedule( 32, "CreatePathNode", %transform );
|
||||
|
||||
// Return Event.
|
||||
return %event;
|
||||
}
|
||||
|
||||
// No Object.
|
||||
return 0;
|
||||
}
|
||||
|
||||
function VMotionTrack::OnSelect( %this )
|
||||
{
|
||||
// Fetch Path.
|
||||
%path = %this.getPath();
|
||||
if ( !isObject( EVPathEditor ) || !isObject( %path ) )
|
||||
{
|
||||
// No Editor.
|
||||
return;
|
||||
}
|
||||
|
||||
// Update Selection.
|
||||
EVPathEditor.setSelection( %path );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VMotionTrack::GetContextMenu( %this )
|
||||
{
|
||||
%contextMenu = $VerveEditor::VMotionTrack::ContextMenu;
|
||||
if ( !isObject( %contextMenu ) )
|
||||
{
|
||||
%contextMenu = new PopupMenu()
|
||||
{
|
||||
SuperClass = "VerveWindowMenu";
|
||||
|
||||
IsPopup = true;
|
||||
|
||||
Label = "VTrackContextMenu";
|
||||
Position = 0;
|
||||
|
||||
Item[0] = "&Add Event" TAB "" TAB "VEditorSelectableTrack::AddEvent();";
|
||||
|
||||
Item[1] = "" TAB "";
|
||||
|
||||
Item[2] = "&Import Path Nodes" TAB "" TAB "VMotionTrack::ImportPathNodes();";
|
||||
|
||||
Item[3] = "" TAB "";
|
||||
|
||||
Item[4] = "Cu&t" TAB "" TAB "VerveEditor::CutSelection();";
|
||||
Item[5] = "&Copy" TAB "" TAB "VerveEditor::CopySelection();";
|
||||
Item[6] = "&Paste" TAB "" TAB "VEditorSelectableTrack::PasteEvent();";
|
||||
|
||||
Item[7] = "" TAB "";
|
||||
|
||||
Item[8] = "&Delete" TAB "" TAB "VerveEditor::DeleteSelection();";
|
||||
|
||||
AddIndex = 0;
|
||||
PasteIndex = 4;
|
||||
};
|
||||
%contextMenu.Init();
|
||||
|
||||
// Cache.
|
||||
$VerveEditor::VMotionTrack::ContextMenu = %contextMenu;
|
||||
}
|
||||
|
||||
// Return Menu.
|
||||
return %contextMenu;
|
||||
}
|
||||
|
||||
function VMotionTrack::ImportPathNodes()
|
||||
{
|
||||
if ( !VerveEditor::HasSelection() )
|
||||
{
|
||||
// Invalid Selection.
|
||||
return;
|
||||
}
|
||||
|
||||
%trackObject = $VerveEditor::InspectorObject;
|
||||
if ( !%trackObject.isMemberOfClass( "VMotionTrack" ) )
|
||||
{
|
||||
// Invalid Selection.
|
||||
return;
|
||||
}
|
||||
|
||||
// Load the Import Options Dialog.
|
||||
if($Verve::UseSeparateWindow)
|
||||
VerveEditorWindow.pushDialog( VerveEditorImportPathNodesGUI );
|
||||
else
|
||||
Canvas.pushDialog( VerveEditorImportPathNodesGUI );
|
||||
}
|
||||
|
||||
function VMotionTrack::_ImportPathNodes( %speed )
|
||||
{
|
||||
// Awake?
|
||||
if ( VerveEditorImportPathNodesGUI.isAwake() )
|
||||
{
|
||||
// Close the GUI.
|
||||
if($Verve::UseSeparateWindow)
|
||||
VerveEditorWindow.popDialog( VerveEditorImportPathNodesGUI );
|
||||
else
|
||||
Canvas.popDialog( VerveEditorImportPathNodesGUI );
|
||||
}
|
||||
|
||||
if ( !VerveEditor::HasSelection() )
|
||||
{
|
||||
// Invalid Selection.
|
||||
return;
|
||||
}
|
||||
|
||||
%trackObject = $VerveEditor::InspectorObject;
|
||||
if ( !%trackObject.isMemberOfClass( "VMotionTrack" ) )
|
||||
{
|
||||
// Invalid Selection.
|
||||
return;
|
||||
}
|
||||
|
||||
// Fetch the Controller.
|
||||
%controller = %trackObject.getRoot();
|
||||
|
||||
// Group History Actions.
|
||||
VerveEditor::ToggleHistoryGroup();
|
||||
|
||||
// Clear the Track.
|
||||
while( %trackObject.getCount() > 0 )
|
||||
{
|
||||
// Fetch Object.
|
||||
%event = %trackObject.getObject( 0 );
|
||||
|
||||
// Add History Item.
|
||||
%historyObject = new UndoScriptAction()
|
||||
{
|
||||
Class = "VerveEditorHistoryDeleteObject";
|
||||
SuperClass = "VerveEditorHistoryObject";
|
||||
|
||||
ActionName = "Delete Object";
|
||||
|
||||
// Store Object References.
|
||||
Parent = %trackObject;
|
||||
Object = %event;
|
||||
};
|
||||
|
||||
// Detach Object.
|
||||
%trackObject.removeObject( %event );
|
||||
}
|
||||
|
||||
// Fetch the Path.
|
||||
%pathObject = %trackObject.getPath();
|
||||
|
||||
// New Duration.
|
||||
%controllerDuration = 0;
|
||||
// Last Event Time.
|
||||
%lastEventTime = 0;
|
||||
// Fetch the Node Count.
|
||||
%nodeCount = %pathObject.getNodeCount();
|
||||
for ( %i = 0; %i < ( %nodeCount + %controller.Loop ); %i++ )
|
||||
{
|
||||
// Create a new Event.
|
||||
%newEvent = %trackObject.CreateEvent( false );
|
||||
|
||||
if ( %i > 0 )
|
||||
{
|
||||
// Fetch the Node Length.
|
||||
%nodeLength = %pathObject.getNodeLength( %i - 1 );
|
||||
// Determine the Trigger Time.
|
||||
%triggerInterval = 1000 * ( %nodeLength / %speed );
|
||||
|
||||
// Determine the Trigger Time.
|
||||
%lastEventTime = ( %lastEventTime + %triggerInterval );
|
||||
|
||||
// Update Duration.
|
||||
%controllerDuration = %lastEventTime;
|
||||
// Set the Event's Trigger Time.
|
||||
%newEvent.TriggerTime = %lastEventTime;
|
||||
}
|
||||
|
||||
if ( %i < %nodeCount )
|
||||
{
|
||||
// Add the Event.
|
||||
%trackObject.addObject( %newEvent );
|
||||
}
|
||||
|
||||
// Do Event Callback.
|
||||
%newEvent.OnAdd();
|
||||
}
|
||||
|
||||
// Set the Controller Duration.
|
||||
%controller.setFieldValue( "Duration", %controllerDuration );
|
||||
|
||||
// Finish Up.
|
||||
VerveEditor::ToggleHistoryGroup();
|
||||
|
||||
// Refresh the Editor.
|
||||
VerveEditor::Refresh();
|
||||
|
||||
// Set Selection.
|
||||
VerveEditor::SetSelection( %trackObject.Control );
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VParticleEffectToggleTrackPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
Parent = "VObjectPropertyList";
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VParticleEffectToggleTrack::CreateEvent( %this )
|
||||
{
|
||||
// Create Event.
|
||||
return new VParticleEffectToggleEvent();
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VPostEffectToggleTrackPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
Parent = "VObjectPropertyList";
|
||||
|
||||
Group[0] = "VPostEffectToggleTrack";
|
||||
Field[0, 0] = "PostEffect";
|
||||
Type[0, 0] = "VPostEffectEnum";
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VPostEffectToggleTrack::CreateEvent( %this )
|
||||
{
|
||||
// Create Event.
|
||||
return new VPostEffectToggleEvent();
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VSceneJumpTrackPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
Parent = "VObjectPropertyList";
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VSceneJumpTrack::CreateEvent( %this )
|
||||
{
|
||||
// Create Event.
|
||||
return new VSceneJumpEvent();
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VScriptEventTrackPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
Parent = "VObjectPropertyList";
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VScriptEventTrack::CreateEvent( %this )
|
||||
{
|
||||
// Create Event.
|
||||
return new VScriptEvent();
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VShapeAnimationTrackPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
Parent = "VObjectPropertyList";
|
||||
|
||||
Group[0] = "VShapeAnimationTrack";
|
||||
Field[0, 0] = "ThreadIndex";
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VShapeAnimationTrack::Refresh( %this )
|
||||
{
|
||||
// Create Control.
|
||||
%trackControl = Parent::Refresh( %this );
|
||||
|
||||
// Add Field Notify.
|
||||
VObject::AddFieldNotify( $VerveEditor::Controller, "Duration", %this );
|
||||
|
||||
// Object Reference Notify.
|
||||
VObject::AddFieldNotify( %this.getParent(), "Reference", %this );
|
||||
|
||||
// Return Control.
|
||||
return %trackControl;
|
||||
}
|
||||
|
||||
function VShapeAnimationTrack::CreateEvent( %this )
|
||||
{
|
||||
// Create Event.
|
||||
return new VShapeAnimationEvent();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
function VShapeAnimationTrack::Update( %this )
|
||||
{
|
||||
// Root Update.
|
||||
%this.UpdateTrack();
|
||||
|
||||
%trackControl = %this.Control.SiblingControl;
|
||||
if ( !isObject( %trackControl ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Update GUI Elements.
|
||||
%eventCount = %trackControl.getCount();
|
||||
for ( %i = 0; %i < %eventCount; %i++ )
|
||||
{
|
||||
// Get Control.
|
||||
%eventControl = %trackControl.getObject( %i );
|
||||
|
||||
// Update.
|
||||
%eventControl.Update();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VSlowMoTrackPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
Parent = "VObjectPropertyList";
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VSlowMoTrack::CreateEvent( %this )
|
||||
{
|
||||
// Create Event.
|
||||
return new VSlowMoEvent();
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VSoundEffectTrackPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
Parent = "VObjectPropertyList";
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VSoundEffectTrack::CreateEvent( %this )
|
||||
{
|
||||
// Create Event.
|
||||
return new VSoundEffectEvent();
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VSpawnSphereSpawnTargetTrackPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
Parent = "VObjectPropertyList";
|
||||
|
||||
Group[0] = "Spawn Target Track";
|
||||
Field[0, 0] = "DespawnOnLoop";
|
||||
Field[0, 1] = "DespawnOnStop";
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VSpawnSphereSpawnTargetTrack::CreateEvent( %this )
|
||||
{
|
||||
// Create Event.
|
||||
return new VSpawnSphereSpawnTargetEvent();
|
||||
}
|
||||
|
|
@ -0,0 +1,266 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ScriptObject( VTrackPropertyList )
|
||||
{
|
||||
SuperClass = "VEditorPropertyList";
|
||||
Parent = "VObjectPropertyList";
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VTrack::OnAdd( %this )
|
||||
{
|
||||
%ourClass = %this.getClassName();
|
||||
if ( !isWordInList( %ourClass, $VerveEditor::NonUniqueTrackList ) )
|
||||
{
|
||||
%group = %this.getParent();
|
||||
%trackCount = %group.getCount();
|
||||
for ( %i = 0; %i < %trackCount; %i++ )
|
||||
{
|
||||
%trackObject = %group.getObject( %i );
|
||||
if ( %trackObject.getId() == %this.getId() )
|
||||
{
|
||||
// Skip.
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( %trackObject.isMemberOfClass( %ourClass ) )
|
||||
{
|
||||
// Alert Message.
|
||||
messageBox( "Verve Editor", "You cannot have more than one \"" @ %ourClass @ "\" in a group.", "Ok", "Warning" );
|
||||
|
||||
// Invalid.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Regular Add.
|
||||
return Parent::OnAdd( %this );
|
||||
}
|
||||
|
||||
function VTrack::CanPaste( %this, %targetObject )
|
||||
{
|
||||
if ( !isObject( %targetObject ) )
|
||||
{
|
||||
// Nope!
|
||||
return false;
|
||||
}
|
||||
|
||||
return %targetObject.isMemberOfClass( "VEvent" );
|
||||
}
|
||||
|
||||
function VTrack::Refresh( %this )
|
||||
{
|
||||
// Create Control.
|
||||
%trackControl = VerveEditor::CreateTrackControl( %this );
|
||||
|
||||
%eventCount = %this.getCount();
|
||||
for ( %i = 0; %i < %eventCount; %i++ )
|
||||
{
|
||||
%this.getObject( %i ).Refresh( %trackControl );
|
||||
}
|
||||
|
||||
// Return Control.
|
||||
return %trackControl;
|
||||
}
|
||||
|
||||
function VTrack::CreateEvent( %this )
|
||||
{
|
||||
// Create Event.
|
||||
return new VEvent();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
function VerveEditor::CreateTrackControl( %object )
|
||||
{
|
||||
%groupWidth = getWord( VerveEditorGroupStack.getExtent(), 0 );
|
||||
%groupHeight = 26;
|
||||
%trackWidth = getWord( VerveEditorTrackStack.getExtent(), 0 );
|
||||
%trackHeight = %groupHeight;
|
||||
|
||||
%groupContainer = new VEditorButton()
|
||||
{
|
||||
SuperClass = "VEditorSelectable";
|
||||
Class = "VEditorSelectableTrack";
|
||||
Profile = "VEditorTrackProfile";
|
||||
|
||||
HorizSizing = "width";
|
||||
VertSizing = "bottom";
|
||||
Position = "0 0";
|
||||
Extent = %groupWidth SPC %groupHeight;
|
||||
|
||||
ButtonType = "ToggleButton";
|
||||
GroupNum = "-1";
|
||||
|
||||
IsContainer = "1";
|
||||
};
|
||||
VerveEditorGroupStack.add( %groupContainer );
|
||||
|
||||
%groupCheckbox = new GuiCheckBoxCtrl()
|
||||
{
|
||||
Class = "VEditorBoolPropertyField";
|
||||
InternalName = "Enabled";
|
||||
Profile = "VEditorCheckBoxProfile";
|
||||
|
||||
HorizSizing = "width";
|
||||
VertSizing = "bottom";
|
||||
Position = "4 0";
|
||||
Extent = "14" SPC %trackHeight;
|
||||
|
||||
Object = %object;
|
||||
FieldName = "Enabled";
|
||||
Command = "$ThisControl.ApplyValue();";
|
||||
|
||||
Text = "";
|
||||
};
|
||||
%groupContainer.add( %groupCheckbox );
|
||||
|
||||
%trackContainer = new VEditorButton()
|
||||
{
|
||||
SuperClass = "VEditorSelectable";
|
||||
Class = "VEditorSelectableTrack";
|
||||
Profile = "VEditorTrackProfile";
|
||||
|
||||
HorizSizing = "width";
|
||||
VertSizing = "bottom";
|
||||
Position = "0 0";
|
||||
Extent = %trackWidth SPC %trackHeight;
|
||||
|
||||
ButtonType = "ToggleButton";
|
||||
GroupNum = "-1";
|
||||
|
||||
IsContainer = "1";
|
||||
};
|
||||
VerveEditorTrackStack.add( %trackContainer );
|
||||
|
||||
// Field Notify.
|
||||
%object.AddFieldNotify( "Label", %groupContainer );
|
||||
%object.AddFieldNotify( "Enabled", %groupCheckbox );
|
||||
|
||||
// Reference Siblings.
|
||||
%trackContainer.SiblingControl = %groupContainer;
|
||||
%groupContainer.SiblingControl = %trackContainer;
|
||||
|
||||
// Reference Proxy.
|
||||
%groupContainer.Proxy = %object;
|
||||
%trackContainer.Proxy = %object;
|
||||
|
||||
// Reference Control.
|
||||
%object.Control = %groupContainer;
|
||||
|
||||
return %trackContainer;
|
||||
}
|
||||
|
||||
function VEditorSelectableTrack::Update( %this, %fieldName, %fieldValue )
|
||||
{
|
||||
%this.setText( %fieldValue );
|
||||
}
|
||||
|
||||
function VTrack::GetContextMenu( %this )
|
||||
{
|
||||
%contextMenu = $VerveEditor::VTrack::ContextMenu;
|
||||
if ( !isObject( %contextMenu ) )
|
||||
{
|
||||
%contextMenu = new PopupMenu()
|
||||
{
|
||||
SuperClass = "VerveWindowMenu";
|
||||
|
||||
IsPopup = true;
|
||||
|
||||
Label = "VTrackContextMenu";
|
||||
Position = 0;
|
||||
|
||||
Item[0] = "&Add Event" TAB "" TAB "VEditorSelectableTrack::AddEvent();";
|
||||
|
||||
Item[1] = "" TAB "";
|
||||
|
||||
Item[2] = "Cu&t" TAB "" TAB "VerveEditor::CutSelection();";
|
||||
Item[3] = "&Copy" TAB "" TAB "VerveEditor::CopySelection();";
|
||||
Item[4] = "&Paste" TAB "" TAB "VEditorSelectableTrack::PasteEvent();";
|
||||
|
||||
Item[5] = "" TAB "";
|
||||
|
||||
Item[6] = "&Delete" TAB "" TAB "VerveEditor::DeleteSelection();";
|
||||
|
||||
AddIndex = 0;
|
||||
PasteIndex = 4;
|
||||
};
|
||||
%contextMenu.Init();
|
||||
|
||||
// Cache.
|
||||
$VerveEditor::VTrack::ContextMenu = %contextMenu;
|
||||
}
|
||||
|
||||
// Return Menu.
|
||||
return %contextMenu;
|
||||
}
|
||||
|
||||
function VTrack::DisplayContextMenu( %this, %x, %y )
|
||||
{
|
||||
// Fetch the Context Menu.
|
||||
%contextMenu = %this.GetContextMenu();
|
||||
|
||||
// Fetch Track Control.
|
||||
%trackControl = %this.Control.SiblingControl;
|
||||
|
||||
// Enable If Track Stack Member.
|
||||
%enableAdd = VerveEditorTrackStack.isMember( %trackControl );
|
||||
|
||||
if ( %enableAdd )
|
||||
{
|
||||
// Time.
|
||||
%time = VerveEditorTimeLine.toTime( %x - getWord( %trackControl.getGlobalPosition(), 0 ) );
|
||||
if ( %time < 0 || %time > $VerveEditor::Controller.Duration )
|
||||
{
|
||||
// Disable.
|
||||
%enableAdd = false;
|
||||
}
|
||||
|
||||
// Store Time.
|
||||
%this.MouseTime = %time;
|
||||
}
|
||||
|
||||
// Enable/Disable Adding Events.
|
||||
%contextMenu.enableItem( %contextMenu.AddIndex , %enableAdd );
|
||||
|
||||
// Enable/Disable Pasting.
|
||||
%contextMenu.enableItem( %contextMenu.PasteIndex, %enableAdd & VerveEditor::CanPaste() );
|
||||
|
||||
// Display.
|
||||
if($Verve::UseSeparateWindow)
|
||||
%contextMenu.showPopup( VerveEditorWindow, %x, %y );
|
||||
else
|
||||
%contextMenu.showPopup( Canvas, %x, %y );
|
||||
}
|
||||
|
||||
function VEditorSelectableTrack::AddEvent()
|
||||
{
|
||||
if ( !VerveEditor::HasSelection() )
|
||||
{
|
||||
// Invalid Selection.
|
||||
return;
|
||||
}
|
||||
|
||||
%trackObject = $VerveEditor::InspectorObject;
|
||||
if ( !%trackObject.isMemberOfClass( "VTrack" ) )
|
||||
{
|
||||
// Invalid Selection.
|
||||
return;
|
||||
}
|
||||
|
||||
// Create Event.
|
||||
VerveEditor::AddEvent( %trackObject, %trackObject.MouseTime );
|
||||
|
||||
// Clear.
|
||||
%trackObject.MouseTime = "";
|
||||
}
|
||||
|
||||
function VEditorSelectableTrack::PasteEvent()
|
||||
{
|
||||
// Void.
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VerveEditor::InitTrackScripts()
|
||||
{
|
||||
// Core.
|
||||
exec( "./VTrack.cs" );
|
||||
|
||||
// Built-In.
|
||||
exec( "./VCameraShakeTrack.cs" );
|
||||
exec( "./VDirectorTrack.cs" );
|
||||
exec( "./VFadeTrack.cs" );
|
||||
exec( "./VLightObjectAnimationTrack.cs" );
|
||||
exec( "./VLightObjectToggleTrack.cs" );
|
||||
exec( "./VMotionTrack.cs" );
|
||||
exec( "./VParticleEffectToggleTrack.cs" );
|
||||
exec( "./VPostEffectToggleTrack.cs" );
|
||||
exec( "./VSceneJumpTrack.cs" );
|
||||
exec( "./VScriptEventTrack.cs" );
|
||||
exec( "./VShapeAnimationTrack.cs" );
|
||||
exec( "./VSlowMoTrack.cs" );
|
||||
exec( "./VSoundEffectTrack.cs" );
|
||||
exec( "./VSpawnSphereSpawnTargetTrack.cs" );
|
||||
|
||||
// Custom.
|
||||
// Exec Custom Track Scripts.
|
||||
|
||||
// Non-Unique Group List.
|
||||
$VerveEditor::NonUniqueTrackList = "VTrack VPostEffectToggleTrack VSoundEffectTrack";
|
||||
}
|
||||
VerveEditor::InitTrackScripts();
|
||||
99
Templates/BaseGame/game/tools/VerveEditor/Scripts/Utility.cs
Normal file
99
Templates/BaseGame/game/tools/VerveEditor/Scripts/Utility.cs
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Class
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function SimObject::isMemberOfClassList( %this, %typeList )
|
||||
{
|
||||
%typeCount = getWordCount( %typeList );
|
||||
for ( %i = 0; %i < %typeCount; %i++ )
|
||||
{
|
||||
if ( %this.isMemberOfClass( getWord( %typeList, %i ) ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// GUI
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function GuiControl::getParentOfType( %this, %className )
|
||||
{
|
||||
%parent = %this.getParent();
|
||||
while ( isObject( %parent ) )
|
||||
{
|
||||
if ( %parent.isMemberOfClass( %className ) )
|
||||
{
|
||||
return %parent;
|
||||
}
|
||||
|
||||
%parent = %parent.getParent();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// MATH
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function mRound( %number, %delta )
|
||||
{
|
||||
return ( mFloor( %number / %delta + 0.5 ) * %delta );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// STRING
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function isWordInList( %word, %list )
|
||||
{
|
||||
%wordCount = getWordCount( %list );
|
||||
for ( %i = 0; %i < %wordCount; %i++ )
|
||||
{
|
||||
if ( getWord( %list, %i ) $= %word )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function sortWordList( %list )
|
||||
{
|
||||
%wordCount = getWordCount( %list );
|
||||
for ( %j = 0; %j < %wordCount; %j++ )
|
||||
{
|
||||
for ( %i = %wordCount - 1; %i > %j; %i-- )
|
||||
{
|
||||
%wordA = getWord( %list, %i - 0 );
|
||||
%wordB = getWord( %list, %i - 1 );
|
||||
|
||||
// Compare and swap if needed
|
||||
if ( strcmp( strlwr( %wordA ), strlwr( %wordB ) ) < 0 )
|
||||
{
|
||||
%list = setWord( %list, %i - 1, %wordA );
|
||||
%list = setWord( %list, %i - 0, %wordB );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return %list;
|
||||
}
|
||||
98
Templates/BaseGame/game/tools/VerveEditor/Scripts/VObject.cs
Normal file
98
Templates/BaseGame/game/tools/VerveEditor/Scripts/VObject.cs
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) - Violent Tulip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VObject::OnAdd( %this )
|
||||
{
|
||||
// Fetch Parent.
|
||||
%parentObject = %this.getParent();
|
||||
%rootObject = %this.getRoot();
|
||||
if ( !%parentObject || ( %rootObject.getId() != $VerveEditor::Controller.getId() ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( !VerveEditorHistoryManager.Locked )
|
||||
{
|
||||
// Add History Item.
|
||||
%historyObject = new UndoScriptAction()
|
||||
{
|
||||
Class = "VerveEditorHistoryCreateObject";
|
||||
SuperClass = "VerveEditorHistoryObject";
|
||||
|
||||
ActionName = "Create Object";
|
||||
|
||||
// Store Object References.
|
||||
Parent = %parentObject;
|
||||
Object = %this;
|
||||
};
|
||||
}
|
||||
|
||||
// Valid.
|
||||
return true;
|
||||
}
|
||||
|
||||
function VObject::OnRemove( %this )
|
||||
{
|
||||
// Void.
|
||||
}
|
||||
|
||||
function VObject::Delete( %this )
|
||||
{
|
||||
// Fetch Parent.
|
||||
%parentObject = %this.getParent();
|
||||
%rootObject = %this.getRoot();
|
||||
if ( !%parentObject || ( %rootObject.getId() != $VerveEditor::Controller.getId() ) )
|
||||
{
|
||||
// Callback.
|
||||
%this.OnRemove();
|
||||
|
||||
// Not Editing, Delete.
|
||||
Parent::delete( %this );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !VerveEditorHistoryManager.Locked )
|
||||
{
|
||||
// Add History Item.
|
||||
%historyObject = new UndoScriptAction()
|
||||
{
|
||||
Class = "VerveEditorHistoryDeleteObject";
|
||||
SuperClass = "VerveEditorHistoryObject";
|
||||
|
||||
ActionName = "Delete Object";
|
||||
|
||||
// Store Object References.
|
||||
Parent = %parentObject;
|
||||
Object = %this;
|
||||
};
|
||||
}
|
||||
|
||||
// Callback.
|
||||
%this.OnRemove();
|
||||
|
||||
// Detach Object.
|
||||
%parentObject.removeObject( %this );
|
||||
}
|
||||
|
||||
function VObject::OnFieldChange( %this, %fieldName, %oldValue, %newValue )
|
||||
{
|
||||
if ( !VerveEditorHistoryManager.Locked )
|
||||
{
|
||||
// Add History Item.
|
||||
%historyObject = new UndoScriptAction()
|
||||
{
|
||||
Class = "VerveEditorHistoryChangeProperty";
|
||||
SuperClass = "VerveEditorHistoryObject";
|
||||
|
||||
ActionName = "Change Property (" @ %fieldName @ ")";
|
||||
|
||||
// Store References.
|
||||
Object = %this;
|
||||
FieldName = %fieldName;
|
||||
OldValue = %oldValue;
|
||||
NewValue = %newValue;
|
||||
};
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue