بالفعل لا تنسي تعديل قيمة ال Gamma في الصور كلها.
استعمل هذا السكربت
mr_texture_gamma_correct.mel
حمل من هنا
mr_texture_gamma_correct.mel
او احظ ما ارفقته في الادني كملف الmel
استعمل هذا السكربت
mr_texture_gamma_correct.mel
حمل من هنا
mr_texture_gamma_correct.mel
او احظ ما ارفقته في الادني كملف الmel
/* 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);
}
// 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);
}
تعليق