Posts Tagged ‘autodesk’

Maya : hos_rampColorShift.mel

Saturday, December 5th, 2009

Here’s another small function that i missed from my experience with Lightwave, it’s a script that allows you to shift the Hue, Saturation and Values of all color keys on the selected ramp node.
It has it’s own interface and i had to rewrite the RGB to HSV and the HSV to RGB code as the standard rgb_to_hsv and hsv_to_rgb functions clamp values to 0.0 and 1.0, which is a royal pain when your ramps are float and exceed 1.0 as value.

download : hos_rampColorShift_v1.0.zip

gradients_2

Maya : hos_invertRampPositions.mel

Saturday, December 5th, 2009

Here’s a small function that inverts all the key positions on the selected ramp, a small feature i missed from Lightwave and wanted to bring to Maya.

download : hos_invertRampPostions_v1.0.zip

gradients_1

Maya : Create Reference multifunctional hotkey

Saturday, December 5th, 2009

Here’s a small replacement for the default <CTRL> + <r> Create Reference command hot-key that adds some extra functionality.

This little function is actually quite simple, but allows one hot-key to do two things.
First, if nothing or a non referenced node is selected, the hot-key will simply function as Create Reference always did.
However, when a referenced node is selected, it will simply open up the Reference Editor.

Very simple, but a nice work-flow addition.

download : hos_ReferenceHotkey_v1.0

hosReferenceHK_01

Maya : open Reference in new instance of Maya.

Saturday, December 5th, 2009

Ever work with lots of references in a scene and you keep opening new instances of Maya to tweak a referenced file as a workaround trying to avoid using the save reference edits because of the (well justified) fear of wrecking a perfectly good referenced asset?

Well, no more, here’s a way to add a new feature to the RMB menu and File menu in the Reference Editor that opens the currently selected reference in a new instance of Maya.

Before you start doing this, know that it involves changing the MAYA_LOCATION/scripts/other/referenceEditorPanel.mel file that is an essential part of Maya, so, BACKUP referenceEditorPanel.mel BEFORE PROCEEDING.

If you screw up files that are an integral part of Maya and you don’t have extra workstations with Maya installs that can be used to restore those files should you screw up, there’s only one way to restore those files, and that is a reinstall of Maya.

The procedure is very simple,
Open up the MAYA_LOCATION/scripts/other/referenceEditorPanel.mel file in your favourite script editor.
Go to the end of line 214 (Maya 2009 and 2010, x86 and x64 on Windows) and create a new line.
Copy the folowing piece of code.

1
2
3
4
5
6
7
8
9
10
11
12
		// START HOS EXTRAS
		// in Maya 2010 add at the end of line 214 of referenceEditorPanel.mel
		menuItem -divider true;
 
		menuItem
			-label ("Edit in New instance")
			-annotation ("Opens a new instance of Maya with the file")
			-command ("string $referenceFile[] = `sceneEditor -q -si $gReferenceEditorPanel`;" + "system(\"start \\\"\" + getenv(\"MAYA_LOCATION\") + \"/bin/maya.exe\\\" \\\"\"+$referenceFile[0]+\"\\\"\");")
 
			referenceEdInstance;
 
		// END HOS EXTRAS

And paste it at the newly created line.
Save, start Maya, and you are ready to go.

That’s it.

edit : I just noticed that WordPress’ auto formatting screwed with the code, fixed it now (if you tried this and it didn’t work, WordPress was the reason as to why.

ref_script_editor_01referencesEII_01referencesEII_02

Maya progressBar and interrupting a script loop

Tuesday, June 23rd, 2009

maya2009_120This seems to be a function that is forgotten by many MEL programmers but can save you a lot of headaches.

It is one of those things you might want to implement anywhere in a script you know will do some heavy looping that could take a lot of processing time.

Just add this to your script early on and you are able to interrupt your script by pressing ESC, and a as a bonus you can implement a progress bar for some visual feedback.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
global string $gMainProgressBar;
int $maxPBar = 10000;
progressBar -e -bp -ii 1 -max $maxPBar $gMainProgressBar;
 
for($i=0; $i &lt; $maxPBar; $i++)
{
    if(`progressBar -q -ic $gMainProgressBar`)
    {
        break;
    }
 
    // here goes you code
 
    progressBar -e -s 1 $gMainProgressBar; // increases the progress bar
}
 
progressBar -e -endProgress $gMainProgressBar; // call this when you stop the script or when the script is done

Offcourse, the counter isn’t really necesary, just adding this script without increasing the progressBar alone is enough to prevent you having to force quit Maya and losing your script when your script decides to take hours to finish.

Fusion : HoS_MayaToxic2DMV.plugin

Thursday, May 14th, 2009

eyeonfusion120A Fusion plug-in that converts a Maya/MentalRay 2D Motion Vector (2dMVToxik) render pass to a normalized data set that Re:VisionFX’s ReelSmart Motion Blur can us.

All you as user need to do, is render out your 2dMVToxik pass as you normally would (either embedded as extra EXR pass or as a single RGB(A) file) and plug the following channels in the Background input:

red -> 2dMVToxic X-motion (the red channel by default.)
green -> 2dMXToxik Y-motion (the green channel by default.)

and plug the following channel into the Foreground input:

alpha -> the Alpha channel of the image that needs to be motion blurred.

When you have done that, the plug-in normalizes the channels according to the Displacement value so that when placed into the FG input of a ReelSmart Motion Blur Vectors node with the Max Displace set to the same value as the Displacement value of this plug-in, it should work exactly like the data that is produced by a shading plug-in like,  say lm2dmv.

This plug-in has been used extensively in our pipeline without any troubles so far, but should you run into something please let me know.
At the moment i have only compiled a x86 version and some small updates are planned, so keep an eye out for those.

download : hos_mayatoxic2dmv