Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    Select Direktory/folder

    Scheduled Pinned Locked Moved PYTHON Development
    6 Posts 0 Posters 552 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        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).

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            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:)

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              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.

              1 Reply Last reply Reply Quote 0
              • H Offline
                Helper
                last edited by

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

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

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post