#!F-adobe-helvetica-medium-r-normal--18* #!N #!CSeaGreen #!N #!Rall609 Interactors and Control Panels #!N #!EC #!N #!N Interactors are special two-part modules. To incorporate an interactor into your visual program, you select the preferred type of interactor from the Interactor category, place it on the VPE #!F-adobe-times-medium-i-normal--18* canvas #!EF just like any other module, and connect it to the appropriate input tab or tabs on other modules. The interactor module that appears on the canvas is called a "stand-in." To use the interactor interactively, you also place an instance of the interactor in a Control Panel window. The interactor in the control panel represents the actual manipulator used by the user exploring the data. When a value is set by a user, it becomes the new output of the interactor stand-in and is thereby fed to the modules connected to the stand-in's output. Interactors have different appearances depending on its type; numeric (integer or scalar) interactors can be made to look like dials or sliders, while string interactors give you a place to type in a string. List interactors let you keep a list of items: there are lists of strings, vectors, values, integers, and scalars. #!N #!N It is good "programming" practice to set interactor minima, maxima, and increments to reasonable values. For example, a Scale module will accept a value of 0.0, but the effect will be to make the scaled object disappear! That is usually not desirable; set the minimum permitted scale value to be a positive value greater than 0.0 if you do not want to confuse users of your visual program. #!N #!N Some interactors can be used in a different mode than interactive: these are called #!F-adobe-times-medium-i-normal--18* data-driven interactors #!EF . Scalar, Integer, and Vector interactors, (and their respective List types) all have input tabs of their own. By default, all the numeric interactors have arbitrary ranges preset to -1,000,000 to +1,000,000. Clearly, these will rarely be the appropriate ranges for your data. As part of good interactive visual program design, you, the visual program author, would like to restrict these ranges to the "correct" values for the input data sets. But if you are building a visual program for use by others, you won't know in advance the ranges of data sets the user will import. If you build your visual program such that the data Field (the output of Import, for example) connects to the input tab on one of these interactors, the correct maximum and minimum values will be automatically set the first time the visual program is executed, and they will be updated appropriately as the input data set changes. Thereafter, the user cannot accidentally exceed the range of values by turning a dial or sliding a slider too far in one direction or the other. #!N #!N Data-driven interactors can be directly driven by Compute functions that might in turn be connected to a Sequencer or other data Fields or data components in a Field. As just a simple example, a Sequencer could emit a series of integers from 0 to 360; a Compute can turn the integers into floating-point angles in the range from 0.0 to 1.0 then make this new number the first component of a 3-vector ("[a/360.0, 1.0, 1.0]"); then Convert can change this HSV vector into RGB. Connect the output of Convert to a Vector Interactor and feed the interactor output to Color. The result is that the Sequencer will make the color of an object attached to this Color module pass through the entire spectrum of hues; simultaneously, you can watch the RGB values change on the Vector interactor in the Control Panel. #!N #!N You can have as many Control Panels associated with a visual program as you like. Furthermore, a handy feature is that the same "stand-in" (the Interactor module that appears in the visual program) can have multiple interactor instances associated with it. This means you can have both simple Control Panels and elaborate Control Panels with commonly needed interactors appearing in both. When you do set things up like this, you will notice that the multiple instances of the interactors will always maintain the same value: as you change the value in one Control Panel(s), the associated interactor(s) in the other Control Panel will stay in perfect agreement. #!N #!N Control Panels can be named and accessed by name. This allows you to set up hierarchies or even rings of Control Panels. You might choose to make a simple panel with only the most commonly used interactors, then create additional panels with less-used interactors. The main panel can then be set up to access the subpanels by name, using the Control Panel's #!F-adobe-times-bold-r-normal--18* Panels #!EF menu. Select #!F-adobe-times-bold-r-normal--18* Open Control Panel by Name #!EF to see the list of other Control Panels accessible by the current panel. #!N #!N It is very important to create sensible labels for the interactors in your Control Panels. Data Explorer will automatically assign a name to a new interactor that reflects the name of the module and input to which you have attached the interactor stand-in in the visual program. However, this name tends to be too generic, especially if you have several interactors connected to several similar modules. For example, you connect a Scalar Interactor to the "value" input of an Isosurface module. The interactor label in your control panel will acquire the title #!F-adobe-times-bold-r-normal--18* Isosurface value #!EF . But if you also place another Scalar connected to a different Isosurface, you will end up with two interactors with identical names. So it is incumbent upon you, the visual program author, to change the names of your interactors to reflect their function in your visual program. See #!Lbuico,dxall380 h Using Control Panels and Interactors #!EL and #!Linterac,dxall409 h Using Interactors #!EL for the instructions on using Control Panels and Interactors. #!N #!N A very handy interactor is the Selector. This interactor lets you construct a pop-up menu containing one or more string items each associated with a value, either a scalar (including integer scalar), vector or a string. Selector has two outputs, the value and the string you have entered. This allows you to present a menu that describes clearly what choices the user has, and when the user picks an item, Selector outputs both the value (through its left-hand output tab) and the string choice (through the right-hand output tab). The right-hand output can be attached to modules that accept string input. Remember Format? You can use this technique to change a caption depending on the user's current Selector choice. #!N #!N If you use integers as the "values" in your Selector, the left-hand output will be the currently selected integer. You can direct this numeric output of Selector to any module that takes an integer; a common use is to connect the integer output of Selector to a Switch module. #!N #!N The Switch module (in the Structuring category) uses a number to pick which of several inputs to pass to its output. Suppose you have connected an Isosurface to the first "input" (the second tab) of Switch and a ShowConnections to the second "input" (third tab). You have also constructed a Selector menu to offer the three choices: 0 = Both off; 1 = Show Isosurface; and 2 = Show Connections. The left-hand output of Selector is connected to the first tab (the "selector") of Switch. Now when the user chooses item 1 on the menu in the Selector interactor (located on a control panel, of course), the number 1 is emitted and received by Switch. Switch then lets the isosurface pass through. One more trick: you may want to allow both the Isosurface and the ShowConnections images to appear at the same time. Use a Collect module just before the Switch. Attach the Isosurface output both to Switch input 1, and to Collect; similarly, attach the ShowConnections output to Switch input 2 and to the Collect. Now add a fourth choice to the Selector menu: 3 = Show both. Attach the output of Collect to "input" 3 of Switch, and you have provided this new capability to the user. By the way, the value "0" will always turn off all output from the Switch; you do not need to provide a "0" valued choice if that is not appropriate; in other words, if you always want Switch to pass at least one item. #!N #!N The default settings for Selector are 0 = off, 1 = on. You may find this handy as you begin to develop more complicated visual programs containing a number of objects in the Image window. As you develop each "subnet" (that is, a branch of the visual program that yields a particular visual object), attach it to a Switch and add an on-off Selector. Change the label of the Selector interactor in the Control Panel to identify the object it controls. Run the output of each Switch to a Collect (add inputs to Collect as needed), then to Image. This way, you have a whole panel of Switches, allowing you to turn off and on each object in the scene. This will decrease the amount of time you wait for all objects to be rendered if you know that certain ones are OK but wish to test new ones in the scene. This technique is easier than connecting and breaking wires, too. #!N #!N #!N #!F-adobe-times-medium-i-normal--18* Next Topic #!EF #!N #!N #!Lall610,dxall611 h Transmitters and Receivers #!EL #!N #!F-adobe-times-medium-i-normal--18* #!N
Generated by dwww version 1.15 on Sat Jun 22 12:58:48 CEST 2024.