<<< Enquiries | Chapters | KID Graphics: Overview >>> |
colour
, given a face set f0 with tags is:
> (colour enquire) --> output information about attribute definition > (f0 colour) --> delete all colour attributes in f0 > (f0 colour ´(0.3 0.3 0.3)) --> create colour attributes on all f0 |
There are 5 ways to create a working attribute.
> ( attribute update ) |
Interrogates the model for all active attributes and build corresponding objects in KID with matching names. Only attributes new to the World since the last call to this are re-created.
> ( colour create ) |
The effect is as in the first method, but since only a single attribute is processed this is faster.
> ( attribute create 21 ) |
This path is used to do the work for the first option.
> ( define colour system_attribute ) > ( colour lazy ) -- only supported for system defined attributes |
Attribute structures are defined from a list of names, each field in the structure can be of type: real, integer, string, vector, coordinate, direction or axis.
> ( define myatt attribute ) > ( myatt structure ´( string vector real vector real )) > ( myatt create ) |
The structure must always be given as a list, even if only one field is needed.
Additionally an attribute with NO fields is valid. This is indicated in KID by defining the structure to be
t
.
> ( define marked attribute ) > ( marked structure t ) > ( marked create ) |
If a structure is not defined, KID interrogates the kernel when the attribute is created to try and find an existing structure definition for an attribute of that name.
Values are returned in the order implied by the structure definition, formatted into sublists to reflect the implied structure of axis, coordinate, vector and direction subfields. Since an object may have several tags, each with an attribute attached, or since class 6 and 7 attributes may be attached to a single owner multiple times, each set of attribute data is returned in a separate list.
Attributes with a single field return that field without enclosing it in another list.
> ( f0 name ) --> ( George )one tag with a name attached > ( g0 name ) --> ( Peter Bob two tags have a name attached |
Attributes with no fields return a ( t ) for each tag in the object taglist which has the attribute attached and nil if there are none at all.
> ( f0 marked ) --> ( t t t t ) 4 of the faces are marked > ( f0 marked ) --> nil - none of the faces are marked |
The attribute values should be supplied in the order which corresponds to the structure definition.
> ( b0 density ´( 135.4 kg/m3 )) -- real before string in this case |
Integer values may be provided in positions in which real values are expected.
> ( b0 density ´( 135 kg/m3 )) |
Reflecting embedded structure of the data values using brackets is optional.
Structures with a single field need not be enclosed in a list. So both the following work:
> ( f0 translucency ´( 0.5 )) > ( f0 translucency 0.5 ) |
Structures with no fields can always be set using the value t. All structures can be unset (deleted) by using the value nil.
> ( f0 marked t ) -- set a logical attribute > ( f0 marked nil ) -- delete for any attribute |
If the class of attributes has a standard prefix then it would be convenient to take this for granted whilst working with the attributes. This system is already used for system_attributes which have a prefix of SDL/TYSA_.
Alternatively the full attribute name can be overridden manually before it is first created.
> ( define id attribute ) > ( id name "EDS/UG_SYSTEM_ID" ) > ( id structure ´( integer )) > ( id create ) -- New attribute id:full name EDS/UG_SYSTEM_ID |
<<< Enquiries | Chapters | KID Graphics: Overview >>> |