// =========================================================================== // 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. // =========================================================================== // // Description: // Creation and manipulation of the GE preferences window // source "nodeEditorPanel.mel"; global proc switchGEPrefTabs(string $ned, int $whichTab) { int $index = $whichTab; string $prefIndex = ($ned + "PrefIndex"); if ($whichTab == 0) { int $indexLst[] = `textScrollList -q -selectIndexedItem $prefIndex`; if(size($indexLst) == 0) return; $index = $indexLst[0]; } else { textScrollList -e -selectIndexedItem $index $prefIndex; } string $uniqueTagLst[] = `textScrollList -q -selectUniqueTagItem $prefIndex`; if(size($uniqueTagLst) == 0) return; string $uniqueTag = tolower($uniqueTagLst[0]); string $prefTabs = ($ned + "GEPrefsTabs"); tabLayout -e -selectTabIndex $index $prefTabs; } proc loadSettingsGE(string $ned) { string $currentConnectionStyle = `nodeEditor -q -connectionStyle $ned`; optionVar -sv "nodeEdConnectionStylePush" $currentConnectionStyle; float $minSegment = `nodeEditor -q -csm $ned`; optionVar -fv "nodeEdConnectionMinSegmentPush" $minSegment; float $offset = `nodeEditor -q -cso $ned`; optionVar -fv "nodeEdConnectionOffsetPush" $offset; int $connectionTension = `nodeEditor -q -cst $ned`; optionVar -iv "nodeEdConnectionTensionPush" $connectionTension; float $connectionRoundness = `nodeEditor -q -csr $ned`; optionVar -fv "nodeEdConnectionRoundnessPush" $connectionRoundness; int $enableOpenGL = `nodeEditor -q -egl $ned`; optionVar -iv "nodeEdEnableOpenGLPush" $enableOpenGL; int $select = 1; if ($currentConnectionStyle == "bezier") $select = 1; else if ($currentConnectionStyle == "straight") $select = 2; else if ($currentConnectionStyle == "corner") $select = 3; else if ($currentConnectionStyle == "sshape") $select = 4; string $connectionStyleRBG = ($ned + "ConnectionStyleRBG"); radioButtonGrp -e -select $select $connectionStyleRBG; nodeEdGESetConnectionStyle $ned $currentConnectionStyle; string $enableOpenGLOM = ($ned + "EnableOpenGLOM"); if (`getenv "MAYA_NE_ENABLE_OPENGL"` != "") { $enableOpenGL = 1; optionMenuGrp -e -enable false $enableOpenGLOM; } if ($enableOpenGL == 1) $select = 2; else $select = 1; optionMenuGrp -e -select $select $enableOpenGLOM; string $tensionSlider = ($ned + "TensionSlider"); intSliderGrp -e -value $connectionTension $tensionSlider; string $minSegmentSlider = ($ned + "MinSegmentSlider"); floatSliderGrp -e -value $minSegment $minSegmentSlider; string $segmentOffsetSlider = ($ned + "SegmentOffsetSlider"); floatSliderGrp -e -value $offset $segmentOffsetSlider; string $roundnessSlider = ($ned + "RoundnessSlider"); floatSliderGrp -e -value $connectionRoundness $roundnessSlider; } global proc nodeEdGESetOpenGLPref(string $ned) { string $enableOpenGLOM = ($ned + "EnableOpenGLOM"); if (`optionMenuGrp -q -select $enableOpenGLOM` == 2) nodeEditor -e -egl 1 $ned; else nodeEditor -e -egl 0 $ned; } global proc nodeEdGESetConnectionStyle(string $ned, string $style) { string $tensionSlider = ($ned + "TensionSlider"); string $minSegmentSlider = ($ned + "MinSegmentSlider"); string $segmentOffsetSlider = ($ned + "SegmentOffsetSlider"); string $roundnessSlider = ($ned + "RoundnessSlider"); int $minSegmentVisible = ($style != "bezier"); int $segmentOffsetVisible = ($style == "corner") || ($style == "sshape"); int $tensionVisible = ($style == "corner") || ($style == "sshape"); int $roundnessVisible = ($style == "sshape"); floatSliderGrp -e -en $minSegmentVisible $minSegmentSlider; floatSliderGrp -e -en $segmentOffsetVisible $segmentOffsetSlider; intSliderGrp -e -en $tensionVisible $tensionSlider; floatSliderGrp -e -en $roundnessVisible $roundnessSlider; nodeEditor -e -connectionStyle $style $ned; } global proc nodeEdSetConnectionParameters(string $ned) { string $tensionSlider = ($ned + "TensionSlider"); string $minSegmentSlider = ($ned + "MinSegmentSlider"); string $segmentOffsetSlider = ($ned + "SegmentOffsetSlider"); string $roundnessSlider = ($ned + "RoundnessSlider"); int $tension = `intSliderGrp -q -v $tensionSlider`; float $minSeg = `floatSliderGrp -q -v $minSegmentSlider`; float $offset = `floatSliderGrp -q -v $segmentOffsetSlider`; float $roundness = `floatSliderGrp -q -v $roundnessSlider`; nodeEditor -e -cst $tension $ned; nodeEditor -e -cso $offset $ned; nodeEditor -e -csm $minSeg $ned; nodeEditor -e -csr $roundness $ned; } global proc nodeEdGESavePrefsChanges(string $ned) { string $nodeEditorGEPreferencesWin = ($ned + "GEPreferencesWnd"); window -e -vis false $nodeEditorGEPreferencesWin; } global proc nodeEdGECancelPrefsChanges(string $ned) { string $nodeEditorGEPreferencesWin = ($ned + "GEPreferencesWnd"); int $enableOpenGL = `optionVar -q "nodeEdEnableOpenGLPush"`; string $connectionStyle = `optionVar -q "nodeEdConnectionStylePush"`; float $connectionMinSegment = `optionVar -q "nodeEdConnectionMinSegmentPush"`; float $connectionOffset = `optionVar -q "nodeEdConnectionOffsetPush"`; int $connectionTension = `optionVar -q "nodeEdConnectionTensionPush"`; float $connectionRoundness = `optionVar -q "nodeEdConnectionRoundnessPush"`; nodeEditor -e -egl $enableOpenGL $ned; nodeEditor -e -connectionStyle $connectionStyle $ned; nodeEditor -e -connectionMinSegment $connectionMinSegment $ned; nodeEditor -e -connectionOffset $connectionOffset $ned; nodeEditor -e -connectionTension $connectionTension $ned; nodeEditor -e -connectionRoundness $connectionRoundness $ned; window -e -vis false $nodeEditorGEPreferencesWin; } proc createGEPrefs(string $neda) { $ned = `getCurrentNodeEditor`; string $nodeEditorGEPreferencesWin = ($ned + "GEPreferencesWnd"); if (!`window -exists $nodeEditorGEPreferencesWin`) { window -title (uiRes("m_nodeEditorGEPrefs.kNodeEditorSettings")) -rtf true -wh 600 400 $nodeEditorGEPreferencesWin; formLayout prefsForm; string $saveBtn = `button -label (uiRes("m_nodeEditorGEPrefs.kSave")) -c {"{nodeEdGESavePrefsChanges " + $ned + ";}"}`; string $cancelBtn = `button -label (uiRes("m_nodeEditorGEPrefs.kCancel")) -c {"{nodeEdGECancelPrefsChanges " + $ned + ";}"}`; // Left side panel string $menuList = `frameLayout -label (uiRes("m_nodeEditorGEPrefs.kCategories")) -w 160`; setParent $menuList; string $cmd = "switchGEPrefTabs " + $ned + " 0"; string $prefIndex = ($ned + "PrefIndex"); textScrollList -sc $cmd -append (uiRes("m_nodeEditorGEPrefs.kInterface2")) -append (uiRes("m_nodeEditorGEPrefs.kNodeGraph2")) -append (uiRes("m_nodeEditorGEPrefs.kBifSchema")) $prefIndex; setParent ..; setParent ..; string $prefTabs2 = ($ned + "GEPrefsTabs"); string $prefTabs = `tabLayout -scrollable true -tabsVisible false -childResizable true $prefTabs2`; // Interface $intefaceLayout = `frameLayout -label (uiRes("m_nodeEditorGEPrefs.kInterface")) interfacePref`; setParent $prefTabs; // Node Editor preferences frameLayout -label (uiRes("m_nodeEditorGEPrefs.kNodeGraph")); $nodeEditorGEPreferencesWinParent = `columnLayout nodeGraphPref`; frameLayout -label (uiRes("m_nodeEditorGEPrefs.kConnectionStyle")) -lv true -cll false -mw 50 -mh 10 connectionStyleFrame; columnLayout -adj false; string $bezier = (uiRes("m_nodeEditorGEPrefs.kBezierSpline")); string $straight = (uiRes("m_nodeEditorGEPrefs.kStraightLine")); string $corner = (uiRes("m_nodeEditorGEPrefs.kCorners")); string $sshape = (uiRes("m_nodeEditorGEPrefs.kSShape")); string $connectionStyleRBG = ($ned + "ConnectionStyleRBG"); radioButtonGrp -numberOfRadioButtons 4 -vr -labelArray4 $bezier $straight $corner $sshape -onCommand1 {"nodeEdGESetConnectionStyle " + $ned + " bezier;"} -onCommand2 {"nodeEdGESetConnectionStyle " + $ned + " straight;"} -onCommand3 {"nodeEdGESetConnectionStyle " + $ned + " corner;"} -onCommand4 {"nodeEdGESetConnectionStyle " + $ned + " sshape;"} $connectionStyleRBG; setParent ..; setParent ..; string $tensionSlider = ($ned + "TensionSlider"); intSliderGrp -label (uiRes("m_nodeEditorGEPrefs.kTension")) -field true -minValue -100 -maxValue 100 -fieldMinValue -100 -fieldMaxValue 100 -value 10 -dc {"nodeEdSetConnectionParameters " + $ned} $tensionSlider; string $minSegmentSlider = ($ned + "MinSegmentSlider"); floatSliderGrp -label (uiRes("m_nodeEditorGEPrefs.kMinSegLen")) -field true -minValue 0.0 -maxValue 1.0 -fieldMinValue 0.0 -fieldMaxValue 1.0 -s 0.01 -dc {"nodeEdSetConnectionParameters " + $ned} $minSegmentSlider; string $segmentOffsetSlider = ($ned + "SegmentOffsetSlider"); floatSliderGrp -label (uiRes("m_nodeEditorGEPrefs.kSegOffset")) -field true -minValue 0.0 -maxValue 1.0 -fieldMinValue 0.0 -fieldMaxValue 1.0 -s 0.01 -dc {"nodeEdSetConnectionParameters " + $ned} $segmentOffsetSlider; string $roundnessSlider = ($ned + "RoundnessSlider"); floatSliderGrp -label (uiRes("m_nodeEditorGEPrefs.kRoundness")) -field true -minValue 0.5 -maxValue 1.0 -fieldMinValue 0.5 -fieldMaxValue 1.0 -s 0.01 -dc {"nodeEdSetConnectionParameters " + $ned} $roundnessSlider; separator -h 35; frameLayout -label (uiRes("m_nodeEditorGEPrefs.kRendering")) -lv true -cll false -mw 30 -mh 10 surfacesFrame; columnLayout -adj false; string $enableOpenGLOM = ($ned + "EnableOpenGLOM"); optionMenuGrp -cc {"nodeEdGESetOpenGLPref " + $ned} $enableOpenGLOM; menuItem -label (uiRes("m_nodeEditorGEPrefs.kSoftware")); menuItem -label (uiRes("m_nodeEditorGEPrefs.kOpenGL")); setParent ..; setParent ..; formLayout -edit -af $menuList "top" 5 -af $menuList "left" 5 -an $menuList "right" -ac $menuList "bottom" 5 $cancelBtn -af $prefTabs "top" 5 -ac $prefTabs "left" 5 $menuList -af $prefTabs "right" 5 -ac $prefTabs "bottom" 5 $cancelBtn -af $saveBtn "bottom" 5 -af $saveBtn "left" 5 -ap $saveBtn "right" 1 50 -af $cancelBtn "bottom" 5 -ap $cancelBtn "left" 1 50 -af $cancelBtn "right" 5 prefsForm; setParent $prefTabs; // BIF Schema $bifSchemaLayout = `frameLayout -label (uiRes("m_nodeEditorGEPrefs.kBifSchema2")) bifSchemaPref`; setParent $bifSchemaLayout; frameLayout (uiRes("m_nodeEditorGEPrefs.kDefaultBifSchema")); columnLayout; textFieldGrp -label (uiRes("m_nodeEditorGEPrefs.kPosition")) -text "P"; textFieldGrp -label (uiRes("m_nodeEditorGEPrefs.kNormals")) -text "N"; textFieldGrp -label (uiRes("m_nodeEditorGEPrefs.kUV")) -text "uv"; textFieldGrp -label (uiRes("m_nodeEditorGEPrefs.kVelocity")) -text "v"; textFieldGrp -label (uiRes("m_nodeEditorGEPrefs.kColorPerVertex")) -text "color"; setParent ..; separator; frameLayout (uiRes("m_nodeEditorGEPrefs.kDynamicChannels")); columnLayout; textFieldGrp -label (uiRes("m_nodeEditorGEPrefs.kAge")) -text "age"; textFieldGrp -label (uiRes("m_nodeEditorGEPrefs.kDensity")) -text "density"; setParent $prefTabs; } switchGEPrefTabs $ned 2; } global proc showGEPrefs() { string $ned = `getCurrentNodeEditor`; if ($ned == "") return; string $nodeEditorGEPreferencesWin = ($ned + "GEPreferencesWnd"); createGEPrefs $ned; loadSettingsGE $ned; showWindow $nodeEditorGEPreferencesWin; }