السلام عليكم
اطرح بين ايديكم هذا الموضوع لكي نشارك بعضنا و لكي تعم الفائدة للجميع ..
وهو كل واحد بيستخدم سكريبتات معينة يضعها هنا حتى نتعرف على السكريبتات المفيدة
و حتى تعم الفائدة للجميع
سأبدأ أنا بوضع سكريبت يمكن موجود عند المعظم ..
و هو gamma update
يقوم بعمل ابديت للجاما بشكل اوتوماتيكي لجميع الخامات عند استخدم ال
mia sun and sky
وهو يوفر الكثير من الوقت
تقوم بعمل زرين على الشلف .. الاول بيفعل هذا السكريبت ..
/* TOI Gamma Tool */
// revision 0.6 - january 2008;
// author(s): S. Mulders & T. Welman
//
// Usage: Source the script and start with toi_gamma();
global proc toi_gamma() {
if ( `window -exists toi_gamma_window` ) {
deleteUI toi_gamma_window;
} else {
window -t "TOI Texture Gamma Tool" -w 220 -h 260 -retain toi_gamma_window;
columnLayout -adj 1 -rs 6 -w 290 toi_gamma_mainCol;
floatFieldGrp -l "Gamma:" -v1 2.2 -nf 1 toi_gammaValue;
button -l "Update All textures" -c "toi_gamma_update_all()";
button -l "Update Selected textures" -c "toi_gamma_update_selected()";
button -l "Remove from All textures" -c "toi_gamma_remove_all()";
button -l "Remove from Selected textures" -c "toi_gamma_remove_selected()";
showWindow toi_gamma_window;
}
}
global proc toi_gamma_update_all () {
string $nodes[] = `ls -mat`;
float $gamma = `floatFieldGrp -q -v1 toi_gammaValue`;
toi_fixGamma( $gamma, $nodes );
}
global proc toi_gamma_update_selected () {
string $nodes[] = `ls -sl -mat`;
float $gamma = `floatFieldGrp -q -v1 toi_gammaValue`;
toi_fixGamma( $gamma, $nodes );
}
global proc toi_gamma_remove_all () {
string $nodes[] = `ls -mat`;
toi_removeGamma( $nodes );
}
global proc toi_gamma_remove_selected () {
string $nodes[] = `ls -sl -mat`;
toi_removeGamma( $nodes );
}
global proc toi_removeGamma( string $nodes[] ) {
string $nodetype,$connected[],$gammaNode,$fileNode;
//execute the convert options for each shader
for ($shader in $nodes) {
$nodetype = `objectType $shader`;
if ( $nodetype == "mia_material" || $nodetype == "mia_material_x" ) {
if (`connectionInfo -isDestination ($shader+".diffuse")`) {
$connected = `listConnections ($shader+".diffuse")`;
if ( `objectType $connected[0]` == "gammaCorrect" ) {
$gammaNode = $connected[0];
$connected = `listConnections ($gammaNode+".value")`;
$fileNode = $connected[0];
// remove the node and connect de file node directly
connectAttribute ($shader,"diffuse",$fileNode,"outColor");
delete $gammaNode;
}
}
} else if ( $nodetype == "lambert" || $nodetype == "blinn" || $nodetype == "phong" || $nodetype == "phongE" ) {
if (`connectionInfo -isDestination ($shader+".color")`) {
$connected = `listConnections ($shader+".color")`;
if ( `objectType $connected[0]` == "gammaCorrect" ) {
$gammaNode = $connected[0];
$connected = `listConnections ($gammaNode+".value")`;
$fileNode = $connected[0];
// remove the node and connect de file node directly
connectAttribute ($shader,"color",$fileNode,"outColor");
delete $gammaNode;
}
}
}
}
}
global proc toi_fixGamma( float $gamma, string $nodes[] ) {
string $nodetype,$gammaNode;
float $gammaValue = (float(1)/$gamma);
//execute the convert options for each shader
for ($shader in $nodes) {
$nodetype = `objectType $shader`;
if ( $nodetype == "mia_material" || $nodetype == "mia_material_x" ) {
if (`connectionInfo -isDestination ($shader+".diffuse")`) {
$connected = `listConnections ($shader+".diffuse")`;
if ( `objectType $connected[0]` == "gammaCorrect" ) {
$gammaNode = $connected[0];
} else {
// create the node and connect it
$gammaNode = `shadingNode -asUtility gammaCorrect`;
connectAttribute ($gammaNode,"value",$connected[0],"outColor");
connectAttribute ($shader,"diffuse",$gammaNode,"outValue");
}
// set the gamma
setAttr ($gammaNode + ".gammaX") $gammaValue ;
setAttr ($gammaNode + ".gammaY") $gammaValue ;
setAttr ($gammaNode + ".gammaZ") $gammaValue ;
}
} else if ( $nodetype == "lambert" || $nodetype == "blinn" || $nodetype == "phong" || $nodetype == "phongE" ) {
if (`connectionInfo -isDestination ($shader+".color")`) {
$connected = `listConnections ($shader+".color")`;
if ( `objectType $connected[0]` == "gammaCorrect" ) {
$gammaNode = $connected[0];
} else {
// create the node and connect it
$gammaNode = `shadingNode -asUtility gammaCorrect`;
connectAttribute ($gammaNode,"value",$connected[0],"outColor");
connectAttribute ($shader,"color",$gammaNode,"outValue");
}
// set the gamma
setAttr ($gammaNode + ".gammaX") $gammaValue ;
setAttr ($gammaNode + ".gammaY") $gammaValue ;
setAttr ($gammaNode + ".gammaZ") $gammaValue ;
}
}
}
}
// Set Attribute procedure
global proc setAttribute(string $shader,string $attribute, float $value[], string $type) {
switch($type) {
case "double3":
setAttr ($shader+"."+$attribute) -type double3 $value[0] $value[1] $value[2];
break;
case "float":
setAttr ($shader+"."+$attribute) $value[0];
break;
}
}
// Connect Attribute procedure
global proc connectAttribute (string $srcShader, string $srcAttr, string $destShader,string $destAttr) {
connectAttr -force ($destShader+"."+$destAttr) ($srcShader+"."+$srcAttr);
}
و الثاني بيفعل هذا
toi_gamma()
و بعد تفعيل الثاني بتفتح نافذة فيها خيارات update gamma >>>
,من ثم الامر واضح
هذي ايقونات عملتها للسكريبت الاول و الثاني
اطرح بين ايديكم هذا الموضوع لكي نشارك بعضنا و لكي تعم الفائدة للجميع ..
وهو كل واحد بيستخدم سكريبتات معينة يضعها هنا حتى نتعرف على السكريبتات المفيدة
و حتى تعم الفائدة للجميع
سأبدأ أنا بوضع سكريبت يمكن موجود عند المعظم ..
و هو gamma update
يقوم بعمل ابديت للجاما بشكل اوتوماتيكي لجميع الخامات عند استخدم ال
mia sun and sky
وهو يوفر الكثير من الوقت
تقوم بعمل زرين على الشلف .. الاول بيفعل هذا السكريبت ..
/* TOI Gamma Tool */
// revision 0.6 - january 2008;
// author(s): S. Mulders & T. Welman
//
// Usage: Source the script and start with toi_gamma();
global proc toi_gamma() {
if ( `window -exists toi_gamma_window` ) {
deleteUI toi_gamma_window;
} else {
window -t "TOI Texture Gamma Tool" -w 220 -h 260 -retain toi_gamma_window;
columnLayout -adj 1 -rs 6 -w 290 toi_gamma_mainCol;
floatFieldGrp -l "Gamma:" -v1 2.2 -nf 1 toi_gammaValue;
button -l "Update All textures" -c "toi_gamma_update_all()";
button -l "Update Selected textures" -c "toi_gamma_update_selected()";
button -l "Remove from All textures" -c "toi_gamma_remove_all()";
button -l "Remove from Selected textures" -c "toi_gamma_remove_selected()";
showWindow toi_gamma_window;
}
}
global proc toi_gamma_update_all () {
string $nodes[] = `ls -mat`;
float $gamma = `floatFieldGrp -q -v1 toi_gammaValue`;
toi_fixGamma( $gamma, $nodes );
}
global proc toi_gamma_update_selected () {
string $nodes[] = `ls -sl -mat`;
float $gamma = `floatFieldGrp -q -v1 toi_gammaValue`;
toi_fixGamma( $gamma, $nodes );
}
global proc toi_gamma_remove_all () {
string $nodes[] = `ls -mat`;
toi_removeGamma( $nodes );
}
global proc toi_gamma_remove_selected () {
string $nodes[] = `ls -sl -mat`;
toi_removeGamma( $nodes );
}
global proc toi_removeGamma( string $nodes[] ) {
string $nodetype,$connected[],$gammaNode,$fileNode;
//execute the convert options for each shader
for ($shader in $nodes) {
$nodetype = `objectType $shader`;
if ( $nodetype == "mia_material" || $nodetype == "mia_material_x" ) {
if (`connectionInfo -isDestination ($shader+".diffuse")`) {
$connected = `listConnections ($shader+".diffuse")`;
if ( `objectType $connected[0]` == "gammaCorrect" ) {
$gammaNode = $connected[0];
$connected = `listConnections ($gammaNode+".value")`;
$fileNode = $connected[0];
// remove the node and connect de file node directly
connectAttribute ($shader,"diffuse",$fileNode,"outColor");
delete $gammaNode;
}
}
} else if ( $nodetype == "lambert" || $nodetype == "blinn" || $nodetype == "phong" || $nodetype == "phongE" ) {
if (`connectionInfo -isDestination ($shader+".color")`) {
$connected = `listConnections ($shader+".color")`;
if ( `objectType $connected[0]` == "gammaCorrect" ) {
$gammaNode = $connected[0];
$connected = `listConnections ($gammaNode+".value")`;
$fileNode = $connected[0];
// remove the node and connect de file node directly
connectAttribute ($shader,"color",$fileNode,"outColor");
delete $gammaNode;
}
}
}
}
}
global proc toi_fixGamma( float $gamma, string $nodes[] ) {
string $nodetype,$gammaNode;
float $gammaValue = (float(1)/$gamma);
//execute the convert options for each shader
for ($shader in $nodes) {
$nodetype = `objectType $shader`;
if ( $nodetype == "mia_material" || $nodetype == "mia_material_x" ) {
if (`connectionInfo -isDestination ($shader+".diffuse")`) {
$connected = `listConnections ($shader+".diffuse")`;
if ( `objectType $connected[0]` == "gammaCorrect" ) {
$gammaNode = $connected[0];
} else {
// create the node and connect it
$gammaNode = `shadingNode -asUtility gammaCorrect`;
connectAttribute ($gammaNode,"value",$connected[0],"outColor");
connectAttribute ($shader,"diffuse",$gammaNode,"outValue");
}
// set the gamma
setAttr ($gammaNode + ".gammaX") $gammaValue ;
setAttr ($gammaNode + ".gammaY") $gammaValue ;
setAttr ($gammaNode + ".gammaZ") $gammaValue ;
}
} else if ( $nodetype == "lambert" || $nodetype == "blinn" || $nodetype == "phong" || $nodetype == "phongE" ) {
if (`connectionInfo -isDestination ($shader+".color")`) {
$connected = `listConnections ($shader+".color")`;
if ( `objectType $connected[0]` == "gammaCorrect" ) {
$gammaNode = $connected[0];
} else {
// create the node and connect it
$gammaNode = `shadingNode -asUtility gammaCorrect`;
connectAttribute ($gammaNode,"value",$connected[0],"outColor");
connectAttribute ($shader,"color",$gammaNode,"outValue");
}
// set the gamma
setAttr ($gammaNode + ".gammaX") $gammaValue ;
setAttr ($gammaNode + ".gammaY") $gammaValue ;
setAttr ($gammaNode + ".gammaZ") $gammaValue ;
}
}
}
}
// Set Attribute procedure
global proc setAttribute(string $shader,string $attribute, float $value[], string $type) {
switch($type) {
case "double3":
setAttr ($shader+"."+$attribute) -type double3 $value[0] $value[1] $value[2];
break;
case "float":
setAttr ($shader+"."+$attribute) $value[0];
break;
}
}
// Connect Attribute procedure
global proc connectAttribute (string $srcShader, string $srcAttr, string $destShader,string $destAttr) {
connectAttr -force ($destShader+"."+$destAttr) ($srcShader+"."+$srcAttr);
}
و الثاني بيفعل هذا
toi_gamma()
و بعد تفعيل الثاني بتفتح نافذة فيها خيارات update gamma >>>
,من ثم الامر واضح
هذي ايقونات عملتها للسكريبت الاول و الثاني
تعليق