Created
November 27, 2015 01:16
-
-
Save whaison/662d5324068c2ef9591c to your computer and use it in GitHub Desktop.
SelectMaterialName_boxed_png24_InputNodeFrameDataFind6vu_global.mel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//select -r nurbsSphere1 ; | |
select `ls `; | |
hyperShade -smn; | |
string $materialNameStr[]; | |
$materialNameStr= `ls -sl`; | |
//$materialNameStr =`ls -long`; | |
print("\n $materialNameStr="); | |
print($materialNameStr); | |
string $materialNameStr0=$materialNameStr[0]; | |
print("\n $materialNameStr0="); | |
print($materialNameStr0); | |
//boxed_png24 | |
// | |
//print("\n"); | |
//print("\n"); | |
//print("\n"); | |
string $materialnodenameArr[]; | |
$materialnodenameArr=`listHistory $materialNameStr0`; | |
print("\n $materialnodenameArr="); | |
print($materialnodenameArr); | |
//select -cl ; | |
//select -r sd_50110_olivia1:sd_50110_olivia_mat1P2D ; | |
//setAttr "sd_50110_olivia1:sd_50110_olivia_mat1P2D.offsetV" 0.4; | |
//keyframe -index 2 -absolute -valueChange 0.4 sd_50110_olivia_mat1P2D_offsetV ; | |
string $offsetSetNameStr=$materialnodenameArr[1]; | |
print("\n $offsetSetNameStr=");//sd_50110_olivia1:sd_50110_olivia_mat1F | |
print($offsetSetNameStr); | |
string $offsetSetKeyFrameNameStr=$materialnodenameArr[2]; | |
print("\n $offsetSetKeyFrameNameStr=");//sd_50110_olivia1:sd_50110_olivia_mat1P2D | |
print($offsetSetKeyFrameNameStr); | |
int $u_have=0; | |
int $v_have=0; | |
for($material_att in $materialnodenameArr) | |
{ | |
string $resultStrArr[]; | |
clear $resultStrArr; | |
//tokenize "Maya_Memo_Blog" "_" $result; | |
tokenize $material_att "_" $resultStrArr; | |
for($attstr in $resultStrArr) | |
{ | |
if($attstr=="offsetV"){ | |
$v_have=1; | |
print "\n------------------------------------------offsetV \n"; | |
} | |
if($attstr=="offsetU"){ | |
$u_have=1; | |
print "\n------------------------------------------offsetU \n"; | |
} | |
} | |
} | |
string $evalDeferredStr="showEditor "+$offsetSetKeyFrameNameStr; | |
evalDeferred( $evalDeferredStr); | |
//animCurveTU | |
print ("total Number = " + $size + "\n"); | |
//object_And_Param_To_Select_Key("sd_50110_olivia1:sd_50110_olivia_mat1P2D" ,"offsetV"); | |
if($v_have==1){ | |
object_And_Param_To_Select_Key($offsetSetKeyFrameNameStr ,"offsetV"); | |
} | |
if($u_have==1){ | |
object_And_Param_To_Select_Key($offsetSetKeyFrameNameStr ,"offsetU"); | |
} | |
//////////////////////////////////////////// | |
///////////////////////////////////////////// | |
///////////////////////////////////////////// | |
//////////////////////////////////////////// | |
//string $myCone[] = `cone`; | |
//setKeyframe -time 0 -time 5 -time 10 -attribute tx -v 5 $myCone[0]; | |
//setKeyframe -time 2 -time 7 -time 12 -attribute ty -v 10 $myCone[0]; | |
//setKeyframe -time 4 -time 9 -time 14 -attribute tz -v 15 $myCone[0]; | |
//selectKey -time 5 -time 12 -time 4; | |
//selectKey -animation objects -add -time 14; | |
string $output_key_Propaty_string;//ここの外部グローバル変数にアクセスしたい。 | |
string $output_keyTimes_string;//ここの外部グローバル変数にアクセスしたい。 | |
string $output_keyframe_value_string;//ここの外部グローバル変数にアクセスしたい。 | |
proc object_And_Param_To_Select_Key(string $object ,string $param) { | |
global string $output_key_Propaty_string;//外部グローバルの変数とってくる。 | |
$output_key_Propaty_string = ""; | |
global string $output_keyTimes_string;//外部グローバルの変数とってくる。 | |
$output_keyTimes_string = ""; | |
global string $output_keyframe_value_string;//外部グローバルの変数とってくる。 | |
$output_keyframe_value_string = ""; | |
selectKey -add -attribute $param $object; | |
string $sameValueBool=true; | |
float $keyTimes[]; | |
string $nodes[] = `keyframe -query -name $object`; | |
for( $node in $nodes ) { | |
$keyTimes = `keyframe -selected -query -tc $node`; | |
string $printData=""; | |
for( $time in $keyTimes ) { | |
$printData=$printData+ $time + " " ; | |
$output_keyTimes_string=$output_keyTimes_string+$time+","; | |
} | |
if($printData!=""){ | |
$output_key_Propaty_string=$param+","; | |
print( "\n ----- $output_key_Propaty_string="+$output_key_Propaty_string +"\n"); | |
print($node + ": "); | |
print($printData); | |
print "\n"; | |
print( "\n ----- output_keyTimes_string="+$output_keyTimes_string +"\n"); | |
} | |
float $timeData[]; | |
$timeData =`keyframe -selected -query -valueChange $node`; | |
$sameValueBool=true; | |
float $firstData=$timeData[0]; | |
for($i=0;$i<size($timeData);$i++) { | |
if($firstData==$timeData[$i]){ | |
}else{ | |
$sameValueBool=false; | |
} | |
print("timeData="+ $timeData[$i] + " " ); | |
$output_keyframe_value_string=$output_keyframe_value_string+$timeData[$i]+","; | |
} | |
print( "\n ----- output_keyframe_value_string="+$output_keyframe_value_string +"\n"); | |
} | |
print (" $sameValueBool="+$sameValueBool); | |
if($sameValueBool==true) | |
{ | |
print(" 消せます!!!!"); | |
} | |
print("\n"); | |
if($sameValueBool==true) | |
{ | |
$keyTimes = `keyframe -selected -query -tc $node`; | |
string $printData=""; | |
string $first_time; | |
string $end_time; | |
for( $time in $keyTimes ) { | |
$printData=$printData+ $time + " " ; | |
} | |
if($printData!=""){ | |
print($node + ": "); | |
print($printData); | |
print "\n"; | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment