Page 1 of 1

GLSLShader 'Select A File' : Add *.txt filter & lastpath

Posted: Sat Jan 03, 2015 7:28 pm
by Terry Payman
GLSLShader 'Select A File' dialog box:

1) Default filter of "*.txt" in addition to the present "*.*"
Particularly helpful when picking shader files from amongst other types of file, eg when browsing in a "Collected Assets" folder.

2) Remember "lastpath" for the selected file.
It's a hassle having to repeatedly enter a path that differs from the (install?) default. Copy/paste of a module that "knows" the path is an inelegant workaround.

Filter and lastpath work very nicely for the Open Project (.magic) dialog. :D
Don't you just hate inconsistency? ;)

Re: GLSLShader 'Select A File' : Add *.txt filter & lastpath

Posted: Sun Jan 04, 2015 3:33 pm
by Magic
Of course! Thanks for that. :)

Re: GLSLShader 'Select A File' : Add *.txt filter & lastpath

Posted: Wed Jan 07, 2015 11:32 pm
by Sadler
All my gl shader files have a .glsl extension!

Re: GLSLShader 'Select A File' : Add *.txt filter & lastpath

Posted: Thu Jan 08, 2015 12:52 am
by Magic
No problem, I'll add that extension too. :)

Re: GLSLShader 'Select A File' : Add *.txt filter & lastpath

Posted: Thu Jan 08, 2015 1:14 am
by Terry Payman
If the default filter is "*.*" no-one will have extra clicks unless they want/need to filter. Would be fine by me.
Otherwise perhaps add a configuration option for an arbitary default filter or a "LastFilter" memory.

Re: GLSLShader 'Select A File' : Add *.txt filter & lastpath

Posted: Tue Jan 13, 2015 6:25 pm
by Magic
2) Remember "lastpath" for the selected file.
It's a hassle having to repeatedly enter a path that differs from the (install?) default. Copy/paste of a module that "knows" the path is an inelegant workaround.
Hmm. I definitely see how this is an issue. I'm trying to think of a way around it, but the problem is that if a file is already being used in a module, the chooser path is always the path of the file.

For the GLSLShader module, it's important that the default file be loaded when the module is created.

Any thoughts on how to improve this?

Re: GLSLShader 'Select A File' : Add *.txt filter & lastpath

Posted: Tue Jan 13, 2015 7:59 pm
by Terry Payman
Is it sufficient to look at whether the chooser/path has been triggered by the MouseUp event on the GLSLShader's file box?

- or perhaps just "push" a path to the default file when the module is created by Add>Special>GLSLShader, and "pop" back to the user's lastpath afterwards?

Re: GLSLShader 'Select A File' : Add *.txt filter & lastpath

Posted: Wed Jan 14, 2015 5:46 pm
by Magic
If "file.ext" is the module's current file, no matter what module it is, it will be the default selection when the file chooser is opened.

The behavior you're looking for would be what happens if no file is selected when the module is created. That's how it works for Video, Image, Model, etc. So I guess I could add an option somewhere to not load files in any modules by default?

EDIT: I tried that and it worked perfectly. So it'll be in the next version :)

Re: GLSLShader 'Select A File' : Add *.txt filter & lastpath

Posted: Fri Jan 16, 2015 1:54 pm
by Terry Payman
:D Sounds perfect, if I have understood correctly. I look forward to trying it!
Many thanks Eric! :D