pencil2d / pencil

Pencil2D is an easy, intuitive tool to make 2D hand-drawn animations. Pencil2D is open source and cross-platform.
http://pencil2d.org
GNU General Public License v2.0
1.47k stars 273 forks source link

Change default animation export path to same directory as project file #1656

Closed hellocatfood closed 2 years ago

hellocatfood commented 3 years ago

Issue Summary

Following up on a discord conversation, https://discord.com/channels/342369662710972417/402984217702563871/869180648106110976 when exporting an animation the export path appears to be set to one of two options: * the home directory if a document hasn't been saved/exported previous * the path of the most recently exported animation I feel that this is confusing as if I'm starting a new project I wouldn't want to export it to the location of an old project. ### Actual Results The default export path of an animation is set to either the home directory or the last saved project ### Expected Results Can the default export path be set to the path of the project file itself? Assuming, of course, that the pencil2d project has been saved. In the case that is hasn't it should default to the user's home director. ### System Information + Pencil2D Version: Development Build Jul 21 2021 CPU Architecture: x86_64 Qt Version: 5.15.2 + Operating System: Operating System: Ubuntu 21.04 + RAM Size: 16GB
Jose-Moreno commented 3 years ago

@hellocatfood Hey. Thank you for submitting this request. I personally agree that it should be possible to modify the import/export dialogs file path without needing to use the browse button. Of course this brings a different slew of issues and considerations despite being such an apparently minimal change, but you'd be surprised at how easy it is to mess up a software by providing incorrect paths for different operations 😄

Regarding the project file suggestion part, it should be doable considering right now the export is using something similar to the last saved file path instead, and honestly this should also apply to the saved file itself.

Since I'm not sure about the particular set of tasks required to implement this, for now I'll add it to the enhancement priority list and we'll go from there once a dev is free to take a look.

donarturo11 commented 3 years ago

So about my submission. I found, that functions QString FileDialog::getLastSavePath(FileType fileType) and QString FileDialog::getLastOpenPath(FileType fileType) in file filedialog.cpp return default path if object setting will not find key Animation (always saved in settings after open or save), because it is searching key matching to fileformat given by argument of these functions. So I changed return, to behave always, like case, when fileType is always FileType::ANIMATION. To do is else importexportdialog.cpp, where necessary is write small code to define default file extension.

donarturo11 commented 2 years ago

Please check if I synced my fork correctly. It was my first contribution, so thank you for advises. Thank you for improve my first contribution – is cleaner than mine.