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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Setting system preference texture paths

    Scheduled Pinned Locked Moved PYTHON Development
    8 Posts 0 Posters 918 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 08/08/2016 at 14:03, xxxxxxxx wrote:

      Hello all, I have a script I am trying to make to set a specific texture path in the system preferences.  If you type in

      Files[c4d.PREF_TEXPATH_PATH1]="some/file/path"

      into the console it works no problem. The problem I am trying to figure out is how do you get this to work in a python Script Manager. I know somehow I need to get the Files BaseList2D I just am not sure how and can't seem to find any good documentation on this. If anyone knows I would be very appreciative. Thank you very much for all the help.

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

        On 08/08/2016 at 21:13, xxxxxxxx wrote:

        something like this

        import c4d
          
        def main() :
          
            FilesTool_ID=465001626
            FilesTool=c4d.plugins.FindPlugin(FilesTool_ID, c4d.PLUGINTYPE_PREFS)
            print "PATH1: ", FilesTool[c4d.PREF_TEXPATH_PATH1]
            FilesTool[c4d.PREF_TEXPATH_PATH2] = r"YOU\PATH"
            print "PATH2: ", FilesTool[c4d.PREF_TEXPATH_PATH2]
          
        if __name__=='__main__':
            main()
        
        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 09/08/2016 at 03:26, xxxxxxxx wrote:

          Hi,

          anion's answer is correct. It just misses a c4d.EventAdd() in the end to make the change show up immediately.

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

            On 09/08/2016 at 05:28, xxxxxxxx wrote:

            Originally posted by xxxxxxxx

            Hi,

            anion's answer is correct. It just misses a c4d.EventAdd() in the end to make the change show up immediately.

            Yes I know, thank you

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

              On 09/08/2016 at 12:26, xxxxxxxx wrote:

              Beautiful! Thank you guys so much for the help as always.  Is it possible to explain how you knew/found the Files plugin ID? And also how you knew it was a plugin? Just curious for my further understanding.  Thank you!

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

                On 11/08/2016 at 01:58, xxxxxxxx wrote:

                Hi Andrez,

                usually we suggest to look into the resource headers (located in your C4D install folder under resource/modules). But this won't work for preferences pages.
                In this case you can use something like this:

                plist = c4d.plugins.FilterPluginList(c4d.PLUGINTYPE_PREFS, True)
                for p in plist:
                    print p.GetName(), p.GetID()
                

                Instead of looking through the entire list manually, you could further refine this.
                By dragging a parameter from the Files page into the console command line, you get for example:

                Files[c4d.PREF_FILE_RECENT]
                

                If you now do a:

                Files.GetName()
                

                You'll get the name you are looking for in the above list (note that the name for Im-/Exporters differs slightly as either " Import" or " Export" is appended to the name).

                So, this was the generic answer...

                To demonstrate my blindness, this is what I should have answered in the first place (sorry!) :
                You can simply use GetGlobalTexturePath() and SetGlobalTexturePath() 🙂

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

                  On 14/08/2016 at 09:53, xxxxxxxx wrote:

                  Awesome thanks for the detailed response. I will certainly use that knowledge in the future even though there was an easier way the whole time hehe. !Smile[URL-REMOVED]


                  [URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.

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

                    On 21/08/2016 at 09:19, xxxxxxxx wrote:

                    Originally posted by xxxxxxxx

                    something like this

                    import c4d
                     
                    def main() :
                     
                        FilesTool_ID=465001626
                        FilesTool=c4d.plugins.FindPlugin(FilesTool_ID, c4d.PLUGINTYPE_PREFS)
                        print "PATH1: ", FilesTool[c4d.PREF_TEXPATH_PATH1]
                        FilesTool[c4d.PREF_TEXPATH_PATH2] = r"YOU\PATH"
                        print "PATH2: ", FilesTool[c4d.PREF_TEXPATH_PATH2]
                     
                    if __name__=='__main__':
                        main()
                    

                    This helped me solve the same problem I have with OP. Thanks Anion!

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