Solved Filename Gui how get empty folder path

Hi
I create a filename gui, when an empty folder is choosed, there is no file to choose from. What I want to get is the path of the empty folder. How to do it!

For example, the following figure,i want to get its path
未标题-1.png

Thanks for any help!

相信我,可以的!

Hello @chuanzhen,

Thank you for reaching out to us. While I understand your question, it is slightly ambiguous, as you do not tell us how and where this file name custom GUI is being created. It could be a dialog or a description, and you could use a resource file or the GeDialog methods to create it.

A FilenameCustomGui has multiple flags which change its behavior, one of which is FILENAME_DIRECTORY. The '...' button will then open a directory selection dialog instead of a file selection dialog. If you want some sort of conditional operation ("select files by default, but if a directory is empty, allow the selection of such directory"), this is unfortunately not possible. You can only select files or directories, not both based on a custom condition.

When you have defined your GUI in a resource file, you must add the DIRECTORY flag to the element, here is an example from a Team Render resource.

    LONG PREF_ASSETCHUNKSIZE { ANIM OFF; MIN 2; MAX 256;}
    SEPARATOR PREF_SEP_PATHS { }
    FILENAME PREF_SERVICEREPOSITORYPATH { DIRECTORY; }
  }
}

When you add the gadget manually in a CreateLayout, you must set the bool c4d.FILENAME_DIRECTORY to True in the customdata container passed to GeDialog.AddCustomGui.

Cheers,
Ferdinand

MAXON SDK Specialist
developers.maxon.net

Hello @chuanzhen,

Thank you for reaching out to us. While I understand your question, it is slightly ambiguous, as you do not tell us how and where this file name custom GUI is being created. It could be a dialog or a description, and you could use a resource file or the GeDialog methods to create it.

A FilenameCustomGui has multiple flags which change its behavior, one of which is FILENAME_DIRECTORY. The '...' button will then open a directory selection dialog instead of a file selection dialog. If you want some sort of conditional operation ("select files by default, but if a directory is empty, allow the selection of such directory"), this is unfortunately not possible. You can only select files or directories, not both based on a custom condition.

When you have defined your GUI in a resource file, you must add the DIRECTORY flag to the element, here is an example from a Team Render resource.

    LONG PREF_ASSETCHUNKSIZE { ANIM OFF; MIN 2; MAX 256;}
    SEPARATOR PREF_SEP_PATHS { }
    FILENAME PREF_SERVICEREPOSITORYPATH { DIRECTORY; }
  }
}

When you add the gadget manually in a CreateLayout, you must set the bool c4d.FILENAME_DIRECTORY to True in the customdata container passed to GeDialog.AddCustomGui.

Cheers,
Ferdinand

MAXON SDK Specialist
developers.maxon.net

@ferdinand Thanks.
I create Filename Gui in CreateLayout
it work,this is code:

 bc = c4d.BaseContainer()
 bc.SetBool(c4d.FILENAME_DIRECTORY,True)
 self.AddCustomGui(1012, c4d.CUSTOMGUI_FILENAME,"",c4d.BFH_SCALEFIT, 50, 20, bc)

相信我,可以的!