1
$\begingroup$

I want to set a temporary script path for an instance of blender that will bet set from a python script. That script will be launched with the execution of the blender exe.

It needs to be temporary as I do not want user to have access to certain tools when they are using the exe outside of the project's art pipeline.

I'm having trouble finding a way to set pref automatically using python. On top of that, having that setting being volatile during this instance only.

Any help is welcome! thank you!

$\endgroup$
  • $\begingroup$ Can you please elaborate what you mean by "script path"? Do you mean the script path in Preferences > File Paths > Scripts? $\endgroup$ – Robert Gützkow Dec 12 '19 at 21:43
  • $\begingroup$ yes the script path from the preferences. I need to set a temporary path where all our in house maintained script are stored and launched. I do not want to alter the artist's c:/ drive in any way a long as he does not launch the software from our launcher, that will launch along with a startup script that alters the paths for the working session only. if the software is launched regularly. that path will not be set. $\endgroup$ – Dominique Cote Dec 16 '19 at 14:11
  • $\begingroup$ Setting the script path is easy, making it temporary is difficult. There are no handlers for pre and post saving preferences and atexit is run after the preferences are saved. You can disable auto-saving of the preferences, however you can't re-enable them before closing, because that is the same problem as before. Perhaps the most sensible solution is through CLI options which provide custom user preferences. I'll have to look into that though. $\endgroup$ – Robert Gützkow Dec 16 '19 at 15:35
  • $\begingroup$ This could be accomplished through a script that sets a temporary environment variable for BLENDER_USER_CONFIG to load the user preferences from a different directory. The downside are that it affects the entirety of the user preferences. $\endgroup$ – Robert Gützkow Dec 16 '19 at 16:21
  • $\begingroup$ The real question is why the user shouldn't have access to these script outside of the pipeline. If this is an access control issue, then this should be solved in a different way, because the suggested approach doesn't protect against a user manually inserting the path or copying the files from that location. $\endgroup$ – Robert Gützkow Dec 16 '19 at 17:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.