skinWeight Mesh Combine
mesh> combine option
MELだと
string $combine[] = `polyUniteSkinned -constructionHistory 0 -mergeUVSets 1`;
参考URL
https://help.autodesk.com/cloudhelp/2023/JPN/Maya-Tech-Docs/Commands/polyUniteSkinned.html
skinWeight Mesh Combine
mesh> combine option
MELだと
string $combine[] = `polyUniteSkinned -constructionHistory 0 -mergeUVSets 1`;
参考URL
https://help.autodesk.com/cloudhelp/2023/JPN/Maya-Tech-Docs/Commands/polyUniteSkinned.html
[maya][mel] Check if a file is read-only in MEL.
global proc MEL_FileReadModeCheck(string $Save_path){
//MELでファイルの読み取り専用をチェックする。
print("MEL_FileReadModeCheck("+$Save_path+") \n");
python("import os");
int $FileReadOnlybool = python("os.access('"+$Save_path+"', os.W_OK)");
print("$FileReadOnlybool= "+$FileReadOnlybool+" \n");
if($FileReadOnlybool==0){
print("読み取り専用 のため書き込み不可 \n");
}else{
print("書き込み出来ます \n");
}
}
MEL_FileReadModeCheck("D:/check_ON.txt");
MEL_FileReadModeCheck("D:/check_OFF.txt");
maya mel get mesh from material
hyperShade -objects materialName;
//結果のmeshは選択される
Function
global proc string get_MeshTransform_from_Material_v2(string $mat){
string $selected[];
//選択を取っておく
$selected =`ls -sl`;
string $mesh_arr[];
//$mesh_arr =`hyperShade -objects $mat`;
//結果のmeshは選択されるので
hyperShade -objects $mat;
//選択からとる
$mesh_arr =`ls -sl`;
int $mesh_arr_len=size($mesh_arr);
string $returnStr;
print("$mesh_arr_len= "+$mesh_arr_len+"\n");
if($mesh_arr_len==0){
$returnStr="";
}else{
print("$mesh_arr= "+ stringArrayToString($mesh_arr, ", ") +"\n");
string $mesh= $mesh_arr[0];
string $trans_arr[] = `listRelatives -noIntermediate -fullPath -parent $mesh`;
print("$trans_arr= "+ stringArrayToString($trans_arr, ", ") +"\n");
$returnStr=$trans_arr[0];
}
//選択を戻す
select -cl;
string $sel;
for($sel in $selected){
select -add $sel;
};
return $returnStr;
}
get SkinCluster from mesh
string $SkinSkinCluster = `findRelatedSkinCluster $mesh`;
応用例
print(">>>>>>>>>>>>>SkinWeightCheck Start>>>>>>>>>>\n");
select "|parts_low";
string $selected[] = `ls -sl -long -absoluteName`;
string $selectedStr = stringArrayToString($selected, ","); // ","を区切り文字として結合する
print("SkinWeightCheckの 選択したもの $selected= "+$selectedStr+"\n");
string $mesh[];
for ($sel in $selected) {
string $allMesh[] = `listRelatives -ni -pa -ad -typ "mesh" $sel`;
for ($am in $allMesh) {
string $trans[] = `listRelatives -ni -pa -p $am`;
$mesh[size($mesh)] = $trans[0];
}
}
$mesh = stringArrayRemoveDuplicates($mesh);
string $meshStr = stringArrayToString($mesh, ","); // ","を区切り文字として結合する
print("SkinWeightCheckの メッシュのみ選別したもの $mesh= "+$meshStr+"\n");
for ($mesh_i in $mesh){
//print("$mesh_i= "+$mesh_i+"\n");
string $SkinCluster = `findRelatedSkinCluster $mesh_i`;
print("メッシュ : "+$mesh_i+" SkinCluster : "+$SkinCluster+" \n");
//string $influenceJoint[] = `skinCluster -q -influence $mesh_i`;
string $influenceJoint[];
int $inflenceJointBool=0;
if ( catch ($influenceJoint=`skinCluster -q -influence $mesh_i`)) {
print("B ------------------------------------------------------------------------------->>>>>メッシュ : "+$mesh_i+" のインフルエンスジョイントがありません!!NG \n");
$inflenceJointBool=1;
$AllWeightMeshBool=1;
}else{
print("A OK \n");
$inflenceJointBool=0;
}
int $WeightMeshBool=0;
if($inflenceJointBool==0){
print("メッシュ : "+$mesh_i+" influenceJoint : "+$influenceJoint[0]+" \n");
//vtx[100] の joint1 の weight を取得
//skinPercent( 'skinCluster1', 'pPlane1.vtx[100]', t='joint1', query=True, value=True)
//string $weight[] = `skinPercent -query -value -t $influence[0] $SkinCluster $mesh `;
string $vertex = $mesh_i+".vtx[0]" ;
//string $weight[] = `skinPercent -query -value $vertex $SkinCluster`;
float $weightFloatArr[] = `skinPercent -query -value $SkinCluster $vertex`;
print("$weightFloatArr= "+floatArrayToString($weightFloatArr, ", ")+"\n");
//skinPercent -query -value skinCluster1 pPlane1.vtx[100];
float $weightAll=0;
for ($val in $weightFloatArr){
$weightAll=$weightAll + $val;
}
print("$weightAll= "+$weightAll+"\n");
if($weightAll>0){
print("SkinWeight OK !!! $mesh_i= "+$mesh_i+" OK!!!!!\n");
}else{
$WeightMeshBool=1;
print("SkinWeight -----------------------------------------------------------スキンウェイトがありません--Attention !!! $mesh_i= "+$mesh_i+" NG!!!!!\n");
}
$AllWeightMeshBool=$AllWeightMeshBool+$WeightMeshBool;
}
}//for
参考
[maya][python] findRelatedskinCLuster
https://discourse.techart.online/t/maya-python-findrelatedskincluster/2673
あるようで知らない特殊な複製。
// 選択したノードに至る上流ノード (およびその接続) も複製されます。
// スキンウェイトなどもコピーされます。
duplicate -upstreamNodes;
上記の場合
duplicate -returnRootsOnly -upstreamNodes;
group root1 parts_low1;
カスタムした例
global proc skinWeightCopy_JointMeshGroup(){
//選択
select root parts_low;
//スキンウェイトモデルのスキンウェイトごとコピー
duplicate -returnRootsOnly -upstreamNodes;
//グループ化
group -name "group_dup" root1 parts_low1;
//元の名前にリネーム
rename "group_dup|root1" "root";
rename "group_dup|parts_low1" "parts_low";
}
skinWeightCopy_JointMeshGroup();
combine しながらエクスポート
global proc skinWeightCopy_JointMeshGroup(){
//選択
select "|root" "|parts_low";
//スキンウェイトモデルのスキンウェイトごとコピー
duplicate -returnRootsOnly -upstreamNodes;
//グループ化
group -name "group_dup" root1 parts_low1;
//元の名前にリネーム
rename "group_dup|root1" "root";
rename "group_dup|parts_low1" "parts_low";
}
global proc group_dup_parts_low_combine(){
string $selected[] = `ls -sl -long -absoluteName`;
//string $selectedStr = stringArrayToString($selected, ","); // ","を区切り文字として結合する
//print("選択したもの $selected= "+$selectedStr+"\n");
string $mesh[];
for ($sel in $selected) {
string $allMesh[] = `listRelatives -ni -pa -ad -typ "mesh" $sel`;
for ($am in $allMesh) {
string $trans[] = `listRelatives -ni -pa -p $am`;
$mesh[size($mesh)] = $trans[0];
}
}
$mesh = stringArrayRemoveDuplicates($mesh);
string $meshStr = stringArrayToString($mesh, ","); // ","を区切り文字として結合する
print(" メッシュのみ選別したもの $mesh= "+$meshStr+"\n");
select -r $mesh; // <メッシュのみ選択
// Combine実行
// Skeletalだった場合
string $combine[] = `polyUniteSkinned -ch 0 -muv 1`;
rename $combine[0] "MeshGP";
//よけておくグループ化
select "|root" "parts_low";
string $group_root;
$group_root =`group -world -name "group_root"`;
//MeshGPをparts_lowへ入れる
select "MeshGP";
string $group_parts_low;
$group_parts_low =`group -world -name "parts_low"`;
//worldへ移動
parent -world "group_dup|root";
//出力用選択
select "|root" "|parts_low";
// Export
// --------------------------------------------------------------------------
simple_model_common_Export(2, "D:/MOSADesign/WorkData/Avatar/008/001/PL_008_001_001/Game/SK_PL_008_001_001_Body.fbx", 0);
//おかたずけ partslow|MeshGP rootを削除
delete "|parts_low" "|root" "|group_dup";
//worldへ移動
parent -world "group_root|root";
//worldへ移動
parent -world "group_root|parts_low";
//group_root 削除
delete "|group_root";
}
// Export
//--------------------------------------------------------------------------
global proc simple_model_common_Export(int $type, string $expName, int $modelType) {
showHidden -a;
// if($type == 2) {
if ($type == 1) {
FBXExportSmoothMesh -v 0;
} else {
FBXExportSmoothMesh -v 1;
}
FBXExportAnimationOnly -v 0;
FBXExportInAscii -v 0 ;
FBXExportConvertUnitString cm;
FBXExportTriangulate -v 0;
FBXExportSmoothingGroups -v 1;
FBXExportConstraints -v 0;
FBXExport -f $expName -s;
}
参考URL
https://help.autodesk.com/cloudhelp/2025/ENU/Maya-Tech-Docs/Commands/duplicate.html
http://me.autodesk.jp/wam/maya/docs/Maya2010/Commands/duplicate.html
Meshグループに無数にMeshがはいっててスキンウェイトをコピーするのがめんどくさくなったから書いたよ
Aのメッシュグループから
Bのメッシュグループにコピーしていく
動作はちょっと逆で
Bのグループのメッシュ名をループして
Aのグループのメッシュ名にあるか探す
あったらスキンウェイトコピー
なかったらrejectedリストに入れてます。
最後にrejectedListを表示するのでスキンウェイトしなかったメッシュのリストが出ます。
// SkinWeightCopy First Select MeshGroup to Second Select MeshGroup
string $selectedArrFUllPath[] = `ls -long -sl`;
print($selectedArrFUllPath);
string $FirstSelect=$selectedArrFUllPath[0];
string $SecondSelect=$selectedArrFUllPath[1];
string $rejectArr[];
string $inputNodes[] = `ls -type transform -long -dag $FirstSelect`;
string $destNodes[] = `ls -type transform -long -dag $SecondSelect`;
$inputNodeslong=size($inputNodes);
$destNodeslong=size($destNodes);
string $buffer[];
string $buffer_i[];
$finded = 0;
for($d = 0; $d <$destNodeslong;$d++){
string $destNode_name=$destNodes[$d];
if($destNode_name==$SecondSelect){
}else{
print("$destNode_name= "+$destNode_name+"\n");
$numTokens = `tokenize $destNode_name "|" $buffer`;
$bufferlong=size($buffer);
string $destNode_name_Short = $buffer[$bufferlong-1]+"";
print("$destNode_name_Short= "+$destNode_name_Short+"\n");
$finded = 0;
for($i = 0; $i <$inputNodeslong;$i++){
string $inputNode_name=$inputNodes[$i];
$numTokens_i = `tokenize $inputNode_name "|" $buffer_i`;
$bufferlong_i=size($buffer_i);
string $inputNode_name_Short = $buffer_i[$bufferlong_i-1]+"";
print("$inputNode_name_Short= "+$inputNode_name_Short+"\n");
//$index=`gmatch $inputNode_name $destNode_name_Short`;
//if($index > 0){
if($inputNode_name_Short==$destNode_name_Short){
//$blendShapeName = $blendshapeRet_name;
print("$destNode_name= "+$destNode_name+" isHit!! "+"\n");
select -r $inputNode_name;
select -add $destNode_name;
copySkinWeights -noMirror -surfaceAssociation closestPoint -influenceAssociation closestJoint;
//copySkinWeights -noMirror -surfaceAssociation closestPoint -influenceAssociation closestJoint -sourceSkin $inputNode_name -destinationSkin $destNode_name;
$finded = 1;
}
}
if($finded==0){
$rejectArr[size($rejectArr)] = $destNode_name;
}
}
}
print("----rejected_list---start"+"\n");
print($rejectArr);
print("----rejected_list---end"+"\n");
select -r $FirstSelect ;
select -add $SecondSelect ;
メッシュグループ内のグループを無視できるように、MeshのTransformだけをフィルターした。
// SkinWeightCopy First Select MeshGroup to Second Select MeshGroup
string $selectedArrFUllPath[] = `ls -long -sl`;
print($selectedArrFUllPath);
string $FirstSelect=$selectedArrFUllPath[0];
string $SecondSelect=$selectedArrFUllPath[1];
string $rejectArr[];
//string $inputNodes[] = `ls -type transform -long -dag $FirstSelect`;
//string $destNodes[] = `ls -type transform -long -dag $SecondSelect`;
string $inputNodes_mesh[] = `ls -type mesh -long -dag $FirstSelect`;
string $destNodes_mesh[] = `ls -type mesh -long -dag $SecondSelect`;
$inputNodes_meshlong=size($inputNodes_mesh);
$destNodes_meshlong=size($destNodes_mesh);
string $inputNodes[];
string $destNodes[];
clear $inputNodes;
clear $destNodes;
string $mesh;
string $parent;
for($d0 = 0; $d0 <$inputNodes_meshlong;$d0++){
$mesh=$inputNodes_mesh[$d0];
string $parentS[] = `listRelatives -parent -path -type transform $mesh`;
$parent=$parentS[0];
$inputNodes[size($inputNodes)] = $parent;
}
for($d0 = 0; $d0 <$destNodes_meshlong;$d0++){
$mesh=$destNodes_mesh[$d0];
string $parentS[] = `listRelatives -parent -path -type transform $mesh`;
$parent=$parentS[0];
$destNodes[size($destNodes)] = $parent;
}
print("$inputNodes= ------------------------------------------------ \n");
print($inputNodes);
print("$destNodes= ------------------------------------------------ \n");
print($destNodes);
$inputNodeslong=size($inputNodes);
$destNodeslong=size($destNodes);
string $buffer[];
string $buffer_i[];
$finded = 0;
for($d = 0; $d <$destNodeslong;$d++){
string $destNode_name=$destNodes[$d];
if($destNode_name==$SecondSelect){
}else{
print("$destNode_name= "+$destNode_name+"\n");
$numTokens = `tokenize $destNode_name "|" $buffer`;
$bufferlong=size($buffer);
string $destNode_name_Short = $buffer[$bufferlong-1]+"";
print("$destNode_name_Short= "+$destNode_name_Short+"\n");
$finded = 0;
for($i = 0; $i <$inputNodeslong;$i++){
string $inputNode_name=$inputNodes[$i];
$numTokens_i = `tokenize $inputNode_name "|" $buffer_i`;
$bufferlong_i=size($buffer_i);
string $inputNode_name_Short = $buffer_i[$bufferlong_i-1]+"";
print("$inputNode_name_Short= "+$inputNode_name_Short+"\n");
//$index=`gmatch $inputNode_name $destNode_name_Short`;
//if($index > 0){
if($inputNode_name_Short==$destNode_name_Short){
//$blendShapeName = $blendshapeRet_name;
print("$destNode_name= "+$destNode_name+" isHit!! "+"\n");
select -r $inputNode_name;
select -add $destNode_name;
copySkinWeights -noMirror -surfaceAssociation closestPoint -influenceAssociation closestJoint;
//copySkinWeights -noMirror -surfaceAssociation closestPoint -influenceAssociation closestJoint -sourceSkin $inputNode_name -destinationSkin $destNode_name;
$finded = 1;
}//if
}//for
if($finded==0){
$rejectArr[size($rejectArr)] = $destNode_name;
}//if
}//if
}//for
print("----rejected_list---start"+"\n");
print($rejectArr);
print("----rejected_list---end"+"\n");
select -r $FirstSelect ;
select -add $SecondSelect ;
maya mel python environment variables list path MAYA_SCRIPT_PATH
MEL
//getenv "MAYA_SCRIPT_PATH";//パスを確認
$sPath=`getenv "PATH"`;
print("$sPath= "+$sPath+"\n");
$sMAYA_SCRIPT_PATH=`getenv "MAYA_SCRIPT_PATH"`;
print("$sMAYA_SCRIPT_PATH= "+$sMAYA_SCRIPT_PATH+"\n");
$array = stringToStringArray($sMAYA_SCRIPT_PATH, ";");
for ($MSP in $array) {
print($MSP+"\n");
}
Python
import os
print("------------------------PATH---------------------------")
ePath = os.environ["PATH"]
ePath_List=ePath.split(";")
for ePath_line in ePath_List:
#for ev in environ:
print(ePath_line)
print("------------------------MAYA_SCRIPT_PATH-----------------------------")
mayaScriptPath = os.environ["MAYA_SCRIPT_PATH"]
mayaScriptPath_List=mayaScriptPath.split(";")
for mayaScriptPath_line in mayaScriptPath_List:
#for ev in environ:
print(mayaScriptPath_line)
このノード状態がキレイなので「bindPose1が一つだけ」キープしながらモデリング編集すること。
Genesis9 やったこと
—————————————-ここからはモデリングとする。——————————————–
Das3D 4.22 のGenesis9を
Maya2022に持ってきて
duplicateでスキンバインド外し=複製して
meshGroupのグループに
・genesis9のまつ毛や口のレイヤーも入れる(skinCluster初めから無いので)
・Marvelous Designerの服レイヤーも入れる
・highheelレイヤーも入れる
highheelの高さにhipとmeshGroupをmoveする。(オプション)
↑高さはBluePrintで変更可能
—————————————-ここまではモデリングとする。——————————————–
新しい方の骨とmeshGroupでバインド
↑ちゃんとしたバインドオプションが重要
cmds.skinBind()引数なしじゃclusterがダメ
genesis9からcopySkinWeightした
モデル編集後ファイル (自分用リンク)」
jennie9_6_v12z_v00122_dupGen9_Kihon.zip
#jennie9_6_v12z_v00122_dupGen9_Kihon__ModelEnd_SkinBindSkinWeight.py
def startSelectionToNewSkinCluster():
selectList=cmds.ls(sl=1,long=1)
print("selectList= "+str(selectList))
# 全部必要だから引数にした
Genesis9 = selectList[0]
Genesis9_Mesh = selectList[1]
Genesis9s = selectList[2]
MeshGroup = selectList[3]
#------------------------------------------------------------------------
ModelEnd_SkinBind(Genesis9s,MeshGroup)
ModelEnd_SkinWeight(Genesis9,Genesis9_Mesh,Genesis9s,MeshGroup)
#------------------------------------------------------------------------
def ModelEnd_SkinBind(Genesis9s,MeshGroup):
cmds.select(Genesis9s,MeshGroup)
#MEL (Script found in: C:/Program Files/Autodesk/Maya2022/scripts/others/newSkinCluster.mel)
#newSkinCluster " -bindMethod 0 -normalizeWeights 1 -weightDistribution 0 -mi 3 -dr 4 -rui false -ihs , multipleBindPose, 0";
#Python でMEL実行
import maya.mel
maya.mel.eval('newSkinCluster " -bindMethod 0 -normalizeWeights 1 -weightDistribution 0 -mi 3 -dr 4 -rui false -ihs , multipleBindPose, 0";')
#Python NG 'maya.cmds' has no attribute 'newSkinCluster' #
#cmds.newSkinCluster(" -bindMethod 0 -normalizeWeights 1 -weightDistribution 0 -mi 3 -dr 4 -rui false -ihs , multipleBindPose, 0")
#import pymel.core as pm #OK
#pm.mel.newSkinCluster(" -bindMethod 0 -normalizeWeights 1 -weightDistribution 0 -mi 3 -dr 4 -rui false -ihs , multipleBindPose, 0")
def ModelEnd_SkinWeight(Genesis9,Genesis9_Mesh,Genesis9s,MeshGroup):
Genesis9_Low_skincluster = Get_SkinCluster(Genesis9_Mesh)
print("Genesis9_Low_skincluster= "+str(Genesis9_Low_skincluster))
MeshList = cmds.listRelatives(MeshGroup,shapes=0,fullPath=1)
print("MeshList= "+str(MeshList))
for closet_mesh in MeshList:
closet_skinCluster = Get_SkinCluster(closet_mesh)
print("closet_skinCluster= "+str(closet_skinCluster))
# 元のスキンクラスターを服のスキンクラスターへコピースキンウェイト
cmds.copySkinWeights(
sourceSkin = Genesis9_Low_skincluster,
destinationSkin = closet_skinCluster,
noMirror=True,
influenceAssociation="oneToOne",
surfaceAssociation="closestPoint"
)
def Get_SkinCluster(LowMeshTransformLong):
# トランスフォームのシェイプノードを取得
shapeList = cmds.listRelatives(LowMeshTransformLong, shapes=True, noIntermediate=True,fullPath=True)
#print("shapeList= "+str(shapeList))
# lowのヒストリーを取得し、スキンクラスターのみ取得
historyList = cmds.listHistory(shapeList[0], pruneDagObjects=True, interestLevel=2)
#print("historyList= "+str(historyList))
skinclusterList = cmds.ls(historyList, type="skinCluster")
#print("skinclusterList= "+str(skinclusterList))
skincluster = skinclusterList[0]
#print("skincluster= "+str(skincluster))
return skincluster
startSelectionToNewSkinCluster()
完成ファイル (自分用リンク)
jennie9_6_v12z_v00127_Mouse_SW_Take2OK_Kihon_UE532ExportEnd.zip
I tried running the scriptedPanel sample.
// define callbacks for this type and make it a unique type
// as we don't want two panels sharing the same global data.
scriptedPanelType
-ccb sampleCreateCallback
-icb sampleInitCallback
-acb sampleAddCallback
-rcb sampleRemoveCallback
-dcb sampleDeleteCallback
-scb sampleSaveStateCallback
-unique true
"sampleScriptedPanelType6";
global proc sampleCreateCallback(string $panelName) {
//
// Description:
// Create any editors unparented here and do
// any other initialization required.
//
// In this example we will only declare a global array to
// maintain some state information.
//
global float $gSampleState[5];
}
global proc sampleInitCallback(string $panelName) {
//
// Description:
// Re-initialize the panel on file -new or file -open.
//
// In this example we will only re-init the global array.
//
global float $gSampleState[];
$gSampleState[0] = 20.2;
$gSampleState[1] = 50.5;
$gSampleState[2] = 34.7;
$gSampleState[3] = 2.0;
$gSampleState[4] = 1.0;
}
global proc sampleAddCallback(string $panelName) {
//
// Description: Create UI and parent any editors.
//
global float $gSampleState[];
columnLayout -adj true topCol;
separator -style "none" -h 10;
frameLayout -l "Sliders" -mw 10;
columnLayout -adj true sampleCol;
separator -style "none" -h 10;
floatSliderGrp -l "Property A" -f true
-v $gSampleState[0]
fsg1;
floatSliderGrp -l "Property B" -f true
-v $gSampleState[1]
fsg2;
floatSliderGrp -l "Property C" -f true
-v $gSampleState[2]
fsg3;
separator -style "none" -h 10;
setParent ..;
setParent ..;
separator -style "none" -h 10;
frameLayout -l "Radio Buttons" -mw 10;
columnLayout sampleCol2;
separator -style "none" -h 10;
radioButtonGrp -nrb 3
-l "Big Options"
-la3 "Option 1" "Option 2" "Option 3"
-select $gSampleState[3]
rbg;
radioButtonGrp -nrb 3
-l "Little Options"
-la3 "Option 4" "Option 5" "Option 6"
-select $gSampleState[4]
rbg2;
separator -style "none" -h 10;
}
global proc sampleRemoveCallback(string $panelName) {
//
// Description:
// Unparent any editors and save state if required.
//
global float $gSampleState[];
// Scope the control names to this panel.
//
string $control = `scriptedPanel -q -control $panelName`;
setParent $control;
$gSampleState[0] = `floatSliderGrp -q -v fsg1`;
$gSampleState[1] = `floatSliderGrp -q -v fsg2`;
$gSampleState[2] = `floatSliderGrp -q -v fsg3`;
$gSampleState[3] = `radioButtonGrp -q -sl rbg`;
$gSampleState[4] = `radioButtonGrp -q -sl rbg2`;
}
global proc sampleDeleteCallback(string $panelName) {
//
// Description:
// Delete any editors and do any other cleanup required.
}
global proc string sampleSaveStateCallback(string $panelName) {
//
// Description:
// Return a string that will restore the current state
// when it is executed.
global float $gSampleState[];
$indent = "\n\t\t\t";
return ($indent+"$gSampleState[0]="+$gSampleState[0]+";" +
$indent+"$gSampleState[1]="+$gSampleState[1]+";" +
$indent+"$gSampleState[2]="+$gSampleState[2]+";" +
$indent+"$gSampleState[3]="+$gSampleState[3]+";" +
$indent+"$gSampleState[4]="+$gSampleState[4]+";" +
$indent+"setSamplePanelState $panelName;\n" );
}
global proc setSamplePanelState( string $whichPanel ) {
//
// Description:
// This is a convenience proc to set the panel state from the
// global array
global float $gSampleState[];
// Scope the control names to this panel.
//
string $control = `scriptedPanel -q -control $whichPanel`;
if ("" != $control) {
setParent $control;
floatSliderGrp -e -v $gSampleState[0] fsg1;
floatSliderGrp -e -v $gSampleState[1] fsg2;
floatSliderGrp -e -v $gSampleState[2] fsg3;
if (0 != $gSampleState[3]) {
radioButtonGrp -e -sl $gSampleState[3] rbg;
};
if (0 != $gSampleState[4]) {
radioButtonGrp -e -sl $gSampleState[4] rbg2;
}
}
}
// This script will create an unparented scripted panel, place it
// in one window, remove it, and place it in another window then
// return it to the first window.
//
// Create unparented scripted panel
//
scriptedPanel -unParent -type "sampleScriptedPanelType6" -label "Sample" "sampleScriptedPanel6";
// Create a couple of windows and parent the scripted panel to the first.
//
window "sampleWin6";
frameLayout -lv false -bv false frm;
scriptedPanel -e -parent "sampleWin6|frm" "sampleScriptedPanel6";
showWindow;
/*
window -w `window -q -w sampleWin` -h `window -q -h "sampleWin"` "sampleWin2";
frameLayout -lv false -bv false frm;
showWindow;
*/
なんか引っかかってしまいがちな
どこにも書いてないウィンドウパスの話
MY_Export_window|MY_layout|pathTxtFld
def createWindow():
MY_window = cmds.window("MY_Export_window", widthHeight=(400, 200))
MY_layout = cmds.columnLayout("MY_layout",adjustableColumn=True, parent=MY_window)
cmds.text (label="テキストを変更したら呼ばれるよ", align='left', parent=MY_layout)
text_Field_id = cmds.textField("pathTxtFld",text=get_lastExportDirPath(),changeCommand=changeTextFld)
print("text_Field_id= "+text_Field_id)
cmds.showWindow(MY_window)
return None
def changeTextFld(*arg):
text_Field_id="MY_Export_window|MY_layout|pathTxtFld"
print("text_Field_id= "+text_Field_id)
pathTxtFld_value = cmds.textField(text_Field_id, q=True, text=True)
print("pathTxtFld_value= "+pathTxtFld_value)
set_lastExportDirPath(pathTxtFld_value)
createWindow()
この時出力が
#columnLayoutに名前つけないとパスがこんな不安な感じになる。
text_Field_id= MY_Export_window|columnLayout118|pathTxtFld
#columnLayoutに名前つければとパスがこんな確実な感じになる。
text_Field_id= MY_Export_window|MY_layout|pathTxtFld
text_Field_id= MY_Export_window|MY_layout|pathTxtFld