Graphics

 View Only
  • 1.  How To Suppress Error

    Posted 12-05-2024 16:25

    Using Xpression version 9.5

    I like to make utility functions when some task needs to be done again and again. In this case I am enabling/disabling tracks in scene directors.

    However, when I try to access a track that doesn't exist, xpDbgMon.exe throws an alert box/notification. 

    This is the function:

    Sub SetTrack(SDir as xpSceneDirector, Name as String, OnOff as Boolean)
      Dim Track as xpSceneDirectorTrack
      Try
        SDir.GetTrackByName(Name,Track)
        Track.Enabled=OnOff
      Catch
        'Do Nothing
      End Try
    End Sub

    I thought the Try/Catch would suppress the message. I would also hope an error like this would show in the log. It doesn't.

    I initially used the following but I got the alerts.

    Sub SetTrack(SDir as xpSceneDirector, Name as String, OnOff as Boolean)
      Dim Track as xpSceneDirectorTrack
      If SDir.GetTrackByName(Name,Track) Then
        Track.Enabled=OnOff
      End If
    End Sub

    I solved the problem by adding an empty track with the missing name in the offending scene director. But I thought the way I was writing the code would suppress the alerts.

    Any thoughts?



    ------------------------------
    Azathoth
    Son of Cthulhu
    ------------------------------


  • 2.  RE: How To Suppress Error

    Posted 12-06-2024 04:26

    Hi,

    First check SDir.TrackExistsByName(Name). If this results in False, skip the rest because the track is not there. If it results in true do the SDir.GetTrackByName(Name,Track).



    ------------------------------
    Gerard de Vries
    Solution Architect Live Graphics & Virtual Production
    EMG
    The Netherlands
    ------------------------------



  • 3.  RE: How To Suppress Error

    Posted 12-06-2024 09:25

    OMG. I looked at the SDK over and over and didn't see it. Now that you've pointed it out ... it's right there screaming at me.

    Thank you!



    ------------------------------
    Azathoth
    Son of Cthulhu
    ------------------------------