// Generated by Cutter v7.3.0 at 10:12:12 on the 3.3.2016.
// The source document on which this mel script is based is,
//    "/Users/malcolm/Documents/WebSite/FUNDZA_COM/cutter/rfm/runProgram/put_files_into_RfM_mel/runProgram.rman"
// Cutter software by Malcolm Kesson (all rights reserved).
// 
// Pre Shape Mel Script
//
global proc runProgramRI() {
// Get the name of the shape node
string $shapeNode = `rman ctxGetObject`;
string $parents[] = `listRelatives -parent $shapeNode`;
string $tformNode = $parents[0];
  
// The node may hava a number in its name that we can use 
// to set the random number generator
int    $nodeNumber = `match "[0-9]+" $shapeNode`;    
if($nodeNumber != "") {
    seed(int($nodeNumber));
    }
else
    $nodeNumber = 1;
    
// Bounding box...
float $bb_width =  `getAttr ($shapeNode + ".boundingBoxSizeX")`;
float $bb_height = `getAttr ($shapeNode + ".boundingBoxSizeY")`;
float $bb_depth =  `getAttr ($shapeNode + ".boundingBoxSizeZ")`;
  
string $attr;
$attr = `rmanGetAttrName "rp_helperApp"`;
$attr = `rmanGetFullSharedGeometricAttrName $shapeNode $attr`;
string $rp_helperApp = `getAttr $attr`;
  
$attr = `rmanGetAttrName "rp_points_num"`;
$attr = `rmanGetFullSharedGeometricAttrName $shapeNode $attr`;
int $rp_points_num = `getAttr $attr`;
  
$attr = `rmanGetAttrName "rp_points_width"`;
$attr = `rmanGetFullSharedGeometricAttrName $shapeNode $attr`;
float $rp_points_width = `getAttr $attr`;
  
$attr = `rmanGetAttrName "rp_scatter_radius"`;
$attr = `rmanGetFullSharedGeometricAttrName $shapeNode $attr`;
float $rp_scatter_radius = `getAttr $attr`;
  
$attr = `rmanGetAttrName "rp_scatter_thickness"`;
$attr = `rmanGetFullSharedGeometricAttrName $shapeNode $attr`;
float $rp_scatter_thickness = `getAttr $attr`;
  
float $minX = -10000, $minY = -10000, $minZ = -10000, 
      $maxX = 10000, $maxY = 10000, $maxZ = 10000;
  
string $pycmd = "python "; // assume we are on Windows
if(`about -os` == "linux" || `about -os` == "mac")
    $pycmd = "/usr/bin/python ";
    
// Use the Pixar RiMel proc to output our call to the python script.
string $inputs = $rp_points_num + " " + $rp_points_width + " " + 
                 $rp_scatter_radius + " " + ($rp_scatter_radius - $rp_scatter_thickness) +
                 " " + $nodeNumber;
RiProcedural("RunProgram", $pycmd + $rp_helperApp,
                                    $minX, $maxX,
                                    $minY, $maxY,
                                    $minZ, $maxZ,
                                    $inputs);
// Make the proxy object inactive
RiAttribute "visibility" "int camera" 0;
RiAttribute "visibility" "int indirect" 0;
RiAttribute "visibility" "int transmission" 0;
}