// =========================================================================== // 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: // AElayeredTextureTemplate // // Description Name; // Creates the attribute editor controls for the layeredTexture Node // // Input Value: // nodeName // // Output Value: // None // // // Procedure Name: // AElayeredTextureInteractivePortNew // global proc AElayeredTextureInteractivePortNew (string $inputs) { // Crack an attribute name open to get the name of the node // string $layeredName[]; tokenize($inputs, ".", $layeredName); string $portName = `layeredTexturePort -node $layeredName[0] layeredPort`; // Create the controls for adjusting the color, alpha, // blend mode and visibility of each layer. // setUITemplate -pst attributeEditorTemplate; string $selectedColorControl = `attrColorSliderGrp -label (uiRes("m_AElayeredTextureTemplate.kColor")) selectedColorControl`; // In order to get the map button on the field slider group for // the alpha channel we need to specify an attribute up front // for some reason. Arbitrarily choose the first valid index. // Note that it is important to check for validity as querying // an invalid index automatically creates it and causes a black // layer to be added to the front of the layered texture (bug 341688). int $index = 0; int $validIndices[] = `getAttr -multiIndices $inputs`; if (size($validIndices) > 0) { $index = $validIndices[0]; } string $selectedAlphaControl = `attrFieldSliderGrp -label (uiRes("m_AElayeredTextureTemplate.kAlpha")) -attribute ($inputs + "[" + $index + "].alpha") selectedAlphaControl`; string $selectedBlendModeControl = `attrEnumOptionMenuGrp -label (uiRes("m_AElayeredTextureTemplate.kBlendMode")) -ei 0 (uiRes("m_AElayeredTextureTemplate.kBlendNone")) -ei 1 (uiRes("m_AElayeredTextureTemplate.kBlendOver")) -ei 2 (uiRes("m_AElayeredTextureTemplate.kBlendIn")) -ei 3 (uiRes("m_AElayeredTextureTemplate.kBlendOut")) -ei 4 (uiRes("m_AElayeredTextureTemplate.kBlendAdd")) -ei 5 (uiRes("m_AElayeredTextureTemplate.kBlendSubtract")) -ei 6 (uiRes("m_AElayeredTextureTemplate.kBlendMultiply")) -ei 7 (uiRes("m_AElayeredTextureTemplate.kBlendDiff")) -ei 8 (uiRes("m_AElayeredTextureTemplate.kBlendLighten")) -ei 9 (uiRes("m_AElayeredTextureTemplate.kBlendDarken")) -ei 10 (uiRes("m_AElayeredTextureTemplate.kBlendSaturate")) -ei 11 (uiRes("m_AElayeredTextureTemplate.kBlendDesaturate")) -ei 12 (uiRes("m_AElayeredTextureTemplate.kBlendIllum")) selectedBlendModeControl`; string $selectedIsVisibleControl = `checkBoxGrp -numberOfCheckBoxes 1 -label1 (uiRes("m_AElayeredTextureTemplate.kLayerIsVisible")) selectedIsVisibleControl`; setUITemplate -ppt; // //////////////////////////////////////////////////////// layeredTexturePort -e -scc $selectedColorControl $portName; layeredTexturePort -e -sac $selectedAlphaControl $portName; layeredTexturePort -e -sbc $selectedBlendModeControl $portName; layeredTexturePort -e -svc $selectedIsVisibleControl $portName; } // // Procedure Name: // AElayeredTextureInteractivePortReplace // global proc AElayeredTextureInteractivePortReplace (string $inputs) { // Crack an attribute name open to get the name of the node // string $layeredName[]; tokenize($inputs, ".", $layeredName); layeredTexturePort -edit -node $layeredName[0] layeredPort; } // // Procedure Name: // AElayeredTextureTemplate // global proc AElayeredTextureTemplate ( string $nodeName ) { AEswatchDisplay $nodeName; editorTemplate -beginScrollLayout; editorTemplate -beginLayout (uiRes("m_AElayeredTextureTemplate.kLayeredTextureAttr")) -collapse 0; editorTemplate -callCustom "AElayeredTextureInteractivePortNew" "AElayeredTextureInteractivePortReplace" "inputs"; editorTemplate -endLayout; editorTemplate -addControl "alphaIsLuminance"; editorTemplate -addControl "hardwareColor"; // include/call base class/node attributes AEdependNodeTemplate $nodeName; editorTemplate -addExtraControls; editorTemplate -endScrollLayout; }