View Full Version : Vray lights MEL selection
10-25-2011, 12:19 PM
Hi there, using outliner and other tools in Maya, it seems vray lights are regarded as well...lights. Excellent!
But MEL doesn't seem to catch them with this:
$listLight = `ls -lights`;
Does anyone know how to select vray lights in MEL? and if so can you go further and select them by their type? (vraysphere, vraydome etc..)
10-25-2011, 02:24 PM
every node in Maya has a specific type, and many of these types are "children" of a more common umbrella type, for example, directionLight, spotLight, etc are all types of light. you can list node by type using the ls command (among others).
// list ONLY directional lights:
ls -type "directionalLight";
// list ALL lights:
ls -type "light";
// `ls -lights` is simply a convenient (but unnecessary) shortcutThis all works because "directionalLight" is the node type for those lights, and "light" is the "parent" type for all lights. vRay lights may not be configured or created properly in Maya so Maya doesn't see them as "light" types, however they WILL have their own unique node type which you can ls with. All you need to do is find out that type. If you don't have documentation to tell you what it is, the quickest way is to select one and type:
ls -sl -st -dag;Which will list the name(s) and TYPE(s) of the node(s) selected. Remember that DAG nodes consist of a transform parent and the shape below, so what you will probably have selected is the transform. the -dag flag will make sure it reports the shape part too. You can get your node types this way, or alternatively you could use the nodeType "nodeName"; command.
10-25-2011, 02:40 PM
For some reason each vray light has it's own type so by:
ls -type VRayLightRectShape;
Will list only rectangular lights, VRayLightSphereShape - spherical etc.
Other funny thing is that all VRay lights will be listed with
ls -type locator
10-26-2011, 02:26 AM
Thanks guys, big help - I'm trying to get a Light Lister going exactly like the Max version.
Getting the light type has been the hardest part.
10-26-2011, 09:43 AM
It's handy, but considering the number of custom UI controls and connections you have to build, and the need of constant update/relationship betwen the UI and the scene I would propose you just feed all the params you need to an attribute spreadsheet - its much more efficient and you don't have to wory about connections between controls and lights, also it supports multiple parameter editing... I've already made such thing for most of the render related nodes in Maya:
10-26-2011, 11:26 AM
Thanks, that's a great idea but I also want to be able to connect/disconnect ramps and other effects to the lights. Thankfully though it's very easy to build one of these - finished the sphere lights, now onto the others..... :wip:
Probably should start learning python instead of MEL ahaha.
10-26-2011, 11:26 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2014, Jelsoft Enterprises Ltd.