Debian Codegraph @

examples/prism-mel.html

raw symbols SCIP
1 <h2>Comments</h2>
2 <pre><code>// This is a comment</code></pre>
3
4 <h2>Strings</h2>
5 <pre><code>"This is a string"
6 "foo \"bar\" baz"</code></pre>
7
8 <h2>Numbers</h2>
9 <pre><code>42
10 3.14159
11 0xA2F</code></pre>
12
13 <h2>Variables</h2>
14 <pre><code>$x
15 $floaty5000
16 $longDescriptiveName
17 $name_with_underscores
18 $_line
19
20 float $param;
21 int $counter;
22 string $name;
23 vector $position;</code></pre>
24
25 <h2>Arrays, vectors and matrices</h2>
26 <pre><code>string $array[3] = {"first\n", "second\n", "third\n"};
27 print($array[0]); // Prints "first\n"
28 print($array[1]); // Prints "second\n"
29 print($array[2]); // Prints "third\n"
30
31 vector $roger = &lt;&lt;3.0, 7.7, 9.1>>;
32 vector $more = &lt;&lt;4.5, 6.789, 9.12356>>;
33 // Assign a vector to variable $test:
34 vector $test = &lt;&lt;3.0, 7.7, 9.1>>;
35 $test = &lt;&lt;$test.x, 5.5, $test.z>>
36 // $test is now &lt;&lt;3.0, 5.5, 9.1>>
37
38 matrix $a3[3][4] = &lt;&lt;2.5, 4.5, 3.25, 8.05;
39 1.12, 1.3, 9.5, 5.2;
40 7.23, 6.006, 2.34, 4.67>></code></pre>
41
42 <h2>Commands</h2>
43 <pre><code>pickWalk -d down;
44 string $mySelection[] = `ls -selection`;
45
46 setAttr ($mySelection[0]+".particleRenderType") 5;
47
48 addAttr -is true -ln "spriteTwist" -at "float" -min -180 -max 180 -dv 0.0 blue_nParticleShape;</code></pre>
49
50 <h2>Full example</h2>
51 <pre><code>// From http://help.autodesk.com/view/MAYAUL/2015/ENU/?guid=Example_scripts_Dynamics_Time_Playback
52 // Alias Script File
53 // MODIFY THIS AT YOUR OWN RISK
54 //
55 // Creation Date: 8 May 1996
56 // Author: rh
57 //
58 // Description:
59 // Playback from frame 0 to frame &lt;n> and return the
60 // the playback rate in frames/sec. If a negative frame
61 // count is given, this indicates silent mode. In silent
62 // mode, no output is printed.
63 //
64 // This version is intended for use in batch tests of dynamics.
65 // It requests particle and rigid body positions every frame.
66 //
67 // RETURN
68 // Frame rate in frames/sec
69 //
70 global proc float dynTimePlayback( float $frames )
71 {
72 int $silent;
73 // Get the list of particle shapes.
74 //
75 string $particleObjects[] = `ls -type particle`;
76 int $particleCount = size( $particleObjects );
77 // Get the list of transforms.
78 // This will include rigid bodies.
79 //
80 string $transforms[] = `ls -tr`;
81 int $trCount = size( $transforms );
82 // Check for negative $frames. This indicates
83 // $silent mode.
84 //
85 if ($frames &lt; 0)
86 {
87 $silent = 1;
88 $frames = -$frames;
89 }
90 else
91 {
92 $silent = 0;
93 }
94 // Setup the playback options.
95 //
96 playbackOptions -min 1 -max $frames -loop "once";
97 currentTime -edit 0;
98 // Playback the animation using the timerX command
99 // to compute the $elapsed time.
100 //
101 float $startTime, $elapsed;
102 $startTime = `timerX`;
103 // play -wait;
104 int $i;
105 for ($i = 1; $i &lt; $frames; $i++ )
106 {
107 // Set time
108 //
109 currentTime -e $i;
110 int $obj;
111 // Request count for every particle object.
112 //
113 for ($obj = 0; $obj &lt; $particleCount; $obj++)
114 {
115 string $cmd = "getAttr " + $particleObjects[$obj]+".count";
116 eval( $cmd );
117 }
118 // Request position for every transform
119 // (includes every rigid body).
120 //
121 for ($obj = 0; $obj &lt; $trCount; $obj++)
122 {
123 string $cmd = "getAttr " + $transforms[$obj]+".translate";
124 eval ($cmd);
125 }
126 }
127 $elapsed = `timerX -st $startTime`;
128 // Compute the playback frame $rate. Print results.
129 //
130 float $rate = ($elapsed == 0 ? 0.0 : $frames / $elapsed) ;
131 if ( ! $silent)
132 {
133 print( "Playback time: " + $elapsed + " secs\n" );
134 print( "Playback $rate: " + $rate + " $frames/sec\n" );
135 }
136 return ( $rate );
137 } // timePlayback //</code></pre>