// =========================================================================== // 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. // =========================================================================== ////////////////////////////////////////////////////////////////////// // // Procedure Name: // createNewOverride // // Description: // This procedure is provided as a hook for customers to allow // you to redefine the behaviour of the "create new" button on // attributes. // // Input Arguments: // $dest - the name of the plug to which the newly created node is to // be connected. // $force - determines whether or not existing connections should be // overwritten by newly created ones // // Return Value: // Return 1 if you want Maya to perform the default creation behaviour // for the plug. Return 0 if you have chosen to implement a different // behaviour for this connection and don't want the normal operation to // be performed as well. // global proc int createNewOverride( string $dest, int $force ) { int $doNormalOperation = 1; string $destAttr[]; int $numTokens = tokenize( $dest, ".", $destAttr ); string $node = ""; string $attr = ""; if( $numTokens != 2 ) { return $doNormalOperation; } else { $node = $destAttr[0]; $attr = $destAttr[1]; } if ("dx11Shader" == `nodeType $node` && `attributeExists ($attr + "_Type") $node`) { string $type = `getAttr ($node + "." + $attr + "_Type")`; if ("texture" == $type) { $doNormalOperation = 0; string $cmd = "defaultNavigation -force true -connectToExisting -source %node -destination " + $dest; createRenderNodeCB -as2DTexture "" file $cmd; } } else if( $attr == "contourContrast" || $attr == "contourStore" ) { $doNormalOperation = 0; string $navCmd = ( "defaultNavigation -connectToExisting -destination " + $dest + " -source %node" ); createRenderNode -allWithMentalUp $navCmd ""; } return $doNormalOperation; }