VectorStyler
    • Categories
    • Unread
    • Recent
    • Tags
    • Popular
    • Register
    • Login

    FR: API for Scripting

    Scheduled Pinned Locked Moved Features and Ideas
    16 Posts 5 Posters 14.6k Views 5 Watching
    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.
    • X-RaymX Offline
      X-Raym
      last edited by

      Hi,

      Is an API with a simple scripting language (like Lua or JavaScript) in consideration for VectorStyler ?

      It is really something which is missing from Affinity Designer and as been requested for years.

      Even a very simple system, with a dropdown to run file from a directory could do nice things.

      Having access to Layer stack, layer name, layer transform properties, and we can write some nice things with that, to make grids, to add randomization etc...

      It is surely not in top priority cause there is stability and UX things to take care first but just wanted to know if this is something dev have considered.

      Thx!

      b77B VectorStylerV 2 Replies Last reply Reply Quote 2
      • b77B Offline
        b77 @X-Raym
        last edited by

        @X-Raym I'm positive a scripting API is coming — in the meantime Actions (Panels > Presets) while limited, can be put to good use.

        MacBook Pro (Intel) running Monterey 12.6.4

        1 Reply Last reply Reply Quote 2
        • VectorStylerV Offline
          VectorStyler @X-Raym
          last edited by

          @X-Raym The short answer is yes, but it will be in a major update (possibly before 2.0, but certainly by 2.0).

          The longer answer: both native plugin development and scripting already exists in the current version of VectorStyler, it is just not publicly available (so the hard part is done).
          And in fact, the whole VS as it is, is a collection of plugins.
          The problem is that this API cannot be made publicly available, as it would restrict its evolution (fragile binary interfaces).
          For native development, there will be an additional layer of indirection (in C++), publishing a restricted, but sufficient interface to develop various plugin types (effects, file formats, actions, etc).
          For scripting (Lua is already in, again internally only), the primary target is JavaScript, with a set of domain specific interfaces (mainly focused on automation, access to document hierarchy, styles, effects, and properties in general).

          X-RaymX N 2 Replies Last reply Reply Quote 6
          • X-RaymX Offline
            X-Raym @VectorStyler
            last edited by

            This is promising, and nice to hear it is in consideration ! Thx!

            1 Reply Last reply Reply Quote 0
            • N Offline
              Nils @VectorStyler
              last edited by

              @vectoradmin Quick question on this: I know, these things are incredibly hard to predict, but do you have any rough estimate when 2.0 might be released?

              VectorStylerV 1 Reply Last reply Reply Quote 0
              • VectorStylerV Offline
                VectorStyler @Nils
                last edited by

                @Nils said in FR: API for Scripting:

                @vectoradmin Quick question on this: I know, these things are incredibly hard to predict, but do you have any rough estimate when 2.0 might be released?

                Yes, it is hard to predict. There is a set of features that are planned to be done before that.
                But bugs are always prioritized over features, and then there are also those feature requests that are "almost bugs", in that it is either something missing, or it is an obvious thing that is needed.

                So I prefer to keep the schedule fluid, so I cannot assign a date to 2.0.
                I have been planning to setup a roadmap (without dates) of features, so progress can be followed much better.

                N 1 Reply Last reply Reply Quote 1
                • N Offline
                  Nils @VectorStyler
                  last edited by

                  @vectoradmin Makes sense. Quick aside: If you ever considered to provide a python interface for the eventually coming scripting API, that would be amazing. It's imo a way better language for this kind of thing.

                  1 Reply Last reply Reply Quote 2
                  • S Offline
                    Subpath
                    last edited by Subpath

                    @vectoradmin

                    You already mentioned Lula and Java Script, which of the
                    two is from your point of view the scripting language that
                    offers the most possibilities in Vs?

                    I have some (amateurish) knowledge of various scripting languages, including Lua.
                    Have always enjoyed using these to automate operations.

                    Lua seems to me to be a bit easier than Java Script for beginners (myself included 🙂 ).

                    Bwt. while @Nils wrote this, have no knowledge in Phyton. ( yet 🙂 ).

                    Win 11
                    CPU: AMD Ryzen 5 9600X, 6-core.
                    GPU: Nvidia Geforce RTX 5070.

                    VectorStylerV N 2 Replies Last reply Reply Quote 0
                    • VectorStylerV Offline
                      VectorStyler @Subpath
                      last edited by

                      @Subpath @Nils The current architecture of VS allows the addition of scripting languages as plugins.

                      Currently only Lua is implemented, but it is not public. JavaScript is certainly will be added, and from what I know Python is also possible.

                      The (native) interfaces to VS are dynamic and it is easy to create / call any object or method from a scripting language, or navigate existing object hierarchies like the document.

                      The main challenge is to select what interfaces to publish, and document those, this where the actual effort will be.

                      N S 2 Replies Last reply Reply Quote 1
                      • N Offline
                        Nils @Subpath
                        last edited by

                        @Subpath Hey, you should pick up some python when you find some time. It's really easy to learn and a lot better for these purposes. For example: Inkscape uses it for their extensions and it works beautifully. Since VS is in most other aspects a lot better than Inkscape ( expectedly, since it's paid ), this would really widen the gap a lot.

                        S 1 Reply Last reply Reply Quote 1
                        • N Offline
                          Nils @VectorStyler
                          last edited by

                          @vectoradmin I see, so I imagine the backend document structure manipulation to be similar to your typical svg xml doc..

                          VectorStylerV 2 Replies Last reply Reply Quote 0
                          • VectorStylerV Offline
                            VectorStyler @Nils
                            last edited by

                            @Nils said in FR: API for Scripting:

                            @vectoradmin I see, so I imagine the backend document structure manipulation to be similar to your typical svg xml doc..

                            Yes, there are properties to get/set, collections to iterate over. Properties can get a bit more complicated, but otherwise it is a typical document object structure.
                            Except the structure is not strictly defined. A lot of plugins participate and bring their own data / properties / features.

                            1 Reply Last reply Reply Quote 1
                            • S Offline
                              Subpath @VectorStyler
                              last edited by

                              @vectoradmin

                              thanks, interesting

                              Win 11
                              CPU: AMD Ryzen 5 9600X, 6-core.
                              GPU: Nvidia Geforce RTX 5070.

                              1 Reply Last reply Reply Quote 0
                              • S Offline
                                Subpath @Nils
                                last edited by Subpath

                                @Nils

                                I know that Inkscape have Python as Scripting Language
                                also use Inkscape from time to time. Like the Spray Feature in Inkscape.
                                I will have a look at it when I have some time

                                Win 11
                                CPU: AMD Ryzen 5 9600X, 6-core.
                                GPU: Nvidia Geforce RTX 5070.

                                1 Reply Last reply Reply Quote 0
                                • VectorStylerV Offline
                                  VectorStyler @Nils
                                  last edited by

                                  @Nils @Subpath BTW: the VS document can be saved in JSON or XML format (it is a variation of the same vstyler format), by setting JSON or XML in Document Setup -> File -> File Format field.

                                  The resulting file can then be used with any JSON or XML tool. But, no documentation on the content

                                  S 1 Reply Last reply Reply Quote 2
                                  • S Offline
                                    Subpath @VectorStyler
                                    last edited by

                                    @vectoradmin

                                    interesting, but it's out of my league. I have dealt with html once, but it's been a looong time 🙂 .

                                    Win 11
                                    CPU: AMD Ryzen 5 9600X, 6-core.
                                    GPU: Nvidia Geforce RTX 5070.

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