summaryrefslogtreecommitdiffstats
path: root/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/nameSpaceGui.mel
blob: 6648922eddcdcabd034d471cb35fbea4a9aea076 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
global string $g_P3DNameSpaceField;

global proc P3DRemoveNameSpaceTool_RemoveNameSpace(string $selectedNodes[], string $nameSpace)
{
   print "called P3DRemoveNameSpaceTool_RemoveNameSpace for:";
   print $selectedNodes;
   print "\n";
   for($node in $selectedNodes)
   {      
      string $newName = `substitute $nameSpace $node ""`;
      if($newName != "")
      {             
         rename -is $node $newName;      
      }
   }
}

global proc P3DRemoveNameSpaceTool_RemoveSelected()
{
   global string $g_P3DNameSpaceField;
   string $nameSpace = `textField -q -text $g_P3DNameSpaceField`;
   string $selectedNodes[] = `ls -sl`;

   P3DRemoveNameSpaceTool_RemoveNameSpace( $selectedNodes, $nameSpace );
}

global proc P3DRemoveNameSpaceTool_RemoveHierarchy()
{
   global string $g_P3DNameSpaceField;
   string $nameSpace = `textField -q -text $g_P3DNameSpaceField`;
   select -add -hi;
   string $selectedNodes[] = `ls -sl`;
   
   P3DRemoveNameSpaceTool_RemoveNameSpace( $selectedNodes, $nameSpace );
}


global proc P3DRemoveNameSpaceTool_GUICreate()
{
   string $windowName = "P3DRemoveNameSpaceTool";

   global string $g_P3DNameSpaceField;

   if (`window -query -exists $windowName`!=1)
   {
      window 
            -width 300 
            -height 140
            -minimizeButton false 
            -maximizeButton false 
            -sizeable false 
            -title $windowName 
            $windowName;

      columnLayout 
         -adjustableColumn true
	      -columnAlign "left" 
         -cat "left" 5;

         text -l "NameSpace";
         $g_P3DNameSpaceField = `textField -width 200`;

      button
         -label "Remove Selected"
            -command "P3DRemoveNameSpaceTool_RemoveSelected()";
      button
         -label "Remove Hierarchy"
            -command "P3DRemoveNameSpaceTool_RemoveHierarchy()";

      showWindow $windowName;
   }
}

P3DRemoveNameSpaceTool_GUICreate();