New plugin to test: Circular Array

  • Pete

    Pete - 2016-01-28


    This is something, that I have been planning on doing for a very long time: A plugin that creates henges or arch- or helix formations of objects. This is much more precise that curve arrays. Before this has been existing as an 'unofficial' script to those who happen to remember, where to look.... ;)

    Currently this is still a bit of unfinished. A couple of features that I plan to add:

    • Copying with children
    • Removing double selections (= as the object itself and as a child of another. The Array tool does not do this.)
    • Possibly a choise to make the array as direct children to the selected center object. Probably not to the first release yet. It requires a few "if and whens and maybes" to be checked.
    • Title text and hopefully an icon.

    Now I'd like to ask something:

    1. Does the name of it sound right? Should it be for instance 'Henge' instead of 'Circular Array'. (I'm not sure, what this has been called in the professional tools that I have used, as they had just icons visible, but the Circular array probably comes from soewhere -- a manual maybe?)
    2. How about the rest of the vocabulary? 'Segment' or 'Step' ... or anything else that looks funny?
    3. Is there a way to add the title text and icon to a ComponentsDialog() ... The title property at least seems to be available, but when that dialog is made it also gets launched right away and then it only waits for OK or Cancel. (I'll probably need to make my own version of Components Dialog?)
    4. Any commets on my coding?
    5. I'd be happy to receive translations in other languages. A model properties file is available in the folder below, so you don't have to unzip anything just for that! :)

    PLEASE NOTE: This is not a 'release' but rather an introductory version, for feedback so lets not load it to the repository yet. :)



    EDIT: A New version with a nicer UI behind that link above. My comments somewhere below.

    Last edit: Pete 2016-03-15
  • Luke S

    Luke S - 2016-01-29

    Must take a look... Though, if the basics are similar to the old script, I think "Circular Array" is a fine name...

  • Pete

    Pete - 2016-01-31

    I noticed something funny: I usually start AoI by running a .bat file that allows it all the memory. When I do that, all the views get repainted just by calling window.repaint(). However, when I have started AoI by the Art of Illusion.exe window.repaint does nothing. The newly created arrays only show up after I either click one of the views or the new array in the item list.

    To overcome that issue I needed to

        for (int v = 0; v < w.getAllViews().length; v++)

    I think I have struggled with those new objects that stay invisible before, but I did not realize that it was related to the way the program was launched.

    (So far I got it copying children. A few more things to check before next release. For one thing, I realized, that it makes a new group for every object that was in the selection -- that was not suppised to happen) :D


    Last edit: Pete 2016-02-03
  • Luke S

    Luke S - 2016-02-03

    Okay, finally got to trying this. Liking the basic results. Spiral staircases, anyone?

    I noticed that the arrays are always constructed with the assumption that the originator object is pre-positioned in relation to the selected center. I originally assumed that I would be able to create a ring of arbitrary radius centered where I liked, without prepositioning. It took me a few minutes to get my head around that one, though I can certainly see the use of this method, and would probably use this version more often, even if the other was available.

    all the views get repainted just by calling window.repaint(). However, when I have started AoI by the Art of Illusion.exe window.repaint does nothing. The newly created arrays only show up after I either click one of the views of the new array in the item list.

    I'm having this issue, and I launch with a .bat file. Could you post yours so that we can compare? Mine is: javaw -Xmx4096m -Djava.library.path=./lib -jar ArtOfIllusion.jar 1>AOIlog.txt 2>AOIerrlog.txt

    Also, what AOI version? What java version? And to clarify, is the file that I downloaded tonight running your workaround?

  • Pete

    Pete - 2016-02-03

    I noticed that the arrays are always constructed with the assumption that the originator object is pre-positioned in relation to the selected center.

    Yes, I figured, this'd be the simplest approach. Creating a ring anywhere would mean a lot more steps in the process.

    1) Set position of the center
    2) Set orientation of the center
    3) Set position of the first object
    4) Set orientation of the first object

    So now the objects already carry that information with them. Some engineering tools that I have used have some of those settings available to the user, but the process actually becomes very complex, and it includes things like modelling/marking a graphic element (a point) into the object that then is used as it's positioning ancor in the array....

    Basically the Array tool has a similar approach, that the array starts where the first object is. That one just does not need a centerpoint defined.

    Could you post yours

    javaw -Xmx12288m -jar ArtOfIllusion.jar 1>SystemOutLog.txt 2>SystemOutError.txt
    • AoI = 3.0.2 -- The newer version, with the corrected bsh. (I think It should have been called 3.0.3, for clarity)
    • Java = jdk1.7.0_55 (There also seems to be a jre1.8.0_65 around)
    • The work-around was not yet on the one I had for download.

    And the bat that I use to compile:

    set ANT_HOME=C:\Program_Files\apache-ant-1.9.4
    set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_55
    set PATH=%PATH%;%ANT_HOME%\bin
    set PATH=%PATH%;%JAVA_HOME%\bin
    set CLASSPATH=
    set CLASSPATH=%CLASSPATH%;C:\Program_Files\ArtOfIllusion\ArtOfIllusion.jar
    ant -f CircularArray/CircularArrayBuild.xml > BuildLog.txt
    Last edit: Pete 2016-02-03
  • Pete

    Pete - 2016-02-03

    The Array tool is actually using window.updateImage(). ...wonder if I should use that.

    Last edit: Pete 2016-02-03
  • Luke S

    Luke S - 2016-02-03

    Yes, updateImage() is probably better. window.repaint() is in the bouy GUI level, and usually refers to rebuilding the layout of a standard GUI component, for example when you add an option dynamically. LayoutWindow (the upper-level AOI scene window) does not have a repaint() method, and the scene viewers call repaint() internally at the end of their updateImage() method

    I see what you are saying with the "Engineer" interface. Probably better as is, it just surprised me the first time. Also trying to figure if there would be a way to simplify/smooth the interface out a bit.

    Last edit: Luke S 2016-02-03
  • Pete

    Pete - 2016-02-03

    LayoutWindow (the upper-level AOI scene window) does not have a repaint() method.

    Yes it does. :) it is inherited from a few extension back, from buoy.widget.Widget -- the AoI API just does not usually refer too far back. And sometimes the repaint() works too! (I did to me!) .... But I have no idea why, how or under what circumstances. So updateImage() it is. :D

    Also trying to figure if there would be a way to simplify/smooth the interface out a bit.

    Yeap. The ComponentsDialog is probably not the best choise for the UI platform, but at least it is pretty easy to work on, while you are developing something. I think, so far, it seems quite obvious that the information on the UI can be split into 3 groups and I'm quite happy about the interactivity between the elements...

    Already now the bigger part of the code seems to be controlling the UI, which seems to be typical of anything with good usability. It could be developed further for example into something that collapses the parts of the UI that are not needed.... So far I know nothing about those.

    As a (far) further development I'd like to see all the array tools existing as a group, where you would have three choices: linear, circular and user. -- The "user in this case meaning curve arrays.

    But first things first. Only the ignoring multipy selected objects is still missing and then I'll put out the next version. :)

    Last edit: Pete 2016-02-05
  • Pete

    Pete - 2016-02-04

    Version 0.02.00 is available.

    All the features are now in. I also managed to compress the UI a bit. -- Now it seems to miss some cosmetic improvements like adding a title text to the dialog... :)

    Some small changes to the properties file as well. Now would be a perfect time to get translations (German, France, Italian ... anybody?) You can post or link them here or send privately!

    Last edit: Pete 2016-02-04
  • Luke S

    Luke S - 2016-02-05

    Nice. Making prgress here.

    • I'm liking the dialog organization much better.
    • Are there any use cases when you would not want to ignore multiple selections?
    • Is the rotation scale in Radians or complete revolutions?

    At some point, the plugin should support undo properly. Just create an UndoRecord and call setUndoRecord() just before adding the completed array into the scene..

  • Pete

    Pete - 2016-02-06

    I'm liking the dialog organization much better.

    Surprised myself how much clearer it got. :)

    Are there any use cases when you would not want to ignore multiple selections?

    Probably not. The reason, I put the checkbox there is that the Array tool does not do that check-up and I wanted to have the otion for similar functionality. Maybe the check-up could be added to the Array tool?

    Is the rotation scale in Radians or complete revolutions?

    Angles are given in degrees. The local rotations are weights of the rotation pattern. So rotations for a full rotation. The pitch, when it is defined as the total distance does not have any connection to the rotations. Radians would probaby not make much sense to 'the common toddler'...

    Yes: Undo should be added. Currently the plugin adds each copy to the scene right, when it is created -- not all of them as a group -- and in the case, that a center object is used as parent this is the only way. But that all can be handled by one undorecord. Copied from the Array tool it seems to be working just fine.

  • Pete

    Pete - 2016-03-12

    I have ran into a minor issue with the UI: I can not make the AoI-icon appear on the corner of the dialog.

    BDialog knows how to copy the icon from the parent window and ComponentsDialog is extending BDialog but the icon does not show up. I also tried making a new copy of the ComponentsDialog, that adds a title on the header, but that one does not copy the icon either.

    What am I missing?

    The ArrayDialog seems to just super(parent, "Array", true); That works and so does a script that creates a BDialog.

    EDIT: I'll rewrite the dialog, so that it directly extends BDialog. ... But I still don't understand why the icon gets copied this way, but not by the ComponentsDialog?

    Last edit: Pete 2016-03-12
  • Luke S

    Luke S - 2016-03-13

    Hmm... I'd have to dig in to the structure of the libraries. Peter wrote bouy, so perhaps this is something he just... knows?

    • Pete

      Pete - 2016-03-15

      Like I wouldn't have bigger issues to worry about, I got a fix to this. See the comment after setResizable.

      package artofillusion.circulararray;
      import artofillusion.*;
      import artofillusion.object.*;
      import artofillusion.ui.*;
      import buoy.event.*;
      import buoy.widget.*;
      import java.awt.*;
      import java.util.*;
       * CADialog is a prototype UI. 
      public class CADialog extends BDialog
          public CADialog(LayoutWindow parent)
              super(parent, Translate.text("circulararray:dialogTitle"), true);
              // Close by 'X-button'
              addEventLink(WindowClosingEvent.class, new Object() {
                  void processEvent() {dispose();}
              } );
              // When usin 'setResizable(false)' or 'getComponent().setResizable(false)',
              // the icon is removed. The problem seems to be inherited form JDialog. 
              // This fix puts the Icon back.
              // The List needs to point to 'java.util.List' because 
              // there also is a List in java.awt, which will be needed later.
              java.util.List imageList = parent.getComponent().getIconImages();

      Now it is recopying the icon(s) from the parent window, but you could as well copy it from this, then setResizable(false) and then put it back, especially if you have defined a new Icon to the dialog.

      EDIT: Just icons = getIconImages() (from this) does not work alone. The setResizable(false) empties the list that the icons is referring to.... I suppose that would take making a local copy of each image first and adding them into a new list.

      Strangely enough setResizable(true) returns the removed icon(s). I suppose there is a kind of a logic in there, that resizable dialogs have icons and unresizable ones not, but that's not the way I want it in this case.


      Last edit: Pete 2016-03-15
  • Pete

    Pete - 2016-03-14

    Another question: The ComponentsDialog is removing all KeyPressed-event links after dispose(). Is that necessary or will the event links come back "haunting" the user if they are not removed? I mean I'd expect them to expire at dispose?

    I think I'll add the similar functionalities to the UI, so it can be closed with the X-button or Esc-key.

    EDIT: ...I tested this much: A (this) BDialog does perform actions after it disposes itself.

    Last edit: Pete 2016-03-14
  • Pete

    Pete - 2016-03-15

    A new verison is out:

    I managed to compress some of empty space off the UI and now there is undo

    Some comments / future changes:

    • Now the center object is picked from all objects on the scene. That should be changed so that the center object is among the selection before launching the tool. Then the logic would be the same as with the Curve Array.
    • The dialog appears in the middle of the parent window. I'll move it closer to the right upper corner. I don't think it should cover the area where you are working.
    • Now, If you use "add one in the end" th eone is not included in the axial pitch. It probabaly should.
    • Some minor adjustment to how the UI is actually built. Not visible to users.
    • Ant complains, that the dialog is using unsafe methods ... I'm not sure what that means. It seems to work though.
    • Comments (also on the code) are welcome.
    • See my previous post. My question is still up.
    • How about the way it handles empy selection (in the Dialog, not before)?


    Last edit: Pete 2016-03-15
  • Pete

    Pete - 2016-05-01

    Can we call this ready?

    Comments to before:

    • The (optional) center object is still picked from the scene. Having to select that too before launching the tool did not feel like such a good idea after all. Now you can pick any object on the scene as a center for the array -- even a child in a selection, that is going to be copied.
    • The dialog is now placed on the top right.
    • Did not change the behavior with the axial pitch -- There would have been more options to consider, so i chose to leave the maths to the user.

    New stuff:

    • Now you'll find the both the Array and the Circular Array under Array Tools in the Tools menu.
    • The original pieces that are copied are now set invisible. Unfortunately undo does not make them visible again.

    I'd be happy to drop in more translations now there are only US-English (?) and Finnish.

    If nobody has anything to say, I'll compile it once more and call it 1.0 :)


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks