Announcement

Collapse
No announcement yet.

Auto-create directories for irmaps

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

  • Auto-create directories for irmaps

    Hi!

    When using a prepass/rendering workflow I tend to just count up versions in the textfield by hand, not using the filebrowser. But vray doesn't create the directories needed for saving the maps automatically. (Like it does for rendered images). So if you forget create them by hand, your render will fail. For sure I can script something th manage this, but as a freelancer it's nice to have those features in the vanilla package.

    Thanks!

  • #2
    Yes, as you say you can create them with Maya's tools and a bit of scripting which is a good way of doing it, you can stop all those extra directories Maya creates and create new rules as well like this site explains:

    http://www.mayzie.net/maya-tips/custom-maya-projects

    Here's my script after I added in the fileRuleEntry Vray into Maya if you find it helpful.

    Code:
    global proc vrayFixCache(){
    
    string $fileName = `file -q -sceneName`;
    string $gi = `getAttr "vraySettings.giOn"`;
    string $scene = `getSceneName`;
    string $lightcache = `getAttr "vraySettings.secondaryEngine"`;
    string $irradiancecache = `getAttr "vraySettings.primaryEngine"`;
    string $workspace = `workspace -q -rd`;
    string $workspacevray =`workspace -q -fileRuleEntry Vray`;
    
      if(!`objExists vrayCreateVRaySettingsNode`)
      {
    	vrayCreateVRaySettingsNode;
      } 
    
    if ($gi == 1){
    string $result = `confirmDialog 
    	    -title "Assign Cache Paths"
    	    -message ("Would you like to assign this as the correct cache path?\n\n" + $workspace + $workspacevray +"/")
    	    -button "OK" -button "Cancel"
    	    -defaultButton "OK" -cancelButton "Cancel"
    	    -dismissString "Cancel"`;
    
    	if ($result == "OK") {
    	
    //if ($irradiancecache == 0)
    //{
    setAttr -type "string" vraySettings.imap_fileName ($workspace + $workspacevray + "/" + "cache.vrmap");
    setAttr -type "string" vraySettings.imap_autoSaveFile ($workspace + $workspacevray + "/" + "cache.vrmap");
    setAttr -type "string" vraySettings.autoSaveFile ($workspace + $workspacevray + "/" + "cache.vrlmap");
    setAttr -type "string" vraySettings.fileName ($workspace + $workspacevray + "/" + "cache.vrlmap");
    //}
    }
    }
    else {
    	
    print "// Result: Could not complete operation";
    	
    }
    }
    If you want custom path names:

    Code:
    global proc vrayCustomCache(){
    
    string $text;
    string $gi = `getAttr "vraySettings.giOn"`;
    string $fileName = `file -q -sceneName`;
    string $workspace = `workspace -q -rd`;
    string $workspacevray =`workspace -q -fileRuleEntry Vray`;
    
      if(!`objExists vrayCreateVRaySettingsNode`)
      {
    	vrayCreateVRaySettingsNode;
      } 
    
    if ($gi == 1){
    string $result = `promptDialog 
    	    -title "Assign Cache Paths"
    	    -message ("Enter new V-Ray Cache file name to use")
    	    -button "OK" -button "Cancel"
    	    -defaultButton "OK" -cancelButton "Cancel"
    	    -dismissString "Cancel"`;
    
    	if ($result == "OK" && $gi == 1){
    
    $text = `promptDialog -q -t`;
    if (size($text) == 0)
    $text = "cache";
    
    setAttr -type "string" vraySettings.imap_fileName ($workspace + $workspacevray + "/" +  $text + ".vrmap");
    setAttr -type "string" vraySettings.imap_autoSaveFile ($workspace + $workspacevray + "/" +  $text + ".vrmap");
    setAttr -type "string" vraySettings.autoSaveFile ($workspace + $workspacevray + "/" +  $text + ".vrlmap");
    setAttr -type "string" vraySettings.fileName ($workspace + $workspacevray + "/" +  $text + ".vrlmap");
    
    }
    
    }
    
    else {
    	
    print "// Result: Could not complete operation, GI settings are off";
    	
    }
    
    }
    Maya 2020/2022
    Win 10x64
    Vray 5

    Comment


    • #3
      That looks really helpful, thanks for sharing!
      (but it would be nice, if vray would just create the directories needed - as a freelancer you don't always have the possibility to modify everything you want
      Last edited by pechart; 09-07-2012, 02:55 AM.

      Comment


      • #4
        Originally posted by pechart View Post
        When using a prepass/rendering workflow I tend to just count up versions in the textfield by hand, not using the filebrowser. But vray doesn't create the directories needed for saving the maps automatically.
        Thanks for the suggestion, will see what can be done about it.

        Best regards,
        Vlado
        I only act like I know everything, Rogers.

        Comment


        • #5
          Great, thank you!

          Comment


          • #6
            Just thought, that adding support for tokens like <Scene> etc. would be cool.

            Comment


            • #7
              Originally posted by pechart View Post
              Just thought, that adding support for tokens like <Scene> etc. would be cool.
              +1 for me, <Scene>, <Camera>, etc etc
              www.deex.info

              Comment

              Working...
              X