USD.Attribute
Inherits from USD.Property
Description
A class that represents a USD Property.
Properties
numTimeSamples | Gets the number of time samples the attribute has. |
type | The type of the attribute. |
value | The value of the attribute. |
Methods
clear | Removes all time samples and values from the attribute. |
clearAtTime | Removes a value with a specific time code from the attribute. |
getTimeSamples | Gets an Array of all the time samples for the attribute. |
getValue | Gets the value of the attribute. |
setValue | Sets the value of the attribute. |
Details
Do no remove, this fixes the anchor on doc.flexsim.com
USD.Attribute.numTimeSamples
readonly int numTimeSamples
Description
Gets the number of time samples the attribute has.
Do no remove, this fixes the anchor on doc.flexsim.com
USD.Attribute.type
readonly string type
Description
The type of the attribute.
Basic attribute types can be found here.
USD.Stage stage = Model.find("USD Stage1");
USD.Prim prim = stage.defaultPrim;
USD.Attribute attr = prim.createAttribute("myDouble", "double");
if (attr) {
string type = attr.type; // type == "double"
}
Do no remove, this fixes the anchor on doc.flexsim.com
USD.Attribute.value
Variant value
Description
The value of the attribute.
If you set the value of the attribute, the type of value you assign must match the type of attribute it is. For example, if my attribute has a type of "double[]", then my value should be an Array of doubles.
USD.Stage stage = Model.find("USD Stage1");
USD.Prim prim = stage.defaultPrim;
USD.Attribute attr = prim.createAttribute("myDouble", "double");
if (attr) {
attr.value = 20;
}
Do no remove, this fixes the anchor on doc.flexsim.com
Do no remove, this fixes the anchor on doc.flexsim.com
USD.Attribute.clearAtTime()
clearAtTime( Variant timeCode ) |
Parameters
timeCode | The time code of the value to be removed from the attribute. |
Description
Removes a value with a specific time code from the attribute.
USD.Stage stage = Model.find("USD Stage1");
USD.Prim operator = stage.findPrim("/World/Operator1");
USD.Attribute translation = prim.getProperty("xformOp:translate");
// if there is at least 1 time sample
if (translation.numTimeSamples) {
Array times = translation.getTimeSamples();
// remove the first time sample
translation.clearAtTime(times[1]);
}
...
Do no remove, this fixes the anchor on doc.flexsim.com
USD.Attribute.getTimeSamples()
Array getTimeSamples( ) |
Returns
Array | An Array of time samples. |
Description
Gets an Array of all the time samples for the attribute.
Do no remove, this fixes the anchor on doc.flexsim.com
USD.Attribute.getValue()
Variant getValue( Variant timeCode = nullvar ) |
Parameters
timeCode | The timecode of the value you want to retrieve. |
Returns
Variant | The value of the attribute. |
Description
Gets the value of the attribute.
If a timecode is supplied, this will get the value of the attribute at the given timecode.Do no remove, this fixes the anchor on doc.flexsim.com
USD.Attribute.setValue()
setValue( Variant value , Variant timeCode = nullvar ) |
Parameters
value | The new value to set the attribute to. |
timeCode | The timecode of the value you want to set. |
Description
Sets the value of the attribute.
If a timecode is supplied, this will set the value of the attribute at the given timecode.