Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Cosky <eric_cosky>2020-10-13 17:45:22 +0300
committerRay Molenkamp <github@lazydodo.com>2020-10-13 17:45:22 +0300
commitdd3b047f8b4d7aa2155fb9b3570f536240dbd06f (patch)
tree5224c4fc428a9efa172282aab92d8b3212e03eaa /build_files/cmake/platform/platform_win32.cmake
parent48b52e06b0bd75c0f143fb53d87e29ece81ec2d1 (diff)
Windows/CMake:Support BLENDER_USER_SCRIPTS in IDE
This diff adds support for respecting the `BLENDER_USER_SCRIPTS` environment variable when setting up the IDE environment. Previously the scripts from the users profile folder were always used even when this variable was set, leading to the possibility of the wrong scripts being visible in the IDE. Differential Revision: https://developer.blender.org/D9189 Reviewed By: Ray Molenkamp
Diffstat (limited to 'build_files/cmake/platform/platform_win32.cmake')
-rw-r--r--build_files/cmake/platform/platform_win32.cmake18
1 files changed, 14 insertions, 4 deletions
diff --git a/build_files/cmake/platform/platform_win32.cmake b/build_files/cmake/platform/platform_win32.cmake
index 2dd8d5f4600..e7474b0035d 100644
--- a/build_files/cmake/platform/platform_win32.cmake
+++ b/build_files/cmake/platform/platform_win32.cmake
@@ -720,14 +720,24 @@ if(WINDOWS_PYTHON_DEBUG)
string(REPLACE "/" "\\" _group_path "${_source_path}")
source_group("${_group_path}" FILES "${_source}")
endforeach()
- # Include the user scripts from the profile folder in the blender_python_user_scripts project.
- set(USER_SCRIPTS_ROOT "$ENV{appdata}/blender foundation/blender/${BLENDER_VERSION}")
+
+ # If the user scripts env var is set, include scripts from there otherwise
+ # include user scripts in the profile folder.
+ if(DEFINED ENV{BLENDER_USER_SCRIPTS})
+ message(STATUS "Including user scripts from environment BLENDER_USER_SCRIPTS=$ENV{BLENDER_USER_SCRIPTS}")
+ set(USER_SCRIPTS_ROOT "$ENV{BLENDER_USER_SCRIPTS}")
+ else()
+ message(STATUS "Including user scripts from the profile folder")
+ # Include the user scripts from the profile folder in the blender_python_user_scripts project.
+ set(USER_SCRIPTS_ROOT "$ENV{appdata}/blender foundation/blender/${BLENDER_VERSION}/scripts")
+ endif()
+
file(TO_CMAKE_PATH ${USER_SCRIPTS_ROOT} USER_SCRIPTS_ROOT)
- FILE(GLOB_RECURSE inFiles "${USER_SCRIPTS_ROOT}/scripts/*.*" )
+ FILE(GLOB_RECURSE inFiles "${USER_SCRIPTS_ROOT}/*.*" )
ADD_CUSTOM_TARGET(blender_python_user_scripts SOURCES ${inFiles})
foreach(_source IN ITEMS ${inFiles})
get_filename_component(_source_path "${_source}" PATH)
- string(REPLACE "${USER_SCRIPTS_ROOT}/scripts" "" _source_path "${_source_path}")
+ string(REPLACE "${USER_SCRIPTS_ROOT}" "" _source_path "${_source_path}")
string(REPLACE "/" "\\" _group_path "${_source_path}")
source_group("${_group_path}" FILES "${_source}")
endforeach()