• Products
    • Isadora
    • Get It
    • ADD-ONS
    • IzzyCast
    • Get It
  • Forum
  • Help
  • Werkstatt
  • Newsletter
  • Impressum
  • Dsgvo
  • Press
  • Isadora
  • Get It
  • ADD-ONS
  • IzzyCast
  • Get It
  • Press
  • Dsgvo
  • Impressum

Navigation

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Tags

    SDK: Get total number of scenes and max length of a scene name

    Developers
    3
    6
    1864
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • djinoui
      djinoui last edited by

      Hello Mark and Isadora developers,

      I'm rewriting dbengali's plugin JumpByName ([http://troikatronix.com/troikatronixforum/discussion/768](http://troikatronix.com/troikatronixforum/discussion/768)) as I'd like to use it on Windows.
      The way I proceed is quite simple:
      • browse all scenes in a 'for' loop
      • if the name of the currently requested scene (I use the GetSceneName_ function defined in IsadoraCallbacks.h) matches the requirements according to the parameters, jump to this scene
      But this approach raises 2 problems:
      1. The 'for' loop needs a boundary. For now I hardcoded it in a constant, assuming that no Isadora project would use more than, say, 2000 scenes.
      2. The GetSceneName_ function requires a maxLen parameter, which seems to be the size of the string it fills with the scene name. I also used a constant, assuming that no one would have a scene name of 1000 characters.
      I would like the performance to be optimal, not to mention the ugliness of these solutions. Hence these 2 questions:
      1. Is there a way to get the total number of scenes in an Isadora project dynamically (something like GetNumberOfScenes_ ?), or at least the maximum size of the scene array (if it's not dynamically assigned) ?
      2. Same question for the size of the scene name string (a constant maybe?)
      Thanks in advance.

      Computer: Asus N76VZ PC, Windows 7x64, Intel I7, 6G RAM, Isadora v1.3.1f06
      Isadora SDK dev computer: VirtualBox PC, Windows XPx32, 2G RAM, Isadora v1.3.1f06

      1 Reply Last reply Reply Quote 0
      • djinoui
        djinoui last edited by

        Just a little update. I finally managed to solve problem #1, I just replaced the 'for' loop with a do/while: knowing that GetSceneName_ fills the string parameter back with empty content (""), it can be tested as a loop end condition.

        char loopCurrentSceneName[SCENE_NAME_MAX_LENGTH];
        int i = 1; // scene index (one-based)
        do
        {
        GetSceneName_(ip, inActorInfo, mode, i, SCENE_NAME_MAX_LENGTH-1, loopCurrentSceneName); // loopCurrentSceneName pointer now points to the scene name at current index
        ...
        i++;
        }while (strcmp(loopCurrentSceneName, "") != 0); // Loop while a scene name is found in scene list
        As you can see, I didn't solve problem #2 (kept the SCENE_NAME_MAX_LENGTH constant defined in linked .h file), but after all it's no big deal.

        Computer: Asus N76VZ PC, Windows 7x64, Intel I7, 6G RAM, Isadora v1.3.1f06
        Isadora SDK dev computer: VirtualBox PC, Windows XPx32, 2G RAM, Isadora v1.3.1f06

        1 Reply Last reply Reply Quote 0
        • DusX
          DusX Tech Staff last edited by

          Cool.. the name length is not such an issue..
          thanks for putting in the hard work.

          Troikatronix Technical Support

          • New Support Ticket Link: https://support.troikatronix.com/support/tickets/new
          • My Add-ons: https://troikatronix.com/add-ons/?u=dusx
          • Profession Services: https://support.troikatronix.com/support/solutions/articles/13000109444-professional-services

          Running: Win 11 64bit, i7, M.2 PCIe SSD's, 32gb DDR4, nVidia GTX 4070 | located in Ontario Canada.

          1 Reply Last reply Reply Quote 0
          • dbengali
            dbengali last edited by

            Sorry again to disappear while you were working on this and not to save you time!

            For #2 I made a similar choice, though I set the max length to 128\.  I believe I left a warning in the actor help about keeping scene labels less than 128 characters.  You were more generous :)
            For #1 I also wonder if there is a way to find out the number of scenes somewhere, but I assumed that the scene list is maybe stored internally as a linked list rather than an array, in which case, there isn't necessarily a way to know the number of scenes other than navigating the list.  So, while iterating through the scenes looking for the search string, I just catch the error "kIzzyErr_SceneDoesntExist" to know if I have run past the end of the scene list, and thus can stop checking.  This conveniently avoids the need for a constant boundary on number of scenes.
            hope this helps, even though it is a bit late.
            1 Reply Last reply Reply Quote 0
            • djinoui
              djinoui last edited by

              No problem, dbengali, thanks for your post anyway. The try/catch approach is interesting too, seems more robust in case of a change in the API.

              Computer: Asus N76VZ PC, Windows 7x64, Intel I7, 6G RAM, Isadora v1.3.1f06
              Isadora SDK dev computer: VirtualBox PC, Windows XPx32, 2G RAM, Isadora v1.3.1f06

              1 Reply Last reply Reply Quote 0
              • djinoui
                djinoui last edited by

                Oh... I see. No try/catch, just the return value compared to the kIzzyErr_SceneDoesntExist constant.

                I'm feeling lazy to adapt my source right now, I'll keep the empty string comparison for now... works well too.

                Computer: Asus N76VZ PC, Windows 7x64, Intel I7, 6G RAM, Isadora v1.3.1f06
                Isadora SDK dev computer: VirtualBox PC, Windows XPx32, 2G RAM, Isadora v1.3.1f06

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post