|
|
|
StructuresSoftWish provides procedures for allocating each of the structures types defined by SAAPHIRE. For example, SAA_AllocScene returns the name of an allocated scene which can then be passed to any SAAPHIRE call which takes a scene as argument. More generally one allocates a SAAPHIRE structure or an array of SAAPHIRE structures with SAA_AllocObject (where Object is a valid SAAPHIRE structure type, like Scene, Vector or Element). These allocation procedures takes optional parameters, the most common of which is the number of objects (just as is the case with arrays).
allocates and returns an array of 25 vector objects. One gets and sets structures using the access procedure. In this case since we want to access an array of structures we pass the name of the array, an index and a field name, prepended with a dash. Vector objects have 4 fields, namely x,y,z and w. So
returns the value of the x field of the first element of myVectors. We can set the field to a specified value by passing it as a 4th argument.:
sets the x coordinate of the first element of the array of vector objects accessed by $myVectors to 25.7, and
makes the x and y coordinates of the 5th element the same. Omitting the index and all subsequent arguments accesses the entire vector element, so
scales myMatrix by the fourth element (vector) of myVectors. Omitting all the arguments accesses the entire array. SoftWish treats the Softimage Matrix as a structures rather than as a multi-dimensional array. The structures are accessed using the keywords row and column . So:
sets the matrix element in the third row and first column to 23.5. If a field is itself an array it is accessed with C-like syntax, like this:
This references what in C would be Subelem.id[0] One duplicates a structure using the -clone keyword. set copyVectors [access $myVectors -clone] allocates a copy of the myVectors structure. Changing the value of the fields of elements of myVectors does not change copyVectors in any way. This is not the case with: set otherVectors [access $myVectors -clone] This creates another name for the myVectors array. Changing any field of any element of myVectors changes the corresponding field of the corresponding element of otherVectors, and vice-versa. This is because myVectors and otherVectors are different names for the same structures (they both point to the same memory).
Note that because "alloc","clone","size" and "string" are reserved words used by the access procedure, one cannot get or set structure ids with these names. See Also |
|
copyright Video-Collage Inc. |