Skip to main content

Sate Configuration

Using Behaviors 

To apply logic to the nodes in a no-coding-approach, CGI Studio providesenables behaviors.application Behaviorslogic arethrough smallan genericintegrated functionsstate thatmachine canmodel. manipulateState machines, combined with controls and behaviors, support the construction of complex application logic without programming.

This section describes how to set up transitions between scenes using state machines. The ultimate goal is to trigger scene transitions by clicking on specific nodes within a scene.


Displaying the State Machine Editor

The state machine editor is displayed by the following operations

    Expand [ Solution>State Machines ] in the SceneSolution Tree.Explorer.
    By
    setting"State configurableMachines" properties,is behaviorsexpanded and "GlobalStateMachine" is displayed.
    drawing-4-1707887702.png


    Double-click "GlobalStateMachine".
      The State Machine Editor panel will appear. The State Machine Editor panel can also be adapteddisplayed toby applyselecting to[ multipleState differentMachine scenarios> withoutState Machine Editor ] on the needmenu tobar createfrom new"View". ones. Another feature

      With the State Machine Editor panel displayed, check the Properties panel and make sure that [ Is Global ] is checked. If it is not checked, check it.

      GlobalStateMachine consists of behaviorsInitial State (circle icon), Transition (arrow), and State (rectangle) by default.
      Initial State is thatthe theyentry communicatepoint viafor events.the Eventsstate allowmachine. sendingState datarepresents froma onecertain behaviorlogic status and is associated with a series of actions when transitioning into a State (enabled) or transitioning out of a State and moving to another behaviorState without knowing any details about each other. (disabled).

      InEach thisaction section,defined for a State change is performed when the valueState ofis enabled/disabled.

      drawing-4-1707887847.png


      State configuration

      To perform screen transitions, set the gaugeState. (needles)This willoperation beis forwardedperformed toafter the textState valueMachine in the center of the gauge, using behaviors. 

      1. Click Scene > Car_Cluster in Solution Explorer. 

        Car_ClusterEditor is displayed in SceneDisplaying Tree.the State Machine Editor operation.
        1. ExtraSceneTreeClick isState on the State Machine Editor panel.
          • The properties of the selected State are displayed atin the right-sideProperties view of Scene Tree. panel.

          2.

          Click and selectIn the controlProperties RPMGauge.panel,
          change the [ Name ] of the General category to "Car_Cluster".
          • The behaviorsname of RPMGaugethe areState shownon inthe ExtraSceneTree.State Machine Editor panel screen changes to "Car_Cluster".
            drawing-5-1697188508.pngdrawing-4-1707888043.png

          3.

          SelectWith Forward"Car_Cluster" Value behaviorselected, from the Toolbox.lower
            On the top partleft of the Toolbox,State thereMachine Editor panel, click [ Fusion... ].
              Switch to the Fusion panel and the Fusion diagram for "Car_Cluster" is adisplayed.
              searchThe barTransition Request Fusion node is connected to easilythe findconnector nodes(On orEntry behaviorsActions) thatin arethe needed.upper right corner of the Car_Cluster Fusion node. [ RequesType ] is set to "Active".
              drawing-4-1678164929.pngdrawing-4-1707888413.png

              4.

              Move Forward Value behavior to ExtraSceneTree of RPMValue by drag-and-drop operation. 
              drawing-5-1697188623.png

              5.

              Click the added Forward Value behavior to show its Properties. 

              6. Click the browse button on the right-sideSelect ofitem TargetNode 

              7. For the TargetNode value, select RPMGauge_Group > RPMValue. 

                Through this operation, the value of RPMGauge control is automatically forwardedicon to the RPMValueright control.of the [ Identifier ] in the Transition Request Fusion node.
                  [ Choose Item ] dialog box appears.
                  drawing-4-1706847284.png


                  Select [ Solution>Scenes>Car_Cluster ] from the list on the right side of the dialog and press [ OK ] button.
                    With this setting, the "Car_Cluster" scene will be enabled when transitioning to this State "Car_Cluster".
                    drawing-5-1697188795.pngdrawing-4-1707888975.png


                    Drag the connector (On Exit Actions) in the lower right corner of the Car_Cluster Fusion node, move the mouse, and release left click anywhere.
                      [ Select Behavior ] dialog appears.
                      drawing-4-1707889069.png

                      8.

                      RepeatEnter steps"Transition 2Request to" 7in fromthe abovesearch forfield SpeedGaugeat control.the top of the dialog.
                      • ForThe SpeedGaugelist control,of select SpeedGauge_Group > SpeedValue as TargetNodebehaviors in Step 7. 


                      Adding Multilanguage Features

                      You can easily switch languages by using CGI Studio multilanguage support function. In this section, you will understand how to apply the multilanguage support function to switch between English and Germany (miles and kilometer). At first, you need to set-up a culture for this. 


                      1. Click the globe icon from the menu bar. 

                        The "Solution Options : Cultures" dialog is displayed.narrowed down to [ Action > Transition > Transition Request ].

                        ThisDouble-click dialog"Transition Request".
                          Transition Request Fusion node is alsolinked accessible throughto the menu"On barExit byActions" selectingconnector Fileof >the SolutionCar_Cluster Options…Fusion > Cultures. node.
                          drawing-5-1697188957.pngdrawing-4-1706847453.png

                          2.

                          ClickThe following settings are made for the globeTransition withRequest aFusion plusnode iconconnected to addthe new"On cultureExit settingActions" row.connector.

                          3.

                          SelectWith Englishthis setting, the Car_Cluster scene is disabled when transitioning from this State "Car_Cluster".
                          RequestType Deactivate Identifier Solution>Scenes>Car_Cluster

                          Adding and configuring "State"

                            Click on the "Car_Cluster" State on the State Machine Editor and select [en] Copy ] from the Culturecontext drop-downlist.menu.

                            4. Repeat step 2 above but select German[de] this time.

                            drawing-5-1697189230.pngdrawing-4-1707889373.png

                            5. Press the OK button to close the dialog box. 

                            6. Click Scene > Car_Cluster in Solution Explorer. 


                            Car_Cluster is shownAnywhere in the scenestate tree.machine editor, bring up the context menu and select [ Paste ].
                              A State named "Car_Cluster_1" will be added.

                              ExtraSceneTreeClick ison shown"Car_Cluster_1" on the State Machine Editor panel screen.
                                The properties of "Car_Cluster_1" will appear in the right-sideProperties panel.

                                In the Properties panel, change the [ Name ] of the General category to "Car_Status".
                                  The name of State on the SceneState tree.Machine Editor panel changes to "Car_Status".

                                  7.

                                  ClickWith "Car_Status" selected, from the triangularlower iconleft besideof StatusBottom.the State Machine Editor panel, click [ Fusion... ].
                                  • StatusBottom is expanded and items Temp, Petrol and Odometer are shown. 

                                  8. Click Odometer. 

                                  9. In the Properties, under Control category, click the browse button nextSwitch to the inputFusion fieldpanel and the Fusion diagram for "Car_Status" is displayed.

                                  The connectors on the right side of the FormatCar_Status TextFusion property.node (On
                                  drawing-5-1697189845.png
                                  Entry

                                  10.Actions/On TheExit LanguageActions) Tableare Selection is opened.

                                    The Language Table dialog may also be opened via the menu bar Language > Language Table…  The drop-down on the top right allows selection of the Current Culture. 

                                    11. Click the Add button while Master[00] is set as Current Culture. 

                                    drawing-5-1697190061.png

                                    12. Set the value as seen belowconnected to the newlyTransition addedRequest row.Fusion node, respectively.


                                    Set the Transition Request as follows
                                    TargetOn item
                                    Entry Setting valueActions TextRequestType Trip: %04d km
                                    Activate Translation HintIdentifier mileageSolution>Scenes>Car_Status On Exit Actions RequestType Deactivate Identifier Solution>Scenes>Car_Status

                                    13.

                                    ChangeRepeat the Currentstep Culture1 bythrough selectingstep either6 English[en]above, and/oradd German[de]another fromState and make the drop-downfollowing list, then set the value as seen below for each culture. settings.
                                    Culture
                                    Setting valueName English[en] Trip: %04d milesIncoming_Call German[de]On Entry Actions RequestType Trip:Activate %04d km Identifier Solution>Scenes>Incoming_Call On Exit Actions RequestType Deactivate Identifier Solution>Scenes>Incoming_Call

                                    14.

                                    After all steps are completed, the previousstate set-up,machine clickeditor thewill OKlook buttonlike tobelow close the dialog box. 

                                    15. In the Culture Solution Option in the tool bar, switch between English and German. The distance unit should change to "miles" or "km" accordingly. 

                                      When English[en] is selected, the unit is “miles”. When either Master[00] or German[de] is selected, the unit is “km”. figure.
                                      drawing-5-1697190288.pngdrawing-4-1706765922.png


                                      Simulation via CGI Player and Value Generator

                                      In this section, simulation will be run via CGI Player based on the settings made in Using Behaviors and Adding Multilanguage Features

                                      1. Run the CGI Player and perform simulation on RPMGauge and SpeedGauge. 

                                        Refer to Run CGI Player and Run simulation by Value Generator how to operate. Based on the settings of Using Behaviors, the value in the center of the Gauge must be changed according to the Gauge needle value.


                                        2. Click the Value Generator tab. 

                                        3. Change the value on Maximum as below for RPMValue and SpeedValue. 

                                        Items Setting value RPMValue 8000 SpeedValue 240
                                        drawing-5-1697191449.png

                                        4. Next, select from the Culture selection drop-down and switch English/German. 

                                        drawing-5-1697191518.png
                                          When en (English) is selected, “miles” should be shown accordingly. 
                                          drawing-5-1697191933.png