Go to:
Return value. Related commands. Flags. Examples.
Synopsis
getAttr [-k | -l | -s | -typ] [-t time] object.attribute
This command returns the value of the named object's attribute.
UI units are used where applicable.
Currently, the types of attributes that can be displayed are:
- numeric attributes
- string attributes
- matrix attributes
- numeric compound attributes (whose children are all numeric)
- vector array attributes
- double array attributes
- int32 array attributes
- point array attributes
- data component list attributes
Other data types cannot be retrieved. No result is returned if the
attribute contains no data.
Return value
Value or state of the attribute. The number and type
of values returned is dependent on the attribute type.
Related commands
addAttr, setAttr, connectAttr, disconnectAttr, listAttr, attributeQueryFlags
asString, caching, channelBox, expandEnvironmentVariables, keyable, lock, settable, silent, size, time, type
Long name (short name) | [argument types] | Properties |
---|
-keyable
(-k)
|
|  |
|
Returns the keyable state of the attribute.
|
|
-lock
(-l)
|
|  |
|
Returns the lock state of the attribute.
|
|
-type
(-typ)
|
|  |
|
Returns the type of data to expect at the attribute.
|
|
-size
(-s)
|
|  |
|
Returns the size of a multi-attribute array. Returns 1 if non-multi.
|
|
-time
(-t)
| <time> |  |
|
Evaluate the attribute at the given time instead of the current time.
|
|
-silent
(-sl)
|
|  |
|
When evaluating an attribute that is not a numeric or string
value, suppress the error message saying that the data cannot be
displayed. The attribute will be evaluated even though its data
cannot be displayed. This flag does not suppress all error messages,
only those that are benign.
|
|
-settable
(-se)
|
|  |
|
Returns 1 if this attribute is currently settable by setAttr,
0 otherwise. An attribute is settable if it's not locked
and either not connected, or has only keyframed animation.
|
|
-expandEnvironmentVariables
(-x)
|
|  |
|
Expand any environment variable and (tilde characters on UNIX)
found in string attributes which are returned.
|
|
-asString
(-as)
|
|  |
|
This flag is only valid for enum attributes. It allows you to
get the attribute values as strings instead of integer values.
|
|
-channelBox
(-cb)
|
|  |
|
Returns whether the attribute is set to show in the channelBox.
Keyable attributes also show in the channel box.
|
|
-caching
(-ca)
|
|  |
|
Returns whether the attribute is set to be cached internally
|
|
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
|
Examples
createNode revolve -n gravityWell;
sphere -n loxTank;
cone -n noseCone;
cone -n fin;
pointConstraint -n weld fin noseCone;
float $angle = `getAttr gravityWell.esw`;
// Result: 360 //
string $type = `getAttr -type loxTank.translate`;
// Result: double3 //
int $lock = `getAttr -lock noseCone.translateX`;
// Result: 0 //
float $finZ = `getAttr -time 12 fin.translateZ`;
// Result: 0 //
int $size = `getAttr -size weld.target`;
// Result: 1 //
int $size = `getAttr -settable weld.target`;
// Result: 0 //
float $matrix[] = `getAttr loxTank.matrix`;
// Result: 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 //
setAttr file1.ftn -type "string" "$TMPDIR/smile.gif";
string $s = `getAttr file1.ftn`;
// Result: $TMPDIR/smile.gif //
string $s = `getAttr -x file1.ftn`;
// Result: /var/tmp/smile.gif //