Most of Clarisse’s attribute types are mapped to SeExpr native types (FP, FP[3] - ie. VECTOR, STRING). Based on the SeExpr type, you can decide which of the following getter functions to use to query an attribute value:
FP get_double(STRING path) # Return a floating-point number |
VECTOR get_vec3(STRING path) # Return a 3D vector |
STRING get_string(STRING path) # Return a string |
These getter functions take only one argument: the path to the attribute value. Paths follow the Clarisse item path syntax and can be either absolute or relative:
“project://path/to/object.attribute[index]” # Absolute paths always start from the project’s root. # Each context is separated using ‘/’ down to the object. # Attribute names are separated from object names using a ‘.’. # Value index is specified using brackets ‘[ ]’ like C arrays. |
“path/to/object.attribute[index]” # Relative paths always start from the context in which the # object that contains the expression. # They follow the same syntax as absolute paths. |
“project://scene/lighting/light.translate[0]” # Absolute path to attribute value translate[0] of object light # in context scene/lighting. |
“project://scene/lighting/light.exposure[0]” # Absolute path to attribute value exposure[0] of object light # in context scene/lighting. |
“project://scene/lighting/light.exposure” # Absolute path to attribute value exposure[0] of object light # in context scene/lighting. # The value index can be ignored as exposure has only # one value. |
“project://scene/lighting/light.translate” # Absolute path to attribute translate of object light # in context scene/lighting. # The value index can be ignored as exposure has only # one value. |
“lighting/light.translate[0]” # Relative path to attribute value translate[0] of object light # in context scene/lighting from context scene. |
“light.translate[0]” # Relative path to attribute value translate[0] of object light # in context scene/lighting from context scene/lighting. |
“translate[0]” # Relative path to attribute value translate[0] of object light # in context scene/lighting from object scene/lighting/light. |
Clarisse’s expression system uses the following mapping between attribute types and SeExpr types:
Attribute Type |
SeExpr Type |
Getter Function |
Comments |
BOOL |
FP |
get_double |
Return 0 is the attribute is false, 1 otherwise. |
COLOR |
FP[3] |
get_vec3 |
Return the RGB color as a 3D vector. |
CURVE |
N/A |
N/A |
Unsupported attribute type. |
DOUBLE |
FP |
get_double |
Return the attribute value as a floating-point number |
ENUM |
STRING |
get_string |
Return the name of the current enum. |
FILE |
STRING |
get_string |
Return the filename as a string. |
GROUP |
STRING |
get_string |
Return the path of the referenced group. |
LONG |
FP |
get_double |
Return the attribute value as a floating-point number |
OBJECT |
N/A |
N/A |
Unsupported attribute type |
PRESET |
FP |
get_double |
Return the index of the current preset. |
REFERENCE |
STRING |
get_string |
Return the path of the referenced object. |
SCRIPT |
STRING |
get_string |
Return the script as a string. |
STRING |
STRING |
get_string |
Return the attribute value as a string. |
TAG |
STRING |
get_string |
Return the current tag name as a string. |
VEC3D |
FP[3] |
get_vec3 |
Return the attribute value as a 3D vector. |
get_double(“project://scene/lighting/light.enable”) # Returns 1 if the enable attribute of item light # is true, or 0 otherwise. |
get_double(“project://scene/lighting/light.exposure”) # Returns the exposure of the light light |
get_double(“project://scene/lighting/light.translate[0]”) # Returns the 1st component of the translation # vector ot item light. |
get_string(“project://scene/lighting/light.parent”) # Returns the path to the parent item of light. |
get_vec3(“project://scene/lighting/light.translate”)[0] # Returns the 1st component of the translation # vector of item light. |
v = get_vec3(“project://scene/lighting/light.translate”); # Stores the translation vector of item light in # variable v.
v[0] + v[1] + v[2] # Returns the sum of all components of v. |