octupe
09-07-2005, 01:17 PM
Hi,
I`m pretty new to MEL and I`m reading lots of good advise and help on this board as well as others.
I`ve been writing a script that will color a light based off the color at a point in a texture applied to some geometry. I`ve got all the light creation and setting the color ok, but I was stuck when trying to find out from an object what its filetexturenode was.
I read lots of posts and checked Brian Ewerts site many times and was gradually pulling more and more hair out. I didn`t want to come here asking until at least i had tried pretty much all possibilites and maybe got something half working anyway.
So i was reading all about listRelatives, listConnection, connectionInfo, listSets and anything related.
Now I am new to this,so thats probably not helping,but does it strike anyone else that trying to navigate through the DG to find what you are looking for is a nightmare of complexity? Surely it should be simpler to find out what is connected to what using MEL than it is, especialyl as the DG is at the heart of maya.
I now have something that is working basically and seems to work ok for a simple object with one shader with one filetexturenode attached.
here it is..its just in simplistic test form at the mo, I will splice it inot my main script later..
global proc WhatMapsIUse()
{
string $Selection[] = `ls -sl -sn` ;
string $ShadingGroup[] = `listSets -t 1
-ets
-object $Selection` ;
string $TokenClip[] ;
string $Shader = `connectionInfo -sfd ($ShadingGroup[0] + ".surfaceShader")`;
tokenize $Shader "." $TokenClip;
string $ShaderFileTexture[] = `listConnections -s true -d true $TokenClip[0]` ;
print ("ShadingGroup: " + $ShadingGroup[0] + "\n");
print ("Shader: " + $Shader + "\n") ;
print ("ShaderFileTexture: " + $ShaderFileTexture[0] + "\n") ;
}
If anyone has suggestions on how to improve this, then they will be most welcome.
And if anyone can contribute to this thread the best way to do this it would be great, because when I was tryingto find out how to do this it was very frustrating.
Thanks in advance for any help.
Although frustrating, I`m really enjoying getting in to MEL :)
Cheers
I`m pretty new to MEL and I`m reading lots of good advise and help on this board as well as others.
I`ve been writing a script that will color a light based off the color at a point in a texture applied to some geometry. I`ve got all the light creation and setting the color ok, but I was stuck when trying to find out from an object what its filetexturenode was.
I read lots of posts and checked Brian Ewerts site many times and was gradually pulling more and more hair out. I didn`t want to come here asking until at least i had tried pretty much all possibilites and maybe got something half working anyway.
So i was reading all about listRelatives, listConnection, connectionInfo, listSets and anything related.
Now I am new to this,so thats probably not helping,but does it strike anyone else that trying to navigate through the DG to find what you are looking for is a nightmare of complexity? Surely it should be simpler to find out what is connected to what using MEL than it is, especialyl as the DG is at the heart of maya.
I now have something that is working basically and seems to work ok for a simple object with one shader with one filetexturenode attached.
here it is..its just in simplistic test form at the mo, I will splice it inot my main script later..
global proc WhatMapsIUse()
{
string $Selection[] = `ls -sl -sn` ;
string $ShadingGroup[] = `listSets -t 1
-ets
-object $Selection` ;
string $TokenClip[] ;
string $Shader = `connectionInfo -sfd ($ShadingGroup[0] + ".surfaceShader")`;
tokenize $Shader "." $TokenClip;
string $ShaderFileTexture[] = `listConnections -s true -d true $TokenClip[0]` ;
print ("ShadingGroup: " + $ShadingGroup[0] + "\n");
print ("Shader: " + $Shader + "\n") ;
print ("ShaderFileTexture: " + $ShaderFileTexture[0] + "\n") ;
}
If anyone has suggestions on how to improve this, then they will be most welcome.
And if anyone can contribute to this thread the best way to do this it would be great, because when I was tryingto find out how to do this it was very frustrating.
Thanks in advance for any help.
Although frustrating, I`m really enjoying getting in to MEL :)
Cheers
