summaryrefslogtreecommitdiffstats
path: root/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/simpsonsArt.mel
blob: 0f6dcf3286db052f91efde2b096c1278cb270c79 (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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
/* simpsonsArt.mel  

    THIS IS AN UPDATE TO JEFF PIDSADNY'S SIMPSONS ART MENU SCRIPT.
    THIS REVISION HAS MAINLY CHANGED THE LOOK OF THE GUI AND ADDED 
    ICONS INSTEAD OF TEXT.

    AUTHOR: ARYAN HANBECK 

    JULY 03 2002

*/
 
//
// SOURCE ALL SCRIPTS AND DEFINE GLOBAL PROCEDURES
//


//===========================================================================
// validBMP
//===========================================================================
// Description: Maya's UI layout will BOMB if you attempt to create a UI
//              control that contains an image (a 'symbolButton' for example)
//              where the specified image does not exist.
//
//              This function queries the folders specified in the XBMLANGPATH 
//              environment variable for the specified BMP image.  If the
//              image is found, its name is returned.  If the image is not
//              found, the default image "vacantCell.xpm" is returned instead.
//
//              Suggested use is to specify the image for a control by 
//              wrapping it within validBMP(); e.g.:
//
//                  symbolButton -image ( validBMP( "myImage.bmp" );
//
// Constraints: 
//
//  Parameters: string $bmp: The name of the BMP image (no path, please).
//
//      Return: (string): If specified BMP is valid, the BMP name is
//                        returned; if the BMP is not valid "vacantCell.xpm"
//                        is returned.
//
//===========================================================================


 proc string validBMP( string $bmp )
{
    string $validBMP = "vacantCell.xpm";
    
    string $pathEnv = `getenv XBMLANGPATH`;
    string $paths[];
    tokenize $pathEnv ";" $paths;
    for ( $p in $paths )
    {
        string $bmpPath = ( $p + "/" + $bmp );
        if ( `file -q -exists $bmpPath` )
        {
            $validBMP = $bmp;
            break;
        }
    }
    
    return $validBMP;
}


source "C:/AW/Maya4.0/scripts/SimpsonsArt/renameScripts.mel";
source "C:/AW/Maya4.0/scripts/SimpsonsArt/forceUniqueNames.mel"; 
source "C:/AW/Maya4.0/scripts/SimpsonsArt/optimizeShaders.mel"; 
source "C:/AW/Maya4.0/scripts/SimpsonsArt/mappedPrelightWindow.mel";
source "C:/AW/Maya4.0/scripts/SimpsonsArt/rndPoints.mel";
source "C:/AW/Maya4.0/scripts/SimpsonsArt/setShapeNode.mel";
source "C:/AW/Maya4.0/scripts/SimpsonsArt/yuya_copyFileTex.mel";
source "C:/AW/Maya4.0/scripts/SimpsonsArt/uvz.mel";



global proc setShapeNode() 
{
    source "C:/AW/Maya4.0/scripts/SimpsonsArt/setShapeNode.mel";setShapeNode;
}

global proc uvz()
{
    source "C:/AW/Maya4.0/scripts/SimpsonsArt/uvz.mel";
}

global proc nameSpaceGui() 
{
    source "C:/AW/Maya4.0/scripts/SimpsonsArt/nameSpaceGui.mel";
}

global proc renameTexture() 
{
    source "C:/AW/Maya4.0/scripts/SimpsonsArt/renameTexture.mel";renameTexture;
}

global proc simpsonsExporterOptions()
{
setAttr "p3dDefaultExporterSetting.exportVertexOffsetAnims" 0;
setAttr "p3dDefaultExporterSetting.exportVisAnimations" 0;
setAttr "p3dDefaultExporterSetting.exportAnimations" 0;

}

global proc litOff() 
{
    string $mats[] = `ls -type pure3dSimpleShader`;
    for($mat in $mats)
    {
        $attr = $mat + ".dynamicallyLit";
      setAttr $attr 0;
        $attrs = $mat + ".color";
        shadingConnection -e -cs on $attrs;
        FixHWTextureInfo( $mat );
    }
//    for($mat in $mats)
//    {
//        $attr = $mat + ".doubleSided";
//      setAttr $attr 0;
//        $attrs = $mat + ".color";
//        shadingConnection -e -cs on $attrs; 
//    }
}

global proc backfaceOff()
{
    string $objects[] = `ls -sl -dag -s`;
    print ("\n");
    print $objects;
    for($object in $objects)
    {
        setAttr ( $object + ".opposite") 0; 
    }
}


if(`window -ex "SAMmainwindow"`)
{
    deleteUI -wnd "SAMainWindow";
}

//
//CREATE THE GUI WINDOW AND ADD THE BUTTONS
//

global proc simpsonsArt()
{
window 
    -visible 1
    -title "SAM"
    -sizeable 0
    -iconify 0
    -wh 147 300
    -maximizeButton 0
        SAMmainWindow;
    columnLayout -adj true;
        frameLayout
            -label "Geometry"
            -labelAlign "center"
            -cll true
                SAMgeometryFrame;

            rowLayout
                -numberOfColumns 2
                -columnWidth 1 68
                -columnWidth 2 68
                    SAMgeometryRow;

                symbolButton
                    -w 68
                    -h 28
                    -image "C:/AW/Maya4.0/scripts/SimpsonsArt/icons/rnd.bmp"
                    -ann "Random Points"
                    -c "rndPoints"
                    SAMrndPoints;
                symbolButton
                    -w 68
                    -h 28
                    -image "C:/AW/Maya4.0/scripts/SimpsonsArt/icons/backfaceoff.bmp"
                    -ann "Backface Off"
                    -c "backfaceOff"
                    SAMbackfaceOff;
                setParent ..;
        setParent ..;

        frameLayout
            -label "Lighting"
            -labelAlign "center"
            -cll true
            -bv true
            SAMlightingFrame;                   
            rowLayout
                -numberOfColumns 2
                -columnWidth 1 68
                -columnWidth 2 68
                SAMlightingRow;
                symbolButton
                    -w 68
                    -h 28
                    -image "C:/AW/Maya4.0/scripts/SimpsonsArt/icons/prelighttool.bmp"
                    -ann "Simpsons Prelight"
                    -c "mappedPrelightWindow"
                    SAMsimpsonsPreLight;
                symbolButton
                    -w 68
                    -h 28
                    -image "C:/AW/Maya4.0/scripts/SimpsonsArt/icons/prelitoff.bmp"
                    -ann "Prelit Off"
                    -c "litOff"
                    SAMpreLitOff;
                setParent ..;
        setParent ..;

        frameLayout
            -label "Textures"
            -labelAlign "center"
            -cll true
            -bv true
            SAMtextureFrame;                    
            columnLayout -adjustableColumn 1 SAMtextureColumn;
                rowLayout
                    -numberOfColumns 2
                    -columnWidth 1 68
                    -columnWidth 2 68
                    SAMtextureRow;
                    symbolButton
                        -w 68
                        -h 28
                        -image "C:/AW/Maya4.0/scripts/SimpsonsArt/icons/renametex.bmp"
                        -ann "RenameTextures"
                        -c "renameTexture"
                        SAMrenameTextures;
                    symbolButton
                        -w 68
                        -h 28
                        -image "C:/AW/Maya4.0/scripts/SimpsonsArt/icons/movetex.bmp"
                        -ann "Move Textures"
                        -c "yuya_copyFileTex"
                        SAMoveFiles;
                    setParent ..;
                rowLayout
                    -numberOfColumns 2
                    -columnWidth 1 68
                    -columnWidth 2 68
                    SAMtextureRow2; 
                    symbolButton
                        -w 68
                        -h 28
                        -image "C:/AW/Maya4.0/scripts/SimpsonsArt/icons/optimizetex.bmp"
                        -ann "Optimize Shaders"
                        -c "optimizeShaders"
                        SAMoptimizeShaders;
                    symbolButton
                        -w 68
                        -h 28
                        -image "C:/AW/Maya4.0/scripts/SimpsonsArt/icons/uvz.bmp"
                        -ann "UVz Utility"
                        -c "uvz"
                        SAMuvz;                 
                    setParent ..;
            setParent ..;
        setParent ..;
        frameLayout
            -label "Hypergraph"
            -labelAlign "center"
            -cll true
            -bv true
            SAMhypergraphFrame;                 
            columnLayout -adjustableColumn 1 SAMhypegraphColumn;
                rowLayout
                    -numberOfColumns 2
                    -columnWidth 1 68
                    -columnWidth 2 68
                    SAMhypergraphRow;
                    symbolButton
                        -w 68
                        -h 28
                        -image "C:/AW/Maya4.0/scripts/SimpsonsArt/icons/setshape.bmp"
                        -ann "Set Shape Node"
                        -c "setShapeNode"
                        SAMsetShapeNode;
                    symbolButton
                        -w 68
                        -h 28
                        -image "C:/AW/Maya4.0/scripts/SimpsonsArt/icons/removetxt.bmp"
                        -ann "Remove Text String"
                        -c "nameSpaceGui"
                        SAMremoveTextString;
                    setParent ..;
                rowLayout
                    -numberOfColumns 2
                    -columnWidth 1 68
                    -columnWidth 2 68
                    SAMHypergraphRow2;  
                    symbolButton
                        -w 68
                        -h 28
                        -image "C:/AW/Maya4.0/scripts/SimpsonsArt/icons/unique.bmp"
                        -ann "Force Unique Names"
                        -c "forceUniqueNames"
                        SAMforceUniqueNames;
                    symbolButton
                        -w 68
                        -h 28
                        -image "C:/AW/Maya4.0/scripts/SimpsonsArt/icons/p3d.bmp"
                        -ann "Set Exporter Options"
                        -c "simpsonsExporterOptions"
                        SAMsetExporterOptions;
                    setParent ..;
                rowLayout
                    -numberOfColumns 2
                    -columnWidth 1 68
                    -columnWidth 2 68
                    SAMhypergraphRow3;
                    string $name = `textField -width 68`;
                    symbolButton
                        -w 68
                        -h 28
                        -image "C:/AW/Maya4.0/scripts/SimpsonsArt/icons/renamesh.bmp"
                        -ann "Rename Shapes"
                        -c ("renameShape `textField -q -text " + $name + "`")
                        renameShape;
                    setParent ..;
            setParent ..;
        setParent ..;
    setParent ..;

	 window -e
		 -wh 147 295
		SAMmainWindow;

}
// end of script