3
$\begingroup$

I would like to have two folders where i can put scripts and addons that will be loaded at start time with blender.

for example if its possible to add two paths to BLENDER_USER_SCRIPTS environment variable.

$\endgroup$
2
$\begingroup$

To use multiple directories on Windows, i edited the file 2.78\scripts\addon_utils.py and added my path in the function paths() beginning at line 48

def paths():
    # RELEASE SCRIPTS: official scripts distributed in Blender releases
    addon_paths = _bpy.utils.script_paths("addons")

    # CONTRIB SCRIPTS: good for testing but not official scripts yet
    # if folder addons_contrib/ exists, scripts in there will be loaded too
    addon_paths += _bpy.utils.script_paths("addons_contrib")

+   # ADDITIONAL SCRIPTS: for development 
+   addon_paths += [r"C:\Users\plu\Documents\Blender\pyScripts\dev\addons"]
    return addon_paths

I also edited the file 2.78\scripts\startup\bl_ui\space_userpref.py and modified the draw method of the USERPREF_PT_addons panel beginning at line 1243, so that the addons from the folder will show up under the User Filter

def draw(self, context):
    import os
    import addon_utils

    layout = self.layout

    userpref = context.user_preferences
    used_ext = {ext.module for ext in userpref.addons}

    userpref_addons_folder = os.path.join(userpref.filepaths.script_directory, "addons")
    scripts_addons_folder = bpy.utils.user_resource('SCRIPTS', "addons")
+   scripts_dev_folder = r"C:\Users\plu\Documents\Blender\pyScripts\dev\addons"

+   scripts_user_folders = userpref_addons_folder, scripts_addons_folder, scripts_dev_folder

        # check if addon should be visible with current filters
        if ((filter == "All") or
            (filter == info["category"]) or
            (filter == "Enabled" and is_enabled) or
            (filter == "Disabled" and not is_enabled) or
-           (filter == "User" and (mod.__file__.startswith((userpref_addons_folder, scripts_addons_folder))))
+           (filter == "User" and (mod.__file__.startswith(scripts_user_folders)))
            ):

On Linux i create symbolic links in the addons folder. It is explained in this video

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.