From 7a6267f501ccac7b599b40715e9db265166e47c9 Mon Sep 17 00:00:00 2001 From: Piotr Mintus Date: Sat, 12 Jun 2021 10:19:15 -0700 Subject: [PATCH 01/15] Search for Python install in HKLM When installed for all user, the python registry keys may be under HKLM instead of HKCU. HKCU has precedence. --- UsdShellExtension/Module.cpp | 10 ++++++++-- shared/environment.cpp | 5 +++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/UsdShellExtension/Module.cpp b/UsdShellExtension/Module.cpp index eabd8c0..37f0bfd 100644 --- a/UsdShellExtension/Module.cpp +++ b/UsdShellExtension/Module.cpp @@ -83,8 +83,14 @@ static bool GetPythonInstallationPath( LPTSTR sBuffer, DWORD nBufferSizeInChars CRegKey regPythonInstallPath; ls = regPythonInstallPath.Open( HKEY_CURRENT_USER, sPythonRegKeyInstallPath, KEY_READ ); - if ( ls != ERROR_SUCCESS ) - return false; + if (ls != ERROR_SUCCESS) + { + ls = regPythonInstallPath.Open(HKEY_LOCAL_MACHINE, sPythonRegKeyInstallPath, KEY_READ); + if (ls != ERROR_SUCCESS) + { + return false; + } + } ULONG nChars = nBufferSizeInChars; ls = regPythonInstallPath.QueryStringValue( _T(""), sBuffer, &nChars ); diff --git a/shared/environment.cpp b/shared/environment.cpp index 6f5c577..d033b84 100644 --- a/shared/environment.cpp +++ b/shared/environment.cpp @@ -111,6 +111,11 @@ static void SetupPathEnvironmentVariable(LPCWSTR sUSD_Path, LPCWSTR sPython_Path LSTATUS ls; CRegKey regPythonInstallPath; ls = regPythonInstallPath.Open( HKEY_CURRENT_USER, sPythonRegKeyInstallPath, KEY_READ ); + if ( ls != ERROR_SUCCESS ) + { + ls = regPythonInstallPath.Open(HKEY_LOCAL_MACHINE, sPythonRegKeyInstallPath, KEY_READ); + } + if ( ls == ERROR_SUCCESS ) { TCHAR sValue[512]; From 40eb1ad307c5da280319c590676e3c3ff9d210f6 Mon Sep 17 00:00:00 2001 From: Piotr Mintus Date: Sat, 12 Jun 2021 10:50:19 -0700 Subject: [PATCH 02/15] Search registry for all Python versions Always check the registry first for a python install. --- UsdShellExtension/Module.cpp | 57 +++++++++++++++++------------ shared/environment.cpp | 69 ++++++++++++++++++++---------------- 2 files changed, 73 insertions(+), 53 deletions(-) diff --git a/UsdShellExtension/Module.cpp b/UsdShellExtension/Module.cpp index 37f0bfd..29fa7e9 100644 --- a/UsdShellExtension/Module.cpp +++ b/UsdShellExtension/Module.cpp @@ -65,6 +65,32 @@ static std::vector TranslatePathsToList(LPCTSTR paths) return pathList; } +static bool GetPythonInstallationPathFromRegistry(LPTSTR sBuffer, DWORD nBufferSizeInChars) +{ + CString sPythonRegKeyInstallPath; + sPythonRegKeyInstallPath.Format(_T("SOFTWARE\\Python\\PythonCore\\%hs\\InstallPath"), _CRT_STRINGIZE(PYTHONVERSION)); + + LSTATUS ls; + + CRegKey regPythonInstallPath; + ls = regPythonInstallPath.Open(HKEY_CURRENT_USER, sPythonRegKeyInstallPath, KEY_READ); + if (ls != ERROR_SUCCESS) + { + ls = regPythonInstallPath.Open(HKEY_LOCAL_MACHINE, sPythonRegKeyInstallPath, KEY_READ); + if (ls != ERROR_SUCCESS) + { + return false; + } + } + + ULONG nChars = nBufferSizeInChars; + ls = regPythonInstallPath.QueryStringValue(_T(""), sBuffer, &nChars); + if (ls != ERROR_SUCCESS) + return false; + + return true; +} + static bool GetPythonInstallationPath( LPTSTR sBuffer, DWORD nBufferSizeInChars ) { std::vector ConfigFileList = BuildConfigFileList( g_hInstance ); @@ -73,32 +99,19 @@ static bool GetPythonInstallationPath( LPTSTR sBuffer, DWORD nBufferSizeInChars GetPrivateProfileStringAndExpandEnvironmentStrings( L"PYTHON", L"PATH", L"", sPythonPath, ConfigFileList ); wcscpy_s( sBuffer, nBufferSizeInChars, sPythonPath ); - if ( sBuffer[0] == '\0' ) + if (sBuffer[0] == '\0') { -#if PY_MAJOR_VERSION >= 3 - CString sPythonRegKeyInstallPath; - sPythonRegKeyInstallPath.Format( _T( "SOFTWARE\\Python\\PythonCore\\%hs\\InstallPath" ), _CRT_STRINGIZE(PYTHONVERSION) ); - - LSTATUS ls; - - CRegKey regPythonInstallPath; - ls = regPythonInstallPath.Open( HKEY_CURRENT_USER, sPythonRegKeyInstallPath, KEY_READ ); - if (ls != ERROR_SUCCESS) + bool bResult = GetPythonInstallationPathFromRegistry(sBuffer, nBufferSizeInChars); +#if (PY_MAJOR_VERSION == 2) && (PY_MINOR_VERSION == 7) + if (bResult == false) { - ls = regPythonInstallPath.Open(HKEY_LOCAL_MACHINE, sPythonRegKeyInstallPath, KEY_READ); - if (ls != ERROR_SUCCESS) - { - return false; - } + _tcscpy_s(sBuffer, nBufferSizeInChars, _T("C:\\Python27\\")); + DWORD nAttribs = ::GetFileAttributes( sBuffer ); + if ( (nAttribs != INVALID_FILE_ATTRIBUTES) && (nAttribs & FILE_ATTRIBUTE_DIRECTORY) ) + bResult = true; } - - ULONG nChars = nBufferSizeInChars; - ls = regPythonInstallPath.QueryStringValue( _T(""), sBuffer, &nChars ); - if ( ls != ERROR_SUCCESS ) - return false; -#elif (PY_MAJOR_VERSION == 2) && (PY_MINOR_VERSION == 7) - _tcscpy_s(sBuffer, nBufferSizeInChars, _T("C:\\Python27\\")); #endif + return bResult; } else { diff --git a/shared/environment.cpp b/shared/environment.cpp index d033b84..8224618 100644 --- a/shared/environment.cpp +++ b/shared/environment.cpp @@ -97,48 +97,55 @@ static CStringW AppendEnvironmentVariable( LPCWSTR sEnvironmentVariable, LPCWSTR return sSetBuffer; } -static void SetupPathEnvironmentVariable(LPCWSTR sUSD_Path, LPCWSTR sPython_Path) +static bool GetPythonInstallationPathFromRegistry(LPTSTR sBuffer, DWORD nBufferSizeInChars) { - CStringW sSetBuffer; + CString sPythonRegKeyInstallPath; + sPythonRegKeyInstallPath.Format(_T("SOFTWARE\\Python\\PythonCore\\%hs\\InstallPath"), _CRT_STRINGIZE(PYTHONVERSION)); - if ( sPython_Path[0] == '\0' ) + LSTATUS ls; + + CRegKey regPythonInstallPath; + ls = regPythonInstallPath.Open(HKEY_CURRENT_USER, sPythonRegKeyInstallPath, KEY_READ); + if (ls != ERROR_SUCCESS) { -#if PY_MAJOR_VERSION >= 3 - #if defined(PYTHONVERSION) - CStringW sPythonRegKeyInstallPath; - sPythonRegKeyInstallPath.Format( L"SOFTWARE\\Python\\PythonCore\\%hs\\InstallPath", _CRT_STRINGIZE(PYTHONVERSION) ); - - LSTATUS ls; - CRegKey regPythonInstallPath; - ls = regPythonInstallPath.Open( HKEY_CURRENT_USER, sPythonRegKeyInstallPath, KEY_READ ); - if ( ls != ERROR_SUCCESS ) + ls = regPythonInstallPath.Open(HKEY_LOCAL_MACHINE, sPythonRegKeyInstallPath, KEY_READ); + if (ls != ERROR_SUCCESS) { - ls = regPythonInstallPath.Open(HKEY_LOCAL_MACHINE, sPythonRegKeyInstallPath, KEY_READ); + return false; } + } + + ULONG nChars = nBufferSizeInChars; + ls = regPythonInstallPath.QueryStringValue(_T(""), sBuffer, &nChars); + if (ls != ERROR_SUCCESS) + return false; + + return true; +} - if ( ls == ERROR_SUCCESS ) +static void SetupPathEnvironmentVariable(LPCWSTR sUSD_Path, LPCWSTR sPython_Path) +{ + CStringW sSetBuffer; + + if ( sPython_Path[0] == '\0' ) + { + TCHAR sValue[512]; + bool bFound = GetPythonInstallationPathFromRegistry( sValue, ARRAYSIZE(sValue) ); +#if (PY_MAJOR_VERSION == 2) && (PY_MINOR_VERSION == 7) + if (bFound == false) { - TCHAR sValue[512]; - ULONG nChars = ARRAYSIZE( sValue ); - ls = regPythonInstallPath.QueryStringValue( L"", sValue, &nChars ); - if ( ls == ERROR_SUCCESS ) - { - if ( !sSetBuffer.IsEmpty() ) - sSetBuffer += L";"; - sSetBuffer += sValue; - } + _tcscpy_s(sValue, ARRAYSIZE(sValue), _T("C:\\Python27\\")); + DWORD nAttribs = ::GetFileAttributes(sBuffer); + if ((nAttribs != INVALID_FILE_ATTRIBUTES) && (nAttribs & FILE_ATTRIBUTE_DIRECTORY)) + bResult = true; } - #endif -#elif PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION == 7 - static constexpr wchar_t python27InstallPath[] = L"C:\\Python27\\"; - DWORD nAttrib = ::GetFileAttributesW( python27InstallPath ); - if ( (nAttrib != INVALID_FILE_ATTRIBUTES) && (nAttrib & FILE_ATTRIBUTE_DIRECTORY) ) +#endif + if (bFound) { - if ( !sSetBuffer.IsEmpty() ) + if (!sSetBuffer.IsEmpty()) sSetBuffer += L";"; - sSetBuffer += python27InstallPath; + sSetBuffer += sValue; } -#endif } else { From 3121a420cd754cea4ecc317d107d84f897badb78 Mon Sep 17 00:00:00 2001 From: Piotr Mintus Date: Sun, 13 Jun 2021 09:33:10 -0700 Subject: [PATCH 03/15] Adding a manifest file to UsdPreviewLocalServer Specifying DPI awareness in the manifest file. This fixes per monitor DPI issues with the preview window under Python 2.7. --- .../UsdPreviewLocalServer.manifest | 24 +++++++++++++++++++ .../UsdPreviewLocalServer.vcxproj | 3 +++ .../UsdPreviewLocalServer.vcxproj.filters | 3 +++ 3 files changed, 30 insertions(+) create mode 100644 UsdPreviewHandlerServer/UsdPreviewLocalServer.manifest diff --git a/UsdPreviewHandlerServer/UsdPreviewLocalServer.manifest b/UsdPreviewHandlerServer/UsdPreviewLocalServer.manifest new file mode 100644 index 0000000..504e68c --- /dev/null +++ b/UsdPreviewHandlerServer/UsdPreviewLocalServer.manifest @@ -0,0 +1,24 @@ + + + + + + true + PerMonitorV2 + + + \ No newline at end of file diff --git a/UsdPreviewHandlerServer/UsdPreviewLocalServer.vcxproj b/UsdPreviewHandlerServer/UsdPreviewLocalServer.vcxproj index cafa4b2..f1b8b8c 100644 --- a/UsdPreviewHandlerServer/UsdPreviewLocalServer.vcxproj +++ b/UsdPreviewHandlerServer/UsdPreviewLocalServer.vcxproj @@ -236,6 +236,9 @@ + + + diff --git a/UsdPreviewHandlerServer/UsdPreviewLocalServer.vcxproj.filters b/UsdPreviewHandlerServer/UsdPreviewLocalServer.vcxproj.filters index c0f66c8..2892d54 100644 --- a/UsdPreviewHandlerServer/UsdPreviewLocalServer.vcxproj.filters +++ b/UsdPreviewHandlerServer/UsdPreviewLocalServer.vcxproj.filters @@ -100,4 +100,7 @@ Resource Files + + + \ No newline at end of file From c169f866d9129f2416b526d097474bafcde145a0 Mon Sep 17 00:00:00 2001 From: Piotr Mintus Date: Mon, 14 Jun 2021 11:39:06 -0700 Subject: [PATCH 04/15] Fix for UsdView displaying behind Windows Explorer A call to QtWidget::activateWindow must be made by UsdView to bring the window into the foreground. Adding a usdview.py script that inherits from Pixar's usdview and adds: 1. A call to QtWidget::activateWindow after the window is created to bring it to the foreground. 2. A usd icon for the window. --- UsdPythonToolsServer/UsdPythonToolsImpl.cpp | 38 +++++++++++++--- .../UsdPythonToolsLocalServer.rc | 2 + .../UsdPythonToolsLocalServer.vcxproj | 9 +++- .../UsdPythonToolsLocalServer.vcxproj.filters | 1 + UsdPythonToolsServer/UsdView.py | 44 +++++++++++++++++++ UsdPythonToolsServer/resource.h | 5 +-- UsdShellExtension/ShellExecute.cpp | 2 + .../UsdShellExtensionInstaller.nsi | 2 + 8 files changed, 93 insertions(+), 10 deletions(-) create mode 100644 UsdPythonToolsServer/UsdView.py diff --git a/UsdPythonToolsServer/UsdPythonToolsImpl.cpp b/UsdPythonToolsServer/UsdPythonToolsImpl.cpp index aa2459b..e82b193 100644 --- a/UsdPythonToolsServer/UsdPythonToolsImpl.cpp +++ b/UsdPythonToolsServer/UsdPythonToolsImpl.cpp @@ -151,7 +151,8 @@ static HRESULT RunDiskPythonScript( LPCWSTR sToolFileName, std::vector &ArgV, std::string &sStdOut, int& exitCode ) +typedef void (*PreExecuteScriptCallback)( CStringA& pyScript ); +static HRESULT RunResourcePythonScript( UINT nResourceId, std::vector &ArgV, std::string &sStdOut, int& exitCode, PreExecuteScriptCallback pfnPreExecuteScriptCallback) { exitCode = 0; @@ -190,6 +191,9 @@ static HRESULT RunResourcePythonScript( UINT nResourceId, std::vector ArgV; - ArgV.push_back( sPathToHostExe ); + // Set the first argument as the absolute path to the usdview python script + // We will use argv[0] to load it using importlib + CW2Py pyUsdViewAbsolutePath(sUsdViewAbsolutePath.c_str()); + ArgV.push_back(pyUsdViewAbsolutePath); CW2Py pyRenderer(renderer); if ( renderer != nullptr && renderer[0] != '\0' ) @@ -354,8 +382,8 @@ STDMETHODIMP CUsdPythonToolsImpl::View( IN BSTR usdStagePath, IN BSTR renderer ) ArgV.push_back( pyUsdStagePath ); int exitCode = 0; - hr = RunDiskPythonScript( L"usdview", ArgV, sStdOut, exitCode ); - if ( FAILED( hr ) ) + hr = RunResourcePythonScript( IDR_PYTHON_VIEW, ArgV, sStdOut, exitCode, UsdViewPreExecuteScriptCallback ); + if (FAILED(hr)) return hr; if ( exitCode != 0 ) diff --git a/UsdPythonToolsServer/UsdPythonToolsLocalServer.rc b/UsdPythonToolsServer/UsdPythonToolsLocalServer.rc index dba898a..04e7255 100644 --- a/UsdPythonToolsServer/UsdPythonToolsLocalServer.rc +++ b/UsdPythonToolsServer/UsdPythonToolsLocalServer.rc @@ -76,6 +76,8 @@ IDI_ICON_USD ICON "shared\\usd.ico" IDR_PYTHON_THUMBNAIL PYTHON "UsdThumbnail.py" +IDR_PYTHON_VIEW PYTHON "UsdView.py" + #endif // English (United States) resources ///////////////////////////////////////////////////////////////////////////// diff --git a/UsdPythonToolsServer/UsdPythonToolsLocalServer.vcxproj b/UsdPythonToolsServer/UsdPythonToolsLocalServer.vcxproj index c679cf9..c7a6adc 100644 --- a/UsdPythonToolsServer/UsdPythonToolsLocalServer.vcxproj +++ b/UsdPythonToolsServer/UsdPythonToolsLocalServer.vcxproj @@ -147,7 +147,9 @@ $(OutDir)$(ProjectName).tlb - %(Command) + xcopy "$(SolutionDir)shared\usd.ico" "$(TargetDir)" /I /Y /D /R + +%(Command) @@ -185,7 +187,9 @@ $(OutDir)$(ProjectName).tlb - %(Command) + xcopy "$(SolutionDir)shared\usd.ico" "$(TargetDir)" /I /Y /D /R + +%(Command) @@ -217,6 +221,7 @@ + diff --git a/UsdPythonToolsServer/UsdPythonToolsLocalServer.vcxproj.filters b/UsdPythonToolsServer/UsdPythonToolsLocalServer.vcxproj.filters index 57a7293..fe508a1 100644 --- a/UsdPythonToolsServer/UsdPythonToolsLocalServer.vcxproj.filters +++ b/UsdPythonToolsServer/UsdPythonToolsLocalServer.vcxproj.filters @@ -74,6 +74,7 @@ Resource Files + diff --git a/UsdPythonToolsServer/UsdView.py b/UsdPythonToolsServer/UsdView.py new file mode 100644 index 0000000..e48e7d0 --- /dev/null +++ b/UsdPythonToolsServer/UsdView.py @@ -0,0 +1,44 @@ +# Copyright 2021 Activision Publishing, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import print_function +import sys +import pxr.Usdviewq as Usdviewq + +class LauncherOverride(Usdviewq.Launcher): + + def LaunchPreamble(self, arg_parse_result): + try: + from PySide2 import QtGui + except ImportError: + from PySide import QtGui + + (app, appController) = super().LaunchPreamble(arg_parse_result) + + # set the icon that will appear in the taskbar + appController._mainWindow.setWindowIcon(QtGui.QIcon('%PATH_TO_USD_ICO%')) + # activate the window (SetForegroundWindow) + appController._mainWindow.activateWindow() + + return (app, appController) + +if __name__ == '__main__': + # Let Ctrl-C kill the app. + import signal + signal.signal(signal.SIGINT, signal.SIG_DFL) + try: + LauncherOverride().Run() + except Usdviewq.InvalidUsdviewOption as e: + print("ERROR: " + e.message, file=sys.stderr) + sys.exit(1) diff --git a/UsdPythonToolsServer/resource.h b/UsdPythonToolsServer/resource.h index 2fa80a0..fa0016f 100644 --- a/UsdPythonToolsServer/resource.h +++ b/UsdPythonToolsServer/resource.h @@ -9,15 +9,14 @@ #define IDR_PYTHON_PREVIEWHANLDER 107 #define IDR_REGISTRY_THUMBNAILIMPL 108 #define IDR_REGISTRY_USDTHUMBNAILIMPL 108 -#define IDD_DIALOG1 109 -#define IDR_PYTHON1 111 #define IDR_PYTHON_THUMBNAIL 111 +#define IDR_PYTHON_VIEW 112 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 112 +#define _APS_NEXT_RESOURCE_VALUE 113 #define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_CONTROL_VALUE 1004 #define _APS_NEXT_SYMED_VALUE 101 diff --git a/UsdShellExtension/ShellExecute.cpp b/UsdShellExtension/ShellExecute.cpp index a92255d..b502c6c 100644 --- a/UsdShellExtension/ShellExecute.cpp +++ b/UsdShellExtension/ShellExecute.cpp @@ -66,6 +66,8 @@ void CALLBACK OpenInUsdViewW( HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, in if ( FAILED( hr ) ) return; + ::CoAllowSetForegroundWindow( pUsdPythonTools, nullptr ); + hr = pUsdPythonTools->View( CComBSTR(args.argv[0]), bRendererIsValid ? bstrRenderer : nullptr ); if ( FAILED( hr ) ) return; diff --git a/UsdShellExtensionInstaller/UsdShellExtensionInstaller.nsi b/UsdShellExtensionInstaller/UsdShellExtensionInstaller.nsi index 155cbce..30c4a76 100644 --- a/UsdShellExtensionInstaller/UsdShellExtensionInstaller.nsi +++ b/UsdShellExtensionInstaller/UsdShellExtensionInstaller.nsi @@ -195,6 +195,7 @@ SetOutPath "$INSTDIR" File plugInfo.json File LICENSE.txt File NOTICE.txt +File usd.ico SetOutPath "$INSTDIR\usd" File /r .\usd\* @@ -390,6 +391,7 @@ DeleteRegKey HKLM SOFTWARE\Activision\UsdShellExtension Delete /REBOOTOK "$INSTDIR\plugInfo.json" Delete /REBOOTOK "$INSTDIR\LICENSE.txt" Delete /REBOOTOK "$INSTDIR\NOTICE.txt" +Delete /REBOOTOK "$INSTDIR\usd.ico" RMDir /r /REBOOTOK "$INSTDIR\usd" Delete /REBOOTOK "$INSTDIR\UsdPropertyKeys.propdesc" From 48da96f35a77ea24879435e405c690b03c4e0d1b Mon Sep 17 00:00:00 2001 From: Piotr Mintus Date: Mon, 14 Jun 2021 11:50:23 -0700 Subject: [PATCH 05/15] Consolidate implementations of GetPythonInstallationPathFromRegistry --- UsdShellExtension/Module.cpp | 28 +--------------------------- shared/environment.cpp | 10 +++++----- shared/environment.h | 3 ++- 3 files changed, 8 insertions(+), 33 deletions(-) diff --git a/UsdShellExtension/Module.cpp b/UsdShellExtension/Module.cpp index 29fa7e9..27728a3 100644 --- a/UsdShellExtension/Module.cpp +++ b/UsdShellExtension/Module.cpp @@ -65,32 +65,6 @@ static std::vector TranslatePathsToList(LPCTSTR paths) return pathList; } -static bool GetPythonInstallationPathFromRegistry(LPTSTR sBuffer, DWORD nBufferSizeInChars) -{ - CString sPythonRegKeyInstallPath; - sPythonRegKeyInstallPath.Format(_T("SOFTWARE\\Python\\PythonCore\\%hs\\InstallPath"), _CRT_STRINGIZE(PYTHONVERSION)); - - LSTATUS ls; - - CRegKey regPythonInstallPath; - ls = regPythonInstallPath.Open(HKEY_CURRENT_USER, sPythonRegKeyInstallPath, KEY_READ); - if (ls != ERROR_SUCCESS) - { - ls = regPythonInstallPath.Open(HKEY_LOCAL_MACHINE, sPythonRegKeyInstallPath, KEY_READ); - if (ls != ERROR_SUCCESS) - { - return false; - } - } - - ULONG nChars = nBufferSizeInChars; - ls = regPythonInstallPath.QueryStringValue(_T(""), sBuffer, &nChars); - if (ls != ERROR_SUCCESS) - return false; - - return true; -} - static bool GetPythonInstallationPath( LPTSTR sBuffer, DWORD nBufferSizeInChars ) { std::vector ConfigFileList = BuildConfigFileList( g_hInstance ); @@ -101,7 +75,7 @@ static bool GetPythonInstallationPath( LPTSTR sBuffer, DWORD nBufferSizeInChars if (sBuffer[0] == '\0') { - bool bResult = GetPythonInstallationPathFromRegistry(sBuffer, nBufferSizeInChars); + bool bResult = GetPythonInstallationPathFromRegistry( sBuffer, nBufferSizeInChars ); #if (PY_MAJOR_VERSION == 2) && (PY_MINOR_VERSION == 7) if (bResult == false) { diff --git a/shared/environment.cpp b/shared/environment.cpp index 8224618..0786b51 100644 --- a/shared/environment.cpp +++ b/shared/environment.cpp @@ -97,18 +97,18 @@ static CStringW AppendEnvironmentVariable( LPCWSTR sEnvironmentVariable, LPCWSTR return sSetBuffer; } -static bool GetPythonInstallationPathFromRegistry(LPTSTR sBuffer, DWORD nBufferSizeInChars) +bool GetPythonInstallationPathFromRegistry( LPTSTR sBuffer, DWORD nBufferSizeInChars ) { CString sPythonRegKeyInstallPath; - sPythonRegKeyInstallPath.Format(_T("SOFTWARE\\Python\\PythonCore\\%hs\\InstallPath"), _CRT_STRINGIZE(PYTHONVERSION)); + sPythonRegKeyInstallPath.Format( _T("SOFTWARE\\Python\\PythonCore\\%hs\\InstallPath"), _CRT_STRINGIZE(PYTHONVERSION) ); LSTATUS ls; CRegKey regPythonInstallPath; - ls = regPythonInstallPath.Open(HKEY_CURRENT_USER, sPythonRegKeyInstallPath, KEY_READ); + ls = regPythonInstallPath.Open( HKEY_CURRENT_USER, sPythonRegKeyInstallPath, KEY_READ ); if (ls != ERROR_SUCCESS) { - ls = regPythonInstallPath.Open(HKEY_LOCAL_MACHINE, sPythonRegKeyInstallPath, KEY_READ); + ls = regPythonInstallPath.Open( HKEY_LOCAL_MACHINE, sPythonRegKeyInstallPath, KEY_READ ); if (ls != ERROR_SUCCESS) { return false; @@ -116,7 +116,7 @@ static bool GetPythonInstallationPathFromRegistry(LPTSTR sBuffer, DWORD nBufferS } ULONG nChars = nBufferSizeInChars; - ls = regPythonInstallPath.QueryStringValue(_T(""), sBuffer, &nChars); + ls = regPythonInstallPath.QueryStringValue( _T(""), sBuffer, &nChars ); if (ls != ERROR_SUCCESS) return false; diff --git a/shared/environment.h b/shared/environment.h index 2c30e42..e9c363d 100644 --- a/shared/environment.h +++ b/shared/environment.h @@ -24,4 +24,5 @@ const CStringW &GetUsdPythonPath(); const CStringW &GetUsdEditor(); std::vector BuildConfigFileList( HMODULE hCurrentModule ); -void GetPrivateProfileStringAndExpandEnvironmentStrings( LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpDefault, CStringW &lpReturnedString, const std::vector &ConfigFileList ); \ No newline at end of file +void GetPrivateProfileStringAndExpandEnvironmentStrings( LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpDefault, CStringW &lpReturnedString, const std::vector &ConfigFileList ); +bool GetPythonInstallationPathFromRegistry( LPTSTR sBuffer, DWORD nBufferSizeInChars ); From 9ab71e170464ac2356025f048c1b4f152aa184d6 Mon Sep 17 00:00:00 2001 From: Piotr Mintus Date: Mon, 14 Jun 2021 11:55:29 -0700 Subject: [PATCH 06/15] Version Bump Bumping version for next release. --- atviversion.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atviversion.props b/atviversion.props index 5aae0f9..c89c89f 100644 --- a/atviversion.props +++ b/atviversion.props @@ -18,7 +18,7 @@ 1 - 09 + 10 00 00 Activision USD Shell Extension From 2e0872ffb7f6663e2c5bfe8d2074e0cbd2227ff6 Mon Sep 17 00:00:00 2001 From: Piotr Mintus Date: Mon, 14 Jun 2021 15:38:43 -0700 Subject: [PATCH 07/15] Adding a Camera context menu to the preview The preview window will now have a camera context menu. This menu will only be present if a scene has cameras. --- .../UsdPreviewHandlerPython.py | 56 ++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/UsdPreviewHandlerServer/UsdPreviewHandlerPython.py b/UsdPreviewHandlerServer/UsdPreviewHandlerPython.py index be0e77e..70dc335 100644 --- a/UsdPreviewHandlerServer/UsdPreviewHandlerPython.py +++ b/UsdPreviewHandlerServer/UsdPreviewHandlerPython.py @@ -16,8 +16,9 @@ import sys import os import argparse -from pxr import Usd, UsdUtils, Sdf, UsdAppUtils +from pxr import Usd, UsdGeom, UsdUtils, Sdf, Tf, UsdAppUtils from pxr.Usdviewq.stageView import StageView +from pxr.Usdviewq._usdviewq import Utils from pxr.UsdAppUtils.complexityArgs import RefinementComplexities import UsdPreviewHandler @@ -92,6 +93,14 @@ def OnRendererPlugin(self, plugin): action.setDisabled(True) break + def OnCameraSelectionChanged(self, action): + self.model.viewSettings.cameraPrim = action.data() + + # reset the Free-Cam camera + # it can get messed up if camera controls are used in a fixed camera + if not self.model.viewSettings.cameraPrim: + self.view.updateView(resetCam=True, forceComputeBBox=False) + def buildContextMenu_Renderer(self, contextMenu): self.rendererPluginActionGroup = QActionGroup(self) self.rendererPluginActionGroup.setExclusive(True) @@ -218,12 +227,57 @@ def buildContextMenu_DisplayPurposes(self, contextMenu): displayPurposesMenu.addAction(self.actionDisplay_Proxy) displayPurposesMenu.addAction(self.actionDisplay_Render) + def buildContextMenu_Camera(self, contextMenu): + + self.view.allSceneCameras = Utils._GetAllPrimsOfType( + self.model.stage, Tf.Type.Find(UsdGeom.Camera)) + + # only display a camera menu if the scene has cameras + if len(self.view.allSceneCameras) == 0: + return + + currCamera = self.model.viewSettings.cameraPrim + currCameraPath = None + if currCamera: + currCameraPath = currCamera.GetPath() + + cameraMenu = contextMenu.addMenu("Camera") + + cameraGroup = QActionGroup(self) + cameraGroup.setExclusive(True) + cameraGroup.triggered.connect(self.OnCameraSelectionChanged) + + # add free-cam + actionFreeCamera = QAction("Free Camera", self) + actionFreeCamera.setCheckable(True) + actionFreeCamera.setData(None) + actionFreeCamera.setChecked(currCameraPath == None) + cameraMenu.addAction(actionFreeCamera) + cameraGroup.addAction(actionFreeCamera) + + actionSeparator = QAction("", self) + actionSeparator.setSeparator(True) + cameraMenu.addAction(actionSeparator) + cameraGroup.addAction(actionSeparator) + + for camera in self.view.allSceneCameras: + action = QAction(camera.GetName(), self) + action.setData(camera) + action.setToolTip(str(camera.GetPath())) + action.setCheckable(True) + + action.setChecked(camera.GetPath() == currCameraPath) + + cameraMenu.addAction(action) + cameraGroup.addAction(action) + def buildContextMenu(self): self.contextMenu = QMenu(self) self.buildContextMenu_Renderer(self.contextMenu) self.buildContextMenu_Complexity(self.contextMenu) self.buildContextMenu_ShadingMode(self.contextMenu) self.buildContextMenu_DisplayPurposes(self.contextMenu) + self.buildContextMenu_Camera(self.contextMenu) def closeEvent(self, event): From dfbe07148347a5f07adef5169cd39f7342cff529 Mon Sep 17 00:00:00 2001 From: Piotr Mintus Date: Wed, 16 Jun 2021 06:59:49 -0700 Subject: [PATCH 08/15] Adding Python's PythonPath into the process environment Extracting PythonPath from the registry and applying it in the environment. --- UsdShellExtension/Module.cpp | 2 +- shared/environment.cpp | 53 +++++++++++++++++++++++++++++++----- shared/environment.h | 3 +- 3 files changed, 49 insertions(+), 9 deletions(-) diff --git a/UsdShellExtension/Module.cpp b/UsdShellExtension/Module.cpp index 27728a3..55d40ef 100644 --- a/UsdShellExtension/Module.cpp +++ b/UsdShellExtension/Module.cpp @@ -75,7 +75,7 @@ static bool GetPythonInstallationPath( LPTSTR sBuffer, DWORD nBufferSizeInChars if (sBuffer[0] == '\0') { - bool bResult = GetPythonInstallationPathFromRegistry( sBuffer, nBufferSizeInChars ); + bool bResult = GetPythonInstallPathFromRegistry( sBuffer, nBufferSizeInChars ); #if (PY_MAJOR_VERSION == 2) && (PY_MINOR_VERSION == 7) if (bResult == false) { diff --git a/shared/environment.cpp b/shared/environment.cpp index 0786b51..ad2a183 100644 --- a/shared/environment.cpp +++ b/shared/environment.cpp @@ -97,7 +97,7 @@ static CStringW AppendEnvironmentVariable( LPCWSTR sEnvironmentVariable, LPCWSTR return sSetBuffer; } -bool GetPythonInstallationPathFromRegistry( LPTSTR sBuffer, DWORD nBufferSizeInChars ) +bool GetPythonInstallPathFromRegistry( LPTSTR sBuffer, DWORD nBufferSizeInChars ) { CString sPythonRegKeyInstallPath; sPythonRegKeyInstallPath.Format( _T("SOFTWARE\\Python\\PythonCore\\%hs\\InstallPath"), _CRT_STRINGIZE(PYTHONVERSION) ); @@ -123,6 +123,32 @@ bool GetPythonInstallationPathFromRegistry( LPTSTR sBuffer, DWORD nBufferSizeInC return true; } +bool GetPythonPythonPathFromRegistry( LPTSTR sBuffer, DWORD nBufferSizeInChars ) +{ + CString sPythonRegKeyPythonPath; + sPythonRegKeyPythonPath.Format( _T("SOFTWARE\\Python\\PythonCore\\%hs\\PythonPath"), _CRT_STRINGIZE(PYTHONVERSION) ); + + LSTATUS ls; + + CRegKey regPythonPythonPath; + ls = regPythonPythonPath.Open( HKEY_CURRENT_USER, sPythonRegKeyPythonPath, KEY_READ ); + if (ls != ERROR_SUCCESS) + { + ls = regPythonPythonPath.Open( HKEY_LOCAL_MACHINE, sPythonRegKeyPythonPath, KEY_READ ); + if (ls != ERROR_SUCCESS) + { + return false; + } + } + + ULONG nChars = nBufferSizeInChars; + ls = regPythonPythonPath.QueryStringValue( _T(""), sBuffer, &nChars ); + if (ls != ERROR_SUCCESS) + return false; + + return true; +} + static void SetupPathEnvironmentVariable(LPCWSTR sUSD_Path, LPCWSTR sPython_Path) { CStringW sSetBuffer; @@ -130,14 +156,14 @@ static void SetupPathEnvironmentVariable(LPCWSTR sUSD_Path, LPCWSTR sPython_Path if ( sPython_Path[0] == '\0' ) { TCHAR sValue[512]; - bool bFound = GetPythonInstallationPathFromRegistry( sValue, ARRAYSIZE(sValue) ); + bool bFound = GetPythonInstallPathFromRegistry( sValue, ARRAYSIZE(sValue) ); #if (PY_MAJOR_VERSION == 2) && (PY_MINOR_VERSION == 7) if (bFound == false) { _tcscpy_s(sValue, ARRAYSIZE(sValue), _T("C:\\Python27\\")); - DWORD nAttribs = ::GetFileAttributes(sBuffer); + DWORD nAttribs = ::GetFileAttributes(sValue); if ((nAttribs != INVALID_FILE_ATTRIBUTES) && (nAttribs & FILE_ATTRIBUTE_DIRECTORY)) - bResult = true; + bFound = true; } #endif if (bFound) @@ -164,9 +190,22 @@ static void SetupPathEnvironmentVariable(LPCWSTR sUSD_Path, LPCWSTR sPython_Path static void SetupPythonPathEnvironmentVariable(LPCWSTR sUSD_PythonPath, LPCWSTR sPython_PythonPath) { CStringW sSetBuffer = sUSD_PythonPath; - if ( !sSetBuffer.IsEmpty() ) - sSetBuffer += L";"; - sSetBuffer += sPython_PythonPath; + + if (sPython_PythonPath[0] == '\0') + { + TCHAR sValue[1024]; + bool bFound = GetPythonPythonPathFromRegistry(sValue, ARRAYSIZE(sValue)); + if (bFound) + { + if (!sSetBuffer.IsEmpty()) + sSetBuffer += L";"; + sSetBuffer += sValue; + } + } + else + { + sSetBuffer += sPython_PythonPath; + } g_UsdPythonPath = AppendEnvironmentVariable( L"PYTHONPATH", sSetBuffer ); } diff --git a/shared/environment.h b/shared/environment.h index e9c363d..b8e7a86 100644 --- a/shared/environment.h +++ b/shared/environment.h @@ -25,4 +25,5 @@ const CStringW &GetUsdEditor(); std::vector BuildConfigFileList( HMODULE hCurrentModule ); void GetPrivateProfileStringAndExpandEnvironmentStrings( LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpDefault, CStringW &lpReturnedString, const std::vector &ConfigFileList ); -bool GetPythonInstallationPathFromRegistry( LPTSTR sBuffer, DWORD nBufferSizeInChars ); +bool GetPythonInstallPathFromRegistry( LPTSTR sBuffer, DWORD nBufferSizeInChars ); +bool GetPythonPythonPathFromRegistry( LPTSTR sBuffer, DWORD nBufferSizeInChars ); From 515b7f956a0053acd5d3741cff73fe2cc1a60033 Mon Sep 17 00:00:00 2001 From: Piotr Mintus Date: Wed, 16 Jun 2021 07:01:52 -0700 Subject: [PATCH 09/15] Adding Python configuration page to installer Similar to the existing USD configuration page but for configuring Python. --- UsdShellExtensionInstaller/PythonPathPage.nsh | 79 +++++++++++++++++++ .../UsdShellExtensionInstaller.nsi | 2 + 2 files changed, 81 insertions(+) create mode 100644 UsdShellExtensionInstaller/PythonPathPage.nsh diff --git a/UsdShellExtensionInstaller/PythonPathPage.nsh b/UsdShellExtensionInstaller/PythonPathPage.nsh new file mode 100644 index 0000000..27980f1 --- /dev/null +++ b/UsdShellExtensionInstaller/PythonPathPage.nsh @@ -0,0 +1,79 @@ +;-------------------------------- +; UsdPathPage + +Var hWndPythonPathDlg +Var hWndPythonPathEditPath +Var hWndPythonPathEditPythonPath +Var hWndPythonPathButtonBuild + +Function PythonPathPage + !insertmacro MUI_HEADER_TEXT "Python ${PYTHON_VERSION}" "Please set the following Python ${PYTHON_VERSION} environment variables." + + nsDialogs::Create 1018 + Pop $hWndPythonPathDlg + + ${If} $hWndPythonPathDlg == error + Abort + ${EndIf} + + SetShellVarContext all + + ${NSD_CreateLabel} 0 0 100% 10u "PATH" + !insertmacro ReadConfigFile "$LOCALAPPDATA\Activision\UsdShellExtension\UsdShellExtension.ini" "Python" "PATH" "" + Pop $R0 + ${If} $R0 == "" + ReadRegStr $R0 HKCU "SOFTWARE\Python\PythonCore\${PYTHON_VERSION}\InstallPath" "" + ${If} $R0 == "" + ReadRegStr $R0 HKLM "SOFTWARE\Python\PythonCore\${PYTHON_VERSION}\InstallPath" "" + ${EndIf} + ${EndIf} + ${NSD_CreateText} 0 10u 100% 12u $R0 + Pop $hWndPythonPathEditPath + + ${NSD_CreateLabel} 0 28u 100% 10u "PYTHONPATH" + !insertmacro ReadConfigFile "$LOCALAPPDATA\Activision\UsdShellExtension\UsdShellExtension.ini" "Python" "PYTHONPATH" "" + Pop $R0 + ${If} $R0 == "" + ReadRegStr $R0 HKCU "SOFTWARE\Python\PythonCore\${PYTHON_VERSION}\PythonPath" "" + ${If} $R0 == "" + ReadRegStr $R0 HKLM "SOFTWARE\Python\PythonCore\${PYTHON_VERSION}\PythonPath" "" + ${EndIf} + ${EndIf} + ${NSD_CreateText} 0 38u 100% 12u $R0 + Pop $hWndPythonPathEditPythonPath + + ${NSD_CreateButton} -140u 62u 140u 15u "Set using root Python ${PYTHON_VERSION} folder" + Pop $hWndPythonPathButtonBuild + ${NSD_OnClick} $hWndPythonPathButtonBuild PythonPathPageBuildClick + + nsDialogs::Show +FunctionEnd + +Function PythonPathPageLeave + SetShellVarContext all + + ${NSD_GetText} $hWndPythonPathEditPath $0 + + IfFileExists "$0\python.exe" PythonFound + MessageBox MB_ICONSTOP|MB_OK "Python.exe was not found at $0" + Abort + +PythonFound: + !insertmacro WriteConfigFile "$LOCALAPPDATA\Activision\UsdShellExtension\UsdShellExtension.ini" "Python" "PATH" $0 + + ${NSD_GetText} $hWndPythonPathEditPythonPath $0 + !insertmacro WriteConfigFile "$LOCALAPPDATA\Activision\UsdShellExtension\UsdShellExtension.ini" "Python" "PYTHONPATH" $0 + +FunctionEnd + +Function PythonPathPageBuildClick + + nsDialogs::SelectFolderDialog "Select root folder of Python ${PYTHON_VERSION} installation" + Pop $R0 + + ${If} $R0 != error + ${NSD_SetText} $hWndPythonPathEditPath "$R0" + ${NSD_SetText} $hWndPythonPathEditPythonPath "$R0\Lib\;$R0\DLLs\" + ${EndIf} + +FunctionEnd diff --git a/UsdShellExtensionInstaller/UsdShellExtensionInstaller.nsi b/UsdShellExtensionInstaller/UsdShellExtensionInstaller.nsi index 30c4a76..f39adeb 100644 --- a/UsdShellExtensionInstaller/UsdShellExtensionInstaller.nsi +++ b/UsdShellExtensionInstaller/UsdShellExtensionInstaller.nsi @@ -83,12 +83,14 @@ InstallDirRegKey HKLM "Software\Activision\UsdShellExtension" "Install_Dir" ;-------------------------------- ;Pages +!include "${__FILEDIR__}\PythonPathPage.nsh" !include "${__FILEDIR__}\UsdPathPage.nsh" !include "${__FILEDIR__}\UsdConfigPage.nsh" !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_LICENSE "LICENSE.txt" !insertmacro MUI_PAGE_INSTFILES +Page custom PythonPathPage PythonPathPageLeave Page custom USDPathPage USDPathPageLeave Page custom USDConfigPage USDConfigPageLeave !insertmacro MUI_PAGE_FINISH From 093f46f91d82effa10b1181918b81399207b26bc Mon Sep 17 00:00:00 2001 From: Piotr Mintus Date: Wed, 16 Jun 2021 07:02:40 -0700 Subject: [PATCH 10/15] Enabling optimizations on the UsdShellExtension project --- UsdShellExtension/UsdShellExtension.vcxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/UsdShellExtension/UsdShellExtension.vcxproj b/UsdShellExtension/UsdShellExtension.vcxproj index 0c0d94c..3b0caed 100644 --- a/UsdShellExtension/UsdShellExtension.vcxproj +++ b/UsdShellExtension/UsdShellExtension.vcxproj @@ -168,8 +168,8 @@ mc -h %(RelativeDir) %(FullPath) $(SolutionDir);$(PythonHome)include;$(OutDir);%(AdditionalIncludeDirectories) Use true - Disabled - Disabled + AnySuitable + MaxSpeed Windows From c50d503abbc6bf472adada8729df2907ad05439b Mon Sep 17 00:00:00 2001 From: Piotr Mintus Date: Wed, 16 Jun 2021 07:16:28 -0700 Subject: [PATCH 11/15] Pushing monolithic build to USD 21.05 --- usd-monolithic.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usd-monolithic.props b/usd-monolithic.props index 572c9ad..c467b2d 100644 --- a/usd-monolithic.props +++ b/usd-monolithic.props @@ -20,7 +20,7 @@ monolithic - 21.02 + 21.05 From 5e068983750c6908c6a16543090580d373e0e071 Mon Sep 17 00:00:00 2001 From: Piotr Mintus Date: Wed, 16 Jun 2021 09:02:16 -0700 Subject: [PATCH 12/15] Fix for Edit command launching in the background Propagating AllowSetForegroundWindow --- UsdSdkToolsServer/UsdSdkToolsImpl.cpp | 2 ++ UsdShellExtension/ShellExecute.cpp | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/UsdSdkToolsServer/UsdSdkToolsImpl.cpp b/UsdSdkToolsServer/UsdSdkToolsImpl.cpp index 088813e..73aad4c 100644 --- a/UsdSdkToolsServer/UsdSdkToolsImpl.cpp +++ b/UsdSdkToolsServer/UsdSdkToolsImpl.cpp @@ -156,6 +156,8 @@ STDMETHODIMP CUsdSdkToolsImpl::Edit( IN BSTR usdStagePath, IN VARIANT_BOOL force return E_FAIL; } + ::AllowSetForegroundWindow( pi.dwProcessId ); + ::WaitForSingleObject( pi.hProcess, INFINITE ); ::CloseHandle( pi.hProcess ); diff --git a/UsdShellExtension/ShellExecute.cpp b/UsdShellExtension/ShellExecute.cpp index b502c6c..4726db0 100644 --- a/UsdShellExtension/ShellExecute.cpp +++ b/UsdShellExtension/ShellExecute.cpp @@ -201,6 +201,8 @@ void CALLBACK EditInUsdEditW( HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, in if ( FAILED( hr ) ) return; + ::CoAllowSetForegroundWindow( pUSDTools, nullptr ); + hr = pUSDTools->Edit( CComBSTR(args.argv[0]), VARIANT_FALSE ); if ( FAILED( hr ) ) { @@ -276,6 +278,8 @@ void CALLBACK PackageDefaultW( HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, i wcscpy_s( sOutputFile, args.argv[0] ); PathCchRenameExtension( sOutputFile, ARRAYSIZE( sOutputFile ), L"usdz" ); + ::CoAllowSetForegroundWindow( pUSDTools, nullptr ); + hr = pUSDTools->Package( CComBSTR(args.argv[0]), CComBSTR(sOutputFile), UsdSdkToolsLib::USD_PACKAGE_DEFAULT, VARIANT_TRUE ); if ( FAILED( hr ) ) { @@ -312,6 +316,8 @@ void CALLBACK PackageARKitW( HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int wcscpy_s( sOutputFile, args.argv[0] ); PathCchRenameExtension( sOutputFile, ARRAYSIZE( sOutputFile ), L"usdz" ); + ::CoAllowSetForegroundWindow( pUSDTools, nullptr ); + hr = pUSDTools->Package( CComBSTR(args.argv[0]), CComBSTR(sOutputFile), UsdSdkToolsLib::USD_FORMAT_APPLE_ARKIT, VARIANT_TRUE ); if ( FAILED( hr ) ) { @@ -345,6 +351,8 @@ void CALLBACK StageStatsW( HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int n if ( FAILED( hr ) ) return; + ::CoAllowSetForegroundWindow( pUSDTools, nullptr ); + hr = pUSDTools->DisplayStageStats( CComBSTR(args.argv[0]) ); if ( FAILED( hr ) ) { From 26bbe7aaab8a15fee6d21f1455235faef5318df2 Mon Sep 17 00:00:00 2001 From: Piotr Mintus Date: Wed, 16 Jun 2021 09:10:17 -0700 Subject: [PATCH 13/15] Update PythonPathPage.nsh Removing incorrect comment header --- UsdShellExtensionInstaller/PythonPathPage.nsh | 2 -- 1 file changed, 2 deletions(-) diff --git a/UsdShellExtensionInstaller/PythonPathPage.nsh b/UsdShellExtensionInstaller/PythonPathPage.nsh index 27980f1..42c3c65 100644 --- a/UsdShellExtensionInstaller/PythonPathPage.nsh +++ b/UsdShellExtensionInstaller/PythonPathPage.nsh @@ -1,5 +1,3 @@ -;-------------------------------- -; UsdPathPage Var hWndPythonPathDlg Var hWndPythonPathEditPath From 6be33cddc0c81876cce2a2c8b4c2e648b7f1730c Mon Sep 17 00:00:00 2001 From: Piotr Mintus Date: Wed, 23 Jun 2021 17:12:18 -0700 Subject: [PATCH 14/15] Setting OutputItemType for EventViewerMessages Setting to CLInclude to hopefully have EventViewerMessages project complete before dependent projects start compiling. --- shared/EventViewerMessages.vcxproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shared/EventViewerMessages.vcxproj b/shared/EventViewerMessages.vcxproj index 9162078..05b5147 100644 --- a/shared/EventViewerMessages.vcxproj +++ b/shared/EventViewerMessages.vcxproj @@ -62,6 +62,8 @@ mc %(FullPath) mc %(FullPath) Compiling Messages... %(Filename).rc;%(Filename).h;MSG00409.bin + ClInclude + ClInclude From 33b89d2f38694dfbd98dc321aaa1865c774d2a66 Mon Sep 17 00:00:00 2001 From: Piotr Mintus Date: Wed, 23 Jun 2021 17:12:54 -0700 Subject: [PATCH 15/15] Update INSTALLING.md Showing all Python search locations --- docs/INSTALLING.md | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/docs/INSTALLING.md b/docs/INSTALLING.md index a7cf2e0..7e2a459 100644 --- a/docs/INSTALLING.md +++ b/docs/INSTALLING.md @@ -73,19 +73,26 @@ Troubleshooting **Python** -By default, the shell extension will try to automatically locate a Python install. The Python 3.x installers from python.org will install registry keys that can be used to locate Python. +By default, the shell extension will try to automatically locate a Python install. Python installers from python.org will install registry keys that can be used to locate Python. -| Python Version | Search Location | -|- |- | -| 2.7 | C:\Python27 | -| 3.6 | HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\3.6\InstallPath | -| 3.7 | HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\3.7\InstallPath | +The Python install location is searched in the order listed in the table below. + +| Python Version | Search Location | +|- |- | +| 2.7 | HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\2.7\InstallPath | +| | HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.7\InstallPath | +| | C:\Python27 | +| 3.6 | HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\3.6\InstallPath | +| | HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\3.6\InstallPath | +| 3.7 | HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\3.7\InstallPath | +| | HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\3.7\InstallPath | If the Python install is not found at these locations, then it needs to be set explicitly using the `UsdShellExtension.ini` file. ``` [PYTHON] -PATH=C:\Python37 +PATH=C:\Python36\ +PYTHONPATH=C:\Python36\Lib\;C:\Python36\DLLs\ ``` **Event Viewer**