Win7 Change Environmental Color script

pencilart
2015-08-10
2015-08-14
  • pencilart

    pencilart - 2015-08-10

    I just got AOI 3.0.2 on my Windows 7 (64 bit) machine now. Everything looks good execpt for one weird problem:
    I have a script that Mayid (Guillermo Pérez) made for me (quite a while ago) to have the environment color be changed to the one I want for every new scene and it works on all my various installs of AOI except 3.0.2 on my Windows 7.
    The script works with:
    3.0.2 on Linux,
    Windows 8.1 and
    the 3.0 version of AOI on Win 7.
    I don't know why it's not working with 3.0.2 on Windows 7.
    When I installed 3.0.2, I installed it to a different directory as I do all the time on any of my computers. (I like to have several different versions around to check things).

    See this on how the script was put together in case you need to examine it: http://www.friendlyskies.net/aoiforum/viewtopic.php?pid=18024#p18024

     
  • Luke S

    Luke S - 2015-08-11

    Not the same issue. The bit of code that @pencilart is referring to is a plugin. Basically sets teh environment color for a new scene. I'll have to see if I can re-compile it later, as the binary version is gone.

    Longer term, I'd like to create a 'template scene' functionality, as I think it would be a lot more flexible than many little customization plugins.

    RE: beanshell, I had re-built with 2.0b4 pulled from one of the other binaries. Listed in the thread. Have not done a freash build after source has been updated, though... thought it would be the same build.

     
  • pencilart

    pencilart - 2015-08-11

    It might have been the same issue. I just downloaded and installed the artofillusion.exe (that you, Luke posted) from the page that Peter just gave the link to and it worked! The change environment color script works now! That makes me very happy.
    If that exe is the same one on the official download page, then I wonder what was happening. That's just plain weird.
    OTOH, would that have anything to do with Windows' permissions? The first time, I ended up installing from the admin profile because I wanted the AOI start icon launcher to be available to all users and that was greyed out (I was logged in as a regular user -- a.k.a. the kids' account) but was available when I installed it while logged in as admin.
    This time around, I was on the kids' account and just let the installer just do as it wanted (the icon would not be available to all, just the account I was logged into) then I just logged into the admin account and simply clicked on aoi's exe and told Windows to send a shortcut to the admin desktop and it works.
    I hope I didn't confuse you guys with this explanation. :)

    @Luke: I have the script for the ChangeEnvironmentalColor.jar and can send it to you if you want.

     
  • Luke S

    Luke S - 2015-08-12

    Yes, please post the plugin. This I have got to see, as no plugin should be affected by the Beanshell library. The version on that other discussion is not the same as on the download page, Which is why Peter asked if I had re-built.

    Unless the plugin diverges significantly from what was discussed on friendlyskies, it should not be a permissions issue either.

    OTOH, the slight awkwardness that you have experienced with your user account installs is due to how windows permissions are set up. With the current versions of AOI, I would not suggest trying for a system wide install on windows. You seem to be getting away with it because you have AOI installed in a user acct, which an Admin acct. can always access. If you had multiple user-level accts, things would really get interesting.

    I would love to get AOI set up to install in the standard C:/ProgramFiles location, but that would require some re-building of various components, specifically how the SPManager installs plugins.

     
  • Pete

    Pete - 2015-08-12

    Just a thought, but since there's only one line in that code, that actually is doing something, wouldn't it work just fine as a startup script instead of a plugin? -- At least it would be easier to change the color, should that be needed and it does not have to be compiled.

    EDIT: OK, then. It was discussed in the original FS thread...

     
    Last edit: Pete 2015-08-12
  • Pete

    Pete - 2015-08-12

    Well, I couldn't stop there :D

    As a start up script it looks like this:

    /* Change the default color of the environment for rendering. */
    
    // Set color channel values in the range of 0.0 to 1.0
    float r = 0.107, g = 0.268, b = 0.510;
    
    PluginRegistry.registerPlugin(new Plugin() {
      void processMessage(int message, Object[] args)
      {
        if (message == Plugin.SCENE_WINDOW_CREATED){  
          Scene scene = args[0].getScene();
          if (scene.getDirectory() == null) // only modify newly created scenes 
            scene.setEnvironmentColor(new RGBColor(r, g, b)); // set the environment color
        }
      }
    });
    

    If you save this into the Scripts/Startup folder (and remove the plugin to avoid 'overlapping') it will do the job. It works just as well as .bsh or .groovy and as all the scripts in that folder are executed anyway at start up, you can name it anything you like. .... like "MyColor.groovy" :)

    EDIT: I cleaned it a bit further.

     
    Last edit: Pete 2015-08-13
  • pencilart

    pencilart - 2015-08-12

    But, what about this part?
    PluginRegistry.registerPlugin(new Plugin()
    {

    Since you must have tried it yourself, did you keep that part?
    When you rename it, do you have to have .groovy at the end?

     
  • Pete

    Pete - 2015-08-12

    Yes, that plugin part is, that the script actually creates a new plugin and the plugin changes the color. That is the way it has to be done, when the new scene has just been created. There is an example of this in Peter's instructions on the AoI home site: http://artofillusion.org/docs/scripttut/chapter8.html -- So that is the typical way start up scripts work.

    You can save it as 'Something.groovy' or as 'Something.bsh'. The .groovy is then executed as Groovy and .bsh as BeanShell. (AoI supports two scripting languages nowadays.) Peter seems to favour groovy as it is more powerful. Sometimes in tool scripts there are AoI commands, that groovy does not support, so I usually choose .bsh just to be sure.... :D

    EDIT: Some additions and typo fixing.

     
    Last edit: Pete 2015-08-13
  • Pete

    Pete - 2015-08-12

    forget

     
    Last edit: Pete 2015-08-12
  • Peter Eastman

    Peter Eastman - 2015-08-13

    Luke, can you point me to the corrected Windows installer? I'll replace the one on the download page with that one.

    Sometimes in tool scripts there are AoI commands, that groovy does not support, so I usually choose .bsh just to be sure.... :D

    There shouldn't be anything that Groovy doesn't support, but occassionally it requires slightly different syntax. Groovy and Beanshell are very similar languages, but not at all identical.

    The main reason I favor Groovy is that it's much faster. It gets compiled to Java bytecode, which then gets compiled to machine code, whereas Beanshell is strictly interpreted.

    Peter

     
  • Luke S

    Luke S - 2015-08-13

    Here we are. File attached.

    I really would like to get the installer packaging integrated into the ant builds. How much re-structuring would you be willing to tolerate? (to separate build artifacts from source tree. I would update all scripts, etc, so that they would still function.)

    @pencilart: I've got a copy of the plugin as you posted it, but pete is right, what he posted is about all there is to it. No idea why it seemed sensitive to build version.

     

    Related

    Discussion: Distribute script not working post aoi3.0

  • Pete

    Pete - 2015-08-14

    There shouldn't be anything that Groovy doesn't support

    I was going to ask about print but it turns out (just by guessing and testing) that in Groovy it is println. I may have some other syntax related questions, but that's another topic.

    No idea why it seemed sensitive to build version.

    For one thing, it has been compiled many versions ago .. .and for the other, I think Mayid for example added import statements, that are not really needed and I don't see a reason for the final static protected RGB-color either. - It is just a color and the the user can replace it by a new color any time.

    If I am not mistaken, that was Mayid's first plugin. Myself, I had not made acquaintance with the stuff at the time yet.... :)

     
    Last edit: Pete 2015-08-14

Log in to post a comment.

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

Sign up for the SourceForge newsletter:





No, thanks