[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35873] trunk/blender: Apply [#26044] Windows thumbnails and improved filetype registration

Nathan Letwory nathan at letworyinteractive.com
Tue Mar 29 15:00:03 CEST 2011


Revision: 35873
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35873
Author:   jesterking
Date:     2011-03-29 13:00:03 +0000 (Tue, 29 Mar 2011)
Log Message:
-----------
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!

Modified Paths:
--------------
    trunk/blender/SConstruct
    trunk/blender/release/windows/installer/00.sconsblender.nsi
    trunk/blender/source/blender/blenlib/BLI_winstuff.h
    trunk/blender/source/blender/blenlib/intern/winstuff.c
    trunk/blender/source/creator/CMakeLists.txt
    trunk/blender/source/creator/creator.c
    trunk/blender/source/icons/SConscript
    trunk/blender/source/icons/winblender.rc

Added Paths:
-----------
    trunk/blender/source/icons/blender.exe.manifest

Removed Paths:
-------------
    trunk/blender/source/icons/linuxcrossblender.rcscons
    trunk/blender/source/icons/winblender.rcscons

Modified: trunk/blender/SConstruct
===================================================================
--- trunk/blender/SConstruct	2011-03-29 12:54:38 UTC (rev 35872)
+++ trunk/blender/SConstruct	2011-03-29 13:00:03 UTC (rev 35873)
@@ -153,13 +153,11 @@
 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 @@
 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 @@
                     '${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
 

Modified: trunk/blender/release/windows/installer/00.sconsblender.nsi
===================================================================
--- trunk/blender/release/windows/installer/00.sconsblender.nsi	2011-03-29 12:54:38 UTC (rev 35872)
+++ trunk/blender/release/windows/installer/00.sconsblender.nsi	2011-03-29 13:00:03 UTC (rev 35873)
@@ -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 @@
 ;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 @@
 Var BLENDERHOME
 Var SHORTVERSION ; This is blender_version_decimal() from path_util.c
 
-; custom controls
+; Custom controls
 Var HWND
 
 Var HWND_APPDATA
@@ -94,9 +91,25 @@
 
 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
   nsDialogs::Create /NOUNLOAD 1018
   Pop $HWND
@@ -105,12 +118,12 @@
     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 @@
 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 @@
   ${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 @@
   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 @@
   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."

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list