PDA

View Full Version : "Delete lightLinker" script?


Throbberwocky
10-27-2004, 10:22 AM
Hi,

is it possible to write a script (or does already one exist) which is able to delete unneeded lightLinker info in your scene?

When you do a lot of inporting and exporting in your scene, that scene is getting bigger quite fast and much worse to handle over time because it is claddered with unneeded lightLinker info. You could manually delete it by saving the scene as a MayaAscii file and editing it with a text editor but this is kinda annoying.

So I am thankful for any help or advice :)
Gumbo YaYa

X-Tender
10-27-2004, 10:42 AM
i'am not real sure know what you mean .. but could you maybe upload an example file and tell which lightlin kis useless? .. then i could try to to build the script for you =o) ..

mhovland
10-27-2004, 03:02 PM
Try the script I posted in this thread. It will clean your scene of all unused nodes. Make sure you save a backup copy first, the script will automatically save a backup for you, but strange behavior has happened in the past, where the .BAK file is created in the root od C:\ and is named "_BAK.mb", instead of saving it in the current scenes location and named <yourscene_BAK.mb>. Just so you know. Hope it helps you out.

http://www.cgtalk.com/showthread.php?t=151243

Throbberwocky
10-28-2004, 04:18 PM
mhovland: Nice script! It's a good addition to "Optimize scene". But unfortunately it didn't solve my problem with that lightLinker info.

X-Tender: Here is an example of the code I am talking about. You can usually find it in the lower part of MayaAscii files which were a lot imported and exported:

connectAttr ":defaultLightSet.msg" "lightLinker1.lnk[0].llnk";
connectAttr ":initialShadingGroup.msg" "lightLinker1.lnk[0].olnk";
connectAttr ":defaultLightSet.msg" "lightLinker1.lnk[1].llnk";
connectAttr ":initialParticleSE.msg" "lightLinker1.lnk[1].olnk";
connectAttr ":initialShadingGroup.msg" "lightLinker1.lnk[5].llnk";
connectAttr ":initialParticleSE.msg" "lightLinker1.lnk[5].olnk";
connectAttr ":initialShadingGroup.msg" "lightLinker1.lnk[6].llnk";
connectAttr ":initialParticleSE.msg" "lightLinker1.lnk[6].olnk";
connectAttr ":initialShadingGroup.msg" "lightLinker1.lnk[7].llnk";
connectAttr ":initialParticleSE.msg" "lightLinker1.lnk[7].olnk";
connectAttr ":initialShadingGroup.msg" "lightLinker1.lnk[8].llnk";
connectAttr ":initialParticleSE.msg" "lightLinker1.lnk[8].olnk";
connectAttr ":initialShadingGroup.msg" "lightLinker1.lnk[11].llnk";
connectAttr ":initialParticleSE.msg" "lightLinker1.lnk[11].olnk";
connectAttr ":initialShadingGroup.msg" "lightLinker1.lnk[18].llnk";
connectAttr ":initialParticleSE.msg" "lightLinker1.lnk[18].olnk";
connectAttr ":initialShadingGroup.msg" "lightLinker1.lnk[19].llnk";
connectAttr ":initialParticleSE.msg" "lightLinker1.lnk[19].olnk";
connectAttr ":initialShadingGroup.msg" "lightLinker1.lnk[20].llnk";
connectAttr ":initialParticleSE.msg" "lightLinker1.lnk[20].olnk";
...
...
...
connectAttr ":initialShadingGroup.msg" "lightLinker1.lnk[10116].llnk";
connectAttr ":initialParticleSE.msg" "lightLinker1.lnk[10116].olnk";
connectAttr ":initialShadingGroup.msg" "lightLinker1.lnk[10117].llnk";
connectAttr ":initialParticleSE.msg" "lightLinker1.lnk[10117].olnk";
connectAttr ":initialShadingGroup.msg" "lightLinker1.lnk[10118].llnk";
connectAttr ":initialParticleSE.msg" "lightLinker1.lnk[10118].olnk";
connectAttr ":initialShadingGroup.msg" "lightLinker1.lnk[10119].llnk";
connectAttr ":initialParticleSE.msg" "lightLinker1.lnk[10119].olnk";
connectAttr ":initialShadingGroup.msg" "lightLinker1.lnk[10120].llnk";
connectAttr ":initialParticleSE.msg" "lightLinker1.lnk[10120].olnk";
connectAttr ":initialShadingGroup.msg" "lightLinker1.lnk[10121].llnk";
connectAttr ":initialParticleSE.msg" "lightLinker1.lnk[10121].olnk";
connectAttr ":initialShadingGroup.msg" "lightLinker1.lnk[10122].llnk";
connectAttr ":initialParticleSE.msg" "lightLinker1.lnk[10122].olnk";
connectAttr ":initialShadingGroup.msg" "lightLinker1.lnk[10123].llnk";
connectAttr ":initialParticleSE.msg" "lightLinker1.lnk[10123].olnk";
connectAttr ":initialShadingGroup.msg" "lightLinker1.lnk[10124].llnk";
connectAttr ":initialParticleSE.msg" "lightLinker1.lnk[10124].olnk";

I truncated the list in the middle cause it is REALLY long! And that's why it is not necessary at all and I want it to be deleted prefereably automatically.

What is the purpose of those lightLinkers by the way? Where do they come from and why aren't they deleted by the "Optimize scene" command?

X-Tender
10-29-2004, 10:49 AM
try this one =o) ...


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

CGTalk Moderation
01-19-2006, 04:00 PM
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.