├── .gitignore ├── Activision-Corporate-CLA-USD-Shell-Extension.pdf ├── Activision-Individual-CLA-USD-Shell-Extension.pdf ├── BUILDING.md ├── CONTRIBUTING.txt ├── LICENSE.txt ├── NOTICE.txt ├── README.md ├── UsdPreviewHandlerPython ├── Module.cpp ├── Module.h ├── StageViewWnd.cpp ├── StageViewWnd.h ├── UsdPreviewHandlerEvent.h ├── UsdPreviewHandlerMgr.cpp ├── UsdPreviewHandlerMgr.h ├── UsdPreviewHandlerPython.rc ├── UsdPreviewHandlerPython.vcxproj ├── UsdPreviewHandlerPython.vcxproj.filters ├── pyUsdPreviewHandler.cpp ├── resource.h ├── stdafx.cpp └── stdafx.h ├── UsdPreviewHandlerServer ├── Module.cpp ├── Module.h ├── UsdPreviewHandlerImpl.cpp ├── UsdPreviewHandlerImpl.h ├── UsdPreviewHandlerImpl.rgs ├── UsdPreviewHandlerPython.py ├── UsdPreviewLocalServer.idl ├── UsdPreviewLocalServer.rc ├── UsdPreviewLocalServer.vcxproj ├── UsdPreviewLocalServer.vcxproj.filters ├── UsdPreviewLocalServerModule.rgs ├── UsdPreviewThread.cpp ├── UsdPreviewThread.h ├── resource.h ├── stdafx.cpp └── stdafx.h ├── UsdPythonToolsServer ├── Module.cpp ├── Module.h ├── UsdPythonToolsImpl.cpp ├── UsdPythonToolsImpl.h ├── UsdPythonToolsImpl.rgs ├── UsdPythonToolsLocalServer.idl ├── UsdPythonToolsLocalServer.rc ├── UsdPythonToolsLocalServer.vcxproj ├── UsdPythonToolsLocalServer.vcxproj.filters ├── UsdPythonToolsLocalServerModule.rgs ├── UsdThumbnail.py ├── resource.h ├── stdafx.cpp └── stdafx.h ├── UsdSdkToolsServer ├── Module.cpp ├── Module.h ├── UsdSdkToolsImpl.cpp ├── UsdSdkToolsImpl.h ├── UsdSdkToolsImpl.rgs ├── UsdSdkToolsLocalServer.idl ├── UsdSdkToolsLocalServer.rc ├── UsdSdkToolsLocalServer.vcxproj ├── UsdSdkToolsLocalServer.vcxproj.filters ├── UsdSdkToolsLocalServerModule.rgs ├── resource.h ├── stdafx.cpp └── stdafx.h ├── UsdShellExtension.sln ├── UsdShellExtension ├── ArResolverShellExtension.cpp ├── ArResolverShellExtension.h ├── Module.cpp ├── Module.h ├── ShellExecute.cpp ├── ShellExt.def ├── ShellExt.idl ├── ShellExt.rc ├── ShellExtModule.rgs ├── ShellPreviewHandlerImpl.cpp ├── ShellPreviewHandlerImpl.h ├── ShellPreviewHandlerImpl.rgs ├── ShellPropertyStoreImpl.cpp ├── ShellPropertyStoreImpl.h ├── ShellPropertyStoreImpl.rgs ├── ShellThumbnailProviderImpl.cpp ├── ShellThumbnailProviderImpl.h ├── ShellThumbnailProviderImpl.rgs ├── USDLogoLrgWithAlpha.png ├── UWPProgressBar.cpp ├── UWPProgressBar.h ├── UsdLoadScreenDlg.cpp ├── UsdLoadScreenDlg.h ├── UsdMetadata.cpp ├── UsdMetadata.h ├── UsdPropertyKeys.h ├── UsdPropertyKeys.propdesc ├── UsdShellExtension-monolithic.manifest ├── UsdShellExtension-shared.manifest ├── UsdShellExtension.ini ├── UsdShellExtension.vcxproj ├── UsdShellExtension.vcxproj.filters ├── logo.png ├── plugInfo.json ├── register.bat ├── resource.h ├── stdafx.cpp ├── stdafx.h ├── unregister.bat └── usd.ico ├── UsdShellExtensionInstaller ├── CmdLineArgs.nsh ├── RestartManager.nsh ├── ShellLinkSetRunAs.nsh ├── UsdConfigPage.nsh ├── UsdConfigUtils.nsh ├── UsdPathPage.nsh ├── UsdShellExtensionInstaller.nsi ├── UsdShellExtensionInstaller.vcxproj └── UsdShellExtensionInstaller.vcxproj.filters ├── atviversion.h ├── atviversion.props ├── atviversion.rc2 ├── boost.props ├── docs ├── DEPLOYMENT.md ├── DESIGN.md ├── EventViewer.png ├── FEATURES.md ├── INSTALLING.md ├── edit.png ├── preview.png ├── search.png ├── thumbnails.png ├── usdcat.png └── usdview.png ├── nsis.props ├── python.props ├── shared ├── EventViewerLog.h ├── EventViewerMessages.mc ├── EventViewerMessages.vcxproj ├── EventViewerMessages.vcxproj.filters ├── PythonUtil.h ├── emb.cpp ├── emb.h ├── environment.cpp ├── environment.h ├── installerWelcome.bmp └── usd.ico ├── usd-monolithic.props ├── usd-shared.props └── usd.props /.gitignore: -------------------------------------------------------------------------------- 1 | .vs/ 2 | bin/ 3 | build/ 4 | *.aps 5 | *.user 6 | *_h.h 7 | *_i.c 8 | *_p.c 9 | dlldata.c 10 | EventViewerMessages.h 11 | EventViewerMessages.rc 12 | MSG00409.bin 13 | -------------------------------------------------------------------------------- /Activision-Corporate-CLA-USD-Shell-Extension.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Activision/USDShellExtension/b7655b9436f24edb28cb8079386e9a3aa43b15a3/Activision-Corporate-CLA-USD-Shell-Extension.pdf -------------------------------------------------------------------------------- /Activision-Individual-CLA-USD-Shell-Extension.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Activision/USDShellExtension/b7655b9436f24edb28cb8079386e9a3aa43b15a3/Activision-Individual-CLA-USD-Shell-Extension.pdf -------------------------------------------------------------------------------- /BUILDING.md: -------------------------------------------------------------------------------- 1 | ACTIVISION USD SHELL EXTENSION 2 | ============================== 3 | 4 | 5 | ## Dependencies 6 | 7 | * Boost 8 | * Python (2.7, 3.6, 3.7) 9 | * USD SDK 10 | * Windows 10 SDK 11 | * Visual Studio 2017+ 12 | * ATL 13 | * Python C++ Tools 14 | 15 | #### Boost 16 | 17 | `boost.props` 18 | 19 | Boost is required for Boost.Python. It is used to build a python extension module. The boost 20 | compilation must match the version of MSVC and Python used by the shell extension. 21 | 22 | #### Python 23 | 24 | `python.props` 25 | 26 | Currently only Python 2.7, 3.6, and 3.7 are supported. The USD SDK does not currently support Python 3.8+ on Windows. 27 | 28 | #### USD SDK 29 | 30 | `usd.props` 31 | 32 | The shell extension requires a bare-bones monolithic build of the USD SDK. The monolithic build 33 | is a single DLL which makes it easier to isolate it into its own activation context in Windows Explorer. 34 | 35 | The shell extension is currently set up to build against a build of USD that does not use Python. 36 | The shell extension is injected into Windows Explorer which is also the process that runs 37 | the Windows Desktop. We want to keep as much out of that process as we can. 38 | 39 | ``` 40 | python.exe build_scripts\build_usd.py d:\USD-monolithic-bare --build-monolithic --no-tests --no-examples --no-tutorials --no-tools --no-docs --no-python --no-imaging --no-ptex --no-openvdb --no-usdview --no-embree --no-prman --no-openimageio --no-opencolorio --no-alembic --no-hdf5 --no-draco --no-materialx 41 | ``` 42 | 43 | #### Windows 10 SDK 44 | 45 | Windows 10 SDK 10.0.14393.0 or higher is required to build the shell extension. This requirement is only 46 | due to High DPI support. It would be possible to remove High DPI support and compile the shell extension 47 | for Windows 7. 48 | 49 | #### Visual Studio 50 | 51 | Visual Studio is the only supported build tool at this time. 52 | 53 | The following Visual Studio components are required: 54 | 55 | - C++ ATL 56 | - Python Language Support 57 | 58 | 59 | ## Simple Build 60 | 61 | The simplest way to build the shell extension is to build two flavors of the USD SDK. The first being a 62 | bare-bones version of the SDK that is used by Windows Explorer. The second is a full version used by 63 | everything else. 64 | 65 | Bare-Bones USD SDK 66 | 67 | ``` 68 | python.exe build_scripts\build_usd.py d:\USD-monolithic-bare --build-monolithic --no-tests --no-examples --no-tutorials --no-tools --no-docs --no-python --no-imaging --no-ptex --no-openvdb --no-usdview --no-embree --no-prman --no-openimageio --no-opencolorio --no-alembic --no-hdf5 --no-draco --no-materialx 69 | ``` 70 | 71 | Full USD SDK 72 | 73 | ``` 74 | python.exe build_scripts\build_usd.py d:\USD-shared-full [--embree] [--materialx] 75 | ``` 76 | 77 | Then update the property sheets to point to these builds. 78 | 79 | `usd.props` 80 | 81 | Point this property sheet to the bare-bones USD SDK. 82 | 83 | `boost.props` 84 | 85 | Point this property sheet to the full USD SDK's version of boost. 86 | 87 | `UsdShellExtension.ini` 88 | 89 | Point the paths in this configuration file to the full USD SDK. 90 | 91 | ``` 92 | [USD] 93 | PATH=D:\USD-shared-full\bin\;D:\USD-shared-full\lib\ 94 | PYTHONPATH=D:\USD-shared-full\lib\python 95 | PXR_PLUGINPATH_NAME= 96 | ``` -------------------------------------------------------------------------------- /CONTRIBUTING.txt: -------------------------------------------------------------------------------- 1 | Thank you for your interest in USD Shell Extension. Before contributing code to the project, please sign a Contributor License Agreement (CLA). At the root of the repository you can find the two possible CLAs: 2 | 3 | Activision-Corporate-CLA-USD-Shell-Extension.pdf: for corporate contributors 4 | Activision-Individual-CLA-USD-Shell-Extension.pdf: for individual contributors 5 | 6 | Please send your signed CLAs to LegalAffairs@activision.com, making sure to include your github username in the email. Please wait for our confirmation that you're approved for contributions, after which you can submit pull requests. 7 | -------------------------------------------------------------------------------- /NOTICE.txt: -------------------------------------------------------------------------------- 1 | Activision USD Shell Extension 2 | Copyright 2021 Activision Publishing, Inc. 3 | 4 | All rights reserved. 5 | 6 | This product includes software developed at Activision Publishing, Inc. 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Activision USD Shell Extension 2 | ============================== 3 | 4 | A Windows Shell Extension for the Pixar USD file format. 5 | 6 | **Windows Explorer Features** 7 | 8 | * Hydra Realtime Preview 9 | * Thumbnails 10 | * Context Menus 11 | * Metadata Properties 12 | 13 | **Windows Search Features** 14 | 15 | * Metadata Search 16 | 17 | More details available [here](./docs/FEATURES.md). 18 | 19 | Goals 20 | ----- 21 | 22 | There are several goals that this shell extension tries to adhere to and takes extra precautions to meet. 23 | 24 | * **Performance** 25 | It is important that the shell extension not stall Windows Explorer. 26 | 27 | * **Stability** 28 | Instability in the shell extension will take down Window Explorer and/or the entire desktop. 29 | 30 | The mitigation strategy is to run the majority of the shell extension asynchronously out of the 31 | Windows Explorer process. 32 | 33 | 34 | Dependencies 35 | ------------ 36 | 37 | The following dependencies are required: 38 | 39 | * [Microsoft Visual Studio (2017 or newer)](https://visualstudio.microsoft.com/vs/) 40 | * [Universal Scene Description (USD)](https://graphics.pixar.com/usd/docs/index.html) 41 | * [Python (2.7, 3.6, 3.7)](https://www.python.org/) 42 | 43 | Required Microsoft Visual Studio Components: 44 | 45 | * Desktop development with C++ 46 | * C++ ATL 47 | * Windows 10 SDK 48 | * Windows Universal C Runtime 49 | * Python language support 50 | 51 | 52 | -------------------------------------------------------------------------------- /UsdPreviewHandlerPython/Module.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "stdafx.h" 16 | #include "Module.h" 17 | 18 | HMODULE g_hInstance; 19 | 20 | BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) 21 | { 22 | UNREFERENCED_PARAMETER( lpReserved ); 23 | 24 | switch ( ul_reason_for_call ) 25 | { 26 | case DLL_PROCESS_ATTACH: 27 | g_hInstance = hModule; 28 | break; 29 | } 30 | 31 | return TRUE; 32 | } -------------------------------------------------------------------------------- /UsdPreviewHandlerPython/Module.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | extern HMODULE g_hInstance; 18 | 19 | -------------------------------------------------------------------------------- /UsdPreviewHandlerPython/StageViewWnd.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "stdafx.h" 16 | #include "StageViewWnd.h" 17 | #include "Module.h" 18 | #include "resource.h" 19 | 20 | 21 | void CStageViewWnd::Init( HWND hWndToSubclass ) 22 | { 23 | if ( m_hWnd ) 24 | Term(); 25 | 26 | SubclassWindow( hWndToSubclass ); 27 | } 28 | 29 | void CStageViewWnd::Term() 30 | { 31 | UnsubclassWindow(); 32 | } 33 | 34 | -------------------------------------------------------------------------------- /UsdPreviewHandlerPython/StageViewWnd.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #include "resource.h" 18 | 19 | class CStageViewWnd : public CWindowImpl 20 | { 21 | public: 22 | void Init( HWND hWndToSubclass ); 23 | void Term(); 24 | 25 | private: 26 | 27 | BEGIN_MSG_MAP(CStageViewWnd) 28 | END_MSG_MAP() 29 | }; -------------------------------------------------------------------------------- /UsdPreviewHandlerPython/UsdPreviewHandlerEvent.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | enum eUsdPreviewEvent 18 | { 19 | USDPREVIEWEVENT_INVALID, 20 | USDPREVIEWEVENT_QUIT, 21 | USDPREVIEWEVENT_RESIZE, 22 | USDPREVIEWEVENT_RESIZERECT, 23 | USDPREVIEWEVENT_SETWINDOW, 24 | }; 25 | 26 | struct UsdPreviewEventData 27 | { 28 | eUsdPreviewEvent event; 29 | intptr_t data1; 30 | intptr_t data2; 31 | }; 32 | 33 | typedef void (*FNUSDPREVIEWPUSHEVENT)(eUsdPreviewEvent event, intptr_t data1, intptr_t data2); 34 | 35 | typedef HWND (*FNUSDPREVIEWGETPREVIEWWINDOW)(); -------------------------------------------------------------------------------- /UsdPreviewHandlerPython/UsdPreviewHandlerMgr.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "stdafx.h" 16 | #include "UsdPreviewHandlerMgr.h" 17 | #include "UsdPreviewHandlerEvent.h" 18 | 19 | CUsdPreviewHandlerMgr CUsdPreviewHandlerMgr::s_Singleton; 20 | 21 | UsdPreviewEventData CUsdPreviewHandlerMgr::PeekEvent() 22 | { 23 | UsdPreviewEventData eventData = {}; 24 | 25 | std::lock_guard guard(m_EventQueueMutex); 26 | if (m_EventQueue.empty()) 27 | return eventData; 28 | 29 | eventData = m_EventQueue.front(); 30 | m_EventQueue.pop(); 31 | 32 | return eventData; 33 | } 34 | 35 | void CUsdPreviewHandlerMgr::LoadComplete() 36 | { 37 | m_bLoadComplete = true; 38 | 39 | if( m_bQuit == false ) 40 | SetParent( m_hWndParent, m_hWndChild, m_hWndStageView ); 41 | } 42 | 43 | void CUsdPreviewHandlerMgr::PostEvent(eUsdPreviewEvent event, intptr_t data1, intptr_t data2) 44 | { 45 | switch (event) 46 | { 47 | case USDPREVIEWEVENT_RESIZE: 48 | OnResize(static_cast(data1), static_cast(data2)); 49 | return; 50 | case USDPREVIEWEVENT_RESIZERECT: 51 | OnResizeRect(*reinterpret_cast(data1)); 52 | return; 53 | case USDPREVIEWEVENT_SETWINDOW: 54 | OnResizeRect(*reinterpret_cast(data2)); 55 | break; 56 | case USDPREVIEWEVENT_QUIT: 57 | OnQuit(); 58 | break; 59 | } 60 | 61 | UsdPreviewEventData eventData = {}; 62 | eventData.event = event; 63 | eventData.data1 = data1; 64 | eventData.data2 = data2; 65 | 66 | std::lock_guard guard(m_EventQueueMutex); 67 | m_EventQueue.push(std::move(eventData)); 68 | } 69 | 70 | void CUsdPreviewHandlerMgr::SetParent(HWND hWndParent, HWND hWndChild, HWND hWndStageView) 71 | { 72 | if ( m_bLoadComplete ) 73 | { 74 | // The parent passed in here is actually the load screen dialog. 75 | // We want to swap the load screen dialog here with our dialog. 76 | 77 | HWND hWndLoadScreen = hWndParent; 78 | 79 | RECT rcClient; 80 | ::GetClientRect( hWndLoadScreen, &rcClient ); 81 | 82 | HWND hWndPreviewParent = ::GetParent( hWndLoadScreen ); 83 | ::SetParent( hWndChild, hWndPreviewParent ); 84 | 85 | ::SetWindowLong( hWndChild, GWL_STYLE, WS_POPUP|WS_CLIPCHILDREN ); 86 | ::SetWindowPos( hWndChild, HWND_TOP, 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top, SWP_FRAMECHANGED ); 87 | ::ShowWindow( hWndChild, SW_SHOW ); 88 | 89 | ::ShowWindow( hWndLoadScreen, SW_HIDE ); 90 | 91 | m_StageViewWnd.Init( hWndStageView ); 92 | } 93 | 94 | m_hWndParent = hWndParent; 95 | m_hWndChild = hWndChild; 96 | m_hWndStageView = hWndStageView; 97 | } 98 | 99 | void CUsdPreviewHandlerMgr::OnResize(int cx, int cy) 100 | { 101 | if (m_bLoadComplete && m_hWndChild != nullptr) 102 | ::SetWindowPos(m_hWndChild, nullptr, 0, 0, cx, cy, 0); 103 | } 104 | 105 | void CUsdPreviewHandlerMgr::OnResizeRect(const RECT& rc) 106 | { 107 | if (m_bLoadComplete && m_hWndChild != nullptr) 108 | ::SetWindowPos(m_hWndChild, nullptr, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, 0); 109 | } 110 | 111 | void CUsdPreviewHandlerMgr::OnQuit() 112 | { 113 | m_bQuit = true; 114 | 115 | // clear out our data 116 | m_hWndChild = nullptr; 117 | m_hWndParent = nullptr; 118 | m_hWndStageView = nullptr; 119 | } 120 | 121 | HWND CUsdPreviewHandlerMgr::GetPreviewWindow() const 122 | { 123 | return m_hWndChild; 124 | } 125 | 126 | bool CUsdPreviewHandlerMgr::IsValid() const 127 | { 128 | return m_hWndChild != nullptr; 129 | } 130 | 131 | // pushes an event to Python 132 | extern "C" __declspec(dllexport) 133 | void UsdPreviewPushEvent(eUsdPreviewEvent event, intptr_t data1, intptr_t data2) 134 | { 135 | CUsdPreviewHandlerMgr::GetSingleton().PostEvent(event, data1, data2); 136 | } 137 | 138 | // pushes an event to Python 139 | extern "C" __declspec(dllexport) 140 | HWND UsdPreviewGetPreviewWindow() 141 | { 142 | return CUsdPreviewHandlerMgr::GetSingleton().GetPreviewWindow(); 143 | } -------------------------------------------------------------------------------- /UsdPreviewHandlerPython/UsdPreviewHandlerMgr.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #include "UsdPreviewHandlerMgr.h" 18 | #include "UsdPreviewHandlerEvent.h" 19 | #include "StageViewWnd.h" 20 | 21 | #include 22 | #include 23 | 24 | class CUsdPreviewHandlerMgr 25 | { 26 | public: 27 | static CUsdPreviewHandlerMgr& GetSingleton(); 28 | 29 | UsdPreviewEventData PeekEvent(); 30 | void PostEvent(eUsdPreviewEvent event, intptr_t data1, intptr_t data2); 31 | 32 | void SetParent(HWND hWndParent, HWND hWndChild, HWND hWndStageView); 33 | 34 | HWND GetPreviewWindow() const; 35 | void LoadComplete(); 36 | 37 | bool IsValid() const; 38 | 39 | private: 40 | void OnResize(int cx, int cy); 41 | void OnResizeRect(const RECT& rc); 42 | void OnQuit(); 43 | 44 | static CUsdPreviewHandlerMgr s_Singleton; 45 | 46 | std::queue m_EventQueue; 47 | std::mutex m_EventQueueMutex; 48 | 49 | HWND m_hWndParent = nullptr; 50 | HWND m_hWndChild = nullptr; 51 | HWND m_hWndStageView = nullptr; 52 | 53 | bool m_bLoadComplete = false; 54 | bool m_bQuit = false; 55 | 56 | CStageViewWnd m_StageViewWnd; 57 | }; 58 | 59 | inline CUsdPreviewHandlerMgr& CUsdPreviewHandlerMgr::GetSingleton() 60 | { 61 | return s_Singleton; 62 | } -------------------------------------------------------------------------------- /UsdPreviewHandlerPython/UsdPreviewHandlerPython.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include "winres.h" 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | #undef APSTUDIO_READONLY_SYMBOLS 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // English (United States) resources 17 | 18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 19 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 20 | #pragma code_page(1252) 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "#define ATVI_VERSION_DESCRIPTION ""Activision USD Preview Python Module""\r\n" 43 | "#include ""atviversion.rc2""\r\n" 44 | "\0" 45 | END 46 | 47 | #endif // APSTUDIO_INVOKED 48 | 49 | #endif // English (United States) resources 50 | ///////////////////////////////////////////////////////////////////////////// 51 | 52 | 53 | 54 | #ifndef APSTUDIO_INVOKED 55 | ///////////////////////////////////////////////////////////////////////////// 56 | // 57 | // Generated from the TEXTINCLUDE 3 resource. 58 | // 59 | 60 | #define ATVI_VERSION_DESCRIPTION "Activision USD Preview Python Module" 61 | #include "atviversion.rc2" 62 | 63 | ///////////////////////////////////////////////////////////////////////////// 64 | #endif // not APSTUDIO_INVOKED 65 | 66 | -------------------------------------------------------------------------------- /UsdPreviewHandlerPython/UsdPreviewHandlerPython.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | Header Files 32 | 33 | 34 | Header Files 35 | 36 | 37 | 38 | 39 | Source Files 40 | 41 | 42 | Source Files 43 | 44 | 45 | Source Files 46 | 47 | 48 | Source Files 49 | 50 | 51 | Source Files 52 | 53 | 54 | 55 | 56 | Resource Files 57 | 58 | 59 | -------------------------------------------------------------------------------- /UsdPreviewHandlerPython/pyUsdPreviewHandler.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "stdafx.h" 16 | #include "UsdPreviewHandlerEvent.h" 17 | #include "UsdPreviewHandlerMgr.h" 18 | 19 | using namespace boost::python; 20 | 21 | struct UsdPreviewApp 22 | { 23 | void SetParent( uint64_t nWndParent, uint64_t nWndChild, uint64_t nWndStageView ); 24 | UsdPreviewEventData PeekEvent(); 25 | void LoadComplete(); 26 | }; 27 | 28 | BOOST_PYTHON_MODULE( UsdPreviewHandler ) 29 | { 30 | using namespace boost::python; 31 | 32 | enum_( "UsdPreviewEvent" ) 33 | .value( "NoMoreEvents", USDPREVIEWEVENT_INVALID) 34 | .value( "Quit", USDPREVIEWEVENT_QUIT) 35 | ; 36 | 37 | class_( "UsdPreviewEventData", "help", no_init ) 38 | .def_readonly("event", &UsdPreviewEventData::event) 39 | .def_readonly("data1", &UsdPreviewEventData::data1) 40 | .def_readonly("data2", &UsdPreviewEventData::data2) 41 | ; 42 | 43 | class_( "UsdPreviewApp", "help", init<>() ) 44 | .def( "SetParent", &UsdPreviewApp::SetParent ) 45 | .def( "PeekEvent", &UsdPreviewApp::PeekEvent ) 46 | .def( "LoadComplete", &UsdPreviewApp::LoadComplete ) 47 | ; 48 | } 49 | 50 | void UsdPreviewApp::SetParent( uint64_t nWndParent, uint64_t nWndChild, uint64_t nWndStageView ) 51 | { 52 | HWND hWndParent = reinterpret_cast(nWndParent); 53 | HWND hWndChild = reinterpret_cast(nWndChild); 54 | HWND hWndStageView = reinterpret_cast(nWndStageView); 55 | 56 | CUsdPreviewHandlerMgr::GetSingleton().SetParent(hWndParent, hWndChild, hWndStageView); 57 | } 58 | 59 | UsdPreviewEventData UsdPreviewApp::PeekEvent() 60 | { 61 | return CUsdPreviewHandlerMgr::GetSingleton().PeekEvent(); 62 | } 63 | 64 | void UsdPreviewApp::LoadComplete() 65 | { 66 | CUsdPreviewHandlerMgr::GetSingleton().LoadComplete(); 67 | } 68 | 69 | -------------------------------------------------------------------------------- /UsdPreviewHandlerPython/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by UsdPreviewHandlerPython.rc 4 | // 5 | 6 | // Next default values for new objects 7 | // 8 | #ifdef APSTUDIO_INVOKED 9 | #ifndef APSTUDIO_READONLY_SYMBOLS 10 | #define _APS_NEXT_RESOURCE_VALUE 103 11 | #define _APS_NEXT_COMMAND_VALUE 40012 12 | #define _APS_NEXT_CONTROL_VALUE 1001 13 | #define _APS_NEXT_SYMED_VALUE 101 14 | #endif 15 | #endif 16 | -------------------------------------------------------------------------------- /UsdPreviewHandlerPython/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "stdafx.h" -------------------------------------------------------------------------------- /UsdPreviewHandlerPython/stdafx.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #pragma warning(push) 18 | #pragma warning(disable: 4244 4459) 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #pragma warning(pop) 26 | 27 | #include 28 | 29 | #define WIN32_LEAN_AND_MEAN 30 | #include 31 | #include 32 | #include 33 | 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include -------------------------------------------------------------------------------- /UsdPreviewHandlerServer/Module.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "stdafx.h" 16 | #include "Module.h" 17 | 18 | HMODULE g_hInstance; 19 | CUSDPreviewLocalServerModule g_AtlModule; 20 | 21 | extern "C" int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nShowCmd) 22 | { 23 | UNREFERENCED_PARAMETER( hPrevInstance ); 24 | UNREFERENCED_PARAMETER( lpCmdLine ); 25 | UNREFERENCED_PARAMETER( nShowCmd ); 26 | 27 | g_hInstance = hInstance; 28 | 29 | int nResult = g_AtlModule.WinMain( nShowCmd ); 30 | 31 | return nResult; 32 | } 33 | 34 | 35 | -------------------------------------------------------------------------------- /UsdPreviewHandlerServer/Module.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #include "USDPreviewLocalServer_h.h" 18 | #include "resource.h" 19 | 20 | // Using an ATL module here because it removes a lot of the 21 | // boiler-plate COM work that we would have to implement ourselves. 22 | 23 | class CUSDPreviewLocalServerModule : public CAtlExeModuleT 24 | { 25 | public: 26 | DECLARE_LIBID( LIBID_USDPreview ) 27 | DECLARE_REGISTRY_APPID_RESOURCEID( IDR_REGISTRY_MODULE, "{067AAB34-285D-40D1-92EF-A5ED449EFEEE}" ) 28 | 29 | // Override CAtlExeModuleT::PreMessageLoop to change REGCLS_MULTIPLEUSE to REGCLS_SINGLEUSE. 30 | // REGCLS_SINGLEUSE will create a new Windows process for every instance of our COM classes, 31 | // REGCLS_MULTIPLEUSE will reuse the same Windows process. 32 | HRESULT PreMessageLoop( _In_ int /*nShowCmd*/ ) throw() 33 | { 34 | HRESULT hr = S_OK; 35 | CUSDPreviewLocalServerModule* pT = static_cast(this); 36 | 37 | #ifndef _ATL_NO_COM_SUPPORT 38 | hr = pT->RegisterClassObjects(CLSCTX_LOCAL_SERVER, 39 | REGCLS_SINGLEUSE | // <- !!! 40 | REGCLS_SUSPENDED); 41 | 42 | if (FAILED(hr)) 43 | return hr; 44 | 45 | if (hr == S_OK) 46 | { 47 | if (m_bDelayShutdown) 48 | { 49 | CHandle h(pT->StartMonitor()); 50 | if (h.m_h == NULL) 51 | { 52 | hr = E_FAIL; 53 | } 54 | else 55 | { 56 | hr = CoResumeClassObjects(); 57 | ATLASSERT(SUCCEEDED(hr)); 58 | if (FAILED(hr)) 59 | { 60 | ::SetEvent(m_hEventShutdown); // tell monitor to shutdown 61 | ::WaitForSingleObject(h, m_dwTimeOut * 2); 62 | } 63 | } 64 | } 65 | else 66 | { 67 | hr = CoResumeClassObjects(); 68 | ATLASSERT(SUCCEEDED(hr)); 69 | } 70 | 71 | if (FAILED(hr)) 72 | pT->RevokeClassObjects(); 73 | } 74 | else 75 | { 76 | m_bDelayShutdown = false; 77 | } 78 | 79 | #endif // _ATL_NO_COM_SUPPORT 80 | 81 | ATLASSERT(SUCCEEDED(hr)); 82 | return hr; 83 | } 84 | }; 85 | 86 | extern CUSDPreviewLocalServerModule g_AtlModule; 87 | extern HMODULE g_hInstance; 88 | 89 | -------------------------------------------------------------------------------- /UsdPreviewHandlerServer/UsdPreviewHandlerImpl.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #include "USDPreviewLocalServer_h.h" 18 | #include "USDPreviewThread.h" 19 | #include "UsdPreviewHandlerPython\UsdPreviewHandlerEvent.h" 20 | 21 | #include "resource.h" 22 | 23 | class CPreviewHandlerFrameInfo : public PREVIEWHANDLERFRAMEINFO 24 | { 25 | public: 26 | CPreviewHandlerFrameInfo() 27 | { 28 | haccel = nullptr; 29 | cAccelEntries = 0; 30 | } 31 | 32 | ~CPreviewHandlerFrameInfo() 33 | { 34 | Term(); 35 | } 36 | 37 | void Term() 38 | { 39 | if ( haccel ) 40 | { 41 | DestroyAcceleratorTable( haccel ); 42 | haccel = nullptr; 43 | } 44 | } 45 | }; 46 | 47 | class ATL_NO_VTABLE CUsdPreviewHandlerImpl : 48 | public CComObjectRootEx, 49 | public CComCoClass, 50 | public IInitializeWithFile, 51 | public IObjectWithSite, 52 | public IOleWindow, 53 | public IPreviewHandler, 54 | public IPreviewHandlerVisuals 55 | { 56 | public: 57 | DECLARE_NOT_AGGREGATABLE(CUsdPreviewHandlerImpl) 58 | DECLARE_PROTECT_FINAL_CONSTRUCT() 59 | 60 | BEGIN_COM_MAP(CUsdPreviewHandlerImpl) 61 | COM_INTERFACE_ENTRY(IInitializeWithFile) 62 | COM_INTERFACE_ENTRY(IObjectWithSite) 63 | COM_INTERFACE_ENTRY(IOleWindow) 64 | COM_INTERFACE_ENTRY(IPreviewHandler) 65 | COM_INTERFACE_ENTRY(IPreviewHandlerVisuals) 66 | END_COM_MAP() 67 | 68 | HRESULT FinalConstruct(); 69 | void FinalRelease(); 70 | 71 | // IInitializeWithFile 72 | STDMETHODIMP Initialize( __RPC__in_string LPCWSTR pszFilePath, DWORD grfMode ) override; 73 | 74 | // IObjectWithSite 75 | STDMETHODIMP SetSite(__RPC__in_opt IUnknown* pUnkSite) override; 76 | STDMETHODIMP GetSite(__RPC__in REFIID riid, __RPC__deref_out_opt void** ppvSite) override; 77 | 78 | // IOleWindow 79 | STDMETHODIMP GetWindow(__RPC__deref_out_opt HWND* phwnd) override; 80 | STDMETHODIMP ContextSensitiveHelp(BOOL fEnterMode) override; 81 | 82 | // IPreviewHandler 83 | STDMETHODIMP SetWindow( __RPC__in HWND hwnd, __RPC__in const RECT* prc) override; 84 | STDMETHODIMP SetRect( __RPC__in const RECT* prc ) override; 85 | STDMETHODIMP DoPreview() override; 86 | STDMETHODIMP Unload() override; 87 | STDMETHODIMP SetFocus() override; 88 | STDMETHODIMP QueryFocus( __RPC__deref_out_opt HWND* phwnd) override; 89 | STDMETHODIMP TranslateAccelerator(__RPC__in MSG* pmsg) override; 90 | 91 | // IPreviewHandlerVisuals 92 | STDMETHODIMP SetBackgroundColor(COLORREF color) override; 93 | STDMETHODIMP SetFont(__RPC__in const LOGFONTW *plf) override; 94 | STDMETHODIMP SetTextColor(COLORREF color) override; 95 | 96 | static HRESULT WINAPI UpdateRegistry(_In_ BOOL bRegister) throw(); 97 | 98 | private: 99 | bool PushEvent(eUsdPreviewEvent event, intptr_t data1 = 0, intptr_t data2 = 0); 100 | 101 | HMODULE m_hUsdPreviewLib = nullptr; 102 | FNUSDPREVIEWPUSHEVENT m_fnUsdPreviewPushEvent = nullptr; 103 | FNUSDPREVIEWGETPREVIEWWINDOW m_fnUsdGetPreviewWindow = nullptr; 104 | CUSDPreviewThread m_PreviewThread; 105 | 106 | CStringW m_usdStagePath; 107 | 108 | CComPtr m_pSite; 109 | CComPtr m_pPreviewHandlerFrame; 110 | 111 | HWND m_hWndParent = nullptr; 112 | RECT m_rcWindow = {}; 113 | CPreviewHandlerFrameInfo m_PreviewHandlerFrameInfo; 114 | 115 | COLORREF m_clrBackground; 116 | COLORREF m_clrText; 117 | }; 118 | 119 | OBJECT_ENTRY_AUTO(__uuidof(USDPreviewHandler), CUsdPreviewHandlerImpl) 120 | 121 | -------------------------------------------------------------------------------- /UsdPreviewHandlerServer/UsdPreviewHandlerImpl.rgs: -------------------------------------------------------------------------------- 1 | HKCR 2 | { 3 | NoRemove CLSID 4 | { 5 | ForceRemove %CLSID_USDPREVIEWHANDLER% = s 'Activision USD Preview Handler Server' 6 | { 7 | LocalServer32 = s '%MODULE%' 8 | val AppID = s '%APPID%' 9 | } 10 | } 11 | } 12 | 13 | -------------------------------------------------------------------------------- /UsdPreviewHandlerServer/UsdPreviewLocalServer.idl: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import "oaidl.idl"; 16 | import "ocidl.idl"; 17 | import "ShObjIdl.idl"; 18 | 19 | [ 20 | uuid(68DF0FAC-996B-4933-B092-9733E77061BB), 21 | helpstring("USDPreview Type Library"), 22 | version(1.0), 23 | ] 24 | library USDPreview 25 | { 26 | [ 27 | uuid(07D4D38F-9C98-48F8-A057-26241405D5C8), 28 | helpstring("USD IPreviewHandler Server implementation") 29 | ] 30 | coclass USDPreviewHandler 31 | { 32 | [default] interface IPreviewHandler; 33 | } 34 | }; -------------------------------------------------------------------------------- /UsdPreviewHandlerServer/UsdPreviewLocalServer.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include "winres.h" 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | #undef APSTUDIO_READONLY_SYMBOLS 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // English (United States) resources 17 | 18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 19 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 20 | #pragma code_page(1252) 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "1 TYPELIB ""USDPreviewLocalServer.tlb""\r\n" 42 | "\r\n" 43 | "#define ATVI_VERSION_DESCRIPTION ""Activision USD Preview Server""\r\n" 44 | "#include ""atviversion.rc2""\r\n" 45 | "\0" 46 | END 47 | 48 | #endif // APSTUDIO_INVOKED 49 | 50 | 51 | ///////////////////////////////////////////////////////////////////////////// 52 | // 53 | // REGISTRY 54 | // 55 | 56 | IDR_REGISTRY_MODULE REGISTRY "USDPreviewLocalServerModule.rgs" 57 | 58 | IDR_REGISTRY_USDPREVIEWHANDLERIMPL REGISTRY "USDPreviewHandlerImpl.rgs" 59 | 60 | 61 | ///////////////////////////////////////////////////////////////////////////// 62 | // 63 | // Icon 64 | // 65 | 66 | // Icon with lowest ID value placed first to ensure application icon 67 | // remains consistent on all systems. 68 | IDI_ICON_USD ICON "shared\\usd.ico" 69 | 70 | 71 | ///////////////////////////////////////////////////////////////////////////// 72 | // 73 | // PYTHON 74 | // 75 | 76 | IDR_PYTHON_PREVIEWHANLDER PYTHON "UsdPreviewHandlerPython.py" 77 | 78 | #endif // English (United States) resources 79 | ///////////////////////////////////////////////////////////////////////////// 80 | 81 | 82 | 83 | #ifndef APSTUDIO_INVOKED 84 | ///////////////////////////////////////////////////////////////////////////// 85 | // 86 | // Generated from the TEXTINCLUDE 3 resource. 87 | // 88 | 1 TYPELIB "USDPreviewLocalServer.tlb" 89 | 90 | #define ATVI_VERSION_DESCRIPTION "Activision USD Preview Server" 91 | #include "atviversion.rc2" 92 | 93 | ///////////////////////////////////////////////////////////////////////////// 94 | #endif // not APSTUDIO_INVOKED 95 | 96 | -------------------------------------------------------------------------------- /UsdPreviewHandlerServer/UsdPreviewLocalServer.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {31617a27-1920-4188-aada-071adaa53b76} 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | Header Files 32 | 33 | 34 | Header Files 35 | 36 | 37 | Header Files 38 | 39 | 40 | Shared 41 | 42 | 43 | Shared 44 | 45 | 46 | Shared 47 | 48 | 49 | Shared 50 | 51 | 52 | 53 | 54 | Source Files 55 | 56 | 57 | Source Files 58 | 59 | 60 | Source Files 61 | 62 | 63 | Source Files 64 | 65 | 66 | Source Files 67 | 68 | 69 | Shared 70 | 71 | 72 | Shared 73 | 74 | 75 | 76 | 77 | Resource Files 78 | 79 | 80 | Resource Files 81 | 82 | 83 | 84 | 85 | 86 | 87 | Source Files 88 | 89 | 90 | 91 | 92 | Resource Files 93 | 94 | 95 | 96 | 97 | Shared 98 | 99 | 100 | Resource Files 101 | 102 | 103 | -------------------------------------------------------------------------------- /UsdPreviewHandlerServer/UsdPreviewLocalServerModule.rgs: -------------------------------------------------------------------------------- 1 | HKCU 2 | { 3 | NoRemove AppID 4 | { 5 | '%APPID%' = s 'USDPreviewLocalServer' 6 | 'USDPreviewLocalServer.exe' 7 | { 8 | val AppID = s '%APPID%' 9 | } 10 | } 11 | } 12 | 13 | -------------------------------------------------------------------------------- /UsdPreviewHandlerServer/UsdPreviewThread.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | class CUSDPreviewThread 18 | { 19 | public: 20 | ~CUSDPreviewThread(); 21 | 22 | bool Init(); 23 | void Term(); 24 | 25 | HRESULT LaunchPreviewWindow(HWND hWndParent, LPCTSTR pPathToUsdStage); 26 | 27 | void WaitForExit(); 28 | 29 | bool IsValid() const; 30 | 31 | private: 32 | static DWORD WINAPI ThreadProc( _In_ LPVOID lpParameter ); 33 | 34 | HANDLE m_hThread = nullptr; 35 | HWND m_hParent = 0; 36 | CString m_sPathToUsdStage; 37 | }; 38 | 39 | inline bool CUSDPreviewThread::IsValid() const 40 | { 41 | return m_hThread != nullptr; 42 | } -------------------------------------------------------------------------------- /UsdPreviewHandlerServer/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by UsdPreviewLocalServer.rc 4 | // 5 | #define IDR_REGISTRY_MODULE 101 6 | #define IDR_REGISTRY_USDPREVIEWIMPL 102 7 | #define IDR_REGISTRY_PREVIEWHANDLERIMPL 105 8 | #define IDR_REGISTRY_USDPREVIEWHANDLERIMPL 105 9 | #define IDI_ICONUSD 106 10 | #define IDI_ICON_USD 106 11 | #define IDR_PYTHON_PREVIEWHANLDER 107 12 | #define IDR_REGISTRY_THUMBNAILIMPL 108 13 | #define IDR_REGISTRY_USDTHUMBNAILIMPL 108 14 | 15 | // Next default values for new objects 16 | // 17 | #ifdef APSTUDIO_INVOKED 18 | #ifndef APSTUDIO_READONLY_SYMBOLS 19 | #define _APS_NEXT_RESOURCE_VALUE 109 20 | #define _APS_NEXT_COMMAND_VALUE 40001 21 | #define _APS_NEXT_CONTROL_VALUE 1004 22 | #define _APS_NEXT_SYMED_VALUE 101 23 | #endif 24 | #endif 25 | -------------------------------------------------------------------------------- /UsdPreviewHandlerServer/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "stdafx.h" -------------------------------------------------------------------------------- /UsdPreviewHandlerServer/stdafx.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #ifndef STRICT 18 | #define STRICT 19 | #endif 20 | 21 | #pragma warning(push) 22 | #pragma warning(disable: 4244 4459) 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #pragma warning(pop) 30 | 31 | #include 32 | #define _WIN32_WINNT 0x0A00 33 | #include 34 | 35 | #define _ATL_APARTMENT_THREADED 36 | #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit 37 | #define ATL_NO_ASSERT_ON_DESTROY_NONEXISTENT_WINDOW 38 | // Use the C++ standard templated min/max 39 | #define NOMINMAX 40 | #define NOBITMAP 41 | // Include if you need this 42 | #define NOMCX 43 | // Include if you need this 44 | #define NOSERVICE 45 | 46 | #include 47 | #include 48 | 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | #include 55 | #include 56 | 57 | #include 58 | 59 | -------------------------------------------------------------------------------- /UsdPythonToolsServer/Module.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "stdafx.h" 16 | #include "Module.h" 17 | 18 | HMODULE g_hInstance; 19 | CUsdPythonToolsLocalServerModule g_AtlModule; 20 | CString g_DebugIUsdPythonToolsMethod; 21 | 22 | extern "C" int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nShowCmd) 23 | { 24 | UNREFERENCED_PARAMETER( hPrevInstance ); 25 | UNREFERENCED_PARAMETER( lpCmdLine ); 26 | UNREFERENCED_PARAMETER( nShowCmd ); 27 | 28 | g_hInstance = hInstance; 29 | 30 | int nResult = g_AtlModule.WinMain( nShowCmd ); 31 | 32 | return nResult; 33 | } 34 | -------------------------------------------------------------------------------- /UsdPythonToolsServer/Module.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #include "UsdPythonToolsLocalServer_h.h" 18 | #include "resource.h" 19 | 20 | // Using an ATL module here because it removes a lot of the 21 | // boiler-plate COM work that we would have to implement ourselves. 22 | 23 | class CUsdPythonToolsLocalServerModule : public CAtlExeModuleT 24 | { 25 | public: 26 | DECLARE_LIBID( LIBID_UsdPythonToolsLib ) 27 | DECLARE_REGISTRY_APPID_RESOURCEID( IDR_REGISTRY_MODULE, "{8777F2C4-2318-408A-85D8-F65E15811971}" ) 28 | 29 | // Override CAtlExeModuleT::PreMessageLoop to change REGCLS_MULTIPLEUSE to REGCLS_SINGLEUSE. 30 | // REGCLS_SINGLEUSE will create a new Windows process for every instance of our COM classes, 31 | // REGCLS_MULTIPLEUSE will reuse the same Windows process. 32 | HRESULT PreMessageLoop( _In_ int /*nShowCmd*/ ) throw() 33 | { 34 | HRESULT hr = S_OK; 35 | CUsdPythonToolsLocalServerModule* pT = static_cast(this); 36 | 37 | #ifndef _ATL_NO_COM_SUPPORT 38 | hr = pT->RegisterClassObjects(CLSCTX_LOCAL_SERVER, 39 | REGCLS_SINGLEUSE | // <- !!! 40 | REGCLS_SUSPENDED); 41 | 42 | if (FAILED(hr)) 43 | return hr; 44 | 45 | if (hr == S_OK) 46 | { 47 | if (m_bDelayShutdown) 48 | { 49 | CHandle h(pT->StartMonitor()); 50 | if (h.m_h == NULL) 51 | { 52 | hr = E_FAIL; 53 | } 54 | else 55 | { 56 | hr = CoResumeClassObjects(); 57 | ATLASSERT(SUCCEEDED(hr)); 58 | if (FAILED(hr)) 59 | { 60 | ::SetEvent(m_hEventShutdown); // tell monitor to shutdown 61 | ::WaitForSingleObject(h, m_dwTimeOut * 2); 62 | } 63 | } 64 | } 65 | else 66 | { 67 | hr = CoResumeClassObjects(); 68 | ATLASSERT(SUCCEEDED(hr)); 69 | } 70 | 71 | if (FAILED(hr)) 72 | pT->RevokeClassObjects(); 73 | } 74 | else 75 | { 76 | m_bDelayShutdown = false; 77 | } 78 | 79 | #endif // _ATL_NO_COM_SUPPORT 80 | 81 | ATLASSERT(SUCCEEDED(hr)); 82 | return hr; 83 | } 84 | }; 85 | 86 | extern CUsdPythonToolsLocalServerModule g_AtlModule; 87 | extern HMODULE g_hInstance; 88 | // Helpful for debugging zombie processes. 89 | // Set to the last method that was called in IUSDTools 90 | extern CString g_DebugIUsdPythonToolsMethod; 91 | 92 | #define DEBUG_RECORD_ENTRY() \ 93 | g_DebugIUsdPythonToolsMethod = _T(__FUNCTION__) 94 | -------------------------------------------------------------------------------- /UsdPythonToolsServer/UsdPythonToolsImpl.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #include "UsdPythonToolsLocalServer_h.h" 18 | 19 | #include "resource.h" 20 | 21 | class ATL_NO_VTABLE CUsdPythonToolsImpl : 22 | public IDispatchImpl, 23 | public CComObjectRootEx, 24 | public CComCoClass 25 | { 26 | public: 27 | DECLARE_NOT_AGGREGATABLE(CUsdPythonToolsImpl) 28 | DECLARE_PROTECT_FINAL_CONSTRUCT() 29 | 30 | BEGIN_COM_MAP( CUsdPythonToolsImpl ) 31 | COM_INTERFACE_ENTRY( IUsdPythonTools ) 32 | COM_INTERFACE_ENTRY2( IDispatch, IUsdPythonTools ) 33 | END_COM_MAP() 34 | 35 | HRESULT FinalConstruct(); 36 | void FinalRelease(); 37 | 38 | STDMETHODIMP Record( IN BSTR usdStagePath, IN int imageWidth, IN BSTR renderer, OUT BSTR *outputImagePath ) override; 39 | STDMETHODIMP View( IN BSTR usdStagePath, IN BSTR renderer ) override; 40 | 41 | static HRESULT WINAPI UpdateRegistry(_In_ BOOL bRegister) throw(); 42 | 43 | private: 44 | }; 45 | 46 | OBJECT_ENTRY_AUTO( __uuidof(UsdPythonTools), CUsdPythonToolsImpl ) -------------------------------------------------------------------------------- /UsdPythonToolsServer/UsdPythonToolsImpl.rgs: -------------------------------------------------------------------------------- 1 | HKCR 2 | { 3 | NoRemove CLSID 4 | { 5 | ForceRemove %CLSID_USDPYTHONTOOLS% = s 'Activision USD Python Tools Server' 6 | { 7 | LocalServer32 = s '%MODULE%' 8 | val AppID = s '%APPID%' 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /UsdPythonToolsServer/UsdPythonToolsLocalServer.idl: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import "oaidl.idl"; 16 | import "ocidl.idl"; 17 | 18 | [ 19 | uuid(88D2DCD9-4E41-49B1-B49A-4BD2942FE737), 20 | helpstring("UsdPythonTools Type Library"), 21 | version(1.0), 22 | ] 23 | library UsdPythonToolsLib 24 | { 25 | [ 26 | uuid(A73B8191-52C6-416E-ADAF-B2D1572CB0FE) 27 | ] 28 | struct UsdVariantPair 29 | { 30 | BSTR key; 31 | VARIANT value; 32 | }; 33 | 34 | [ 35 | uuid(36B7B0A6-E4FC-4728-86C1-05AFD6CFCA52), 36 | object, 37 | nonextensible, 38 | oleautomation, 39 | helpstring("IUsdPythonTools interface"), 40 | dual 41 | ] 42 | interface IUsdPythonTools : IDispatch 43 | { 44 | [helpstring("Launches usdrecord to generate a thumbnail of a USD stage.")] 45 | HRESULT Record( [in] BSTR usdStagePath, [in] int imageWidth, [in, optional] BSTR renderer, [out, retval] BSTR* outputImagePath ); 46 | 47 | [helpstring("Launches usdview for a given USD stage.")] 48 | HRESULT View( [in] BSTR usdStagePath, [in, optional] BSTR renderer ); 49 | } 50 | 51 | [ 52 | uuid(67F43831-59C3-450E-8956-AA76273F3E9F), 53 | helpstring("UsdPythonTools Server implementation") 54 | ] 55 | coclass UsdPythonTools 56 | { 57 | [default] interface IUsdPythonTools; 58 | } 59 | }; -------------------------------------------------------------------------------- /UsdPythonToolsServer/UsdPythonToolsLocalServer.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include "winres.h" 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | #undef APSTUDIO_READONLY_SYMBOLS 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // English (United States) resources 17 | 18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 19 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 20 | #pragma code_page(1252) 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "1 TYPELIB ""USDPythonToolsLocalServer.tlb""\r\n" 42 | "\r\n" 43 | "#define ATVI_VERSION_DESCRIPTION ""Activision USD Python Tools Server""\r\n" 44 | "#include ""atviversion.rc2""\r\n" 45 | "\r\n" 46 | "\0" 47 | END 48 | 49 | #endif // APSTUDIO_INVOKED 50 | 51 | 52 | ///////////////////////////////////////////////////////////////////////////// 53 | // 54 | // REGISTRY 55 | // 56 | 57 | IDR_REGISTRY_MODULE REGISTRY "USDPythonToolsLocalServerModule.rgs" 58 | 59 | IDR_REGISTRY_USDTOOLSIMPL REGISTRY "UsdPythonToolsImpl.rgs" 60 | 61 | 62 | ///////////////////////////////////////////////////////////////////////////// 63 | // 64 | // Icon 65 | // 66 | 67 | // Icon with lowest ID value placed first to ensure application icon 68 | // remains consistent on all systems. 69 | IDI_ICON_USD ICON "shared\\usd.ico" 70 | 71 | 72 | ///////////////////////////////////////////////////////////////////////////// 73 | // 74 | // PYTHON 75 | // 76 | 77 | IDR_PYTHON_THUMBNAIL PYTHON "UsdThumbnail.py" 78 | 79 | #endif // English (United States) resources 80 | ///////////////////////////////////////////////////////////////////////////// 81 | 82 | 83 | 84 | #ifndef APSTUDIO_INVOKED 85 | ///////////////////////////////////////////////////////////////////////////// 86 | // 87 | // Generated from the TEXTINCLUDE 3 resource. 88 | // 89 | 1 TYPELIB "USDPythonToolsLocalServer.tlb" 90 | 91 | #define ATVI_VERSION_DESCRIPTION "Activision USD Python Tools Server" 92 | #include "atviversion.rc2" 93 | 94 | 95 | ///////////////////////////////////////////////////////////////////////////// 96 | #endif // not APSTUDIO_INVOKED 97 | 98 | -------------------------------------------------------------------------------- /UsdPythonToolsServer/UsdPythonToolsLocalServer.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {a27a5032-5dc7-4c59-b490-e65c0cc5fee0} 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | Header Files 32 | 33 | 34 | Header Files 35 | 36 | 37 | Shared 38 | 39 | 40 | Shared 41 | 42 | 43 | Shared 44 | 45 | 46 | Shared 47 | 48 | 49 | 50 | 51 | Source Files 52 | 53 | 54 | Source Files 55 | 56 | 57 | Source Files 58 | 59 | 60 | Source Files 61 | 62 | 63 | Shared 64 | 65 | 66 | Shared 67 | 68 | 69 | 70 | 71 | Resource Files 72 | 73 | 74 | Resource Files 75 | 76 | 77 | 78 | 79 | 80 | Source Files 81 | 82 | 83 | 84 | 85 | Resource Files 86 | 87 | 88 | 89 | 90 | Shared 91 | 92 | 93 | Resource Files 94 | 95 | 96 | -------------------------------------------------------------------------------- /UsdPythonToolsServer/UsdPythonToolsLocalServerModule.rgs: -------------------------------------------------------------------------------- 1 | HKCU 2 | { 3 | NoRemove AppID 4 | { 5 | '%APPID%' = s 'UsdPythonToolsLocalServer' 6 | 'UsdPythonToolsLocalServer.exe' 7 | { 8 | val AppID = s '%APPID%' 9 | } 10 | } 11 | } 12 | 13 | -------------------------------------------------------------------------------- /UsdPythonToolsServer/UsdThumbnail.py: -------------------------------------------------------------------------------- 1 | # Copyright 2021 Activision Publishing, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # This is a fix for USD issue #1521 16 | # https://github.com/PixarAnimationStudios/USD/issues/1521 17 | 18 | import sys 19 | try: 20 | from importlib.util import spec_from_loader, module_from_spec 21 | from importlib.machinery import SourceFileLoader 22 | except ImportError: 23 | import imp 24 | 25 | def _SetupOpenGLContextFix(width=100, height=100): 26 | try: 27 | from PySide2 import QtOpenGL 28 | from PySide2.QtWidgets import QApplication 29 | from PySide2 import QtCore # Activision Change 30 | except ImportError: 31 | from PySide import QtOpenGL 32 | from PySide.QtGui import QApplication 33 | from PySide import QtCore # Activision Change 34 | 35 | application = QApplication(sys.argv) 36 | 37 | glFormat = QtOpenGL.QGLFormat() 38 | glFormat.setSampleBuffers(True) 39 | glFormat.setSamples(4) 40 | 41 | glWidget = QtOpenGL.QGLWidget(glFormat) 42 | glWidget.setFixedSize(width, height) 43 | # BEGIN - Activision Change 44 | glWidget.setAttribute( QtCore.Qt.WA_DontShowOnScreen ) 45 | # END - Activision Change 46 | glWidget.show() 47 | glWidget.setHidden(True) 48 | 49 | return glWidget 50 | 51 | def main(): 52 | try: 53 | spec = spec_from_loader("usdrecord", SourceFileLoader("usdrecord", sys.argv[0])) 54 | usdrecord = module_from_spec(spec) 55 | spec.loader.exec_module(usdrecord) 56 | except: 57 | usdrecord = imp.load_source('usdrecord', sys.argv[0]) 58 | 59 | usdrecord._SetupOpenGLContext = _SetupOpenGLContextFix 60 | return usdrecord.main() 61 | 62 | if __name__ == '__main__': 63 | sys.exit(main()) 64 | -------------------------------------------------------------------------------- /UsdPythonToolsServer/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by UsdPythonToolsLocalServer.rc 4 | // 5 | #define IDR_REGISTRY_MODULE 101 6 | #define IDR_REGISTRY_USDTOOLSIMPL 102 7 | #define IDI_ICONUSD 106 8 | #define IDI_ICON_USD 106 9 | #define IDR_PYTHON_PREVIEWHANLDER 107 10 | #define IDR_REGISTRY_THUMBNAILIMPL 108 11 | #define IDR_REGISTRY_USDTHUMBNAILIMPL 108 12 | #define IDD_DIALOG1 109 13 | #define IDR_PYTHON1 111 14 | #define IDR_PYTHON_THUMBNAIL 111 15 | 16 | // Next default values for new objects 17 | // 18 | #ifdef APSTUDIO_INVOKED 19 | #ifndef APSTUDIO_READONLY_SYMBOLS 20 | #define _APS_NEXT_RESOURCE_VALUE 112 21 | #define _APS_NEXT_COMMAND_VALUE 40001 22 | #define _APS_NEXT_CONTROL_VALUE 1004 23 | #define _APS_NEXT_SYMED_VALUE 101 24 | #endif 25 | #endif 26 | -------------------------------------------------------------------------------- /UsdPythonToolsServer/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "stdafx.h" -------------------------------------------------------------------------------- /UsdPythonToolsServer/stdafx.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #ifndef STRICT 18 | #define STRICT 19 | #endif 20 | 21 | #pragma warning(push) 22 | #pragma warning(disable: 4244 4459) 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #pragma warning(pop) 30 | 31 | #include 32 | #define _WIN32_WINNT 0x0A00 33 | #include 34 | 35 | #define _ATL_APARTMENT_THREADED 36 | #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit 37 | #define ATL_NO_ASSERT_ON_DESTROY_NONEXISTENT_WINDOW 38 | // Use the C++ standard templated min/max 39 | #define NOMINMAX 40 | #define NOBITMAP 41 | // Include if you need this 42 | #define NOMCX 43 | // Include if you need this 44 | #define NOSERVICE 45 | 46 | #include 47 | #include 48 | 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | #include 55 | #include 56 | 57 | #include 58 | #include 59 | 60 | -------------------------------------------------------------------------------- /UsdSdkToolsServer/Module.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "stdafx.h" 16 | #include "Module.h" 17 | 18 | HMODULE g_hInstance; 19 | CUsdSdkToolsLocalServerModule g_AtlModule; 20 | CString g_DebugIUsdSdkToolsMethod; 21 | 22 | extern "C" int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nShowCmd) 23 | { 24 | UNREFERENCED_PARAMETER( hPrevInstance ); 25 | UNREFERENCED_PARAMETER( lpCmdLine ); 26 | UNREFERENCED_PARAMETER( nShowCmd ); 27 | 28 | g_hInstance = hInstance; 29 | 30 | int nResult = g_AtlModule.WinMain( nShowCmd ); 31 | 32 | return nResult; 33 | } 34 | -------------------------------------------------------------------------------- /UsdSdkToolsServer/Module.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #include "UsdSdkToolsLocalServer_h.h" 18 | #include "resource.h" 19 | 20 | // Using an ATL module here because it removes a lot of the 21 | // boiler-plate COM work that we would have to implement ourselves. 22 | 23 | class CUsdSdkToolsLocalServerModule : public CAtlExeModuleT 24 | { 25 | public: 26 | DECLARE_LIBID( LIBID_UsdSdkToolsLib ) 27 | DECLARE_REGISTRY_APPID_RESOURCEID( IDR_REGISTRY_MODULE, "{123A65E6-B4B4-4B46-BEF5-D0FCE7173261}" ) 28 | 29 | // Override CAtlExeModuleT::PreMessageLoop to change REGCLS_MULTIPLEUSE to REGCLS_SINGLEUSE. 30 | // REGCLS_SINGLEUSE will create a new Windows process for every instance of our COM classes, 31 | // REGCLS_MULTIPLEUSE will reuse the same Windows process. 32 | HRESULT PreMessageLoop( _In_ int /*nShowCmd*/ ) throw() 33 | { 34 | HRESULT hr = S_OK; 35 | CUsdSdkToolsLocalServerModule* pT = static_cast(this); 36 | 37 | #ifndef _ATL_NO_COM_SUPPORT 38 | hr = pT->RegisterClassObjects(CLSCTX_LOCAL_SERVER, 39 | REGCLS_SINGLEUSE | // <- !!! 40 | REGCLS_SUSPENDED); 41 | 42 | if (FAILED(hr)) 43 | return hr; 44 | 45 | if (hr == S_OK) 46 | { 47 | if (m_bDelayShutdown) 48 | { 49 | CHandle h(pT->StartMonitor()); 50 | if (h.m_h == NULL) 51 | { 52 | hr = E_FAIL; 53 | } 54 | else 55 | { 56 | hr = CoResumeClassObjects(); 57 | ATLASSERT(SUCCEEDED(hr)); 58 | if (FAILED(hr)) 59 | { 60 | ::SetEvent(m_hEventShutdown); // tell monitor to shutdown 61 | ::WaitForSingleObject(h, m_dwTimeOut * 2); 62 | } 63 | } 64 | } 65 | else 66 | { 67 | hr = CoResumeClassObjects(); 68 | ATLASSERT(SUCCEEDED(hr)); 69 | } 70 | 71 | if (FAILED(hr)) 72 | pT->RevokeClassObjects(); 73 | } 74 | else 75 | { 76 | m_bDelayShutdown = false; 77 | } 78 | 79 | #endif // _ATL_NO_COM_SUPPORT 80 | 81 | ATLASSERT(SUCCEEDED(hr)); 82 | return hr; 83 | } 84 | }; 85 | 86 | extern CUsdSdkToolsLocalServerModule g_AtlModule; 87 | extern HMODULE g_hInstance; 88 | // Helpful for debugging zombie processes. 89 | // Set to the last method that was called in IUsdSdkTools 90 | extern CString g_DebugIUsdSdkToolsMethod; 91 | 92 | #define DEBUG_RECORD_ENTRY() \ 93 | g_DebugIUsdSdkToolsMethod = _T(__FUNCTION__) 94 | -------------------------------------------------------------------------------- /UsdSdkToolsServer/UsdSdkToolsImpl.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #include "UsdSdkToolsLocalServer_h.h" 18 | 19 | #include "resource.h" 20 | 21 | class ATL_NO_VTABLE CUsdSdkToolsImpl : 22 | public IDispatchImpl, 23 | public CComObjectRootEx, 24 | public CComCoClass 25 | { 26 | public: 27 | DECLARE_NOT_AGGREGATABLE(CUsdSdkToolsImpl) 28 | DECLARE_PROTECT_FINAL_CONSTRUCT() 29 | 30 | BEGIN_COM_MAP( CUsdSdkToolsImpl ) 31 | COM_INTERFACE_ENTRY( IUsdSdkTools ) 32 | COM_INTERFACE_ENTRY2( IDispatch, IUsdSdkTools ) 33 | END_COM_MAP() 34 | 35 | HRESULT FinalConstruct(); 36 | void FinalRelease(); 37 | 38 | STDMETHODIMP Cat( IN BSTR usdStagePathInput, IN BSTR usdStagePathOuput, IN eUsdFormat formatOutput = USD_FORMAT_INPUT, IN VARIANT_BOOL flatten = 0 ) override; 39 | STDMETHODIMP Edit( IN BSTR usdStagePath, IN VARIANT_BOOL force = 0 ) override; 40 | STDMETHODIMP Package( IN BSTR usdStagePathInput, IN BSTR usdStagePathOuput, IN eUsdPackageType packageType = USD_PACKAGE_DEFAULT, IN VARIANT_BOOL verbose = 0 ) override; 41 | STDMETHODIMP DisplayStageStats( IN BSTR usdStagePath ) override; 42 | 43 | static HRESULT WINAPI UpdateRegistry(_In_ BOOL bRegister) throw(); 44 | 45 | private: 46 | }; 47 | 48 | OBJECT_ENTRY_AUTO( __uuidof(UsdSdkTools), CUsdSdkToolsImpl ) -------------------------------------------------------------------------------- /UsdSdkToolsServer/UsdSdkToolsImpl.rgs: -------------------------------------------------------------------------------- 1 | HKCR 2 | { 3 | NoRemove CLSID 4 | { 5 | ForceRemove %CLSID_USDSDKTOOLS% = s 'Activision USD SDK Tools Server' 6 | { 7 | LocalServer32 = s '%MODULE%' 8 | val AppID = s '%APPID%' 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /UsdSdkToolsServer/UsdSdkToolsLocalServer.idl: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import "oaidl.idl"; 16 | import "ocidl.idl"; 17 | 18 | typedef [uuid(B397354A-F5D9-4835-B584-9524749F7B63), helpstring("USD Format")] 19 | enum eUsdFormat 20 | { 21 | [helpstring("Same as input file")] 22 | USD_FORMAT_INPUT, 23 | [helpstring("ASCII")] 24 | USD_FORMAT_USDA, 25 | [helpstring("Crate")] 26 | USD_FORMAT_USDC, 27 | } eUsdFormat; 28 | 29 | typedef [uuid(266D173D-4142-4CA1-BF25-EC9BC61FDE6A), helpstring("USDZ Package Type")] 30 | enum eUsdPackageType 31 | { 32 | [helpstring("Default USDZ package.")] 33 | USD_PACKAGE_DEFAULT, 34 | [helpstring("Apple ARKit USDZ package.")] 35 | USD_FORMAT_APPLE_ARKIT 36 | } eUsdPackageType; 37 | 38 | [ 39 | uuid(F68344A7-0343-4064-8DA9-7A2ECF6C2D2A), 40 | object, 41 | nonextensible, 42 | oleautomation, 43 | helpstring("IUsdSdkTools interface"), 44 | dual 45 | ] 46 | interface IUsdSdkTools : IDispatch 47 | { 48 | [helpstring("Converts between the various USD file formats.")] 49 | HRESULT Cat( [in] BSTR usdStagePathInput, [in] BSTR usdStagePathOuput, [in, defaultvalue(USD_FORMAT_INPUT)] eUsdFormat formatOutput, [in, defaultvalue(0)] VARIANT_BOOL flatten); 50 | 51 | [helpstring("Launches a text editor for a given USD stage.")] 52 | HRESULT Edit( [in] BSTR usdStagePath, [in, defaultvalue(0)] VARIANT_BOOL forcewrite); 53 | 54 | [helpstring("Converts a USD stage to a USD package.")] 55 | HRESULT Package( [in] BSTR usdStagePathInput, [in] BSTR usdStagePathOuput, [in, defaultvalue(USD_PACKAGE_DEFAULT)] eUsdPackageType packageType, [in, defaultvalue(0)] VARIANT_BOOL verbose ); 56 | 57 | [helpstring("Displays stats about the USD stage.")] 58 | HRESULT DisplayStageStats( [in] BSTR usdStagePath ); 59 | } 60 | 61 | [ 62 | uuid(7704E595-537E-41A0-AF52-53EA2941A773), 63 | helpstring("UsdSdkTools Type Library"), 64 | version(1.0), 65 | ] 66 | library UsdSdkToolsLib 67 | { 68 | [ 69 | uuid(5F016739-AF12-4899-B710-3FB5C242A11D), 70 | helpstring("UsdSdkTools Server implementation") 71 | ] 72 | coclass UsdSdkTools 73 | { 74 | [default] interface IUsdSdkTools; 75 | } 76 | }; -------------------------------------------------------------------------------- /UsdSdkToolsServer/UsdSdkToolsLocalServer.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include "winres.h" 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | #undef APSTUDIO_READONLY_SYMBOLS 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // English (United States) resources 17 | 18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 19 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 20 | #pragma code_page(1252) 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "1 TYPELIB ""UsdSdkToolsLocalServer.tlb""\r\n" 42 | "\r\n" 43 | "#define ATVI_VERSION_DESCRIPTION ""Activision USD SDK Tools Server""\r\n" 44 | "#include ""atviversion.rc2""\r\n" 45 | "\r\n" 46 | "\0" 47 | END 48 | 49 | #endif // APSTUDIO_INVOKED 50 | 51 | 52 | ///////////////////////////////////////////////////////////////////////////// 53 | // 54 | // REGISTRY 55 | // 56 | 57 | IDR_REGISTRY_MODULE REGISTRY "UsdSdkToolsLocalServerModule.rgs" 58 | 59 | IDR_REGISTRY_USDTOOLSIMPL REGISTRY "UsdSdkToolsImpl.rgs" 60 | 61 | 62 | ///////////////////////////////////////////////////////////////////////////// 63 | // 64 | // Icon 65 | // 66 | 67 | // Icon with lowest ID value placed first to ensure application icon 68 | // remains consistent on all systems. 69 | IDI_ICON_USD ICON "shared\\usd.ico" 70 | 71 | #endif // English (United States) resources 72 | ///////////////////////////////////////////////////////////////////////////// 73 | 74 | 75 | 76 | #ifndef APSTUDIO_INVOKED 77 | ///////////////////////////////////////////////////////////////////////////// 78 | // 79 | // Generated from the TEXTINCLUDE 3 resource. 80 | // 81 | 1 TYPELIB "UsdSdkToolsLocalServer.tlb" 82 | 83 | #define ATVI_VERSION_DESCRIPTION "Activision USD SDK Tools Server" 84 | #include "atviversion.rc2" 85 | 86 | 87 | ///////////////////////////////////////////////////////////////////////////// 88 | #endif // not APSTUDIO_INVOKED 89 | 90 | -------------------------------------------------------------------------------- /UsdSdkToolsServer/UsdSdkToolsLocalServer.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {a27a5032-5dc7-4c59-b490-e65c0cc5fee0} 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | Shared 32 | 33 | 34 | Shared 35 | 36 | 37 | Header Files 38 | 39 | 40 | Header Files 41 | 42 | 43 | Shared 44 | 45 | 46 | 47 | 48 | Source Files 49 | 50 | 51 | Source Files 52 | 53 | 54 | Shared 55 | 56 | 57 | Source Files 58 | 59 | 60 | Source Files 61 | 62 | 63 | 64 | 65 | Resource Files 66 | 67 | 68 | Resource Files 69 | 70 | 71 | 72 | 73 | Source Files 74 | 75 | 76 | 77 | 78 | Resource Files 79 | 80 | 81 | 82 | 83 | Shared 84 | 85 | 86 | Resource Files 87 | 88 | 89 | -------------------------------------------------------------------------------- /UsdSdkToolsServer/UsdSdkToolsLocalServerModule.rgs: -------------------------------------------------------------------------------- 1 | HKCU 2 | { 3 | NoRemove AppID 4 | { 5 | '%APPID%' = s 'UsdSdkToolsLocalServer' 6 | 'UsdSdkToolsLocalServer.exe' 7 | { 8 | val AppID = s '%APPID%' 9 | } 10 | } 11 | } 12 | 13 | -------------------------------------------------------------------------------- /UsdSdkToolsServer/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by UsdSdkToolsLocalServer.rc 4 | // 5 | #define IDR_REGISTRY_MODULE 101 6 | #define IDR_REGISTRY_USDTOOLSIMPL 102 7 | #define IDI_ICONUSD 106 8 | #define IDI_ICON_USD 106 9 | #define IDR_PYTHON_PREVIEWHANLDER 107 10 | #define IDR_REGISTRY_THUMBNAILIMPL 108 11 | #define IDR_REGISTRY_USDTHUMBNAILIMPL 108 12 | #define IDD_DIALOG1 109 13 | 14 | // Next default values for new objects 15 | // 16 | #ifdef APSTUDIO_INVOKED 17 | #ifndef APSTUDIO_READONLY_SYMBOLS 18 | #define _APS_NEXT_RESOURCE_VALUE 111 19 | #define _APS_NEXT_COMMAND_VALUE 40001 20 | #define _APS_NEXT_CONTROL_VALUE 1004 21 | #define _APS_NEXT_SYMED_VALUE 101 22 | #endif 23 | #endif 24 | -------------------------------------------------------------------------------- /UsdSdkToolsServer/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "stdafx.h" -------------------------------------------------------------------------------- /UsdSdkToolsServer/stdafx.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #ifndef STRICT 18 | #define STRICT 19 | #endif 20 | 21 | #include 22 | #define _WIN32_WINNT 0x0A00 23 | #include 24 | 25 | #define _ATL_APARTMENT_THREADED 26 | #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit 27 | #define ATL_NO_ASSERT_ON_DESTROY_NONEXISTENT_WINDOW 28 | // Use the C++ standard templated min/max 29 | #define NOMINMAX 30 | #define NOBITMAP 31 | // Include if you need this 32 | #define NOMCX 33 | // Include if you need this 34 | #define NOSERVICE 35 | 36 | #include 37 | #include 38 | 39 | #pragma warning( push ) 40 | #pragma warning( disable : 4244 4305 5033 4100 4201 4245 4127 ) 41 | 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | #include 55 | #include 56 | 57 | 58 | #pragma warning( pop ) 59 | 60 | #include 61 | #include 62 | #include 63 | #include 64 | #include 65 | #include 66 | #include 67 | 68 | #include 69 | #include 70 | #include 71 | #include -------------------------------------------------------------------------------- /UsdShellExtension.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28307.1209 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UsdPreviewHandlerPython", "UsdPreviewHandlerPython\UsdPreviewHandlerPython.vcxproj", "{248F687E-4028-4243-87B8-2312F57BE8A5}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UsdPreviewLocalServer", "UsdPreviewHandlerServer\UsdPreviewLocalServer.vcxproj", "{279AFA6D-6E35-4798-BA63-8A7E15D11185}" 9 | EndProject 10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UsdShellExtension", "UsdShellExtension\UsdShellExtension.vcxproj", "{9974380D-C9C6-4CF4-8AA2-7D564EB8C4E8}" 11 | ProjectSection(ProjectDependencies) = postProject 12 | {279AFA6D-6E35-4798-BA63-8A7E15D11185} = {279AFA6D-6E35-4798-BA63-8A7E15D11185} 13 | {248F687E-4028-4243-87B8-2312F57BE8A5} = {248F687E-4028-4243-87B8-2312F57BE8A5} 14 | {EA717BDA-3304-439B-BEC8-408D9CE9F3FB} = {EA717BDA-3304-439B-BEC8-408D9CE9F3FB} 15 | EndProjectSection 16 | EndProject 17 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UsdSdkToolsLocalServer", "UsdSdkToolsServer\UsdSdkToolsLocalServer.vcxproj", "{EA717BDA-3304-439B-BEC8-408D9CE9F3FB}" 18 | EndProject 19 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UsdPythonToolsLocalServer", "UsdPythonToolsServer\UsdPythonToolsLocalServer.vcxproj", "{6AD79C79-3A9D-4C39-B028-C45072541C28}" 20 | EndProject 21 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F2EEFD0F-82FF-4404-94E5-CD2F3837BDA9}" 22 | ProjectSection(SolutionItems) = preProject 23 | atviversion.h = atviversion.h 24 | BUILDING.md = BUILDING.md 25 | README.md = README.md 26 | EndProjectSection 27 | EndProject 28 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UsdShellExtensionInstaller", "UsdShellExtensionInstaller\UsdShellExtensionInstaller.vcxproj", "{1390252A-71E2-4C4E-B874-301909F40CBA}" 29 | EndProject 30 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Property Sheets", "Property Sheets", "{8889FDB0-64A4-4AB7-A539-D3328F0846E9}" 31 | ProjectSection(SolutionItems) = preProject 32 | atviversion.props = atviversion.props 33 | boost.props = boost.props 34 | nsis.props = nsis.props 35 | python.props = python.props 36 | usd-monolithic.props = usd-monolithic.props 37 | usd-shared.props = usd-shared.props 38 | usd.props = usd.props 39 | EndProjectSection 40 | EndProject 41 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EventViewerMessages", "shared\EventViewerMessages.vcxproj", "{F12E597B-B731-4F5A-BEC3-980D20159320}" 42 | EndProject 43 | Global 44 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 45 | Debug|x64 = Debug|x64 46 | Release|x64 = Release|x64 47 | EndGlobalSection 48 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 49 | {248F687E-4028-4243-87B8-2312F57BE8A5}.Debug|x64.ActiveCfg = Debug|x64 50 | {248F687E-4028-4243-87B8-2312F57BE8A5}.Debug|x64.Build.0 = Debug|x64 51 | {248F687E-4028-4243-87B8-2312F57BE8A5}.Release|x64.ActiveCfg = Release|x64 52 | {248F687E-4028-4243-87B8-2312F57BE8A5}.Release|x64.Build.0 = Release|x64 53 | {279AFA6D-6E35-4798-BA63-8A7E15D11185}.Debug|x64.ActiveCfg = Debug|x64 54 | {279AFA6D-6E35-4798-BA63-8A7E15D11185}.Debug|x64.Build.0 = Debug|x64 55 | {279AFA6D-6E35-4798-BA63-8A7E15D11185}.Release|x64.ActiveCfg = Release|x64 56 | {279AFA6D-6E35-4798-BA63-8A7E15D11185}.Release|x64.Build.0 = Release|x64 57 | {9974380D-C9C6-4CF4-8AA2-7D564EB8C4E8}.Debug|x64.ActiveCfg = Debug|x64 58 | {9974380D-C9C6-4CF4-8AA2-7D564EB8C4E8}.Debug|x64.Build.0 = Debug|x64 59 | {9974380D-C9C6-4CF4-8AA2-7D564EB8C4E8}.Release|x64.ActiveCfg = Release|x64 60 | {9974380D-C9C6-4CF4-8AA2-7D564EB8C4E8}.Release|x64.Build.0 = Release|x64 61 | {EA717BDA-3304-439B-BEC8-408D9CE9F3FB}.Debug|x64.ActiveCfg = Debug|x64 62 | {EA717BDA-3304-439B-BEC8-408D9CE9F3FB}.Debug|x64.Build.0 = Debug|x64 63 | {EA717BDA-3304-439B-BEC8-408D9CE9F3FB}.Release|x64.ActiveCfg = Release|x64 64 | {EA717BDA-3304-439B-BEC8-408D9CE9F3FB}.Release|x64.Build.0 = Release|x64 65 | {6AD79C79-3A9D-4C39-B028-C45072541C28}.Debug|x64.ActiveCfg = Debug|x64 66 | {6AD79C79-3A9D-4C39-B028-C45072541C28}.Debug|x64.Build.0 = Debug|x64 67 | {6AD79C79-3A9D-4C39-B028-C45072541C28}.Release|x64.ActiveCfg = Release|x64 68 | {6AD79C79-3A9D-4C39-B028-C45072541C28}.Release|x64.Build.0 = Release|x64 69 | {1390252A-71E2-4C4E-B874-301909F40CBA}.Debug|x64.ActiveCfg = Debug|x64 70 | {1390252A-71E2-4C4E-B874-301909F40CBA}.Release|x64.ActiveCfg = Release|x64 71 | {F12E597B-B731-4F5A-BEC3-980D20159320}.Debug|x64.ActiveCfg = Debug|x64 72 | {F12E597B-B731-4F5A-BEC3-980D20159320}.Debug|x64.Build.0 = Debug|x64 73 | {F12E597B-B731-4F5A-BEC3-980D20159320}.Release|x64.ActiveCfg = Release|x64 74 | {F12E597B-B731-4F5A-BEC3-980D20159320}.Release|x64.Build.0 = Release|x64 75 | EndGlobalSection 76 | GlobalSection(SolutionProperties) = preSolution 77 | HideSolutionNode = FALSE 78 | EndGlobalSection 79 | GlobalSection(ExtensibilityGlobals) = postSolution 80 | SolutionGuid = {E4AEC1C0-464E-4B29-B0FA-8841731E8735} 81 | EndGlobalSection 82 | EndGlobal 83 | -------------------------------------------------------------------------------- /UsdShellExtension/ArResolverShellExtension.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "stdafx.h" 16 | #include "ArResolverShellExtension.h" 17 | 18 | // NOTE 19 | // /Zc:inline- is set for this file in the vcxproj 20 | // Enabling /Zc:inline strips out USD plug-in registration 21 | // https://developercommunity.visualstudio.com/t/zcinline-removes-extern-symbols-inside-anonymous-n/914943 22 | 23 | PXR_NAMESPACE_OPEN_SCOPE 24 | 25 | AR_DEFINE_RESOLVER(ArResolverShellExtension, ArResolver) 26 | 27 | std::shared_ptr ArResolverShellExtension::OpenAsset(const std::string& resolvedPath) 28 | { 29 | // Deny writes. 30 | // The shell extension is used by many processes and threads at the same time. 31 | // fopen on Windows will allow writes with reads 32 | FILE* f = _wfsopen( ATL::CA2W( resolvedPath.c_str(), CP_UTF8 ), L"rb", _SH_SECURE ); 33 | if (!f) { 34 | return nullptr; 35 | } 36 | 37 | return std::shared_ptr(new ArFilesystemAsset(f)); 38 | } 39 | 40 | PXR_NAMESPACE_CLOSE_SCOPE 41 | 42 | -------------------------------------------------------------------------------- /UsdShellExtension/ArResolverShellExtension.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | PXR_NAMESPACE_OPEN_SCOPE 18 | 19 | class ArResolverShellExtension : public ArDefaultResolver 20 | { 21 | public: 22 | std::shared_ptr OpenAsset( const std::string &resolvedPath ) override; 23 | }; 24 | 25 | PXR_NAMESPACE_CLOSE_SCOPE -------------------------------------------------------------------------------- /UsdShellExtension/Module.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #include "ShellExt_h.h" 18 | #include "resource.h" 19 | 20 | // Using an ATL module here because it removes a lot of the 21 | // boiler-plate COM work that we would have to implement ourselves. 22 | 23 | class CShellExtModule : public CAtlDllModuleT 24 | { 25 | public: 26 | DECLARE_LIBID( LIBID_UsdShellExtensionLib ) 27 | 28 | static HRESULT WINAPI UpdateRegistry(_In_ BOOL bRegister) throw(); 29 | }; 30 | 31 | extern CShellExtModule g_AtlModule; 32 | extern HMODULE g_hInstance; 33 | 34 | #define E_PYTHON_NOT_INSTALLED MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0200) 35 | #define E_PYOPENGL_NOT_INSTALLED MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0201) 36 | #define E_PYSIDE2_NOT_INSTALLED MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0202) 37 | 38 | class CCommandLineArgs 39 | { 40 | public: 41 | ~CCommandLineArgs() 42 | { 43 | if ( argv ) 44 | LocalFree( argv ); 45 | } 46 | 47 | int argc = 0; 48 | LPWSTR *argv = nullptr; 49 | }; 50 | 51 | -------------------------------------------------------------------------------- /UsdShellExtension/ShellExt.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | DllRegisterServer PRIVATE 3 | DllUnregisterServer PRIVATE 4 | DllGetClassObject PRIVATE 5 | DllCanUnloadNow PRIVATE 6 | DllInstall PRIVATE -------------------------------------------------------------------------------- /UsdShellExtension/ShellExt.idl: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import "oaidl.idl"; 16 | import "ocidl.idl"; 17 | import "ShObjIdl.idl"; 18 | import "thumbcache.idl"; 19 | 20 | [ 21 | uuid(B71120F9-A3EA-4153-8C32-C906CCE1F6F2), 22 | version(1.0), 23 | ] 24 | library UsdShellExtensionLib 25 | { 26 | [ 27 | uuid(0BCB74E0-5B61-4F24-BAB3-96CC76FE3672) 28 | ] 29 | coclass UsdContextMenu 30 | { 31 | [default] interface IContextMenu; 32 | }; 33 | 34 | [ 35 | uuid(2DEB1AB8-DECA-42C2-B576-3116D9CA8FA8), 36 | helpstring("USD IPreviewHandler implementation") 37 | ] 38 | coclass ShellPreviewHandler 39 | { 40 | [default] interface IPreviewHandler; 41 | } 42 | 43 | [ 44 | uuid(2877CB72-1427-43B0-A2B4-9CB1B2BA8C53), 45 | helpstring("USD IThumbnailProvider implementation") 46 | ] 47 | coclass ShellThumbnailProvider 48 | { 49 | [default] interface IThumbnailProvider; 50 | } 51 | 52 | [ 53 | uuid(5CE761D0-72AA-4484-B2BF-2A0EBF3ACC0C), 54 | helpstring("USD IPropertyStore implementation") 55 | ] 56 | coclass ShellPropertyStore 57 | { 58 | [default] interface IPropertyStore; 59 | } 60 | }; -------------------------------------------------------------------------------- /UsdShellExtension/ShellExt.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include "winres.h" 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | #undef APSTUDIO_READONLY_SYMBOLS 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // Neutral (Default) resources 17 | 18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEUD) 19 | LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT 20 | #pragma code_page(1252) 21 | 22 | #include "EventViewerMessages.rc" 23 | 24 | ///////////////////////////////////////////////////////////////////////////// 25 | // 26 | // REGISTRY 27 | // 28 | 29 | IDR_REGISTRY_SHELLPREVIEWHANDLERIMPL REGISTRY "ShellPreviewHandlerImpl.rgs" 30 | 31 | IDR_REGISTRY_SHELLTHUMBNAILPROVIDERIMPL REGISTRY "ShellThumbnailProviderImpl.rgs" 32 | 33 | IDR_REGISTRY_MODULE REGISTRY "ShellExtModule.rgs" 34 | 35 | IDR_REGISTRY_SHELLPROPERTYSTOREIMPL REGISTRY "ShellPropertyStoreImpl.rgs" 36 | 37 | 38 | ///////////////////////////////////////////////////////////////////////////// 39 | // 40 | // Icon 41 | // 42 | 43 | // Icon with lowest ID value placed first to ensure application icon 44 | // remains consistent on all systems. 45 | IDI_ICON_USD ICON "usd.ico" 46 | 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | // 50 | // Dialog 51 | // 52 | 53 | IDD_LOADSCREEN DIALOGEX 0, 0, 231, 130 54 | STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN 55 | FONT 8, "MS Shell Dlg", 400, 0, 0x1 56 | BEGIN 57 | END 58 | 59 | 60 | ///////////////////////////////////////////////////////////////////////////// 61 | // 62 | // DESIGNINFO 63 | // 64 | 65 | #ifdef APSTUDIO_INVOKED 66 | GUIDELINES DESIGNINFO 67 | BEGIN 68 | IDD_LOADSCREEN, DIALOG 69 | BEGIN 70 | LEFTMARGIN, 7 71 | TOPMARGIN, 7 72 | END 73 | END 74 | #endif // APSTUDIO_INVOKED 75 | 76 | 77 | ///////////////////////////////////////////////////////////////////////////// 78 | // 79 | // AFX_DIALOG_LAYOUT 80 | // 81 | 82 | IDD_LOADSCREEN AFX_DIALOG_LAYOUT 83 | BEGIN 84 | 0 85 | END 86 | 87 | 88 | ///////////////////////////////////////////////////////////////////////////// 89 | // 90 | // PNG 91 | // 92 | 93 | IDB_LOADSCREEN PNG "USDLogoLrgWithAlpha.png" 94 | 95 | IDB_LOGO PNG "logo.png" 96 | 97 | 98 | ///////////////////////////////////////////////////////////////////////////// 99 | // 100 | // XML 101 | // 102 | 103 | IDR_XML_PROPDESC_USD XML "UsdPropertyKeys.propdesc" 104 | 105 | 106 | #ifdef APSTUDIO_INVOKED 107 | ///////////////////////////////////////////////////////////////////////////// 108 | // 109 | // TEXTINCLUDE 110 | // 111 | 112 | 1 TEXTINCLUDE 113 | BEGIN 114 | "resource.h\0" 115 | END 116 | 117 | 2 TEXTINCLUDE 118 | BEGIN 119 | "#include ""winres.h""\r\n" 120 | "\0" 121 | END 122 | 123 | 3 TEXTINCLUDE 124 | BEGIN 125 | "1 TYPELIB ""UsdShellExtension.tlb""\r\n" 126 | "\r\n" 127 | "#define ATVI_VERSION_DESCRIPTION ""Activision USD Shell Extension""\r\n" 128 | "#include ""atviversion.rc2""\r\n" 129 | "\0" 130 | END 131 | 132 | #endif // APSTUDIO_INVOKED 133 | 134 | 135 | ///////////////////////////////////////////////////////////////////////////// 136 | // 137 | // String Table 138 | // 139 | 140 | STRINGTABLE 141 | BEGIN 142 | IDS_USD_DOCUMENTATION_LABEL "Documentation" 143 | IDS_USD_DOCUMENTATION_INVITATIONTEXT "Add documentation" 144 | IDS_USD_DOCUMENTATION_MNEMONICS "usddocumentation|usddocs|usddoc" 145 | IDS_USD_PROPGROUP_USD_LABEL "Universal Scene Description" 146 | END 147 | 148 | STRINGTABLE 149 | BEGIN 150 | IDS_FILE_USD "Universal Scene Description" 151 | IDS_FILE_USDA "Universal Scene Description ASCII" 152 | IDS_FILE_USDC "Universal Scene Description Crate" 153 | IDS_FILE_USDZ "Universal Scene Description Package" 154 | IDS_SHELL_VIEW "&View" 155 | IDS_SHELL_EDIT "&Edit" 156 | END 157 | 158 | STRINGTABLE 159 | BEGIN 160 | IDS_SHELL_CRATE "&Crate" 161 | IDS_SHELL_UNCRATE "&Uncrate" 162 | IDS_SHELL_FLATTEN "&Flatten" 163 | IDS_SHELL_REFRESHTHUMBNAIL "&Refresh Thumbnail" 164 | IDS_SHELL_STATS "&Stats" 165 | IDS_USD_CUSTOMLAYERDATA_LABEL "Custom layer data" 166 | IDS_USD_CUSTOMLAYERDATA_MNEMONICS "usdcustomlayerdata|usdlayerdata" 167 | END 168 | 169 | #endif // Neutral (Default) resources 170 | ///////////////////////////////////////////////////////////////////////////// 171 | 172 | 173 | 174 | #ifndef APSTUDIO_INVOKED 175 | ///////////////////////////////////////////////////////////////////////////// 176 | // 177 | // Generated from the TEXTINCLUDE 3 resource. 178 | // 179 | 1 TYPELIB "UsdShellExtension.tlb" 180 | 181 | #define ATVI_VERSION_DESCRIPTION "Activision USD Shell Extension" 182 | #include "atviversion.rc2" 183 | 184 | ///////////////////////////////////////////////////////////////////////////// 185 | #endif // not APSTUDIO_INVOKED 186 | 187 | -------------------------------------------------------------------------------- /UsdShellExtension/ShellPreviewHandlerImpl.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #include "ShellExt_h.h" 18 | 19 | #include "UsdLoadScreenDlg.h" 20 | #include "resource.h" 21 | 22 | 23 | class ATL_NO_VTABLE CShellPreviewHandlerImpl : 24 | public CComObjectRootEx, 25 | public CComCoClass, 26 | public IInitializeWithFile, 27 | public IObjectWithSite, 28 | public IOleWindow, 29 | public IPreviewHandler, 30 | public IPreviewHandlerVisuals 31 | { 32 | public: 33 | DECLARE_NOT_AGGREGATABLE(CShellPreviewHandlerImpl) 34 | DECLARE_PROTECT_FINAL_CONSTRUCT() 35 | 36 | BEGIN_COM_MAP(CShellPreviewHandlerImpl) 37 | COM_INTERFACE_ENTRY(IInitializeWithFile) 38 | COM_INTERFACE_ENTRY(IObjectWithSite) 39 | COM_INTERFACE_ENTRY(IOleWindow) 40 | COM_INTERFACE_ENTRY(IPreviewHandler) 41 | COM_INTERFACE_ENTRY(IPreviewHandlerVisuals) 42 | END_COM_MAP() 43 | 44 | HRESULT FinalConstruct(); 45 | void FinalRelease(); 46 | 47 | // IInitializeWithFile 48 | STDMETHODIMP Initialize( __RPC__in_string LPCWSTR pszFilePath, DWORD grfMode ) override; 49 | 50 | // IObjectWithSite 51 | STDMETHODIMP SetSite(__RPC__in_opt IUnknown* pUnkSite) override; 52 | STDMETHODIMP GetSite(__RPC__in REFIID riid, __RPC__deref_out_opt void** ppvSite) override; 53 | 54 | // IOleWindow 55 | STDMETHODIMP GetWindow(__RPC__deref_out_opt HWND* phwnd) override; 56 | STDMETHODIMP ContextSensitiveHelp(BOOL fEnterMode) override; 57 | 58 | // IPreviewHandler 59 | STDMETHODIMP SetWindow( __RPC__in HWND hwnd, __RPC__in const RECT* prc) override; 60 | STDMETHODIMP SetRect( __RPC__in const RECT* prc ) override; 61 | STDMETHODIMP DoPreview() override; 62 | STDMETHODIMP Unload() override; 63 | STDMETHODIMP SetFocus() override; 64 | STDMETHODIMP QueryFocus( __RPC__deref_out_opt HWND* phwnd) override; 65 | STDMETHODIMP TranslateAccelerator(__RPC__in MSG* pmsg) override; 66 | 67 | // IPreviewHandlerVisuals 68 | STDMETHODIMP SetBackgroundColor(COLORREF color) override; 69 | STDMETHODIMP SetFont(__RPC__in const LOGFONTW *plf) override; 70 | STDMETHODIMP SetTextColor(COLORREF color) override; 71 | 72 | static HRESULT WINAPI UpdateRegistry(_In_ BOOL bRegister) throw(); 73 | 74 | private: 75 | HRESULT CreateLocalServer(); 76 | void DestroyLocalServer(); 77 | 78 | CComPtr m_pInitializeWithFile; 79 | CComPtr m_pObjectWithSite; 80 | CComPtr m_pOleWindow; 81 | CComPtr m_pPreviewHandler; 82 | CComPtr m_pPreviewHandlerVisuals; 83 | 84 | HWND m_hWnd = nullptr; 85 | // raw dpi-unaware rect 86 | RECT m_rcWndRaw = {}; 87 | // window rect adjusted for dpi 88 | RECT m_rcWndDpiAware = {}; 89 | 90 | COLORREF m_clrBackground; 91 | COLORREF m_clrText; 92 | 93 | CUsdLoadScreenDlg m_LoadScreenDlg; 94 | bool m_bLoadScreenCreated = false; 95 | }; 96 | 97 | OBJECT_ENTRY_AUTO(__uuidof(ShellPreviewHandler), CShellPreviewHandlerImpl) 98 | 99 | -------------------------------------------------------------------------------- /UsdShellExtension/ShellPreviewHandlerImpl.rgs: -------------------------------------------------------------------------------- 1 | HKCR 2 | { 3 | NoRemove ATVI.USD 4 | { 5 | NoRemove shellex 6 | { 7 | ForceRemove {8895b1c6-b41f-4c1c-a562-0d564250836f} = s '%CLSID_SHELLPREVIEWHANDLER%' 8 | } 9 | } 10 | 11 | NoRemove ATVI.USDA 12 | { 13 | NoRemove shellex 14 | { 15 | ForceRemove {8895b1c6-b41f-4c1c-a562-0d564250836f} = s '%CLSID_SHELLPREVIEWHANDLER%' 16 | } 17 | } 18 | 19 | NoRemove ATVI.USDC 20 | { 21 | NoRemove shellex 22 | { 23 | ForceRemove {8895b1c6-b41f-4c1c-a562-0d564250836f} = s '%CLSID_SHELLPREVIEWHANDLER%' 24 | } 25 | } 26 | 27 | NoRemove ATVI.USDZ 28 | { 29 | NoRemove shellex 30 | { 31 | ForceRemove {8895b1c6-b41f-4c1c-a562-0d564250836f} = s '%CLSID_SHELLPREVIEWHANDLER%' 32 | } 33 | } 34 | 35 | NoRemove CLSID 36 | { 37 | ForceRemove %CLSID_SHELLPREVIEWHANDLER% = s 'Activision USD Preview Handler' 38 | { 39 | ForceRemove InProcServer32 = s '%MODULE%' 40 | { 41 | val ThreadingModel = s 'Apartment' 42 | } 43 | val DisplayName = s 'Activision USD Preview Handler' 44 | val AppID = s '{6d2b5079-2f0b-48dd-ab7f-97cec514d30b}' 45 | val DisableProcessIsolation = d '1' 46 | val DisableLowILProcessIsolation = d '1' 47 | val Icon = s '%MODULE%,-113' 48 | } 49 | } 50 | } 51 | 52 | HKLM 53 | { 54 | NoRemove Software 55 | { 56 | NoRemove Microsoft 57 | { 58 | NoRemove Windows 59 | { 60 | NoRemove CurrentVersion 61 | { 62 | NoRemove PreviewHandlers 63 | { 64 | ForceRemove val %CLSID_SHELLPREVIEWHANDLER% = s 'Activision USD Preview Handler' 65 | } 66 | 67 | NoRemove 'Shell Extensions' 68 | { 69 | NoRemove Approved 70 | { 71 | ForceRemove val %CLSID_SHELLPREVIEWHANDLER% = s 'Activision USD Preview Handler' 72 | } 73 | } 74 | } 75 | } 76 | } 77 | } 78 | } 79 | 80 | HKCU 81 | { 82 | NoRemove Software 83 | { 84 | NoRemove Microsoft 85 | { 86 | NoRemove Windows 87 | { 88 | NoRemove CurrentVersion 89 | { 90 | NoRemove PreviewHandlers 91 | { 92 | ForceRemove val %CLSID_SHELLPREVIEWHANDLER% = s 'Activision USD Preview Handler' 93 | } 94 | 95 | NoRemove 'Shell Extensions' 96 | { 97 | NoRemove Approved 98 | { 99 | ForceRemove val %CLSID_SHELLPREVIEWHANDLER% = s 'Activision USD Preview Handler' 100 | } 101 | } 102 | } 103 | } 104 | } 105 | } 106 | } -------------------------------------------------------------------------------- /UsdShellExtension/ShellPropertyStoreImpl.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #include "ShellExt_h.h" 18 | 19 | #include "resource.h" 20 | 21 | 22 | class ATL_NO_VTABLE CShellPropertyStoreImpl : 23 | public CComObjectRootEx, 24 | public CComCoClass, 25 | public IInitializeWithFile, 26 | public IPropertyStore, 27 | public IPropertyStoreCapabilities 28 | { 29 | public: 30 | DECLARE_NOT_AGGREGATABLE(CShellPropertyStoreImpl) 31 | DECLARE_PROTECT_FINAL_CONSTRUCT() 32 | 33 | BEGIN_COM_MAP(CShellPropertyStoreImpl) 34 | COM_INTERFACE_ENTRY(IInitializeWithFile) 35 | COM_INTERFACE_ENTRY(IPropertyStore) 36 | COM_INTERFACE_ENTRY(IPropertyStoreCapabilities) 37 | END_COM_MAP() 38 | 39 | HRESULT FinalConstruct(); 40 | void FinalRelease(); 41 | 42 | // IInitializeWithFile 43 | STDMETHODIMP Initialize( __RPC__in_string LPCWSTR pszFilePath, DWORD grfMode ) override; 44 | 45 | // IPropertyStore 46 | STDMETHODIMP GetCount( __RPC__out DWORD *cProps ) override; 47 | STDMETHODIMP GetAt( DWORD iProp, __RPC__out PROPERTYKEY *pkey ) override; 48 | STDMETHODIMP GetValue( __RPC__in REFPROPERTYKEY key, __RPC__out PROPVARIANT *pv ) override; 49 | STDMETHODIMP SetValue( __RPC__in REFPROPERTYKEY key, __RPC__in REFPROPVARIANT propvar ) override; 50 | STDMETHODIMP Commit() override; 51 | 52 | // IPropertyStoreCapabilities 53 | STDMETHODIMP IsPropertyWritable( __RPC__in REFPROPERTYKEY key) override; 54 | 55 | 56 | static HRESULT WINAPI UpdateRegistry(_In_ BOOL bRegister) throw(); 57 | 58 | private: 59 | bool IsPackage() const { return m_bIsPackage; } 60 | bool IsReadOnly() const { return (m_grfMode & STGM_READWRITE) == 0; } 61 | 62 | CStringW m_usdStagePath; 63 | DWORD m_grfMode = 0; 64 | bool m_bIsPackage = false; 65 | 66 | CComPtr m_pPropertyStoreCache; 67 | 68 | }; 69 | 70 | OBJECT_ENTRY_AUTO(__uuidof(ShellPropertyStore), CShellPropertyStoreImpl) 71 | 72 | -------------------------------------------------------------------------------- /UsdShellExtension/ShellPropertyStoreImpl.rgs: -------------------------------------------------------------------------------- 1 | HKCR 2 | { 3 | NoRemove ATVI.USD 4 | { 5 | %PROPERTYDESCRIPTIONS% 6 | } 7 | 8 | NoRemove ATVI.USDA 9 | { 10 | %PROPERTYDESCRIPTIONS% 11 | } 12 | 13 | NoRemove ATVI.USDC 14 | { 15 | %PROPERTYDESCRIPTIONS% 16 | } 17 | 18 | NoRemove ATVI.USDZ 19 | { 20 | %PROPERTYDESCRIPTIONS% 21 | } 22 | 23 | NoRemove CLSID 24 | { 25 | ForceRemove %CLSID_SHELLPROPERTYSTORE% = s 'Activision USD Property Store' 26 | { 27 | ForceRemove InProcServer32 = s '%MODULE%' 28 | { 29 | val ThreadingModel = s 'Apartment' 30 | } 31 | val DisplayName = s 'Activision USD Property Store' 32 | val DisableProcessIsolation = d '1' 33 | } 34 | } 35 | } 36 | 37 | HKLM 38 | { 39 | NoRemove Software 40 | { 41 | NoRemove Microsoft 42 | { 43 | NoRemove Windows 44 | { 45 | NoRemove CurrentVersion 46 | { 47 | NoRemove PropertySystem 48 | { 49 | NoRemove PropertyHandlers 50 | { 51 | ForceRemove .usd = s '%CLSID_SHELLPROPERTYSTORE%' 52 | ForceRemove .usda = s '%CLSID_SHELLPROPERTYSTORE%' 53 | ForceRemove .usdc = s '%CLSID_SHELLPROPERTYSTORE%' 54 | ForceRemove .usdz = s '%CLSID_SHELLPROPERTYSTORE%' 55 | } 56 | } 57 | 58 | NoRemove 'Shell Extensions' 59 | { 60 | NoRemove Approved 61 | { 62 | ForceRemove val %CLSID_SHELLPROPERTYSTORE% = s 'Activision USD Property Store' 63 | } 64 | } 65 | } 66 | } 67 | } 68 | } 69 | } 70 | 71 | -------------------------------------------------------------------------------- /UsdShellExtension/ShellThumbnailProviderImpl.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "stdafx.h" 16 | #include "ShellThumbnailProviderImpl.h" 17 | #include "Module.h" 18 | #include "resource.h" 19 | 20 | #import "UsdPythonToolsLocalServer.tlb" raw_interfaces_only 21 | 22 | 23 | HRESULT CShellThumbnailProviderImpl::FinalConstruct() 24 | { 25 | return __super::FinalConstruct(); 26 | } 27 | 28 | void CShellThumbnailProviderImpl::FinalRelease() 29 | { 30 | __super::FinalRelease(); 31 | } 32 | 33 | static bool GetRendererFromConfig( CComBSTR &outBstr ) 34 | { 35 | TCHAR sModulePath[MAX_PATH]; 36 | ::GetModuleFileName( g_hInstance, sModulePath, ARRAYSIZE( sModulePath ) ); 37 | ::PathCchRenameExtension( sModulePath, ARRAYSIZE( sModulePath ), L"cfg" ); 38 | 39 | TCHAR sRenderer[128]; 40 | sRenderer[0] = '\0'; 41 | ::GetPrivateProfileString( _T( "RENDERER" ), _T( "THUMBNAIL" ), _T( "" ), sRenderer, ARRAYSIZE( sRenderer ), sModulePath ); 42 | 43 | if ( sRenderer[0] == '\0' ) 44 | return false; 45 | 46 | outBstr = sRenderer; 47 | 48 | return true; 49 | } 50 | 51 | // IInitializeWithFile 52 | STDMETHODIMP CShellThumbnailProviderImpl::Initialize(__RPC__in_string LPCWSTR pszFilePath, DWORD grfMode) 53 | { 54 | UNREFERENCED_PARAMETER( grfMode ); 55 | 56 | if ( pszFilePath == nullptr ) 57 | return E_POINTER; 58 | 59 | m_usdStagePath = pszFilePath; 60 | 61 | return S_OK; 62 | } 63 | 64 | // IThumbnailProvider 65 | STDMETHODIMP CShellThumbnailProviderImpl::GetThumbnail( UINT cx, __RPC__deref_out_opt HBITMAP *phbmp, __RPC__out WTS_ALPHATYPE *pdwAlpha) 66 | { 67 | if ( phbmp == nullptr ) 68 | return E_POINTER; 69 | 70 | HRESULT hr; 71 | 72 | CComPtr pUSDTools; 73 | hr = pUSDTools.CoCreateInstance( __uuidof(UsdPythonToolsLib::UsdPythonTools) ); 74 | if ( FAILED( hr ) ) 75 | return hr; 76 | 77 | CComBSTR bstrRenderer; 78 | bool bRendererIsSet = GetRendererFromConfig( bstrRenderer ); 79 | 80 | BSTR sThumbnailImage = nullptr; 81 | hr = pUSDTools->Record( CComBSTR(m_usdStagePath), cx, bRendererIsSet ? bstrRenderer : nullptr, &sThumbnailImage ); 82 | if ( FAILED( hr ) ) 83 | return hr; 84 | 85 | CComBSTR bstrThumbnailImage; 86 | bstrThumbnailImage.Attach( sThumbnailImage ); 87 | 88 | CImage imgBmp; 89 | hr = imgBmp.Load( bstrThumbnailImage ); 90 | if ( FAILED( hr ) ) 91 | return hr; 92 | 93 | *phbmp = imgBmp.Detach(); 94 | 95 | if ( pdwAlpha ) 96 | *pdwAlpha = WTSAT_ARGB; 97 | 98 | return S_OK; 99 | } 100 | 101 | 102 | HRESULT WINAPI CShellThumbnailProviderImpl::UpdateRegistry(_In_ BOOL bRegister) throw() 103 | { 104 | ATL::_ATL_REGMAP_ENTRY regMapEntries[] = 105 | { 106 | { L"CLSID_SHELLTHUMBNAILPROVIDER", L"{2877CB72-1427-43B0-A2B4-9CB1B2BA8C53}" }, 107 | { nullptr, nullptr } 108 | }; 109 | 110 | return g_AtlModule.UpdateRegistryFromResource(IDR_REGISTRY_SHELLTHUMBNAILPROVIDERIMPL, bRegister, regMapEntries); 111 | } -------------------------------------------------------------------------------- /UsdShellExtension/ShellThumbnailProviderImpl.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #include "ShellExt_h.h" 18 | 19 | #include "resource.h" 20 | 21 | 22 | class ATL_NO_VTABLE CShellThumbnailProviderImpl : 23 | public CComObjectRootEx, 24 | public CComCoClass, 25 | public IInitializeWithFile, 26 | public IThumbnailProvider 27 | { 28 | public: 29 | DECLARE_NOT_AGGREGATABLE(CShellThumbnailProviderImpl) 30 | DECLARE_PROTECT_FINAL_CONSTRUCT() 31 | 32 | BEGIN_COM_MAP(CShellThumbnailProviderImpl) 33 | COM_INTERFACE_ENTRY(IInitializeWithFile) 34 | COM_INTERFACE_ENTRY(IThumbnailProvider) 35 | END_COM_MAP() 36 | 37 | HRESULT FinalConstruct(); 38 | void FinalRelease(); 39 | 40 | // IInitializeWithFile 41 | STDMETHODIMP Initialize( __RPC__in_string LPCWSTR pszFilePath, DWORD grfMode ) override; 42 | 43 | // IThumbnailProvider 44 | STDMETHODIMP GetThumbnail( UINT cx, __RPC__deref_out_opt HBITMAP *phbmp, __RPC__out WTS_ALPHATYPE *pdwAlpha) override; 45 | 46 | static HRESULT WINAPI UpdateRegistry(_In_ BOOL bRegister) throw(); 47 | 48 | private: 49 | CStringW m_usdStagePath; 50 | }; 51 | 52 | OBJECT_ENTRY_AUTO(__uuidof(ShellThumbnailProvider), CShellThumbnailProviderImpl) 53 | 54 | -------------------------------------------------------------------------------- /UsdShellExtension/ShellThumbnailProviderImpl.rgs: -------------------------------------------------------------------------------- 1 | HKCR 2 | { 3 | NoRemove ATVI.USD 4 | { 5 | NoRemove shellex 6 | { 7 | ForceRemove {e357fccd-a995-4576-b01f-234630154e96} = s '%CLSID_SHELLTHUMBNAILPROVIDER%' 8 | } 9 | ForceRemove DefaultIcon = s '%MODULE%,-113' 10 | } 11 | 12 | NoRemove ATVI.USDA 13 | { 14 | NoRemove shellex 15 | { 16 | ForceRemove {e357fccd-a995-4576-b01f-234630154e96} = s '%CLSID_SHELLTHUMBNAILPROVIDER%' 17 | } 18 | ForceRemove DefaultIcon = s '%MODULE%,-113' 19 | } 20 | 21 | NoRemove ATVI.USDC 22 | { 23 | NoRemove shellex 24 | { 25 | ForceRemove {e357fccd-a995-4576-b01f-234630154e96} = s '%CLSID_SHELLTHUMBNAILPROVIDER%' 26 | } 27 | ForceRemove DefaultIcon = s '%MODULE%,-113' 28 | } 29 | 30 | NoRemove ATVI.USDZ 31 | { 32 | NoRemove shellex 33 | { 34 | ForceRemove {e357fccd-a995-4576-b01f-234630154e96} = s '%CLSID_SHELLTHUMBNAILPROVIDER%' 35 | } 36 | ForceRemove DefaultIcon = s '%MODULE%,-113' 37 | } 38 | 39 | NoRemove CLSID 40 | { 41 | ForceRemove %CLSID_SHELLTHUMBNAILPROVIDER% = s 'Activision USD Thumbnail Provider' 42 | { 43 | ForceRemove InProcServer32 = s '%MODULE%' 44 | { 45 | val ThreadingModel = s 'Apartment' 46 | } 47 | val DisplayName = s 'Activision USD Thumbnail Provider' 48 | val DisableProcessIsolation = d '1' 49 | val DisableLowILProcessIsolation = d '1' 50 | } 51 | } 52 | } 53 | 54 | HKLM 55 | { 56 | NoRemove Software 57 | { 58 | NoRemove Microsoft 59 | { 60 | NoRemove Windows 61 | { 62 | NoRemove CurrentVersion 63 | { 64 | NoRemove 'Shell Extensions' 65 | { 66 | NoRemove Approved 67 | { 68 | ForceRemove val %CLSID_SHELLTHUMBNAILPROVIDER% = s 'Activision USD Thumbnail Provider' 69 | } 70 | } 71 | } 72 | } 73 | } 74 | } 75 | } 76 | 77 | HKCU 78 | { 79 | NoRemove Software 80 | { 81 | NoRemove Microsoft 82 | { 83 | NoRemove Windows 84 | { 85 | NoRemove CurrentVersion 86 | { 87 | NoRemove 'Shell Extensions' 88 | { 89 | NoRemove Approved 90 | { 91 | ForceRemove val %CLSID_SHELLTHUMBNAILPROVIDER% = s 'Activision USD Thumbnail Provider' 92 | } 93 | } 94 | } 95 | } 96 | } 97 | } 98 | } -------------------------------------------------------------------------------- /UsdShellExtension/USDLogoLrgWithAlpha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Activision/USDShellExtension/b7655b9436f24edb28cb8079386e9a3aa43b15a3/UsdShellExtension/USDLogoLrgWithAlpha.png -------------------------------------------------------------------------------- /UsdShellExtension/UWPProgressBar.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "stdafx.h" 16 | #include "UWPProgressBar.h" 17 | 18 | static float GetPerformanceFrequency() 19 | { 20 | LARGE_INTEGER li; 21 | QueryPerformanceFrequency( &li ); 22 | return (float)li.QuadPart; 23 | } 24 | 25 | static float GetTimeInterval() 26 | { 27 | static float s_fFreq = GetPerformanceFrequency(); 28 | return s_fFreq; 29 | } 30 | 31 | static float GetTimePrecise() 32 | { 33 | LARGE_INTEGER li; 34 | QueryPerformanceCounter( &li ); 35 | 36 | return (float)li.QuadPart / (GetTimeInterval() / 1000.0f); 37 | } 38 | 39 | void CUWPProgressBar::Init() 40 | { 41 | m_LastUpdateTime = GetTimePrecise(); 42 | 43 | m_ptProgressBarDot[0].Y = -10.0f; 44 | m_ptProgressBarDot[0].X = 0; 45 | for ( int i = 1; i < ARRAYSIZE( m_ptProgressBarDot ); ++i ) 46 | { 47 | m_ptProgressBarDot[i].Y = m_ptProgressBarDot[i - 1].Y - 0.5f; 48 | m_ptProgressBarDot[i].X = 0.0f; 49 | } 50 | } 51 | 52 | void CUWPProgressBar::UpdateProgressBar() 53 | { 54 | float tCurrent = GetTimePrecise(); 55 | float fDelta = (float)(tCurrent - m_LastUpdateTime); 56 | m_LastUpdateTime = tCurrent; 57 | 58 | fDelta /= 100.0f; 59 | 60 | for ( Gdiplus::PointF &pt : m_ptProgressBarDot ) 61 | { 62 | pt.Y += fDelta; 63 | 64 | // x = (y^3 / 32) + y 65 | // the resulting ranges are: 66 | // x: [-30,+30] 67 | // y: [-10,+10] 68 | pt.X = ((pt.Y * pt.Y * pt.Y) / 32.0f) + pt.Y; 69 | 70 | // if we are past our range, go back to -10.0f 71 | if ( pt.Y > 10.0f ) 72 | pt.Y -= 20.0f; 73 | } 74 | } 75 | 76 | void CUWPProgressBar::DrawProgressBar( HWND hWnd, Gdiplus::Graphics &gfx, Gdiplus::RectF &rcArea, Gdiplus::Color &backgroundColor ) 77 | { 78 | float fDpiWindow = static_cast(::GetDpiForWindow( hWnd )); 79 | float fDpiScale = fDpiWindow / USER_DEFAULT_SCREEN_DPI; 80 | 81 | Gdiplus::SolidBrush brush( backgroundColor ); 82 | gfx.FillRectangle( &brush, rcArea ); 83 | 84 | Gdiplus::SizeF dot; 85 | dot.Width = kfProgressBarDotSize; 86 | dot.Height = kfProgressBarDotSize; 87 | 88 | // DPI adjust 89 | dot.Width *= fDpiScale; 90 | dot.Height *= fDpiScale; 91 | 92 | for ( Gdiplus::PointF &pt : m_ptProgressBarDot ) 93 | { 94 | // dots do not look good in a width below 720 or so 95 | float fScaledWidth = std::max( 720.0f, (float)rcArea.Width ); 96 | 97 | // pt.X [-30.0f, 30.0f] 98 | float scaledX = (((pt.X + 30.0f) * fScaledWidth) / 60.0f); 99 | scaledX += ((float)rcArea.Width - fScaledWidth) / 2.0f; 100 | if ( scaledX < 0 || (scaledX + dot.Width) >= rcArea.Width ) 101 | continue; 102 | 103 | Gdiplus::RectF rcDot( 104 | rcArea.X + scaledX, 105 | rcArea.Y + ((rcArea.Height - dot.Height) / 2.0f), 106 | dot.Width, 107 | dot.Height ); 108 | 109 | Gdiplus::Color clrDot; 110 | BYTE bAlpha = (BYTE)(((100.0f - fabsf( pt.X )) / 100.0f) * 255.0f); 111 | //clrDot.SetValue( Gdiplus::Color::MakeARGB(bAlpha, 52, 198, 243) ); 112 | clrDot.SetValue( Gdiplus::Color::MakeARGB( bAlpha, 200, 200, 200 ) ); 113 | Gdiplus::SolidBrush brushDot( clrDot ); 114 | 115 | gfx.FillEllipse( &brushDot, rcDot ); 116 | } 117 | } 118 | 119 | void CUWPProgressBar::SetBackgroundColor( COLORREF color, bool bWindowsExplorerUsingLightTheme ) 120 | { 121 | UNREFERENCED_PARAMETER( color ); 122 | 123 | m_bWindowsExplorerUsingLightTheme = bWindowsExplorerUsingLightTheme; 124 | } -------------------------------------------------------------------------------- /UsdShellExtension/UWPProgressBar.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | // This class attempts to replicate the UWP XAML progress bar 18 | 19 | class CUWPProgressBar 20 | { 21 | public: 22 | void Init(); 23 | 24 | void UpdateProgressBar(); 25 | void DrawProgressBar( HWND hWnd, Gdiplus::Graphics &gfx, Gdiplus::RectF &rcDst, Gdiplus::Color &backgroundColor ); 26 | void SetBackgroundColor( COLORREF color, bool bWindowsExplorerUsingLightTheme ); 27 | 28 | private: 29 | static constexpr size_t knProgressBarDotCount = 5; 30 | static constexpr float kfProgressBarDotSize = 4.0f; 31 | Gdiplus::PointF m_ptProgressBarDot[knProgressBarDotCount]; 32 | float m_LastUpdateTime = 0; 33 | bool m_bWindowsExplorerUsingLightTheme = true; 34 | }; 35 | -------------------------------------------------------------------------------- /UsdShellExtension/UsdLoadScreenDlg.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #include "resource.h" 18 | #include "UWPProgressBar.h" 19 | 20 | class CUsdLoadScreenDlg : public CDialogImpl 21 | { 22 | public: 23 | enum { IDD = IDD_LOADSCREEN }; 24 | 25 | void SetBackgroundColor( COLORREF color ); 26 | 27 | private: 28 | void OnFinalMessage( _In_ HWND hWnd ) override; 29 | 30 | void CreateBackBuffer( UINT width, UINT height ); 31 | void Draw( Gdiplus::Graphics &gfx ); 32 | 33 | void InvalidateProgressBar( Gdiplus::RectF &rcArea ); 34 | 35 | BEGIN_MSG_MAP( CUsdLoadScreenDlg ) 36 | MESSAGE_HANDLER( WM_INITDIALOG, OnInitDialog ) 37 | MESSAGE_HANDLER( WM_PAINT, OnPaint ) 38 | MESSAGE_HANDLER( WM_ERASEBKGND, OnEraseBkgnd ) 39 | MESSAGE_HANDLER( WM_SIZE, OnSize ) 40 | MESSAGE_HANDLER( WM_CTLCOLORDLG, OnCtlColorDlg ) 41 | MESSAGE_HANDLER( WM_TIMER, OnTimer ) 42 | END_MSG_MAP() 43 | 44 | LRESULT OnInitDialog( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled ); 45 | LRESULT OnPaint( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled ); 46 | LRESULT OnEraseBkgnd( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled ); 47 | LRESULT OnSize( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled ); 48 | LRESULT OnCtlColorDlg( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled ); 49 | LRESULT OnTimer( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled ); 50 | 51 | CUWPProgressBar m_ProgressBar; 52 | 53 | CImage m_imgBackBuffer; 54 | HBRUSH m_hBackground = nullptr; 55 | ULONG_PTR m_gdiplusToken = 0; 56 | Gdiplus::Image *m_pImgLoadScreen = nullptr; 57 | Gdiplus::Image *m_pImgLogo = nullptr; 58 | Gdiplus::Color m_Background; 59 | 60 | HDC m_hDCBackbuffer = nullptr; 61 | Gdiplus::Graphics *m_pGfx = nullptr; 62 | Gdiplus::RectF m_rcProgressArea; 63 | 64 | bool m_bWindowsExplorerUsingLightTheme = true; 65 | }; 66 | 67 | class CAutoDpiAware 68 | { 69 | public: 70 | CAutoDpiAware(DPI_AWARENESS_CONTEXT ctx) 71 | { 72 | m_PreviousContext = ::GetThreadDpiAwarenessContext(); 73 | ::SetThreadDpiAwarenessContext( ctx ); 74 | } 75 | ~CAutoDpiAware() 76 | { 77 | ::SetThreadDpiAwarenessContext( m_PreviousContext ); 78 | } 79 | 80 | private: 81 | DPI_AWARENESS_CONTEXT m_PreviousContext; 82 | }; -------------------------------------------------------------------------------- /UsdShellExtension/UsdMetadata.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "stdafx.h" 16 | #include "UsdMetadata.h" 17 | #include "UsdPropertyKeys.h" 18 | 19 | static std::string DictionaryToString(const pxr::VtDictionary &dict, std::string prefix = "") 20 | { 21 | // Exports all values on separate lines 22 | // Format: dict.key=value 23 | 24 | std::string result; 25 | 26 | for ( const std::pair& stat : dict ) 27 | { 28 | if ( stat.second.GetTypeid() == typeid(pxr::VtDictionary) ) 29 | { 30 | pxr::VtDictionary nestedDict = stat.second.Get(); 31 | std::string nestedPrefix = prefix; 32 | if ( !nestedPrefix.empty() ) 33 | nestedPrefix += "."; 34 | nestedPrefix += stat.first; 35 | result += DictionaryToString( nestedDict, nestedPrefix ); 36 | } 37 | else 38 | { 39 | std::string name = prefix; 40 | if ( !name.empty() ) 41 | name += "."; 42 | name += stat.first; 43 | 44 | std::stringstream ss; 45 | if ( stat.second.GetTypeid() == typeid(size_t) ) 46 | ss << name << "=" << stat.second.Get() << std::endl; 47 | else if ( stat.second.GetTypeid() == typeid(double) ) 48 | ss << name << "=" << stat.second.Get() << std::endl; 49 | else if ( stat.second.GetTypeid() == typeid(std::string) ) 50 | ss << name << "=" << stat.second << std::endl; 51 | else 52 | ss << name << "=" << "[UNKNOWN TYPE]" << std::endl; 53 | 54 | result += ss.str(); 55 | } 56 | } 57 | 58 | return result; 59 | } 60 | 61 | HRESULT ReadUsdMetadata( const pxr::SdfLayerRefPtr &rootLayer, const pxr::VtDictionary &customLayerData, IPropertyStoreCache* pPropertyStoreCache ) 62 | { 63 | HRESULT hr; 64 | 65 | std::string sComment = rootLayer->GetComment(); 66 | hr = StoreStringValue( pPropertyStoreCache, PKEY_Comment, sComment.c_str() ); 67 | 68 | std::string sDocumentation = rootLayer->GetDocumentation(); 69 | hr = StoreStringValue( pPropertyStoreCache, PKEY_USD_DOCUMENTATION, sDocumentation.c_str() ); 70 | 71 | std::string sCustomLayerData = DictionaryToString( customLayerData ); 72 | hr = StoreStringValue( pPropertyStoreCache, PKEY_USD_CUSTOMLAYERDATA, sCustomLayerData.c_str() ); 73 | 74 | return S_OK; 75 | } 76 | 77 | HRESULT WriteUsdMetadata( pxr::SdfLayerRefPtr &rootLayer, pxr::VtDictionary &customLayerData, IPropertyStoreCache *pPropertyStoreCache, bool &bIsDirty ) 78 | { 79 | UNREFERENCED_PARAMETER( customLayerData ); 80 | 81 | HRESULT hr; 82 | PSC_STATE state; 83 | 84 | hr = pPropertyStoreCache->GetState( PKEY_Comment, &state); 85 | if ( SUCCEEDED( hr ) && state == PSC_DIRTY ) 86 | { 87 | std::string sValue; 88 | hr = GetValueAsUTF8( pPropertyStoreCache, PKEY_Comment, sValue ); 89 | if ( SUCCEEDED( hr ) ) 90 | { 91 | rootLayer->SetComment( sValue ); 92 | bIsDirty = true; 93 | } 94 | } 95 | 96 | hr = pPropertyStoreCache->GetState( PKEY_USD_DOCUMENTATION, &state); 97 | if ( SUCCEEDED( hr ) && state == PSC_DIRTY ) 98 | { 99 | std::string sValue; 100 | hr = GetValueAsUTF8( pPropertyStoreCache, PKEY_USD_DOCUMENTATION, sValue ); 101 | if ( SUCCEEDED( hr ) ) 102 | { 103 | rootLayer->SetDocumentation( sValue ); 104 | bIsDirty = true; 105 | } 106 | } 107 | 108 | return S_OK; 109 | } 110 | 111 | HRESULT IsMetadataPropertyWritable( REFPROPERTYKEY key ) 112 | { 113 | if ( IsEqualPropertyKey( key, PKEY_Comment ) /*|| 114 | IsEqualPropertyKey( key, PKEY_USD_DOCUMENTATION )*/ ) 115 | return S_OK; 116 | 117 | return S_FALSE; 118 | } -------------------------------------------------------------------------------- /UsdShellExtension/UsdMetadata.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | HRESULT ReadUsdMetadata( const pxr::SdfLayerRefPtr &rootLayer, const pxr::VtDictionary &customLayerData, IPropertyStoreCache *pPropertyStoreCache ); 18 | HRESULT WriteUsdMetadata( pxr::SdfLayerRefPtr &rootLayer, pxr::VtDictionary &customLayerData, IPropertyStoreCache *pPropertyStoreCache, bool &bIsDirty ); 19 | HRESULT IsMetadataPropertyWritable( REFPROPERTYKEY key ); 20 | 21 | inline HRESULT StoreStringValue( IPropertyStoreCache *pPropertyStoreCache, REFPROPERTYKEY key, LPCWSTR sValue ) 22 | { 23 | HRESULT hr; 24 | 25 | PROPVARIANT propvar = {}; 26 | hr = InitPropVariantFromString( sValue, &propvar ); 27 | if ( SUCCEEDED( hr ) ) 28 | { 29 | hr = PSCoerceToCanonicalValue( key, &propvar ); 30 | if ( SUCCEEDED( hr ) ) 31 | { 32 | hr = pPropertyStoreCache->SetValueAndState( key, &propvar, PSC_NORMAL ); 33 | } 34 | 35 | PropVariantClear( &propvar ); 36 | } 37 | 38 | return hr; 39 | } 40 | 41 | inline HRESULT StoreStringValue( IPropertyStoreCache *pPropertyStoreCache, REFPROPERTYKEY key, LPCSTR sValue ) 42 | { 43 | return StoreStringValue( pPropertyStoreCache, key, ATL::CA2W( sValue, CP_UTF8 ) ); 44 | } 45 | 46 | inline HRESULT StoreUInt64Value( IPropertyStoreCache *pPropertyStoreCache, REFPROPERTYKEY key, uint64_t nValue ) 47 | { 48 | HRESULT hr; 49 | 50 | PROPVARIANT propvar = {}; 51 | hr = InitPropVariantFromUInt64( nValue, &propvar ); 52 | if ( SUCCEEDED( hr ) ) 53 | { 54 | hr = pPropertyStoreCache->SetValueAndState( key, &propvar, PSC_NORMAL ); 55 | 56 | PropVariantClear( &propvar ); 57 | } 58 | 59 | return hr; 60 | } 61 | 62 | inline HRESULT StoreDateValue( IPropertyStoreCache *pPropertyStoreCache, REFPROPERTYKEY key, const FILETIME *pft ) 63 | { 64 | HRESULT hr; 65 | 66 | PROPVARIANT propvar = {}; 67 | hr = InitPropVariantFromFileTime( pft, &propvar ); 68 | if ( SUCCEEDED( hr ) ) 69 | { 70 | hr = pPropertyStoreCache->SetValueAndState( key, &propvar, PSC_NORMAL ); 71 | 72 | PropVariantClear( &propvar ); 73 | } 74 | 75 | return hr; 76 | } 77 | 78 | inline HRESULT GetValueAsUTF8( IPropertyStoreCache *pPropertyStoreCache, REFPROPERTYKEY key, std::string &value ) 79 | { 80 | HRESULT hr; 81 | 82 | PROPVARIANT propVariant; 83 | hr = pPropertyStoreCache->GetValue( key, &propVariant ); 84 | if ( SUCCEEDED( hr ) ) 85 | { 86 | LPCWSTR sUTF16Value = PropVariantToStringWithDefault( propVariant, L"" ); 87 | value = ATL::CW2A( sUTF16Value, CP_UTF8 ); 88 | 89 | return hr; 90 | } 91 | 92 | return hr; 93 | } 94 | -------------------------------------------------------------------------------- /UsdShellExtension/UsdPropertyKeys.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #define INITGUID 18 | #include 19 | 20 | // {3B7AB16C-C876-461C-BBA5-2F1182A834D1} 21 | DEFINE_PROPERTYKEY(PKEY_USD_PROPGROUP, 0x3b7ab16c, 0xc876, 0x461c, 0xbb, 0xa5, 0x2f, 0x11, 0x82, 0xa8, 0x34, 0xd1, PID_FIRST_USABLE + 0); 22 | 23 | // {3CEF792B-F66F-42E1-A59D-7BE261E682AE} 24 | DEFINE_PROPERTYKEY(PKEY_USD_DOCUMENTATION, 0x3cef792b, 0xf66f, 0x42e1, 0xa5, 0x9d, 0x7b, 0xe2, 0x61, 0xe6, 0x82, 0xae, PID_FIRST_USABLE + 1); 25 | 26 | // {89379215-052D-429D-9A74-6D220E41C86D} 27 | DEFINE_PROPERTYKEY(PKEY_USD_CUSTOMLAYERDATA, 0x89379215, 0x52d, 0x429d, 0x9a, 0x74, 0x6d, 0x22, 0xe, 0x41, 0xc8, 0x6d, PID_FIRST_USABLE + 2); 28 | 29 | 30 | #undef INITGUID -------------------------------------------------------------------------------- /UsdShellExtension/UsdPropertyKeys.propdesc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /UsdShellExtension/UsdShellExtension-monolithic.manifest: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /UsdShellExtension/UsdShellExtension-shared.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /UsdShellExtension/UsdShellExtension.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Activision/USDShellExtension/b7655b9436f24edb28cb8079386e9a3aa43b15a3/UsdShellExtension/UsdShellExtension.ini -------------------------------------------------------------------------------- /UsdShellExtension/UsdShellExtension.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {d9bfe0ff-29ed-458b-8cd8-ec1eae4c9c07} 18 | 19 | 20 | {ee807d35-c06f-4914-b5d4-32a300dc72d8} 21 | 22 | 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | Header Files 32 | 33 | 34 | Header Files 35 | 36 | 37 | Header Files 38 | 39 | 40 | Header Files 41 | 42 | 43 | Header Files 44 | 45 | 46 | Header Files 47 | 48 | 49 | Header Files 50 | 51 | 52 | Header Files 53 | 54 | 55 | Header Files 56 | 57 | 58 | Header Files 59 | 60 | 61 | Shared 62 | 63 | 64 | 65 | 66 | Source Files 67 | 68 | 69 | Source Files 70 | 71 | 72 | Source Files 73 | 74 | 75 | Source Files 76 | 77 | 78 | Source Files 79 | 80 | 81 | Source Files 82 | 83 | 84 | Source Files 85 | 86 | 87 | Source Files 88 | 89 | 90 | Source Files 91 | 92 | 93 | Source Files 94 | 95 | 96 | Source Files 97 | 98 | 99 | Shared 100 | 101 | 102 | 103 | 104 | Source Files 105 | 106 | 107 | Resource Files 108 | 109 | 110 | Resource Files 111 | 112 | 113 | Resource Files 114 | 115 | 116 | Resource Files 117 | 118 | 119 | Resource Files 120 | 121 | 122 | Files 123 | 124 | 125 | Files 126 | 127 | 128 | Files 129 | 130 | 131 | Files 132 | 133 | 134 | 135 | 136 | Source Files 137 | 138 | 139 | 140 | 141 | Resource Files 142 | 143 | 144 | 145 | 146 | Resource Files 147 | 148 | 149 | Resource Files 150 | 151 | 152 | Resource Files 153 | 154 | 155 | 156 | 157 | 158 | -------------------------------------------------------------------------------- /UsdShellExtension/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Activision/USDShellExtension/b7655b9436f24edb28cb8079386e9a3aa43b15a3/UsdShellExtension/logo.png -------------------------------------------------------------------------------- /UsdShellExtension/plugInfo.json: -------------------------------------------------------------------------------- 1 | { 2 | "Plugins": [ 3 | { 4 | "Info": { 5 | "Types": { 6 | "ArResolverShellExtension" : { 7 | "bases": ["ArResolver"] 8 | } 9 | } 10 | }, 11 | "LibraryPath": "UsdShellExtension.dll", 12 | "Name": "ArResolverShellExtension", 13 | "Type": "library" 14 | } 15 | ] 16 | } -------------------------------------------------------------------------------- /UsdShellExtension/register.bat: -------------------------------------------------------------------------------- 1 | REM This batch needs to be executed as administrator! 2 | 3 | @echo off 4 | 5 | cd /D %~dp0 6 | 7 | set /a success = 1 8 | 9 | echo UsdPreviewLocalServer.exe /RegServer 10 | start /wait UsdPreviewLocalServer.exe /RegServer 11 | if %ERRORLEVEL% NEQ 0 ( 12 | echo UsdPreviewLocalServer.exe failed to register! 13 | set /a success = 0 14 | ) 15 | 16 | echo UsdPythonToolsLocalServer.exe /RegServer 17 | start /wait UsdPythonToolsLocalServer.exe /RegServer 18 | if %ERRORLEVEL% NEQ 0 ( 19 | echo UsdPythonToolsLocalServer.exe failed to register! 20 | set /a success = 0 21 | ) 22 | 23 | echo UsdSdkToolsLocalServer.exe /RegServer 24 | start /wait UsdSdkToolsLocalServer.exe /RegServer 25 | if %ERRORLEVEL% NEQ 0 ( 26 | echo UsdSdkToolsLocalServer.exe failed to register! 27 | set /a success = 0 28 | ) 29 | 30 | echo regsvr32.exe /n /i UsdShellExtension.dll 31 | regsvr32.exe /n /i UsdShellExtension.dll 32 | 33 | if %success% NEQ 1 ( 34 | pause 35 | exit /b 1 36 | ) -------------------------------------------------------------------------------- /UsdShellExtension/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by ShellExt.rc 4 | // 5 | #define IDR_REGISTRY_SHELLPREVIEWHANDLERIMPL 112 6 | #define IDI_ICON_USD 113 7 | #define IDR_REGISTRY_SHELLTHUMBNAILPROVIDERIMPL 114 8 | #define IDR_REGISTRY_MODULE 115 9 | #define IDD_LOADSCREEN 116 10 | #define IDB_LOADSCREEN 118 11 | #define IDR_REGISTRY_SHELLPROPERTYSTOREIMPL 119 12 | #define IDS_USD_DOCUMENTATION_LABEL 123 13 | #define IDR_XML_PROPDESC_USD 124 14 | #define IDS_USD_DOCUMENTATION_INVITATIONTEXT 124 15 | #define IDS_USD_DOCUMENTATION_MNEMONICS 125 16 | #define IDB_LOGO 125 17 | #define IDS_USD_PROPGROUP_USD_LABEL 126 18 | #define IDS_FILE_USD 138 19 | #define IDS_FILE_USDA 139 20 | #define IDS_FILE_USDC 140 21 | #define IDS_FILE_USDZ 141 22 | #define IDS_SHELL_VIEW 142 23 | #define IDS_SHELL_EDIT 143 24 | #define IDS_SHELL_CRATE 144 25 | #define IDS_SHELL_UNCRATE 145 26 | #define IDS_SHELL_FLATTEN 146 27 | #define IDS_SHELL_REFRESHTHUMBNAIL 147 28 | #define IDS_SHELL_STATS 148 29 | #define IDS_USD_CUSTOMLAYERDATA_LABEL 149 30 | #define IDS_USD_CUSTOMLAYERDATA_MNEMONICS 150 31 | 32 | // Next default values for new objects 33 | // 34 | #ifdef APSTUDIO_INVOKED 35 | #ifndef APSTUDIO_READONLY_SYMBOLS 36 | #define _APS_NEXT_RESOURCE_VALUE 126 37 | #define _APS_NEXT_COMMAND_VALUE 40011 38 | #define _APS_NEXT_CONTROL_VALUE 1001 39 | #define _APS_NEXT_SYMED_VALUE 101 40 | #endif 41 | #endif 42 | -------------------------------------------------------------------------------- /UsdShellExtension/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "stdafx.h" -------------------------------------------------------------------------------- /UsdShellExtension/stdafx.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #define WIN32_LEAN_AND_MEAN 18 | #define NOBITMAP 19 | #define NOMCX 20 | #define NOSERVICE 21 | #define NOMINMAX 22 | 23 | #define GDIPVER 0x0110 24 | 25 | #include 26 | #define _WIN32_WINNT 0x0A00 27 | #include 28 | 29 | #include 30 | #include 31 | #include 32 | 33 | #pragma warning( push ) 34 | #pragma warning( disable : 4244 4305 5033 4100 4201 4245 4127 ) 35 | 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | 49 | 50 | #pragma warning( pop ) 51 | 52 | 53 | #ifndef max 54 | #define max(a,b) (((a) > (b)) ? (a) : (b)) 55 | #endif 56 | #ifndef min 57 | #define min(a,b) (((a) < (b)) ? (a) : (b)) 58 | #endif 59 | 60 | #include 61 | #include 62 | #include 63 | #include 64 | #include 65 | #include 66 | #include 67 | 68 | #include 69 | #include 70 | #include 71 | #include 72 | #include 73 | #include 74 | 75 | #include 76 | #include 77 | 78 | #include -------------------------------------------------------------------------------- /UsdShellExtension/unregister.bat: -------------------------------------------------------------------------------- 1 | REM This batch needs to be executed as administrator! 2 | 3 | @echo off 4 | 5 | cd /D %~dp0 6 | 7 | set /a success = 1 8 | 9 | echo UsdPreviewLocalServer.exe /UnregServer 10 | start /wait UsdPreviewLocalServer.exe /UnregServer 11 | if %ERRORLEVEL% NEQ 0 ( 12 | echo UsdPreviewLocalServer.exe failed to unregister! 13 | set /a success = 0 14 | ) 15 | 16 | echo UsdPythonToolsLocalServer.exe /UnregServer 17 | start /wait UsdPythonToolsLocalServer.exe /UnregServer 18 | if %ERRORLEVEL% NEQ 0 ( 19 | echo UsdPythonToolsLocalServer.exe failed to unregister! 20 | set /a success = 0 21 | ) 22 | 23 | echo UsdSdkToolsLocalServer.exe /UnregServer 24 | start /wait UsdSdkToolsLocalServer.exe /UnregServer 25 | if %ERRORLEVEL% NEQ 0 ( 26 | echo UsdSdkToolsLocalServer.exe failed to unregister! 27 | set /a success = 0 28 | ) 29 | 30 | echo regsvr32.exe /u UsdShellExtension.dll 31 | regsvr32.exe /u UsdShellExtension.dll 32 | 33 | if %success% NEQ 1 ( 34 | pause 35 | exit /b 1 36 | ) -------------------------------------------------------------------------------- /UsdShellExtension/usd.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Activision/USDShellExtension/b7655b9436f24edb28cb8079386e9a3aa43b15a3/UsdShellExtension/usd.ico -------------------------------------------------------------------------------- /UsdShellExtensionInstaller/CmdLineArgs.nsh: -------------------------------------------------------------------------------- 1 | !include FileFunc.nsh 2 | 3 | ;-------------------------------- 4 | Var CmdLineUsdPath 5 | Var CmdLineUsdPythonPath 6 | Var CmdLineUsdPxrPluginPathName 7 | 8 | Var CmdLinePythonPath 9 | Var CmdLinePythonPythonPath 10 | 11 | Var CmdLineRendererPreview 12 | Var CmdLineRendererThumbnail 13 | Var CmdLineRendererView 14 | 15 | ;-------------------------------- 16 | Function ParseCommandLine 17 | 18 | ${GetParameters} $R0 19 | ClearErrors 20 | 21 | ${GetOptions} $R0 /USD_PATH= $CmdLineUsdPath 22 | ${GetOptions} $R0 /USD_PYTHONPATH= $CmdLineUsdPythonPath 23 | ${GetOptions} $R0 /USD_PXRPLUGINPATHNAME= $CmdLineUsdPxrPluginPathName 24 | 25 | ${GetOptions} $R0 /PYTHON_PATH= $CmdLinePythonPath 26 | ${GetOptions} $R0 /PYTHON_PYTHONPATH= $CmdLinePythonPythonPath 27 | 28 | ${GetOptions} $R0 /RENDERER_PREVIEW= $CmdLineRendererPreview 29 | ${GetOptions} $R0 /RENDERER_THUMBNAIL= $CmdLineRendererThumbnail 30 | ${GetOptions} $R0 /RENDERER_VIEW= $CmdLineRendererView 31 | 32 | FunctionEnd -------------------------------------------------------------------------------- /UsdShellExtensionInstaller/ShellLinkSetRunAs.nsh: -------------------------------------------------------------------------------- 1 | !include LogicLib.nsh 2 | 3 | !ifndef IPersistFile 4 | !define IPersistFile {0000010b-0000-0000-c000-000000000046} 5 | !endif 6 | !ifndef CLSID_ShellLink 7 | !define CLSID_ShellLink {00021401-0000-0000-C000-000000000046} 8 | !define IID_IShellLinkA {000214EE-0000-0000-C000-000000000046} 9 | !define IID_IShellLinkW {000214F9-0000-0000-C000-000000000046} 10 | !define IShellLinkDataList {45e2b4ae-b1c3-11d0-b92f-00a0c90312e1} 11 | !ifdef NSIS_UNICODE 12 | !define IID_IShellLink ${IID_IShellLinkW} 13 | !else 14 | !define IID_IShellLink ${IID_IShellLinkA} 15 | !endif 16 | !endif 17 | 18 | 19 | 20 | Function ShellLinkSetRunAs 21 | System::Store S 22 | pop $9 23 | System::Call "ole32::CoCreateInstance(g'${CLSID_ShellLink}',i0,i1,g'${IID_IShellLink}',*i.r1)i.r0" 24 | ${If} $0 = 0 25 | System::Call "$1->0(g'${IPersistFile}',*i.r2)i.r0" ;QI 26 | ${If} $0 = 0 27 | System::Call "$2->5(w '$9',i 0)i.r0" ;Load 28 | ${If} $0 = 0 29 | System::Call "$1->0(g'${IShellLinkDataList}',*i.r3)i.r0" ;QI 30 | ${If} $0 = 0 31 | System::Call "$3->6(*i.r4)i.r0" ;GetFlags 32 | ${If} $0 = 0 33 | System::Call "$3->7(i $4|0x2000)i.r0" ;SetFlags ;SLDF_RUNAS_USER 34 | ${If} $0 = 0 35 | System::Call "$2->6(w '$9',i1)i.r0" ;Save 36 | ${EndIf} 37 | ${EndIf} 38 | System::Call "$3->2()" ;Release 39 | ${EndIf} 40 | System::Call "$2->2()" ;Release 41 | ${EndIf} 42 | ${EndIf} 43 | System::Call "$1->2()" ;Release 44 | ${EndIf} 45 | push $0 46 | System::Store L 47 | FunctionEnd 48 | 49 | !macro ShellLinkSetRunAs link 50 | push `${link}` 51 | 52 | Call ShellLinkSetRunAs 53 | !macroend -------------------------------------------------------------------------------- /UsdShellExtensionInstaller/UsdConfigPage.nsh: -------------------------------------------------------------------------------- 1 | ;-------------------------------- 2 | ; UsdConfigPage 3 | 4 | !define /ifndef WS_BORDER 0x00800000 5 | 6 | !define USDCONFIGCONFIGPATH_STYLE ${DEFAULT_STYLES}|${WS_BORDER}|${ES_AUTOHSCROLL} 7 | !define USDCONFIGCONFIGPATH_EXSTYLE 0;${WS_EX_STATICEDGE} 8 | 9 | Var hWndUsdConfigDlg 10 | Var hWndUsdConfigLabelAll 11 | Var hWndUsdConfigLabelCurrent 12 | Var hWndUsdConfigConfigPathAll 13 | Var hWndUsdConfigConfigPathCurrent 14 | Var hWndUsdConfigButtonShowAll 15 | Var hWndUsdConfigButtonShowCurrent 16 | 17 | Function USDConfigPage 18 | !insertmacro MUI_HEADER_TEXT "USD Shell Extension Configuration File" "" 19 | 20 | nsDialogs::Create 1018 21 | Pop $hWndUsdConfigDlg 22 | 23 | ${If} $hWndUsdConfigDlg == error 24 | Abort 25 | ${EndIf} 26 | 27 | ${NSD_CreateLabel} 0 0 100% 40u "This file contains the configuration for the USD Shell Extension. \ 28 | The configuration can be modified at any time and the changes will be reflected immeditately.$\r$\n$\r$\n\ 29 | The local user configuration file will override the all users configuration file." 30 | 31 | SetShellVarContext all 32 | ${NSD_CreateLabel} 0 50u 100% 10u "All Users" 33 | Pop $hWndUsdConfigLabelAll 34 | nsDialogs::CreateControl "${__NSD_Text_CLASS}" "${USDCONFIGCONFIGPATH_STYLE}" "${USDCONFIGCONFIGPATH_EXSTYLE}" 0 60u 100% 12u "$LOCALAPPDATA\Activision\UsdShellExtension\UsdShellExtension.ini" 35 | Pop $hWndUsdConfigConfigPathAll 36 | ${NSD_Edit_SetReadOnly} $hWndUsdConfigConfigPathAll 1 37 | ${NSD_CreateButton} -100u 75u 100u 15u "Show in Explorer" 38 | Pop $hWndUsdConfigButtonShowAll 39 | ${NSD_OnClick} $hWndUsdConfigButtonShowAll USDConfigPageShowAllClick 40 | 41 | 42 | SetShellVarContext current 43 | ${NSD_CreateLabel} 0 95u 100% 10u "Local User" 44 | Pop $hWndUsdConfigLabelCurrent 45 | nsDialogs::CreateControl "${__NSD_Text_CLASS}" "${USDCONFIGCONFIGPATH_STYLE}" "${USDCONFIGCONFIGPATH_EXSTYLE}" 0 105u 100% 12u "$LOCALAPPDATA\Activision\UsdShellExtension\UsdShellExtension.ini" 46 | Pop $hWndUsdConfigConfigPathCurrent 47 | ${NSD_Edit_SetReadOnly} $hWndUsdConfigConfigPathCurrent 1 48 | ${NSD_CreateButton} -100u 120u 100u 15u "Show in Explorer" 49 | Pop $hWndUsdConfigButtonShowCurrent 50 | ${NSD_OnClick} $hWndUsdConfigButtonShowCurrent USDConfigPageShowCurrentClick 51 | 52 | ;CreateFont $0 "$(^Font)" "8" "700"; size 8 weight 700 makes it bold 53 | ;SendMessage $hWndUsdConfigLabelCurrent ${WM_SETFONT} $0 0 54 | ;SendMessage $hWndUsdConfigLabelAll ${WM_SETFONT} $0 0 55 | 56 | nsDialogs::Show 57 | FunctionEnd 58 | 59 | Function USDConfigPageLeave 60 | 61 | FunctionEnd 62 | 63 | Function USDConfigPageShowAllClick 64 | SetShellVarContext all 65 | ExecWait 'explorer.exe /n,/select,"$LOCALAPPDATA\Activision\UsdShellExtension\UsdShellExtension.ini"' 66 | FunctionEnd 67 | 68 | Function USDConfigPageShowCurrentClick 69 | SetShellVarContext current 70 | ExecWait 'explorer.exe /n,/select,"$LOCALAPPDATA\Activision\UsdShellExtension\UsdShellExtension.ini"' 71 | FunctionEnd 72 | -------------------------------------------------------------------------------- /UsdShellExtensionInstaller/UsdConfigUtils.nsh: -------------------------------------------------------------------------------- 1 | 2 | Function ReadConfigFile 3 | pop $0 ; file 4 | pop $1 ; section 5 | pop $2 ; key 6 | pop $3 ; value 7 | 8 | System::StrAlloc 1024 9 | Pop $R1 10 | System::Call 'Kernel32::GetPrivateProfileStringW(w r1, w r2, t "", p R1, i 1024, w r0)' 11 | ; we can only store a max of 1024 characters in NSIS registers 12 | System::Call "*$R1(&t1024 .s)" 13 | System::Free $R1 14 | FunctionEnd 15 | 16 | !macro ReadConfigFile file section key value 17 | push `${value}` 18 | push `${key}` 19 | push `${section}` 20 | push `${file}` 21 | 22 | Call ReadConfigFile 23 | !macroend 24 | 25 | Function WriteConfigFile 26 | pop $0 ; file 27 | pop $1 ; section 28 | pop $2 ; key 29 | pop $3 ; value 30 | 31 | System::Call 'Kernel32::WritePrivateProfileStringW(w r1, w r2, w r3, w r0)' 32 | FunctionEnd 33 | 34 | !macro WriteConfigFile file section key value 35 | push `${value}` 36 | push `${key}` 37 | push `${section}` 38 | push `${file}` 39 | 40 | Call WriteConfigFile 41 | !macroend 42 | 43 | Function PatchConfigFile 44 | pop $0 ; file 45 | pop $1 ; section 46 | pop $2 ; key 47 | pop $3 ; value 48 | 49 | ; a string that someone isn't going to enter by hand 50 | StrCpy $R0 "{3D3157AE-140F-49B9-9283-57051DB19E37}" 51 | System::StrAlloc 8192 52 | Pop $R1 53 | System::Call 'Kernel32::GetPrivateProfileStringW(w r1, w r2, w R0, p R1, i 8192, w r0)' 54 | ; copy the returned string into $R2 55 | ; we can only store a max of 1024 characters in NSIS registers 56 | System::Call "*$R1(&t1024 .R2)" 57 | System::Free $R1 58 | 59 | ${If} $R2 == "{3D3157AE-140F-49B9-9283-57051DB19E37}" 60 | System::Call 'Kernel32::WritePrivateProfileStringW(w r1, w r2, w r3, w r0)' 61 | ${EndIf} 62 | 63 | FunctionEnd 64 | 65 | !macro PatchConfigFile file section key value 66 | push `${value}` 67 | push `${key}` 68 | push `${section}` 69 | push `${file}` 70 | 71 | Call PatchConfigFile 72 | !macroend 73 | 74 | -------------------------------------------------------------------------------- /UsdShellExtensionInstaller/UsdPathPage.nsh: -------------------------------------------------------------------------------- 1 | ;-------------------------------- 2 | ; UsdPathPage 3 | 4 | Var hWndUsdPathDlg 5 | Var hWndUsdPathEditPath 6 | Var hWndUsdPathEditPythonPath 7 | Var hWndUsdPathEditPxrPluginPath 8 | Var hWndUsdPathButtonBuild 9 | ;Var hWndUsdPathConfigPath 10 | 11 | Function USDPathPage 12 | !insertmacro MUI_HEADER_TEXT "USD Libraries and Tools" "Please set the following USD environment variables." 13 | 14 | nsDialogs::Create 1018 15 | Pop $hWndUsdPathDlg 16 | 17 | ${If} $hWndUsdPathDlg == error 18 | Abort 19 | ${EndIf} 20 | 21 | SetShellVarContext all 22 | 23 | ${NSD_CreateLabel} 0 0 100% 10u "PATH" 24 | !insertmacro ReadConfigFile "$LOCALAPPDATA\Activision\UsdShellExtension\UsdShellExtension.ini" "USD" "PATH" "" 25 | Pop $R0 26 | ${NSD_CreateText} 0 10u 100% 12u $R0 27 | Pop $hWndUsdPathEditPath 28 | 29 | ${NSD_CreateLabel} 0 28u 100% 10u "PYTHONPATH" 30 | !insertmacro ReadConfigFile "$LOCALAPPDATA\Activision\UsdShellExtension\UsdShellExtension.ini" "USD" "PYTHONPATH" "" 31 | Pop $R0 32 | ${NSD_CreateText} 0 38u 100% 12u $R0 33 | Pop $hWndUsdPathEditPythonPath 34 | 35 | ${NSD_CreateLabel} 0 56u 100% 10u "PXR_PLUGINPATH_NAME" 36 | !insertmacro ReadConfigFile "$LOCALAPPDATA\Activision\UsdShellExtension\UsdShellExtension.ini" "USD" "PXR_PLUGINPATH_NAME" "" 37 | Pop $R0 38 | ${NSD_CreateText} 0 66u 100% 12u $R0 39 | Pop $hWndUsdPathEditPxrPluginPath 40 | 41 | ${NSD_CreateButton} -140u 90u 140u 15u "Set using root USD folder" 42 | Pop $hWndUsdPathButtonBuild 43 | ${NSD_OnClick} $hWndUsdPathButtonBuild USDPathPageBuildClick 44 | 45 | ;${NSD_CreateLabel} 0 -30u 100% 10u "Configuration File" 46 | ;${NSD_CreateText} 0 -18u 100% 12u "$LOCALAPPDATA\Activision\UsdShellExtension\UsdShellExtension.ini" 47 | ;Pop $hWndUsdPathConfigPath 48 | ;${NSD_Edit_SetReadOnly} $hWndUsdPathConfigPath 1 49 | 50 | nsDialogs::Show 51 | FunctionEnd 52 | 53 | Function USDPathPageLeave 54 | SetShellVarContext all 55 | 56 | ${NSD_GetText} $hWndUsdPathEditPath $0 57 | !insertmacro WriteConfigFile "$LOCALAPPDATA\Activision\UsdShellExtension\UsdShellExtension.ini" "USD" "PATH" $0 58 | 59 | ${NSD_GetText} $hWndUsdPathEditPythonPath $0 60 | !insertmacro WriteConfigFile "$LOCALAPPDATA\Activision\UsdShellExtension\UsdShellExtension.ini" "USD" "PYTHONPATH" $0 61 | 62 | ${NSD_GetText} $hWndUsdPathEditPxrPluginPath $0 63 | !insertmacro WriteConfigFile "$LOCALAPPDATA\Activision\UsdShellExtension\UsdShellExtension.ini" "USD" "PXR_PLUGINPATH_NAME" $0 64 | 65 | FunctionEnd 66 | 67 | Function USDPathPageBuildClick 68 | 69 | nsDialogs::SelectFolderDialog "Select root folder of USD installation" 70 | Pop $R0 71 | 72 | ${If} $R0 != error 73 | ${NSD_SetText} $hWndUsdPathEditPath "$R0\bin\;$R0\lib\" 74 | ${NSD_SetText} $hWndUsdPathEditPythonPath "$R0\lib\python" 75 | ${NSD_SetText} $hWndUsdPathEditPxrPluginPath "" 76 | ${EndIf} 77 | 78 | FunctionEnd 79 | -------------------------------------------------------------------------------- /UsdShellExtensionInstaller/UsdShellExtensionInstaller.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /atviversion.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ATVI_VERSION_DESCRIPTION 16 | # define ATVI_VERSION_DESCRIPTION "" 17 | #endif 18 | 19 | #define __ATVI_VERSION_PRODUCT_STRING_INTERNAL3(s) \ 20 | #s 21 | 22 | #define __ATVI_VERSION_PRODUCT_STRING_INTERNAL2(p, s, b, f) \ 23 | __ATVI_VERSION_PRODUCT_STRING_INTERNAL3(p.s.b.f) 24 | 25 | #define __ATVI_VERSION_PRODUCT_STRING_INTERNAL(p, s, b, f) \ 26 | __ATVI_VERSION_PRODUCT_STRING_INTERNAL2(p, s, b, f) 27 | 28 | #define ATVI_VERSION_PRODUCT_STRING __ATVI_VERSION_PRODUCT_STRING_INTERNAL(ATVI_VERSION_MAJOR, ATVI_VERSION_MINOR, ATVI_VERSION_REVISION, ATVI_VERSION_BUILD) 29 | 30 | 31 | -------------------------------------------------------------------------------- /atviversion.props: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 1 21 | 09 22 | 00 23 | 00 24 | Activision USD Shell Extension 25 | Activision Publishing, Inc. 26 | Copyright (C) 2021 Activision Publishing, Inc. 27 | 28 | 29 | 30 | 31 | ATVI_VERSION_PRODUCTNAME="$(ATVI_VERSION_PRODUCTNAME)";ATVI_VERSION_COMPANYNAME="$(ATVI_VERSION_COMPANYNAME)";ATVI_VERSION_COPYRIGHT="$(ATVI_VERSION_COPYRIGHT)";ATVI_VERSION_MAJOR="$(ATVI_VERSION_MAJOR)";ATVI_VERSION_MINOR="$(ATVI_VERSION_MINOR)";ATVI_VERSION_REVISION="$(ATVI_VERSION_REVISION)";ATVI_VERSION_BUILD="$(ATVI_VERSION_BUILD)";%(PreprocessorDefinitions) 32 | 33 | 34 | ATVI_VERSION_PRODUCTNAME=\"$(ATVI_VERSION_PRODUCTNAME)\";ATVI_VERSION_COMPANYNAME=\"$(ATVI_VERSION_COMPANYNAME)\";ATVI_VERSION_COPYRIGHT=\"$(ATVI_VERSION_COPYRIGHT)\";ATVI_VERSION_MAJOR="$(ATVI_VERSION_MAJOR)";ATVI_VERSION_MINOR="$(ATVI_VERSION_MINOR)";ATVI_VERSION_REVISION="$(ATVI_VERSION_REVISION)";ATVI_VERSION_BUILD="$(ATVI_VERSION_BUILD)";%(PreprocessorDefinitions) 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /atviversion.rc2: -------------------------------------------------------------------------------- 1 | 2 | #include "atviversion.h" 3 | 4 | VS_VERSION_INFO VERSIONINFO 5 | FILEVERSION ATVI_VERSION_MAJOR,ATVI_VERSION_MINOR,ATVI_VERSION_REVISION,ATVI_VERSION_BUILD 6 | PRODUCTVERSION ATVI_VERSION_MAJOR,ATVI_VERSION_MINOR,ATVI_VERSION_REVISION,ATVI_VERSION_BUILD 7 | FILEFLAGSMASK 0x3fL 8 | #ifdef _DEBUG 9 | FILEFLAGS 0x1L 10 | #else 11 | FILEFLAGS 0x0L 12 | #endif 13 | FILEOS 0x4L 14 | FILETYPE 0x1L 15 | FILESUBTYPE 0x0L 16 | BEGIN 17 | BLOCK "StringFileInfo" 18 | BEGIN 19 | BLOCK "040904e4" 20 | BEGIN 21 | VALUE "CompanyName", ATVI_VERSION_COMPANYNAME 22 | VALUE "FileDescription", ATVI_VERSION_DESCRIPTION 23 | VALUE "FileVersion", ATVI_VERSION_PRODUCT_STRING 24 | VALUE "LegalCopyright", ATVI_VERSION_COPYRIGHT 25 | VALUE "ProductName", ATVI_VERSION_PRODUCTNAME 26 | VALUE "ProductVersion", ATVI_VERSION_PRODUCT_STRING 27 | END 28 | END 29 | BLOCK "VarFileInfo" 30 | BEGIN 31 | VALUE "Translation", 0x409, 1252 32 | END 33 | END 34 | 35 | -------------------------------------------------------------------------------- /boost.props: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | D:\USD-shared-full-p37-debug\lib\ 20 | D:\USD-shared-full-p37-debug\include\boost-1_70\ 21 | boost_$(PythonFileName)-vc$(PlatformToolsetVersion)-mt-gd-x64-1_70.dll 22 | 23 | 24 | D:\USD-shared-full-p37\lib\ 25 | D:\USD-shared-full-p37\include\boost-1_70\ 26 | boost_$(PythonFileName)-vc$(PlatformToolsetVersion)-mt-x64-1_70.dll 27 | 28 | 29 | 30 | 31 | $(BOOSTINCLUDEPATH);%(AdditionalIncludeDirectories) 32 | 33 | 34 | $(BOOSTLIBPATH);%(AdditionalLibraryDirectories) 35 | 36 | 37 | 38 | 39 | 40 | xcopy "$(BOOSTLIBPATH)$(BOOSTDLL)" "$(TargetDir)" /I /Y /F /R 41 | 42 | %(Command) 43 | 44 | 45 | 46 | 47 | 48 | 49 | xcopy "$(BOOSTLIBPATH)$(BOOSTDLL)" "$(TargetDir)" /I /Y /F /R 50 | 51 | %(Command) 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /docs/DEPLOYMENT.md: -------------------------------------------------------------------------------- 1 | Activision USD Shell Extension - Deployment Guide 2 | ================================================= 3 | 4 | The USD Shell Extension has been written to be deployed in many development environments. 5 | 6 | Deploying using Setup 7 | --------------------- 8 | The USD Shell Extension setup can be run in silently and all ini configuration file values can be set on the command line of the setup program using the syntax /SECTION_KEY=VALUE. 9 | 10 | | Switch | Description | 11 | |- |- | 12 | | /s | Runs setup in silent mode | 13 | | /USD_PATH= | PATH environment variable for USD | 14 | | /USD_PYTHONPATH= | PYTHONPATH environment variable for USD | 15 | | /USD_PXR_PLUGINPATH_NAME= | PXR_PLUGINPATH_NAME environment variable for USD | 16 | | /USD_EDITOR= | Editor used for the Edit command in Windows Explorer | 17 | | /RENDERER_PREVIEW= | Hydra renderer used for the Windows Explorer Preview pane | 18 | | /RENDERER_THUMBNAIL= | Hydra renderer used for Windows Explorer Thumbnails | 19 | | /RENDERER_VIEW= | Hydra renderer used when launching usdview | 20 | | /PYTHON_PATH= | Path to the installation of Python | 21 | | /PYTHON_PYTHONPATH= | PYTHONPATH environment variable for Python | 22 | 23 | ``` 24 | UsdShellExtension-v1.09-u21.02-p3.7-setup.exe /s /USD_PATH="D:\USD-shared-full\bin\;D:\USD-shared-full\lib\" /USD_PYTHONPATH="D:\USD-shared-full\lib\python" /RENDERER_PREVIEW=Embree 25 | ``` 26 | 27 | Deploying using Loose Files 28 | --------------------------- 29 | 30 | It is possible to deploy the Shell Extension manually. 31 | 32 | 1. The files installed by setup can be packaged up for deployment without the use of setup. 33 | 2. A `UsdShellExtension.ini` configuration file can be placed in the install folder. 34 | 3. The github repository contains `register.bat` and `unregister.bat`. The commands in these batch files can be used to install and uninstall the shell extension. 35 | 36 | **NOTE** 37 | Care must be taken to correctly shutdown Windows Explorer and Windows Search when updating the shell extension. 38 | 39 | | File | 40 | |- | 41 | | usd\\\*.\* | 42 | | boost_pythonXX-vcXXX-mt-x64-1_70.dll | 43 | | LICENSE.txt | 44 | | NOTICE.txt | 45 | | plugInfo.json | 46 | | pythonXX.dll | 47 | | tbb.dll | 48 | | tbbmalloc.dll | 49 | | UsdPreviewHandler.pyd | 50 | | UsdPreviewLocalServer.exe | 51 | | UsdPythonToolsLocalServer.exe | 52 | | UsdSdkToolsLocalServer.exe | 53 | | UsdShellExtension.dll | 54 | | usd_ms.dll | 55 | | register.bat | 56 | | unregister.bat | 57 | -------------------------------------------------------------------------------- /docs/DESIGN.md: -------------------------------------------------------------------------------- 1 | Activision USD Shell Extension - Design 2 | ======================================= 3 | 4 | Fundamentals 5 | ------------ 6 | 7 | There are several fundamentals that this shell extension tries to adhere to. 8 | 9 | * **Performance** 10 | The extension must not stall Windows Explorer. 11 | 12 | * **Stability** 13 | The extension must be stable. A crash will take down Window Explorer and/or the entire desktop. 14 | 15 | 16 | UsdShellExtension 17 | ----------------- 18 | 19 | This is a DLL project. 20 | 21 | It is the core Windows Explorer Shell extension. This DLL is loaded into 22 | the Windows Explorer process. As a result, this DLL should not *host* python. 23 | 24 | 25 | | Extension | Description | 26 | |- |- | 27 | | **IPreviewHandler** | Adds a preview for USD files by running `usdStageView` (a part of `usdView`) in an out-of-process viewport. | 28 | | **IThumbnailProvider**| Generates thumbnails for USD files by running `usdRecord` out-of-process. | 29 | | **IPropertyStore** | Exposes USD metadata to Windows Explorer and Windows Search. | 30 | 31 | 32 | **IPreviewHandler** 33 | 34 | The IPreviewHandler runs out-of-process in a Windows provided COM local server called `prevhost.exe`. 35 | We run the USD loading screen in `prevhost.exe` but launch the actual preview using our own out of process COM server, `UsdPreviewLocalServer.exe`. 36 | 37 | The `prevhost.exe` process hosts all Windows preview handler in a single process instance. We use `UsdPreviewLocalServer.exe` to isolate `prevhost.exe`. 38 | 39 | *UsdPreviewLocalServer.exe* 40 | 41 | This COM server embeds python and launches an instance of `usdStageView` using a custom python script. 42 | It isolates python from any Windows system process. 43 | 44 | Stalling a COM call in our implementation of IPreviewHandler would still hang Windows Explorer, even though the preview is running out-of-process in `prevhost.exe`. By having our own asynchronous out-of-process server, we could operate asynchronously to Windows Explorer. 45 | 46 | *UsdPreviewHandlerPython.py* 47 | 48 | When launching `usdStageView` from `UsdPreviewLocalServer.exe` we use a custom script that uses `UsdPreviewHandlerPython.py` to send and receive events from C++. The first event that is sent is the HWND of the `usdStageView` so that it can be made a child of the preview HWND in Windows Explorer. 49 | 50 | **IThumbnailProvider** 51 | 52 | *UsdPythonToolsLocalServer.exe* 53 | 54 | Thumbnail providers already run on background threads in Windows Explorer. The extraction of a thumbnail can take a significant amount of time. We launch an out-of-process COM server, `UsdPythonToolsLocalServer.exe`, to run the `usdRecord` python script provided by USD SDK. This keeps python out of Windows Explorer. 55 | 56 | **IPropertyStore** 57 | 58 | The IPropertyStore interface runs synchronously to the UI in Windows Explorer. It must execute quickly. For this reason 59 | the C++ USD SDK is used directly in Windows Explorer. 60 | 61 | **USD Activation Context** 62 | 63 | The USD SDK and all of its dependencies are isolated from the rest of Windows Explorer via a Windows Activation Context. 64 | This at least guarantees that if any other extension ever loads USD or any of its dependencies into Windows Explorer, we will not clash. 65 | 66 | **Python USD Plug-in** 67 | This DLL serves as a python plug-in. The python plug-in is called ArResolverShellExtension. It is used to 68 | allow shared reads across the USD SDK. By default, the USD SDK uses fopen which in MSVC does not allow shared reads. 69 | 70 | **rundll** 71 | This DLL has several rundll entry points. These entry points are executed from Windows Explorer context menus. 72 | They are all located in `ShellExecute.cpp`. 73 | 74 | UsdPreviewLocalServer 75 | --------------------- 76 | 77 | This is COM Local Server executable. 78 | 79 | This project serves `usdStageView`, the USD preview window, out of process. `usdStageView` is a python script 80 | written by Pixar. This project hosts python and executes the script. It communicates with `UsdShellExtension` 81 | via COM. 82 | 83 | If the Preview server crashes. It will not take down Windows Explorer. 84 | 85 | UsdPreviewHandlerPython 86 | ----------------------- 87 | 88 | This is a python extension module. 89 | 90 | It is used to communicate between the python preview window and our shell 91 | extension. It is hosted by `UsdPreviewLocalServer`. 92 | 93 | UsdPythonToolsLocalServer 94 | ------------------------- 95 | 96 | This is COM Local Server executable. 97 | 98 | It is used to host out of process USD python tools. This server is used to capture thumbnails using 99 | `usdrecord` and to launch `usdview`. 100 | 101 | UsdSdkToolsLocalServer 102 | ---------------------- 103 | 104 | This is COM Local Server executable. 105 | 106 | It is used to host out of process USD C++ tools. This server executes the conversion between USD file 107 | formats and generating USD archives. 108 | -------------------------------------------------------------------------------- /docs/EventViewer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Activision/USDShellExtension/b7655b9436f24edb28cb8079386e9a3aa43b15a3/docs/EventViewer.png -------------------------------------------------------------------------------- /docs/FEATURES.md: -------------------------------------------------------------------------------- 1 | Activision USD Shell Extension 2 | ============================== 3 | 4 | Table of contents 5 | ----------------- 6 | 7 | - [Windows Explorer Thumbnails](#features-thumbnails) 8 | - [Windows Explorer Preview](#features-preview) 9 | - [Windows Explorer Format Conversion](#features-conversion) 10 | - [Windows Explorer Edit](#features-edit) 11 | - [Windows Search](#features-search) 12 | - [UsdView](#features-usdview) 13 | 14 |
15 | 16 | Windows Explorer Thumbnails 17 | --------------------------- 18 | 19 | Thumbnails are automatically generated for USD file types. Thumbnails are generated by rendering out an image of the USD stage in the background. 20 | 21 | Thumbnails are cached in the Windows thumbnail cache. Subsequent visits to a folder will display the cached thumbnail. The cached thumbnail will be invalidated when the file is modified or when the user explicitly selects Refresh Thumbnail from the Windows Explorer context menu. 22 | 23 | ![thumbnails][thumbnails] 24 | 25 |
26 | 27 | Windows Explorer Preview 28 | ------------------------ 29 | 30 | The Windows Explorer Preview pane will display a 3D viewport. 31 | 32 | This viewport uses UsdStageView of UsdView to render a 3D viewport in Windows Explorer. 33 | 34 | The viewport exposes all installed Hydra renderers. The default Hydra renderer can be modified in the configuration file. 35 | 36 | ![preview][preview] 37 | 38 |
39 | 40 | Windows Explorer Format Conversion 41 | ---------------------------------- 42 | 43 | The Windows Explorer context menu can perform conversions on USD files. 44 | 45 | * Crate 46 | Convert a USD file type to USDC Crate Format. 47 | * Uncrate 48 | Convert a USD file type to USDA ASCII Format. 49 | * Package 50 | Convert a USD file type to a USDZ Package. 51 | * Flatten 52 | Flatten a USD file hierarchy to a USD file. 53 | 54 | ![convert][convert] 55 | 56 |
57 | 58 | Windows Explorer Edit 59 | --------------------- 60 | 61 | The Windows Explorer context menu exposes the ability to edit USD files in place. This includes crated USDC files. 62 | 63 | The editor application used can be set in the configuration file. 64 | 65 | ![edit][edit] 66 | 67 |
68 | 69 | Windows Search 70 | -------------- 71 | 72 | USD file metadata is exposed to Windows Search. When USD metadata is indexed by Windows Search it can be searched for quickly. 73 | 74 | | Metadata | Search Mnemonics | Visible in Explorer | Editable in Explorer | Visible in Properties | 75 | | --------------- |-----------------------------------|---------------------|----------------------|-----------------------| 76 | | Comments | comment, comments | Yes | Yes | Yes | 77 | | Documentation | usddocumentation, usddocs, usddoc | Yes | No | Yes | 78 | | CustomLayerData | usdcustomlayerdata, usdlayerdata | No | No | Yes | 79 | 80 |
81 | 82 | ![search][search] 83 | 84 |
85 | 86 | UsdView 87 | ------- 88 | The default action for USD files in Windows Explorer is to open them in UsdView. 89 | 90 | ![view][view] 91 | 92 | 93 | [thumbnails]:thumbnails.png "Windows Explorer Thumbnails" 94 | [preview]:preview.png "Windows Explorer Preview" 95 | [convert]:usdcat.png "Windows Explorer Format Conversion" 96 | [edit]:edit.png "Windows Explorer Edit" 97 | [search]:search.png "Windows Search" 98 | [view]:usdview.png "UsdView" -------------------------------------------------------------------------------- /docs/INSTALLING.md: -------------------------------------------------------------------------------- 1 | Activision USD Shell Extension - Installation Guide 2 | =================================================== 3 | 4 | This document covers installing the shell extension from precompiled shell extension setup installers. 5 | 6 | Step 1: USD Build 7 | ----------------- 8 | 9 | A prerequisite to the installing the shell extension is to have a functional build of USD. 10 | 11 | You can build USD locally from Pixar's GitHub or use per-built libraries such as the ones available at NVIDIA. 12 | 13 | When building locally, make sure that the USD Python tools are built as well. 14 | 15 | Pixar's USD Source Repository 16 | https://github.com/PixarAnimationStudios/USD/ 17 | 18 | NVIDIA's USD Pre-built Libraries and Tools 19 | https://developer.nvidia.com/usd 20 | 21 | 22 | Step 2: Verify USD install with usdview 23 | --------------------------------------- 24 | 25 | The shell extension uses usdview for the Windows Explorer preview and usdrecord for thumbnails. usdview must be operational outside of the extension. 26 | 27 | Launch usdview manually out of the USD build and make sure that it is rendering correctly. 28 | 29 | 30 | Step 3: Shell Extension Setup 31 | ----------------------------- 32 | 33 | Match the version of Python used by the USD build with that of the shell extension setup. NVIDIA's pre-built libraries currently use Python 3.6. 34 | 35 | The shell extension setup contains a USD Libraries and Tools screen. Use the `Set using root USD folder` button to select the location of the USD build from Step 1. 36 | 37 | **NVIDIA Pre-built Libraries Example** 38 | 39 | NVIDIA pre-built libraries installation location: `D:\usd-21-05-usd-win64_py36_release` 40 | 41 | | Entry | Value | 42 | |- |- | 43 | | **PATH** | D:\usd-21-05-usd-win64_py36_release\bin\;D:\usd-21-05-usd-win64_py36_release\lib\ | 44 | | **PYTHONPATH** | D:\usd-21-05-usd-win64_py36_release\lib\python | 45 | | **PXR_PLUGINPATH_NAME** | | 46 | 47 | 48 | USD Text Editor 49 | --------------- 50 | By default, the text editor used by the `Edit` command is `notepad.exe`. This text editor is guaranteed to be installed. 51 | 52 | A custom text editor can be specified in the `UsdShellExtension.ini` file. 53 | 54 | **Requirements** 55 | 56 | The editor *must* support not returning on the command line until the text file is closed in the editor. 57 | 58 | 59 | **Visual Studio Code** 60 | 61 | Visual Studio Code is a great editor for USDA files that also can perform syntax highlighting. 62 | 63 | To associate Visual Studio Code with the USD Shell Extension use the following command in the ini file: 64 | 65 | ``` 66 | [USD] 67 | EDITOR="C:\Users\pmintus\AppData\Local\Programs\Microsoft VS Code\Code.exe" --wait 68 | ``` 69 | 70 | 71 | Troubleshooting 72 | --------------- 73 | 74 | **Python** 75 | 76 | 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. 77 | 78 | | Python Version | Search Location | 79 | |- |- | 80 | | 2.7 | C:\Python27 | 81 | | 3.6 | HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\3.6\InstallPath | 82 | | 3.7 | HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\3.7\InstallPath | 83 | 84 | If the Python install is not found at these locations, then it needs to be set explicitly using the `UsdShellExtension.ini` file. 85 | 86 | ``` 87 | [PYTHON] 88 | PATH=C:\Python37 89 | ``` 90 | 91 | **Event Viewer** 92 | 93 | If the shell extension is not working, then the first place to check for issues is the Windows Event Viewer. 94 | 95 | Windows Logs | Application 96 | 97 | The event source will be `Activision USD Shell Extension`. 98 | 99 | If you are seeing Python errors, then make sure that you can run usdview outside of the shell extension (Step 2). Also make sure that the Python version of the shell extension matches that of the USD build. 100 | 101 | ![eventviewer][eventviewer] 102 | 103 | 104 | **File Associations** 105 | 106 | For the shell extension to work it needs to be associated with USD, USDA, USDC, and USDZ file extensions. Setup performs this association. However, manual user associations take precedence over system global associations. If these file extensions have been previously manually associated with a different application, then the shell extension will not work. 107 | 108 | Make sure that the following file type associations are set to `Activision USD Shell Extension`. 109 | 110 | This can be changed manually using Windows Settings. 111 | 112 | Windows Settings | Apps | Default apps | Choose default apps by file type 113 | 114 | | Extension | App | 115 | |- |- | 116 | | .usd | Activision USD Shell Extension | 117 | | .usda | Activision USD Shell Extension | 118 | | .usdc | Activision USD Shell Extension | 119 | | .usdz | Activision USD Shell Extension | 120 | 121 | [eventviewer]:EventViewer.png "Event Viewer" 122 | -------------------------------------------------------------------------------- /docs/edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Activision/USDShellExtension/b7655b9436f24edb28cb8079386e9a3aa43b15a3/docs/edit.png -------------------------------------------------------------------------------- /docs/preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Activision/USDShellExtension/b7655b9436f24edb28cb8079386e9a3aa43b15a3/docs/preview.png -------------------------------------------------------------------------------- /docs/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Activision/USDShellExtension/b7655b9436f24edb28cb8079386e9a3aa43b15a3/docs/search.png -------------------------------------------------------------------------------- /docs/thumbnails.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Activision/USDShellExtension/b7655b9436f24edb28cb8079386e9a3aa43b15a3/docs/thumbnails.png -------------------------------------------------------------------------------- /docs/usdcat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Activision/USDShellExtension/b7655b9436f24edb28cb8079386e9a3aa43b15a3/docs/usdcat.png -------------------------------------------------------------------------------- /docs/usdview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Activision/USDShellExtension/b7655b9436f24edb28cb8079386e9a3aa43b15a3/docs/usdview.png -------------------------------------------------------------------------------- /nsis.props: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | $(ProgramFiles)\NSIS\makensis.exe 20 | 21 | -------------------------------------------------------------------------------- /python.props: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 3.7 20 | 21 | 0x03070000 22 | python37 23 | 24 | 25 | 26 | $(PythonFileName).dll 27 | 28 | 29 | $(PythonFileName).dll 30 | 31 | 32 | 33 | 34 | PYTHONVERSION=$(PythonVersion);PYTHONDLL="$(PythonDLL)";%(PreprocessorDefinitions) 35 | 36 | 37 | 38 | xcopy "$(PYTHONHOME)$(PythonDLL)" "$(TargetDir)" /I /Y /F /R 39 | 40 | %(Command) 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /shared/EventViewerLog.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #include "EventViewerMessages.h" 18 | 19 | #define EVENTLOG_SOURCE "Activision USD Shell Extension" 20 | 21 | enum class LogEventType 22 | { 23 | Error = EVENTLOG_ERROR_TYPE, 24 | Warning = EVENTLOG_WARNING_TYPE, 25 | Information = EVENTLOG_INFORMATION_TYPE, 26 | }; 27 | 28 | inline bool LogEventMessage(WORD category, LPCTSTR sEventMessage, LogEventType type) 29 | { 30 | bool bSuccess = false; 31 | 32 | DWORD eventId; 33 | switch ( type ) 34 | { 35 | case LogEventType::Information: 36 | eventId = MSG_GENERIC_INFORMATION; 37 | break; 38 | case LogEventType::Warning: 39 | eventId = MSG_GENERIC_WARNING; 40 | break; 41 | case LogEventType::Error: 42 | eventId = MSG_GENERIC_ERROR; 43 | break; 44 | default: 45 | type = LogEventType::Error; 46 | eventId = MSG_GENERIC_ERROR; 47 | break; 48 | } 49 | 50 | HANDLE hEventSource = ::RegisterEventSource( nullptr, _T(EVENTLOG_SOURCE) ); 51 | if ( hEventSource ) 52 | { 53 | bSuccess = (::ReportEvent( hEventSource, static_cast(type), category, eventId, nullptr, 1, 0, &sEventMessage, nullptr ) != FALSE); 54 | ::DeregisterEventSource( hEventSource ); 55 | } 56 | 57 | return bSuccess; 58 | } -------------------------------------------------------------------------------- /shared/EventViewerMessages.mc: -------------------------------------------------------------------------------- 1 | LanguageNames=(English=0x409:MSG00409) 2 | 3 | MessageIdTypedef=WORD 4 | 5 | MessageId=0x1 6 | SymbolicName=GENERIC_CATEGORY 7 | Language=English 8 | Generic 9 | . 10 | 11 | MessageId=0x2 12 | SymbolicName=SHELLEXTENSION_CATEGORY 13 | Language=English 14 | USD Shell Extension 15 | . 16 | 17 | MessageId=0x3 18 | SymbolicName=PREVIEWHANDLER_CATEGORY 19 | Language=English 20 | USD Preview Handler Server 21 | . 22 | 23 | MessageId=0x4 24 | SymbolicName=PYTHONTOOLS_CATEGORY 25 | Language=English 26 | USD Python Tools Server 27 | . 28 | 29 | MessageId=0x5 30 | SymbolicName=SDKTOOLS_CATEGORY 31 | Language=English 32 | USD SDK Tools Server 33 | . 34 | 35 | MessageId=0x6 36 | SymbolicName=CATEGORY_COUNT 37 | Language=English 38 | Number of categories 39 | . 40 | 41 | MessageIdTypedef=DWORD 42 | 43 | MessageId=0x100 44 | Severity=Error 45 | SymbolicName=MSG_GENERIC_SUCCESS 46 | Language=English 47 | %1 48 | . 49 | 50 | MessageId=0x101 51 | Severity=Informational 52 | SymbolicName=MSG_GENERIC_INFORMATION 53 | Language=English 54 | %1 55 | . 56 | 57 | MessageId=0x102 58 | Severity=Warning 59 | SymbolicName=MSG_GENERIC_WARNING 60 | Language=English 61 | %1 62 | . 63 | 64 | MessageId=0x103 65 | Severity=Error 66 | SymbolicName=MSG_GENERIC_ERROR 67 | Language=English 68 | %1 69 | . 70 | 71 | -------------------------------------------------------------------------------- /shared/EventViewerMessages.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | x64 7 | 8 | 9 | Release 10 | x64 11 | 12 | 13 | 14 | 15.0 15 | {F12E597B-B731-4F5A-BEC3-980D20159320} 16 | USDSharedLib 17 | 10.0.14393.0 18 | EventViewerMessages 19 | 20 | 21 | 22 | Utility 23 | true 24 | v141 25 | Unicode 26 | 27 | 28 | Utility 29 | false 30 | v141 31 | false 32 | Unicode 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | $(SolutionDir)bin\$(PlatformToolset)\$(PythonTag)\$(Configuration)\ 48 | $(SolutionDir)build\$(PlatformToolset)\$(PythonTag)\$(Configuration)\$(ProjectName)\ 49 | 50 | 51 | $(SolutionDir)bin\$(PlatformToolset)\$(PythonTag)\$(Configuration)\ 52 | $(SolutionDir)build\$(PlatformToolset)\$(PythonTag)\$(Configuration)\$(ProjectName)\ 53 | 54 | 55 | 56 | Document 57 | echo mc %(FullPath) 58 | mc %(FullPath) 59 | Compiling Messages... 60 | %(Filename).rc;%(Filename).h;MSG00409.bin 61 | echo mc %(FullPath) 62 | mc %(FullPath) 63 | Compiling Messages... 64 | %(Filename).rc;%(Filename).h;MSG00409.bin 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /shared/EventViewerMessages.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /shared/emb.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2011 Mateusz Loskot 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | // 7 | // Blog article: http://mateusz.loskot.net/?p=2819 8 | 9 | #pragma once 10 | 11 | #include "stdafx.h" 12 | #include "emb.h" 13 | 14 | namespace emb 15 | { 16 | struct Stdout 17 | { 18 | PyObject_HEAD 19 | stdout_write_type write; 20 | }; 21 | 22 | PyObject *Stdout_write( PyObject *self, PyObject *args ) 23 | { 24 | std::size_t written( 0 ); 25 | Stdout *selfimpl = reinterpret_cast(self); 26 | if ( selfimpl->write ) 27 | { 28 | char *data; 29 | if ( !PyArg_ParseTuple( args, "s", &data ) ) 30 | return 0; 31 | 32 | std::string str( data ); 33 | selfimpl->write( str ); 34 | written = str.size(); 35 | } 36 | return PyLong_FromSize_t( written ); 37 | } 38 | 39 | PyObject *Stdout_flush( PyObject * /*self*/, PyObject * /*args*/ ) 40 | { 41 | // no-op 42 | return Py_BuildValue( "" ); 43 | } 44 | 45 | PyMethodDef Stdout_methods[] = 46 | { 47 | {"write", Stdout_write, METH_VARARGS, "sys.stdout.write"}, 48 | {"flush", Stdout_flush, METH_VARARGS, "sys.stdout.write"}, 49 | {0, 0, 0, 0} // sentinel 50 | }; 51 | 52 | PyTypeObject StdoutType = 53 | { 54 | PyVarObject_HEAD_INIT( 0, 0 ) 55 | "emb.StdoutType", /* tp_name */ 56 | sizeof( Stdout ), /* tp_basicsize */ 57 | 0, /* tp_itemsize */ 58 | 0, /* tp_dealloc */ 59 | 0, /* tp_print */ 60 | 0, /* tp_getattr */ 61 | 0, /* tp_setattr */ 62 | 0, /* tp_reserved */ 63 | 0, /* tp_repr */ 64 | 0, /* tp_as_number */ 65 | 0, /* tp_as_sequence */ 66 | 0, /* tp_as_mapping */ 67 | 0, /* tp_hash */ 68 | 0, /* tp_call */ 69 | 0, /* tp_str */ 70 | 0, /* tp_getattro */ 71 | 0, /* tp_setattro */ 72 | 0, /* tp_as_buffer */ 73 | Py_TPFLAGS_DEFAULT, /* tp_flags */ 74 | "emb.Stdout objects", /* tp_doc */ 75 | 0, /* tp_traverse */ 76 | 0, /* tp_clear */ 77 | 0, /* tp_richcompare */ 78 | 0, /* tp_weaklistoffset */ 79 | 0, /* tp_iter */ 80 | 0, /* tp_iternext */ 81 | Stdout_methods, /* tp_methods */ 82 | 0, /* tp_members */ 83 | 0, /* tp_getset */ 84 | 0, /* tp_base */ 85 | 0, /* tp_dict */ 86 | 0, /* tp_descr_get */ 87 | 0, /* tp_descr_set */ 88 | 0, /* tp_dictoffset */ 89 | 0, /* tp_init */ 90 | 0, /* tp_alloc */ 91 | 0, /* tp_new */ 92 | }; 93 | 94 | #if PY_MAJOR_VERSION >= 3 95 | PyModuleDef embmodule = 96 | { 97 | PyModuleDef_HEAD_INIT, 98 | "emb", 0, -1, 0, 99 | }; 100 | #endif 101 | 102 | // Internal state 103 | PyObject *g_stdout; 104 | PyObject *g_stdout_saved; 105 | PyObject *g_stderr; 106 | PyObject *g_stderr_saved; 107 | 108 | #if PY_MAJOR_VERSION >= 3 109 | #define NULL_MODULE nullptr 110 | #else 111 | #define NULL_MODULE 112 | #endif 113 | 114 | PyMODINIT_FUNC PyInit_emb( void ) 115 | { 116 | g_stdout = 0; 117 | g_stdout_saved = 0; 118 | g_stderr = 0; 119 | g_stderr_saved = 0; 120 | 121 | StdoutType.tp_new = PyType_GenericNew; 122 | if ( PyType_Ready( &StdoutType ) < 0 ) 123 | return NULL_MODULE; 124 | 125 | #if PY_MAJOR_VERSION >= 3 126 | PyObject *m = PyModule_Create( &embmodule ); 127 | #else 128 | PyObject *m = Py_InitModule( "emb", Stdout_methods ); 129 | #endif 130 | if ( m ) 131 | { 132 | Py_INCREF( &StdoutType ); 133 | PyModule_AddObject( m, "Stdout", reinterpret_cast(&StdoutType) ); 134 | } 135 | 136 | #if PY_MAJOR_VERSION >= 3 137 | return m; 138 | #endif 139 | } 140 | 141 | void set_stdout( stdout_write_type write ) 142 | { 143 | if ( !g_stdout ) 144 | { 145 | g_stdout_saved = PySys_GetObject( const_cast("stdout") ); // borrowed 146 | g_stdout = StdoutType.tp_new( &StdoutType, 0, 0 ); 147 | } 148 | 149 | Stdout *impl = reinterpret_cast(g_stdout); 150 | impl->write = write; 151 | PySys_SetObject( const_cast("stdout"), g_stdout ); 152 | } 153 | 154 | void reset_stdout() 155 | { 156 | if ( g_stdout_saved ) 157 | PySys_SetObject( const_cast("stdout"), g_stdout_saved ); 158 | 159 | Py_XDECREF( g_stdout ); 160 | g_stdout = 0; 161 | } 162 | 163 | void set_stderr( stdout_write_type write ) 164 | { 165 | if ( !g_stderr ) 166 | { 167 | g_stderr_saved = PySys_GetObject( const_cast("stderr") ); // borrowed 168 | g_stderr = StdoutType.tp_new( &StdoutType, 0, 0 ); 169 | } 170 | 171 | Stdout *impl = reinterpret_cast(g_stderr); 172 | impl->write = write; 173 | PySys_SetObject( const_cast("stderr"), g_stderr ); 174 | } 175 | 176 | void reset_stderr() 177 | { 178 | if ( g_stderr_saved ) 179 | PySys_SetObject( const_cast("stderr"), g_stderr_saved ); 180 | 181 | Py_XDECREF( g_stderr ); 182 | g_stderr = 0; 183 | } 184 | 185 | } // namespace emb 186 | -------------------------------------------------------------------------------- /shared/emb.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2011 Mateusz Loskot 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | // 7 | // Blog article: http://mateusz.loskot.net/?p=2819 8 | 9 | #pragma once 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace emb 16 | { 17 | typedef std::function stdout_write_type; 18 | 19 | PyMODINIT_FUNC PyInit_emb( void ); 20 | void set_stdout( stdout_write_type write ); 21 | void reset_stdout(); 22 | void set_stderr( stdout_write_type write ); 23 | void reset_stderr(); 24 | 25 | } // namespace emb 26 | -------------------------------------------------------------------------------- /shared/environment.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Activision Publishing, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #include 18 | 19 | void SetupPythonEnvironment( HMODULE hCurrentModule ); 20 | const std::vector &GetUsdPathList(); 21 | const std::vector &GetUsdPythonPathList(); 22 | const CStringW &GetUsdPath(); 23 | const CStringW &GetUsdPythonPath(); 24 | const CStringW &GetUsdEditor(); 25 | 26 | std::vector BuildConfigFileList( HMODULE hCurrentModule ); 27 | void GetPrivateProfileStringAndExpandEnvironmentStrings( LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpDefault, CStringW &lpReturnedString, const std::vector &ConfigFileList ); -------------------------------------------------------------------------------- /shared/installerWelcome.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Activision/USDShellExtension/b7655b9436f24edb28cb8079386e9a3aa43b15a3/shared/installerWelcome.bmp -------------------------------------------------------------------------------- /shared/usd.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Activision/USDShellExtension/b7655b9436f24edb28cb8079386e9a3aa43b15a3/shared/usd.ico -------------------------------------------------------------------------------- /usd-monolithic.props: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | 22 | monolithic 23 | 21.02 24 | 25 | 26 | 27 | d:\USD-monolithic-bare-debug\bin\ 28 | d:\USD-monolithic-bare-debug\lib\ 29 | d:\USD-monolithic-bare-debug\include\ 30 | d:\USD-monolithic-bare-debug\lib\usd\ 31 | 32 | 33 | 34 | d:\USD-monolithic-bare\bin\ 35 | d:\USD-monolithic-bare\lib\ 36 | d:\USD-monolithic-bare\include\ 37 | d:\USD-monolithic-bare\lib\usd\ 38 | 39 | 40 | 41 | 42 | %(PreprocessorDefinitions) 43 | $(USDINCLUDEPATH);$(USDINCLUDEPATH)\boost-1_70;%(AdditionalIncludeDirectories) 44 | 45 | 46 | dbghelp.lib;Ws2_32.lib;usd_ms.lib;%(AdditionalDependencies) 47 | $(USDLIBPATH);%(AdditionalLibraryDirectories) 48 | /WHOLEARCHIVE:"$(USDLIBPATH)usd_ms" %(AdditionalOptions) 49 | 50 | 51 | 52 | xcopy "$(USDBINPATH)tbb_debug.dll" "$(TargetDir)" /I /Y /F /R 53 | xcopy "$(USDBINPATH)tbb_debug.pdb" "$(TargetDir)" /I /Y /F /R 54 | xcopy "$(USDBINPATH)tbbmalloc_debug.dll" "$(TargetDir)" /I /Y /F /R 55 | xcopy "$(USDBINPATH)tbbmalloc_debug.pdb" "$(TargetDir)" /I /Y /F /R 56 | xcopy "$(USDLIBPATH)usd_ms.dll" "$(TargetDir)" /I /Y /F /R 57 | xcopy "$(USDLIBPATH)usd_ms.pdb" "$(TargetDir)" /I /Y /F /R 58 | xcopy "$(PXR_PLUGINPATH_NAME)" "$(TargetDir)\usd" /I /Y /F /R /S 59 | 60 | %(Command) 61 | 62 | 63 | 64 | 65 | 66 | %(PreprocessorDefinitions) 67 | $(USDINCLUDEPATH);$(USDINCLUDEPATH)\boost-1_70;%(AdditionalIncludeDirectories) 68 | 69 | 70 | dbghelp.lib;Ws2_32.lib;usd_ms.lib;%(AdditionalDependencies) 71 | $(USDLIBPATH);%(AdditionalLibraryDirectories) 72 | /WHOLEARCHIVE:"$(USDLIBPATH)usd_ms" %(AdditionalOptions) 73 | 74 | 75 | 76 | xcopy "$(USDBINPATH)tbb.dll" "$(TargetDir)" /I /Y /F /R 77 | xcopy "$(USDBINPATH)tbb.pdb" "$(TargetDir)" /I /Y /F /R 78 | xcopy "$(USDBINPATH)tbbmalloc.dll" "$(TargetDir)" /I /Y /F /R 79 | xcopy "$(USDBINPATH)tbbmalloc.pdb" "$(TargetDir)" /I /Y /F /R 80 | xcopy "$(USDLIBPATH)usd_ms.dll" "$(TargetDir)" /I /Y /F /R 81 | xcopy "$(USDLIBPATH)usd_ms.pdb" "$(TargetDir)" /I /Y /F /R 82 | xcopy "$(PXR_PLUGINPATH_NAME)" "$(TargetDir)\usd" /I /Y /F /R /S 83 | 84 | %(Command) 85 | 86 | 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /usd.props: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | --------------------------------------------------------------------------------