summaryrefslogtreecommitdiffstats
path: root/tools/trackeditor/code/scripts
diff options
context:
space:
mode:
authorSvxy <aidan61605@gmail.com>2023-05-31 23:31:32 +0200
committerSvxy <aidan61605@gmail.com>2023-05-31 23:31:32 +0200
commiteb4b3404aa00220d659e532151dab13d642c17a3 (patch)
tree7e1107c4995489a26c4007e41b53ea8d00ab2134 /tools/trackeditor/code/scripts
downloadThe-Simpsons-Hit-and-Run-eb4b3404aa00220d659e532151dab13d642c17a3.tar
The-Simpsons-Hit-and-Run-eb4b3404aa00220d659e532151dab13d642c17a3.tar.gz
The-Simpsons-Hit-and-Run-eb4b3404aa00220d659e532151dab13d642c17a3.tar.bz2
The-Simpsons-Hit-and-Run-eb4b3404aa00220d659e532151dab13d642c17a3.tar.lz
The-Simpsons-Hit-and-Run-eb4b3404aa00220d659e532151dab13d642c17a3.tar.xz
The-Simpsons-Hit-and-Run-eb4b3404aa00220d659e532151dab13d642c17a3.tar.zst
The-Simpsons-Hit-and-Run-eb4b3404aa00220d659e532151dab13d642c17a3.zip
Diffstat (limited to 'tools/trackeditor/code/scripts')
-rw-r--r--tools/trackeditor/code/scripts/te_BVContext.mel43
-rw-r--r--tools/trackeditor/code/scripts/te_IntersectionContext.mel212
-rw-r--r--tools/trackeditor/code/scripts/te_PPContext.mel43
-rw-r--r--tools/trackeditor/code/scripts/te_cleanup.mel12
-rw-r--r--tools/trackeditor/code/scripts/te_editorwindow.mel335
-rw-r--r--tools/trackeditor/code/scripts/te_globals.mel1
-rw-r--r--tools/trackeditor/code/scripts/te_main.mel195
-rw-r--r--tools/trackeditor/code/scripts/te_setup.mel15
-rw-r--r--tools/trackeditor/code/scripts/te_treelineContext.mel84
9 files changed, 940 insertions, 0 deletions
diff --git a/tools/trackeditor/code/scripts/te_BVContext.mel b/tools/trackeditor/code/scripts/te_BVContext.mel
new file mode 100644
index 0000000..e835468
--- /dev/null
+++ b/tools/trackeditor/code/scripts/te_BVContext.mel
@@ -0,0 +1,43 @@
+//-----------------------------------------------------------------------------
+// Copyright (C) 2001 Radical Entertainment Ltd. All rights reserved.
+//
+// te_BVContext.mel
+//
+// Description: Defines all the scripts required by the BVContext tool
+// As a convention all Terrain Editor global procedures
+// and global variables are prefixed with "te_". All commands
+// exposed through TE plugins are prefixed with "TE_".
+//
+// MCB = Menu Call Back
+// BCB = Button Call Back
+//
+// Modification History:
+// + Created -- CBrisebois
+//-----------------------------------------------------------------------------
+
+//This is the global instance of the bv context tool.
+
+global proc te_MCB_StartBVLoop()
+{
+ //Start the BV context...
+ if ( ! `contextInfo -exists BVCtx` )
+ {
+ BVContext BVCtx;
+ }
+
+ setToolTo BVCtx;
+}
+
+global proc te_MCB_SplitSelectedBV()
+{
+ //Call the API function.
+ BVSplitSelected();
+}
+
+global proc te_Delete_BVContext()
+{
+ if ( `contextInfo -exists BVCtx` )
+ {
+ deleteUI -toolContext BVCtx;
+ }
+} \ No newline at end of file
diff --git a/tools/trackeditor/code/scripts/te_IntersectionContext.mel b/tools/trackeditor/code/scripts/te_IntersectionContext.mel
new file mode 100644
index 0000000..54561ff
--- /dev/null
+++ b/tools/trackeditor/code/scripts/te_IntersectionContext.mel
@@ -0,0 +1,212 @@
+//-----------------------------------------------------------------------------
+// Copyright (C) 2001 Radical Entertainment Ltd. All rights reserved.
+//
+// te_IntersectionContext.mel
+//
+// Description: Defines all the scripts required by the IntersectionContext tool
+// As a convention all Terrain Editor global procedures
+// and global variables are prefixed with "te_". All commands
+// exposed through TE plugins are prefixed with "TE_".
+//
+// MCB = Menu Call Back
+// BCB = Button Call Back
+//
+// Modification History:
+// + Created -- CBrisebois
+//-----------------------------------------------------------------------------
+
+//This is the global instance of the bv context tool.
+
+global proc te_MCB_StartIntersection()
+{
+ //Start the Intersection context...
+ if ( ! `contextInfo -exists IntersectionCtx` )
+ {
+ IntersectionContext IntersectionCtx;
+ }
+
+ setToolTo IntersectionCtx;
+}
+
+global string $gSelectedIntersection = "";
+global int $gIntersectionSelectionCallbackID = 0;
+global string $gSelectedName;
+global string $gTypeField;
+global string $gIntersectionTypes[] = { "NoStop", "NWay", "FourWay", "NoStopN", "NWayN" };
+
+global proc te_MCB_EditIntersection()
+{
+ global string $gSelectedName;
+ global int $gIntersectionSelectionCallbackID;
+ global string $gIntersectionTypes[];
+ global string $gTypeField;
+
+ if ( `window -exists TE_InteresctionEditor` )
+ {
+ deleteUI -window TE_IntersectionEditor;
+ }
+
+ window -rtf true -title "TE Road / Intersection Editor" TE_IntersectionEditor;
+
+ columnLayout -adjustableColumn true;
+
+ $gSelectedName = `textField -editable false -text "" -width 170`;
+
+ $gTypeField = `optionMenu -label "Type" -width 170 -changeCommand ("te_MCB_IntersectionTypeChange( \"#1\" )")`;
+
+ int $index;
+ int $size = size($gIntersectionTypes);
+ for ( $index = 0; $index < $size; $index++ )
+ {
+ menuItem -label $gIntersectionTypes[ $index ];
+ }
+ setParent ..;
+
+ button -label "Create Road" -command ( "te_MCB_CreateRoadFromSelected()" );
+ button -label "Show Whole Road" -command ( "te_MCB_ShowRoadFromSelected()" );
+ button -label "Destroy Road" -command ( "te_MCB_DestroyRoadFromSelected()" );
+ button -label "Set Intersection Start" -command ( "te_MCB_AddSelectedIntersectionToRoad( 0 )" );
+ button -label "Set Intersection End" -command ( "te_MCB_AddSelectedIntersectionToRoad( 1 )" );
+ separator;
+ button -label "Create Intersections" -command "te_MCB_StartIntersection()";
+
+ setParent ..;
+
+ showWindow;
+
+ //Create the selection change callback.
+ $gIntersectionSelectionCallbackID = `scriptJob -parent "TE_IntersectionEditor" -event "SelectionChanged" "te_UpdateIntersectionEditor()"`;
+
+}
+
+global proc te_MCB_IntersectionTypeChange( string $value )
+{
+ global string $gSelectedIntersection;
+
+ if ( $gSelectedIntersection != "" )
+ {
+ setAttr ( $gSelectedIntersection + ".IntersectionType" ) -type "string" $value;
+ }
+}
+
+global proc te_CloseIntersectionEditorWindow()
+{
+ global int $gIntersectionSelectionCallbackID;
+
+ if ( `window -exists TE_InteresctionEditor` )
+ {
+ deleteUI -window TE_IntersectionEditor;
+ }
+
+ $gIntersectionSelectionCallbackID = 0;
+}
+
+global proc te_UpdateIntersectionEditor()
+{
+ global string $gSelectedIntersection;
+ global string $gSelectedName;
+ global string $gTypeField;
+ global string $gIntersectionTypes[];
+
+ string $selectedObjects[] = `ls -sl -dag`;
+ string $selectedObjectName = $selectedObjects[0];
+ string $selectedNodeType;
+
+ if ( $selectedObjectName != "" )
+ {
+ //There is something selected
+
+ $selectedNodeType = `nodeType $selectedObjectName `;
+
+ if ( $selectedNodeType == "transform" )
+ {
+ //We don't want the transform, we want the child node.
+ string $children[] = `listRelatives -c $selectedObjectName`;
+ $selectedObjectName = $children[0];
+ }
+
+ if ( $selectedObjectName != "" )
+ {
+ $selectedNodeType = `nodeType $selectedObjectName `;
+
+ if ( $selectedNodeType == "IntersectionLocatorNode" )
+ {
+ //We're in business
+ textField -edit -text $selectedObjectName $gSelectedName;
+
+ string $value = `getAttr ( $selectedObjectName + ".IntersectionType" )`;
+
+ //Which index is this string?
+ int $size = size( $gIntersectionTypes );
+ int $index;
+
+ for ( $index = 0; $index < $size; $index++ )
+ {
+ if ( $gIntersectionTypes[ $index ] == $value )
+ {
+ optionMenu -edit -sl ($index + 1) $gTypeField;
+ break;
+ }
+ }
+
+ if ( $index == $size )
+ {
+ //This node had no proper setting. Resetting it.
+ warning "Node had invalid type setting. Correcting to default type";
+
+ optionMenu -edit -sl 1 $gTypeField;
+ setAttr ( $selectedObjectName + ".IntersectionType" ) -type "string" $gIntersectionTypes[ 0 ];
+ }
+
+ $gSelectedIntersection = $selectedObjectName;
+ return;
+ }
+ else if ( $selectedNodeType == "mesh" )
+ {
+ //This is for adding road to the selected intersection. Do not unselect the intersection.
+ string $whichRoad[] = `listAttr -st teWhichRoad $selectedObjectName`;
+
+ if ( size( $whichRoad ) )
+ {
+ return;
+ }
+ }
+ }
+ }
+
+ textField -edit -text "" $gSelectedName;
+ $gSelectedIntersection = "";
+
+}
+
+
+
+global proc te_MCB_CreateRoadFromSelected()
+{
+ TE_CreateRoad();
+}
+
+global proc te_MCB_ShowRoadFromSelected()
+{
+ TE_ShowRoad();
+}
+
+global proc te_MCB_DestroyRoadFromSelected()
+{
+ TE_DestroyRoad();
+}
+
+global proc te_MCB_AddSelectedIntersectionToRoad( int $isEnd )
+{
+ global string $gSelectedIntersection;
+
+ TE_AddIntersectionToRoad( $gSelectedIntersection, $isEnd );
+}
+
+global proc te_Delete_IntersectionContext()
+{
+ if ( `contextInfo -exists IntersectionCtx` )
+ {
+ deleteUI -toolContext IntersectionCtx;
+ }
+} \ No newline at end of file
diff --git a/tools/trackeditor/code/scripts/te_PPContext.mel b/tools/trackeditor/code/scripts/te_PPContext.mel
new file mode 100644
index 0000000..a8cc63f
--- /dev/null
+++ b/tools/trackeditor/code/scripts/te_PPContext.mel
@@ -0,0 +1,43 @@
+//-----------------------------------------------------------------------------
+// Copyright (C) 2001 Radical Entertainment Ltd. All rights reserved.
+//
+// te_PPContext.mel
+//
+// Description: Defines all the scripts required by the PPContext tool
+// As a convention all Terrain Editor global procedures
+// and global variables are prefixed with "te_". All commands
+// exposed through TE plugins are prefixed with "TE_".
+//
+// MCB = Menu Call Back
+// BCB = Button Call Back
+//
+// Modification History:
+// + Created -- CBrisebois
+//-----------------------------------------------------------------------------
+
+//This is the global instance of the bv context tool.
+
+global proc te_MCB_StartPPLoop()
+{
+ //Start the PP context...
+ if ( ! `contextInfo -exists PPCtx` )
+ {
+ PPContext PPCtx;
+ }
+
+ setToolTo PPCtx;
+}
+
+global proc te_MCB_SplitSelectedPP()
+{
+ //Call the API function.
+ PPSplitSelected();
+}
+
+global proc te_Delete_PPContext()
+{
+ if ( `contextInfo -exists PPCtx` )
+ {
+ deleteUI -toolContext PPCtx;
+ }
+} \ No newline at end of file
diff --git a/tools/trackeditor/code/scripts/te_cleanup.mel b/tools/trackeditor/code/scripts/te_cleanup.mel
new file mode 100644
index 0000000..21f39d3
--- /dev/null
+++ b/tools/trackeditor/code/scripts/te_cleanup.mel
@@ -0,0 +1,12 @@
+te_Delete_TreeLineContext();
+te_Delete_BVContext();
+te_Delete_PPContext();
+te_Delete_IntersectionContext();
+te_CloseIntersectionEditorWindow();
+
+if ( `menu -exists te_MainMenu` )
+{
+ deleteUI te_MainMenu;
+
+ flushUndo;
+}
diff --git a/tools/trackeditor/code/scripts/te_editorwindow.mel b/tools/trackeditor/code/scripts/te_editorwindow.mel
new file mode 100644
index 0000000..1504a52
--- /dev/null
+++ b/tools/trackeditor/code/scripts/te_editorwindow.mel
@@ -0,0 +1,335 @@
+//Constant
+global int $gMAX_LANES = 4;
+
+global string $gSelectedName;
+global string $gOriginField;
+global string $gRoadField;
+global string $gTopField;
+global string $gBottomField;
+global string $gLanesField;
+global string $gShoulderField;
+
+global int $gSelectionScriptJob;
+
+global string $gSelectedObjectName;
+
+global proc teOpenEditorWindow()
+{
+ global string $gSelectedName;
+ global string $gOriginField;
+ global string $gRoadField;
+ global string $gTopField;
+ global string $gBottomField;
+ global string $gLanesField;
+ global string $gShoulderField;
+ global int $gMAX_LANES;
+
+
+ if ( `window -exists TE_TileEditor` )
+ {
+ deleteUI -window TE_TileEditor;
+ }
+
+ window -rtf true -title "TE Tile Editor" TE_TileEditor;
+
+ columnLayout -adjustableColumn true;
+
+ string $selectedRow = `rowLayout -numberOfColumns 3 -columnWidth 1 170`;
+ $gSelectedName = `textField -editable false -text "" -width 170`;
+ string $selectedButton = `button -label "Select Mesh" -command ("teSelectMesh()")`;
+ string $doneButton = `button -label "Done" -command ("teDoneEditingMesh()")`;
+
+ setParent ..;
+
+ string $originRow = `rowLayout -numberOfColumns 2`;
+ string $originButton = `button -label "Set Origin" -command ("teSelectOrigin()")`;
+ $gOriginField = `intField -value -1 -editable false`;
+ setParent ..;
+
+
+ string $roadRow = `rowLayout -numberOfColumns 2`;
+ string $roadButton = `button -label "Set Road Dir" -command ("teSelectRoadDir()")`;
+ $gRoadField = `intField -value -1 -editable false`;
+ setParent ..;
+
+
+ string $topRow = `rowLayout -numberOfColumns 2`;
+ string $topButton = `button -label "Set TOP" -command ("teSelectTOP()")`;
+ $gTopField = `intField -value -1 -editable false`;
+ setParent ..;
+
+
+ string $bottomRow = `rowLayout -numberOfColumns 2`;
+ string $bottomButton = `button -label "Set BOTTOM" -command ("teSelectBOTTOM()")`;
+ $gBottomField = `intField -value -1 -editable false`;
+ setParent ..;
+
+ //The following #1 is a trick that the scripting system converts into the value of the field/control...
+ string $laneRow = `rowLayout -numberOfColumns 2`;
+ string $laneLabel = `text -label "Num. Lanes" -align "center"`;
+ $gLanesField = `intField -value 1 -min 0 -max $gMAX_LANES -step 1 -editable true -changeCommand ("teSetNumLanes(#1)")`;
+ setParent ..;
+
+ $gShoulderField = `checkBox -label "Has Shoulder" -value true -changeCommand ("teSetShoulder(#1)")`;
+
+ setParent ..; //columnLayout
+
+ showWindow;
+}
+
+global proc teCloseEditorWindow()
+{
+ global string $gSelectedName;
+ global string $gOriginField;
+ global string $gRoadField;
+ global string $gTopField;
+ global string $gBottomField;
+ global string $gLanesField;
+ global string $gShoulderField;
+
+ global int $gSelectionScriptJob;
+
+ if ( `window -exists TE_TileEditor` )
+ {
+ deleteUI -window TE_TileEditor;
+ }
+
+ $gSelectedName = "";
+ $gOriginField = "";
+ $gRoadField = "";
+ $gTopField = "";
+ $gBottomField = "";
+ $gLanesField = "";
+ $gShoulderField = "";
+
+ $gSelectionScriptJob = 0;
+}
+
+global proc teSelectMesh()
+{
+ global string $gSelectedName;
+ global int $gSelectionScriptJob;
+ global string $gSelectedObjectName;
+
+ //May want to inform the TrackEditor of this selection if it is good.
+ string $selectedObjects[] = `ls -sl -dag`;
+ string $selectedObjectName = $selectedObjects[0];
+ string $selectedNodeType;
+
+ if ( $selectedObjectName != "" )
+ {
+ //There is something selected
+
+ $selectedNodeType = `nodeType $selectedObjectName `;
+
+ if ( $selectedNodeType == "transform" )
+ {
+ //We don't want the transform, we want the child node.
+ $selectedObjectName = $selectedObjects[1];
+ }
+
+ if ( $selectedObjectName != "" )
+ {
+ $selectedNodeType = `nodeType $selectedObjectName `;
+
+ if ( $selectedNodeType == "mesh" )
+ {
+ //We're in business
+ textField -edit -text $selectedObjectName $gSelectedName;
+
+ teSwitchToVertexSelection( 1 ); //Turn on vertex selection.
+
+ teAddSettingsToObject( $selectedObjectName );
+
+ $gSelectedObjectName = $selectedObjectName;
+
+ teUpdateEditorWindow();
+ }
+ }
+ }
+}
+
+global proc teUpdateEditorWindow()
+{
+ global string $gSelectedName;
+ global string $gOriginField;
+ global string $gRoadField;
+ global string $gTopField;
+ global string $gBottomField;
+ global string $gSelectedObjectName;
+ global string $gLanesField;
+ global string $gShoulderField;
+
+ //Update the fields according to the selected object.
+
+ int $valsSet = false;
+
+ if ( $gSelectedObjectName != "" )
+ {
+ string $attr[] = `listAttr -st teOrigin $gSelectedObjectName`;
+
+ if ( $attr[0] != "" )
+ {
+ textField -edit -text $gSelectedObjectName $gSelectedName;
+
+ float $origin = `getAttr ($gSelectedObjectName + ".teOrigin")`;
+ intField -edit -value $origin $gOriginField;
+
+ float $road = `getAttr ($gSelectedObjectName + ".teRoad")`;
+ intField -edit -value $road $gRoadField;
+
+ float $top = `getAttr ($gSelectedObjectName + ".teTop")`;
+ intField -edit -value $top $gTopField;
+
+ float $bottom = `getAttr ($gSelectedObjectName + ".teBottom")`;
+ intField -edit -value $bottom $gBottomField;
+
+ int $lanes = `getAttr ($gSelectedObjectName + ".teLanes")`;
+ intField -edit -value $lanes $gLanesField;
+
+ int $hasShoulder = `getAttr ($gSelectedObjectName + ".teShoulder")`;
+ checkBox -edit -value $hasShoulder $gShoulderField;
+
+ $valsSet = 1;
+ }
+ }
+
+ if ( !$valsSet )
+ {
+ textField -edit -text "" $gSelectedName;
+
+ intField -edit -value -1 $gOriginField;
+ intField -edit -value -1 $gRoadField;
+ intField -edit -value -1 $gTopField;
+ intField -edit -value -1 $gBottomField;
+ intField -edit -value 0 $gLanesField;
+ checkBox -edit -value false $gShoulderField;
+ }
+}
+
+global proc teSwitchToVertexSelection( int $on )
+{
+ if ( $on )
+ {
+ selectMode -component;
+ selectType -vertex true;
+ }
+ else
+ {
+ selectMode -object;
+ }
+}
+
+global proc teDoneEditingMesh()
+{
+ global string $gSelectedObjectName;
+
+ $gSelectedObjectName = ""; //Clear the selection.
+
+ teSwitchToVertexSelection( 0 ); //Turn on vertex selection.
+
+ teUpdateEditorWindow();
+}
+
+global proc teAddSettingsToObject( string $objectName )
+{
+ string $attr[] = `listAttr -st teOrigin $objectName`;
+
+ if ( $attr[0] == "" )
+ {
+ addAttr -ln teOrigin -sn teO -at long -defaultValue -1 $objectName;
+
+ addAttr -ln teRoad -sn teR -at long -defaultValue -1 $objectName;
+
+ addAttr -ln teTop -sn teT -at long -defaultValue -1 $objectName;
+
+ addAttr -ln teBottom -sn teB -at long -defaultValue -1 $objectName;
+
+ addAttr -ln teLanes -sn teL -at long -defaultValue 1 $objectName;
+
+ addAttr -ln teShoulder -sn teS -at bool -defaultValue true $objectName;
+
+ //This is for connecting to roads
+ addAttr -ln teWhichRoad -sn teWR -at message $objectName;
+
+ //This is a hint of the type
+ addAttr -ln teTypeHint -sn teTH -at long -defaultValue -1 $objectName;
+ }
+}
+
+global proc teSelectOrigin()
+{
+ global string $gSelectedObjectName;
+
+ int $pos = `TE_GetSelectedVertexIndex`;
+
+ if ( $pos >= 0 )
+ {
+ setAttr ( $gSelectedObjectName + ".teOrigin" ) $pos;
+ }
+
+ teUpdateEditorWindow();
+}
+
+global proc teSelectRoadDir()
+{
+ global string $gSelectedObjectName;
+
+ int $pos = `TE_GetSelectedVertexIndex`;
+
+ if ( $pos >= 0 )
+ {
+ setAttr ( $gSelectedObjectName + ".teRoad" ) $pos;
+ }
+
+ teUpdateEditorWindow();
+}
+
+global proc teSelectTOP()
+{
+ global string $gSelectedObjectName;
+
+ int $pos = `TE_GetSelectedVertexIndex`;
+
+ if ( $pos >= 0 )
+ {
+ setAttr ( $gSelectedObjectName + ".teTop" ) $pos;
+ }
+
+ teUpdateEditorWindow();
+}
+
+global proc teSelectBOTTOM()
+{
+ global string $gSelectedObjectName;
+
+ int $pos = `TE_GetSelectedVertexIndex`;
+
+ if ( $pos >= 0 )
+ {
+ setAttr ( $gSelectedObjectName + ".teBottom" ) $pos;
+ }
+
+ teUpdateEditorWindow();
+}
+
+
+global proc teSetNumLanes( int $numLanes )
+{
+ global string $gSelectedObjectName;
+
+ if ( $gSelectedObjectName != "" )
+ {
+ setAttr ( $gSelectedObjectName + ".teLanes" ) $numLanes;
+ }
+}
+
+global proc teSetShoulder( int $hasShoulder )
+{
+ global string $gSelectedObjectName;
+
+ if ( $gSelectedObjectName != "" )
+ {
+ setAttr ( $gSelectedObjectName + ".teShoulder" ) $hasShoulder;
+ }
+} \ No newline at end of file
diff --git a/tools/trackeditor/code/scripts/te_globals.mel b/tools/trackeditor/code/scripts/te_globals.mel
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/tools/trackeditor/code/scripts/te_globals.mel
@@ -0,0 +1 @@
+
diff --git a/tools/trackeditor/code/scripts/te_main.mel b/tools/trackeditor/code/scripts/te_main.mel
new file mode 100644
index 0000000..6a97582
--- /dev/null
+++ b/tools/trackeditor/code/scripts/te_main.mel
@@ -0,0 +1,195 @@
+//-----------------------------------------------------------------------------
+// Copyright (C) 2001 Radical Entertainment Ltd. All rights reserved.
+//
+// TE_main.mel
+//
+// Description: Installs the Terrain Editor (TE) interface.
+// As a convention all Terrain Editor global procedures
+// and global variables are prefixed with "te_". All commands
+// exposed through TE plugins are prefixed with "TE_".
+//
+// MCB = Menu Call Back
+// BCB = Button Call Back
+//
+// Modification History:
+// + Created Apr 11, 2001 -- bkusy
+// + Stolen & Adapted -- CBrisebois
+//-----------------------------------------------------------------------------
+
+//-----------------------------------------------------------------------------
+// t e _ b r e a k p o i n t
+//
+// Synopsis:
+//
+// Parameters: NONE
+//
+// Returns: NOTHING
+//
+// Constraints: NONE
+//
+//-----------------------------------------------------------------------------
+global proc te_breakpoint( string $tag )
+{
+ confirmDialog -m ( "BreakPoint: " + $tag );
+}
+
+//-----------------------------------------------------------------------------
+// t e _ M C B _ A b o u t
+//
+// Synopsis: Display an About Terrain Editor window.
+//
+// Parameters: NONE
+//
+// Returns: NOTHING
+//
+// Constraints: NONE
+//
+//-----------------------------------------------------------------------------
+global proc te_MCB_About()
+{
+// string $pluginVersion = `te_GetVersion`;
+
+ string $pluginVersion = "2.0";
+
+ string $message = ( "\nSimpsons Road Rage Terrain Editor.\n\n" +
+ "Release " + $pluginVersion + "\n" +
+ "(c) 2001, Radical Entertainment, Ltd.\n\n" );
+
+
+ confirmDialog -title "About Terrain Editor"
+ -message $message
+ -button "OK"
+ -defaultButton "OK";
+}
+
+//-----------------------------------------------------------------------------
+// t e _ d o M a i n M e n u I t e m s
+//
+// Synopsis: Creates the TE menu on the menu handle passed in.
+//
+// Parameters: NONE
+//
+// Returns: NOTHING
+//
+// Constraints: NONE
+//
+//-----------------------------------------------------------------------------
+global proc te_doMainMenuItems( string $menu )
+{
+ menu -edit -tearOff true -allowOptionBoxes true $menu;
+
+ menuItem -label "Bounding Fences" -sm true;
+
+ menuItem -label "Create fence line" -command "te_MCB_StartBVLoop()";
+
+ menuItem -label "Split Fence(s)" -command "te_MCB_SplitSelectedBV()";
+
+ setParent -menu ..;
+
+ menuItem -label "Pedestrian Paths" -sm true;
+
+ menuItem -label "Create path line" -command "te_MCB_StartPPLoop()";
+
+ menuItem -label "Split Path(s)" -command "te_MCB_SplitSelectedPP()";
+
+ setParent -menu ..;
+
+ menuItem -divider true;
+
+ menuItem -label "Track Editor" -sm true;
+
+ radioMenuItemCollection;
+
+ menuItem -label "Off" -radioButton on -command "TE_StateChange(0)";
+
+ menuItem -label "Edit Mode" -radioButton off -command "TE_StateChange(1)";
+
+ menuItem -label "Display Mode" -radioButton off -command "TE_StateChange(2)";
+
+ menuItem -divider true;
+
+ menuItem -label "Create Intersections" -command "te_MCB_StartIntersection()";
+
+ menuItem -label "Edit Roads / Intersections" -command "te_MCB_EditIntersection()";
+
+ setParent -menu ..;
+
+ menuItem -divider true;
+
+ menuItem -label "Tree Line Tool" -allowOptionBoxes true -sm true;
+
+ menuItem -label "Create Tree Lines" -command "te_MCB_CreateTreeLines()";
+
+ menuItem -label "Options" -optionBox true -command "te_MCB_TreelineOptions()";
+
+ menuItem -divider true;
+
+ menuItem -label "Snap Selected Treelines" -command "te_MCB_SnapTreelines()";
+
+ menuItem -divider true;
+
+ menuItem -label "Convert Treelines to Geometry" -command "te_MCB_ConvertToGeometry()";
+
+ setParent -menu ..;
+
+ menuItem -divider true;
+
+ menuItem -label "Export" -command "te_MCB_Export()";
+
+ menuItem -optionBox true -command "TE_ExportOptions()";
+
+ menuItem -divider true;
+
+ menuItem -label "About" -command "te_MCB_About()";
+
+ setParent -m ..;
+}
+
+//-----------------------------------------------------------------------------
+// t e _ I n s t a l l U I
+//
+// Synopsis:
+//
+// Parameters: NONE
+//
+// Returns: NOTHING
+//
+// Constraints: NONE
+//
+//-----------------------------------------------------------------------------
+global proc te_InstallUI()
+{
+
+ global string $gMainWindow;
+
+ //
+ // Install TE menu as a root menu.
+ //
+ if ( `menu -exists te_MainMenu` ) deleteUI te_MainMenu;
+ menu -label "Track Editor" -allowOptionBoxes true -parent $gMainWindow te_MainMenu;
+
+ te_doMainMenuItems "te_MainMenu";
+}
+
+global proc te_MCB_Export()
+{
+ $whichCtx = `currentCtx`;
+
+ if ( $whichCtx != "" )
+ {
+ ctxCompletion;
+ }
+
+ TE_Export();
+}
+
+source "te_globals.mel";
+source "te_setup.mel";
+source "te_BVContext.mel";
+source "te_PPContext.mel";
+source "te_treelineContext.mel";
+source "te_IntersectionContext.mel";
+source "te_editorWindow.mel";
+source "AETEShowRoadSegButton.mel";
+
+evalDeferred "te_InstallUI"; \ No newline at end of file
diff --git a/tools/trackeditor/code/scripts/te_setup.mel b/tools/trackeditor/code/scripts/te_setup.mel
new file mode 100644
index 0000000..d5ca442
--- /dev/null
+++ b/tools/trackeditor/code/scripts/te_setup.mel
@@ -0,0 +1,15 @@
+//Create the TrackEditorNode.
+
+
+global proc te_Create_TrackEditorNode()
+{
+ if ( !(`objExists TrackEditorNode`) )
+ {
+ createNode "transform" -n "TrackEditorNode";
+ createNode "transform" -n "Fences" -p "TrackEditorNode";
+ createNode "transform" -n "Roads" -p "TrackEditorNode";
+ createNode "transform" -n "Intersections" -p "TrackEditorNode";
+ createNode "transform" -n "Treelines" -p "TrackEditorNode";
+ createNode "transform" -n "PedPaths" -p "TrackEditorNode";
+ }
+} \ No newline at end of file
diff --git a/tools/trackeditor/code/scripts/te_treelineContext.mel b/tools/trackeditor/code/scripts/te_treelineContext.mel
new file mode 100644
index 0000000..c8120ab
--- /dev/null
+++ b/tools/trackeditor/code/scripts/te_treelineContext.mel
@@ -0,0 +1,84 @@
+//-----------------------------------------------------------------------------
+// Copyright (C) 2001 Radical Entertainment Ltd. All rights reserved.
+//
+// te_treelineContext.mel
+//
+// Description: Defines all the scripts required by the TreeLineContext tool
+// As a convention all Terrain Editor global procedures
+// and global variables are prefixed with "te_". All commands
+// exposed through TE plugins are prefixed with "TE_".
+//
+// MCB = Menu Call Back
+// BCB = Button Call Back
+//
+// Modification History:
+// + Created -- CBrisebois
+//-----------------------------------------------------------------------------
+
+//This is the global instance of the tree line context tool.
+
+global proc te_MCB_CreateTreeLines()
+{
+ //Start the tree line context...
+ if ( ! `contextInfo -exists TreeLineCtx` )
+ {
+ TreeLineContext TreeLineCtx;
+ }
+
+ setToolTo TreeLineCtx;
+}
+
+global proc te_Delete_TreeLineContext()
+{
+ if ( `contextInfo -exists TreeLineCtx` )
+ {
+ deleteUI -toolContext TreeLineCtx;
+ }
+}
+
+global proc te_MCB_SnapTreelines()
+{
+ TE_SnapSelectedTreelines();
+}
+
+global proc te_MCB_ConvertToGeometry()
+{
+ string $whichCtx = `currentCtx`;
+
+ if ( $whichCtx == "TreeLineCtx" )
+ {
+ ctxAbort;
+ }
+
+ TE_ConvertTreelineToGeometry();
+}
+
+global int $gDeleteTreelines = true;
+
+global proc te_MCB_TreelineOptions()
+{
+ global int $gDeleteTreelines;
+
+ if ( `window -exists TE_TreelineOptions` )
+ {
+ deleteUI -window TE_TreelineOptions;
+ }
+
+ window -rtf true -title "TE Treeline Options" TE_TreelineOptions;
+
+ columnLayout -adjustableColumn true;
+
+ checkBox -label "Delete Treelines" -value $gDeleteTreelines -cc "te_BCB_SetDeleteTreelines(#1)";
+
+ setParent ..;
+
+ showWindow;
+}
+
+global proc te_BCB_SetDeleteTreelines( int $delete )
+{
+ global int $gDeleteTreelines;
+
+ $gDeleteTreelines = $delete;
+ TE_SetDeleteTreeline($delete);
+}