summaryrefslogtreecommitdiffstats
path: root/tools/MayaTools/Maya4.0/scripts/others
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/MayaTools/Maya4.0/scripts/others
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/MayaTools/Maya4.0/scripts/others')
-rw-r--r--tools/MayaTools/Maya4.0/scripts/others/TerrainType.mel426
-rw-r--r--tools/MayaTools/Maya4.0/scripts/others/bobsMenu.mel33
-rw-r--r--tools/MayaTools/Maya4.0/scripts/others/os_cleanup.mel3
-rw-r--r--tools/MayaTools/Maya4.0/scripts/others/os_main.mel228
-rw-r--r--tools/MayaTools/Maya4.0/scripts/others/reBuildLayers.mel111
-rw-r--r--tools/MayaTools/Maya4.0/scripts/others/showAndLight.mel113
-rw-r--r--tools/MayaTools/Maya4.0/scripts/others/swapCamera.mel104
-rw-r--r--tools/MayaTools/Maya4.0/scripts/others/te_BVContext.mel43
-rw-r--r--tools/MayaTools/Maya4.0/scripts/others/te_IntersectionContext.mel212
-rw-r--r--tools/MayaTools/Maya4.0/scripts/others/te_PPContext.mel43
-rw-r--r--tools/MayaTools/Maya4.0/scripts/others/te_cleanup.mel12
-rw-r--r--tools/MayaTools/Maya4.0/scripts/others/te_editorwindow.mel335
-rw-r--r--tools/MayaTools/Maya4.0/scripts/others/te_globals.mel1
-rw-r--r--tools/MayaTools/Maya4.0/scripts/others/te_main.mel195
-rw-r--r--tools/MayaTools/Maya4.0/scripts/others/te_setup.mel15
-rw-r--r--tools/MayaTools/Maya4.0/scripts/others/te_treelineContext.mel84
-rw-r--r--tools/MayaTools/Maya4.0/scripts/others/wb_cleanup.mel11
-rw-r--r--tools/MayaTools/Maya4.0/scripts/others/wb_coinsplines.mel53
-rw-r--r--tools/MayaTools/Maya4.0/scripts/others/wb_locator.mel71
-rw-r--r--tools/MayaTools/Maya4.0/scripts/others/wb_main.mel274
-rw-r--r--tools/MayaTools/Maya4.0/scripts/others/wb_setup.mel6
-rw-r--r--tools/MayaTools/Maya4.0/scripts/others/wb_splines.mel46
22 files changed, 2419 insertions, 0 deletions
diff --git a/tools/MayaTools/Maya4.0/scripts/others/TerrainType.mel b/tools/MayaTools/Maya4.0/scripts/others/TerrainType.mel
new file mode 100644
index 0000000..79026d6
--- /dev/null
+++ b/tools/MayaTools/Maya4.0/scripts/others/TerrainType.mel
@@ -0,0 +1,426 @@
+//===========================================================================
+// Copyright ©2002 Radical Entertainment Ltd. All rights reserved.
+//
+// Component: TerrainType.mel
+//
+// Description: Provides a UI for applying the Pure3D Game Attribute
+// '.TerrainType' to Materials.
+//===========================================================================
+
+//===========================================================================
+// version
+//===========================================================================
+// Description: Returns the current version for this MEL script.
+// Used for version control.
+//===========================================================================
+proc float version()
+{
+ return ( 1.1 );
+}
+
+// ////////////////////////////////////////////////////////////////
+// rootNode
+//
+// Description: Strips the dot-suffix of the specified string.
+// e.g. "object.attribute" is returned as "object"
+
+proc string rootNode( string $object )
+{
+ string $buffer[];
+ tokenize $object "." $buffer;
+ return $buffer[0];
+}
+
+proc string getFacetSG( string $facet )
+// Input (string) - facet component to query (e.g. "pSphere1.f[0]")
+// Result (string) - Shading Group shading facet (e.g. "lambert2SG")
+{
+ string $facetSG = "";
+
+ // Get array of all Shading Groups
+ string $shadingGroups[] = `ls -type shadingEngine`;
+
+ for ( $shadingGroup in $shadingGroups )
+ {
+ // If this facet is a member of the shading set for this
+ // Shading Group, tag this as the facet's shader
+
+ // NOTE: This _fails!_ if the entire object is assigned to the shader,
+ // and no face components are represented in the Shading Group set.
+ if ( `sets -isMember $shadingGroup $facet` )
+ {
+ $facetSG = $shadingGroup;
+ break;
+ }
+ }
+
+ return $facetSG;
+}
+
+// //////////////////////////////////////////////////////////////////////
+// getMaterialFromSG
+//
+// Description: Returns the Material node feeing the '.surfaceShader'
+// attribute of the specified Shading Group node (shadingEngine).
+
+proc string getMaterialFromSG( string $SG )
+{
+ string $material = "";
+
+ if ( "shadingEngine" == `nodeType $SG` && `connectionInfo -id ( $SG + ".surfaceShader" )` )
+ $material = rootNode( `connectionInfo -sfd ( $SG + ".surfaceShader" )` );
+
+ return $material;
+}
+
+// ////////////////////////////////////////////////////////////////////////
+// getSGFromMaterial
+//
+// Description: Returns the Shading Group node being fed by the '.outColor'
+// attribute of the specified Material node
+proc string[] getSGFromMaterial( string $material )
+{
+ string $SG[];
+
+ string $class[] = getClassification( `nodeType $material` );
+
+ if ( "shader/surface" == $class[0] && `connectionInfo -is ( $material + ".outColor" )` )
+ {
+ string $dests[] = `connectionInfo -dfs ( $material + ".outColor" )`;
+ for ( $dest in $dests )
+ {
+ if ( "shadingEngine" == `nodeType $dest` )
+ {
+ $SG[`size $SG`] = rootNode( $dest );
+ }
+ }
+ }
+
+ return $SG;
+}
+
+proc int TerrainTypeEnum()
+{
+ string $enumUI = "TerrainTypeEnumUI";
+ string $interiorUI = "TerrainTypeInteriorUI";
+
+ int $enumType = `optionMenu -q -select $enumUI`;
+ $enumType--; // Convert from 1-based to 0-based
+ $enumType--; // Skip "Undefined"
+
+ int $isInterior = `checkBox -q -value $interiorUI`;
+ if ( $isInterior ) $enumType += 1073741824; // ( 2 ** 30 )
+
+ return $enumType;
+}
+
+proc SetTerrainTypeEnum( int $enumType )
+{
+ int $bIsInterior = false;
+
+ if ( $enumType > 1073741823 )
+ {
+ $enumType -= 1073741824; // ( 2 ** 30 )
+ $bIsInterior = true;
+ }
+
+ $enumType++; // Skip "Undefined"
+ $enumType++; // Convert from 0-based to 1-based
+
+ string $enumUI = "TerrainTypeEnumUI";
+ string $interiorUI = "TerrainTypeInteriorUI";
+
+ optionMenu -e -select $enumType $enumUI;
+ checkBox -e -value $bIsInterior $interiorUI;
+}
+
+proc string[] GetSelectionAsFaces()
+{
+ string $select[] = `ls -sl`;
+
+ $select = `polyListComponentConversion -tf $select`;
+ $select = `filterExpand -sm 34 -ex true $select`;
+
+ return $select;
+}
+
+proc int HasTerrainAttr( string $node, string $TerrainAttr )
+{
+ if ( `attributeQuery -node $node -exists $TerrainAttr` ) return true;
+ return false;
+}
+
+proc AssignTerrainType( string $node, string $TerrainAttr, int $type )
+{
+ if ( HasTerrainAttr( $node, $TerrainAttr ) )
+ {
+ setAttr ( $node + "." + $TerrainAttr ) $type;
+ }
+}
+
+proc int GetTerrainType( string $node, string $TerrainAttr )
+{
+ int $type = 0;
+ if ( HasTerrainAttr( $node, $TerrainAttr ) )
+ {
+ $type = `getAttr ( $node + "." + $TerrainAttr )`;
+ }
+ return $type;
+}
+
+proc int AddTerrainTypeAttr( string $node, string $TerrainAttr )
+{
+ // Does the .TerrainType attr exist?
+ if ( `attributeQuery -node $node -exists $TerrainAttr` )
+ {
+ return false;
+ }
+
+ // Add the P3DGameAttr
+ if ( !`attributeQuery -node $node -exists "P3D_GameAttr"` )
+ {
+ addAttr -ln P3D_GameAttr -dt "string" -hidden true $node;
+ }
+
+ // Add the TerrainAttr to the P3DGameAttr
+ string $gameAttr = `getAttr ( $node + ".P3D_GameAttr" )`;
+ if ( $gameAttr != "" )
+ {
+ $gameAttr += "~";
+ }
+ $gameAttr = $gameAttr + $TerrainAttr;
+ setAttr -type "string" ( $node + ".P3D_GameAttr" ) $gameAttr;
+
+ // Add the .TerrainType attribute
+ addAttr -ln $TerrainAttr -at "long" -hidden true $node;
+
+ return true;
+}
+
+global proc TerrainType_Apply( string $TerrainAttr )
+{
+ int $type = TerrainTypeEnum();
+ if ( $type < 0 ) return; // Don't bother with "Undefined"
+
+ string $materials[] = `ls -sl -materials`;
+
+ for ( $m in $materials )
+ {
+ if ( ( $m == "lambert1" ) || ( $m == "particleCloud1" ) ) continue;
+
+ AddTerrainTypeAttr( $m, $TerrainAttr );
+
+ AssignTerrainType( $m, $TerrainAttr, $type );
+ }
+}
+
+global proc TerrainType_ApplyIndirect( string $TerrainAttr )
+{
+ int $type = TerrainTypeEnum();
+ if ( $type < 0 ) return; // Don't bother with "Undefined"
+
+ string $select[] = GetSelectionAsFaces();
+
+ for ( $f in $select )
+ {
+ string $sg = getFacetSG( $f );
+
+ if ( ( $sg == "" ) || ( $sg == "initialShadingGroup" ) ) continue;
+
+ string $mat = getMaterialFromSG( $sg );
+
+ if ( $mat != "" )
+ {
+ AddTerrainTypeAttr( $mat, $TerrainAttr );
+
+ AssignTerrainType( $mat, $TerrainAttr, $type );
+ }
+ }
+}
+
+global proc TerrainType_Select( string $TerrainAttr )
+{
+ int $enumType = TerrainTypeEnum();
+
+ string $matches[];
+
+ string $materials[] = `ls -materials`;
+
+ for ( $m in $materials )
+ {
+ if ( ( $m == "lambert1" ) || ( $m == "particleCloud1" ) ) continue;
+
+ if (
+ ( HasTerrainAttr( $m, $TerrainAttr ) && GetTerrainType( $m, $TerrainAttr ) == $enumType ) ||
+ ( $enumType < 0 ) && ( !HasTerrainAttr( $m, $TerrainAttr ) )
+ )
+ {
+ $matches[`size $matches`] = $m;
+ }
+ }
+
+ select $matches;
+
+}
+
+global proc TerrainType_SelectIndirect( string $TerrainAttr )
+{
+ int $enumType = TerrainTypeEnum();
+
+ string $matches[];
+
+ string $materials[] = `ls -materials`;
+
+ for ( $m in $materials )
+ {
+ if (
+ ( HasTerrainAttr( $m, $TerrainAttr ) && GetTerrainType( $m, $TerrainAttr ) == $enumType ) ||
+ ( $enumType < 0 ) && ( !HasTerrainAttr( $m, $TerrainAttr ) )
+ )
+ {
+ string $sg[] = getSGFromMaterial( $m );
+ for ( $s in $sg )
+ {
+ $matches[`size $matches`] = $s;
+ }
+ }
+
+ }
+
+ // Don't alter user selection if nothing found.
+ if ( `size $matches` > 0 )
+ {
+ select $matches;
+ }
+}
+
+global proc TerrainType_SelectionCallback( string $TerrainAttr )
+{
+ string $materials[] = `ls -sl -materials`;
+ if ( `size $materials` > 0 )
+ {
+ if ( HasTerrainAttr( $materials[0], $TerrainAttr ) )
+ {
+ int $type = `getAttr ( $materials[0] + "." + $TerrainAttr )`;
+ SetTerrainTypeEnum( $type );
+ }
+ else
+ {
+ SetTerrainTypeEnum( -1 );
+ }
+
+ TerrainType_EnumCallback(); // update the optionMenu
+ }
+}
+
+global proc TerrainType_EnumCallback()
+{
+ string $enumUI = "TerrainTypeEnumUI";
+ string $applyMaterialUI = "TerrainTypeApplyMaterialUI";
+ string $applyObjectUI = "TerrainTypeApplyObjectUI";
+
+ int $enable = `optionMenu -q -select $enumUI` > 1;
+ button -e -enable $enable $applyMaterialUI;
+ button -e -enable $enable $applyObjectUI;
+}
+
+global proc TerrainType()
+{
+ string $TerrainAttr = "TerrainType";
+
+ string $windowUI = "TerrainTypeUI";
+
+ string $enumUI = "TerrainTypeEnumUI";
+ string $interiorUI = "TerrainTypeInteriorUI";
+ string $applyMaterialUI = "TerrainTypeApplyMaterialUI";
+ string $applyObjectUI = "TerrainTypeApplyObjectUI";
+
+ string $enumArray[] =
+ {
+ "* Undefined *",
+ "Road",
+ "Grass",
+ "Sand",
+ "Gravel",
+ "Water",
+ "Wood",
+ "Metal",
+ "Dirt"
+ };
+
+ if ( `window -exists $windowUI` )
+ deleteUI -window $windowUI;
+
+ window -title ( "Terrain Type v" + version() ) $windowUI;
+
+ columnLayout -adj true;
+
+ frameLayout -label "Surface";
+ columnLayout -adj true;
+ optionMenu $enumUI;
+ for ( $e = 0; $e < `size $enumArray`; $e++ )
+ {
+ menuItem -label $enumArray[$e];
+ }
+ checkBox -label "Interior" -align "left" $interiorUI;
+ setParent ..;
+ setParent ..;
+
+ frameLayout -label "Materials";
+ columnLayout -adj true;
+
+ button
+ -label "Apply To Materials"
+ -c ( "TerrainType_Apply \"" + $TerrainAttr + "\"" )
+ -ann "Applies the displayed Terrain Type to all selected Materials."
+ $applyMaterialUI;
+ button
+ -label "Select Assigned Materials"
+ -c ( "TerrainType_Select \"" + $TerrainAttr + "\"" )
+ -ann "Selects all Materials assigned to the displayed Terrain Type.";
+
+
+ setParent ..;
+
+ setParent ..;
+
+
+ frameLayout -label "Objects";
+ columnLayout -adj true;
+
+ button
+ -label "Apply To Objects"
+ -c ( "TerrainType_ApplyIndirect \"" + $TerrainAttr + "\"" )
+ -ann "Applies the displayed Terrain Type to all Materials assigned to the selected objects."
+ $applyObjectUI;
+ button
+ -label "Select Assigned Objects"
+ -c ( "TerrainType_SelectIndirect \"" + $TerrainAttr + "\"" )
+ -ann "Selects all objects assigned to Materials bearing the displayed Terrain Type.";
+ setParent ..;
+
+ setParent ..;
+
+ setParent ..;
+
+ // Option Menu should respond to user selection, to reflect current type
+ // of selected material
+ scriptJob -parent $enumUI -event "SelectionChanged" ( "TerrainType_SelectionCallback \"" + $TerrainAttr + "\"" );
+
+ optionMenu -e
+ -cc TerrainType_EnumCallback
+ -select 2
+ $enumUI;
+
+ checkBox -e
+ -value off
+ $interiorUI;
+
+ TerrainType_SelectionCallback $TerrainAttr;
+
+ showWindow $windowUI;
+}
+
+/*
+source TerrainType; TerrainType;
+*/
diff --git a/tools/MayaTools/Maya4.0/scripts/others/bobsMenu.mel b/tools/MayaTools/Maya4.0/scripts/others/bobsMenu.mel
new file mode 100644
index 0000000..b8c5b4a
--- /dev/null
+++ b/tools/MayaTools/Maya4.0/scripts/others/bobsMenu.mel
@@ -0,0 +1,33 @@
+global proc bobsMenu(){
+
+ global string $gMainWindow;
+
+ setParent $gMainWindow;
+
+ menu -l "Bobs Menu"
+ -p MayaWindow
+ -to 1
+ -aob true
+ -fi "bob_Mr_T.bmp"
+ bobsMenu;
+
+ menuItem -l "Refresh Layers"
+ -ann ("")
+ -echoCommand true
+ -c "reBuildLayers"
+ reBuildLayers;
+
+ menuItem -divider true;
+
+ menuItem -l "Persp To Ortho"
+ -ann ("")
+ -echoCommand true
+ -c "swapCamera 0"
+ swapCamera;
+
+ menuItem -l "Back To Persp"
+ -ann ("")
+ -echoCommand true
+ -c "swapCamera 1"
+ swapCamera2;
+}; \ No newline at end of file
diff --git a/tools/MayaTools/Maya4.0/scripts/others/os_cleanup.mel b/tools/MayaTools/Maya4.0/scripts/others/os_cleanup.mel
new file mode 100644
index 0000000..020de04
--- /dev/null
+++ b/tools/MayaTools/Maya4.0/scripts/others/os_cleanup.mel
@@ -0,0 +1,3 @@
+
+
+os_RemoveUI(); \ No newline at end of file
diff --git a/tools/MayaTools/Maya4.0/scripts/others/os_main.mel b/tools/MayaTools/Maya4.0/scripts/others/os_main.mel
new file mode 100644
index 0000000..7a8c567
--- /dev/null
+++ b/tools/MayaTools/Maya4.0/scripts/others/os_main.mel
@@ -0,0 +1,228 @@
+//-----------------------------------------------------------------------------
+// Copyright (C) 2001 Radical Entertainment Ltd. All rights reserved.
+//
+// TE_main.mel
+//
+// Description: Installs the Object Snapper (OS) interface.
+// As a convention all Object Snapper global procedures
+// and global variables are prefixed with "os_". All commands
+// exposed through OS plugins are prefixed with "OS_".
+//
+// MCB = Menu Call Back
+// BCB = Button Call Back
+//
+// Modification History:
+// + Created March 18 2002 -- Cary Brisebois
+//-----------------------------------------------------------------------------
+
+
+global float $gOS_Offset = 0.10;
+
+
+//-----------------------------------------------------------------------------
+// o s _ b r e a k p o i n t
+//
+// Synopsis:
+//
+// Parameters: NONE
+//
+// Returns: NOTHING
+//
+// Constraints: NONE
+//
+//-----------------------------------------------------------------------------
+global proc os_breakpoint( string $tag )
+{
+ confirmDialog -m ( "BreakPoint: " + $tag );
+}
+
+//-----------------------------------------------------------------------------
+// o s _ M C B _ A b o u t
+//
+// Synopsis: Display an About Object Snapper window.
+//
+// Parameters: NONE
+//
+// Returns: NOTHING
+//
+// Constraints: NONE
+//
+//-----------------------------------------------------------------------------
+global proc os_MCB_About()
+{
+ string $pluginVersion = "1.0";
+
+ string $message = ( "\nSimpsons Road Rage Object Snapper.\n\n" +
+ "Release " + $pluginVersion + "\n" +
+ "(c) 2001, Radical Entertainment, Ltd.\n\n" );
+
+
+ confirmDialog -title "About Object Snapper"
+ -message $message
+ -button "OK"
+ -defaultButton "OK";
+}
+
+//-----------------------------------------------------------------------------
+// o s _ d o M a i n M e n u I t e m s
+//
+// Synopsis: Creates the OS menu on the menu handle passed in.
+//
+// Parameters: NONE
+//
+// Returns: NOTHING
+//
+// Constraints: NONE
+//
+//-----------------------------------------------------------------------------
+global proc os_doMainMenuItems( string $menu )
+{
+ menu -edit -tearOff true -allowOptionBoxes true $menu;
+
+ menuItem -label "Snap Single Selected" -command ( "os_MCB_SnapSingleSelected()" );
+
+ menuItem -divider true;
+
+ menuItem -label "Snap All Selected" -command ( "os_MCB_SnapSelected()" );
+
+ menuItem -divider true;
+
+ menuItem -label "Snap Tree Line" -command ( "os_MCB_SnapTreeLine()" );
+
+ menuItem -divider true;
+
+ menuItem -label "About" -command "os_MCB_About()";
+
+ menuItem -optionBox true -command "os_MCB_OSOptions()";
+
+ setParent -m ..;
+}
+
+//-----------------------------------------------------------------------------
+// o s _ I n s t a l l U I
+//
+// Synopsis:
+//
+// Parameters: NONE
+//
+// Returns: NOTHING
+//
+// Constraints: NONE
+//
+//-----------------------------------------------------------------------------
+global proc os_InstallUI()
+{
+
+ global string $gMainWindow;
+
+ //
+ // Install OS menu as a root menu.
+ //
+ if ( `menu -exists os_MainMenu` ) deleteUI os_MainMenu;
+ menu -label "Object Snapper" -allowOptionBoxes true -parent $gMainWindow os_MainMenu;
+
+ os_doMainMenuItems "os_MainMenu";
+}
+
+//==============================================================================
+// global proc os_RemoveUI
+//==============================================================================
+// Description: Comment
+//
+// Parameters: ()
+//
+// Return: global
+//
+//==============================================================================
+global proc os_RemoveUI()
+{
+ if ( `menu -exists os_MainMenu` ) deleteUI os_MainMenu;
+ if ( `window -exists os_OptionWindow` ) deleteUI os_OptionWindow;
+}
+
+//==============================================================================
+// global proc os_MCB_SnapSelected
+//==============================================================================
+// Description: Comment
+//
+// Parameters: ()
+//
+// Return: global
+//
+//==============================================================================
+global proc os_MCB_SnapSelected()
+{
+ global float $gOS_Offset;
+
+ OS_SnapSelected( $gOS_Offset, 0 );
+}
+
+
+//==============================================================================
+// global proc os_MCB_SnapSingleSelected
+//==============================================================================
+// Description: Comment
+//
+// Parameters: ()
+//
+// Return: global
+//
+//==============================================================================
+global proc os_MCB_SnapSingleSelected()
+{
+ global float $gOS_Offset;
+
+ OS_SnapSelected( $gOS_Offset, 1 );
+}
+
+//=============================================================================
+// global proc os_MCB_SnapTreeLine
+//=============================================================================
+// Description: Comment
+//
+// Parameters: ()
+//
+// Return: global
+//
+//=============================================================================
+global proc os_MCB_SnapTreeLine()
+{
+ global float $gOS_Offset;
+
+ OS_SnapSelected( $gOS_Offset, 2 );
+}
+
+//==============================================================================
+// global proc os_MCB_OSOptions
+//==============================================================================
+// Description: Comment
+//
+// Parameters: ()
+//
+// Return: global
+//
+//==============================================================================
+global proc os_MCB_OSOptions()
+{
+ global float $gOS_Offset;
+
+ if ( `window -exists os_OptionWindow` ) deleteUI os_OptionWindow;
+
+ window -title "Object Snapper Options" os_OptionWindow;
+
+ columnLayout;
+
+ rowLayout -nc 2;
+
+ text -label "Offset (M):";
+
+ floatField -min -10.0 -max 10.0 -value $gOS_Offset -cc ("$gOS_Offset = #1");
+
+ setParent ..;
+
+ setParent ..;
+
+ showWindow;
+}
+
+evalDeferred "os_InstallUI"; \ No newline at end of file
diff --git a/tools/MayaTools/Maya4.0/scripts/others/reBuildLayers.mel b/tools/MayaTools/Maya4.0/scripts/others/reBuildLayers.mel
new file mode 100644
index 0000000..1d126be
--- /dev/null
+++ b/tools/MayaTools/Maya4.0/scripts/others/reBuildLayers.mel
@@ -0,0 +1,111 @@
+global proc reBuildLayers()
+{
+//Delete the first 40 layers
+
+$DeleteLayer_Index = 1;
+$DeleteLayer_NumTimes = 40;
+while ($DeleteLayer_Index++ < $DeleteLayer_NumTimes)
+{
+layerEditorLayerButtonSelect 1 "";
+layerEditorDeleteLayer "";
+};
+
+//list all top groups
+
+SelectAllCameras;
+$cameras = `ls -sl`;
+
+SelectAllLights;
+$lights = `ls -sl`;
+
+string $misc[];
+if (`objExists "p3dExporterOptions*"`)
+{
+select "p3dExporterOptions*";
+$misc = `ls -sl`;
+};
+
+select -ado;
+select -d $cameras $misc $lights;
+$TopGroups = `ls -sl`;
+string $TopGroup;
+
+//create a layer for each top groups
+
+for ($TopGroup in $TopGroups)
+{
+ select -r $TopGroup;
+ createDisplayLayer -name ("TG_" + $TopGroup);
+};
+
+SelectAllJoints;
+createDisplayLayer -name "All_BVs";
+
+if (`objExists "*L01only*"`)
+{
+select -r "*L01only*";
+createDisplayLayer -name "KG_L01only";
+};
+
+if (`objExists "*L02only*"`)
+{
+select -r "*L02only*";
+createDisplayLayer -name "KG_L02only";
+};
+
+if (`objExists "*L03only*"`)
+{
+select -r "*L03only*";
+createDisplayLayer -name "KG_L03only";
+};
+
+if (`objExists "*L04only*"`)
+{
+select -r "*L04only*";
+createDisplayLayer -name "KG_L04only";
+};
+
+if (`objExists "*L05only*"`)
+{
+select -r "*L05only*";
+createDisplayLayer -name "KG_L05only";
+};
+
+if (`objExists "*L06only*"`)
+{
+select -r "*L06only*";
+createDisplayLayer -name "KG_L06only";
+};
+
+if (`objExists "*L07only*"`)
+{
+select -r "*L07only*";
+createDisplayLayer -name "KG_L07only";
+};
+
+
+//change color of specific layers
+
+if (`objExists "TG_*gens*.color"`)
+ setAttr "TG_*gens*.color" 29;
+
+if (`objExists "TG_*landmarks*.color"`)
+ setAttr "TG_*landmarks*.color" 30;
+
+if (`objExists "TG_*dynamics*.color"`)
+ setAttr "TG_*dynamics*.color" 22;
+
+if (`objExists "TG_*track*.color"`)
+ setAttr "TG_*track*.color" 28;
+
+if (`objExists "All_BVs"`)
+ setAttr "All_BVs.color" 6;
+
+if (`objExists "TG_*work*.color"`)
+{
+ setAttr "TG_*work*.color" 13;
+ setAttr "TG_*work*.visibility" 0;
+};
+};
+
+
diff --git a/tools/MayaTools/Maya4.0/scripts/others/showAndLight.mel b/tools/MayaTools/Maya4.0/scripts/others/showAndLight.mel
new file mode 100644
index 0000000..973c0d4
--- /dev/null
+++ b/tools/MayaTools/Maya4.0/scripts/others/showAndLight.mel
@@ -0,0 +1,113 @@
+global proc swapGeo (string $showGeo , string $hideGeo1, string $hideGeo2)
+{
+select -r ("*" + $showGeo + "only*");
+ //select -r ("*" + 02 + "only*");//
+select -hi;
+ShowSelectedObjects;
+select -r ("*" + $hideGeo1 + "only*");
+ //select -r ("*" + 05 + "only*");//
+select -add ("*" + $hideGeo2 + "only*");
+ //select -add ("*" + 05 + "only*");//
+select -hi;
+HideSelectedObjects;
+select -cl;
+};
+
+proc ShowBVShapes ()
+{
+select -r "P3D_BVol*Shape*" ;
+$select = `ls -sl`;
+string $sel;
+for ($sel in $select)
+ setAttr ($sel + ".visibility") 1;
+};
+
+
+
+//=============================================//
+global proc selectDrawableOnly ()
+{
+ $shapeSel = `ls -sl -s -v`;
+ select $shapeSel;
+}
+global proc hideDontlight ()
+{
+if ( `objExists "*dontlight*"` )
+{
+ select -r "*dontlight*";
+ select -hi;
+ HideSelectedObjects;
+}
+else
+ { warning("there are no objects that you don't want to light?"); };
+};
+
+global proc showDontlight ()
+{
+if ( `objExists "*dontlight*"` )
+{
+ select -r "*dontlight*";
+ select -hi;
+ ShowSelectedObjects;
+}
+else
+ { warning("there are no objects that you don't want to light?"); };
+};
+
+
+global proc selectVisGeo ()
+
+{
+if ( `objExists "*landmarks*"` )
+{
+ select -add -vis "*landmarks*";
+}
+else
+{
+warning("there are no landmarks in your scene?");
+};
+select -add -vis "*gens*";
+select -add -vis "*track*";
+select -add -vis "*dynamics*";
+select -hi;
+}
+;
+
+
+
+
+//=============================================//
+
+
+
+
+global proc bobPrelight ()
+{
+toggleMaterialMapping(0);polyGeoSampler -cs -ul -sf 1 -su -colorBlend "overwrite" -alphaBlend "overwrite"; toggleMaterialMapping(1);
+}
+;
+
+
+
+
+//=============================================//
+
+
+
+
+global proc showAndLight (string $wang, string $chung, string $fung)
+{
+swapGeo $wang $chung $fung;
+hideDontlight;
+selectVisGeo;
+selectDrawableOnly;
+bobPrelight;
+showDontlight;
+swapGeo $wang $chung $fung;
+ShowBVShapes;
+};
+//showAndLight 06 03 03;//
+//showAndLight 03 06 06;//
+
+
+
diff --git a/tools/MayaTools/Maya4.0/scripts/others/swapCamera.mel b/tools/MayaTools/Maya4.0/scripts/others/swapCamera.mel
new file mode 100644
index 0000000..5e1a9a3
--- /dev/null
+++ b/tools/MayaTools/Maya4.0/scripts/others/swapCamera.mel
@@ -0,0 +1,104 @@
+proc swapCamDefaults (){
+global string $camera[];
+global float $camRotY;
+global float $camRotX;
+global float $camRotZ;
+global float $camTranY;
+global float $camTranX;
+global float $camTranZ;
+$camera[0]= "persp";
+float $camRotY =0;
+float $camRotX =0;
+float $camRotZ =0;
+float $camTranY =0;
+float $camTranX =0;
+float $camTranZ =0;
+};
+
+global proc perspToOrtho(){
+global string $camera[];
+global float $camRotY;
+global float $camRotX;
+global float $camRotZ;
+global float $camTranY;
+global float $camTranX;
+global float $camTranZ;
+
+$temp = `ls -sl`;
+{ string $camera = `modelPanel -q -camera modelPanel4`; eval select `getCameraNode view $camera` `getCameraNode up $camera` $camera; };
+$camera = `ls -sl`;
+$camRotY = `getAttr ($camera[0] + ".rotateY")`;
+$camRotX = `getAttr ($camera[0] + ".rotateX")`;
+$camRotZ = `getAttr ($camera[0] + ".rotateZ")`;
+$camTranY = `getAttr ($camera[0] + ".translateY")`;
+$camTranX = `getAttr ($camera[0] + ".translateX")`;
+$camTranZ = `getAttr ($camera[0] + ".translateZ")`;
+int $camRotY1;
+int $camRotX1;
+int $camRotZ1;
+if ($camRotY <= 0)
+ $camRotY1 = (($camRotY-45) % 360.0) / 90;
+else
+ $camRotY1 = (($camRotY+45) % 360.0) / 90;
+$camRotY90 = $camRotY1 * 90;
+
+if ($camRotX <= 0)
+ $camRotX1= (($camRotX-45) % 360.0) / 90;
+else
+ $camRotX1= (($camRotX+45) % 360.0) / 90;
+$camRotX90 = $camRotX1 * 90;
+if ($camRotZ <= 0)
+ $camRotZ1= (($camRotZ-45) % 360.0) / 90;
+else
+ $camRotZ1= (($camRotZ+45) % 360.0) / 90;
+$camRotZ90 = $camRotZ1 * 90;
+
+//$camRotZ90 = (floor ((($camRotZ+45) % 360.0)/90))*90;//
+//makes ortho//
+setAttr ($camera[0] + ".rotateY") $camRotY90;
+setAttr ($camera[0] + ".rotateX") $camRotX90;
+setAttr ($camera[0] + ".rotateZ") $camRotZ90;
+setAttr ($camera[0] + ".orthographic") 1;
+select $temp;
+fitPanel -selected;
+print "camera square";
+};
+
+
+//orthoToPersp $camera[0] $camRotY $camRotX $camRotZ $camTranY $camTranX $camTranZ
+global proc orthoToPersp()
+{
+global string $camera[];
+global float $camRotY;
+global float $camRotX;
+global float $camRotZ;
+global float $camTranY;
+global float $camTranX;
+global float $camTranZ;
+setAttr ($camera[0] + ".rotateY") $camRotY;
+setAttr ($camera[0] + ".rotateX") $camRotX;
+setAttr ($camera[0] + ".rotateZ") $camRotZ;
+setAttr ($camera[0] + ".translateY") $camTranY;
+setAttr ($camera[0] + ".translateX") $camTranX;
+setAttr ($camera[0] + ".translateZ") $camTranZ;
+setAttr ($camera[0] + ".orthographic") 0;
+};
+
+global proc swapCamera(int $sway){
+global string $camera[];
+global float $camRotY;
+global float $camRotX;
+global float $camRotZ;
+global float $camTranY;
+global float $camTranX;
+global float $camTranZ;
+switch ($sway){
+
+case 0:
+ perspToOrtho;
+ break;
+case 1:
+ orthoToPersp;
+ break;
+};
+}; \ No newline at end of file
diff --git a/tools/MayaTools/Maya4.0/scripts/others/te_BVContext.mel b/tools/MayaTools/Maya4.0/scripts/others/te_BVContext.mel
new file mode 100644
index 0000000..e835468
--- /dev/null
+++ b/tools/MayaTools/Maya4.0/scripts/others/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/MayaTools/Maya4.0/scripts/others/te_IntersectionContext.mel b/tools/MayaTools/Maya4.0/scripts/others/te_IntersectionContext.mel
new file mode 100644
index 0000000..54561ff
--- /dev/null
+++ b/tools/MayaTools/Maya4.0/scripts/others/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/MayaTools/Maya4.0/scripts/others/te_PPContext.mel b/tools/MayaTools/Maya4.0/scripts/others/te_PPContext.mel
new file mode 100644
index 0000000..a8cc63f
--- /dev/null
+++ b/tools/MayaTools/Maya4.0/scripts/others/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/MayaTools/Maya4.0/scripts/others/te_cleanup.mel b/tools/MayaTools/Maya4.0/scripts/others/te_cleanup.mel
new file mode 100644
index 0000000..21f39d3
--- /dev/null
+++ b/tools/MayaTools/Maya4.0/scripts/others/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/MayaTools/Maya4.0/scripts/others/te_editorwindow.mel b/tools/MayaTools/Maya4.0/scripts/others/te_editorwindow.mel
new file mode 100644
index 0000000..1504a52
--- /dev/null
+++ b/tools/MayaTools/Maya4.0/scripts/others/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/MayaTools/Maya4.0/scripts/others/te_globals.mel b/tools/MayaTools/Maya4.0/scripts/others/te_globals.mel
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/tools/MayaTools/Maya4.0/scripts/others/te_globals.mel
@@ -0,0 +1 @@
+
diff --git a/tools/MayaTools/Maya4.0/scripts/others/te_main.mel b/tools/MayaTools/Maya4.0/scripts/others/te_main.mel
new file mode 100644
index 0000000..6a97582
--- /dev/null
+++ b/tools/MayaTools/Maya4.0/scripts/others/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/MayaTools/Maya4.0/scripts/others/te_setup.mel b/tools/MayaTools/Maya4.0/scripts/others/te_setup.mel
new file mode 100644
index 0000000..d5ca442
--- /dev/null
+++ b/tools/MayaTools/Maya4.0/scripts/others/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/MayaTools/Maya4.0/scripts/others/te_treelineContext.mel b/tools/MayaTools/Maya4.0/scripts/others/te_treelineContext.mel
new file mode 100644
index 0000000..c8120ab
--- /dev/null
+++ b/tools/MayaTools/Maya4.0/scripts/others/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);
+}
diff --git a/tools/MayaTools/Maya4.0/scripts/others/wb_cleanup.mel b/tools/MayaTools/Maya4.0/scripts/others/wb_cleanup.mel
new file mode 100644
index 0000000..1b2f42c
--- /dev/null
+++ b/tools/MayaTools/Maya4.0/scripts/others/wb_cleanup.mel
@@ -0,0 +1,11 @@
+
+if ( `menu -exists wb_MainMenu` )
+{
+ deleteUI wb_MainMenu;
+ deleteShelfTab ("WorldBuilder");
+
+ wb_SplinesCleanup();
+ wb_CoinSplinesCleanup();
+
+ flushUndo;
+}
diff --git a/tools/MayaTools/Maya4.0/scripts/others/wb_coinsplines.mel b/tools/MayaTools/Maya4.0/scripts/others/wb_coinsplines.mel
new file mode 100644
index 0000000..750eb3e
--- /dev/null
+++ b/tools/MayaTools/Maya4.0/scripts/others/wb_coinsplines.mel
@@ -0,0 +1,53 @@
+global int $gCoinSplineCompleteCB = -1;
+
+global proc wb_MCB_CreateCoinPath()
+{
+ global int $gCoinSplineCompleteCB;
+
+ if ( !`contextInfo -exists CoinSplineCtx` )
+ {
+ curveCVCtx -degree 3 -me true -un true CoinSplineCtx;
+ print "create\n";
+ }
+ else
+ {
+ string $currentCtx = `currentCtx`;
+
+ if ( $currentCtx == "CoinSplineCtx" )
+ {
+ print "complete\n";
+ ctxCompletion;
+
+ wb_CB_CoinSplineComplete();
+ }
+ }
+
+ print "select\n";
+ setToolTo CoinSplineCtx;
+
+ $gCoinSplineCompleteCB = `scriptJob -ro 1 -p "WorldBuilder" -e "ToolChanged" wb_CB_CoinSplineComplete`;
+}
+
+global proc wb_CB_CoinSplineComplete()
+{
+ print "complete callback\n";
+ WB_CoinSplineComplete();
+}
+
+global proc wb_CoinSplinesCleanup()
+{
+ print "clean\n";
+ global int $gCoinSplineCompleteCB;
+
+ if ( $gCoinSplineCompleteCB != -1 )
+ {
+ scriptJob -k $gCoinSplineCompleteCB;
+ print "kill job\n";
+ }
+
+ if ( `contextInfo -exists CoinSplineCtx` )
+ {
+ print "delete ui\n";
+ deleteUI -tc CoinSplineCtx;
+ }
+}
diff --git a/tools/MayaTools/Maya4.0/scripts/others/wb_locator.mel b/tools/MayaTools/Maya4.0/scripts/others/wb_locator.mel
new file mode 100644
index 0000000..0b46abb
--- /dev/null
+++ b/tools/MayaTools/Maya4.0/scripts/others/wb_locator.mel
@@ -0,0 +1,71 @@
+global float $gWB_Offset = 0;
+
+global proc wb_BCB_CreateLocator( string $type )
+{
+ //Start the Locator context...
+ if ( ! `contextInfo -exists LocatorCtx` )
+ {
+ LocatorContext LocatorCtx;
+ }
+
+ WB_SetLocatorType($type);
+
+ setToolTo LocatorCtx;
+}
+
+global proc wb_MCB_SnapLocatorOptions()
+{
+ global float $gWB_Offset;
+
+ if ( `window -exists wb_OptionWindow` ) deleteUI wb_OptionWindow;
+
+ window -title "Snap Locator Options" wb_OptionWindow;
+
+ columnLayout;
+
+ rowLayout -nc 2;
+
+ text -label "Offset (M):";
+
+ floatField -min -10.0 -max 10.0 -value $gWB_Offset -cc ("$gWB_Offset = #1");
+
+ setParent ..;
+
+ button -label "snap locator" -command "WB_SnapLocator( $gWB_Offset )";
+
+ setParent ..;
+
+ showWindow;
+}
+
+global proc wb_BCB_AttachTriggers( string $name, int $isVisibler )
+{
+ global int $gIsItVisibler;
+
+ $gIsItVisibler = $isVisibler;
+
+ //Start the Trigger context...
+ if ( ! `contextInfo -exists TriggerCtx` )
+ {
+ TriggerContext TriggerCtx;
+ }
+
+ select $name;
+
+ WB_SelectObject( $name );
+
+ setToolTo TriggerCtx;
+}
+
+global proc wb_LocatorCleanup()
+{
+ if ( `contextInfo -exists LocatorCtx` )
+ {
+ deleteUI -tc LocatorCtx;
+ }
+
+ if ( `contextInfo -exists TriggerCtx` )
+ {
+ deleteUI -tc TriggerCtx;
+ }
+} \ No newline at end of file
diff --git a/tools/MayaTools/Maya4.0/scripts/others/wb_main.mel b/tools/MayaTools/Maya4.0/scripts/others/wb_main.mel
new file mode 100644
index 0000000..8106946
--- /dev/null
+++ b/tools/MayaTools/Maya4.0/scripts/others/wb_main.mel
@@ -0,0 +1,274 @@
+//-----------------------------------------------------------------------------
+// Copyright (C) 2001 Radical Entertainment Ltd. All rights reserved.
+//
+// WB_main.mel
+//
+// Description: Installs the World Builder (WB) interface.
+// As a convention all World Builder global procedures
+// and global variables are prefixed with "wb_". All commands
+// exposed through WB plugins are prefixed with "WB_".
+//
+// MCB = Menu Call Back
+// BCB = Button Call Back
+//
+// Modification History:
+// + Created Apr 11, 2001 -- bkusy
+// + Stolen & Adapted -- CBrisebois
+//-----------------------------------------------------------------------------
+
+//-----------------------------------------------------------------------------
+// w b _ b r e a k p o i n t
+//
+// Synopsis:
+//
+// Parameters: NONE
+//
+// Returns: NOTHING
+//
+// Constraints: NONE
+//
+//-----------------------------------------------------------------------------
+global proc wb_breakpoint( string $tag )
+{
+ confirmDialog -m ( "BreakPoint: " + $tag );
+}
+
+//-----------------------------------------------------------------------------
+// w b _ M C B _ A b o u t
+//
+// Synopsis: Display an About World Builder window.
+//
+// Parameters: NONE
+//
+// Returns: NOTHING
+//
+// Constraints: NONE
+//
+//-----------------------------------------------------------------------------
+global proc wb_MCB_About()
+{
+ string $pluginVersion = "2.0";
+
+ string $message = ( "\nSimpsons Road Rage World Builder.\n\n" +
+ "Release " + $pluginVersion + "\n" +
+ "(c) 2001, Radical Entertainment, Ltd.\n\n" );
+
+
+ confirmDialog -title "About World Builder"
+ -message $message
+ -button "OK"
+ -defaultButton "OK";
+}
+
+//-----------------------------------------------------------------------------
+// w b _ d o M a i n M e n u I w b m s
+//
+// Synopsis: Creates the WB menu on the menu handle passed in.
+//
+// Parameters: NONE
+//
+// Returns: NOTHING
+//
+// Constraints: NONE
+//
+//-----------------------------------------------------------------------------
+global proc wb_doMainMenuItems( string $menu )
+{
+ global string $gMainWindow;
+ global float $gWB_Offset;
+
+ menu -edit -tearOff true -allowOptionBoxes true $menu;
+
+ menuItem -label "Display Levels" -sm true;
+
+ menuItem -label "Event Locators" -checkBox true -command "WB_ChangeDisplay(0, #1)";
+
+ menuItem -label "Script Locators" -checkBox true -command "WB_ChangeDisplay(1, #1)";
+
+ menuItem -label "Generic Locators" -checkBox true -command "WB_ChangeDisplay(2, #1)";
+
+ menuItem -label "Car Start Locators" -checkBox true -command "WB_ChangeDisplay(3, #1)";
+
+ menuItem -label "Dynamic Zone Locators" -checkBox true -command "WB_ChangeDisplay(4, #1)";
+
+ menuItem -label "Occlusion Locators" -checkBox true -command "WB_ChangeDisplay(5, #1)";
+
+ menuItem -label "Interior Entrance Locators" -checkBox true -command "WB_ChangeDisplay(7, #1)";
+
+ menuItem -label "Directional Locators" -checkBox true -command "WB_ChangeDisplay(8, #1)";
+
+ menuItem -label "Action Locators" -checkBox true -command "WB_ChangeDisplay(9, #1)";
+
+ menuItem -label "FOV" -checkBox true -command "WB_ChangeDisplay(10, #1)";
+
+ menuItem -label "Breakable Camera" -checkBox true -command "WB_ChangeDisplay(11, #1)";
+
+ menuItem -label "Static Camera" -checkBox true -command "WB_ChangeDisplay(12, #1)";
+
+ menuItem -label "Ped Group" -checkBox true -command "WB_ChangeDisplay(13, #1)";
+
+ menuItem -divider true;
+
+ menuItem -label "Trigger Volumes" -checkBox true -command "WB_ChangeDisplay(20, #1)";
+
+ setParent -menu ..;
+
+ menuItem -divider true;
+
+ menuItem -label "Create Camera Path" -command "wb_MCB_CreateCameraPath()";
+
+ menuItem -label "Create Coin Path" -command "wb_MCB_CreateCoinPath()";
+
+ menuItem -divider true;
+
+ menuItem -label "Set Prefix" -command "WB_SetPrefix()";
+
+ menuItem -divider true;
+
+ menuItem -label "Snap Locator" -command "WB_SnapLocator( $gWB_Offset )";
+
+ menuItem -optionBox true -command "wb_MCB_SnapLocatorOptions()";
+
+ menuItem -divider true;
+
+ menuItem -label "Export" -command "WB_Export()";
+
+ menuItem -optionBox true -command "WB_ExportOptions()";
+
+ menuItem -divider true;
+
+ menuItem -label "About" -command "wb_MCB_About()";
+
+ setParent -m ..;
+
+ if ( `shelfLayout -exists "WorldBuilder"` == 0 )
+ {
+ addNewShelfTab "WorldBuilder";
+ }
+
+ //Delete all the old buttons (in case there was a change)..
+ string $buttons[] = `shelfLayout -q -ca WorldBuilder`;
+
+ int $i;
+
+ for ( $i = 0; $i < size($buttons); $i++ )
+ {
+ deleteUI $buttons[ $i ];
+ }
+
+ //Create all the buttons required..
+ shelfButton -c ("wb_BCB_CreateLocator(\"Event\")")
+ -p "WorldBuilder"
+ -i1 "eventlocator.bmp"
+ -ann "Create Event Locator"
+ -l "Event";
+
+ shelfButton -c ("wb_BCB_CreateLocator(\"Script\")")
+ -p "WorldBuilder"
+ -i1 "scriptlocator.bmp"
+ -ann "Create Script Locator"
+ -l "Script";
+
+ shelfButton -c ("wb_BCB_CreateLocator(\"Generic\")")
+ -p "WorldBuilder"
+ -i1 "genericlocator.bmp"
+ -ann "Create Generic Locator"
+ -l "Generic";
+
+ shelfButton -c ("wb_BCB_CreateLocator(\"Car Start\")")
+ -p "WorldBuilder"
+ -i1 "carstartlocator.bmp"
+ -ann "Create Car Start Locator"
+ -l "Car Start";
+
+ shelfButton -c ("wb_BCB_CreateLocator(\"Dynamic Zone\")")
+ -p "WorldBuilder"
+ -i1 "zonelocator.bmp"
+ -ann "Create Dynamic Zone Locator"
+ -l "Dynamic Zone";
+
+ shelfButton -c ("wb_BCB_CreateLocator(\"Occlusion\")")
+ -p "WorldBuilder"
+ -i1 "occlusionlocator.bmp"
+ -ann "Create Occlusion Locator"
+ -l "Occlusion";
+
+ shelfButton -c ("wb_BCB_CreateLocator(\"Interior Entrance\")")
+ -p "WorldBuilder"
+ -i1 "interiorlocator.bmp"
+ -ann "Create Interior Entrance Locator"
+ -l "Interior Entrance";
+
+ shelfButton -c ("wb_BCB_CreateLocator(\"Directional\")")
+ -p "WorldBuilder"
+ -i1 "directionallocator.bmp"
+ -ann "Create Directional Locator"
+ -l "Directional";
+
+ shelfButton -c ("wb_BCB_CreateLocator(\"Action\")")
+ -p "WorldBuilder"
+ -i1 "actionlocator.bmp"
+ -ann "Create Action Locator"
+ -l "Action";
+
+ shelfButton -c ("wb_BCB_CreateLocator(\"FOV\")")
+ -p "WorldBuilder"
+ -i1 "fovlocator.bmp"
+ -ann "Create FOV Locator"
+ -l "FOV";
+
+ shelfButton -c ("wb_BCB_CreateLocator(\"Breakable Camera\")")
+ -p "WorldBuilder"
+ -i1 "breakablecameralocator.bmp"
+ -ann "Create Breakable Camera Locator"
+ -l "Breakable Camera";
+
+ shelfButton -c ("wb_BCB_CreateLocator(\"Static Camera\")")
+ -p "WorldBuilder"
+ -i1 "staticcameralocator.bmp"
+ -ann "Create Static Camera Locator"
+ -l "Static Camera";
+
+ shelfButton -c ("wb_BCB_CreateLocator(\"Ped Group\")")
+ -p "WorldBuilder"
+ -i1 "pedgrouplocator.bmp"
+ -ann "Create Ped Group Locator"
+ -l "Ped Group";
+
+}
+
+
+//-----------------------------------------------------------------------------
+// w b _ I n s t a l l U I
+//
+// Synopsis:
+//
+// Parameters: NONE
+//
+// Returns: NOTHING
+//
+// Constraints: NONE
+//
+//-----------------------------------------------------------------------------
+global proc wb_InstallUI()
+{
+
+ global string $gMainWindow;
+
+ //
+ // Install WB menu as a root menu.
+ //
+ if ( `menu -exists wb_MainMenu` ) deleteUI wb_MainMenu;
+ menu -label "World Builder" -allowOptionBoxes true -parent $gMainWindow wb_MainMenu;
+
+ wb_doMainMenuItems "wb_MainMenu";
+}
+
+evalDeferred "wb_InstallUI";
+
+source "wb_setup.mel";
+source "wb_locator.mel";
+source "wb_splines.mel";
+source "wb_coinsplines.mel";
+source "AEWBTriggerButton.mel";
+source "AEWBSelectTarget.mel"; \ No newline at end of file
diff --git a/tools/MayaTools/Maya4.0/scripts/others/wb_setup.mel b/tools/MayaTools/Maya4.0/scripts/others/wb_setup.mel
new file mode 100644
index 0000000..9211390
--- /dev/null
+++ b/tools/MayaTools/Maya4.0/scripts/others/wb_setup.mel
@@ -0,0 +1,6 @@
+//Create the WorldBuilderNode.
+
+
+global proc wb_Create_WorldBuilderNode()
+{
+} \ No newline at end of file
diff --git a/tools/MayaTools/Maya4.0/scripts/others/wb_splines.mel b/tools/MayaTools/Maya4.0/scripts/others/wb_splines.mel
new file mode 100644
index 0000000..ab99858
--- /dev/null
+++ b/tools/MayaTools/Maya4.0/scripts/others/wb_splines.mel
@@ -0,0 +1,46 @@
+global int $gSplineCompleteCB = -1;
+
+global proc wb_MCB_CreateCameraPath()
+{
+ global int $gSplineCompleteCB;
+
+ if ( !`contextInfo -exists CameraSplineCtx` )
+ {
+ curveCVCtx -degree 3 -me false -un true CameraSplineCtx;
+ }
+ else
+ {
+ string $currentCtx = `currentCtx`;
+
+ if ( $currentCtx == "CameraSplineCtx" )
+ {
+ ctxCompletion;
+
+ wb_CB_SplineComplete();
+ }
+ }
+
+ setToolTo CameraSplineCtx;
+
+ $gSplineCompleteCB = `scriptJob -ro 1 -p "WorldBuilder" -e "ToolChanged" wb_CB_SplineComplete`;
+}
+
+global proc wb_CB_SplineComplete()
+{
+ WB_SplineComplete();
+}
+
+global proc wb_SplinesCleanup()
+{
+ global int $gSplineCompleteCB;
+
+ if ( $gSplineCompleteCB != -1 )
+ {
+ scriptJob -k $gSplineCompleteCB;
+ }
+
+ if ( `contextInfo -exists CameraSplineCtx` )
+ {
+ deleteUI -tc CameraSplineCtx;
+ }
+}