Saori Yoshimoto work notes since 2018

Friday, October 5, 2018

[VEX] setattrib, How to set it in VEX?

------- for all option
//* i:int, f:float, s:string, v:vector*//
int  setattrib(i-geohandle, s-attribclass, s-attribute_name, i-element_num, i-vertex_num, <type>value, s-mode="set")
int  setattrib(i-geohandle, s-attribclass, s-attribute_name, i-element_num, i-vertex_num, <type>value[], s-mode="set")

e.g.)setattrib(0, 'detail', 'tmp_name', 0, 0, s@name, "set"); 


attribclass
One of "detail" (or "global"), "point", "prim", or "vertex".
You can also use "primgroup", "pointgroup" or "vertexgroup" to read from groups.


element_num
The point or primitive number on which to change the attribute.
For detail attributes, set this to 0 (the argument is ignored for detail attributes).
For vertex attributes, set this to the primitive number of the primitive containing the vertex.


vertex_num
For vertex attributes, this is the number of the vertex on the primitive specified in element_num.
To use a linear vertex index, set element_num to -1 and use the linear vertex index here.
For other detail, primitive, or point attributes, set this to 0 (the argument is ignored in these cases).
 

mode
(Optional) if given, this controls how the function modifies any existing value in the attribute.

"set"

Overwrite the attribute with the given value.
"add"
Add to the attribute the value.
"min", "minimum"
Set the attribute to the minimum of itself and the value.
"max", "maximum"
Set the attribute to the maximum of itself and the value.
"mult", "multiply"
Multiply the attribute by the value. For matrices, this will do matrix multiplication. For vectors, component-wise.
"toggle"
Toggles the attribute, independent of the source value. Useful for toggling group membership.
"append"
Valid for string and array attributes. Appends the source value to the end of the original value.