how to limit the type of files we can import?
-
hello,
I'm new here. I'm trying to create an import button to import only tiff files. but it still shows all types of files when the file browser gets opened. any help? Is there a thing to import multiple files?
c4d.storage.LoadDialog(c4d.FILESELECTTYPE_IMAGES, "Select Images", c4d.FILESELECT_LOAD, force_suffix=["tiff"])
-
Hello @sydney_ko!
Welcome to the Maxon developers forum and its community, it is great to have you with us!
Getting Started
Before creating your next postings, we would recommend making yourself accustomed with our forum and support procedures. You did not do anything wrong, we point all new users to these rules.
- Forum Overview: Provides a broad overview of the fundamental structure and rules of this forum, such as the purpose of the different sub-forums or the fact that we will ban users who engage in hate speech or harassment.
- Support Procedures: Provides a more in detail overview of how we provide technical support for APIs here. This topic will tell you how to ask good questions and limits of our technical support.
- Forum Features: Provides an overview of the technical features of this forum, such as Markdown markup or file uploads.
It is strongly recommended to read the first two topics carefully, especially the section Support Procedures: Asking Questions.
About your First Question
The documentation for the c4d.storage.LoadDialog() function explicitly tells that the force_suffix argument is not used, hence providing any value to it doesn't make any effect on the behviour of your selection dialog. The reason why it is still there is due to c4d.storage.LoadDialog() and c4d.storage.SaveDialog() both being based on the same FileSelect() function, that uses "force_suffix" argument only in FILESELECT::SAVE mode.
If you were on C++ plugin development side, you could easily make use of the FileSelectMultiple() function, which allows you to control files extension filters via "filterStrings" argument. However, this function is not exposed to our Python SDK, so the only way for you to make use of it is by switching to C++ development.
Cheers,
Ilia -
@i_mazlov Thanks for your response! I learnt a lot!