// =========================================================================== // 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: // AEorientConstraintTemplate // // Description Name; // Creates the attribute editor controls for the orientConstraint Node // // Input Value: // nodeName // // Output Value: // None // global proc AEorientCheckInterpType(string $nodeName) { int $interpType = `getAttr ($nodeName+".interpType")`; string $cacheExists[] = `listConnections ($nodeName+".interpCache")`; int $enableDeleteCache = (size($cacheExists) > 0); button -e -en $enableDeleteCache deleteCacheButton; // interpType is an enum, and interpType == 4 is "cache" // int $enableCreateCache = (($interpType == 4) && (size($cacheExists) == 0) || ($interpType == 0)); button -e -en $enableCreateCache createCacheButton; } global proc AEorientCacheReplace(string $plug) { string $buff[]; tokenize($plug,".",$buff); string $nodeName = $buff[0]; float $rangeStart = `playbackOptions -q -min`; float $rangeEnd = `playbackOptions -q -max`; button -e -c ("evalEcho \"orientConstraint -e -dc "+$nodeName+"\"; "+ "button -e -en false deleteCacheButton; " + "button -e -en true createCacheButton") deleteCacheButton; button -e -c ("evalEcho \"orientConstraint -e -cc "+ $rangeStart+" "+$rangeEnd+" "+$nodeName+"\"; "+ "button -e -en true deleteCacheButton") createCacheButton; } global proc AEorientCacheNew(string $plug) { setUITemplate -pst attributeEditorTemplate; columnLayout cachectlColumn; rowLayout -nc 5 deleteCacheLayout; text -label (uiRes("m_AEorientConstraintTemplate.kCache")) ; button -label (uiRes("m_AEorientConstraintTemplate.kCreate")) createCacheButton; text -l ""; button -label (uiRes("m_AEorientConstraintTemplate.kDelete")) deleteCacheButton; text -l ""; setParent ..; AEorientCacheReplace($plug); setUITemplate -ppt; } global proc AEenableRestOrientCallback( string $nodeName ) { int $enable = `getAttr ($nodeName+".enableRestPosition")`; editorTemplate -dimControl $nodeName "restRotate" (! $enable); } global proc AEorientConstraintTemplate ( string $nodeName ) { editorTemplate -beginScrollLayout; // include/call base class/node attributes AEtransformMain $nodeName; editorTemplate -beginLayout (uiRes("m_AEorientConstraintTemplate.kOrientConstraintAttributes")) -collapse 0; editorTemplate -addControl "lockOutput"; editorTemplate -addControl "offset"; editorTemplate -addControl "interpType" "AEorientCheckInterpType"; editorTemplate -callCustom "AEorientCacheNew" "AEorientCacheReplace" "interpType"; editorTemplate -addSeparator; editorTemplate -addControl "constraintRotate"; editorTemplate -addControl "enableRestPosition" "AEenableRestOrientCallback"; editorTemplate -addControl "restRotate"; editorTemplate -endLayout; //suppressed attributes editorTemplate -suppress "constraintParentInverseMatrix"; editorTemplate -suppress "target"; editorTemplate -suppress "constraintRotateOrder"; editorTemplate -suppress "constraintJointOrient"; editorTemplate -suppress "scaleCompensate"; editorTemplate -suppress "inverseScale"; editorTemplate -suppress "interpCache"; editorTemplate -suppress "lastTargetRotate"; // include/call base class/node attributes AEtransformNoScroll $nodeName; editorTemplate -addExtraControls; editorTemplate -endScrollLayout; }