Graphics.DrivingFlagsOverDCOMM - lordmundi/wikidoctest GitHub Wiki

Driving Flags Over DCOMM

« A Simple DCOMM Light Client | EDGE User’s Guide | Visualizing a real-time simulation »

(If you are unfamiliar with DCOMM, you can get a decent introduction from the article A Simple DCOMM Light Client.)

Intro

Along with driving position and attitude of nodes using the DCOMM library, you can also drive flags. Flags control things like whether a node is hidden, whether it is highlighted, or whether it is in matrix mode, for example.

Normally you would expect some function calls in the DCOMM header along with an enumeration that lists all the flags. Driving flags in DCOMM is one of those things that was built to be super extendable, so it does things a bit differently (even though most folks just use the default setup and don't extend things).

To get started, you'll want to take a look at d_comm.h at the various functions for dealing with flags. Two of the main ones are "DCF_SetFlag() and DCF_ClearFlag()". These functions will set and clear a specific flag on a node. Like almost all other DCOMM functions, the node is specified by its nodeid integer. The question is, how do you specify the flag (or the flag_mask)?

Flag Names

The flag mask (or id) can be gotten by taking a look in your config file. If you're like most people, you don't modify this so you can just look in your EDGE cev.cfg file and search for "VRD_HIDE_NODE". You should see a block of flag names. These are the names you will use to get the flag mask for that particular flag.

You can get the flag mask with the "DCF_GetFlagID()" function. This will return a flag id/mask for the flag with a particular name. Once you have it, you can use it with the other flag functions that require a mask.

Option 2 - Work By Names

Another option you have is to actually call functions that work with the flag name instead of the id. Search in the d_comm.h file for "ByName" to see these functions.

Option 3 - Hiding and Showing made easy

And lastly, if you are just hiding and showing nodes, you can see d_comm.h that there are DCF_NodeOff and DCF_NodeOn functions. These functions just set or clear the HIDE flag and you won't need to use flag names or IDs at all.