Select Direktory/folder

On 28/05/2013 at 03:24, xxxxxxxx wrote:

Cinema R13, Python.

Hi guys. Simple question. I have this line:
self.file = self.AddCustomGui(1000, c4d.CUSTOMGUI_FILENAME, "", c4d.BFH_SCALEFIT|c4d.BFV_SCALEFIT, 0, 0)

Any chance I can restrict selection only to directories or folders? I don't want users to select files, but rather directory, where those files are.

Thank you.

On 28/05/2013 at 06:06, xxxxxxxx wrote:

I have not used that custom gui yet, but there is c4d.storage.LoadDialog with the flag FILESELECT_DIRECTORY, which does bring up the os folder selection dialog. So you could 
build that what you want out of a button and another gadget to display the path(s).

On 28/05/2013 at 06:31, xxxxxxxx wrote:

Hi Tomas,

CUSTOMGUI_FILENAME has the option FILENAME_DIRECTORY that can be set to display it in directory chooser mode. The options or settings container is passed to AddCustomGui() as last parameter.

On 28/05/2013 at 07:32, xxxxxxxx wrote:

Yannick, any chance you can elaborate on that? I am not py4D guru, so don't really understand what you mean:) Any chance you can give an example on how to do that? Thank you:)

On 28/05/2013 at 23:30, xxxxxxxx wrote:

Hi Tomas,

Here's some code that can be put in the CreateLayout() method override:

settings = c4d.BaseContainer()
settings.SetBool(c4d.FILENAME_DIRECTORY, True)
        
self.customGui = self.AddCustomGui(1001, c4d.CUSTOMGUI_FILENAME, "", c4d.BFH_SCALEFIT|c4d.BFV_CENTER, 0, 0, settings)

If FILENAME_DIRECTORY is set, CUSTOMGUI_FILENAME button opens the directory chooser dialog instead of the file select.

On 30/05/2013 at 01:37, xxxxxxxx wrote:

Thanks Yannick, that did the trick.
Appreciate your help.