Announcement

Collapse
No announcement yet.

[script] Sync Proxy Shader

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [script] Sync Proxy Shader

    Me and friends just working on some big shot and found Some annoying thing that vray proxies had.

    If you create Vray proxies and tick the "Automatically create proxies" It's work fine on that scence you got a shaders.
    But!!!!

    If you import normal Proxies and it's didn't get shaders for you. just a name of it that they had.
    so you must to import material and replace it one by one.
    in the Vraymeshmtl >> shaders
    so it had a name that matching your shaders name import in.

    The concept just simple we just detect the name and get the shader assign on it own just that!!!
    Here it a script and me and my friends want vray to put some button like this in.....


    Code:
    ////////////////////////////////////////////////////////////////////////////
    //////////////////////////// Windows Zome //////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////
    
    if (`window -exists VrayAA`)
    {
    deleteUI VrayAA;
    windowPref -remove VrayAA;
    }
    
    window -widthHeight 200 210 -menuBar true -t "Sync_Proxy" -s 0 VrayAA;
    columnLayout clolumn;
    text -label "Sync_Proxy" -fn boldLabelFont -bgc 0.084 0.084 0.084 -w 200 -h 20 optionBar;
    text "";
    text "  1. import Proxy";
    text "  2. import Shader";
    text "  3. Merge Name space with root ";
    text "  4. Hit Button !!!!!!";
    text "      ";
    button -l "Sync_Proxy" -w 100 -h 30 -c "VrayProxy_AutoAssign";
    text "     ";
    text "5. check it's work?";
    showWindow VrayAA;
    
    ///////////////////////
    // ====================================================================
    ///////////////////////////// VrayProxy_AutoAssign /////////////////////////////////
    // ====================================================================
    // 
    // 
    // Original Idea & Concept By : Manatjosef khamphan (jooldschool)
    // jooldscool@gmail.com
    //
    // Scriping By : Akkarin Sorhasan (Cyangryphon)
    // cyangryphon@gmail.com
    // 
    //    
    // ====================================================================
    
    global proc VrayProxy_AutoAssign()
    {
        string $GvrMesh[] = `ls -typ "VRayMeshMaterial"`;
        string $msg = "\n===================\n//result//\n";
        string $miss = "\n\n----------\nMissing Shader\n";
        string $Cnect = "\n----------\nConnect Shader\n";
        
        
        for ($e in $GvrMesh)
        {
            $ShaderMax = `getAttr -size ($e + ".shaderNames")`;
            for ($i=0;$i<$ShaderMax;$i++)
            {
                $GSdname = `getAttr ($e + ".shaderNames[" + $i + "]")`;
                if (`objExists $GSdname`)
                {
                    //if alredy connect
                    if (`vrayShaderConnectionDefaultTraversal ($e + ".shaders[" + $i + "]")` == $GSdname )
                    {
                        $Cnect += "\nAlredy connect: " + $GSdname + "  ==>  " + ($e + ".shaders[" + $i + "]") ;
                    }else
                    {
                        connectAttr -f ($GSdname + ".outColor") ($e + ".shaders[" + $i + "]");
                        $Cnect += "\nConnect Shader : " + $GSdname + "  ==>  " + ($e + ".shaders[" + $i + "]") ;
                    }
                }else
                {
                    $miss += "\nMissing Shader : " + $GSdname + "  ==>  " + ($e + ".shaders[" + $i + "]") ;
                }
            }
        }
        $msg += $Cnect + $miss +"\n\n\nDone~~\n===================";
        print $msg;
    }
    
    ///////////////////////////////////////
    - Original Idea & Concept By : Manatjosef khamphan (jooldschool)
    jooldscool@gmail.com
    - Scriping By : Akkarin Sorhasan (Cyangryphon)
    cyangryphon@gmail.com

    ////////////////////// How to use //////////////////////







  • #2
    The V-Ray proxy has always written the geometry (+ animation, + velocity/color/user channels) and has never written materials/shaders to the file. The auto-import just relinks the existing shaders while the scene is still open.
    You script seems like something very useful, thanks for sharing it, I'll definitely give it a try
    Alex Yolov
    Product Manager
    V-Ray for Maya, Chaos Player
    www.chaos.com

    Comment


    • #3
      Yep But the Auto it's need to be on that Scene. If I want to import in another Scene file that I Must to relinks all shader so something If you have 30+ Shadder it's would be pain
      I hope this script or concept can be useful And vray got button that sync it's in next version. thx for reply ^ ^b

      Comment

      Working...
      X