Go to: Synopsis. Return value. Flags. Python examples.

Synopsis

gradientControlNoAttr( [string] , [asString=string], [changeCommand=string], [currentKey=int], [currentKeyChanged=script], [currentKeyColorValue=[float, float, float]], [currentKeyCurveValue=boolean], [currentKeyInterpValue=int], [dragCommand=script], [optionVar=string], [rampAsColor=boolean], [valueAtPoint=float])

Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.

gradientControlNoAttr is undoable, queryable, and editable.

This command creates a control for editing a ramp (2D control curve). The control attaches to an optionVar used to store and retrieve the encoded gradient control points stored in a string.

Return value

stringThe name of the port created or modified

In query mode, return type is based on queried flag.

Flags

asString, changeCommand, currentKey, currentKeyChanged, currentKeyColorValue, currentKeyCurveValue, currentKeyInterpValue, dragCommand, optionVar, rampAsColor, valueAtPoint
Long name (short name) Argument types Properties
optionVar(ov) string createqueryedit
Specifies the name of the option var used to store and retrieve the string value capturing the curve.
valueAtPoint(vap) float query
Used during query to specify the point at which to query the curve.

In query mode, this flag needs a value.

currentKeyColorValue(clv) [float, float, float] queryedit
Get or set the color of the currently selected key. Only useful if the ramp is set to be a color ramp.
currentKeyCurveValue(cvv) boolean queryedit
Get or set the value of the currently selected key. Only useful if the ramp is set to be a curve ramp.
currentKeyInterpValue(civ) int queryedit
Get or set the interpolation value for the current key.
asString(asString) string queryedit
Used to query and set the value of the ramp as a string of comma separated values
rampAsColor(rac) boolean createqueryedit
Sets whether the ramp should be viewed as a colour ramp or as a curve. Default is as a curve.
currentKey(ck) int createqueryedit
Returns the index of the currently selected key.
currentKeyChanged(ckc) script edit
Specifies a command to be executed whenever the selected key changes.
changeCommand(cc) string edit
Specifies a command to be executed whenever the value of this ramp is modified. This option should not be used when specifying an optionVar.
dragCommand(dc) script edit
Specifies a command to be executed while the ramp is being modified.

Flag can appear in Create mode of command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can have multiple arguments, passed either as a tuple or a list.

Python examples

import maya.cmds as cmds

# Create a window with a gradient control for an optionVar
#
cmds.window( title='Gradient Control For OptionVar' )
cmds.optionVar(stringValueAppend=['falloffCurveOptionVar', '0,1,2'])
cmds.optionVar(stringValueAppend=['falloffCurveOptionVar', '1,0,2'])
cmds.columnLayout()
cmds.gradientControlNoAttr( 'falloffCurve', h=90)
cmds.gradientControlNoAttr( 'falloffCurve', e=True, optionVar='falloffCurveOptionVar' )
cmds.showWindow()

# Query for the value on the curve at a given position.
#
cmds.gradientControlNoAttr( 'falloffCurve', q=True, valueAtPoint=0.5 )