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:
-rw-r--r--build_files/scons/tools/btools.py5
-rw-r--r--release/scripts/startup/bl_operators/wm.py8
-rw-r--r--release/windows/installer/00.sconsblender.nsi81
-rw-r--r--source/blender/blenlib/BLI_path_util.h5
-rw-r--r--source/blender/blenlib/intern/path_util.c76
-rw-r--r--source/blender/editors/space_file/space_file.c2
-rw-r--r--source/blender/python/intern/bpy.c2
-rw-r--r--source/blender/python/intern/bpy_interface.c2
-rw-r--r--source/blender/windowmanager/intern/wm_files.c2
-rw-r--r--source/creator/creator.c2
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.cpp2
11 files changed, 88 insertions, 99 deletions
diff --git a/build_files/scons/tools/btools.py b/build_files/scons/tools/btools.py
index fe6b092598c..accdde0d2cf 100644
--- a/build_files/scons/tools/btools.py
+++ b/build_files/scons/tools/btools.py
@@ -615,10 +615,7 @@ def NSIS_Installer(target=None, source=None, env=None):
else:
if len(df)>0:
dp_tmp = dp[l:]
- if dp_tmp.find('python\\lib') > -1:
- datafiles += "\n" +r'SetOutPath $INSTDIR'+dp[l:]+"\n\n"
- else:
- datafiles += "\n"+r'SetOutPath $BLENDERHOME'+dp[l:]+"\n\n"
+ datafiles += "\n" +r'SetOutPath $INSTDIR'+dp[l:]+"\n\n"
for f in df:
outfile = os.path.join(dp,f)
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py
index 53c8d562297..3f4a061c4ac 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -940,6 +940,14 @@ class WM_OT_copy_prev_settings(bpy.types.Operator):
self.report({'ERROR'}, "Source path %r exists" % path_src)
else:
shutil.copytree(path_src, path_dst)
+
+ # in 2.57 and earlier windows installers, system scripts were copied
+ # into the configuration directory, don't want to copy those
+ system_script = os.path.join(path_dst, 'scripts/modules/bpy_types.py')
+ if os.path.isfile(system_script):
+ shutil.rmtree(os.path.join(path_dst, 'scripts'))
+ shutil.rmtree(os.path.join(path_dst, 'plugins'))
+
# dont loose users work if they open the splash later.
if bpy.data.is_saved is bpy.data.is_dirty is False:
bpy.ops.wm.read_homefile()
diff --git a/release/windows/installer/00.sconsblender.nsi b/release/windows/installer/00.sconsblender.nsi
index 03f62f0df48..42a9b1c13b6 100644
--- a/release/windows/installer/00.sconsblender.nsi
+++ b/release/windows/installer/00.sconsblender.nsi
@@ -33,11 +33,11 @@ RequestExecutionLevel admin
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
-Page custom DataLocation DataLocationOnLeave
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_WELCOME
+UninstPage custom un.OptionalRemoveConfig un.OptionalRemoveConfigOnLeave
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
@@ -62,7 +62,6 @@ UninstallIcon "[RELDIR]\00.installer.ico"
LangString DESC_StartMenu ${LANG_ENGLISH} "Add shortcut items to the Start Menu. (Recommended)"
LangString DESC_DesktopShortcut ${LANG_ENGLISH} "Add a shortcut to Blender on your desktop."
LangString DESC_BlendRegister ${LANG_ENGLISH} "Blender can register itself with .blend files to allow double-clicking from Windows Explorer, etc."
- LangString TEXT_IO_TITLE ${LANG_ENGLISH} "Specify User Data Location"
;--------------------------------
;Data
@@ -76,15 +75,15 @@ DirText "Use the field below to specify the folder where you want Blender to be
SilentUnInstall normal
-Var BLENDERHOME
Var SHORTVERSION ; This is blender_version_decimal() from path_util.c
+Var BLENDERCONFIG
+Var REMOVECONFIG
; Custom controls
Var HWND
-Var HWND_APPDATA
-Var HWND_INSTDIR
-Var HWND_HOMEDIR
+Var HWND_KEEPCONFIG
+Var HWND_REMOVECONFIG
Function .onInit
ClearErrors
@@ -103,9 +102,12 @@ Function .onInit
FunctionEnd
Function un.onInit
+ SetShellVarContext current
+ StrCpy $BLENDERCONFIG "$APPDATA\Blender Foundation\Blender"
+ SetShellVarContext all
FunctionEnd
-Function DataLocation
+Function un.OptionalRemoveConfig
nsDialogs::Create /NOUNLOAD 1018
Pop $HWND
@@ -113,45 +115,27 @@ Function DataLocation
Abort
${EndIf}
- ${NSD_CreateLabel} 0 0 100% 24u "Please specify where you wish to install Blender's user data files. Be aware that if you choose to use your Application Data directory, your preferences and scripts will only be accessible by the current user account."
- ${NSD_CreateRadioButton} 0 50 100% 12u "Use Application Data directory (recommended)"
- Pop $HWND_APPDATA
- ${NSD_CreateRadioButton} 0 80 100% 12u "Use installation directory"
- Pop $HWND_INSTDIR
- ${NSD_CreateRadioButton} 0 110 100% 12u "I have defined a %HOME% variable, please install files there"
- Pop $HWND_HOMEDIR
-
- ${If} ${AtMostWinME}
- GetDlgItem $0 $HWND $HWND_APPDATA
- EnableWindow $0 0
- SendMessage $HWND_INSTDIR ${BM_SETCHECK} 1 0
- ${Else}
- SendMessage $HWND_APPDATA ${BM_SETCHECK} 1 0
- ${EndIf}
+ ${NSD_CreateRadioButton} 0 50 100% 12u "Keep configuration files, autosaved .blend files and installed addons (recommended)"
+ Pop $HWND_KEEPCONFIG
+ ${NSD_CreateRadioButton} 0 80 100% 12u "Remove all files, including configuration files, autosaved .blend files and installed addons"
+ Pop $HWND_REMOVECONFIG
+
+ SendMessage $HWND_KEEPCONFIG ${BM_SETCHECK} 1 0
nsDialogs::Show
FunctionEnd
-Function DataLocationOnLeave
- ${NSD_GetState} $HWND_APPDATA $R0
+Function un.OptionalRemoveConfigOnLeave
+ ${NSD_GetState} $HWND_REMOVECONFIG $R0
${If} $R0 == "1"
- SetShellVarContext current
- StrCpy $BLENDERHOME "$APPDATA\Blender Foundation\Blender"
- SetShellVarContext all
+ StrCpy $REMOVECONFIG "1"
${Else}
- ${NSD_GetState} $HWND_INSTDIR $R0
- ${If} $R0 == "1"
- StrCpy $BLENDERHOME $INSTDIR
- ${Else}
- ${NSD_GetState} $HWND_HOMEDIR $R0
- ${If} $R0 == "1"
- ReadEnvStr $BLENDERHOME "HOME"
- ${EndIf}
- ${EndIf}
+ StrCpy $REMOVECONFIG "0"
${EndIf}
FunctionEnd
+
Section "Blender [VERSION] (required)" InstallFiles
SectionIn RO
@@ -160,7 +144,7 @@ Section "Blender [VERSION] (required)" InstallFiles
; The contents of Blender installation root dir
[ROOTDIRCONTS]
- ; All datafiles (python, scripts, config)
+ ; All datafiles (python, scripts, datafiles)
[DODATAFILES]
SetOutPath $INSTDIR
@@ -169,7 +153,6 @@ Section "Blender [VERSION] (required)" InstallFiles
${EndIf}
; Write the installation path into the registry
WriteRegStr HKLM "SOFTWARE\BlenderFoundation" "Install_Dir" "$INSTDIR"
- WriteRegStr HKLM "SOFTWARE\BlenderFoundation" "ConfigData_Dir" "$BLENDERHOME"
WriteRegStr HKLM "SOFTWARE\BlenderFoundation" "ShortVersion" "[SHORTVERSION]"
; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "DisplayName" "Blender"
@@ -204,7 +187,7 @@ Section "Open .blend files with Blender" BlendRegister
ExecWait '"$INSTDIR\blender.exe" -r'
SectionEnd
-UninstallText "This will uninstall Blender [VERSION], and all installed files. Before continuing make sure you have created backup of all the files you may want to keep: startup.blend, bookmarks.txt, recent-files.txt. Hit 'Uninstall' to continue."
+UninstallText "This will uninstall Blender [VERSION], and all installed files. Hit 'Uninstall' to continue."
Section "Uninstall"
; Remove registry keys
@@ -212,7 +195,6 @@ Section "Uninstall"
SetRegView 64
${EndIf}
- ReadRegStr $BLENDERHOME HKLM "SOFTWARE\BlenderFoundation" "ConfigData_Dir"
ReadRegStr $SHORTVERSION HKLM "SOFTWARE\BlenderFoundation" "ShortVersion"
DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Blender"
DeleteRegKey HKLM "SOFTWARE\BlenderFoundation"
@@ -226,21 +208,10 @@ Section "Uninstall"
Delete "$INSTDIR\uninstall.exe"
- MessageBox MB_YESNO "Recursively erase contents of $BLENDERHOME\$SHORTVERSION\scripts? NOTE: This includes all installed scripts and *any* file and directory you have manually created, installed later or copied. This also including .blend files." IDNO NextNoScriptRemove
- RMDir /r "$BLENDERHOME\$SHORTVERSION\scripts"
-NextNoScriptRemove:
- MessageBox MB_YESNO "Recursively erase contents from $BLENDERHOME\$SHORTVERSION\config? NOTE: This includes your startup.blend, bookmarks and any other file and directory you may have created in that directory" IDNO NextNoConfigRemove
- RMDir /r "$BLENDERHOME\$SHORTVERSION\config"
-NextNoConfigRemove:
- MessageBox MB_YESNO "Recursively erase contents from $BLENDERHOME\$SHORTVERSION\plugins? NOTE: This includes files and subdirectories in this directory" IDNO NextNoPluginRemove
- RMDir /r "$BLENDERHOME\$SHORTVERSION\plugins"
-NextNoPluginRemove:
- ; Try to remove dirs, but leave them if they contain anything
- RMDir "$BLENDERHOME\$SHORTVERSION\plugins"
- RMDir "$BLENDERHOME\$SHORTVERSION\config"
- RMDir "$BLENDERHOME\$SHORTVERSION\scripts"
- RMDir "$BLENDERHOME\$SHORTVERSION"
- RMDir "$BLENDERHOME"
+ ${If} $REMOVECONFIG == "1"
+ RMDir /r "$BLENDERCONFIG\$SHORTVERSION"
+ ${Endif}
+
; Remove shortcuts
Delete "$SMPROGRAMS\Blender Foundation\Blender\*.*"
Delete "$DESKTOP\Blender.lnk"
diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h
index 360cd1ea9ab..81fc8a50db6 100644
--- a/source/blender/blenlib/BLI_path_util.h
+++ b/source/blender/blenlib/BLI_path_util.h
@@ -50,11 +50,7 @@ char *BLI_get_folder_version(const int id, const int ver, const int do_check);
/* folder_id */
/* general, will find based on user/local/system priority */
-#define BLENDER_CONFIG 1
#define BLENDER_DATAFILES 2
-#define BLENDER_SCRIPTS 3
-#define BLENDER_PLUGINS 4
-#define BLENDER_PYTHON 5
/* user-specific */
#define BLENDER_USER_CONFIG 31
@@ -64,7 +60,6 @@ char *BLI_get_folder_version(const int id, const int ver, const int do_check);
#define BLENDER_USER_AUTOSAVE 35
/* system */
-#define BLENDER_SYSTEM_CONFIG 51 /* optional */
#define BLENDER_SYSTEM_DATAFILES 52
#define BLENDER_SYSTEM_SCRIPTS 53
#define BLENDER_SYSTEM_PLUGINS 54
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index 47e50e375f0..5056961c8d6 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -902,10 +902,23 @@ static int get_path_local(char *targetpath, const char *folder_name, const char
return 0;
}
+static int is_portable_install(void)
+{
+ /* detect portable install by the existance of config folder */
+ const int ver= BLENDER_VERSION;
+ char path[FILE_MAX];
+
+ return get_path_local(path, "config", NULL, ver);
+}
+
static int get_path_user(char *targetpath, const char *folder_name, const char *subfolder_name, const char *envvar, const int ver)
{
char user_path[FILE_MAX];
const char *user_base_path;
+
+ /* for portable install, user path is always local */
+ if (is_portable_install())
+ return get_path_local(targetpath, folder_name, subfolder_name, ver);
user_path[0] = '\0';
@@ -1011,6 +1024,26 @@ static int get_path_system(char *targetpath, const char *folder_name, const char
}
}
+#if defined(WIN32) && BLENDER_VERSION < 258
+
+static int path_have_257_script_install(void)
+{
+ const int ver= BLENDER_VERSION;
+ char path[FILE_MAX] = "";
+ char system_pyfile[FILE_MAX];
+
+ if (get_path_user(path, "scripts", NULL, "BLENDER_USER_SCRIPTS", ver)) {
+ BLI_join_dirfile(system_pyfile, sizeof(system_pyfile), path, "modules/bpy_types.py");
+
+ if (BLI_exists(system_pyfile))
+ return 1;
+ }
+
+ return 0;
+}
+
+#endif
+
/* get a folder out of the 'folder_id' presets for paths */
/* returns the path if found, NULL string if not */
char *BLI_get_folder(int folder_id, const char *subfolder)
@@ -1020,13 +1053,12 @@ char *BLI_get_folder(int folder_id, const char *subfolder)
switch (folder_id) {
case BLENDER_DATAFILES: /* general case */
- if (get_path_local(path, "datafiles", subfolder, ver)) break;
if (get_path_user(path, "datafiles", subfolder, "BLENDER_USER_DATAFILES", ver)) break;
+ if (get_path_local(path, "datafiles", subfolder, ver)) break;
if (get_path_system(path, "datafiles", subfolder, "BLENDER_SYSTEM_DATAFILES", ver)) break;
return NULL;
case BLENDER_USER_DATAFILES:
- if (get_path_local(path, "datafiles", subfolder, ver)) break;
if (get_path_user(path, "datafiles", subfolder, "BLENDER_USER_DATAFILES", ver)) break;
return NULL;
@@ -1036,35 +1068,28 @@ char *BLI_get_folder(int folder_id, const char *subfolder)
return NULL;
case BLENDER_USER_AUTOSAVE:
- if (get_path_local(path, "autosave", subfolder, ver)) break;
if (get_path_user(path, "autosave", subfolder, "BLENDER_USER_DATAFILES", ver)) break;
return NULL;
- case BLENDER_CONFIG: /* general case */
- if (get_path_local(path, "config", subfolder, ver)) break;
- if (get_path_user(path, "config", subfolder, "BLENDER_USER_CONFIG", ver)) break;
- if (get_path_system(path, "config", subfolder, "BLENDER_SYSTEM_CONFIG", ver)) break;
- return NULL;
-
case BLENDER_USER_CONFIG:
- if (get_path_local(path, "config", subfolder, ver)) break;
if (get_path_user(path, "config", subfolder, "BLENDER_USER_CONFIG", ver)) break;
return NULL;
- case BLENDER_SYSTEM_CONFIG:
- if (get_path_local(path, "config", subfolder, ver)) break;
- if (get_path_system(path, "config", subfolder, "BLENDER_SYSTEM_CONFIG", ver)) break;
- return NULL;
-
- case BLENDER_SCRIPTS: /* general case */
- if (get_path_local(path, "scripts", subfolder, ver)) break;
- if (get_path_user(path, "scripts", subfolder, "BLENDER_USER_SCRIPTS", ver)) break;
- if (get_path_system(path, "scripts", subfolder, "BLENDER_SYSTEM_SCRIPTS", ver)) break;
- return NULL;
-
case BLENDER_USER_SCRIPTS:
- if (get_path_local(path, "scripts", subfolder, ver)) break;
- if (get_path_user(path, "scripts", subfolder, "BLENDER_USER_SCRIPTS", ver)) break;
+#if defined(WIN32) && BLENDER_VERSION < 258
+ /* if we have a 2.57 installation, then we may have system script
+ * files in the user configuration folder. avoid using that folder
+ * if they are there, until the version gets bumped to 2.58, so
+ * we can be sure that folder only has addons etc. */
+ if (path_have_257_script_install()) {
+ if (get_path_local(path, "scripts", subfolder, ver)) break;
+ }
+ else
+#endif
+ {
+ if (get_path_user(path, "scripts", subfolder, "BLENDER_USER_SCRIPTS", ver)) break;
+ }
+
return NULL;
case BLENDER_SYSTEM_SCRIPTS:
@@ -1072,11 +1097,6 @@ char *BLI_get_folder(int folder_id, const char *subfolder)
if (get_path_system(path, "scripts", subfolder, "BLENDER_SYSTEM_SCRIPTS", ver)) break;
return NULL;
- case BLENDER_PYTHON: /* general case */
- if (get_path_local(path, "python", subfolder, ver)) break;
- if (get_path_system(path, "python", subfolder, "BLENDER_SYSTEM_PYTHON", ver)) break;
- return NULL;
-
case BLENDER_SYSTEM_PYTHON:
if (get_path_local(path, "python", subfolder, ver)) break;
if (get_path_system(path, "python", subfolder, "BLENDER_SYSTEM_PYTHON", ver)) break;
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index ec0d9806bca..18270bfaa26 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -606,7 +606,7 @@ void ED_spacetype_file(void)
void ED_file_init(void)
{
- char *cfgdir = BLI_get_folder(BLENDER_CONFIG, NULL);
+ char *cfgdir = BLI_get_folder(BLENDER_USER_CONFIG, NULL);
fsmenu_read_system(fsmenu_get());
diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c
index afafc9b4534..450151ee870 100644
--- a/source/blender/python/intern/bpy.c
+++ b/source/blender/python/intern/bpy.c
@@ -239,7 +239,7 @@ void BPy_init_modules( void )
PyObject *mod;
/* Needs to be first since this dir is needed for future modules */
- char *modpath= BLI_get_folder(BLENDER_SCRIPTS, "modules");
+ char *modpath= BLI_get_folder(BLENDER_SYSTEM_SCRIPTS, "modules");
if(modpath) {
// printf("bpy: found module path '%s'.\n", modpath);
PyObject *sys_path= PySys_GetObject("path"); /* borrow */
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index acd23887af0..e6f4c5713a1 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -197,7 +197,7 @@ void BPY_python_start(int argc, const char **argv)
PyImport_ExtendInittab(bpy_internal_modules);
/* allow to use our own included python */
- PyC_SetHomePath(BLI_get_folder(BLENDER_PYTHON, NULL));
+ PyC_SetHomePath(BLI_get_folder(BLENDER_SYSTEM_PYTHON, NULL));
/* Python 3.2 now looks for '2.57/python/include/python3.2d/pyconfig.h' to parse
* from the 'sysconfig' module which is used by 'site', so for now disable site.
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index ea77fca4712..1f005ba6021 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -544,7 +544,7 @@ void WM_read_history(void)
struct RecentFile *recent;
char *line;
int num;
- char *cfgdir = BLI_get_folder(BLENDER_CONFIG, NULL);
+ char *cfgdir = BLI_get_folder(BLENDER_USER_CONFIG, NULL);
if (!cfgdir) return;
diff --git a/source/creator/creator.c b/source/creator/creator.c
index 0c29c807554..016c461600c 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -314,7 +314,6 @@ static int print_help(int UNUSED(argc), const char **UNUSED(argv), void *data)
printf ("\nEnvironment Variables:\n");
printf (" $BLENDER_USER_CONFIG Directory for user configuration files.\n");
- printf (" $BLENDER_SYSTEM_CONFIG Directory for system wide configuration files.\n");
printf (" $BLENDER_USER_SCRIPTS Directory for user scripts.\n");
printf (" $BLENDER_SYSTEM_SCRIPTS Directory for system wide scripts.\n");
printf (" $BLENDER_USER_DATAFILES Directory for user data files (icons, translations, ..).\n");
@@ -1087,7 +1086,6 @@ static void setupArguments(bContext *C, bArgs *ba, SYS_SystemHandle *syshandle)
BLI_argsAdd(ba, 1, NULL, "--factory-startup", "\n\tSkip reading the "STRINGIFY(BLENDER_STARTUP_FILE)" in the users home directory", set_factory_startup, NULL);
/* TODO, add user env vars? */
- BLI_argsAdd(ba, 1, NULL, "--env-system-config", "\n\tSet the "STRINGIFY_ARG(BLENDER_SYSTEM_CONFIG)" environment variable", set_env, NULL);
BLI_argsAdd(ba, 1, NULL, "--env-system-datafiles", "\n\tSet the "STRINGIFY_ARG(BLENDER_SYSTEM_DATAFILES)" environment variable", set_env, NULL);
BLI_argsAdd(ba, 1, NULL, "--env-system-scripts", "\n\tSet the "STRINGIFY_ARG(BLENDER_SYSTEM_SCRIPTS)" environment variable", set_env, NULL);
BLI_argsAdd(ba, 1, NULL, "--env-system-plugins", "\n\tSet the "STRINGIFY_ARG(BLENDER_SYSTEM_PLUGINS)" environment variable", set_env, NULL);
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index a3738995db3..c8a6ae5a6d0 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -1781,7 +1781,7 @@ PyObject* initGamePlayerPythonScripting(const STR_String& progname, TPythonSecur
PyImport_ExtendInittab(bge_internal_modules);
/* find local python installation */
- PyC_SetHomePath(BLI_get_folder(BLENDER_PYTHON, NULL));
+ PyC_SetHomePath(BLI_get_folder(BLENDER_SYSTEM_PYTHON, NULL));
Py_Initialize();