initial
This commit is contained in:
@@ -0,0 +1,352 @@
|
||||
global proc AEDirectXShaderTemplate ( string $node )
|
||||
{
|
||||
editorTemplate -beginScrollLayout;
|
||||
|
||||
editorTemplate -label "Maya Viewer Color" -addControl "color" ;
|
||||
|
||||
editorTemplate -callCustom AEDirectXNew AEDirectXReplace $node;
|
||||
|
||||
editorTemplate -endLayout;
|
||||
|
||||
// Hide "Extra Attributes" UI for dynamic attributes.
|
||||
editorTemplate -addExtraControls;
|
||||
|
||||
editorTemplate -endScrollLayout;
|
||||
}
|
||||
|
||||
global proc AEDirectXNew( string $messagePlug )
|
||||
{
|
||||
AEDirectXReplace($messagePlug);
|
||||
}
|
||||
|
||||
proc DxFxParameterLayout( string $shaderNode )
|
||||
{
|
||||
string $dxfxScript= `getAttr ($shaderNode + ".FxScript")`;
|
||||
eval( $dxfxScript );
|
||||
}
|
||||
|
||||
global proc DxFxScriptTest(string $shaderNode )
|
||||
{
|
||||
string $dxfxWindow= "FxShaderTest";
|
||||
|
||||
if ( `window -exists $dxfxWindow` )
|
||||
deleteUI $dxfxWindow;
|
||||
window -widthHeight 200 300 $dxfxWindow;
|
||||
|
||||
|
||||
if ( `frameLayout -exists dxfxAEFrame` )
|
||||
deleteUI dxfxAEFrame;
|
||||
|
||||
frameLayout -label "DirectX Effect Parameters"
|
||||
-borderStyle "etchedIn"
|
||||
-collapsable true
|
||||
-marginWidth 10
|
||||
-visible true
|
||||
dxfxAEFrame;
|
||||
{
|
||||
columnLayout -adjustableColumn true -columnAlign "left";
|
||||
{
|
||||
DxFxParameterLayout($shaderNode);
|
||||
|
||||
setParent ..;
|
||||
}
|
||||
setParent ..;
|
||||
}
|
||||
showWindow $dxfxWindow;
|
||||
|
||||
}
|
||||
|
||||
global proc string plugNode( string $plug )
|
||||
{
|
||||
string $buffer[];
|
||||
tokenize($plug, ".", $buffer);
|
||||
return $buffer[0];
|
||||
}
|
||||
|
||||
global proc dxfxDeleteAttribute(string $AttrName, string $Node)
|
||||
{
|
||||
if( `attributeExists $AttrName $Node` )
|
||||
{
|
||||
catch( `deleteAttr -attribute $AttrName $Node` );
|
||||
}
|
||||
}
|
||||
|
||||
global proc dxfxStackDown(int $change)
|
||||
{
|
||||
int $index;
|
||||
for($index= $change; $index < 0; $index++)
|
||||
{
|
||||
setParent ..;
|
||||
setParent ..;
|
||||
}
|
||||
}
|
||||
global proc dxfxStackUp( string $UIName, int $NoChildren)
|
||||
{
|
||||
if($NoChildren)
|
||||
{
|
||||
columnLayout -adjustableColumn true;
|
||||
}
|
||||
else
|
||||
{
|
||||
frameLayout -label $UIName
|
||||
-borderStyle "out"
|
||||
-font "smallPlainLabelFont"
|
||||
-marginWidth 10
|
||||
-collapse true
|
||||
-collapsable true
|
||||
-visible true;
|
||||
}
|
||||
|
||||
columnLayout -adjustableColumn true;
|
||||
}
|
||||
|
||||
global proc dxfxControlColorCreate(string $UIName, string $plug, int $length)
|
||||
{
|
||||
string $colorUIName = $UIName;
|
||||
if($length == 4)
|
||||
$colorUIName = ($colorUIName + ".rgb");
|
||||
|
||||
|
||||
string $colorSlider = `colorSliderGrp -label $colorUIName`;
|
||||
|
||||
string $quotedColorSlider = ("\"" + $colorSlider + "\"");
|
||||
string $quotedPlug = ("\"" + $plug + "\"");
|
||||
string $callback = "dxfxControlColorCallback( " + $quotedColorSlider + " , " + $quotedPlug + " )";
|
||||
|
||||
float $P0Value= `getAttr ($plug + "[0]")`;
|
||||
float $P1Value= `getAttr ($plug + "[1]")`;
|
||||
float $P2Value= `getAttr ($plug + "[2]")`;
|
||||
//print ("ColorValues: " + $P0Value + " " + $P1Value + " " + $P2Value + " ");
|
||||
|
||||
colorSliderGrp -edit -rgbValue $P0Value $P1Value $P2Value $colorSlider;
|
||||
|
||||
//print ("ColorValues2: " + $P0Value + " " + $P1Value + " " + $P2Value + " ");
|
||||
|
||||
colorSliderGrp -edit -changeCommand $callback $colorSlider;
|
||||
|
||||
if($length == 4)
|
||||
{
|
||||
string $alphaPlug = ($plug + "[3]");
|
||||
string $alphaUIName = ($UIName + ".a");
|
||||
|
||||
dxfxControlSliderCreate( "float", $alphaUIName, 0.0, 1.0, 0.01, $alphaPlug);;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
global proc dxfxControlColorCallback(string $control, string $plug)
|
||||
{
|
||||
float $colorValues[3]= `colorSliderGrp -q -rgbValue $control`;
|
||||
setAttr ($plug + "[0]") $colorValues[0];
|
||||
setAttr ($plug + "[1]") $colorValues[1];
|
||||
setAttr ($plug + "[2]") $colorValues[2];
|
||||
}
|
||||
|
||||
global proc dxfxControlSliderCreate(string $type, string $UIName, float $min, float $max, float $step, string $plug)
|
||||
{
|
||||
|
||||
string $quotedUIName = ("\"" + $UIName + "\"");
|
||||
string $Slider;
|
||||
|
||||
if(0 == strcmp( $type, "float" ))
|
||||
{
|
||||
float $floatMin = $min;
|
||||
float $floatMax = $max;
|
||||
float $floatStep = $step;
|
||||
|
||||
$Slider = `floatSliderGrp -label $UIName -minValue $floatMin -maxValue $floatMax -step $floatStep -field true`;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(0 == strcmp( $type, "int" ))
|
||||
{
|
||||
int $intMin = $min;
|
||||
int $intMax = $max;
|
||||
int $intStep = $step;
|
||||
|
||||
$Slider = `intSliderGrp -label $UIName -minValue $intMin -maxValue $intMax -step $intStep -field true`;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(0 == strcmp( $type, "bool" ))
|
||||
{
|
||||
$Slider = `intSliderGrp -label $UIName -minValue 0 -maxValue 1 -step 1 -field true`;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
connectControl $Slider $plug;
|
||||
}
|
||||
|
||||
global proc dxfxControlScalarCreate(string $type, string $UIName, string $plug)
|
||||
{
|
||||
string $control;
|
||||
if(0 == strcmp( $type, "float" ))
|
||||
{
|
||||
$control = "floatFieldGrp";
|
||||
}
|
||||
else
|
||||
{
|
||||
if(0 == strcmp( $type, "int" ))
|
||||
{
|
||||
$control = "intFieldGrp";
|
||||
}
|
||||
else
|
||||
{
|
||||
if(0 == strcmp( $type, "bool" ))
|
||||
{
|
||||
$control = "checkBoxGrp";
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string $command = ( $control + " -numberOfFields 1" + " -label \"" + $UIName + "\"" + " -columnWidth 2 220" );
|
||||
string $rowCtrl= eval($command);
|
||||
connectControl -index 2 $rowCtrl $plug;
|
||||
}
|
||||
|
||||
global proc dxfxControlVectorCreate(string $type, string $UIName, string $plug, int $length)
|
||||
{
|
||||
dxfxControlMatrixCreate($type, $UIName, $plug, 1, $length);
|
||||
}
|
||||
|
||||
global proc dxfxControlMatrixCreate(string $type, string $UIName, string $plug, int $rows, int $columns )
|
||||
{
|
||||
string $control;
|
||||
if(0 == strcmp( $type, "float" ))
|
||||
{
|
||||
$control = "floatFieldGrp";
|
||||
}
|
||||
else
|
||||
{
|
||||
if(0 == strcmp( $type, "int" ))
|
||||
{
|
||||
$control = "intFieldGrp";
|
||||
}
|
||||
else
|
||||
{
|
||||
if(0 == strcmp( $type, "bool" ))
|
||||
{
|
||||
$control = "checkBoxGrp";
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int $rowIndex;
|
||||
for($rowIndex= 0; $rowIndex < $rows; $rowIndex++)
|
||||
{
|
||||
string $command;
|
||||
int $columnIndex;
|
||||
|
||||
$command = ($control + " -numberOfFields " + $columns );
|
||||
if($rowIndex == 0)
|
||||
$command = ($command + " -label \"" + $UIName + "\"");
|
||||
|
||||
for( $columnIndex = 0; $columnIndex < $columns; $columnIndex++ )
|
||||
{
|
||||
$command = ($command + " -columnWidth " + ($columnIndex + 2) + " " + (220 / $columns) );
|
||||
}
|
||||
|
||||
string $rowCtrl= eval($command);
|
||||
for( $columnIndex = 0; $columnIndex < $columns; $columnIndex++ )
|
||||
{
|
||||
int $plugIndex = ( $rowIndex * $rows ) + $columnIndex;
|
||||
string $subPlugName = ($plug + "[" + $plugIndex + "]");
|
||||
connectControl -index ( $columnIndex + 2 ) $rowCtrl $subPlugName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
global proc dxfxControlStringCreate(string $UIName, string $plug)
|
||||
{
|
||||
string $rowCtrl= `textFieldGrp -label $UIName`;
|
||||
connectControl -index 2 $rowCtrl $plug;
|
||||
}
|
||||
|
||||
global proc dxfxControlTextureCreate(string $UIName, string $plug)
|
||||
{
|
||||
string $quotedPlug = ("\"" + $plug + "\"");
|
||||
|
||||
string $buttonCmd = ("setAttr -type \"string\" " + $quotedPlug + " `fileDialog -directoryMask \"*.dds;*.jpg;*.bmp;*.tga;*.png;*.ppm;*.dib;*.hdr;*.pfm\"`;");
|
||||
|
||||
string $rowCtrl= `textFieldButtonGrp -label $UIName -buttonLabel "..." -buttonCommand $buttonCmd`;
|
||||
|
||||
connectControl -index 2 $rowCtrl $plug;
|
||||
}
|
||||
|
||||
global proc AEDirectXReplace( string $messagePlug )
|
||||
{
|
||||
string $shaderNode = plugNode($messagePlug);
|
||||
|
||||
{
|
||||
string $dxfxFileAttribute = $shaderNode + ".FxFile";
|
||||
|
||||
string $dxfxFile= `getAttr $dxfxFileAttribute`;
|
||||
|
||||
string $dxfxSetFile = "setAttr -type \"string\" " + $dxfxFileAttribute + " `fileDialog -directoryMask \"*.fx\"`";
|
||||
|
||||
string $dxfxReloadFile = "setAttr -type \"string\" " + $dxfxFileAttribute + " `getAttr -asString " + $dxfxFileAttribute + "`";
|
||||
|
||||
if ( `textFieldButtonGrp -exists dxfxFileControl` )
|
||||
deleteUI dxfxFileControl;
|
||||
|
||||
textFieldButtonGrp
|
||||
-label "DirectX Effect File"
|
||||
-text $dxfxFile
|
||||
-editable false
|
||||
-buttonLabel "..."
|
||||
-buttonCommand $dxfxSetFile
|
||||
dxfxFileControl;
|
||||
|
||||
scriptJob
|
||||
-parent dxfxFileControl
|
||||
-replacePrevious
|
||||
-killWithScene
|
||||
-runOnce false
|
||||
-compressUndo true
|
||||
-attributeChange $dxfxFileAttribute "refreshAE;";
|
||||
|
||||
if ( `button -exists dxfxReloadControl` )
|
||||
deleteUI dxfxReloadControl;
|
||||
|
||||
button
|
||||
-label "Reload Effect File"
|
||||
-command $dxfxReloadFile
|
||||
dxfxReloadControl;
|
||||
|
||||
if ( `frameLayout -exists dxfxRollOut` )
|
||||
deleteUI dxfxRollOut;
|
||||
|
||||
frameLayout -label "DirectX Effect Parameters"
|
||||
-collapse false
|
||||
-collapsable true
|
||||
-visible false
|
||||
dxfxRollOut;
|
||||
{
|
||||
columnLayout -adjustableColumn true;
|
||||
{
|
||||
DxFxParameterLayout($shaderNode);
|
||||
setParent ..;
|
||||
}
|
||||
layout -edit -visible true dxfxRollOut;
|
||||
setParent ..;
|
||||
}
|
||||
setParent ..;
|
||||
|
||||
setUITemplate -popTemplate;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,491 @@
|
||||
global int $DXMLogFileId= 0;
|
||||
|
||||
global proc DXMLogStart( string $filename, int $append, string $runName )
|
||||
{
|
||||
global int $DXMLogFileId;
|
||||
|
||||
if($DXMLogFileId != 0)
|
||||
return;
|
||||
|
||||
if($append)
|
||||
{
|
||||
$DXMLogFileId=`fopen $filename "a"`;
|
||||
}
|
||||
else
|
||||
{
|
||||
$DXMLogFileId=`fopen $filename`;
|
||||
}
|
||||
|
||||
fprint $DXMLogFileId "<DXMLog";
|
||||
if(size($runName) > 0)
|
||||
{
|
||||
fprint $DXMLogFileId " name=\"";
|
||||
fprint $DXMLogFileId $runName;
|
||||
fprint $DXMLogFileId "\"";
|
||||
}
|
||||
fprint $DXMLogFileId ">";
|
||||
}
|
||||
|
||||
global proc DXMLogStop( )
|
||||
{
|
||||
global int $DXMLogFileId;
|
||||
|
||||
if($DXMLogFileId != 0)
|
||||
{
|
||||
fprint $DXMLogFileId "</DXMLog>";
|
||||
fclose $DXMLogFileId;
|
||||
$DXMLogFileId= 0;
|
||||
}
|
||||
}
|
||||
|
||||
global proc DXMLogTestBegin( string $testName)
|
||||
{
|
||||
global int $DXMLogFileId;
|
||||
|
||||
if($DXMLogFileId != 0)
|
||||
{
|
||||
fprint $DXMLogFileId "<DXMLogTest";
|
||||
if(size($testName) > 0)
|
||||
{
|
||||
fprint $DXMLogFileId " name=\"";
|
||||
fprint $DXMLogFileId $testName;
|
||||
fprint $DXMLogFileId "\"";
|
||||
}
|
||||
fprint $DXMLogFileId ">";
|
||||
}
|
||||
}
|
||||
|
||||
global proc DXMLogTestEnd()
|
||||
{
|
||||
global int $DXMLogFileId;
|
||||
|
||||
if($DXMLogFileId != 0)
|
||||
{
|
||||
fprint $DXMLogFileId "\t</DXMLogTest>";
|
||||
}
|
||||
}
|
||||
|
||||
global proc DXMLogWarning( string $warnStr)
|
||||
{
|
||||
global int $DXMLogFileId;
|
||||
|
||||
warning $warnStr;
|
||||
|
||||
if($DXMLogFileId != 0)
|
||||
{
|
||||
fprint $DXMLogFileId "<DXMLogWarning>";
|
||||
fprint $DXMLogFileId $warnStr;
|
||||
fprint $DXMLogFileId "</DXMLogWarning>";
|
||||
}
|
||||
}
|
||||
|
||||
global proc DXMLogInfo( string $warnStr)
|
||||
{
|
||||
global int $DXMLogFileId;
|
||||
|
||||
if($DXMLogFileId != 0)
|
||||
{
|
||||
fprint $DXMLogFileId "<DXMLogInfo>";
|
||||
fprint $DXMLogFileId $warnStr;
|
||||
fprint $DXMLogFileId "</DXMLogInfo>";
|
||||
}
|
||||
}
|
||||
|
||||
global proc DXMLogResult( string $result)
|
||||
{
|
||||
global int $DXMLogFileId;
|
||||
|
||||
if($DXMLogFileId != 0)
|
||||
{
|
||||
fprint $DXMLogFileId "<DXMLogResult>";
|
||||
fprint $DXMLogFileId $result;
|
||||
fprint $DXMLogFileId "</DXMLogResult>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
global proc int DXMTestNodeOwnershipOfRoutes()
|
||||
{
|
||||
DXMLogTestBegin("DXMTestNodeOwnershipOfRoutes");
|
||||
|
||||
int $result= true;
|
||||
|
||||
int $iNode;
|
||||
string $nodes[]= `ls -dagObjects`; //`DXMGraphListNodes "DXMSyncGraph"`;
|
||||
for($iNode= 0; $iNode < size($nodes); $iNode++)
|
||||
{
|
||||
string $paths[] = `ls -long -allPaths $nodes[$iNode]`;
|
||||
string $routes[] = `DXMNodeDagListRoutes "DXMSyncGraph" $nodes[$iNode]`;
|
||||
|
||||
|
||||
string $pathsMinusRoutes[] =stringArrayRemove($routes, $paths);
|
||||
int $iPath;
|
||||
for($iPath= 0; $iPath < size($pathsMinusRoutes); $iPath++ )
|
||||
{
|
||||
DXMLogWarning("Path in maya not found on DXMNode. Node: " + $nodes[$iNode] + " Path: " + $pathsMinusRoutes[$iPath]);
|
||||
$result= false;
|
||||
}
|
||||
|
||||
string $routesMinusPaths[] =stringArrayRemove($paths, $routes);
|
||||
int $iRoute;
|
||||
for($iRoute= 0; $iRoute < size($routes); $iRoute++ )
|
||||
{
|
||||
DXMLogWarning("Route in DXMNode not found on in maya. Node: " + $nodes[$iNode] + " Route: " + $routesMinusPaths[$iRoute]);
|
||||
$result= false;
|
||||
}
|
||||
}
|
||||
|
||||
DXMLogResult($result);
|
||||
DXMLogTestEnd();
|
||||
return $result;
|
||||
}
|
||||
|
||||
global proc int DXMTestRouteVisibility()
|
||||
{
|
||||
DXMLogTestBegin("DXMTestRouteVisibility");
|
||||
|
||||
int $result= true;
|
||||
|
||||
int $iNode;
|
||||
string $invisibleNodes[] = `ls -dagObjects -invisible`;
|
||||
for($iNode= 0; $iNode < size($invisibleNodes); $iNode++)
|
||||
{
|
||||
int $iPath;
|
||||
string $pathList[] = `ls -long -allPaths $invisibleNodes[$iNode]`;
|
||||
for($iPath= 0; $iPath < size($pathList) && $result == true; $iPath++)
|
||||
{
|
||||
int $routeVis= `DXMRouteIsVisible "DXMSyncGraph" $pathList[$iPath]`;
|
||||
if($routeVis == true)
|
||||
{
|
||||
DXMLogWarning( "Failure in node's immediate path: (Node: " + $invisibleNodes[$iNode] + ") (Path: " + $pathList[$iPath] + " )" );
|
||||
$result= false;
|
||||
}
|
||||
|
||||
int $iDecendent;
|
||||
string $decendentList[] = `listRelatives -fullPath -allDescendents $pathList[$iPath]`;
|
||||
for($iDecendent= 0; $iDecendent < size($decendentList) && $result == true; $iDecendent++)
|
||||
{
|
||||
$routeVis= `DXMRouteIsVisible "DXMSyncGraph" $decendentList[$iDecendent]`;
|
||||
if($routeVis == true)
|
||||
{
|
||||
DXMLogWarning( "Failure in node's decendents paths (Node: " + $invisibleNodes[$iNode] + ") (Path: " + $decendentList[$iDecendent] + " )" );
|
||||
$result= false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DXMLogResult($result);
|
||||
DXMLogTestEnd();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
global proc int DXMTestNodeExplicitInvisibility()
|
||||
{
|
||||
DXMLogTestBegin("DXMTestNodeExplicitInvisibility");
|
||||
|
||||
int $result= true;
|
||||
|
||||
int $iNode;
|
||||
string $invisibleNodes[] = `ls -dagObjects -invisible`;
|
||||
for($iNode= 0; $iNode < size($invisibleNodes); $iNode++)
|
||||
{
|
||||
if(0 == `DXMNodeDagIsExplicitlyInvisible "DXMSyncGraph" $invisibleNodes[$iNode]`)
|
||||
{
|
||||
DXMLogWarning( "DXMNode Visiblility does not match Maya: " + $invisibleNodes[$iNode] );
|
||||
$result= false;
|
||||
}
|
||||
}
|
||||
|
||||
DXMLogResult($result);
|
||||
DXMLogTestEnd();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
global proc int DXMTestRouteParents()
|
||||
{
|
||||
DXMLogTestBegin("DXMTestRouteParents");
|
||||
|
||||
int $result= true;
|
||||
|
||||
|
||||
string $routeList[]= `DXMGraphListRoutes "DXMSyncGraph"`;
|
||||
|
||||
int $iRoute;
|
||||
for($iRoute= 0; $iRoute < size($routeList); $iRoute++)
|
||||
{
|
||||
string $mayaParent[]= `listRelatives -fullPath -parent $routeList[$iRoute]`;
|
||||
string $dxmParent[]= `DXMRouteGetParent "DXMSyncGraph" $routeList[$iRoute]`;
|
||||
|
||||
if( size($mayaParent) != 0 && size($dxmParent) != 0 )
|
||||
{
|
||||
if($dxmParent[0] != $mayaParent[0])
|
||||
{
|
||||
DXMLogWarning( "Parenting mismatch on route: " + $routeList[$iRoute] + " DXM: " + $dxmParent[0] + " Maya: " + $mayaParent[0] );
|
||||
$result= false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(size($mayaParent) > 0)
|
||||
{
|
||||
DXMLogWarning( "Parenting mismatch on route: " + $routeList[$iRoute] + " Maya: " + $mayaParent[0] + " (DXM is empty)");
|
||||
$result= false;
|
||||
}
|
||||
|
||||
if(size($dxmParent) > 0)
|
||||
{
|
||||
DXMLogWarning( "Parenting mismatch on route: " + $routeList[$iRoute] + " DXM: " + $dxmParent[0] + " (Maya is empty)");
|
||||
$result= false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DXMLogResult($result);
|
||||
DXMLogTestEnd();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
global proc int DXMTestFrameParents()
|
||||
{
|
||||
DXMLogTestBegin("DXMTestFrameParents");
|
||||
|
||||
int $result= true;
|
||||
|
||||
string $routeList[]= `DXMGraphListRoutes "DXMSyncGraph"`;
|
||||
|
||||
int $iRoute;
|
||||
for($iRoute= 0; $iRoute < size($routeList); $iRoute++)
|
||||
{
|
||||
int $isFrameParentingEqual= `DXMRouteIsFrameParentingEqual "DXMSyncGraph" $routeList[$iRoute]`;
|
||||
if($isFrameParentingEqual == false)
|
||||
{
|
||||
DXMLogWarning( "Route & Frame Parenting are not equal: " + $routeList[$iRoute] );
|
||||
$result= false;
|
||||
}
|
||||
}
|
||||
|
||||
DXMLogResult($result);
|
||||
DXMLogTestEnd();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
global proc int DXMTestAdapterOwnership()
|
||||
{
|
||||
DXMLogTestBegin("DXMTestAdapterOwnershipMatch");
|
||||
|
||||
int $result= true;
|
||||
|
||||
string $nodes[]= `DXMGraphListNodes "DXMSyncGraph"`;
|
||||
|
||||
int $iNode;
|
||||
for($iNode= 0; $iNode < size($nodes); $iNode++)
|
||||
{
|
||||
string $nodeAdapters[]= `DXMNodeListAdapters "DXMSyncGraph" $nodes[$iNode]`;
|
||||
int $iNA;
|
||||
for($iNA= 0; $iNA < size($nodeAdapters); $iNA++)
|
||||
{
|
||||
string $graphAdapter= `DXMNodeAdapterGetOwner "DXMSyncGraph" $nodes[$iNode] $nodeAdapters[$iNA]`;
|
||||
int $isInterested= `DXMGraphAdapterIsInterested "DXMSyncGraph" $graphAdapter $nodes[$iNode]`;
|
||||
|
||||
if($isInterested == false)
|
||||
{
|
||||
DXMLogWarning( "Node: " + $nodes[$iNode] + " NodeAdapter: " + $nodeAdapters[$iNA] + " GraphAdapter: " + $graphAdapter );
|
||||
$result= false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DXMLogResult($result);
|
||||
DXMLogTestEnd();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
global proc int DXMTestAllNodesHaveAnAdapter()
|
||||
{
|
||||
DXMLogTestBegin("DXMTestAllNodesHaveAnAdapter");
|
||||
|
||||
int $result= true;
|
||||
string $nodes[]= `DXMGraphListNodes "DXMSyncGraph"`;
|
||||
|
||||
int $iNode;
|
||||
for($iNode= 0; $iNode < size($nodes); $iNode++)
|
||||
{
|
||||
string $nodeAdapters[]= `DXMNodeListAdapters "DXMSyncGraph" $nodes[$iNode]`;
|
||||
|
||||
if(size($nodeAdapters) == 0)
|
||||
{
|
||||
DXMLogWarning( "Failure at Node: " + $nodes[$iNode] );
|
||||
$result= false;
|
||||
}
|
||||
}
|
||||
|
||||
DXMLogResult($result);
|
||||
DXMLogTestEnd();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
global proc int DXMTestMeshVisibility()
|
||||
{
|
||||
DXMLogTestBegin("DXMTestMeshVisibility");
|
||||
|
||||
int $result= true;
|
||||
string $nodes[]= `DXMGraphListNodes "DXMSyncGraph"`;
|
||||
|
||||
int $iNode;
|
||||
for($iNode= 0; $iNode < size($nodes); $iNode++)
|
||||
{
|
||||
int $hasMesh= `DXMNodeHasAdapter "DXMSyncGraph" $nodes[$iNode] "DXMNodeMeshAdapter"`;
|
||||
|
||||
if($hasMesh == true)
|
||||
{
|
||||
int $meshIsVisible= `DXMNodeMeshIsAnyRouteVisible "DXMSyncGraph" $nodes[$iNode]`;
|
||||
|
||||
string $routeList[]= `DXMNodeDagListRoutes "DXMSyncGraph" $nodes[$iNode]`;
|
||||
for($iRoute= 0; $iRoute < size($routeList); $iRoute++)
|
||||
{
|
||||
int $routeIsVisible= `DXMRouteIsVisible "DXMSyncGraph" $routeList[$iRoute]`;
|
||||
|
||||
if($meshIsVisible == false && $routeIsVisible == true)
|
||||
{
|
||||
DXMLogWarning( "Mesh is not visible but Route is! Mesh: " + $nodes[$iNode] + " Route: " + $routeList[$iRoute] );
|
||||
$result= false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DXMLogResult($result);
|
||||
DXMLogTestEnd();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
global proc int DXMTestMeshMembership()
|
||||
{
|
||||
DXMLogTestBegin("DXMTestMeshMembership");
|
||||
|
||||
int $result= true;
|
||||
string $nodes[]= `DXMGraphListNodes "DXMSyncGraph"`;
|
||||
|
||||
int $iNode;
|
||||
for($iNode= 0; $iNode < size($nodes); $iNode++)
|
||||
{
|
||||
int $hasMesh= `DXMNodeHasAdapter "DXMSyncGraph" $nodes[$iNode] "DXMNodeMeshAdapter"`;
|
||||
|
||||
if($hasMesh == true)
|
||||
{
|
||||
string $routeList[]= `DXMNodeDagListRoutes "DXMSyncGraph" $nodes[$iNode]`;
|
||||
for($iRoute= 0; $iRoute < size($routeList); $iRoute++)
|
||||
{
|
||||
int $routeIsVisible= `DXMRouteIsVisible "DXMSyncGraph" $routeList[$iRoute]`;
|
||||
int $meshIsMemberOfRoute= `DXMNodeMeshIsMemberOfRoute "DXMSyncGraph" $nodes[$iNode] $routeList[$iRoute]`;
|
||||
|
||||
if($meshIsMemberOfRoute == true && $routeIsVisible == false)
|
||||
{
|
||||
DXMLogWarning( "Mesh is a member of an invisible route! Mesh: " + $nodes[$iNode] + " Route: " + $routeList[$iRoute] );
|
||||
$result= false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DXMLogResult($result);
|
||||
DXMLogTestEnd();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
global proc int DXMTestAllRoutesValid()
|
||||
{
|
||||
DXMLogTestBegin("DXMTestAllRoutesValid");
|
||||
|
||||
int $result= (false == `DXMGraphHasInvalidRoutes "DXMSyncGraph"`);
|
||||
|
||||
DXMLogResult($result);
|
||||
DXMLogTestEnd();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
global proc int DXMTestAllNodesValid()
|
||||
{
|
||||
DXMLogTestBegin("DXMTestAllNodesValid");
|
||||
|
||||
int $result= (false == `DXMGraphHasInvalidNodes "DXMSyncGraph"`);
|
||||
|
||||
DXMLogResult($result);
|
||||
DXMLogTestEnd();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/*EXAMPLE USAGE
|
||||
proc string polyCubeReturnRoot()
|
||||
{
|
||||
string $result[]= `polyCube`;
|
||||
return $result[0];
|
||||
}
|
||||
DXMTestStressCreateDelete("polyCubeReturnRoot()", "delete", 10);
|
||||
*/
|
||||
|
||||
global proc int DXMTestStressCreateDelete(string $createScripty, string $deleteScripty, int $count)
|
||||
{
|
||||
DXMLogTestBegin("DXMTestStressCreateDelete");
|
||||
|
||||
int $result= true;
|
||||
|
||||
string $nodes[];
|
||||
|
||||
$nodes= `DXMGraphListNodes "DXMSyncGraph"`;
|
||||
|
||||
int $oldNodeCount= size($nodes);
|
||||
|
||||
int $index= 0;
|
||||
for($index= 0; $index < $count; $index++)
|
||||
{
|
||||
string $deleteName= `eval $createScripty`;
|
||||
|
||||
eval $deleteScripty $deleteName;
|
||||
}
|
||||
|
||||
DXCCRebuildDirty;
|
||||
|
||||
$nodes= `DXMGraphListNodes "DXMSyncGraph"`;
|
||||
|
||||
int $newNodeCount= size($nodes);
|
||||
|
||||
int $leakCount= $oldNodeCount - $newNodeCount;
|
||||
if($leakCount != 0)
|
||||
{
|
||||
DXMLogWarning( "Leaked nodes: " + $leakCount );
|
||||
$result= false;
|
||||
}
|
||||
|
||||
DXMLogResult($result);
|
||||
DXMLogTestEnd();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/*EXAMPLE USAGE
|
||||
proc string polyCube2()
|
||||
{
|
||||
string $result[]= `polyCube`;
|
||||
return $result[0];
|
||||
}
|
||||
DXMTestStressCreateDelete("polyCube2()", "delete", 10);
|
||||
*/
|
||||
154
dx10sdk/Utilities/Bin/PlugIns/Maya/Binary7/Scripts/DirectX.mel
Normal file
154
dx10sdk/Utilities/Bin/PlugIns/Maya/Binary7/Scripts/DirectX.mel
Normal file
@@ -0,0 +1,154 @@
|
||||
|
||||
global string $g_dxMenu;
|
||||
global string $g_dxPreviewToggle;
|
||||
global string $g_dxViewerStartupToggle;
|
||||
|
||||
{
|
||||
DirectX_BuildMenu();
|
||||
}
|
||||
|
||||
|
||||
|
||||
global proc DirectX_SetPreviewState(int $state)
|
||||
{
|
||||
global string $g_dxPreviewToggle;
|
||||
|
||||
menuItem -e -checkBox $state $g_dxPreviewToggle;
|
||||
}
|
||||
|
||||
global proc int DirectX_GetPreviewState()
|
||||
{
|
||||
global string $g_dxPreviewToggle;
|
||||
|
||||
int $result= `menuItem -q -checkBox $g_dxPreviewToggle`;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
global proc DirectX_SetViewerStartupState(int $state)
|
||||
{
|
||||
global string $g_dxViewerStartupToggle;
|
||||
|
||||
menuItem -e -checkBox $state $g_dxViewerStartupToggle;
|
||||
}
|
||||
|
||||
global proc int DirectX_GetViewerStartupState()
|
||||
{
|
||||
global string $g_dxViewerStartupToggle;
|
||||
|
||||
int $result= `menuItem -q -checkBox $g_dxViewerStartupToggle`;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
global proc DirectX_RemoveMenu()
|
||||
{
|
||||
global string $g_dxMenu;
|
||||
|
||||
if(`menu -q -exists $g_dxMenu`)
|
||||
deleteUI $g_dxMenu;
|
||||
|
||||
}
|
||||
|
||||
global string $g_dxMenu;
|
||||
global proc DirectX_BuildMenu()
|
||||
{
|
||||
global string $gMainWindow;
|
||||
global string $g_dxMenu;
|
||||
global string $g_dxPreviewToggle;
|
||||
global string $g_dxSkinToggle;
|
||||
global string $g_dxAnimationToggle;
|
||||
global string $g_dxViewerStartupToggle;
|
||||
|
||||
// If menu exists or if main window doesn't exist, just return.
|
||||
if(`menu -q -exists $g_dxMenu`
|
||||
|| !(`window -q -exists $gMainWindow`))
|
||||
return;
|
||||
|
||||
$g_dxMenu= `menu -parent $gMainWindow -tearOff true -aob true
|
||||
-label "DirectX"`;
|
||||
|
||||
setParent -m $g_dxMenu;
|
||||
|
||||
$g_dxPreviewToggle= `menuItem -l "Realtime Previewing"
|
||||
-annotation "Realtime Previewing of scene in Direct3D viewers."
|
||||
-cb 1
|
||||
-c ("DXCCPreviewChanged")`;
|
||||
|
||||
menuItem -d true;
|
||||
|
||||
menuItem -l "Rebuild All"
|
||||
-annotation "Rebuild scene data for realtime viewers and export"
|
||||
-c "DXCCRebuildScene"
|
||||
dxRebuildSceneItem;
|
||||
|
||||
menuItem -l "Rebuild Dirty"
|
||||
-aob true
|
||||
-annotation "Rebuild dirty data for realtime viewers and export"
|
||||
-c ("DXCCRebuildDirty")
|
||||
dxRebuildDirtyItem;
|
||||
|
||||
menuItem -d true;
|
||||
|
||||
menuItem -l "Export All"
|
||||
-annotation "Export the scene to an X-File."
|
||||
-c ("DXCCExportScene")
|
||||
dxExportSceneItem;
|
||||
|
||||
menuItem -l "Export Options"
|
||||
-annotation "Popup the Export Options dialog"
|
||||
-c ("DXCCExportOptions")
|
||||
dxExportOptionsItem;
|
||||
|
||||
menuItem -d true;
|
||||
|
||||
menuItem -l "Viewers..."
|
||||
-sm 1
|
||||
-to 1
|
||||
-annotation "Realtime Viewers"
|
||||
dxViewerItem;
|
||||
|
||||
$g_dxViewerStartupToggle= `menuItem -l "Open on Startup"
|
||||
-annotation "Open the viewer when Maya starts"
|
||||
-cb 0`;
|
||||
|
||||
menuItem -l "None"
|
||||
-annotation "Close the Viewer"
|
||||
-c "DXCCCloseViewer"
|
||||
dxCloseViewerItem;
|
||||
|
||||
menuItem -l "Floating"
|
||||
-annotation "Floating Viewers"
|
||||
-c "DXCCFloatingView"
|
||||
dxFloatingViewerItem;
|
||||
|
||||
menuItem -l "Top"
|
||||
-annotation "Place Viewer over Top Pane"
|
||||
-c "DXCCTopView"
|
||||
dxTopViewerItem;
|
||||
|
||||
menuItem -l "Side"
|
||||
-annotation "Place Viewer over Side Pane"
|
||||
-c "DXCCSideView"
|
||||
dxSideViewerItem;
|
||||
|
||||
menuItem -l "Front"
|
||||
-annotation "Place Viewer over Front Pane"
|
||||
-c "DXCCFrontView"
|
||||
dxFrontViewerItem;
|
||||
|
||||
menuItem -d true;
|
||||
|
||||
|
||||
setParent -m $g_dxMenu;
|
||||
|
||||
menuItem -d true;
|
||||
|
||||
menuItem -l "Help"
|
||||
-annotation "Help"
|
||||
-c "DXMUiHelp"
|
||||
dxHelpItem;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user