// =========================================================================== // 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: Aug 28, 1998 // // // Description: // This implements the "Texture" submenu on the modeling menubar. // global proc SubdRequestUVSetName (string $title, string $cmd, string $version, string $args[]) // // Procedure Name: // SubdRequestUVSetName // // Description: // Helper method to ask the user for a new UV set name and then call // a command with the name as the final argument. The command will be // called like: $cmd $version $args "uvSetName" // // Input Arguments: // string $title The title for the dialog box // string $cmd The command to issue // string $version Version to pass onto the command // string $args Arguments to pass onto the command // // Return Value: // None. // { string $ok = (uiRes("m_SubdTextureMenu.kOK")); string $cancel = (uiRes("m_SubdTextureMenu.kCancel")); string $response = `promptDialog -title $title -message (uiRes("m_SubdTextureMenu.kUVSetName")) -text "uvSet" -button $ok -button $cancel -defaultButton $ok -cancelButton $cancel -dismissString $cancel`; if ($response == $ok) { string $name = `promptDialog -query -text`; string $execute = ($cmd + " \"" + $version + "\" {"); string $comma = ""; for ($arg in $args) { $execute += ($comma + "\"" + $arg + "\""); $comma = ", "; } $execute += ("} \"" + $name + "\""); eval ($execute); } } global proc SubdTextureMenu (string $parent, int $creator, string $selectCmd) // // Procedure Name: // SubdTextureMenu // // Description: // Helper method to generate the menu items for the texture menus // // Input Arguments: // string $parent The name of the parent widget // int $creator Which creator is calling this // Current known creators // 0 Edit Polygons->Textures // 1 Relationship Editor->Edit->Create UV Set // string $selectCmd The command to issue to determine which objects // to affect // // Return Value: // None. // { setParent -m $parent; // string $prefix = ($creator == 0 ? "" : "SubdRequestUVSetName \"Create Planar Mapping\" "); string $prefix = ($creator == 0 ? "" : "SubdRequestUVSetName \"Create Planar Mapping\" "); string $cmd = $prefix + "performSubdProjectionArgList"; string $version = "\"1\""; string $args0 = ("{\"0\", \"Planar\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}"); string $args1 = ("{\"1\", \"Planar\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}"); string $args2 = ("{\"2\", \"Planar\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}"); string $suffix = ($creator == 0 ? " \"\"" : ""); string $dmc = "performSubdProjectionArgList \"1\" {\"2\", \"Planar\", \"ls -sl\", \"0\"} \"\";"; string $c = ($cmd + " " + $version + " " + $args0 + $suffix); string $planarItem1 = (uiRes("m_SubdTextureMenu.kPlanarOption1")); string $planarItem2 = (uiRes("m_SubdTextureMenu.kPlanarOption2")); menuItem -label ($creator == 1 ? $planarItem1 : $planarItem2) -ecr true -i "polyPlanProjLarge.png" -dmc $dmc -annotation (uiRes("m_SubdTextureMenu.kCreatePlanarAnnot")) -c $c planarMappingItem; $c = ($cmd + " " + $version + " " + $args1 + $suffix); menuItem -optionBox 1 -i "polyPlanProjLarge.png" -annotation (uiRes("m_SubdTextureMenu.kPlanarMappingOptionsAnnot")) -ecr false -c $c planarMappingOptionItem; /* string $prefix = ($creator == 0 ? "" : "SubdRequestUVSetName \"Create Cylindrical Mapping\" "); string $cmd = $prefix + "performPolyProjectionArgList"; string $version = "\"1\""; string $args0 = ("{\"0\", \"Cylindrical\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}"); string $args1 = ("{\"1\", \"Cylindrical\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}"); string $args2 = ("{\"2\", \"Cylindrical\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}"); string $suffix = ($creator == 0 ? " \"\"" : ""); string $dmc = "performPolyProjectionArgList \"1\" {\"2\", \"Cylindrical\", \"ls -sl\", \"0\"} \"\";"; string $c = ($cmd + " " + $version + " " + $args0 + $suffix); string $cylindricalItem1 = (uiRes("m_SubdTextureMenu.kCylindricalItem1")); string $cylindricalItem2 = (uiRes("m_SubdTextureMenu.kCylindricalItem2")); menuItem -label ($creator == 1 ? $cylindricalItem1 : $cylindricalItem2) -ecr true -i "polyCylProjLarge.png" -dmc $dmc -annotation (uiRes("m_SubdTextureMenu.kCreateCylindricalProjectionAnnot")) -c $c cylindricMappingItem; string $c = ($cmd + " " + $version + " " + $args1 + $suffix); menuItem -optionBox 1 -i "polyCylProjLarge.png" -annotation (uiRes("m_SubdTextureMenu.kCylindricalMappingOptionsAnnot")) -ecr false -c $c cylindricMappingOptionItem; string $prefix = ($creator == 0 ? "" : "SubdRequestUVSetName \"Create Spherical Mapping\" "); string $cmd = $prefix + "performPolyProjectionArgList"; string $version = "\"1\""; string $args0 = ("{\"0\", \"Spherical\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}"); string $args1 = ("{\"1\", \"Spherical\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}"); string $args2 = ("{\"2\", \"Spherical\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}"); string $suffix = ($creator == 0 ? " \"\"" : ""); string $c = ($cmd + " " + $version + " " + $args0 + $suffix); string $dmc = "performPolyProjectionArgList \"1\" {\"2\", \"Spherical\", \"ls -sl\", \"0\"} \"\";"; string $spericalItem1 = (uiRes("m_SubdTextureMenu.kSpericalItem1")); string $spericalItem2 = (uiRes("m_SubdTextureMenu.kSpericalItem2")); menuItem -label ($creator == 1 ? $spericalItem1 : $spericalItem2) -ecr true -i "polySphereProjLarge.png" -dmc $dmc -annotation (uiRes("m_SubdTextureMenu.kCreateSphericProjectionAnnot")) -c $c sphericMappingItem; $c = ($cmd + " " + $version + " " + $args1 + $suffix); menuItem -ob 1 -i "polySphereProjLarge.png" -annotation (uiRes("m_SubdTextureMenu.kSphericalMappingOptionsAnnot")) -ecr false -c $c sphericMappingOptionItem; ////////////////////////////////////////////////////////////////////// menuItem -divider true; if ($creator != 1) { menuItem -label (uiRes("m_SubdTextureMenu.kMapUVBorder")) -ecr true -i "polyMapUVBorder.png" -annotation (uiRes("m_SubdTextureMenu.kMapTextureAnnot")) -ddc "performPolyUntangleUV map 1" -dmc "performPolyUntangleUV map 2" -c "MapUVBorder" mapUVBorderItem; menuItem -optionBox 1 -i "polyMapUVBorder.png" -annotation (uiRes("m_SubdTextureMenu.kMapUVBorderOptionsAnnot")) -ecr false -c "performPolyUntangleUV map 1" mapUVBorderOptionItem; menuItem -label (uiRes("m_SubdTextureMenu.kRelaxUVs")) -ecr true -i "polyRelaxUVShell.png" -annotation (uiRes("m_SubdTextureMenu.kRelaxSelectedUVsAnnot")) -ddc "performPolyUntangleUV relax 1" -dmc "performPolyUntangleUV relax 2" -c "RelaxUVShell" relaxUVShellItem; menuItem -optionBox 1 -i "polyRelaxUVShell.png" -annotation (uiRes("m_SubdTextureMenu.kRelaxUVsOptionsAnnot")) -ecr false -c "performPolyUntangleUV relax 1" relaxUVShellOptionItem; } */ menuItem -label (uiRes("m_SubdTextureMenu.kAutomaticMapping")) -annotation (uiRes("m_SubdTextureMenu.kSelectFacesAnnot")) -c "performSubdAutoProj 0" -i "polyAutoProjLarge.png" ; menuItem -optionBox 1 -annotation (uiRes("m_SubdTextureMenu.kAutomaticProjectionAnnot")) -c "performSubdAutoProj 1" -ecr false -i "polyAutoProjLarge.png"; ////////////////////////////////////////////////////////////////////// if ($creator != 1) { // menuItem -divider true; menuItem -label (uiRes("m_SubdTextureMenu.kLayoutUVs")) -annotation (uiRes("m_SubdTextureMenu.kSelectFacesUVAnnot")) -c "performSubdLayoutUV 0" -i "polyLayoutUVLarge.png"; menuItem -optionBox 1 -annotation (uiRes("m_SubdTextureMenu.kLayoutUVsOptionsAnnot")) -c "performSubdLayoutUV 1" -ecr false -i "polyLayoutUVLarge.png"; } }