// =========================================================================== // 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. // =========================================================================== // // // Creation Date: 09 Feb 2004 // // Description: // This procedure adds property sheet controls for // a new attribute of matrix type. This is for internal // use only. // // Input Arguments: // The name of the plug for the attribute // The name of the attribute // // Return Value: // The name of the newly-created control. // global proc AEupdateMatrix(string $controlName, string $plugName) { string $floatFieldGrps[] = `columnLayout -q -ca $controlName`; float $val0[] = `floatFieldGrp -q -value $floatFieldGrps[0]`; float $val1[] = `floatFieldGrp -q -value $floatFieldGrps[1]`; float $val2[] = `floatFieldGrp -q -value $floatFieldGrps[2]`; float $val3[] = `floatFieldGrp -q -value $floatFieldGrps[3]`; setAttr $plugName -type "matrix" $val0[0] $val0[1] $val0[2] $val0[3] $val1[0] $val1[1] $val1[2] $val1[3] $val2[0] $val2[1] $val2[2] $val2[3] $val3[0] $val3[1] $val3[2] $val3[3] ; } global proc string AEnewMatrix ( string $plugName, string $attrName, string $changedCommand ) { string $buffer[]; tokenize($plugName, ".", $buffer); string $node = (size($buffer) > 0) ? $buffer[0] : ""; // Is this attr multi? // if so, $plugname looks like this: attrname[n] int $isMulti = 0; clear($buffer); tokenize($plugName, "[",$buffer); // Yes. multi compound if( size($buffer) >1 ) { $isMulti = 1; } string $createdControl = `columnLayout -adj true `; string $cmd ; if( $changedCommand == "" ) $cmd = "AEupdateMatrix(\"" + $createdControl + "\",\"" + $plugName + "\")"; else $cmd = $changedCommand+" \""+$node+"\""; if( $isMulti ) setUITemplate -pst attributeEditorMatrixMultiTemplate; else setUITemplate -pst attributeEditorMatrixTemplate; floatFieldGrp -nf 4 -cc $cmd; floatFieldGrp -nf 4 -cc $cmd; floatFieldGrp -nf 4 -cc $cmd; floatFieldGrp -nf 4 -cc $cmd; setParent ..; setUITemplate -popTemplate; AEreplaceMatrix($createdControl, $plugName, $changedCommand); return $createdControl; }