// =========================================================================== // 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: December 11/2000 // // Description: // // This file contains the procedure which builds a popup menu for a file // the user has RMB clicked on in a hypergraph/visor which is displaying // Paint Effects brushes. // global proc creatorBrushBlend(string $fileName, float $percent) { setPresetBlend( $percent, $percent ); brushPresetSetup(); // Must be called after changing the percentage. // Now blend this brush. eval ("source \"" + $fileName + "\""); // Restore previous values. restorePresetBlend(); } global proc creatorShapeBlend(string $fileName, float $percent) { setPresetBlend( $percent, 0.0 ); brushPresetSetup(); // Now blend this brush. eval ("source \"" + $fileName + "\""); // Restore previous values. restorePresetBlend(); } global proc creatorShadingBlend(string $fileName, float $percent) { // Save current values. setPresetBlend( 0.0, $percent ); brushPresetSetup(); // Now blend this brush. eval ("source \"" + $fileName + "\""); // Restore previous values. restorePresetBlend(); } global proc copyBrushToSelected( string $fileName ) { // set the defualt brush to the selected one // eval ("source \"" + $fileName + "\""); // copy the the default brush to selected strokes // copyTemplateBrushToSelected(); } global proc int buildHypergraphBrushPopupMenuItems( string $editor, string $menu, string $filePath) { setParent -menu $menu; int $rItemsAdded = false; string $fileNameArray[]; tokenize($filePath, "/", $fileNameArray); string $fileNameTail = $fileNameArray[size($fileNameArray) - 1]; string $fileTypesArray[] = `file -query -type $filePath`; string $fileType = $fileTypesArray[0]; if ($fileType == "mel") { menuItem -label (uiRes("m_buildHypergraphBrushPopupMenuItems.kApplyBrush")) -command ("copyBrushToSelected(\"" + $filePath + "\")"); menuItem -divider true; menuItem -label (uiRes("m_buildHypergraphBrushPopupMenuItems.kBlendBrush50")) -command ("creatorBrushBlend(\"" + $filePath + "\", 0.5)"); menuItem -label (uiRes("m_buildHypergraphBrushPopupMenuItems.kBlendBrush20")) -command ("creatorBrushBlend(\"" + $filePath + "\", 0.2)"); menuItem -label (uiRes("m_buildHypergraphBrushPopupMenuItems.kBlendBrush5")) -command ("creatorBrushBlend(\"" + $filePath + "\", 0.05)"); menuItem -divider true; menuItem -label (uiRes("m_buildHypergraphBrushPopupMenuItems.kBlendShape100")) -command ("creatorShapeBlend(\"" + $filePath + "\", 1.0)"); menuItem -label (uiRes("m_buildHypergraphBrushPopupMenuItems.kBlendShape50")) -command ("creatorShapeBlend(\"" + $filePath + "\", 0.5)"); menuItem -label (uiRes("m_buildHypergraphBrushPopupMenuItems.kBlendShape20")) -command ("creatorShapeBlend(\"" + $filePath + "\", 0.2)"); menuItem -label (uiRes("m_buildHypergraphBrushPopupMenuItems.kBlendShape5")) -command ("creatorShapeBlend(\"" + $filePath + "\", 0.05)"); menuItem -divider true; menuItem -label (uiRes("m_buildHypergraphBrushPopupMenuItems.kBlendShading100")) -command ("creatorShadingBlend(\"" + $filePath + "\", 1.0)"); menuItem -label (uiRes("m_buildHypergraphBrushPopupMenuItems.kBlendShading50")) -command ("creatorShadingBlend(\"" + $filePath + "\", 0.5)"); menuItem -label (uiRes("m_buildHypergraphBrushPopupMenuItems.kBlendShading20")) -command ("creatorShadingBlend(\"" + $filePath + "\", 0.2)"); menuItem -label (uiRes("m_buildHypergraphBrushPopupMenuItems.kBlendShading5")) -command ("creatorShadingBlend(\"" + $filePath + "\", 0.05)"); $rItemsAdded = true; } return $rItemsAdded; }