forked from bartvdbraak/blender
Apply [#26044] Windows thumbnails and improved filetype registration
submitted by Tom Edwards Fix [#25473] 64bit Windows installer for version 2.56 is not working patch submitted by Caleb (Dobz) The thumbnail patch adds a thumb handler DLL that adds .blend thumbnail support in Windows Explorer. A -r option is added to do registration in background. The patch also improves icon building and metadata for blender.exe. Caleb fixes and cleans up our installer to an acceptable state. The patch uses the new -r option to do the .blend extension and thumbnailer registration. Thanks to both Caleb and Tom for their efforts!
This commit is contained in:
parent
74e044065b
commit
e4e78d4754
26
SConstruct
26
SConstruct
@ -153,13 +153,11 @@ if cc:
|
||||
if cxx:
|
||||
env['CXX'] = cxx
|
||||
|
||||
if env['CC'] in ['cl', 'cl.exe'] and sys.platform=='win32':
|
||||
if bitness == 64:
|
||||
platform = 'win64-vc'
|
||||
else:
|
||||
platform = 'win32-vc'
|
||||
elif env['CC'] in ['gcc'] and sys.platform=='win32':
|
||||
platform = 'win32-mingw'
|
||||
if sys.platform=='win32':
|
||||
if env['CC'] in ['cl', 'cl.exe']:
|
||||
platform = 'win64-vc' if bitness == 64 else 'win32-vc'
|
||||
elif env['CC'] in ['gcc']:
|
||||
platform = 'win32-mingw'
|
||||
|
||||
env.SConscriptChdir(0)
|
||||
|
||||
@ -197,6 +195,10 @@ else:
|
||||
opts = btools.read_opts(env, optfiles, B.arguments)
|
||||
opts.Update(env)
|
||||
|
||||
if sys.platform=='win32':
|
||||
if bitness==64:
|
||||
env.Append(CFLAGS=['-DWIN64']) # -DWIN32 needed too, as it's used all over to target Windows generally
|
||||
|
||||
if not env['BF_FANCY']:
|
||||
B.bc.disable()
|
||||
|
||||
@ -641,6 +643,16 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'):
|
||||
'${BF_FFMPEG_LIBPATH}/avdevice-52.dll',
|
||||
'${BF_FFMPEG_LIBPATH}/avutil-50.dll',
|
||||
'${BF_FFMPEG_LIBPATH}/swscale-0.dll']
|
||||
|
||||
# Since the thumb handler is loaded by Explorer, architecture is
|
||||
# strict: the x86 build fails on x64 Windows. We need to ship
|
||||
# both builds in x86 packages.
|
||||
if bitness == 32:
|
||||
dllsources.append('${LCGDIR}/thumbhandler/lib/BlendThumb.dll')
|
||||
dllsources.append('${LCGDIR}/thumbhandler/lib/BlendThumb64.dll')
|
||||
|
||||
dllsources.append('#source/icons/blender.exe.manifest')
|
||||
|
||||
windlls = env.Install(dir=env['BF_INSTALLDIR'], source = dllsources)
|
||||
allinstall += windlls
|
||||
|
||||
|
@ -6,19 +6,20 @@
|
||||
; Requires the MoreInfo plugin - http://nsis.sourceforge.net/MoreInfo_plug-in
|
||||
;
|
||||
|
||||
SetCompressor /SOLID lzma
|
||||
|
||||
Name "Blender [VERSION]"
|
||||
|
||||
!define MULTIUSER_EXECUTIONLEVEL Admin
|
||||
|
||||
!include "MUI.nsh"
|
||||
!include "WinVer.nsh"
|
||||
!include "FileFunc.nsh"
|
||||
!include "WordFunc.nsh"
|
||||
!include "nsDialogs.nsh"
|
||||
!include "MultiUser.nsh"
|
||||
!include "x64.nsh"
|
||||
|
||||
RequestExecutionLevel user
|
||||
|
||||
SetCompressor /SOLID lzma
|
||||
|
||||
Name "Blender [VERSION]"
|
||||
|
||||
!define MUI_ABORTWARNING
|
||||
|
||||
!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."
|
||||
@ -60,21 +61,17 @@ UninstallIcon "[RELDIR]\00.installer.ico"
|
||||
;Language Strings
|
||||
|
||||
;Description
|
||||
LangString DESC_SecCopyUI ${LANG_ENGLISH} "Copy all required files to the application folder."
|
||||
LangString DESC_Section2 ${LANG_ENGLISH} "Add shortcut items to the Start Menu. (Recommended)"
|
||||
LangString DESC_Section3 ${LANG_ENGLISH} "Add a shortcut to Blender on your desktop."
|
||||
LangString DESC_Section4 ${LANG_ENGLISH} "Blender can register itself with .blend files to allow double-clicking from Windows Explorer, etc."
|
||||
LangString DESC_InstallFiles ${LANG_ENGLISH} "Copy all required files to the application folder."
|
||||
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
|
||||
|
||||
Caption "Blender [VERSION] Installer"
|
||||
OutFile "[DISTDIR]\..\blender-[VERSION]-windows[BITNESS].exe"
|
||||
;InstallDir "$PROGRAMFILES[BITNESS]\Blender Foundation\Blender"
|
||||
; Install to user profile dir. While it is non-standard, it allows
|
||||
; users to install without having to have the installer run in elevated mode.
|
||||
InstallDir "$PROFILE\Blender Foundation\Blender"
|
||||
|
||||
InstallDir $INSTDIR ; $INSTDIR is set inside .onInit
|
||||
BrandingText "Blender Foundation | http://www.blender.org"
|
||||
ComponentText "This will install Blender [VERSION] on your computer."
|
||||
|
||||
@ -85,7 +82,7 @@ SilentUnInstall normal
|
||||
Var BLENDERHOME
|
||||
Var SHORTVERSION ; This is blender_version_decimal() from path_util.c
|
||||
|
||||
; custom controls
|
||||
; Custom controls
|
||||
Var HWND
|
||||
|
||||
Var HWND_APPDATA
|
||||
@ -94,7 +91,23 @@ Var HWND_HOMEDIR
|
||||
|
||||
Function .onInit
|
||||
ClearErrors
|
||||
!insertmacro MULTIUSER_INIT ; Checks if user has admin rights
|
||||
StrCpy $SHORTVERSION "[SHORTVERSION]"
|
||||
|
||||
${If} ${RunningX64}
|
||||
${If} "[BITNESS]" == "32"
|
||||
${OrIf} "[BITNESS]" == "-mingw"
|
||||
StrCpy $INSTDIR "$PROGRAMFILES32\Blender Foundation\Blender" ; Can't use InstallDir inside Section
|
||||
${ElseIf} "[BITNESS]" == "64"
|
||||
StrCpy $INSTDIR "$PROGRAMFILES64\Blender Foundation\Blender"
|
||||
${EndIf}
|
||||
${Else}
|
||||
StrCpy $INSTDIR "$PROGRAMFILES\Blender Foundation\Blender"
|
||||
${EndIf}
|
||||
FunctionEnd
|
||||
|
||||
Function un.onInit
|
||||
!insertmacro MULTIUSER_UNINIT
|
||||
FunctionEnd
|
||||
|
||||
Function DataLocation
|
||||
@ -105,12 +118,12 @@ Function DataLocation
|
||||
Abort
|
||||
${EndIf}
|
||||
|
||||
${NSD_CreateLabel} 0 0 100% 12u "Please specify where you wish to install Blender's user data files."
|
||||
${NSD_CreateRadioButton} 0 20 100% 12u "Use the Application Data directory"
|
||||
${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 50 100% 12u "Use the installation directory (ie. location chosen to install blender.exe)."
|
||||
${NSD_CreateRadioButton} 0 80 100% 12u "Use installation directory"
|
||||
Pop $HWND_INSTDIR
|
||||
${NSD_CreateRadioButton} 0 80 100% 12u "I have defined a %HOME% variable, please install files here."
|
||||
${NSD_CreateRadioButton} 0 110 100% 12u "I have defined a %HOME% variable, please install files there"
|
||||
Pop $HWND_HOMEDIR
|
||||
|
||||
${If} ${AtMostWinME}
|
||||
@ -128,7 +141,9 @@ FunctionEnd
|
||||
Function DataLocationOnLeave
|
||||
${NSD_GetState} $HWND_APPDATA $R0
|
||||
${If} $R0 == "1"
|
||||
SetShellVarContext current
|
||||
StrCpy $BLENDERHOME "$APPDATA\Blender Foundation\Blender"
|
||||
SetShellVarContext all
|
||||
${Else}
|
||||
${NSD_GetState} $HWND_INSTDIR $R0
|
||||
${If} $R0 == "1"
|
||||
@ -142,15 +157,15 @@ Function DataLocationOnLeave
|
||||
${EndIf}
|
||||
FunctionEnd
|
||||
|
||||
Section "Blender-[VERSION] (required)" SecCopyUI
|
||||
Section "Blender [VERSION] (required)" InstallFiles
|
||||
SectionIn RO
|
||||
|
||||
; Set output path to the installation directory.
|
||||
SetOutPath $INSTDIR
|
||||
; the contents of Blender installation root dir
|
||||
; The contents of Blender installation root dir
|
||||
[ROOTDIRCONTS]
|
||||
|
||||
; all datafiles (python, scripts, config)
|
||||
; All datafiles (python, scripts, config)
|
||||
[DODATAFILES]
|
||||
|
||||
SetOutPath $INSTDIR
|
||||
@ -162,13 +177,19 @@ Section "Blender-[VERSION] (required)" SecCopyUI
|
||||
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 (remove only)"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "UninstallString" '"$INSTDIR\uninstall.exe"'
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "DisplayName" "Blender"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "Publisher" "Blender Foundation"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "URLInfoAbout" "http://www.blender.org/"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "DisplayVersion" "[VERSION]"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "DisplayIcon" "$INSTDIR\blender.exe"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "UninstallString" '"$INSTDIR\uninstall.exe"'
|
||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "NoModify" 1
|
||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "NoRepair " 1
|
||||
WriteUninstaller "uninstall.exe"
|
||||
|
||||
SectionEnd
|
||||
|
||||
Section "Add Start Menu shortcuts" Section2
|
||||
Section "Add Start Menu Shortcuts" StartMenu
|
||||
SetShellVarContext all
|
||||
CreateDirectory "$SMPROGRAMS\Blender Foundation\Blender\"
|
||||
CreateShortCut "$SMPROGRAMS\Blender Foundation\Blender\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
|
||||
@ -176,45 +197,38 @@ Section "Add Start Menu shortcuts" Section2
|
||||
CreateShortCut "$SMPROGRAMS\Blender Foundation\Blender\Readme.lnk" "$INSTDIR\readme.html" "" "" 0
|
||||
CreateShortCut "$SMPROGRAMS\Blender Foundation\Blender\Copyright.lnk" "$INSTDIR\Copyright.txt" "" "$INSTDIR\copyright.txt" 0
|
||||
CreateShortCut "$SMPROGRAMS\Blender Foundation\Blender\GPL-license.lnk" "$INSTDIR\GPL-license.txt" "" "$INSTDIR\GPL-license.txt" 0
|
||||
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)' ; refresh icons
|
||||
SectionEnd
|
||||
|
||||
Section "Add Desktop Blender-[VERSION] shortcut" Section3
|
||||
Section "Add Desktop Shortcut" DesktopShortcut
|
||||
CreateShortCut "$DESKTOP\Blender.lnk" "$INSTDIR\blender.exe" "" "$INSTDIR\blender.exe" 0
|
||||
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)' ; refresh icons
|
||||
SectionEnd
|
||||
|
||||
Section "Open .blend files with Blender-[VERSION]" Section4
|
||||
|
||||
${If} ${RunningX64}
|
||||
SetRegView 64
|
||||
${EndIf}
|
||||
WriteRegStr HKCR ".blend" "" "blendfile"
|
||||
WriteRegStr HKCR "blendfile" "" "Blender .blend File"
|
||||
WriteRegStr HKCR "blendfile\shell" "" "open"
|
||||
WriteRegStr HKCR "blendfile\DefaultIcon" "" $INSTDIR\blender.exe,1
|
||||
WriteRegStr HKCR "blendfile\shell\open\command" "" \
|
||||
'"$INSTDIR\blender.exe" "%1"'
|
||||
|
||||
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 next to continue."
|
||||
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."
|
||||
|
||||
Section "Uninstall"
|
||||
; remove registry keys
|
||||
; Remove registry keys
|
||||
${If} ${RunningX64}
|
||||
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\Microsoft\Windows\CurrentVersion\Uninstall\Blender"
|
||||
DeleteRegKey HKLM "SOFTWARE\BlenderFoundation"
|
||||
DeleteRegKey HKCR ".blend"
|
||||
DeleteRegKey HKCR "blendfile"
|
||||
DeleteRegKey HKCR "CLSID\{D45F043D-F17F-4e8a-8435-70971D9FA46D}"
|
||||
SetShellVarContext all
|
||||
|
||||
; remove files
|
||||
; Remove files
|
||||
[DELROOTDIRCONTS]
|
||||
|
||||
; remove bundled python
|
||||
RmDir /r $INSTDIR\$SHORTVERSION\python
|
||||
|
||||
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
|
||||
@ -226,26 +240,27 @@ 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
|
||||
; 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"
|
||||
; remove shortcuts
|
||||
; Remove shortcuts
|
||||
Delete "$SMPROGRAMS\Blender Foundation\Blender\*.*"
|
||||
Delete "$DESKTOP\Blender.lnk"
|
||||
; remove all link related directories and files
|
||||
RMDir "$SMPROGRAMS\Blender Foundation\Blender"
|
||||
RMDir "$SMPROGRAMS\Blender Foundation"
|
||||
; Remove all link related directories and files
|
||||
RMDir /r "$SMPROGRAMS\Blender Foundation"
|
||||
; Clear out installation dir
|
||||
RMDir "$INSTDIR"
|
||||
RMDir /r "$INSTDIR"
|
||||
|
||||
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)' ; Refresh icons
|
||||
SectionEnd
|
||||
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SecCopyUI} $(DESC_SecCopyUI)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${Section2} $(DESC_Section2)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${Section3} $(DESC_Section3)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${Section4} $(DESC_Section4)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${InstallFiles} $(DESC_InstallFiles)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${StartMenu} $(DESC_StartMenu)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${DesktopShortcut} $(DESC_DesktopShortcut)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${BlendRegister} $(DESC_BlendRegister)
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
||||
|
||||
|
@ -127,7 +127,7 @@ typedef struct _DIR {
|
||||
struct dirent direntry;
|
||||
} DIR;
|
||||
|
||||
void RegisterBlendExtension(char * str);
|
||||
void RegisterBlendExtension(void);
|
||||
DIR *opendir (const char *path);
|
||||
struct dirent *readdir(DIR *dp);
|
||||
int closedir (DIR *dp);
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "BLI_string.h"
|
||||
|
||||
#include "BKE_utildefines.h"
|
||||
#include "BKE_global.h"
|
||||
|
||||
#define WIN32_SKIP_HKEY_PROTECTION // need to use HKEY
|
||||
#include "BLI_winstuff.h"
|
||||
@ -64,39 +65,108 @@ int BLI_getInstallationDir( char * str ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
void RegisterBlendExtension_Fail(HKEY root)
|
||||
{
|
||||
printf("failed\n");
|
||||
if (root)
|
||||
RegCloseKey(root);
|
||||
if (!G.background)
|
||||
MessageBox(0,"Could not register file extension.","Blender error",MB_OK|MB_ICONERROR);
|
||||
TerminateProcess(GetCurrentProcess(),1);
|
||||
}
|
||||
|
||||
void RegisterBlendExtension(char * str) {
|
||||
void RegisterBlendExtension(void) {
|
||||
LONG lresult;
|
||||
HKEY hkey = 0;
|
||||
HKEY root = 0;
|
||||
BOOL usr_mode = FALSE;
|
||||
DWORD dwd = 0;
|
||||
char buffer[128];
|
||||
|
||||
lresult = RegCreateKeyEx(HKEY_CLASSES_ROOT, "blendfile\\shell\\open\\command", 0,
|
||||
"", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwd);
|
||||
char buffer[256];
|
||||
|
||||
if (lresult == ERROR_SUCCESS) {
|
||||
sprintf(buffer, "\"%s\" \"%%1\"", str);
|
||||
lresult = RegSetValueEx(hkey, NULL, 0, REG_SZ, buffer, strlen(buffer) + 1);
|
||||
RegCloseKey(hkey);
|
||||
char BlPath[MAX_PATH];
|
||||
char InstallDir[FILE_MAXDIR];
|
||||
char SysDir[FILE_MAXDIR];
|
||||
char* ThumbHandlerDLL;
|
||||
char RegCmd[MAX_PATH*2];
|
||||
char MBox[256];
|
||||
BOOL IsWOW64;
|
||||
|
||||
printf("Registering file extension...");
|
||||
GetModuleFileName(0,BlPath,MAX_PATH);
|
||||
|
||||
// root is HKLM by default
|
||||
lresult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Classes", 0, KEY_ALL_ACCESS, &root);
|
||||
if (lresult != ERROR_SUCCESS)
|
||||
{
|
||||
// try HKCU on failure
|
||||
usr_mode = TRUE;
|
||||
lresult = RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Classes", 0, KEY_ALL_ACCESS, &root);
|
||||
if (lresult != ERROR_SUCCESS)
|
||||
RegisterBlendExtension_Fail(0);
|
||||
}
|
||||
|
||||
lresult = RegCreateKeyEx(HKEY_CLASSES_ROOT, "blendfile\\DefaultIcon", 0,
|
||||
"", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwd);
|
||||
|
||||
lresult = RegCreateKeyEx(root, "blendfile", 0,
|
||||
NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwd);
|
||||
if (lresult == ERROR_SUCCESS) {
|
||||
sprintf(buffer, "\"%s\",1", str);
|
||||
lresult = RegSetValueEx(hkey, NULL, 0, REG_SZ, buffer, strlen(buffer) + 1);
|
||||
sprintf(buffer,"%s","Blender File");
|
||||
lresult = RegSetValueEx(hkey, NULL, 0, REG_SZ, (BYTE*)buffer, strlen(buffer) + 1);
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
if (lresult != ERROR_SUCCESS)
|
||||
RegisterBlendExtension_Fail(root);
|
||||
|
||||
lresult = RegCreateKeyEx(HKEY_CLASSES_ROOT, ".blend", 0,
|
||||
"", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwd);
|
||||
lresult = RegCreateKeyEx(root, "blendfile\\shell\\open\\command", 0,
|
||||
NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwd);
|
||||
if (lresult == ERROR_SUCCESS) {
|
||||
sprintf(buffer, "\"%s\" \"%%1\"", BlPath);
|
||||
lresult = RegSetValueEx(hkey, NULL, 0, REG_SZ, (BYTE*)buffer, strlen(buffer) + 1);
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
if (lresult != ERROR_SUCCESS)
|
||||
RegisterBlendExtension_Fail(root);
|
||||
|
||||
lresult = RegCreateKeyEx(root, "blendfile\\DefaultIcon", 0,
|
||||
NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwd);
|
||||
if (lresult == ERROR_SUCCESS) {
|
||||
sprintf(buffer, "\"%s\",1", BlPath);
|
||||
lresult = RegSetValueEx(hkey, NULL, 0, REG_SZ, (BYTE*)buffer, strlen(buffer) + 1);
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
if (lresult != ERROR_SUCCESS)
|
||||
RegisterBlendExtension_Fail(root);
|
||||
|
||||
lresult = RegCreateKeyEx(root, ".blend", 0,
|
||||
NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwd);
|
||||
if (lresult == ERROR_SUCCESS) {
|
||||
sprintf(buffer, "%s", "blendfile");
|
||||
lresult = RegSetValueEx(hkey, NULL, 0, REG_SZ, buffer, strlen(buffer) + 1);
|
||||
lresult = RegSetValueEx(hkey, NULL, 0, REG_SZ, (BYTE*)buffer, strlen(buffer) + 1);
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
if (lresult != ERROR_SUCCESS)
|
||||
RegisterBlendExtension_Fail(root);
|
||||
|
||||
BLI_getInstallationDir(InstallDir);
|
||||
GetSystemDirectory(SysDir,FILE_MAXDIR);
|
||||
#ifdef WIN64
|
||||
ThumbHandlerDLL = "BlendThumb64.dll";
|
||||
#else
|
||||
IsWow64Process(GetCurrentProcess(),&IsWOW64);
|
||||
if (IsWOW64 == TRUE)
|
||||
ThumbHandlerDLL = "BlendThumb64.dll";
|
||||
else
|
||||
ThumbHandlerDLL = "BlendThumb.dll";
|
||||
#endif
|
||||
snprintf(RegCmd,MAX_PATH*2,"%s\\regsvr32 /s \"%s\\%s\"",SysDir,InstallDir,ThumbHandlerDLL);
|
||||
system(RegCmd);
|
||||
|
||||
RegCloseKey(root);
|
||||
printf("success (%s)\n",usr_mode ? "user" : "system");
|
||||
if (!G.background)
|
||||
{
|
||||
sprintf(MBox,"File extension registered for %s.",usr_mode ? "the current user. To register for all users, run as an administrator" : "all users");
|
||||
MessageBox(0,MBox,"Blender",MB_OK|MB_ICONINFORMATION);
|
||||
}
|
||||
TerminateProcess(GetCurrentProcess(),0);
|
||||
}
|
||||
|
||||
DIR *opendir (const char *path) {
|
||||
|
@ -101,6 +101,17 @@ set(SRC
|
||||
)
|
||||
|
||||
if(WIN32 AND NOT UNIX)
|
||||
string(SUBSTRING ${BLENDER_VERSION} 0 1 bver1)
|
||||
string(SUBSTRING ${BLENDER_VERSION} 2 1 bver2)
|
||||
string(SUBSTRING ${BLENDER_VERSION} 3 1 bver3)
|
||||
add_definitions(
|
||||
-DBLEN_VER_RC_STR="${BLENDER_VERSION}"
|
||||
-DBLEN_VER_RC_1=${bver1}
|
||||
-DBLEN_VER_RC_2=${bver2}
|
||||
-DBLEN_VER_RC_3=${bver3}
|
||||
-DBLEN_VER_RC_4=0
|
||||
)
|
||||
|
||||
list(APPEND SRC
|
||||
../icons/winblender.rc
|
||||
)
|
||||
@ -536,6 +547,19 @@ elseif(WIN32)
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_custom_command(TARGET blender
|
||||
POST_BUILD
|
||||
MAIN_DEPENDENCY blender
|
||||
COMMAND copy /Y \"${LIBDIR}\\thumbhandler\\lib\\BlendThumb64.dll\" \"${TARGETDIR}\\\"
|
||||
)
|
||||
if(NOT CMAKE_CL_64)
|
||||
add_custom_command(TARGET blender
|
||||
POST_BUILD
|
||||
MAIN_DEPENDENCY blender
|
||||
COMMAND copy /Y \"${LIBDIR}\\thumbhandler\\lib\\BlendThumb.dll\" \"${TARGETDIR}\\\"
|
||||
)
|
||||
endif()
|
||||
|
||||
elseif(APPLE)
|
||||
set(SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blender.app)
|
||||
|
@ -287,6 +287,7 @@ static int print_help(int UNUSED(argc), const char **UNUSED(argv), void *data)
|
||||
|
||||
#ifdef WIN32
|
||||
BLI_argsPrintArgDoc(ba, "-R");
|
||||
BLI_argsPrintArgDoc(ba, "-r");
|
||||
#endif
|
||||
BLI_argsPrintArgDoc(ba, "--version");
|
||||
|
||||
@ -486,12 +487,12 @@ static int without_borders(int UNUSED(argc), const char **UNUSED(argv), void *UN
|
||||
static int register_extension(int UNUSED(argc), const char **UNUSED(argv), void *data)
|
||||
{
|
||||
#ifdef WIN32
|
||||
char *path = BLI_argsArgv(data)[0];
|
||||
RegisterBlendExtension(path);
|
||||
if (data)
|
||||
G.background = 1;
|
||||
RegisterBlendExtension();
|
||||
#else
|
||||
(void)data; /* unused */
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1094,7 +1095,8 @@ static void setupArguments(bContext *C, bArgs *ba, SYS_SystemHandle *syshandle)
|
||||
BLI_argsAdd(ba, 2, "-p", "--window-geometry", "<sx> <sy> <w> <h>\n\tOpen with lower left corner at <sx>, <sy> and width and height as <w>, <h>", prefsize, NULL);
|
||||
BLI_argsAdd(ba, 2, "-w", "--window-border", "\n\tForce opening with borders (default)", with_borders, NULL);
|
||||
BLI_argsAdd(ba, 2, "-W", "--window-borderless", "\n\tForce opening without borders", without_borders, NULL);
|
||||
BLI_argsAdd(ba, 2, "-R", NULL, "\n\tRegister .blend extension (windows only)", register_extension, ba);
|
||||
BLI_argsAdd(ba, 2, "-R", NULL, "\n\tRegister .blend extension, then exit (Windows only)", register_extension, NULL);
|
||||
BLI_argsAdd(ba, 2, "-r", NULL, "\n\tSilently register .blend extension, then exit (Windows only)", register_extension, ba);
|
||||
|
||||
/* third pass: disabling things and forcing settings */
|
||||
BLI_argsAddCase(ba, 3, "-nojoystick", 1, NULL, 0, "\n\tDisable joystick support", no_joystick, syshandle);
|
||||
|
@ -1,9 +1,12 @@
|
||||
#!/usr/bin/python
|
||||
Import ('env')
|
||||
import btools
|
||||
|
||||
if env['OURPLATFORM'] == 'linuxcross':
|
||||
source = 'linuxcrossblender.rcscons'
|
||||
else:
|
||||
source = 'winblender.rcscons'
|
||||
env['RCFLAGS'].append("-DWINDRES")
|
||||
env['RCFLAGS'].append("-DBLEN_VER_RC_STR_M=" + btools.VERSION)
|
||||
env['RCFLAGS'].append("-DBLEN_VER_RC_1=" + btools.VERSION[0])
|
||||
env['RCFLAGS'].append("-DBLEN_VER_RC_2=" + btools.VERSION[2])
|
||||
env['RCFLAGS'].append("-DBLEN_VER_RC_3=" + btools.VERSION[3])
|
||||
env['RCFLAGS'].append("-DBLEN_VER_RC_4=0")
|
||||
|
||||
env.BlenderRes('winresource', source, ['core'], priority=[95])
|
||||
env.BlenderRes('winresource', 'winblender.rc', ['core'], priority=[95])
|
||||
|
10
source/icons/blender.exe.manifest
Normal file
10
source/icons/blender.exe.manifest
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<security>
|
||||
<requestedPrivileges>
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
</assembly>
|
@ -1,2 +0,0 @@
|
||||
APPICON ICON "source/icons/winblender.ico"
|
||||
BLENDERFILE ICON "source/icons/winblenderfile.ico"
|
@ -1,2 +1,40 @@
|
||||
APPICON ICON "winblender.ico"
|
||||
BLENDERFILE ICON "winblenderfile.ico"
|
||||
#define BLENDERFILE 1
|
||||
#define IDR_VERSION1 1
|
||||
|
||||
#ifdef WINDRES
|
||||
#include "winresrc.h"
|
||||
#define IDC_STATIC (-1)
|
||||
#define STRINGIFY_(x) #x
|
||||
#define STRINGIFY(x) STRINGIFY_(x)
|
||||
#define BLEN_VER_RC_STR STRINGIFY(BLEN_VER_RC_STR_M)
|
||||
1 RT_MANIFEST "blender.exe.manifest"
|
||||
#endif
|
||||
|
||||
APPICON ICON DISCARDABLE "winblender.ico"
|
||||
BLENDERFILE ICON DISCARDABLE "winblenderfile.ico"
|
||||
|
||||
IDR_VERSION1 VERSIONINFO
|
||||
FILEVERSION BLEN_VER_RC_1, BLEN_VER_RC_2, BLEN_VER_RC_3, BLEN_VER_RC_4
|
||||
PRODUCTVERSION BLEN_VER_RC_1, BLEN_VER_RC_2, BLEN_VER_RC_3, BLEN_VER_RC_4
|
||||
FILEOS 0x00000004
|
||||
FILETYPE 0x00000001
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "04090000"
|
||||
BEGIN
|
||||
VALUE "FileVersion", BLEN_VER_RC_STR
|
||||
VALUE "ProductVersion", BLEN_VER_RC_STR
|
||||
VALUE "CompanyName", "Blender Foundation"
|
||||
VALUE "FileDescription", "Blender"
|
||||
VALUE "LegalCopyright", "GPLv2 (Blender Foundation)"
|
||||
VALUE "OriginalFilename", "blender.exe"
|
||||
VALUE "ProductName", "Blender"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x0409, 0x0000
|
||||
END
|
||||
END
|
||||
|
||||
|
@ -1,2 +0,0 @@
|
||||
APPICON ICON "source\\icons\\winblender.ico"
|
||||
BLENDERFILE ICON "source\\icons\\winblenderfile.ico"
|
Loading…
Reference in New Issue
Block a user