Go to: Synopsis. Return value. Keywords. Related. Flags. MEL examples.

Synopsis

attributeQuery [-connectable] [-enum] [-exists] [-hidden] [-indexMatters] [-internal] [-internalGet] [-internalSet] [-keyable] [-listChildren] [-listDefault] [-listEnum] [-listParent] [-listSiblings] [-longName] [-maxExists] [-maximum] [-message] [-minExists] [-minimum] [-multi] [-niceName] [-node name] [-numberOfChildren] [-range] [-rangeExists] [-readable] [-shortName] [-softMax] [-softMaxExists] [-softMin] [-softMinExists] [-softRange] [-softRangeExists] [-storable] [-type string] [-typeExact string] [-usedAsColor] [-writable]

attributeQuery is NOT undoable, NOT queryable, and NOT editable.

attributeQuery returns information about the configuration of an attribute. It handles both boolean flags, returning true or false, as well as other return values. Specifying more than one boolean flag will return the logical "and" of all the specified boolean flags. You may not specify any two flags when both do not provide a boolean return type. (eg. "-internal -hidden" is okay but "-range -hidden" or "-range -softRange" is not.)

Return value

float[]when querying ranges or default values
booleanwhen querying attribute flags

Keywords

dg, dependency, graph, attribute, query

Related

getClassification, isConnected, isDirty, nodeType, objExists, objectType

Flags

connectable, enum, exists, hidden, indexMatters, internal, internalGet, internalSet, keyable, listChildren, listDefault, listEnum, listParent, listSiblings, longName, maxExists, maximum, message, minExists, minimum, multi, niceName, node, numberOfChildren, range, rangeExists, readable, shortName, softMax, softMaxExists, softMin, softMinExists, softRange, softRangeExists, storable, type, typeExact, usedAsColor, writable
Long name (short name) Argument types Properties
-type(-typ) string create
Use static attributes from nodes of type TYPE. Includes attributes inherited from parent class nodes.
-typeExact(-tex) string create
Use static attributes only from nodes of type TYPE. Does not included inherited attributes.
-node(-n) name create
Use all attributes from node named NAME
-exists(-ex) create
Return true if the attribute exists
-internal(-i) create
Return true if the attribute is either internalSet or internalGet
-internalSet(-is) create
Return true if the attribute must be set through setCachedValue
-internalGet(-ig) create
Return true if the attribute come from getCachedValue
-keyable(-k) create
Return the keyable status of the attribute
-connectable(-c) create
Return the connectable status of the attribute
-message(-msg) create
Return true if the attribute is a message attribute
-enum(-e) create
Return true if the attribute is a enum attribute
-hidden(-h) create
Return the hidden status of the attribute
-indexMatters(-im) create
Return the indexMatters status of the attribute
-readable(-rd) create
Return the readable status of the attribute
-storable(-st) create
Return true if the attribute is storable
-writable(-w) create
Return the writable status of the attribute
-multi(-m) create
Return true if the attribute is a multi-attribute
-minimum(-min) create
Return the hard minimum of the attribute's value
-maximum(-max) create
Return the hard maximum of the attribute's value
-range(-r) create
Return the hard range of the attribute's value
-usedAsColor(-uac) create
Return true if the attribute should bring up a color picker
-softRange(-s) create
Return the soft range (slider range) of the attribute's value
-softMin(-smn) create
Return the soft min (slider range) of the attribute's value
-softMax(-smx) create
Return the soft max (slider range) of the attribute's value
-numberOfChildren(-nc) create
Return the number of children the attribute has
-listSiblings(-ls) create
Return the list of sibling attributes of the given attribute.
-listChildren(-lc) create
Return the list of children attributes of the given attribute.
-listParent(-lp) create
Return the parent of the given attribute.
-listEnum(-le) create
Return the list of enum strings for the given attribute.
-listDefault(-ld) create
Return the default values of numeric and compound numeric attributes.
-minExists(-mne) create
Return true if the attribute has a hard minimum. A max does not have to be present.
-maxExists(-mxe) create
Return true if the attribute has a hard maximum. A min does not have to be present.
-rangeExists(-re) create
Return true if the attribute has a hard range. Both min and max must be present.
-softMinExists(-sme) create
Return true if the attribute has a soft minimum. A max does not have to be present.
-softMaxExists(-sxe) create
Return true if the attribute has a soft maximum. A min does not have to be present.
-softRangeExists(-se) create
Return true if the attribute has a soft range. Both min and max must be present.
-longName(-ln) create
Return the long name of the attribute.
-shortName(-sn) create
Return the short name of the attribute.
-niceName(-nn) create
Return the nice name (or "UI name") of the attribute.

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 be used more than once in a command.

MEL examples

// Determine the hidden status of the "selector" attribute on choice nodes.
//
attributeQuery -typ choice -h selector;
// Result: 0
// Determine the hidden status of the "selector" attribute on this choice node.
// (Usually the same but you can do this for dynamic attributes too.)
//
createNode choice -n whoIsIt;
// Result: choice1
attributeQuery -n whoIsIt -h selector;
// Result: 0
// Determine the range of the selector value on choice nodes.
// In this case there is no range.
// Note, if there is only a minimum or only a maximum range will not set.
//
attributeQuery -typ choice -range selector;
// For the next several examples create a poly cube and add extra attributes.
polyCube -w 1 -h 1 -d 1 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1;
addAttr -ln egRange -at long -min 0 -max 5 -dv 2 |pCube1;
setAttr -e -keyable false |pCube1.egRange;
// Determine if an attribute is keyable
//
attributeQuery -node "pCube1" -k "egRange";
// Result: 0
// Determine the minimum and maximum values of the added attribute egRange
//
attributeQuery -node "pCube1" -range "egRange";
// Result: 0 5
// Determine if there is a minimum for the attribute.
// Note, having a minimum or maximum value does not imply the attribute has a range.
addAttr -ln egMin -at long -min 2 |pCube1;
attributeQuery -node "pCube1" -minExists "egMin";
// Result: 1
attributeQuery -node "pCube1" -maxExists "egMin";
// Result: 0
attributeQuery -node "pCube1" -min "egMin";
// Result: 2
// Determine if an attribute is an enum
// List the enum strings. This will use ':' as a separator like the attr is written in
// an .ma file.
addAttr -ln myEnum -at "enum" -en "chicken:turkey:duck:" |pCube1;
attributeQuery -node "pCube1" -listEnum "myEnum";
// Result: chicken:turkey:duck //