PDA

View Full Version : LightLinking Bug removal with MEL??


MinaRagaie
09-17-2007, 09:35 AM
I've came across a Maya bug that makes lots of connections between the "initialShadingGroup" node and the "lightLinker1" node.
it slows the file down alot while saving and it's basically trash connections that I don't need.
I'va already asked this in another Thread (http://forums.cgsociety.org/showthread.php?f=7&t=538602) but I thought it would be better to link to it here too.

Maybe one of the Mel wizards here can help me with a script that breaks these connections??

any help is much apriciated,
thanks in advance.

-Mina

mhovland
09-17-2007, 08:47 PM
Try this out:


global proc RemoveUnusedLightLinkers()
{
string $xt_dos[] = `listConnections -s 1 -p 1 defaultObjectSet.message`;
for ( $invalue in $xt_dos )
{
disconnectAttr defaultObjectSet.message $invalue;
}

string $xt_dls[] = `listConnections -s 1 -p 1 defaultLightSet.message`;
for ( $invalue in $xt_dls )
{
disconnectAttr defaultLightSet.message $invalue;
}

string $xt_isg[] = `listConnections -s 1 -p 1 initialShadingGroup.message`;
for ( $invalue in $xt_isg )
{
if($invalue != "initialMaterialInfo.shadingGroup")
{
disconnectAttr initialShadingGroup.message $invalue;
}
}

string $xt_ipse[] = `listConnections -s 1 -p 1 initialParticleSE.message`;
for ( $invalue in $xt_ipse )
{
disconnectAttr initialParticleSE.message $invalue;
}
}

MinaRagaie
09-18-2007, 01:39 PM
Thanks alot... First test off this works fine.
I tried it on an empty file that got the error and it worked just fine.
one thing though... it disconnected even all the light links... wich in an empty file is considerably an unused light link ;)
I'll do another test and come back here :)

thanks again this is really a promising solution :)

-Mina

MinaRagaie
09-23-2007, 10:56 AM
thanks mhovland :thumbsup:
I commented out most of the code... left only the parts I needed..
now it solves the problem without disconnecting everything.
I added to lines at the end that adds the default connections again.

thanks alot, my problem is now solved.

global proc RemoveUnusedLightLinkers()
{
// string $xt_dos[] = `listConnections -s 1 -p 1 defaultObjectSet.message`;
// for ( $invalue in $xt_dos )
// {
// disconnectAttr defaultObjectSet.message $invalue;
// }
//
// string $xt_dls[] = `listConnections -s 1 -p 1 defaultLightSet.message`;
// for ( $invalue in $xt_dls )
// {
// disconnectAttr defaultLightSet.message $invalue;
// }
//
string $xt_isg[] = `listConnections -s 1 -p 1 initialShadingGroup.message`;
for ( $invalue in $xt_isg )
{
if($invalue != "initialMaterialInfo.shadingGroup")
{
disconnectAttr initialShadingGroup.message $invalue;
}
}
//
// string $xt_ipse[] = `listConnections -s 1 -p 1 initialParticleSE.message`;
// for ( $invalue in $xt_ipse )
// {
// disconnectAttr initialParticleSE.message $invalue;
// }
}
RemoveUnusedLightLinkers;
connectAttr -f initialShadingGroup.message lightLinker1.link[0].object;
connectAttr -f initialShadingGroup.message lightLinker1.shadowLink[0].shadowObject;
//
//
//
print ("//LightLinks Fixed :)");

CGTalk Moderation
09-23-2007, 10:56 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.