| |||||||
| New! Use your Facebook, Google, AIM & Yahoo accounts to securely log into this site, click logo to login | |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| PixelHunterDeluX3 | Mel Scripting Problem .. Basic.. Hi, I want to write a script that does basically the following -> ----------------------------------------------------------------------- 1) Save names of all selected Materials into a array <- Completed... 2) While through all the Names and set a couple of attributes to layer override and specific values ----------------------------------------------------------------------- My Script until now : string $materials[] = ` ls -selection -materials ` ; int $nrofmats = size($materials); int $i=0; string $command; while ( $i <= $nrofmats-1 ) { //$commmand = $materials[$i]+".color"; //print($command); //setAttr $materials[$i]+".color" -type "double3" 1 1 1 ; $i++; } Looks quite bare .. it is in fact ;) . Ok my Problem is , how do i access the data ? In C++ ( god bless it ... ) i would only have to dereference from my pointer to the data in the structure like material->color . Ok, mel is not as "complicated" (haha good one .. ) so, instead i want to print each name of the array into the string command and add a .color to it ... Pretty basic. How do i do it ? if i do $command = $material[$i]+."color"; and print out the command its = " " empty... Please help me with this one. Or tell me how i can navigate through all the selected material nodes and access theyr attributes.. The commands i need to perform are theese : //Layer Overrides editRenderLayerAdjustment $materials[$i].color ; editRenderLayerAdjustment $materials[$i].diffuse ; editRenderLayerAdjustment $materials[$i].eccentricity ; editRenderLayerAdjustment $materials[$i].specularRollOff ; editRenderLayerAdjustment $materials[$i].reflectivity ; editRenderLayerAdjustment $materials[$i].specularColor ; //Shader Adjustments. setAttr $materials[$i].diffuse 1 ; setAttr $materials[$i].eccentricity 0 ; setAttr $materials[$i].specularRollOff 0 ; setAttr $materials[$i].specularColor -type double3 1 1 1 ; setAttr $materials[$i].reflectivity 0 ; setAttr $materials[$i].color -type double3 1 1 1 ; $i++ ; The Whole Point with this is ( just in case youre wondering what the heck im doing ;) ) i want to automatise the creation of render layer settings, i have 24 shaders, and sincerely, until now Mel s got me crazy.. so i did it by hand, but this is the type of sily easy task wich programming can do better and faster than my hand and mouse ;) . Thank you for the help ! ![]() Regards . TekniX |
| | |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |







