4
; Blender Self-Installer for Windows (NSIS - http://nsis.sourceforge.net)
6
; Requires the MoreInfo plugin - http://nsis.sourceforge.net/MoreInfo_plug-in
11
!include "FileFunc.nsh"
12
!include "WordFunc.nsh"
13
!include "nsDialogs.nsh"
15
SetCompressor /SOLID lzma
17
Name "Blender [VERSION]"
19
!define MUI_ABORTWARNING
21
!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of Blender. It is recommended that you close all other applications before starting Setup."
22
!define MUI_WELCOMEFINISHPAGE_BITMAP "[RELDIR]\01.installer.bmp"
23
!define MUI_HEADERIMAGE
24
!define MUI_HEADERIMAGE_BITMAP "[RELDIR]\00.header.bmp"
25
!define MUI_COMPONENTSPAGE_SMALLDESC
26
!define MUI_FINISHPAGE_RUN "$INSTDIR\blender.exe"
27
!define MUI_CHECKBITMAP "[RELDIR]\00.checked.bmp"
28
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "[RELDIR]\01.installer.bmp"
30
!insertmacro MUI_PAGE_WELCOME
31
!insertmacro MUI_PAGE_LICENSE "[DISTDIR]\Copyright.txt"
32
!insertmacro MUI_PAGE_COMPONENTS
34
!insertmacro MUI_PAGE_DIRECTORY
35
Page custom DataLocation DataLocationOnLeave
36
!insertmacro MUI_PAGE_INSTFILES
37
!insertmacro MUI_PAGE_FINISH
39
!insertmacro MUI_UNPAGE_WELCOME
40
!insertmacro MUI_UNPAGE_CONFIRM
41
!insertmacro MUI_UNPAGE_INSTFILES
42
!insertmacro MUI_UNPAGE_FINISH
45
!insertmacro VersionCompare
48
Icon "[RELDIR]\00.installer.ico"
49
UninstallIcon "[RELDIR]\00.installer.ico"
51
;--------------------------------
54
!insertmacro MUI_LANGUAGE "English"
56
;--------------------------------
60
LangString DESC_SecCopyUI ${LANG_ENGLISH} "Copy all required files to the application folder."
61
LangString DESC_Section2 ${LANG_ENGLISH} "Add shortcut items to the Start Menu. (Recommended)"
62
LangString DESC_Section3 ${LANG_ENGLISH} "Add a shortcut to Blender on your desktop."
63
LangString DESC_Section4 ${LANG_ENGLISH} "Blender can register itself with .blend files to allow double-clicking from Windows Explorer, etc."
64
LangString TEXT_IO_TITLE ${LANG_ENGLISH} "Specify User Data Location"
65
;--------------------------------
68
Caption "Blender [VERSION] Installer"
69
OutFile "[DISTDIR]\..\blender-[VERSION]-windows[BITNESS].exe"
70
InstallDir "$PROGRAMFILES[BITNESS]\Blender Foundation\Blender"
72
BrandingText "Blender Foundation | http://www.blender.org"
73
ComponentText "This will install Blender [VERSION] on your computer."
75
DirText "Use the field below to specify the folder where you want Blender to be copied to. To specify a different folder, type a new name or use the Browse button to select an existing folder."
77
SilentUnInstall normal
80
Var SHORTVERSION ; This is blender_version_decimal() from path_util.c
91
StrCpy $SHORTVERSION "[SHORTVERSION]"
95
nsDialogs::Create /NOUNLOAD 1018
102
${NSD_CreateLabel} 0 0 100% 12u "Please specify where you wish to install Blender's user data files."
103
${NSD_CreateRadioButton} 0 20 100% 12u "Use the Application Data directory (Requires Windows 2000 or better)"
105
${NSD_CreateRadioButton} 0 50 100% 12u "Use the installation directory (ie. location chosen to install blender.exe)."
107
${NSD_CreateRadioButton} 0 80 100% 12u "I have defined a %HOME% variable, please install files here."
111
GetDlgItem $0 $HWND $HWND_APPDATA
113
SendMessage $HWND_INSTDIR ${BM_SETCHECK} 1 0
115
SendMessage $HWND_APPDATA ${BM_SETCHECK} 1 0
122
Function DataLocationOnLeave
123
${NSD_GetState} $HWND_APPDATA $R0
125
StrCpy $BLENDERHOME "$APPDATA\Blender Foundation\Blender"
127
${NSD_GetState} $HWND_INSTDIR $R0
129
StrCpy $BLENDERHOME $INSTDIR
131
${NSD_GetState} $HWND_HOMEDIR $R0
133
ReadEnvStr $BLENDERHOME "HOME"
139
Section "Blender-[VERSION] (required)" SecCopyUI
142
; Set output path to the installation directory.
144
; the contents of Blender installation root dir
147
; all datafiles (python, scripts, config)
151
; Write the installation path into the registry
152
WriteRegStr HKLM "SOFTWARE\BlenderFoundation" "Install_Dir" "$INSTDIR"
153
WriteRegStr HKLM "SOFTWARE\BlenderFoundation" "ConfigData_Dir" "$BLENDERHOME"
154
WriteRegStr HKLM "SOFTWARE\BlenderFoundation" "ShortVersion" "[SHORTVERSION]"
155
; Write the uninstall keys for Windows
156
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "DisplayName" "Blender (remove only)"
157
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "UninstallString" '"$INSTDIR\uninstall.exe"'
158
WriteUninstaller "uninstall.exe"
160
; Let's now run silent vcredist installer
166
Section "Add Start Menu shortcuts" Section2
167
SetShellVarContext all
168
CreateDirectory "$SMPROGRAMS\Blender Foundation\Blender\"
169
CreateShortCut "$SMPROGRAMS\Blender Foundation\Blender\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
170
CreateShortCut "$SMPROGRAMS\Blender Foundation\Blender\Blender.lnk" "$INSTDIR\Blender.exe" "" "$INSTDIR\blender.exe" 0
171
CreateShortCut "$SMPROGRAMS\Blender Foundation\Blender\Readme.lnk" "$INSTDIR\readme.html" "" "" 0
172
CreateShortCut "$SMPROGRAMS\Blender Foundation\Blender\Copyright.lnk" "$INSTDIR\Copyright.txt" "" "$INSTDIR\copyright.txt" 0
173
CreateShortCut "$SMPROGRAMS\Blender Foundation\Blender\GPL-license.lnk" "$INSTDIR\GPL-license.txt" "" "$INSTDIR\GPL-license.txt" 0
176
Section "Add Desktop Blender-[VERSION] shortcut" Section3
177
CreateShortCut "$DESKTOP\Blender.lnk" "$INSTDIR\blender.exe" "" "$INSTDIR\blender.exe" 0
180
Section "Open .blend files with Blender-[VERSION]" Section4
182
WriteRegStr HKCR ".blend" "" "blendfile"
183
WriteRegStr HKCR "blendfile" "" "Blender .blend File"
184
WriteRegStr HKCR "blendfile\shell" "" "open"
185
WriteRegStr HKCR "blendfile\DefaultIcon" "" $INSTDIR\blender.exe,1
186
WriteRegStr HKCR "blendfile\shell\open\command" "" \
187
'"$INSTDIR\blender.exe" "%1"'
191
UninstallText "This will uninstall Blender [VERSION], and all datafiles from the installation dir. Hit next to continue."
194
; remove registry keys
195
ReadRegStr $BLENDERHOME HKLM "SOFTWARE\BlenderFoundation" "ConfigData_Dir"
196
ReadRegStr $SHORTVERSION HKLM "SOFTWARE\BlenderFoundation" "ShortVersion"
197
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender"
198
DeleteRegKey HKLM "SOFTWARE\BlenderFoundation"
199
SetShellVarContext all
201
StrCpy $0 "$SMPROGRAMS\Blender Foundation\"
206
Delete "$INSTDIR\uninstall.exe"
208
MessageBox MB_YESNO "Erase $BLENDERHOME? This includes all installed scripts and configuration files and any file you may have created there." IDNO Next
209
RMDir /r "$BLENDERHOME"
211
; remove shortcuts, if any.
212
Delete "$DESKTOP\Blender.lnk"
213
; remove all link related directories and files
214
RMDir /r "$SMPROGRAMS\Blender Foundation\"
215
; remove entire installation directory, including any file created by the user
219
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
220
!insertmacro MUI_DESCRIPTION_TEXT ${SecCopyUI} $(DESC_SecCopyUI)
221
!insertmacro MUI_DESCRIPTION_TEXT ${Section2} $(DESC_Section2)
222
!insertmacro MUI_DESCRIPTION_TEXT ${Section3} $(DESC_Section3)
223
!insertmacro MUI_DESCRIPTION_TEXT ${Section4} $(DESC_Section4)
224
!insertmacro MUI_FUNCTION_DESCRIPTION_END
3
; Blender Self-Installer for Windows (NSIS - http://nsis.sourceforge.net)
6
SetCompressor /SOLID lzma
8
Name "Blender [VERSION]"
10
RequestExecutionLevel admin
14
!include "FileFunc.nsh"
15
!include "WordFunc.nsh"
16
!include "nsDialogs.nsh"
19
!define MUI_ABORTWARNING
21
!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of Blender. It is recommended that you close all other applications before starting Setup."
22
!define MUI_WELCOMEFINISHPAGE_BITMAP "[RELDIR]\01.installer.bmp"
23
!define MUI_HEADERIMAGE
24
!define MUI_HEADERIMAGE_BITMAP "[RELDIR]\00.header.bmp"
25
!define MUI_COMPONENTSPAGE_SMALLDESC
26
!define MUI_FINISHPAGE_RUN "$INSTDIR\blender.exe"
27
!define MUI_CHECKBITMAP "[RELDIR]\00.checked.bmp"
28
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "[RELDIR]\01.installer.bmp"
30
!insertmacro MUI_PAGE_WELCOME
31
!insertmacro MUI_PAGE_LICENSE "[DISTDIR]\Copyright.txt"
32
!insertmacro MUI_PAGE_COMPONENTS
34
!insertmacro MUI_PAGE_DIRECTORY
35
!insertmacro MUI_PAGE_INSTFILES
36
!insertmacro MUI_PAGE_FINISH
38
!insertmacro MUI_UNPAGE_WELCOME
39
UninstPage custom un.OptionalRemoveConfig un.OptionalRemoveConfigOnLeave
40
!insertmacro MUI_UNPAGE_CONFIRM
41
!insertmacro MUI_UNPAGE_INSTFILES
42
!insertmacro MUI_UNPAGE_FINISH
45
!insertmacro VersionCompare
48
Icon "[RELDIR]\00.installer.ico"
49
UninstallIcon "[RELDIR]\00.installer.ico"
51
;--------------------------------
54
!insertmacro MUI_LANGUAGE "English"
56
;--------------------------------
60
LangString DESC_InstallFiles ${LANG_ENGLISH} "Copy all required files to the application folder."
61
LangString DESC_StartMenu ${LANG_ENGLISH} "Add shortcut items to the Start Menu. (Recommended)"
62
LangString DESC_DesktopShortcut ${LANG_ENGLISH} "Add a shortcut to Blender on your desktop."
63
LangString DESC_BlendRegister ${LANG_ENGLISH} "Blender can register itself with .blend files to allow double-clicking from Windows Explorer, etc."
64
;--------------------------------
67
Caption "Blender [VERSION] Installer"
68
OutFile "[DISTDIR]\..\blender-[VERSION]-windows[BITNESS].exe"
69
InstallDir $INSTDIR ; $INSTDIR is set inside .onInit
70
BrandingText "Blender Foundation | http://www.blender.org"
71
ComponentText "This will install Blender [VERSION] on your computer."
73
DirText "Use the field below to specify the folder where you want Blender to be copied to. To specify a different folder, type a new name or use the Browse button to select an existing folder."
75
SilentUnInstall normal
77
Var SHORTVERSION ; This is blender_version_decimal() from path_util.c
89
StrCpy $SHORTVERSION "[SHORTVERSION]"
92
${If} "[BITNESS]" == "32"
93
StrCpy $INSTDIR "$PROGRAMFILES32\Blender Foundation\Blender" ; Can't use InstallDir inside Section
94
${ElseIf} "[BITNESS]" == "64"
95
StrCpy $INSTDIR "$PROGRAMFILES64\Blender Foundation\Blender"
98
StrCpy $INSTDIR "$PROGRAMFILES\Blender Foundation\Blender"
103
SetShellVarContext current
104
StrCpy $BLENDERCONFIG "$APPDATA\Blender Foundation\Blender"
105
SetShellVarContext all
108
Function un.OptionalRemoveConfig
109
nsDialogs::Create /NOUNLOAD 1018
116
${NSD_CreateRadioButton} 0 50 100% 12u "Keep configuration files, autosaved .blend files and installed addons (recommended)"
118
${NSD_CreateRadioButton} 0 80 100% 12u "Remove all files, including configuration files, autosaved .blend files and installed addons"
119
Pop $HWND_REMOVECONFIG
121
SendMessage $HWND_KEEPCONFIG ${BM_SETCHECK} 1 0
127
Function un.OptionalRemoveConfigOnLeave
128
${NSD_GetState} $HWND_REMOVECONFIG $R0
130
StrCpy $REMOVECONFIG "1"
132
StrCpy $REMOVECONFIG "0"
137
Section "Blender [VERSION] (required)" InstallFiles
140
; Set output path to the installation directory.
142
; The contents of Blender installation root dir
145
; All datafiles (python, scripts, datafiles)
152
; Write the installation path into the registry
153
WriteRegStr HKLM "SOFTWARE\BlenderFoundation" "Install_Dir" "$INSTDIR"
154
WriteRegStr HKLM "SOFTWARE\BlenderFoundation" "ShortVersion" "[SHORTVERSION]"
155
; Write the uninstall keys for Windows
156
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "DisplayName" "Blender"
157
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "Publisher" "Blender Foundation"
158
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "URLInfoAbout" "http://www.blender.org/"
159
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "DisplayVersion" "[VERSION]"
160
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "DisplayIcon" "$INSTDIR\blender.exe"
161
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "UninstallString" '"$INSTDIR\uninstall.exe"'
162
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "NoModify" 1
163
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "NoRepair " 1
164
WriteUninstaller "uninstall.exe"
168
Section "Add Start Menu Shortcuts" StartMenu
169
SetShellVarContext all
170
CreateDirectory "$SMPROGRAMS\Blender Foundation\Blender\"
171
CreateShortCut "$SMPROGRAMS\Blender Foundation\Blender\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
172
CreateShortCut "$SMPROGRAMS\Blender Foundation\Blender\Blender.lnk" "$INSTDIR\Blender.exe" "" "$INSTDIR\blender.exe" 0
173
CreateShortCut "$SMPROGRAMS\Blender Foundation\Blender\Readme.lnk" "$INSTDIR\readme.html" "" "" 0
174
CreateShortCut "$SMPROGRAMS\Blender Foundation\Blender\Copyright.lnk" "$INSTDIR\Copyright.txt" "" "$INSTDIR\copyright.txt" 0
175
CreateShortCut "$SMPROGRAMS\Blender Foundation\Blender\GPL-license.lnk" "$INSTDIR\GPL-license.txt" "" "$INSTDIR\GPL-license.txt" 0
176
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)' ; refresh icons
179
Section "Add Desktop Shortcut" DesktopShortcut
180
CreateShortCut "$DESKTOP\Blender.lnk" "$INSTDIR\blender.exe" "" "$INSTDIR\blender.exe" 0
181
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)' ; refresh icons
184
Section "Open .blend files with Blender" BlendRegister
185
ExecWait '"$INSTDIR\blender.exe" -r'
188
UninstallText "This will uninstall Blender [VERSION], and all installed files. Hit 'Uninstall' to continue."
191
; Remove registry keys
196
ReadRegStr $SHORTVERSION HKLM "SOFTWARE\BlenderFoundation" "ShortVersion"
197
DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Blender"
198
DeleteRegKey HKLM "SOFTWARE\BlenderFoundation"
199
DeleteRegKey HKCR ".blend"
200
DeleteRegKey HKCR "blendfile"
201
DeleteRegKey HKCR "CLSID\{D45F043D-F17F-4e8a-8435-70971D9FA46D}"
202
SetShellVarContext all
209
Delete "$INSTDIR\uninstall.exe"
211
${If} $REMOVECONFIG == "1"
212
RMDir /r "$BLENDERCONFIG\$SHORTVERSION"
215
; Remove install directory if it's empty
218
Delete "$SMPROGRAMS\Blender Foundation\Blender\*.*"
219
Delete "$DESKTOP\Blender.lnk"
220
; Remove all link related directories and files
221
RMDir "$SMPROGRAMS\Blender Foundation\Blender"
222
RMDir "$SMPROGRAMS\Blender Foundation"
224
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)' ; Refresh icons
227
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
228
!insertmacro MUI_DESCRIPTION_TEXT ${InstallFiles} $(DESC_InstallFiles)
229
!insertmacro MUI_DESCRIPTION_TEXT ${StartMenu} $(DESC_StartMenu)
230
!insertmacro MUI_DESCRIPTION_TEXT ${DesktopShortcut} $(DESC_DesktopShortcut)
231
!insertmacro MUI_DESCRIPTION_TEXT ${BlendRegister} $(DESC_BlendRegister)
232
!insertmacro MUI_FUNCTION_DESCRIPTION_END