- 最后登录
- 2017-9-14
- 注册时间
- 2014-8-12
- 阅读权限
- 20
- 积分
- 235
- 纳金币
- 215
- 精华
- 0
|
// Copyright (C) 1997-2013 Autodesk, Inc., and/or its licensors.
// All rights reserved.
//
// The coded instructions, statements, computer programs, and/or related
// material (collectively the "Data") in these files contain unpublished
// information proprietary to Autodesk, Inc. ("Autodesk") and/or its licensors,
// which is protected by U.S. and Canadian federal copyright law and by
// international treaties.
//
// The Data is provided for use exclusively by You. You have the right to use,
// modify, and incorporate this Data into other products for purposes authorized
// by the Autodesk software license agreement, without fee.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. AUTODESK
// DOES NOT MAKE AND HEREBY DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTIES
// INCLUDING, BUT NOT LIMITED TO, THE WARRANTIES OF NON-INFRINGEMENT,
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, OR ARISING FROM A COURSE
// OF DEALING, USAGE, OR TRADE PRACTICE. IN NO EVENT WILL AUTODESK AND/OR ITS
// LICENSORS BE LIABLE FOR ANY LOST REVENUES, DATA, OR PROFITS, OR SPECIAL,
// DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES, EVEN IF AUTODESK AND/OR ITS
// LICENSORS HAS BEEN ADVISED OF THE POSSIBILITY OR PROBABILITY OF SUCH DAMAGES.
// Procedure Name:
// updateUvSetEditor
//
// Description:
// Updates the uvSetEditor when called. When the uvSetEditor is created
// it creates a scriptJob that is tied to it that cals this when the selection
// changes. This is also called from uvSetEditCmd.
//
// Input Arguments:
// None.
//
// Return Value:
// None.
//
global proc updateUvSetEditor( )
{
// typically, user will have transform selected so find mesh shapes
//
string $objects[] = `listRelatives -s -fullPath -type "mesh" -noIntermediate`;
// if there is nothing, check to see if shapes are selected
//
if (!`size $objects`)
$objects = `ls -sl -type "mesh"`;
// if there is still nothing, check to see if components are selected
//
if (!`size $objects`)
$objects = `listRelatives -p -fullPath -type "mesh"`;
// clear the set list
//
textScrollList -e -ra uvSetList;
// if there are meshes, populate the list with the cpv sets
// from the first selected mesh
//
if (`size $objects`){
string $sets[] = `polyUVSet -pi 1 -q -allUVSets $objects[0]`;
for( $set in $sets ) {
string $perInstUVSet[] = `polyUVSet -uvSet $set -q -pi $objects[0]`;
if (size($perInstUVSet[0]) > 0) {
$set = $perInstUVSet[0];
} else {
continue;
}
textScrollList -e -a $set uvSetList;
}
//***need to add controls for enable/disable state of buttons
// select the current uv set
//
string $currentUVSet[] = `polyUVSet -q -currentPerInstanceUVSet $objects[0]`;
if( `size $currentUVSet` > 0 )
textScrollList -e -si $currentUVSet[0] uvSetList;
}
}
// Procedure Name:
// builduvSetEditorContextHelpItems
//
// Description:
// Creates the help menu and items for the uvSetEditor.
//
// Input Arguments:
// $nameRoot - name to use as the root of all item names
// $menuParent - the name of the parent of this menu
//
// Return Value:
// None
//
global proc builduvSetEditorContextHelpItems(string $nameRoot, string $menuParent)
{
menuItem -label (uiRes("m_uvSetEditor.kHelpOnUVSetEditor"))
-enableCommandRepeat false
-command "showHelp uvSetEditor";
}
// Procedure Name:
// uvSetEditor
//
// Description:
// Creates the uvSetEditor for editting multiple CPV sets.
//
// Input Arguments:
// None.
//
// Return Value:
// None.
//
global proc uvSetEditor( )
{
if( `window -exists uvSetEditor` ) {
deleteUI -window uvSetEditor;
}
// GG: don't hardcode the HEIGHT! It doesn't work X-platform
window -title (uiRes("m_uvSetEditor.kUVSetEditor"))
-menuBar true
-w 223
-s true
uvSetEditor;
addContextHelpProc "uvSetEditor" "builduvSetEditorContextHelpItems";
menu
-label (uiRes("m_uvSetEditor.kPolyUVsPerInstance"));
menuItem
-label (uiRes("m_uvSetEditor.kPolyUVSelectShared"))
-annotation (uiRes("m_uvSetEditor.kPolyUVSelectSharedAnnot"))
-command "SelectSharedUVInstances";
menuItem
-label (uiRes("m_uvSetEditor.kPolyUVShareInstances"))
-annotation (uiRes("m_uvSetEditor.kPolyUVShareInstancesAnnot"))
-command "ShareUVInstances";
setParent -menu ..;
doHelpMenu("uvSetEditor", "uvSetEditor");
formLayout colorEditorForm;
textScrollList
-ams true
-deleteKeyCommand "uvSetEditCmd delete uvSetList"
-doubleClickCommand "uvSetEditCmd rename uvSetList"
-selectCommand "uvSetEditCmd setCurrent uvSetList"
uvSetList;
separator -style "in" scrollButtonsSeparator;
columnLayout uvSetEditorButtonLayout;
button -h 26 -w 80
-label (uiRes("m_uvSetEditor.kPolyNewUVSet"))
-annotation (uiRes("m_PolygonsCreateUVsMenu.kPolyUVsCreateUVSetAnnot"))
-enable true
-c "uvSetEditCmd new uvSetList"
newButton;
button -h 26 -w 80
-label (uiRes("m_uvSetEditor.kPolyRenameUVSet"))
-annotation (uiRes("m_PolygonsCreateUVsMenu.kPolyUVsRenameCurrentUVSetAnnot"))
-c "uvSetEditCmd rename uvSetList"
-enable true
renameButton;
button -h 26 -w 80
-label (uiRes("m_uvSetEditor.kPolyDeleteUVSet"))
-annotation (uiRes("m_PolygonsCreateUVsMenu.kPolyUVsDeleteCurrentUVSetAnnot"))
-c "uvSetEditCmd delete uvSetList"
-enable true
deleteButton;
button -h 26 -w 80
-label (uiRes("m_uvSetEditor.kPolyCopyUVSet"))
-annotation (uiRes("m_PolygonsCreateUVsMenu.kPolyUVsCopyIntoNewUVSetAnnot"))
-c "uvSetEditCmd copy uvSetList"
-enable true
copyButton;
button -h 26 -w 80
-label (uiRes("m_uvSetEditor.kPolyPropagateUVSet"))
-annotation (uiRes("m_uvSetEditor.kPolyPropagateUVSetAnnot"))
-c "uvSetEditCmd propagate uvSetList"
-enable true
propagateButton;
button -h 26 -w 80
-label (uiRes("m_uvSetEditor.kPolyUnmappedUVSet"))
-annotation (uiRes("m_uvSetEditor.kPolyUnmappedUVSetAnnot"))
-c "polyCleanupArgList 3 { \"0\",\"2\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"1e-005\",\"0\",\"1e-005\",\"1\",\"1e-006\",\"0\",\"-1\",\"0\" };"
-enable true
unmappedButton;
setParent ..;
button -h 26 -w 80
-label (uiRes("m_uvSetEditor.kPolyUpdateUVSet"))
-c "updateUvSetEditor"
updateButton;
button -h 26 -w 80
-label (uiRes("m_uvSetEditor.kPolyCloseUVSet"))
-c "deleteUI -window uvSetEditor"
closeButton;
setParent ..;
formLayout -e
-af uvSetList top 5
-ac uvSetList right 5 uvSetEditorButtonLayout
-af uvSetList left 5
-ac uvSetList bottom 5 scrollButtonsSeparator
-af uvSetEditorButtonLayout top 5
-af uvSetEditorButtonLayout right 5
-an uvSetEditorButtonLayout left
-ac uvSetEditorButtonLayout bottom 5 scrollButtonsSeparator
-af scrollButtonsSeparator left 0
-af scrollButtonsSeparator right 0
-ac scrollButtonsSeparator bottom 5 updateButton
-an scrollButtonsSeparator top
-af updateButton left 5
-af updateButton bottom 5
-ap updateButton right 3 50
-an updateButton top
-ap closeButton left 2 50
-af closeButton bottom 5
-af closeButton right 5
-an closeButton top
colorEditorForm;
// Create script jobs to keep the uv set editor up to date
// when the selection changes
//
scriptJob
-parent "uvSetEditor"
-event "SelectionChanged"
"updateUvSetEditor";
scriptJob
-parent "uvSetEditor"
-event "Undo" "updateUvSetEditor";
scriptJob
-parent "uvSetEditor"
-event "Redo" "updateUvSetEditor";
updateUvSetEditor;
showWindow uvSetEditor;
}
|
|