Script Documentation Mismatch

Luke S
  • Luke S

    Luke S - 2015-03-19

    I've been communicating with a user over on friendlyskies who has bumped into something.

    It seems that, contrary to what the documentation implies, a start-up script cannot rely on any reference to window We're still trying to communicate, so I'm not sure why, but he is calling window.getScene() in the first statement of his script, which must run at startup.

    NOTE: in the scripting, this exact call is listed in the section on start-up scripts.

    Looking back through the code history, it looks like this call would not have worked as far back as 2.4.1 (Still using

    So, the question is, is this a documentation issue, or a bug/missing feature?

    The user is currently using a patched solution involving trying to run the start-up scripts inside ArtofIllusion.newWindow(scene) after creating a LayoutWindow He then sets a flag to make sure that the scripts are only run once per AOI run. Are there any "Bad Things(TM)" that might happen in this case?

    EDIT: addendum: When I first saw that call in a start-up script, I thought that the user had to be making a mistake, and putting the contents of a tool script in the start-up folder. It made no sense to me to be able to get a LayoutWindow, or a scene, before the application was fully started. Do I make sense, or am I crazy?

    Last edit: Luke S 2015-03-19
  • Peter Eastman

    Peter Eastman - 2015-03-19

    You definitely can't refer to "window" in a startup script. Those run before any window has yet been created. I'm not sure what documentation you're talking about. Here's the section of the scripting tutorial on startup scripts: There's no mention of a "window" variable anywhere there.

    What exactly is the user trying to do?


  • Luke S

    Luke S - 2015-03-20

    RE: Documentation. Oops. I misread the first couple of lines there. N/M about documentation.

    As to what the user is doing... Long story.

    First: communication with this user is a little difficult, he is using google translate or similar for all communication, and I suspect some of his language is... colloquial. This leads to frequent misunderstandings.

    The upshot is: (And please understand that I am kind of filling in the gaps)

    • User loves AOI's renderer
    • User prefers to model/animate in Blender. Claims that AOI does not handle high poly models well, especially when animated. Due to communication issues, trying to address this issue to get more details is a bit of a non-starter.
    • He has found what is (to him) a perfect solution. (He's boiled this down to a one-click solution in blender)

    Follow these Steps:

    1. Export Blender scene as .obj One file for every frame.
    2. Auto-generate a .bsh script with the .obj directory, destination directory, and render settings hard-coded into the script. Place this script in AOI>Scripts>startup
    3. Start AOI commandline style with python sub-process. (From inside Blender)
    4. The script trolls through the specified directory, loads each file, renders and saves, and moves on to the next.

    Go ahead. Take a few moments to process that. :) I did verify it by looking at one of his generated scripts. Seems remarkably clean, readable, and with proper XML header.

    I can see a little where things could be improved in his process... But this brings up a couple of questions that I have not been able to answer from source.

    First, It appears that artofillusion.translators.OBJImport.importFile(Bframe) is how one loads an .obj file. This user is using the signature artofillusion.translators.OBJImporter.importFile(BFrame, File, File, LayoutWindow, scene)

    I cannot find such a method signature anywhere. Has he made another mod that he has not discussed? I could see such a signature being useful for some types of scripting...

    Second, I noticed the user calling ModellingApp.getRenderers() Since this class is deprecated, and I can't find the functionality anywhere else, is this:

    • Migration that never finished?
    • Or is there a different preferred way of doing this, with a different form?
    Last edit: Luke S 2015-03-20
  • Peter Eastman

    Peter Eastman - 2015-03-21

    Wow! That's... interesting.

    Has he made another mod that he has not discussed?

    Looks like it. But I really should refactor that class to split the loading into its own method that takes a File object as input.

    I noticed the user calling ModellingApp.getRenderers()

    That still works fine, but the modern way of doing that is



  • Peter Eastman

    Peter Eastman - 2015-03-21

    There, changes are checked in. OBJImporter now offers a much more sensible API.


  • Luke S

    Luke S - 2015-03-22

    Looks good. I would be nice if this API update could percolate up to the translator interface, but that can wait... I'll keep it on my list of things to consider.


Log in to post a comment.

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

Sign up for the SourceForge newsletter:

No, thanks