Difference between revisions of "Maya Mel"
								
								Jump to navigation
				Jump to search
				
				
		
					
								
							
		| Line 63: | Line 63: | ||
|      print($object+"\n"); |      print($object+"\n"); | ||
|      snapKey $object; |      snapKey $object; | ||
| + | } | ||
| + | |||
| + | </pre> | ||
| + | |||
| + | === Add blend attribute and set random value for objects selection === | ||
| + | <pre> | ||
| + | // Useful for blending between colors with RedshiftUserColorData | ||
| + | |||
| + | for ( $object in `ls -sl -l` ) { | ||
| + |     print($object); | ||
| + |     addAttr -ln "blend" -at double  -min 0 -max 1 -dv 0 $object; | ||
| + |     setAttr ($object + ".blend") (rand(1)); | ||
| } | } | ||
| </pre> | </pre> | ||
Revision as of 00:20, 9 August 2019
Contents
- 1 Maya Mels Scripts
- 1.1 Octane Render Baking group id - Assign id to multiple objects shapes
- 1.2 Maxwell Render - Particles sequence - Force .abc file
- 1.3 Maxwell Render - Specify object ID color
- 1.4 Convert Motion trail to curve
- 1.5 Quantize keyframes for selection
- 1.6 Add blend attribute and set random value for objects selection
 
Maya Mels Scripts
Octane Render Baking group id - Assign id to multiple objects shapes
// 0 is for Red, 2 for Green, 4 for Blue
// 3, 5 and 6 for Cyan, Magenta and Yellow
// Replace the number "0" by the number of your choice
// Baking group id is also avalaible in Attribute Spreadsheet Editor
for ( $object in `ls -sl -l` ) {
    print($object+"\n");
    setAttr ($object + ".octBakGrId") (0);
}
Maxwell Render - Particles sequence - Force .abc file
//This expression force Maya to reload an Alembic particles file at each frame - there is no other way in Maxwell Render to read a particles sequence in .abc
global int $current_frame;
$current_frame = `currentTime -query`;
print $current_frame;
{
setAttr -type "string" maxwellRFRKParticles1.file ("/YOUR_PATH/YOUR_FILE" + $current_frame + ".abc");
}
Maxwell Render - Specify object ID color
// Specify object ID color
for ( $object in `ls -sl -l` ) {
    print($object+"\n");
    setAttr ($object + ".mxSpecifyObjIdColor") (1);
    setAttr ($object + ".mxObjIdColor") -type "double3" 1 0 0;
}
Convert Motion trail to curve
// Select the motion trail first
{
$selected=`ls -dag -et snapshotShape`;
for ($obj in $selected){
$pts=(getAttr($obj+".pts"));
$size=size($pts);
$curve=`curve -d 1 -p $pts[0] $pts[1] $pts[2] -p $pts[4] $pts[5] $pts[6] -k 0 -k 1`;
for($i=8;$i<$size;$i+=4)
curve -os -a -p $pts[$i] $pts[$i+1] $pts[$i+2] $curve ;
}
}
Quantize keyframes for selection
// Snap keys on frames for objects selection
for ( $object in `ls -sl -l` ) {
    print($object+"\n");
    snapKey $object;
}
Add blend attribute and set random value for objects selection
// Useful for blending between colors with RedshiftUserColorData
for ( $object in `ls -sl -l` ) {
    print($object);
    addAttr -ln "blend" -at double  -min 0 -max 1 -dv 0 $object;
    setAttr ($object + ".blend") (rand(1));
}
