Cl_pyramid_03.mel

[index]

11th April 2009   2:22am 36sec
C:\Work\vsfx705\mel\Cl_pyramid_03.mel


PYRAMID creation 3



//DECLARE Global NAMES//
  
global string $Xslider ;
global string $Yslider ;
global string $Zslider ;
global string $Sslider ;
global string $dupXslider ;
global string $dupZslider ;
global string $pyramidArray[];
  
//END of Global Declaration//
//Geting Value of sliders//
  
global proc int getSliderValueX()
{
global string $Xslider ;
  
int     $XunitValue = `intSliderGrp -q -v  $Xslider`;
return     $XunitValue;
}
//---------------------------------//
global proc int getSliderValueY()
{
  
global string $Yslider ;
  
int      $YunitValue = `intSliderGrp -q -v  $Yslider`;
return  $YunitValue;
}
//--------------------------------//
global proc int getSliderValueZ()
{
  
global string $Zslider ;
  
int     $ZunitValue = `intSliderGrp -q -v  $Zslider`;
return     $ZunitValue;
}
//--------------------------------//
global proc int getSliderValueS()
{
  
global string $Sslider ;
  
int    $SunitValue = `intSliderGrp -q -v  $Sslider`;
return     $SunitValue;
}
//--------------------------------//
global proc int getSliderValue_dupX()
{
  
global string $dupXslider ;
  
int    $dupX_unitValue = `intSliderGrp -q -v  $dupXslider`;
return     $dupX_unitValue;
}
  
//--------------------------------//
global proc int getSliderValue_dupZ()
{
  
global string $dupZslider ;
  
int    $dupZ_unitValue = `intSliderGrp -q -v  $dupZslider`;
return     $dupZ_unitValue;
}
//MAKING THE PYRAMID//-----------------------------
  
//global proc sleepAndRefresh()/
//{
    //python("import time; time.sleep(0.2)");
    //refresh;
//}
global proc cePyr1()
{
global string $pyramidArray[];
  
float $maxX = getSliderValueX();
float $maxY = getSliderValueY();
float $maxZ = getSliderValueZ();
  
int $index = 0;
for ($x =0 ; $x < $maxX; $x++) {
    for ($y =0 ; $y < $maxY; $y++) {
        for ($z = 0; $z <  $maxZ; $z++) {
            if($x >= -5 && $x <=5 || $y >= 0 && $y <= 5) 
            {
                float $cSize = rand(0,0.5);
                string $eachPyramid[] = `polyCube -name py1  -h $cSize` ;
                $pyramidArray[$index] =  $eachPyramid[0];
                $index ++;
                //sleepAndRefresh();
                move     ($x * 0.1) ($y * 0.5) ($z * 0.1);
                //sleepAndRefresh();
                float $scale = ($maxY - $y);
                 scale   ($scale * (rand (0.1,0.5))) ($scale * (rand(0.1,0.5)) ) ($scale * (rand (0.1,0.5)));
                //sleepAndRefresh();
            
            }
            //else 
            //nothing    ;
            }
        }
    }         
}
//Groupin the Pyramid//-------------------------
global proc makePyr1()
{
  
string $grpPyr[] = `ls "py*"`; 
select  $grpPyr;
group -name grp_cl_pyr;
//global string $CLpyramid = CL
//polyPlane;
//scale 100 100 100;
}
//-------------------------------
global proc solver()
{
cePyr1();
  
}
//-----------------------------------
  
global proc deletestuff()
{
  
string $p_node[] = `ls "py*"`;
select $p_node;
delete;
string $grp_node[] = `ls "grp_cl_pyr*"`;
select $grp_node;
delete;
  
}
  
//Selecting Random Shapes//-----------------------------------------
  
global proc randomSelect()
{
//    global string $pyramidArray[];
    
    string $pyrArray[] = `ls "py****"`; 
    int $Smax = getSliderValueS();
    
    int $arraySize = `size $pyrArray`;
    int $py[];
    
    for($s = 0; $s < $Smax; $s++) 
    {
    
    int $Svalue = `rand $arraySize`;
    $py[$s] =  $Svalue;
    
    }
    int $eachIndex;
    select -clear;
    for($eachIndex in $py)
    {
        select -add $pyrArray[$eachIndex];
    } 
    
}
  
//------------------------------------------------------------------------------//
//open the Hypershade
global proc shading()
  
{
tearOffPanel "Hypershade" "hyperShadePanel" true;
}
  
//------------------------------------
/*global proc copyPyr()
    {
    //    string $masterPyr[];
        select -all
        group;
        ls 
        instance;
    
    for ( $x = 0; $x <= 5; $x++){
        //for ( $z = 0: $z <= 5; $z++){
            
            move (0.5 * $x) (0.5 * $x) 0;
            
            //}
        }
for ($i=1; $i<=5; ++$i) instance -st;
  
}*/
//--------------------------------------------
global proc Punite()
{
    string $pyrArray[] = `ls "py****"`;
    string $dupArray[] = `ls "cl_pryUnite*"`;
    select $pyrArray $dupArray; 
    polyUnite -name cl_pryUnite;
    delete -ch ;
}
//--------------------------------------------
global proc Dup_Pyr()
{ 
  
  
int $dupX =  getSliderValue_dupX();
int $dupZ =  getSliderValue_dupZ();
// Create the master sphere
string $parray[] = `ls "cl_pryUnite*"`;
string $list[];
int        $n = 0;
for($x = 0; $x < $dupX; $x++) {
    for($z = 0; $z <$dupZ; $z++) {
        $inst = `instance`;
        $list[$n] = $inst[0];
        move (rand(1,5) * $x) 0 ((rand(1,5))* $z);
        $n++;
        }
        }
  
select $list;
group -name dup;
  
}
//-------------------------------------
global proc delete2()
{
string $list1[] =  `ls "dup*"`; 
string $list2[] =  `ls "cl_pryUnite*"`; 
select $list1;
select $list2;
delete;  
string $list[] =  `ls "dup*"`; 
select $list;
delete;  
}
//_-___-------------------------------------
global proc Plane()
{
//string $p = `ls "polyPlane*"`;
//select $p;
//delete;
polyPlane -width 300 -h 300 ; 
}
  
//___________________________________________________________
/*
global proc CRE_Dshader ()
{
string $shaderN[] = `ls "surfaceShader*"`;  
delete $shaderN;
  
shadingNode -asShader surfaceShader;
// Result: surfaceShader4 // 
sets -renderable true -noSurfaceShader true -empty -name surfaceShader1SG;
// Result: surfaceShader4SG // 
connectAttr -f surfaceShader1.outColor surfaceShader1SG.surfaceShader;
// Result: Connected surfaceShader4.outColor to surfaceShader4SG.surfaceShader. // 
defaultNavigation -createNew -destination "surfaceShader1.outColor";
createRenderNode -allWithTexturesUp "defaultNavigation -force true -connectToExisting -source %node -destination surfaceShader1.outColor" "";
defaultNavigation -defaultTraversal -destination "surfaceShader1.outColor";
defaultNavigation -force true -connectToExisting -source mib_amb_occlusion2 -destination surfaceShader1.outColor;
connectAttr -force mib_amb_occlusion2.outValue surfaceShader1.outColor;
// Result: Connected mib_amb_occlusion2.outValue to surfaceShader4.outColor. // 
  
  
}
global proc Ass_shader ()
{
  
string $grp_node[] = `ls "grp_cl_pyr*"`;
select -r $grp_node;
string $shaderN2[] = `ls "surfaceShader*"`; 
sets -e -forceElement $shaderN2[1];
}
*/