// =========================================================================== // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // =========================================================================== // // AE template for the texture to geometry converter. // global proc TGlaunchBrowserCB( string $attr, string $filename, string $fileType) { string $cmd = ("setAttr " + $attr + " -type \"string\" \"" + $filename + "\""); evalEcho( $cmd ); } global proc TGlaunchBrowser( string $attrName ) { string $cmd = "TGlaunchBrowserCB "+ $attrName; string $workspace = `workspace -q -fn`; setWorkingDirectory $workspace "mayaBinary" ""; fileBrowser($cmd, (uiRes("m_AEtextureToGeomTemplate.kOpen")), "image", 0); } global proc TGimageFileReplace( string $attrName ) { connectControl imageNameField $attrName; symbolButton -e -c ("TGlaunchBrowser " + $attrName) browserBtn; } global proc TGimageFileReload( string $ftn ) { setUITemplate -pst attributeEditorTemplate; rowLayout -nc 2; text -l ""; button -label (uiRes("m_AEtextureToGeomTemplate.kReload")) -c ("TGfileTextureReloadCmd " + $ftn) imagefileReloadBtn; setParent ..; setUITemplate -ppt; } global proc TGimageFileReloadReplace( string $ftn ) { button -e -c ("TGfileTextureReloadCmd " + $ftn) imagefileReloadBtn; } global proc TGfileTextureReloadCmd( string $ftn ) { string $currFile = `getAttr $ftn`; setAttr $ftn -type "string" $currFile; } global proc TGimageFileNew( string $attrName ) // // Description: // Create UI for image file browsing. // { columnLayout -adjustableColumn 1 imageFileLayout; rowLayout -nc 3; text -label (uiRes("m_AEtextureToGeomTemplate.kImageFile")); textField imageNameField; symbolButton -i "navButtonBrowse.png" browserBtn; setParent ..; setUITemplate -ppt; TGimageFileReplace( $attrName ); } global proc TGquantizeCB( string $nodeName ) { string $nodeAttr = $nodeName + ".quantize"; int $value = `getAttr $nodeAttr`; if ( `columnLayout -ex quantizeLayout` ) { columnLayout -e -en $value quantizeLayout; } } global proc TGquantizeReplace( string $attr ) { connectControl quantizeSlider $attr; } global proc TGquantizeNew( string $attr ) { setUITemplate -pst attributeEditorTemplate; columnLayout -adjustableColumn 1 quantizeLayout; intSliderGrp -label (uiRes("m_AEtextureToGeomTemplate.kQuantize")) -min 1 -max 64 quantizeSlider; setParent ..; setUITemplate -ppt; TGquantizeReplace( $attr ); } global proc AEtextureToGeomTemplate( string $nodeName ) { editorTemplate -beginScrollLayout; editorTemplate -beginLayout (uiRes("m_AEtextureToGeomTemplate.kImageProperties")) -collapse 0; editorTemplate -suppress "segGroupIds"; editorTemplate -suppress "simplifyThreshold"; editorTemplate -suppress "pointsOnBoundary"; editorTemplate -callCustom "TGimageFileNew" "TGimageFileReplace" "imageFile"; editorTemplate -callCustom "TGimageFileReload" "TGimageFileReloadReplace" "imageFile"; editorTemplate -endLayout; editorTemplate -beginLayout (uiRes("m_AEtextureToGeomTemplate.kSegmentDetectionOptions")) -collapse 1; editorTemplate -addControl "quantize" "TGquantizeCB" ; editorTemplate -callCustom "TGquantizeNew" "TGquantizeReplace" "quantizeLevels"; editorTemplate -label (uiRes("m_AEtextureToGeomTemplate.kSearchRadius")) -addControl "spatialRadius"; editorTemplate -label (uiRes("m_AEtextureToGeomTemplate.kMinimumSegmentSize")) -addControl "minSegmentSize"; editorTemplate -label (uiRes("m_AEtextureToGeomTemplate.kColorRange")) -addControl "colorRange"; editorTemplate -label (uiRes("m_AEtextureToGeomTemplate.kMaximumColorDifference")) -addControl "maxColorDiff"; editorTemplate -endLayout; editorTemplate -beginLayout (uiRes("m_AEtextureToGeomTemplate.kMeshingOptions")) -collapse 1; global int $gEnableMeshGenerationSettings = 0; if ( $gEnableMeshGenerationSettings ) { editorTemplate -beginLayout (uiRes("m_AEtextureToGeomTemplate.kSmoothing")) -collapse 0; editorTemplate -label (uiRes("m_AEtextureToGeomTemplate.kSmoothBoundaries")) -addControl "smoothBoundary"; editorTemplate -label (uiRes("m_AEtextureToGeomTemplate.kSmoothingFactor")) -addControl "smoothFactor"; editorTemplate -endLayout ; editorTemplate -beginLayout (uiRes("m_AEtextureToGeomTemplate.kCornerDetection")) -collapse 0; editorTemplate -addControl "hardCornerDetect"; editorTemplate -addControl "hardCornerMaxLength"; editorTemplate -endLayout; editorTemplate -beginLayout (uiRes("m_AEtextureToGeomTemplate.kQuality")) -collapse 0; editorTemplate -addControl "simplifyBoundary"; editorTemplate -addControl "meshQuality"; editorTemplate -addControl "maxPointsAdded"; editorTemplate -endLayout ; } else { editorTemplate -suppress "smoothBoundary"; editorTemplate -suppress "smoothFactor"; editorTemplate -suppress "hardCornerDetect"; editorTemplate -suppress "hardCornerMaxLength"; editorTemplate -suppress "meshQuality"; editorTemplate -suppress "simplifyBoundary"; editorTemplate -addControl "maxPointsAdded"; } editorTemplate -endLayout; editorTemplate -beginLayout (uiRes("m_AEtextureToGeomTemplate.kSurfaceFitting")) -collapse 0; editorTemplate -addControl "surfaceOffset"; editorTemplate -label (uiRes("m_AEtextureToGeomTemplate.kUVSet")) -addControl "inputMeshUVSet"; editorTemplate -endLayout ; editorTemplate -suppress "fitTolerance"; editorTemplate -suppress "inputMesh"; editorTemplate -addExtraControls; editorTemplate -endScrollLayout; }