// =========================================================================== // 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. // =========================================================================== global proc AEMASH_FontTemplate( string $nodeName ) { editorTemplate -beginScrollLayout; python("import MASH.nodeHeaders; MASH.nodeHeaders.addHeader('" + $nodeName + "', '3D Font', False)") editorTemplate -endLayout; editorTemplate -callCustom "MASHTextEditBuildQt" "MASHTextEditUpdateQt" ""; editorTemplate -callCustom "MASHFontBlendShapes" "MASHFontBlendShapesEdit" ""; AEdependNodeTemplate $nodeName; editorTemplate -addExtraControls; editorTemplate -endScrollLayout; } global proc MASHTextEditBuildQt(string $nodeName) { string $buffer[]; tokenize($nodeName, ".", $buffer); $nodeName = $buffer[0]; python("import MASHTextFieldWidget"); string $parent = `setParent -q`; //get python to create the widget, include the desired nodeType as an arguement python("MASHTextFieldWidget.build_qt_widget('" + $parent + "','" + $nodeName + "')"); setParent..; } global proc MASHTextEditUpdateQt(string $nodeName ) { string $buffer[]; tokenize($nodeName, ".", $buffer); $nodeName = $buffer[0]; string $parent = `setParent -q`; python("import MASHTextFieldWidget"); python("MASHTextFieldWidget.update_qt_widget('" + $parent + "','" + $nodeName + "')"); } global proc MASHFontBlendShapes(string $nodeName) { string $buffer[]; tokenize($nodeName, ".", $buffer); $nodeName = $buffer[0]; frameLayout -label "Font BlendShapes" -collapse 0 mashFontBlendShapeLayout; //build the blendshape sliders MASHFontPopulateBlendShapes($nodeName); setParent..; } global proc MASHFontBlendShapesEdit(string $nodeName) { string $buffer[]; tokenize($nodeName, ".", $buffer); $nodeName = $buffer[0]; string $blendShapeAttributes[] = `frameLayout -q -ca mashFontBlendShapeLayout`; // delete all the blendshape sliders for ($ui in $blendShapeAttributes) { deleteUI $ui; } // rebuild the blendshape sliders setParent mashFontBlendShapeLayout; MASHFontPopulateBlendShapes($nodeName); } global proc MASHFontPopulateBlendShapes(string $nodeName) { string $instancer[]; if (`objExists ($nodeName + ".instancerMessage")`) { $instancer = `listConnections -d on -s on ($nodeName + ".instancerMessage")`; } if (size($instancer) > 0) { if (`nodeType $instancer[0]` == "instancer") { string $objs[] = `instancer -q -obj $instancer[0]`; if (size($objs) > 0) { string $nsbuffer[]; tokenize($objs[0], ":", $nsbuffer); string $namespace = $nsbuffer[0]; string $nsObjs[] = `ls ($namespace+":*")`; for ($node in $nsObjs) { if (`nodeType $node` == "blendShape") { string $blendShapeAttrs[] = `listAttr -multi ($node+".w")`; for ($attr in $blendShapeAttrs) { attrFieldSliderGrp -label $attr -at ($node+"."+$attr); } } } } } else { // Repro support to go here. } } }