Automatically Assign V-Ray File Path Cache

Automatically Assign V-Ray File Path Cache

Here’s some quick code so Maya will automatically fill out the tedious Irradiance Map Cache file name paths and Light Cache File paths for V-Ray.

string $fileName = `file -q -sceneName`;
string $workspace = `workspace -q -rd`;
string $workspacevray = "renderData/vray";
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") {

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");
}

If you have customised your fileRuleEntry’s with, say a Custom V-Ray Cache rule. you can substitute this line of code

string $workspacevray = "renderData/vray";

with a fileRuleEntry if you have added one. Heres’ mine:

string $workspacevray =`workspace -q -fileRuleEntry Vray`;

Just remember to declare the “Vray” variable in np_getSecondaryProjectFileRules.mel by adding this simple line of code.

(uiRes("m_np_getSecondaryProjectFileRules.kVRay")),     				"Vray",      "renderData/vray",

and np_getSecondaryProjectFileRules.res.mel

displayString -replace -value "V-Ray" m_np_getSecondaryProjectFileRules.kVRay;

Comments

Nobody has said anything in this post yet!

Feedback