Setting system preference texture paths

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.

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

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.

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

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!

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() 🙂

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

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!