Flush_Contents

Functions

void Flush_Attributes (const char *segment)
 Flushes attributes from a segment but leaves styles, geometry, segments, and subsegments. More...
 
void Flush_Contents (const char *segment, const char *filter)
 Empties some or all of the drawing primitives, attributes, or subsegments from a segment. More...
 
void Flush_Geometry (const char *segment)
 Flushes just geometry from a segment but leaves attributes, styles, segments, and subsegments. More...
 

Detailed Description

Function Documentation

◆ Flush_Attributes()

void Flush_Attributes ( const char *  segment)

Flushes attributes from a segment but leaves styles, geometry, segments, and subsegments.

Parameters
segment- Segment(s) to be flushed. Can contain wildcards.

DETAILS

identical to Flush_Contents() (segment, "attributes")

◆ Flush_Contents()

void Flush_Contents ( const char *  segment,
const char *  filter 
)

Empties some or all of the drawing primitives, attributes, or subsegments from a segment.

Parameters
segment- Segment(s) to be flushed. Can contain wildcards.
filter- List of the types of objects you want to delete.

DETAILS

The specified contents of the specified segment(s) are removed. The subsegments, if any, are not touched (unless you included the subsegments as part of the "contents to be removed"). The segment still exists under the same name. Flush_Contents() is often used when picture information comes and goes and is different each time. The structure of the segment tree should remain the same. Unlike the delete routines, the flush routines make no complaint if the item isn't found and there's no work to do. Flush_Contents() is a good way of getting rid of geometry and attributes and restoring a segment to a known state quickly.
Filter is formatted exactly as in Begin_Contents_Search(). In other words, it is a list of the form "type, type, ...", where each type can be any of the things that Begin_Contents_Search() would accept.

It's also possible to flush a specific subset of attributes. For example, calling Flush_Contents(mySegment, "visibility = lines") will flush visibility attributes on line geometry types while maintaining the visibility attributes for other geometry types. This applies not only to visibility but to all other attributes as well; for example, you could flush "color = faces" to only flush color attributes applied to faces.

In addition, you can specify "no" in front of any of the above types. For example: "everything, no geometry, no windows, no colormaps", which flushes all types except windows, colormaps, and all types of geometry. If specifications overlap (as in "geometry, no lines"), the last specification wins.

The plural "s" after each type is optional. The types can be in any combination of uppercase and lowercase. Leading and trailing blanks are not significant. A blank string is equivalent to "everything".
An example of the use of Flush_Contents() is a message line on the screen. Each time you need a new message you can create a segment that contains the message plus the text spacing, text font, window, etc. Or you can leave a permanent segment that holds those attributes. Then you can create and delete a subsegment that has the actual text. Or skip the subsegment and put everything in one segment. Then flush out the text geometry when you're done.
All three methods do work; it's a matter of personal taste which you use.

NOTES

To flush a whole tree, use the "..." segment wildcard. For example, to remove all the geometry in the tree rooted at "foo" (within the currently-open segment) you would say Flush_Geometry("foo/...").
The system knows when a segment does not contain information that actually contributes something visible on the screen—it touches such a segment only briefly during display. So feel free to leave "flushed" segments laying around if this helps your program structure.
There is no " Flush_Contents_By_Key() " provided. If you want to get the same effect, use Flush_By_Key() (which just does geometry) or do an Open_Segment_By_Key() , a Flush_Contents() on ".", and a close segment. (The Open_Segment_By_Key() and the "." are quite efficient.)
Filter has almost the same meaning as in Begin_Contents_Search() , so a call to Flush_Contents() is similar to conducting a contents search and a Delete_By_Key() on each item found. The main difference is that attributes don't have keys, so deleting them would be complicated.
Shells and Meshes can be opened and have their "hardware resources" flushed, but all other types of geometry (e.g. lines, polylines polycylinders and images) must have their "hardware resources" flushed from either their owning segment or some segment above. If the hardware resources are flushed, all resources used for things like display lists, vertex arrays and textures will be freed from the video card cache. Any of these resources that are needed to draw the scene will be regenerated on the next update.

RESTRICTIONS

See also
Begin_Contents_Search, Clear_Display, Close_Segment, Delete_Segment, Open_Segment, Open_Geometry, Rename_Segment, Reset_System.

◆ Flush_Geometry()

void Flush_Geometry ( const char *  segment)

Flushes just geometry from a segment but leaves attributes, styles, segments, and subsegments.

Parameters
segment- Segment(s) to be flushed. Can contain wildcards.

DETAILS

Identical to Flush_Contents() (segment, "geometry").