Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#363 Filename extension filters

open
nobody
None
5
2015-03-09
2013-09-22
Ed Kolis
No

When loading/saving a scene, the default extension in the dialog should be "aoi". Likewise, when rendering, the default extension should be "png", "jpg", or whatever I'm rendering as. That way I won't have to sort through a bunch of rendered files when opening a scene, or accidentally save a render as "mymodel" instead of "mymodel.png".

Discussion

  • Luke S
    Luke S
    2013-09-23

    This one has been bugging me for a bit, too. The idea would ideally extend to other file dialogs:

    • Opening image files for use in textures
    • Importers of other file formats
     
  • Luke S
    Luke S
    2015-02-19

    @Peter: I'm considering implementing this one myself, mostly because the folders I use for AOI projects are starting to drive me nuts. I don't believe that this functionality could be done in a plugin, so I would be modifying AOI core. Questions:

    • Would you object to this feature if the code was available?
    • Anything that I should keep in mind about cross-platform compatibility? I know that some types of OS didn't used to use extensions a lot. Should I be checking for OS type and, say, defaulting mac to unfiltered?
     
  • Peter Eastman
    Peter Eastman
    2015-02-20

    Go ahead. That would be great. As long as the filter is optional, it's fine to default to having it on for all platforms.

    Peter

     
  • Luke S
    Luke S
    2015-03-07

    Okay, Here is a working implementation. I intend to extend it a bit, but this will cover the basics, and give people the chance to give some feedback on the functionality.

    I decided against having a manual setting to enable/disable file filters. Instead, AOI will remember the last filter you used, even across different runs. If you don't want to use a file filter, just select the "all files" filter once, open a file, and never worry about it again.

    There are separate memories for Image Files and AOI files.

    Modified Files are attached:

    ImageFileChooser.java

    Lines:

    • 17, 20 (import)
    • 33 initialize preference object.
    • 49 - 67 (Add options, read preferences)
    • 73-79 Hijack showDialog() to save preferences.
    ArtOfIllusion.java

    edits to lines 529-703.

    artofillusion.properties

    added some entries in a new group, just above the miscellaneous area. (Just English so far)

    There are several other places in the program that try to open aoi files. There are two approaches:

    1. insert basically the same changes that I made to ArtOfIllusion.java in all of them (Bad Idea - then we need to maintain at all of those locations)
    2. Create a small subclass of BFileChooser that implements the filters/preferences, along the same lines as ImageFileChooser. This is what I intend to do eventually, as it will also allow me to add a slightly more sophisticated "Recent Directories" capability.

    EDIT: I just realized that a line in ImageFileChooser had not been translated. Update to fix, functionality should be the same

     
    Last edit: Luke S 2015-03-07
  • Peter Eastman
    Peter Eastman
    2015-03-09

    Looks great. Changes committed. Thanks!