• 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

    Developing an Isadora Plugin

    Developers
    4
    15
    5644
    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.
    • mark
      mark last edited by

      Dear Machel,

      Well, it simply doesn't work the way you want it go... the flow goes like this:
      1a) You activate a scene. Isadora iterators all the actors
      1b) Each actor receives its initial values via HandlePropertyChangeValue: these will be a) the value specified in the property definition string, OR b) the value in the "initialize" field of the property inspector. (The latter overrides the former.) Note that it is possible to ignore this input because the inInitializing flag will be set to true during this call.
      2) Actor is activated - Activate() function is called with activate flag set to true
      3) Actor does its work, generally sending output after it receives new input, or in response to a MessageReceiver callback.
      4a) You deactivate a scene. Isadora iterators all the actors calling the Activate() function with the inActivate parameter set to false
      So really, it depends on when you send your output. For sure, you should **_never_** send output until after the Activate() function is called with the inActivate parameters set to true, and **_never_** send output after the Activate() function is called with the inActivate parameter set to false.
      But why do you want a global variable? Why not let the user input the IP address via an IP address input?
      Best Wishes,
      Mark

      Media Artist & Creator of Isadora
      Macintosh SE-30, 32 Mb RAM, MacOS 7.6, Dual Floppy Drives

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

        Hoi Mark,

        Thank your for the quick reply it helped me a lot figuring out what was happening. To clarify a bit what I am doing, my first step has been to write a OSC send plugin. I know that Isadora already has that actor, but as a first step in learning to develop plugins and working with OSC I choose to first make a OSC sender plugin before starting with the OSC receive plugin described in the first post of the topic.
        In this plugin my goals are indeed that the user can set the ip address, port, header and value. Using your description of the flow the OSC sender plugin now works and is attached to this post together with the OSC library I used. I think the code explains better what I was struggling with then I can explain in words.
        Now my next step will be to start with the OSC receiving plugin. If I run into problems or made some progress I will report back here on the forum. 
        As a side note I am now actually developing with Xcode 5 which I installed/upgraded by accident a couple of days ago. Xcode was nagging me to update the project settings and when I did stuff went wrong so I rolled back the project settings and made a todo for myself to better figure out the impact of Xcode 5 on the development of Isadora plugins.
        Greetings,
        Machiel

        cc31a4-isadoraoscsend.zip


        http://www.z25.org

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

          Dear Forum,

          I ams till further developing an Isadora plugin used to receive and send OSC messages.
          In this plugin I use some data structures to save date and keep track of things. 
          But when I save the file with the plugin in it and close the file after saving and the reopen it the data is gone.
          This is not so strange because the pluginInfo is cleared by DisposeActor. But how can I save data within the actor that will stay there even after reopening the file?  
          For instance is you use the text actor and paste some text in it will save that text so that if you reopen the file with that actor the text is still present.
          If I could have a look at the source code of the text actor that might already help me.
          any help would be greatly appreciated
          Machiel

          http://www.z25.org

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

            I think what you are talking about with the text actor is text that is assigned to an input.

            The input data will remain as part of the Isadora file, and be re-input each time the file is opened.
            As for options for your Plugin to store data, any text file format (txt, xml etc) might be an option. Read and write to a file at a defined location?

            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
            • machiel_v
              machiel_v last edited by

              Dear Forum,

              I have been digging around some more and I found that the "IsadoraDemoReadSerial" which is part of the SDK has the same functionality as the text editor. (in the sense that you get a textfield if you double click the actor and that the text you type there is saved together with the Isadora file)
              I am looking into how the :
              outActorParams->mPrepareActorForFirstUseProc = PrepareForFirstUse;
              outActorParams->mSetActorPrivateDataProc = SetActorPrivateData;
              outActorParams->mGetActorPrivateDataLengthProc = GetActorPrivateDataLength;
              outActorParams->mGetActorPrivateDataProc = GetActorPrivateData;
              outActorParams->mActorDoubleClickProc = DoubleClickActor;
              Are implemented and working. I have copied this functionality in my plugin and I am now testing to save a custom data container instead of a char* in the memory. So I am reading up on what memcpy does and how to implement it.
              I have the feeling I am almost there but any pointers or help would be greatly appreciated.
              However it might be easier to just save the data as txt, xml etc.. But I do not immediately know how to do that. Is there a snippet or sourcode I can take a look at for that ?
              Greetings,
              Machiel

              http://www.z25.org

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

                @machiel_v
                Another user on the forum created a nice text read/write plugin, that includes the source, you way want to take a look at it.
                http://troikatronix.com/troikatronixforum/discussion/694/read-text-from-a-file-i-wrote-a-plugin

                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
                • machiel_v
                  machiel_v last edited by

                  Hi DusX,

                  Ah.. I Forgot about that one.. I will look into the source of the read/write and see if that is an better path to walk then what I am doing now.
                  Thanks for now.

                  http://www.z25.org

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

                    @machiel_v

                    Yes, just have a look at the source. It's only the reading part, but it should help you write your own plugin, if using a separate text file is the way you want to go.

                    I basically used C file functions (fopen, fgetc) as I have a C programming background, but you may rather use C++ file streams and <</>> operators, or other file I/O libs (don't know much about these). The algorithm essentially depends on whether you need to read/write the file as a whole or line by line, character by character, etc.
                    You will find lots of examples here and there, but [stackoverflow.com](http://stackoverflow.com/) is a great site for this kind of snippets. Just be careful about platform-specific parts, some functions I used only work on Windows.

                    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
                    • machiel_v
                      machiel_v last edited by

                      Oke, I am stuck..

                      using the:
                      SetActorPrivateData
                      GetActorPrivateDataLength
                      GetActorPrivateData
                      I can set a chunk of memory with the right data but if I close and reopen the file the chunk of memory I set to something else and I cannot get to my data. In the IsadoraDemoReadSerial a char* is stored and retrieved and I have been able to duplicate that but I want to store a map with an object inside it not a char* ...
                      I could use some help.
                      Machiel

                      http://www.z25.org

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

                        I also noticed that with the GetActorPrivateData a variable called outActorData is being set. Which is probably saved in the file somewhere outside of the reach of the SDK...

                        The type using typeid(outActorData).name() is given as "Pv" which is the same type as the variable to be stored in the IsadoraDemoReadSerial example plugin. While the data I want to store is of the type: PSt3mapISs8PEmoduleSt4lessISsESaISt4pairIKSsS0_EEE which is a map with a string, object pair.
                        So... Maybe I am trying to push an object in to something which is only made to accept char* then of course it will never work...
                        Actually now I think of it "Pv" could mean Pointer variable but then I still do not know what to do with it.
                        So could this be verified? Hopefully by Mark? then I know if I am wasting my time..
                        Greetings, 
                        Machiel

                        http://www.z25.org

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