// =========================================================================== // 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: // AEhyperLayoutTemplate // // Description Name; // Creates the attribute editor controls for the hyperLayout node // // Input Value: // nodeName // // Output Value: // None // // // Procedure Name: // AEhyperLayoutImageNameNew // global proc AEhyperLayoutImageNameNew (string $fileAttribute) { setUITemplate -pst attributeEditorTemplate; columnLayout -adj true; rowLayout -nc 3 hyperLayoutImageNameLayout; text -label (uiRes("m_AEhyperLayoutTemplate.kImageName")) ; textField hyperLayoutImageNameField; symbolButton -image "navButtonBrowse.png" browser; setParent ..; setParent ..; setUITemplate -ppt; AEhyperLayoutImageNameReplace $fileAttribute; } // // Procedure Name: // AEhyperLayoutImageNameReplace // global proc AEhyperLayoutImageNameReplace (string $fileAttribute) { connectControl -fileName hyperLayoutImageNameField $fileAttribute; string $nodeName[]; tokenize($fileAttribute, ".", $nodeName); string $hyperPanel[] = `getPanel -scriptType hyperGraphPanel`; string $editor = ($hyperPanel[0] + "HyperGraphEd"); scriptJob -p hyperLayoutImageNameField -rp -ac $fileAttribute ("AEhyperLayoutUpdateImageName "+$fileAttribute); scriptJob -p hyperLayoutImageNameField -ac ($nodeName[0] + ".imageScale") ("hyperGraph -e -forceRefresh " +$editor); string $command = "loadHyperGraphImage "+" "+$fileAttribute; button -e -c $command browser; $command = "loadHyperGraphImageCB "+" "+$fileAttribute; textField -e -cc "loadHyperGraphImageCB \"#1\"" hyperLayoutImageNameField; } global proc AEhyperLayoutUpdateImageName (string $fileAttribute) { string $value = `getAttr $fileAttribute`; textField -e -text $value hyperLayoutImageNameField; } global proc int loadHyperGraphImageCallback ( string $fileAttribute , string $theFile , string $theFileType) { setAttr $fileAttribute -type "string" $theFile; string $hyperPanel[] = `getPanel -scriptType hyperGraphPanel`; string $editor = ($hyperPanel[0] + "HyperGraphEd"); // Optional retaining of the new directory. string $currentDir = `workspace -q -dir`; // retainWorkingDirectory $currentDir; // Do stuff with $theFile // file -i -type $theFileType $theFile; // Or whatever. hyperGraph -e -image $theFile $editor; hyperGraph -e -imageEnabled true $editor; return 1; } global proc int loadHyperGraphImageCB ( string $theFile ) { string $hyperPanel[] = `getPanel -scriptType hyperGraphPanel`; string $editor = ($hyperPanel[0] + "HyperGraphEd"); // Optional retaining of the new directory. string $currentDir = `workspace -q -dir`; hyperGraph -e -image $theFile $editor; hyperGraph -e -imageEnabled true $editor; return 1; } global proc loadHyperGraphImage(string $fileAttribute) { string $hyperPanel[] = `getPanel -scriptType hyperGraphPanel`; string $editor = ($hyperPanel[0] + "HyperGraphEd"); $myWorkspace = `workspace -q -fn`; setWorkingDirectory($myWorkspace, "image", "images"); string $cmd = "loadHyperGraphImageCallback " + $fileAttribute; fileBrowser $cmd (uiRes("m_AEhyperLayoutTemplate.kLoadImage")) "image" 0; } global proc AEhyperLayoutTemplate ( string $nodeName ) { editorTemplate -beginScrollLayout; editorTemplate -beginLayout (uiRes("m_AEhyperLayoutTemplate.kHyperLayoutAttributes")) -collapse 0; editorTemplate -callCustom "AEhyperLayoutImageNameNew" "AEhyperLayoutImageNameReplace" "imageName"; editorTemplate -addControl "imageScale"; editorTemplate -endLayout; // include/call base class/node attributes AEdependNodeTemplate $nodeName; editorTemplate -addExtraControls; editorTemplate -endScrollLayout; }