[
  {
    "path": ".gitignore",
    "content": ".vs/\nbin/\nbuild/\n*.aps\n*.user\n*_h.h\n*_i.c\n*_p.c\ndlldata.c\nEventViewerMessages.h\nEventViewerMessages.rc\nMSG00409.bin\n"
  },
  {
    "path": "BUILDING.md",
    "content": "ACTIVISION USD SHELL EXTENSION\n==============================\n\n\n## Dependencies\n\n* Boost\n* Python (2.7, 3.6, 3.7)\n* USD SDK\n* Windows 10 SDK\n* Visual Studio 2017+\n  * ATL\n  * Python C++ Tools\n\n#### Boost\n\n`boost.props`\n\nBoost is required for Boost.Python. It is used to build a python extension module. The boost \ncompilation must match the version of MSVC and Python used by the shell extension.\n\n#### Python\n\n`python.props`\n\nCurrently only Python 2.7, 3.6, and 3.7 are supported. The USD SDK does not currently support Python 3.8+ on Windows.\n\n#### USD SDK\n\n`usd.props`\n\nThe shell extension requires a bare-bones monolithic build of the USD SDK. The monolithic build \nis a single DLL which makes it easier to isolate it into its own activation context in Windows Explorer.\n\nThe shell extension is currently set up to build against a build of USD that does not use Python. \nThe shell extension is injected into Windows Explorer which is also the process that runs \nthe Windows Desktop. We want to keep as much out of that process as we can.\n\n```\npython.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\n```\n\n#### Windows 10 SDK\n\nWindows 10 SDK 10.0.14393.0 or higher is required to build the shell extension. This requirement is only \ndue to High DPI support. It would be possible to remove High DPI support and compile the shell extension \nfor Windows 7.\n\n#### Visual Studio\n\nVisual Studio is the only supported build tool at this time. \n\nThe following Visual Studio components are required:\n\n- C++ ATL\n- Python Language Support\n\n\n## Simple Build\n\nThe simplest way to build the shell extension is to build two flavors of the USD SDK. The first being a \nbare-bones version of the SDK that is used by Windows Explorer. The second is a full version used by \neverything else.\n\nBare-Bones USD SDK\n\n```\npython.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\n```\n\nFull USD SDK\n\n```\npython.exe build_scripts\\build_usd.py d:\\USD-shared-full [--embree] [--materialx]\n```\n\nThen update the property sheets to point to these builds.\n\n`usd.props`\n\nPoint this property sheet to the bare-bones USD SDK.\n\n`boost.props`\n\nPoint this property sheet to the full USD SDK's version of boost.\n\n`UsdShellExtension.ini`\n\nPoint the paths in this configuration file to the full USD SDK.\n\n```\n[USD]\nPATH=D:\\USD-shared-full\\bin\\;D:\\USD-shared-full\\lib\\\nPYTHONPATH=D:\\USD-shared-full\\lib\\python\nPXR_PLUGINPATH_NAME=\n```"
  },
  {
    "path": "CONTRIBUTING.txt",
    "content": "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:\n\nActivision-Corporate-CLA-USD-Shell-Extension.pdf: for corporate contributors\nActivision-Individual-CLA-USD-Shell-Extension.pdf: for individual contributors\n\nPlease 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.\n"
  },
  {
    "path": "LICENSE.txt",
    "content": "                               Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n     or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n    Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n============================================================\nemb.cpp, emb.h\n============================================================\n\nCopyright (C) 2011 Mateusz Loskot <mateusz@loskot.net>\nDistributed under the Boost Software License, Version 1.0.\n(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n\nBlog article: http://mateusz.loskot.net/?p=2819\n\nBoost Software License - Version 1.0 - August 17th, 2003\n\nPermission is hereby granted, free of charge, to any person or organization\nobtaining a copy of the software and accompanying documentation covered by\nthis license (the \"Software\") to use, reproduce, display, distribute,\nexecute, and transmit the Software, and to prepare derivative works of the\nSoftware, and to permit third-parties to whom the Software is furnished to\ndo so, all subject to the following:\n\nThe copyright notices in the Software and this entire statement, including\nthe above license grant, this restriction and the following disclaimer,\nmust be included in all copies of the Software, in whole or in part, and\nall derivative works of the Software, unless such copies or derivative\nworks are solely in the form of machine-executable object code generated by\na source language processor.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT\nSHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE\nFOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,\nARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\nDEALINGS IN THE SOFTWARE.\n\n============================================================\nUniversal Scene Description   \n============================================================\nUniversal Scene Description   \nCopyright 2016 Pixar\nAll rights reserved.\nThis product includes software developed at:\nPixar (http://www.pixar.com/).\n\nModified Apache 2.0 License\n\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor\n      and its affiliates, except as required to comply with Section 4(c) of\n      the License and to reproduce the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n\n"
  },
  {
    "path": "NOTICE.txt",
    "content": "Activision USD Shell Extension\nCopyright 2021 Activision Publishing, Inc.\n   \nAll rights reserved.\n\nThis product includes software developed at Activision Publishing, Inc.\n"
  },
  {
    "path": "README.md",
    "content": "Activision USD Shell Extension\n==============================\n\nA Windows Shell Extension for the Pixar USD file format. \n\n**Windows Explorer Features**\n\n* Hydra Realtime Preview \n* Thumbnails\n* Context Menus\n* Metadata Properties\n\n**Windows Search Features**\n\n* Metadata Search\n\nMore details available [here](./docs/FEATURES.md).\n\nGoals\n-----\n\nThere are several goals that this shell extension tries to adhere to and takes extra precautions to meet.\n\n* **Performance**  \n  It is important that the shell extension not stall Windows Explorer.  \n\n* **Stability**  \n  Instability in the shell extension will take down Window Explorer and/or the entire desktop.  \n\nThe mitigation strategy is to run the majority of the shell extension asynchronously out of the \nWindows Explorer process.\n\n\nDependencies\n------------\n\nThe following dependencies are required:\n\n* [Microsoft Visual Studio (2017 or newer)](https://visualstudio.microsoft.com/vs/)\n* [Universal Scene Description (USD)](https://graphics.pixar.com/usd/docs/index.html)\n* [Python (2.7, 3.6, 3.7)](https://www.python.org/)\n\nRequired Microsoft Visual Studio Components:\n\n* Desktop development with C++\n* C++ ATL\n* Windows 10 SDK\n* Windows Universal C Runtime\n* Python language support\n\n\n"
  },
  {
    "path": "UsdPreviewHandlerPython/Module.cpp",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include \"stdafx.h\"\n#include \"Module.h\"\n\nHMODULE g_hInstance;\n\nBOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved )\n{\n\tUNREFERENCED_PARAMETER( lpReserved );\n\n\tswitch ( ul_reason_for_call )\n\t{\n\tcase DLL_PROCESS_ATTACH:\n\t\tg_hInstance = hModule;\n\t\tbreak;\n\t}\n\n\treturn TRUE;\n}"
  },
  {
    "path": "UsdPreviewHandlerPython/Module.h",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#pragma once\n\nextern HMODULE g_hInstance;\n\n"
  },
  {
    "path": "UsdPreviewHandlerPython/StageViewWnd.cpp",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include \"stdafx.h\"\n#include \"StageViewWnd.h\"\n#include \"Module.h\"\n#include \"resource.h\"\n\n\nvoid CStageViewWnd::Init( HWND hWndToSubclass )\n{\n\tif ( m_hWnd )\n\t\tTerm();\n\n\tSubclassWindow( hWndToSubclass );\n}\n\nvoid CStageViewWnd::Term()\n{\n\tUnsubclassWindow();\n}\n\n"
  },
  {
    "path": "UsdPreviewHandlerPython/StageViewWnd.h",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#pragma once\n\n#include \"resource.h\"\n\nclass CStageViewWnd : public CWindowImpl<CStageViewWnd>\n{\npublic:\n\tvoid Init( HWND hWndToSubclass );\n\tvoid Term();\n\nprivate:\n\n\tBEGIN_MSG_MAP(CStageViewWnd)\n\tEND_MSG_MAP()\n};"
  },
  {
    "path": "UsdPreviewHandlerPython/UsdPreviewHandlerEvent.h",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#pragma once\n\nenum eUsdPreviewEvent\n{\n\tUSDPREVIEWEVENT_INVALID,\n\tUSDPREVIEWEVENT_QUIT,\n\tUSDPREVIEWEVENT_RESIZE,\n\tUSDPREVIEWEVENT_RESIZERECT,\n\tUSDPREVIEWEVENT_SETWINDOW,\n};\n\nstruct UsdPreviewEventData\n{\n\teUsdPreviewEvent event;\n\tintptr_t data1;\n\tintptr_t data2;\n};\n\ntypedef void (*FNUSDPREVIEWPUSHEVENT)(eUsdPreviewEvent event, intptr_t data1, intptr_t data2);\n\ntypedef HWND (*FNUSDPREVIEWGETPREVIEWWINDOW)();"
  },
  {
    "path": "UsdPreviewHandlerPython/UsdPreviewHandlerMgr.cpp",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include \"stdafx.h\"\n#include \"UsdPreviewHandlerMgr.h\"\n#include \"UsdPreviewHandlerEvent.h\"\n\nCUsdPreviewHandlerMgr CUsdPreviewHandlerMgr::s_Singleton;\n\nUsdPreviewEventData CUsdPreviewHandlerMgr::PeekEvent()\n{\n\tUsdPreviewEventData eventData = {};\n\n\tstd::lock_guard<std::mutex> guard(m_EventQueueMutex);\n\tif (m_EventQueue.empty())\n\t\treturn eventData;\n\n\teventData = m_EventQueue.front();\n\tm_EventQueue.pop();\n\n\treturn eventData;\n}\n\nvoid CUsdPreviewHandlerMgr::LoadComplete()\n{\n\tm_bLoadComplete = true;\n\n\tif( m_bQuit == false )\n\t\tSetParent( m_hWndParent, m_hWndChild, m_hWndStageView );\n}\n\nvoid CUsdPreviewHandlerMgr::PostEvent(eUsdPreviewEvent event, intptr_t data1, intptr_t data2)\n{\n\tswitch (event)\n\t{\n\tcase USDPREVIEWEVENT_RESIZE:\n\t\tOnResize(static_cast<int>(data1), static_cast<int>(data2));\n\t\treturn;\n\tcase USDPREVIEWEVENT_RESIZERECT:\n\t\tOnResizeRect(*reinterpret_cast<RECT*>(data1));\n\t\treturn;\n\tcase USDPREVIEWEVENT_SETWINDOW:\n\t\tOnResizeRect(*reinterpret_cast<RECT*>(data2));\n\t\tbreak;\n\tcase USDPREVIEWEVENT_QUIT:\n\t\tOnQuit();\n\t\tbreak;\n\t}\n\n\tUsdPreviewEventData eventData = {};\n\teventData.event = event;\n\teventData.data1 = data1;\n\teventData.data2 = data2;\n\n\tstd::lock_guard<std::mutex> guard(m_EventQueueMutex);\n\tm_EventQueue.push(std::move(eventData));\n}\n\nvoid CUsdPreviewHandlerMgr::SetParent(HWND hWndParent, HWND hWndChild, HWND hWndStageView)\n{\n\tif ( m_bLoadComplete )\n\t{\n\t\t// The parent passed in here is actually the load screen dialog.\n\t\t// We want to swap the load screen dialog here with our dialog.\n\n\t\tHWND hWndLoadScreen = hWndParent;\n\n\t\tRECT rcClient;\n\t\t::GetClientRect( hWndLoadScreen, &rcClient );\n\n\t\tHWND hWndPreviewParent = ::GetParent( hWndLoadScreen );\n\t\t::SetParent( hWndChild, hWndPreviewParent );\n\n\t\t::SetWindowLong( hWndChild, GWL_STYLE, WS_POPUP|WS_CLIPCHILDREN );\n\t\t::SetWindowPos( hWndChild, HWND_TOP, 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top, SWP_FRAMECHANGED );\n\t\t::ShowWindow( hWndChild, SW_SHOW );\n\n\t\t::ShowWindow( hWndLoadScreen, SW_HIDE );\n\n\t\tm_StageViewWnd.Init( hWndStageView );\n\t}\n\n\tm_hWndParent = hWndParent;\n\tm_hWndChild = hWndChild;\n\tm_hWndStageView = hWndStageView;\n}\n\nvoid CUsdPreviewHandlerMgr::OnResize(int cx, int cy)\n{\n\tif (m_bLoadComplete && m_hWndChild != nullptr)\n\t\t::SetWindowPos(m_hWndChild, nullptr, 0, 0, cx, cy, 0);\n}\n\nvoid CUsdPreviewHandlerMgr::OnResizeRect(const RECT& rc)\n{\n\tif (m_bLoadComplete && m_hWndChild != nullptr)\n\t\t::SetWindowPos(m_hWndChild, nullptr, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, 0);\n}\n\nvoid CUsdPreviewHandlerMgr::OnQuit()\n{\n\tm_bQuit = true;\n\n\t// clear out our data\n\tm_hWndChild = nullptr;\n\tm_hWndParent = nullptr;\n\tm_hWndStageView = nullptr;\n}\n\nHWND CUsdPreviewHandlerMgr::GetPreviewWindow() const\n{\n\treturn m_hWndChild;\n}\n\nbool CUsdPreviewHandlerMgr::IsValid() const\n{\n\treturn m_hWndChild != nullptr;\n}\n\n// pushes an event to Python\nextern \"C\" __declspec(dllexport) \nvoid UsdPreviewPushEvent(eUsdPreviewEvent event, intptr_t data1, intptr_t data2)\n{\n\tCUsdPreviewHandlerMgr::GetSingleton().PostEvent(event, data1, data2);\n}\n\n// pushes an event to Python\nextern \"C\" __declspec(dllexport)\nHWND UsdPreviewGetPreviewWindow()\n{\n\treturn CUsdPreviewHandlerMgr::GetSingleton().GetPreviewWindow();\n}"
  },
  {
    "path": "UsdPreviewHandlerPython/UsdPreviewHandlerMgr.h",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#pragma once\n\n#include \"UsdPreviewHandlerMgr.h\"\n#include \"UsdPreviewHandlerEvent.h\"\n#include \"StageViewWnd.h\"\n\n#include <queue>\n#include <mutex>\n\nclass CUsdPreviewHandlerMgr\n{\npublic:\n\tstatic CUsdPreviewHandlerMgr& GetSingleton();\n\n\tUsdPreviewEventData PeekEvent();\n\tvoid PostEvent(eUsdPreviewEvent event, intptr_t data1, intptr_t data2);\n\n\tvoid SetParent(HWND hWndParent, HWND hWndChild, HWND hWndStageView);\n\n\tHWND GetPreviewWindow() const;\n\tvoid LoadComplete();\n\n\tbool IsValid() const;\n\nprivate:\n\tvoid OnResize(int cx, int cy);\n\tvoid OnResizeRect(const RECT& rc);\n\tvoid OnQuit();\n\n\tstatic CUsdPreviewHandlerMgr s_Singleton;\n\n\tstd::queue<UsdPreviewEventData> m_EventQueue;\n\tstd::mutex m_EventQueueMutex;\n\n\tHWND m_hWndParent = nullptr;\n\tHWND m_hWndChild = nullptr;\n\tHWND m_hWndStageView = nullptr;\n\n\tbool m_bLoadComplete = false;\n\tbool m_bQuit = false;\n\n\tCStageViewWnd m_StageViewWnd;\n};\n\ninline CUsdPreviewHandlerMgr& CUsdPreviewHandlerMgr::GetSingleton()\n{\n\treturn s_Singleton;\n}"
  },
  {
    "path": "UsdPreviewHandlerPython/UsdPreviewHandlerPython.rc",
    "content": "// Microsoft Visual C++ generated resource script.\n//\n#include \"resource.h\"\n\n#define APSTUDIO_READONLY_SYMBOLS\n/////////////////////////////////////////////////////////////////////////////\n//\n// Generated from the TEXTINCLUDE 2 resource.\n//\n#include \"winres.h\"\n\n/////////////////////////////////////////////////////////////////////////////\n#undef APSTUDIO_READONLY_SYMBOLS\n\n/////////////////////////////////////////////////////////////////////////////\n// English (United States) resources\n\n#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\nLANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US\n#pragma code_page(1252)\n\n#ifdef APSTUDIO_INVOKED\n/////////////////////////////////////////////////////////////////////////////\n//\n// TEXTINCLUDE\n//\n\n1 TEXTINCLUDE \nBEGIN\n    \"resource.h\\0\"\nEND\n\n2 TEXTINCLUDE \nBEGIN\n    \"#include \"\"winres.h\"\"\\r\\n\"\n    \"\\0\"\nEND\n\n3 TEXTINCLUDE \nBEGIN\n    \"\\r\\n\"\n    \"#define ATVI_VERSION_DESCRIPTION \"\"Activision USD Preview Python Module\"\"\\r\\n\"\n    \"#include \"\"atviversion.rc2\"\"\\r\\n\"\n    \"\\0\"\nEND\n\n#endif    // APSTUDIO_INVOKED\n\n#endif    // English (United States) resources\n/////////////////////////////////////////////////////////////////////////////\n\n\n\n#ifndef APSTUDIO_INVOKED\n/////////////////////////////////////////////////////////////////////////////\n//\n// Generated from the TEXTINCLUDE 3 resource.\n//\n\n#define ATVI_VERSION_DESCRIPTION \"Activision USD Preview Python Module\"\n#include \"atviversion.rc2\"\n\n/////////////////////////////////////////////////////////////////////////////\n#endif    // not APSTUDIO_INVOKED\n\n"
  },
  {
    "path": "UsdPreviewHandlerPython/UsdPreviewHandlerPython.vcxproj",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup Label=\"ProjectConfigurations\">\n    <ProjectConfiguration Include=\"Debug|x64\">\n      <Configuration>Debug</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release|x64\">\n      <Configuration>Release</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n  </ItemGroup>\n  <PropertyGroup Label=\"Globals\">\n    <VCProjectVersion>16.0</VCProjectVersion>\n    <Keyword>Win32Proj</Keyword>\n    <ProjectGuid>{248f687e-4028-4243-87b8-2312f57be8a5}</ProjectGuid>\n    <RootNamespace>UsdPreviewHandlerPython</RootNamespace>\n    <ProjectName>UsdPreviewHandlerPython</ProjectName>\n    <WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v141</PlatformToolset>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v141</PlatformToolset>\n    <WholeProgramOptimization>false</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n  <Import Project=\"$(SolutionDir)\\atviversion.props\" />\n  <Import Project=\"$(SolutionDir)\\python.props\" />\n  <Import Project=\"$(SolutionDir)\\boost.props\" />\n  <PropertyGroup Label=\"PythonConfiguration\">\n    <RegistryView>RegistryView.Registry32</RegistryView>\n    <RegistryView Condition=\"$(Platform) == 'x64'\">RegistryView.Registry64</RegistryView>\n    <PythonTag>$(PythonVersion)-32</PythonTag>\n    <PythonTag Condition=\"$(Platform) == 'x64'\">$(PythonVersion)</PythonTag>\n    <PythonHome Condition=\"$(PythonHome) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstallPath', null, null, $(RegistryView)))</PythonHome>\n    <PythonHome Condition=\"$(PythonHome) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstallPath', null, null, $(RegistryView)))</PythonHome>\n    <PythonExe Condition=\"$(PythonExe) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstallPath', 'ExecutablePath', null, $(RegistryView)))</PythonExe>\n    <PythonExe Condition=\"$(PythonExe) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstallPath', 'ExecutablePath', null, $(RegistryView)))</PythonExe>\n    <PythonExe Condition=\"$(PythonExe) == '' and $(PythonHome) != ''\">$(PythonHome)python.exe</PythonExe>\n    <PythonDevVersion>$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstalledFeatures', 'dev', null, $(RegistryView)))</PythonDevVersion>\n    <PythonDevVersion Condition=\"$(PythonDevVersion) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstalledFeatures', 'dev', null, $(RegistryView)))</PythonDevVersion>\n    <PythonCorePDBVersion>$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstalledFeatures', 'core_pdb', null, $(RegistryView)))</PythonCorePDBVersion>\n    <PythonCorePDBVersion Condition=\"$(PythonCorePDBVersion) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstalledFeatures', 'core_pdb', null, $(RegistryView)))</PythonCorePDBVersion>\n    <PythonCoreDVersion>$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstalledFeatures', 'core_d', null, $(RegistryView)))</PythonCoreDVersion>\n    <PythonCoreDVersion Condition=\"$(PythonCoreDVersion) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstalledFeatures', 'core_d', null, $(RegistryView)))</PythonCoreDVersion>\n    <PythonDebugSuffix Condition=\"$(PythonCoreDVersion) != ''\">_d</PythonDebugSuffix>\n    <PythonDExe Condition=\"$(PythonExe) != '' and $(PythonDExe) == ''\">$([System.IO.Path]::GetDirectoryName($(PythonExe)))\\python$(PythonDebugSuffix).exe</PythonDExe>\n    <PythonDExe Condition=\"!Exists($(PythonDExe))\">$(PythonExe)</PythonDExe>\n  </PropertyGroup>\n  <ImportGroup Label=\"ExtensionSettings\">\n  </ImportGroup>\n  <ImportGroup Label=\"Shared\">\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <PropertyGroup Label=\"UserMacros\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <LinkIncremental>true</LinkIncremental>\n    <OutDir>$(SolutionDir)bin\\$(PlatformToolset)\\$(PythonTag)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)build\\$(PlatformToolset)\\$(PythonTag)\\$(Configuration)\\$(ProjectName)\\</IntDir>\n    <TargetExt>.pyd</TargetExt>\n    <TargetName>UsdPreviewHandler</TargetName>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)bin\\$(PlatformToolset)\\$(PythonTag)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)build\\$(PlatformToolset)\\$(PythonTag)\\$(Configuration)\\$(ProjectName)\\</IntDir>\n    <TargetExt>.pyd</TargetExt>\n    <TargetName>UsdPreviewHandler</TargetName>\n  </PropertyGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <ClCompile>\n      <WarningLevel>Level4</WarningLevel>\n      <SDLCheck>true</SDLCheck>\n      <PreprocessorDefinitions>_DEBUG;USDPREVIEW_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <ConformanceMode>false</ConformanceMode>\n      <PrecompiledHeader>Use</PrecompiledHeader>\n      <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>\n      <AdditionalIncludeDirectories>$(PythonHome)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <Optimization>Disabled</Optimization>\n      <InlineFunctionExpansion>Disabled</InlineFunctionExpansion>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <EnableUAC>false</EnableUAC>\n      <AdditionalLibraryDirectories>$(PythonHome)libs;C:\\usd-20.08\\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>UxTheme.lib;%(AdditionalDependencies)</AdditionalDependencies>\n    </Link>\n    <PostBuildEvent />\n    <ResourceCompile>\n      <AdditionalIncludeDirectories>$(OutDir);$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n    </ResourceCompile>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\n    <ClCompile>\n      <WarningLevel>Level4</WarningLevel>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <SDLCheck>true</SDLCheck>\n      <PreprocessorDefinitions>NDEBUG;USDPREVIEW_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <ConformanceMode>false</ConformanceMode>\n      <PrecompiledHeader>Use</PrecompiledHeader>\n      <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>\n      <AdditionalIncludeDirectories>$(PythonHome)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <EnableCOMDATFolding>false</EnableCOMDATFolding>\n      <OptimizeReferences>false</OptimizeReferences>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <EnableUAC>false</EnableUAC>\n      <AdditionalLibraryDirectories>$(PythonHome)libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>UxTheme.lib;%(AdditionalDependencies)</AdditionalDependencies>\n    </Link>\n    <PostBuildEvent />\n    <ResourceCompile>\n      <AdditionalIncludeDirectories>$(OutDir);$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n    </ResourceCompile>\n  </ItemDefinitionGroup>\n  <ItemGroup>\n    <ClInclude Include=\"Module.h\" />\n    <ClInclude Include=\"resource.h\" />\n    <ClInclude Include=\"StageViewWnd.h\" />\n    <ClInclude Include=\"stdafx.h\" />\n    <ClInclude Include=\"UsdPreviewHandlerEvent.h\" />\n    <ClInclude Include=\"UsdPreviewHandlerMgr.h\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"Module.cpp\" />\n    <ClCompile Include=\"StageViewWnd.cpp\" />\n    <ClCompile Include=\"stdafx.cpp\">\n      <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">Create</PrecompiledHeader>\n      <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">Create</PrecompiledHeader>\n    </ClCompile>\n    <ClCompile Include=\"pyUsdPreviewHandler.cpp\" />\n    <ClCompile Include=\"UsdPreviewHandlerMgr.cpp\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ResourceCompile Include=\"UsdPreviewHandlerPython.rc\" />\n  </ItemGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\n  <ImportGroup Label=\"ExtensionTargets\">\n  </ImportGroup>\n</Project>"
  },
  {
    "path": "UsdPreviewHandlerPython/UsdPreviewHandlerPython.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup>\n    <Filter Include=\"Source Files\">\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\n      <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\n    </Filter>\n    <Filter Include=\"Header Files\">\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\n      <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>\n    </Filter>\n    <Filter Include=\"Resource Files\">\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\n    </Filter>\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"stdafx.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"UsdPreviewHandlerEvent.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"UsdPreviewHandlerMgr.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"resource.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"StageViewWnd.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"Module.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"stdafx.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"pyUsdPreviewHandler.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"UsdPreviewHandlerMgr.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"StageViewWnd.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"Module.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n  </ItemGroup>\n  <ItemGroup>\n    <ResourceCompile Include=\"UsdPreviewHandlerPython.rc\">\n      <Filter>Resource Files</Filter>\n    </ResourceCompile>\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "UsdPreviewHandlerPython/pyUsdPreviewHandler.cpp",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include \"stdafx.h\"\n#include \"UsdPreviewHandlerEvent.h\"\n#include \"UsdPreviewHandlerMgr.h\"\n\nusing namespace boost::python;\n\nstruct UsdPreviewApp\n{\n\tvoid SetParent( uint64_t nWndParent, uint64_t nWndChild, uint64_t nWndStageView );\n\tUsdPreviewEventData PeekEvent();\n\tvoid LoadComplete();\n};\n\nBOOST_PYTHON_MODULE( UsdPreviewHandler )\n{\n\tusing namespace boost::python;\n\n\tenum_<eUsdPreviewEvent>( \"UsdPreviewEvent\" )\n\t\t.value( \"NoMoreEvents\", USDPREVIEWEVENT_INVALID)\n\t\t.value( \"Quit\", USDPREVIEWEVENT_QUIT)\n\t\t;\n\n\tclass_<UsdPreviewEventData>( \"UsdPreviewEventData\", \"help\", no_init )\n\t\t.def_readonly(\"event\", &UsdPreviewEventData::event)\n\t\t.def_readonly(\"data1\", &UsdPreviewEventData::data1)\n\t\t.def_readonly(\"data2\", &UsdPreviewEventData::data2)\n\t\t;\n\n\tclass_<UsdPreviewApp>( \"UsdPreviewApp\", \"help\", init<>() )\n\t\t.def( \"SetParent\", &UsdPreviewApp::SetParent )\n\t\t.def( \"PeekEvent\", &UsdPreviewApp::PeekEvent )\n\t\t.def( \"LoadComplete\", &UsdPreviewApp::LoadComplete )\n\t\t;\n}\n\nvoid UsdPreviewApp::SetParent( uint64_t nWndParent, uint64_t nWndChild, uint64_t nWndStageView )\n{\n\tHWND hWndParent = reinterpret_cast<HWND>(nWndParent);\n\tHWND hWndChild = reinterpret_cast<HWND>(nWndChild);\n\tHWND hWndStageView = reinterpret_cast<HWND>(nWndStageView);\n\n\tCUsdPreviewHandlerMgr::GetSingleton().SetParent(hWndParent, hWndChild, hWndStageView);\n}\n\nUsdPreviewEventData UsdPreviewApp::PeekEvent()\n{\n\treturn CUsdPreviewHandlerMgr::GetSingleton().PeekEvent();\n}\n\nvoid UsdPreviewApp::LoadComplete()\n{\n\tCUsdPreviewHandlerMgr::GetSingleton().LoadComplete();\n}\n\n"
  },
  {
    "path": "UsdPreviewHandlerPython/resource.h",
    "content": "//{{NO_DEPENDENCIES}}\n// Microsoft Visual C++ generated include file.\n// Used by UsdPreviewHandlerPython.rc\n//\n\n// Next default values for new objects\n// \n#ifdef APSTUDIO_INVOKED\n#ifndef APSTUDIO_READONLY_SYMBOLS\n#define _APS_NEXT_RESOURCE_VALUE        103\n#define _APS_NEXT_COMMAND_VALUE         40012\n#define _APS_NEXT_CONTROL_VALUE         1001\n#define _APS_NEXT_SYMED_VALUE           101\n#endif\n#endif\n"
  },
  {
    "path": "UsdPreviewHandlerPython/stdafx.cpp",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include \"stdafx.h\""
  },
  {
    "path": "UsdPreviewHandlerPython/stdafx.h",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#pragma once\n\n#pragma warning(push)\n#pragma warning(disable: 4244 4459)\n\n#include <boost/python/module.hpp>\n#include <boost/python/def.hpp>\n#include <boost/python/list.hpp>\n#include <boost/python.hpp>\n\n#pragma warning(pop)\n\n#include <iostream>\n\n#define WIN32_LEAN_AND_MEAN\n#include <windows.h>\n#include <tchar.h>\n#include <Uxtheme.h>\n\n#include <atlbase.h>\n#include <atlcom.h>\n#include <atlconv.h>\n#include <atlstr.h>\n#include <atlwin.h>"
  },
  {
    "path": "UsdPreviewHandlerServer/Module.cpp",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include \"stdafx.h\"\n#include \"Module.h\"\n\nHMODULE g_hInstance;\nCUSDPreviewLocalServerModule g_AtlModule;\n\nextern \"C\" int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nShowCmd)\n{\n\tUNREFERENCED_PARAMETER( hPrevInstance );\n\tUNREFERENCED_PARAMETER( lpCmdLine );\n\tUNREFERENCED_PARAMETER( nShowCmd );\n\n\tg_hInstance = hInstance;\n\n\tint nResult = g_AtlModule.WinMain( nShowCmd );\n\n\treturn nResult;\n}\n\n\n"
  },
  {
    "path": "UsdPreviewHandlerServer/Module.h",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#pragma once\n\n#include \"USDPreviewLocalServer_h.h\"\n#include \"resource.h\"\n\n// Using an ATL module here because it removes a lot of the \n// boiler-plate COM work that we would have to implement ourselves.\n\nclass CUSDPreviewLocalServerModule : public CAtlExeModuleT<CUSDPreviewLocalServerModule>\n{\npublic:\n\tDECLARE_LIBID( LIBID_USDPreview )\n\tDECLARE_REGISTRY_APPID_RESOURCEID( IDR_REGISTRY_MODULE, \"{067AAB34-285D-40D1-92EF-A5ED449EFEEE}\" )\n\n\t// Override CAtlExeModuleT::PreMessageLoop to change REGCLS_MULTIPLEUSE to REGCLS_SINGLEUSE.\n\t// REGCLS_SINGLEUSE will create a new Windows process for every instance of our COM classes, \n\t// REGCLS_MULTIPLEUSE will reuse the same Windows process.\n\tHRESULT PreMessageLoop( _In_ int /*nShowCmd*/ ) throw()\n\t{\n\t\tHRESULT hr = S_OK;\n\t\tCUSDPreviewLocalServerModule* pT = static_cast<CUSDPreviewLocalServerModule*>(this);\n\n#ifndef _ATL_NO_COM_SUPPORT\n\t\thr = pT->RegisterClassObjects(CLSCTX_LOCAL_SERVER,\n\t\t\tREGCLS_SINGLEUSE | // <- !!!\n\t\t\tREGCLS_SUSPENDED);\n\n\t\tif (FAILED(hr))\n\t\t\treturn hr;\n\n\t\tif (hr == S_OK)\n\t\t{\n\t\t\tif (m_bDelayShutdown)\n\t\t\t{\n\t\t\t\tCHandle h(pT->StartMonitor());\n\t\t\t\tif (h.m_h == NULL)\n\t\t\t\t{\n\t\t\t\t\thr = E_FAIL;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\thr = CoResumeClassObjects();\n\t\t\t\t\tATLASSERT(SUCCEEDED(hr));\n\t\t\t\t\tif (FAILED(hr))\n\t\t\t\t\t{\n\t\t\t\t\t\t::SetEvent(m_hEventShutdown); // tell monitor to shutdown\n\t\t\t\t\t\t::WaitForSingleObject(h, m_dwTimeOut * 2);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\thr = CoResumeClassObjects();\n\t\t\t\tATLASSERT(SUCCEEDED(hr));\n\t\t\t}\n\n\t\t\tif (FAILED(hr))\n\t\t\t\tpT->RevokeClassObjects();\n\t\t}\n\t\telse\n\t\t{\n\t\t\tm_bDelayShutdown = false;\n\t\t}\n\n#endif\t// _ATL_NO_COM_SUPPORT\n\n\t\tATLASSERT(SUCCEEDED(hr));\n\t\treturn hr;\n\t}\n};\n\nextern CUSDPreviewLocalServerModule g_AtlModule;\nextern HMODULE g_hInstance;\n\n"
  },
  {
    "path": "UsdPreviewHandlerServer/UsdPreviewHandlerImpl.cpp",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include \"stdafx.h\"\n#include \"USDPreviewHandlerImpl.h\"\n#include \"Module.h\"\n#include \"shared\\PythonUtil.h\"\n#include \"shared\\emb.h\"\n#include \"shared\\environment.h\"\n#include \"shared\\EventViewerLog.h\"\n\nHRESULT CUsdPreviewHandlerImpl::FinalConstruct()\n{\n\tSetupPythonEnvironment( g_hInstance );\n\n\tm_hUsdPreviewLib = LoadLibraryEx(_T(\"UsdPreviewHandler.pyd\"), nullptr, LOAD_LIBRARY_SEARCH_APPLICATION_DIR|LOAD_LIBRARY_SEARCH_SYSTEM32);\n\tif (m_hUsdPreviewLib == nullptr)\n\t\treturn E_FAIL;\n\n\tm_fnUsdPreviewPushEvent = reinterpret_cast<FNUSDPREVIEWPUSHEVENT>(GetProcAddress(m_hUsdPreviewLib, \"UsdPreviewPushEvent\"));\n\tif (m_fnUsdPreviewPushEvent == nullptr)\n\t\treturn E_FAIL;\n\n\tm_fnUsdGetPreviewWindow = reinterpret_cast<FNUSDPREVIEWGETPREVIEWWINDOW>(GetProcAddress(m_hUsdPreviewLib, \"UsdPreviewGetPreviewWindow\"));\n\tif (m_fnUsdGetPreviewWindow == nullptr)\n\t\treturn E_FAIL;\n\n\tif ( !m_PreviewThread.Init() )\n\t\treturn E_FAIL;\n\n\tm_clrBackground = ::GetSysColor( COLOR_WINDOW );\n\tm_clrText = ::GetSysColor( COLOR_WINDOWTEXT );\n\n\treturn __super::FinalConstruct();\n}\n\nvoid CUsdPreviewHandlerImpl::FinalRelease()\n{\n\tm_PreviewThread.Term();\n\n\tif (m_hUsdPreviewLib)\n\t{\n\t\tFreeLibrary(m_hUsdPreviewLib);\n\t\tm_hUsdPreviewLib = nullptr;\n\t\tm_fnUsdPreviewPushEvent = nullptr;\n\t\tm_fnUsdGetPreviewWindow = nullptr;\n\t}\n\n\t__super::FinalRelease();\n}\n\n// IInitializeWithFile\nSTDMETHODIMP CUsdPreviewHandlerImpl::Initialize(__RPC__in_string LPCWSTR pszFilePath, DWORD grfMode)\n{\n\tUNREFERENCED_PARAMETER(grfMode);\n\n\tm_usdStagePath = pszFilePath;\n\n\treturn S_OK;\n}\n\n// IObjectWithSite\nSTDMETHODIMP CUsdPreviewHandlerImpl::SetSite(__RPC__in_opt IUnknown* pUnkSite)\n{\n\tm_pSite = nullptr;\n\tm_pPreviewHandlerFrame = nullptr;\n\tm_PreviewHandlerFrameInfo.Term();\n\n\tif (pUnkSite != nullptr)\n\t{\n\t\tm_pSite = pUnkSite;\n\t\tCComQIPtr<IPreviewHandlerFrame> pIPreviewHandlerFrame(m_pSite);\n\t\tm_pPreviewHandlerFrame = pIPreviewHandlerFrame;\n\t\tif ( m_pPreviewHandlerFrame )\n\t\t\tm_pPreviewHandlerFrame->GetWindowContext( &m_PreviewHandlerFrameInfo );\n\t}\n\n\treturn S_OK;\n}\n\nSTDMETHODIMP CUsdPreviewHandlerImpl::GetSite(__RPC__in REFIID riid, __RPC__deref_out_opt void** ppvSite)\n{\n\tif (ppvSite == nullptr)\n\t\treturn E_POINTER;\n\n\tif (m_pSite == nullptr)\n\t{\n\t\t*ppvSite = nullptr;\n\t\treturn E_FAIL;\n\t}\n\n\tHRESULT hr;\n\thr = m_pSite->QueryInterface(riid, ppvSite);\n\n\treturn hr;\n}\n\n// IOleWindow\nSTDMETHODIMP CUsdPreviewHandlerImpl::GetWindow(__RPC__deref_out_opt HWND* phwnd)\n{\n\tif (phwnd == nullptr)\n\t\treturn E_POINTER;\n\n\t*phwnd = m_fnUsdGetPreviewWindow();\n\tif ( *phwnd == nullptr )\n\t\treturn E_FAIL;\n\n\treturn S_OK;\n}\n\nSTDMETHODIMP CUsdPreviewHandlerImpl::ContextSensitiveHelp(BOOL fEnterMode)\n{\n\tUNREFERENCED_PARAMETER(fEnterMode);\n\treturn E_NOTIMPL;\n}\n\n// IPreviewHandler\nSTDMETHODIMP CUsdPreviewHandlerImpl::SetWindow(__RPC__in HWND hwnd, __RPC__in const RECT* prc)\n{\n\tif (prc == nullptr)\n\t\treturn E_POINTER;\n\n\tm_hWndParent = hwnd;\n\tm_rcWindow = *prc;\n\n\tPushEvent( USDPREVIEWEVENT_SETWINDOW, reinterpret_cast<intptr_t>(m_hWndParent), reinterpret_cast<intptr_t>(&m_rcWindow) );\n\n\treturn S_OK;\n}\n\nSTDMETHODIMP CUsdPreviewHandlerImpl::SetRect(__RPC__in const RECT* prc)\n{\n\tif (prc == nullptr)\n\t\treturn E_POINTER;\n\n\tm_rcWindow = *prc;\n\n\tPushEvent( USDPREVIEWEVENT_RESIZERECT, reinterpret_cast<intptr_t>(&m_rcWindow) );\n\n\treturn S_OK;\n}\n\nSTDMETHODIMP CUsdPreviewHandlerImpl::DoPreview()\n{\n\tHRESULT hr;\n\thr = m_PreviewThread.LaunchPreviewWindow( reinterpret_cast<HWND>(m_hWndParent), m_usdStagePath );\n\tif (FAILED(hr))\n\t\treturn hr;\n\n\treturn S_OK;\n}\n\nSTDMETHODIMP CUsdPreviewHandlerImpl::Unload()\n{\n\t// push the shutdown event to Python\n\tPushEvent( USDPREVIEWEVENT_QUIT );\n\n\tm_usdStagePath.Empty();\n\tm_pSite = nullptr;\n\tm_pPreviewHandlerFrame = nullptr;\n\tm_PreviewHandlerFrameInfo.Term();\n\tm_hWndParent = nullptr;\n\tm_rcWindow = {};\n\n\treturn S_OK;\n}\n\nSTDMETHODIMP CUsdPreviewHandlerImpl::SetFocus()\n{\n\treturn S_OK;\n}\n\nSTDMETHODIMP CUsdPreviewHandlerImpl::QueryFocus(__RPC__deref_out_opt HWND* phwnd)\n{\n\tif ( phwnd == nullptr )\n\t\treturn E_POINTER;\n\n\t*phwnd = nullptr;\n\treturn S_OK;\n}\n\nSTDMETHODIMP CUsdPreviewHandlerImpl::TranslateAccelerator(__RPC__in MSG* pmsg)\n{\n\tif (pmsg == nullptr)\n\t\treturn E_POINTER;\n\n\tif ( m_pPreviewHandlerFrame && IsAccelerator( m_PreviewHandlerFrameInfo.haccel, m_PreviewHandlerFrameInfo.cAccelEntries, pmsg, nullptr ) )\n\t{\n\t\treturn m_pPreviewHandlerFrame->TranslateAccelerator(pmsg);\n\t}\n\n\treturn S_FALSE;\n}\n\nSTDMETHODIMP CUsdPreviewHandlerImpl::SetBackgroundColor( COLORREF color )\n{\n\tm_clrBackground = color;\n\treturn S_OK;\n}\n\nSTDMETHODIMP CUsdPreviewHandlerImpl::SetFont( __RPC__in const LOGFONTW *plf )\n{\n\tUNREFERENCED_PARAMETER( plf );\n\treturn S_OK;\n}\n\nSTDMETHODIMP CUsdPreviewHandlerImpl::SetTextColor( COLORREF color )\n{\n\tm_clrText = color;\n\treturn S_OK;\n}\n\n\nbool CUsdPreviewHandlerImpl::PushEvent(eUsdPreviewEvent event, intptr_t data1, intptr_t data2)\n{\n\t// push the event to Python\n\tif (m_fnUsdPreviewPushEvent == nullptr)\n\t\treturn false;\n\n\tm_fnUsdPreviewPushEvent(event, data1, data2);\n\n\treturn true;\n}\n\nHRESULT WINAPI CUsdPreviewHandlerImpl::UpdateRegistry(_In_ BOOL bRegister) throw()\n{\n\tATL::_ATL_REGMAP_ENTRY regMapEntries[] =\n\t{\n\t\t{ L\"APPID\", L\"{067AAB34-285D-40D1-92EF-A5ED449EFEEE}\" },\n\t\t{ L\"TYPELIB\", L\"{68DF0FAC-996B-4933-B092-9733E77061BB}\" },\n\t\t{ L\"CLSID_USDPREVIEWHANDLER\", L\"{07D4D38F-9C98-48F8-A057-26241405D5C8}\" },\n\t\t{ nullptr, nullptr }\n\t};\n\n\treturn g_AtlModule.UpdateRegistryFromResource(IDR_REGISTRY_USDPREVIEWHANDLERIMPL, bRegister, regMapEntries);\n}"
  },
  {
    "path": "UsdPreviewHandlerServer/UsdPreviewHandlerImpl.h",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#pragma once\n\n#include \"USDPreviewLocalServer_h.h\"\n#include \"USDPreviewThread.h\"\n#include \"UsdPreviewHandlerPython\\UsdPreviewHandlerEvent.h\"\n\n#include \"resource.h\"\n\nclass CPreviewHandlerFrameInfo : public PREVIEWHANDLERFRAMEINFO\n{\npublic:\n\tCPreviewHandlerFrameInfo()\n\t{\n\t\thaccel = nullptr;\n\t\tcAccelEntries = 0;\n\t}\n\n\t~CPreviewHandlerFrameInfo()\n\t{\n\t\tTerm();\n\t}\n\n\tvoid Term()\n\t{\n\t\tif ( haccel )\n\t\t{\n\t\t\tDestroyAcceleratorTable( haccel );\n\t\t\thaccel = nullptr;\n\t\t}\n\t}\n};\n\nclass ATL_NO_VTABLE CUsdPreviewHandlerImpl :\n\tpublic CComObjectRootEx<CComSingleThreadModel>,\n\tpublic CComCoClass<CUsdPreviewHandlerImpl, &CLSID_USDPreviewHandler>,\n\tpublic IInitializeWithFile,\n\tpublic IObjectWithSite,\n\tpublic IOleWindow,\n\tpublic IPreviewHandler,\n\tpublic IPreviewHandlerVisuals\n{\npublic:\n\tDECLARE_NOT_AGGREGATABLE(CUsdPreviewHandlerImpl)\n\tDECLARE_PROTECT_FINAL_CONSTRUCT()\n\n\tBEGIN_COM_MAP(CUsdPreviewHandlerImpl)\n\t\tCOM_INTERFACE_ENTRY(IInitializeWithFile)\n\t\tCOM_INTERFACE_ENTRY(IObjectWithSite)\n\t\tCOM_INTERFACE_ENTRY(IOleWindow)\n\t\tCOM_INTERFACE_ENTRY(IPreviewHandler)\n\t\tCOM_INTERFACE_ENTRY(IPreviewHandlerVisuals)\n\tEND_COM_MAP()\n\n\tHRESULT FinalConstruct();\n\tvoid FinalRelease();\n\n\t// IInitializeWithFile\n\tSTDMETHODIMP Initialize( __RPC__in_string LPCWSTR pszFilePath, DWORD grfMode ) override;\n\n\t// IObjectWithSite\n\tSTDMETHODIMP SetSite(__RPC__in_opt IUnknown* pUnkSite) override;\n\tSTDMETHODIMP GetSite(__RPC__in REFIID riid, __RPC__deref_out_opt void** ppvSite) override;\n\n\t// IOleWindow\n\tSTDMETHODIMP GetWindow(__RPC__deref_out_opt HWND* phwnd) override;\n\tSTDMETHODIMP ContextSensitiveHelp(BOOL fEnterMode) override;\n\n\t// IPreviewHandler\n\tSTDMETHODIMP SetWindow( __RPC__in HWND hwnd, __RPC__in const RECT* prc) override;\n\tSTDMETHODIMP SetRect( __RPC__in const RECT* prc ) override;\n\tSTDMETHODIMP DoPreview() override;\n\tSTDMETHODIMP Unload() override;\n\tSTDMETHODIMP SetFocus() override;\n\tSTDMETHODIMP QueryFocus( __RPC__deref_out_opt HWND* phwnd) override;\n\tSTDMETHODIMP TranslateAccelerator(__RPC__in MSG* pmsg) override;\n\n\t// IPreviewHandlerVisuals\n    STDMETHODIMP SetBackgroundColor(COLORREF color) override;\n    STDMETHODIMP SetFont(__RPC__in const LOGFONTW *plf) override;\n    STDMETHODIMP SetTextColor(COLORREF color) override;\n\n\tstatic HRESULT WINAPI UpdateRegistry(_In_ BOOL bRegister) throw();\n\nprivate:\n\tbool PushEvent(eUsdPreviewEvent event, intptr_t data1 = 0, intptr_t data2 = 0);\n\n\tHMODULE m_hUsdPreviewLib = nullptr;\n\tFNUSDPREVIEWPUSHEVENT m_fnUsdPreviewPushEvent = nullptr;\n\tFNUSDPREVIEWGETPREVIEWWINDOW m_fnUsdGetPreviewWindow = nullptr;\n\tCUSDPreviewThread m_PreviewThread;\n\n\tCStringW m_usdStagePath;\n\n\tCComPtr<IUnknown> m_pSite;\n\tCComPtr<IPreviewHandlerFrame> m_pPreviewHandlerFrame;\n\n\tHWND m_hWndParent = nullptr;\n\tRECT m_rcWindow = {};\n\tCPreviewHandlerFrameInfo m_PreviewHandlerFrameInfo;\n\n\tCOLORREF m_clrBackground;\n\tCOLORREF m_clrText;\n};\n\nOBJECT_ENTRY_AUTO(__uuidof(USDPreviewHandler), CUsdPreviewHandlerImpl)\n\n"
  },
  {
    "path": "UsdPreviewHandlerServer/UsdPreviewHandlerImpl.rgs",
    "content": "HKCR\n{\n\tNoRemove CLSID\n\t{\n\t\tForceRemove %CLSID_USDPREVIEWHANDLER% = s 'Activision USD Preview Handler Server'\n\t\t{\n\t\t\tLocalServer32 = s '%MODULE%'\n\t\t\tval AppID = s '%APPID%'\n\t\t}\n\t}\n}\n\n"
  },
  {
    "path": "UsdPreviewHandlerServer/UsdPreviewHandlerPython.py",
    "content": "#  Copyright 2021 Activision Publishing, Inc. \n#\n#  Licensed under the Apache License, Version 2.0 (the \"License\");\n#  you may not use this file except in compliance with the License.\n#  You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n#  Unless required by applicable law or agreed to in writing, software\n#  distributed under the License is distributed on an \"AS IS\" BASIS,\n#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n#  See the License for the specific language governing permissions and\n#  limitations under the License.\n\nfrom __future__ import print_function\nimport sys\nimport os\nimport argparse\nfrom pxr import Usd, UsdUtils, Sdf, UsdAppUtils\nfrom pxr.Usdviewq.stageView import StageView\nfrom pxr.UsdAppUtils.complexityArgs import RefinementComplexities\nimport UsdPreviewHandler\n\ntry:\n    from PySide2.QtCore import *\n    from PySide2.QtGui import *\n    from PySide2.QtWidgets import *\nexcept ImportError:\n    from PySide.QtCore import *\n    from PySide.QtGui import *\n\nclass Widget(QWidget):\n    def __init__(self, stage=None, app=None, previewApp=None):\n        super(Widget, self).__init__()\n\n        self.setStyleSheet(u\"\")\n\n        self.model = StageView.DefaultDataModel()\n\n        \n        self.view = StageView(dataModel=self.model,\n                              printTiming=True)\n\n        self.model.viewSettings.showHUD = False\n\n        self.app = app\n        self.previewApp = previewApp\n\n        self.layout = QVBoxLayout(self)\n        self.layout.addWidget(self.view)\n        self.layout.setContentsMargins(0, 0, 0, 0)\n\n        self.isLoadComplete = False\n\n        if stage:\n            self.setStage(stage)\n\n    def setStage(self, stage):\n        self.model.stage = stage\n\n    def OnComplexity(self, action):\n        self.model.viewSettings.complexity = RefinementComplexities.fromName(action.text())\n\n    def OnShadingMode(self, action):\n        self.model.viewSettings.renderMode = str(action.text())\n\n    def OnToggleDisplayGuide(self, action):\n        self.model.viewSettings.displayGuide = (self.actionDisplay_Guide.isChecked())\n\n    def OnToggleDisplayProxy(self, action):\n        self.model.viewSettings.displayProxy = (self.actionDisplay_Proxy.isChecked())\n\n    def OnToggleDisplayRender(self, action):\n        self.model.viewSettings.displayRender = (self.actionDisplay_Render.isChecked())\n\n    def OnRendererPlugin(self, plugin):\n        if not self.view.SetRendererPlugin(plugin):\n            # If SetRendererPlugin failed, we need to reset the check mark\n            # to whatever the currently loaded renderer is.\n            for action in self.rendererPluginActionGroup.actions():\n                if action.text() == self.view.rendererDisplayName:\n                    action.setChecked(True)\n                    break\n            # Then display an error message to let the user know something\n            # went wrong, and disable the menu item so it can't be selected\n            # again.\n            for action in self.rendererPluginActionGroup.actions():\n                if action.pluginType == plugin:\n                    self.statusMessage(\n                        'Renderer not supported: %s' % action.text())\n                    action.setText(action.text() + \" (unsupported)\")\n                    action.setDisabled(True)\n                    break\n\n    def buildContextMenu_Renderer(self, contextMenu):\n        self.rendererPluginActionGroup = QActionGroup(self)\n        self.rendererPluginActionGroup.setExclusive(True)\n\n        rendererMenu = contextMenu.addMenu(\"Hydra Renderer\")\n\n        pluginTypes = self.view.GetRendererPlugins()\n        for pluginType in pluginTypes:\n            name = self.view.GetRendererDisplayName(pluginType)\n            action = rendererMenu.addAction(name)\n            action.setCheckable(True)\n            action.pluginType = pluginType\n            self.rendererPluginActionGroup.addAction(action)\n\n            action.triggered[bool].connect(lambda _, pluginType=pluginType:\n                    self.OnRendererPlugin(pluginType))\n\n        # Now set the checked box on the current renderer (it should\n        # have been set by now).\n        currentRendererId = self.view.GetCurrentRendererId()\n        foundPlugin = False\n        \n        for action in self.rendererPluginActionGroup.actions():\n            if action.pluginType == currentRendererId:\n                action.setChecked(True)\n                foundPlugin = True\n                break\n\n        # Disable the menu if no plugins were found\n        rendererMenu.setEnabled(foundPlugin)\n\n    def buildContextMenu_Complexity(self, contextMenu):\n        self.actionLow = QAction(\"Low\", self)\n        self.actionLow.setObjectName(u\"actionLow\")\n        self.actionLow.setCheckable(True)\n        self.actionMedium = QAction(\"Medium\", self)\n        self.actionMedium.setCheckable(True)\n        self.actionMedium.setObjectName(u\"actionMedium\")\n        self.actionHigh = QAction(\"High\", self)\n        self.actionHigh.setCheckable(True)\n        self.actionHigh.setObjectName(u\"actionHigh\")\n        self.actionVery_High = QAction(\"Very High\", self)\n        self.actionVery_High.setCheckable(True)\n        self.actionVery_High.setObjectName(u\"actionVery_High\")\n\n        self.complexityGroup = QActionGroup(self)\n        self.complexityGroup.setExclusive(True)\n        self.complexityGroup.addAction(self.actionLow)\n        self.complexityGroup.addAction(self.actionMedium)\n        self.complexityGroup.addAction(self.actionHigh)\n        self.complexityGroup.addAction(self.actionVery_High)\n        self.complexityGroup.triggered.connect(self.OnComplexity)\n\n        self.actionLow.setChecked(True)\n\n        complexityMenu = contextMenu.addMenu(\"Complexity\")\n        complexityMenu.addAction(self.actionLow)\n        complexityMenu.addAction(self.actionMedium)\n        complexityMenu.addAction(self.actionHigh)\n        complexityMenu.addAction(self.actionVery_High)\n\n    def buildContextMenu_ShadingMode(self, contextMenu):\n        self.actionWireframe = QAction(\"Wireframe\", self)\n        self.actionWireframe.setCheckable(True)\n        self.actionWireframeOnSurface = QAction(\"WireframeOnSurface\", self)\n        self.actionWireframeOnSurface.setCheckable(True)\n        self.actionSmooth_Shaded = QAction(\"Smooth Shaded\", self)\n        self.actionSmooth_Shaded.setCheckable(True)\n        self.actionFlat_Shaded = QAction(\"Flat Shaded\", self)\n        self.actionFlat_Shaded.setCheckable(True)\n        self.actionPoints = QAction(\"Points\", self)\n        self.actionPoints.setCheckable(True)\n        self.actionGeom_Only = QAction(\"Geom Only\", self)\n        self.actionGeom_Only.setCheckable(True)\n        self.actionGeom_Smooth = QAction(\"Geom Smooth\", self)\n        self.actionGeom_Smooth.setCheckable(True)\n        self.actionGeom_Flat = QAction(\"Geom Flat\", self)\n        self.actionGeom_Flat.setCheckable(True)\n        self.actionHidden_Surface_Wireframe = QAction(\"Hidden Surface Wireframe\", self)\n        self.actionHidden_Surface_Wireframe.setCheckable(True)\n\n        self.shadingGroup = QActionGroup(self)\n        self.shadingGroup.setExclusive(True)\n        self.shadingGroup.addAction(self.actionWireframe)\n        self.shadingGroup.addAction(self.actionWireframeOnSurface)\n        self.shadingGroup.addAction(self.actionSmooth_Shaded)\n        self.shadingGroup.addAction(self.actionFlat_Shaded)\n        self.shadingGroup.addAction(self.actionPoints)\n        self.shadingGroup.addAction(self.actionGeom_Only)\n        self.shadingGroup.addAction(self.actionGeom_Smooth)\n        self.shadingGroup.addAction(self.actionGeom_Flat)\n        self.shadingGroup.addAction(self.actionHidden_Surface_Wireframe)\n        self.shadingGroup.triggered.connect(self.OnShadingMode)\n\n        self.actionGeom_Smooth.setChecked(True)\n\n        complexityMenu = contextMenu.addMenu(\"Shading Mode\")\n        complexityMenu.addAction(self.actionWireframe)\n        complexityMenu.addAction(self.actionWireframeOnSurface)\n        complexityMenu.addAction(self.actionSmooth_Shaded)\n        complexityMenu.addAction(self.actionFlat_Shaded)        \n        complexityMenu.addAction(self.actionPoints)        \n        complexityMenu.addAction(self.actionGeom_Only)        \n        complexityMenu.addAction(self.actionGeom_Smooth)        \n        complexityMenu.addAction(self.actionGeom_Flat)        \n        complexityMenu.addAction(self.actionHidden_Surface_Wireframe)        \n\n    def buildContextMenu_DisplayPurposes(self, contextMenu):\n        self.actionDisplay_Guide = QAction(\"Guide\", self)\n        self.actionDisplay_Guide.setCheckable(True)\n        self.actionDisplay_Guide.triggered.connect(self.OnToggleDisplayGuide)\n        self.actionDisplay_Guide.setChecked(self.model.viewSettings.displayGuide)\n        self.actionDisplay_Proxy = QAction(\"Proxy\", self)\n        self.actionDisplay_Proxy.setCheckable(True)\n        self.actionDisplay_Proxy.triggered.connect(self.OnToggleDisplayProxy)\n        self.actionDisplay_Proxy.setChecked(self.model.viewSettings.displayProxy)\n        self.actionDisplay_Render = QAction(\"Render\", self)\n        self.actionDisplay_Render.setCheckable(True)\n        self.actionDisplay_Render.triggered.connect(self.OnToggleDisplayRender)\n        self.actionDisplay_Render.setChecked(self.model.viewSettings.displayRender)\n\n        displayPurposesMenu = contextMenu.addMenu(\"Display Purposes\")\n        displayPurposesMenu.addAction(self.actionDisplay_Guide)\n        displayPurposesMenu.addAction(self.actionDisplay_Proxy)\n        displayPurposesMenu.addAction(self.actionDisplay_Render)\n\n    def buildContextMenu(self):\n        self.contextMenu = QMenu(self)\n        self.buildContextMenu_Renderer(self.contextMenu)\n        self.buildContextMenu_Complexity(self.contextMenu)\n        self.buildContextMenu_ShadingMode(self.contextMenu)\n        self.buildContextMenu_DisplayPurposes(self.contextMenu)\n\n                              \n    def closeEvent(self, event):\n        \n        # Ensure to close the renderer to avoid GlfPostPendingGLErrors\n        self.view.closeRenderer()\n\n    def contextMenuEvent(self, event):\n        modifiers = self.app.keyboardModifiers()\n\n        altModifer = ((modifiers & Qt.AltModifier) == Qt.AltModifier)\n        shiftModifer = ((modifiers & Qt.ShiftModifier) == Qt.ShiftModifier)\n        controlModifer = ((modifiers & Qt.ControlModifier) == Qt.ControlModifier)\n\n        if not altModifer and not shiftModifer and not controlModifer:\n            self.contextMenu.exec_(self.mapToGlobal(event.pos()))\n\n    def timerEvent(self, event):\n\n        if (not self.isLoadComplete) and (not self.view._isFirstImage):\n            self.isLoadComplete = True\n            self.previewApp.LoadComplete()\n\n        eventData = self.previewApp.PeekEvent()\n        while eventData.event != UsdPreviewHandler.UsdPreviewEvent.NoMoreEvents:\n            \n            if eventData.event == UsdPreviewHandler.UsdPreviewEvent.Quit:\n                self.app.quit()\n                \n            eventData = self.previewApp.PeekEvent()\n\ndef setStyleSheetUsingState(app, resourceDir):\n    # We use a style file that is actually a template, which we fill\n    # in from state, and is how we change app font sizes, for example.\n\n    # Qt style sheet accepts only forward slashes as path separators\n    resourceDir = resourceDir.replace(\"\\\\\", \"/\")\n\n    fontSize = 10\n    baseFontSizeStr = \"%spt\" % str(fontSize)\n    \n    # The choice of 8 for smallest smallSize is for performance reasons,\n    # based on the \"Gotham Rounded\" font used by usdviewstyle.qss . If we\n    # allow it to float, we get a 2-3 hundred millisecond hit in startup\n    # time as Qt (apparently) manufactures a suitably sized font.  \n    # Mysteriously, we don't see this cost for larger font sizes.\n    smallSize = 8 if fontSize < 12 else int(round(fontSize * 0.8))\n    smallFontSizeStr = \"%spt\" % str(smallSize)\n\n    # Apply the style sheet to it\n    sheet = open(os.path.join(resourceDir, 'usdviewstyle.qss'), 'r')\n    sheetString = sheet.read() % {\n        'RESOURCE_DIR'  : resourceDir,\n        'BASE_FONT_SZ'  : baseFontSizeStr,\n        'SMALL_FONT_SZ' : smallFontSizeStr }\n\n    app.setStyleSheet(sheetString)\n\n        \ndef main():\n    programName = os.path.basename(sys.argv[0])\n    parser = argparse.ArgumentParser(prog=programName,\n        description='Preview for Windows Explorer')\n\n    parser.add_argument('usdFilePath', action='store', type=str,\n        help='USD file to preview')\n\n    parser.add_argument('--hwnd', action='store', type=int,\n        default=0,\n        help='The HWND of the parent window')\n\n    parser.add_argument('--usdviewqDir', action='store', type=str,\n        help='Full path to the usdviewq python folder')\n\n    UsdAppUtils.rendererArgs.AddCmdlineArgs(parser)\n\n    args = parser.parse_args()\n\n    with Usd.StageCacheContext(UsdUtils.StageCache.Get()):\n        stage = Usd.Stage.Open(args.usdFilePath)\n\n    previewApp = UsdPreviewHandler.UsdPreviewApp()\n\n    app = QApplication([])\n\n    setStyleSheetUsingState(app, args.usdviewqDir)\n\n    window = Widget(stage, app, previewApp)\n    window.setWindowFlags( Qt.Popup | Qt.Tool )\n    window.setAttribute( Qt.WA_DontShowOnScreen )\n    window.show()\n\n    # poll for events every so often\n    window.startTimer( 250 )\n\n    try:\n        import ctypes\n        ctypes.pythonapi.PyCObject_AsVoidPtr.restype = ctypes.c_void_p\n        ctypes.pythonapi.PyCObject_AsVoidPtr.argtypes = [ctypes.py_object]\n        previewApp.SetParent( args.hwnd, ctypes.pythonapi.PyCObject_AsVoidPtr(window.effectiveWinId()), ctypes.pythonapi.PyCObject_AsVoidPtr(window.view.effectiveWinId()) )\n    except:\n        previewApp.SetParent( args.hwnd, window.effectiveWinId(), window.view.effectiveWinId() )\n\n    window.setAttribute( Qt.WA_DontShowOnScreen, False )\n\n    # Make camera fit the loaded geometry\n    window.view.updateView(resetCam=True, forceComputeBBox=True)\n\n    # force a draw when hidden\n    window.view.glDraw()\n\n    window.buildContextMenu()\n\n    app.exec_()\n\nif __name__ == \"__main__\":\n    sys.exit(main())"
  },
  {
    "path": "UsdPreviewHandlerServer/UsdPreviewLocalServer.idl",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport \"oaidl.idl\";\nimport \"ocidl.idl\";\nimport \"ShObjIdl.idl\";\n\n[\n\tuuid(68DF0FAC-996B-4933-B092-9733E77061BB),\n\thelpstring(\"USDPreview Type Library\"),\n\tversion(1.0),\n]\nlibrary USDPreview\n{\n\t[\n\t\tuuid(07D4D38F-9C98-48F8-A057-26241405D5C8),\n\t\thelpstring(\"USD IPreviewHandler Server implementation\")\n\t]\n\tcoclass USDPreviewHandler\n\t{\n\t\t[default] interface IPreviewHandler;\n\t}\n};"
  },
  {
    "path": "UsdPreviewHandlerServer/UsdPreviewLocalServer.rc",
    "content": "// Microsoft Visual C++ generated resource script.\n//\n#include \"resource.h\"\n\n#define APSTUDIO_READONLY_SYMBOLS\n/////////////////////////////////////////////////////////////////////////////\n//\n// Generated from the TEXTINCLUDE 2 resource.\n//\n#include \"winres.h\"\n\n/////////////////////////////////////////////////////////////////////////////\n#undef APSTUDIO_READONLY_SYMBOLS\n\n/////////////////////////////////////////////////////////////////////////////\n// English (United States) resources\n\n#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\nLANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US\n#pragma code_page(1252)\n\n#ifdef APSTUDIO_INVOKED\n/////////////////////////////////////////////////////////////////////////////\n//\n// TEXTINCLUDE\n//\n\n1 TEXTINCLUDE \nBEGIN\n    \"resource.h\\0\"\nEND\n\n2 TEXTINCLUDE \nBEGIN\n    \"#include \"\"winres.h\"\"\\r\\n\"\n    \"\\0\"\nEND\n\n3 TEXTINCLUDE \nBEGIN\n    \"1 TYPELIB \"\"USDPreviewLocalServer.tlb\"\"\\r\\n\"\n    \"\\r\\n\"\n    \"#define ATVI_VERSION_DESCRIPTION \"\"Activision USD Preview Server\"\"\\r\\n\"\n    \"#include \"\"atviversion.rc2\"\"\\r\\n\"\n    \"\\0\"\nEND\n\n#endif    // APSTUDIO_INVOKED\n\n\n/////////////////////////////////////////////////////////////////////////////\n//\n// REGISTRY\n//\n\nIDR_REGISTRY_MODULE     REGISTRY                \"USDPreviewLocalServerModule.rgs\"\n\nIDR_REGISTRY_USDPREVIEWHANDLERIMPL REGISTRY                \"USDPreviewHandlerImpl.rgs\"\n\n\n/////////////////////////////////////////////////////////////////////////////\n//\n// Icon\n//\n\n// Icon with lowest ID value placed first to ensure application icon\n// remains consistent on all systems.\nIDI_ICON_USD            ICON                    \"shared\\\\usd.ico\"\n\n\n/////////////////////////////////////////////////////////////////////////////\n//\n// PYTHON\n//\n\nIDR_PYTHON_PREVIEWHANLDER PYTHON                  \"UsdPreviewHandlerPython.py\"\n\n#endif    // English (United States) resources\n/////////////////////////////////////////////////////////////////////////////\n\n\n\n#ifndef APSTUDIO_INVOKED\n/////////////////////////////////////////////////////////////////////////////\n//\n// Generated from the TEXTINCLUDE 3 resource.\n//\n1 TYPELIB \"USDPreviewLocalServer.tlb\"\n\n#define ATVI_VERSION_DESCRIPTION \"Activision USD Preview Server\"\n#include \"atviversion.rc2\"\n\n/////////////////////////////////////////////////////////////////////////////\n#endif    // not APSTUDIO_INVOKED\n\n"
  },
  {
    "path": "UsdPreviewHandlerServer/UsdPreviewLocalServer.vcxproj",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup Label=\"ProjectConfigurations\">\n    <ProjectConfiguration Include=\"Debug|x64\">\n      <Configuration>Debug</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release|x64\">\n      <Configuration>Release</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n  </ItemGroup>\n  <PropertyGroup Label=\"Globals\">\n    <VCProjectVersion>16.0</VCProjectVersion>\n    <Keyword>Win32Proj</Keyword>\n    <ProjectGuid>{279AFA6D-6E35-4798-BA63-8A7E15D11185}</ProjectGuid>\n    <RootNamespace>UsdPreviewLocalServer</RootNamespace>\n    <WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"Configuration\">\n    <ConfigurationType>Application</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v141</PlatformToolset>\n    <WholeProgramOptimization>false</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\" Label=\"Configuration\">\n    <ConfigurationType>Application</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v141</PlatformToolset>\n    <WholeProgramOptimization>false</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n  <Import Project=\"$(SolutionDir)\\atviversion.props\" />\n  <Import Project=\"$(SolutionDir)\\python.props\" />\n  <Import Project=\"$(SolutionDir)\\boost.props\" />\n  <PropertyGroup Label=\"PythonConfiguration\">\n    <RegistryView>RegistryView.Registry32</RegistryView>\n    <RegistryView Condition=\"$(Platform) == 'x64'\">RegistryView.Registry64</RegistryView>\n    <PythonTag>$(PythonVersion)-32</PythonTag>\n    <PythonTag Condition=\"$(Platform) == 'x64'\">$(PythonVersion)</PythonTag>\n    <PythonHome Condition=\"$(PythonHome) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstallPath', null, null, $(RegistryView)))</PythonHome>\n    <PythonHome Condition=\"$(PythonHome) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstallPath', null, null, $(RegistryView)))</PythonHome>\n    <PythonExe Condition=\"$(PythonExe) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstallPath', 'ExecutablePath', null, $(RegistryView)))</PythonExe>\n    <PythonExe Condition=\"$(PythonExe) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstallPath', 'ExecutablePath', null, $(RegistryView)))</PythonExe>\n    <PythonExe Condition=\"$(PythonExe) == '' and $(PythonHome) != ''\">$(PythonHome)python.exe</PythonExe>\n    <PythonDevVersion>$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstalledFeatures', 'dev', null, $(RegistryView)))</PythonDevVersion>\n    <PythonDevVersion Condition=\"$(PythonDevVersion) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstalledFeatures', 'dev', null, $(RegistryView)))</PythonDevVersion>\n    <PythonCorePDBVersion>$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstalledFeatures', 'core_pdb', null, $(RegistryView)))</PythonCorePDBVersion>\n    <PythonCorePDBVersion Condition=\"$(PythonCorePDBVersion) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstalledFeatures', 'core_pdb', null, $(RegistryView)))</PythonCorePDBVersion>\n    <PythonCoreDVersion>$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstalledFeatures', 'core_d', null, $(RegistryView)))</PythonCoreDVersion>\n    <PythonCoreDVersion Condition=\"$(PythonCoreDVersion) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstalledFeatures', 'core_d', null, $(RegistryView)))</PythonCoreDVersion>\n    <PythonDebugSuffix Condition=\"$(PythonCoreDVersion) != ''\">_d</PythonDebugSuffix>\n    <PythonDExe Condition=\"$(PythonExe) != '' and $(PythonDExe) == ''\">$([System.IO.Path]::GetDirectoryName($(PythonExe)))\\python$(PythonDebugSuffix).exe</PythonDExe>\n    <PythonDExe Condition=\"!Exists($(PythonDExe))\">$(PythonExe)</PythonDExe>\n  </PropertyGroup>\n  <ImportGroup Label=\"ExtensionSettings\">\n  </ImportGroup>\n  <ImportGroup Label=\"Shared\">\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <PropertyGroup Label=\"UserMacros\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)bin\\$(PlatformToolset)\\$(PythonTag)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)build\\$(PlatformToolset)\\$(PythonTag)\\$(Configuration)\\$(ProjectName)\\</IntDir>\n    <IgnoreImportLibrary>true</IgnoreImportLibrary>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)bin\\$(PlatformToolset)\\$(PythonTag)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)build\\$(PlatformToolset)\\$(PythonTag)\\$(Configuration)\\$(ProjectName)\\</IntDir>\n    <IgnoreImportLibrary>true</IgnoreImportLibrary>\n  </PropertyGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <SDLCheck>true</SDLCheck>\n      <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <ConformanceMode>true</ConformanceMode>\n    </ClCompile>\n    <Link>\n      <SubSystem>Console</SubSystem>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <SDLCheck>true</SDLCheck>\n      <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <ConformanceMode>true</ConformanceMode>\n    </ClCompile>\n    <Link>\n      <SubSystem>Console</SubSystem>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <ClCompile>\n      <WarningLevel>Level4</WarningLevel>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <SDLCheck>true</SDLCheck>\n      <PreprocessorDefinitions>_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <ConformanceMode>false</ConformanceMode>\n      <PrecompiledHeader>Use</PrecompiledHeader>\n      <InlineFunctionExpansion>Disabled</InlineFunctionExpansion>\n      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n      <AdditionalIncludeDirectories>$(SolutionDir);$(PythonHome)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <Optimization>Disabled</Optimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <EnableCOMDATFolding>false</EnableCOMDATFolding>\n      <OptimizeReferences>false</OptimizeReferences>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(PythonHome)libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>Pathcch.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <DelayLoadDLLs>\n      </DelayLoadDLLs>\n    </Link>\n    <ResourceCompile>\n      <AdditionalIncludeDirectories>$(OutDir);$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n    </ResourceCompile>\n    <Midl>\n      <InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>\n      <MkTypLibCompatible>false</MkTypLibCompatible>\n      <ValidateAllParameters>true</ValidateAllParameters>\n      <WarningLevel>0</WarningLevel>\n      <EnableErrorChecks>All</EnableErrorChecks>\n      <TypeLibraryName>$(OutDir)$(ProjectName).tlb</TypeLibraryName>\n    </Midl>\n    <PostBuildEvent>\n      <Command>%(Command)\n</Command>\n    </PostBuildEvent>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\n    <ClCompile>\n      <WarningLevel>Level4</WarningLevel>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <SDLCheck>true</SDLCheck>\n      <PreprocessorDefinitions>_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <ConformanceMode>false</ConformanceMode>\n      <PrecompiledHeader>Use</PrecompiledHeader>\n      <AdditionalIncludeDirectories>$(SolutionDir);$(PythonHome)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <Optimization>MaxSpeed</Optimization>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <EnableCOMDATFolding>false</EnableCOMDATFolding>\n      <OptimizeReferences>false</OptimizeReferences>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(PythonHome)libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>Pathcch.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <DelayLoadDLLs>\n      </DelayLoadDLLs>\n    </Link>\n    <ResourceCompile>\n      <AdditionalIncludeDirectories>$(OutDir);$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n    </ResourceCompile>\n    <Midl>\n      <InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>\n      <MkTypLibCompatible>false</MkTypLibCompatible>\n      <ValidateAllParameters>true</ValidateAllParameters>\n      <WarningLevel>0</WarningLevel>\n      <EnableErrorChecks>All</EnableErrorChecks>\n      <TypeLibraryName>$(OutDir)$(ProjectName).tlb</TypeLibraryName>\n    </Midl>\n    <PostBuildEvent>\n      <Command>%(Command)\n</Command>\n    </PostBuildEvent>\n  </ItemDefinitionGroup>\n  <ItemGroup>\n    <ClInclude Include=\"..\\shared\\emb.h\" />\n    <ClInclude Include=\"..\\shared\\environment.h\" />\n    <ClInclude Include=\"..\\shared\\EventViewerLog.h\" />\n    <ClInclude Include=\"..\\shared\\PythonUtil.h\" />\n    <ClInclude Include=\"resource.h\" />\n    <ClInclude Include=\"stdafx.h\" />\n    <ClInclude Include=\"UsdPreviewHandlerImpl.h\" />\n    <ClInclude Include=\"Module.h\" />\n    <ClInclude Include=\"UsdPreviewLocalServer_h.h\" />\n    <ClInclude Include=\"UsdPreviewThread.h\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"..\\shared\\emb.cpp\" />\n    <ClCompile Include=\"..\\shared\\environment.cpp\" />\n    <ClCompile Include=\"stdafx.cpp\">\n      <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">Create</PrecompiledHeader>\n      <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">Create</PrecompiledHeader>\n    </ClCompile>\n    <ClCompile Include=\"UsdPreviewHandlerImpl.cpp\" />\n    <ClCompile Include=\"Module.cpp\" />\n    <ClCompile Include=\"UsdPreviewLocalServer_i.c\">\n      <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">NotUsing</PrecompiledHeader>\n      <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">NotUsing</PrecompiledHeader>\n    </ClCompile>\n    <ClCompile Include=\"UsdPreviewThread.cpp\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Midl Include=\"UsdPreviewLocalServer.idl\">\n      <EnableErrorChecks>All</EnableErrorChecks>\n      <ValidateAllParameters>true</ValidateAllParameters>\n    </Midl>\n  </ItemGroup>\n  <ItemGroup>\n    <ResourceCompile Include=\"UsdPreviewLocalServer.rc\" />\n  </ItemGroup>\n  <ItemGroup>\n    <None Include=\"..\\python.props\" />\n    <None Include=\"UsdPreviewHandlerImpl.rgs\" />\n    <None Include=\"UsdPreviewHandlerPython.py\" />\n    <None Include=\"UsdPreviewLocalServerModule.rgs\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Image Include=\"..\\shared\\usd.ico\" />\n    <Image Include=\"shared\\usd.ico\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"..\\shared\\EventViewerMessages.vcxproj\">\n      <Project>{f12e597b-b731-4f5a-bec3-980d20159320}</Project>\n    </ProjectReference>\n  </ItemGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\n  <ImportGroup Label=\"ExtensionTargets\">\n  </ImportGroup>\n</Project>"
  },
  {
    "path": "UsdPreviewHandlerServer/UsdPreviewLocalServer.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup>\n    <Filter Include=\"Source Files\">\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\n      <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\n    </Filter>\n    <Filter Include=\"Header Files\">\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\n      <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>\n    </Filter>\n    <Filter Include=\"Resource Files\">\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\n    </Filter>\n    <Filter Include=\"Shared\">\n      <UniqueIdentifier>{31617a27-1920-4188-aada-071adaa53b76}</UniqueIdentifier>\n    </Filter>\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"stdafx.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"resource.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"Module.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"UsdPreviewLocalServer_h.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"UsdPreviewThread.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"UsdPreviewHandlerImpl.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"..\\shared\\emb.h\">\n      <Filter>Shared</Filter>\n    </ClInclude>\n    <ClInclude Include=\"..\\shared\\environment.h\">\n      <Filter>Shared</Filter>\n    </ClInclude>\n    <ClInclude Include=\"..\\shared\\EventViewerLog.h\">\n      <Filter>Shared</Filter>\n    </ClInclude>\n    <ClInclude Include=\"..\\shared\\PythonUtil.h\">\n      <Filter>Shared</Filter>\n    </ClInclude>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"stdafx.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"Module.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"UsdPreviewLocalServer_i.c\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"UsdPreviewThread.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"UsdPreviewHandlerImpl.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"..\\shared\\emb.cpp\">\n      <Filter>Shared</Filter>\n    </ClCompile>\n    <ClCompile Include=\"..\\shared\\environment.cpp\">\n      <Filter>Shared</Filter>\n    </ClCompile>\n  </ItemGroup>\n  <ItemGroup>\n    <None Include=\"UsdPreviewLocalServerModule.rgs\">\n      <Filter>Resource Files</Filter>\n    </None>\n    <None Include=\"UsdPreviewHandlerImpl.rgs\">\n      <Filter>Resource Files</Filter>\n    </None>\n    <None Include=\"UsdPreviewHandlerPython.py\" />\n    <None Include=\"..\\python.props\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Midl Include=\"UsdPreviewLocalServer.idl\">\n      <Filter>Source Files</Filter>\n    </Midl>\n  </ItemGroup>\n  <ItemGroup>\n    <ResourceCompile Include=\"UsdPreviewLocalServer.rc\">\n      <Filter>Resource Files</Filter>\n    </ResourceCompile>\n  </ItemGroup>\n  <ItemGroup>\n    <Image Include=\"..\\shared\\usd.ico\">\n      <Filter>Shared</Filter>\n    </Image>\n    <Image Include=\"shared\\usd.ico\">\n      <Filter>Resource Files</Filter>\n    </Image>\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "UsdPreviewHandlerServer/UsdPreviewLocalServerModule.rgs",
    "content": "HKCU\n{\n\tNoRemove AppID\n\t{\n\t\t'%APPID%' = s 'USDPreviewLocalServer'\n\t\t'USDPreviewLocalServer.exe'\n\t\t{\n\t\t\tval AppID = s '%APPID%'\n\t\t}\n\t}\n}\n\n"
  },
  {
    "path": "UsdPreviewHandlerServer/UsdPreviewThread.cpp",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include \"stdafx.h\"\n#include \"USDPreviewThread.h\"\n#include \"Module.h\"\n#include \"shared\\PythonUtil.h\"\n#include \"shared\\emb.h\"\n#include \"shared\\environment.h\"\n#include \"shared\\EventViewerLog.h\"\n\nCUSDPreviewThread::~CUSDPreviewThread()\n{\n\tTerm();\n}\n\nbool CUSDPreviewThread::Init()\n{\n\treturn true;\n}\n\nvoid CUSDPreviewThread::Term()\n{\n\tWaitForExit();\n}\n\nstatic bool GetRendererFromConfig( LPCTSTR system, CStringW &out )\n{\n\tstd::vector<CStringW> ConfigFileList = BuildConfigFileList( g_hInstance );\n\n\tCStringW sRenderer;\n\tGetPrivateProfileStringAndExpandEnvironmentStrings( L\"RENDERER\", system, L\"GL\", sRenderer, ConfigFileList );\n\n\tif ( sRenderer.IsEmpty() )\n\t\treturn false;\n\n\tout = sRenderer;\n\n\treturn true;\n}\n\nHRESULT CUSDPreviewThread::LaunchPreviewWindow( HWND hWndParent, LPCTSTR pPathToUsdStage )\n{\n\tm_hParent = hWndParent;\n\tm_sPathToUsdStage = pPathToUsdStage;\n\n\tm_hThread = ::CreateThread( nullptr, 0, ThreadProc, this, 0, nullptr );\n\tif ( m_hThread == nullptr )\n\t\treturn false;\n\n\treturn S_OK;\n}\n\nvoid CUSDPreviewThread::WaitForExit()\n{\n\tif ( m_hThread == nullptr )\n\t\treturn;\n\n\tif ( ::WaitForSingleObject( m_hThread, 1000 ) == WAIT_TIMEOUT )\n\t{\n\t\tTerminateThread( m_hThread, (DWORD)-1 );\n\t}\n\n\tm_hThread = nullptr;\n}\n\nstatic CStringW LocateUsdviewq()\n{\n\tconst std::vector<CString> &PathList = GetUsdPythonPathList();\n\n\tfor ( const CString &sDir : PathList )\n\t{\n\t\tTCHAR sFilePath[512];\n\t\t_tcscpy_s( sFilePath, sDir.GetString() );\n\n\t\t::PathCchAppend( sFilePath, ARRAYSIZE( sFilePath ), _T(\"pxr\\\\Usdviewq\") );\n\n\t\tDWORD nAttribs = ::GetFileAttributes( sFilePath );\n\t\tif ( (nAttribs != INVALID_FILE_ATTRIBUTES) && (nAttribs & FILE_ATTRIBUTE_DIRECTORY) )\n\t\t\treturn sFilePath;\n\t}\n\n\treturn L\"\";\n}\n\n\nDWORD WINAPI CUSDPreviewThread::ThreadProc( _In_ LPVOID lpParameter )\n{\n\tCUSDPreviewThread *pThis = reinterpret_cast<CUSDPreviewThread *>(lpParameter);\n\n\tTPyChar sPathToHostExe[MAX_PATH];\n#if PY_MAJOR_VERSION >= 3\n\t::GetModuleFileNameW(nullptr, sPathToHostExe, ARRAYSIZE(sPathToHostExe));\n#else\n\t::GetModuleFileNameA(nullptr, sPathToHostExe, ARRAYSIZE(sPathToHostExe));\n#endif\n\n\tPy_SetProgramName(sPathToHostExe);\n\n    PyImport_AppendInittab(\"emb\", emb::PyInit_emb);\n\tCPyInterpreter pyInterpreter;\n    PyImport_ImportModule(\"emb\");\n\n\tCStringW shWndParent;\n\tshWndParent.Format(L\"%d\", pThis->m_hParent);\n\n\tCStringW sRenderer;\n\tGetRendererFromConfig( _T( \"PREVIEW\" ), sRenderer );\n\n\tCStringW sUsdViewqFolder;\n\tsUsdViewqFolder = LocateUsdviewq();\n\n\t// UsdStageView initializes the renderer from this environment variable\n\t_tputenv_s( _T(\"HD_DEFAULT_RENDERER\"), sRenderer );\n\n\tstd::vector<const TPyChar *> ArgV;\n\tArgV.push_back( sPathToHostExe );\n\tArgV.push_back( _Tpy( \"--hwnd\" ) );\n\tCW2Py pyhWndParent( shWndParent );\n\tArgV.push_back( pyhWndParent );\n\tArgV.push_back( _Tpy( \"--usdviewqDir\" ) );\n\tCW2Py pyUsdViewqFolder( sUsdViewqFolder );\n\tArgV.push_back( pyUsdViewqFolder );\n\tCW2Py pyPathToUsdStage( pThis->m_sPathToUsdStage );\n\tArgV.push_back( pyPathToUsdStage );\n\n\tPyAppendSysPath( GetUsdPythonPathList() );\n\tPySetEnvironmentVariable( L\"PATH\", GetUsdPath() );\n\tPySetEnvironmentVariable( L\"PYTHONPATH\", GetUsdPythonPath() );\n\n\tPySys_SetArgvEx( static_cast<int>(ArgV.size()), const_cast<TPyChar**>(&ArgV[0]), 1 );\n\n\tHRSRC hrscPy = ::FindResource( g_hInstance, MAKEINTRESOURCE( IDR_PYTHON_PREVIEWHANLDER ), _T(\"PYTHON\") );\n\tif ( hrscPy == nullptr )\n\t\treturn static_cast<DWORD>(-1);\n\n\tHGLOBAL hPy = ::LoadResource( g_hInstance, hrscPy );\n\tif ( hPy == nullptr )\n\t\treturn static_cast<DWORD>(-1);\n\n\tvoid* pScriptData = ::LockResource( hPy );\n\tif ( pScriptData == nullptr )\n\t\treturn static_cast<DWORD>(-1);\n\n\tDWORD nSize = SizeofResource( g_hInstance, hrscPy );\n\n\tCStringA pyScript;\n\tpyScript.SetString( reinterpret_cast<LPCSTR>(pScriptData), nSize );\n\n    PyObject* pMainModule = PyImport_AddModule(\"__main__\");\n    PyObject* pGlobalDict = PyModule_GetDict(pMainModule);\n\n    std::string buffer;\n    emb::stdout_write_type writeStdOut = [&buffer] (std::string s) { buffer += s; };\n    emb::set_stdout(writeStdOut);\n    emb::stdout_write_type writeStdErr = [&buffer] (std::string s) { buffer += s; };\n    emb::set_stderr(writeStdErr);\n\n\tCPyObject result = CPyObject( PyRun_String( pyScript.GetString(), Py_file_input, pGlobalDict, pGlobalDict ) );\n\n\temb::reset_stdout();\n\temb::reset_stderr();\n\n\tint exitCode = 0;\n\tif ( PyErr_Occurred() )\n\t{\n\t\tCPyException e;\n        if ( !e.IsExceptionSystemExit() )\n        {\n\t\t\tCString sErrorMsg = e.tracebackW();\n\t\t\tif ( !buffer.empty() )\n\t\t\t\tsErrorMsg.AppendFormat( _T( \"\\n\\n[STDOUT]\\n%hs\" ), buffer.c_str() );\n\n\t\t\tif ( sErrorMsg.IsEmpty() )\n\t\t\t{\n\t\t\t\tsErrorMsg = e.typeW();\n\t\t\t}\n\n\t\t\tLogEventMessage( PREVIEWHANDLER_CATEGORY, sErrorMsg.GetString(), LogEventType::Error );\n\n            return static_cast<DWORD>(-1);\n        }\n\t\telse\n\t\t{\n\t\t\tPySystemExitObject* pSystemExitObject = reinterpret_cast<PySystemExitObject*>(e.GetValue());\n\t\t\tif ( pSystemExitObject && pSystemExitObject->code )\n\t\t\t{\n\t\t\t\tif ( PyLong_Check( pSystemExitObject->code ) )\n\t\t\t\t{\n\t\t\t\t\texitCode = PyLong_AsLong( pSystemExitObject->code );\n\t\t\t\t}\n\t\t\t\telse if ( PyUnicode_Check( pSystemExitObject->code ) )\n\t\t\t\t{\n\t\t\t\t\t// unexpected\n\t\t\t\t\tbuffer += e.what();\n\t\t\t\t\texitCode = -1;\n\t\t\t\t\tLogEventMessage( PREVIEWHANDLER_CATEGORY, e.whatW(), LogEventType::Error );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn exitCode;\n}\n\n"
  },
  {
    "path": "UsdPreviewHandlerServer/UsdPreviewThread.h",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#pragma once\n\nclass CUSDPreviewThread\n{\npublic:\n\t~CUSDPreviewThread();\n\n\tbool Init();\n\tvoid Term();\n\n\tHRESULT LaunchPreviewWindow(HWND hWndParent, LPCTSTR pPathToUsdStage);\n\n\tvoid WaitForExit();\n\n\tbool IsValid() const;\n\nprivate:\n\tstatic DWORD WINAPI ThreadProc( _In_ LPVOID lpParameter );\n\n\tHANDLE m_hThread = nullptr;\n\tHWND m_hParent = 0;\n\tCString m_sPathToUsdStage;\n};\n\ninline bool CUSDPreviewThread::IsValid() const\n{\n\treturn m_hThread != nullptr;\n}"
  },
  {
    "path": "UsdPreviewHandlerServer/resource.h",
    "content": "//{{NO_DEPENDENCIES}}\n// Microsoft Visual C++ generated include file.\n// Used by UsdPreviewLocalServer.rc\n//\n#define IDR_REGISTRY_MODULE             101\n#define IDR_REGISTRY_USDPREVIEWIMPL     102\n#define IDR_REGISTRY_PREVIEWHANDLERIMPL 105\n#define IDR_REGISTRY_USDPREVIEWHANDLERIMPL 105\n#define IDI_ICONUSD                     106\n#define IDI_ICON_USD                    106\n#define IDR_PYTHON_PREVIEWHANLDER       107\n#define IDR_REGISTRY_THUMBNAILIMPL      108\n#define IDR_REGISTRY_USDTHUMBNAILIMPL   108\n\n// Next default values for new objects\n// \n#ifdef APSTUDIO_INVOKED\n#ifndef APSTUDIO_READONLY_SYMBOLS\n#define _APS_NEXT_RESOURCE_VALUE        109\n#define _APS_NEXT_COMMAND_VALUE         40001\n#define _APS_NEXT_CONTROL_VALUE         1004\n#define _APS_NEXT_SYMED_VALUE           101\n#endif\n#endif\n"
  },
  {
    "path": "UsdPreviewHandlerServer/stdafx.cpp",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include \"stdafx.h\""
  },
  {
    "path": "UsdPreviewHandlerServer/stdafx.h",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#pragma once\n\n#ifndef STRICT\n#define STRICT\n#endif\n\n#pragma warning(push)\n#pragma warning(disable: 4244 4459)\n\n#include <boost/python/module.hpp>\n#include <boost/python/def.hpp>\n#include <boost/python/list.hpp>\n#include <boost/python.hpp>\n\n#pragma warning(pop)\n\n#include <WinSDKVer.h>\n#define _WIN32_WINNT 0x0A00\n#include <SDKDDKVer.h>\n\n#define _ATL_APARTMENT_THREADED\n#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS\t// some CString constructors will be explicit\n#define ATL_NO_ASSERT_ON_DESTROY_NONEXISTENT_WINDOW\n// Use the C++ standard templated min/max\n#define NOMINMAX\n#define NOBITMAP\n// Include <mcx.h> if you need this\n#define NOMCX\n// Include <winsvc.h> if you need this\n#define NOSERVICE\n\n#include <windows.h>\n#include <PathCch.h>\n\n#include <atlbase.h>\n#include <atlcom.h>\n#include <atlconv.h>\n#include <atlctl.h>\n#include <atlstr.h>\n#include <atlsafe.h>\n#include <comutil.h>\n\n#include <stdint.h>\n\n"
  },
  {
    "path": "UsdPythonToolsServer/Module.cpp",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include \"stdafx.h\"\n#include \"Module.h\"\n\nHMODULE g_hInstance;\nCUsdPythonToolsLocalServerModule g_AtlModule;\nCString g_DebugIUsdPythonToolsMethod;\n\nextern \"C\" int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nShowCmd)\n{\n\tUNREFERENCED_PARAMETER( hPrevInstance );\n\tUNREFERENCED_PARAMETER( lpCmdLine );\n\tUNREFERENCED_PARAMETER( nShowCmd );\n\n\tg_hInstance = hInstance;\n\n\tint nResult = g_AtlModule.WinMain( nShowCmd );\n\n\treturn nResult;\n}\n"
  },
  {
    "path": "UsdPythonToolsServer/Module.h",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#pragma once\n\n#include \"UsdPythonToolsLocalServer_h.h\"\n#include \"resource.h\"\n\n// Using an ATL module here because it removes a lot of the \n// boiler-plate COM work that we would have to implement ourselves.\n\nclass CUsdPythonToolsLocalServerModule : public CAtlExeModuleT<CUsdPythonToolsLocalServerModule>\n{\npublic:\n\tDECLARE_LIBID( LIBID_UsdPythonToolsLib )\n\tDECLARE_REGISTRY_APPID_RESOURCEID( IDR_REGISTRY_MODULE, \"{8777F2C4-2318-408A-85D8-F65E15811971}\" )\n\n\t// Override CAtlExeModuleT::PreMessageLoop to change REGCLS_MULTIPLEUSE to REGCLS_SINGLEUSE.\n\t// REGCLS_SINGLEUSE will create a new Windows process for every instance of our COM classes, \n\t// REGCLS_MULTIPLEUSE will reuse the same Windows process.\n\tHRESULT PreMessageLoop( _In_ int /*nShowCmd*/ ) throw()\n\t{\n\t\tHRESULT hr = S_OK;\n\t\tCUsdPythonToolsLocalServerModule* pT = static_cast<CUsdPythonToolsLocalServerModule*>(this);\n\n#ifndef _ATL_NO_COM_SUPPORT\n\t\thr = pT->RegisterClassObjects(CLSCTX_LOCAL_SERVER,\n\t\t\tREGCLS_SINGLEUSE | // <- !!!\n\t\t\tREGCLS_SUSPENDED);\n\n\t\tif (FAILED(hr))\n\t\t\treturn hr;\n\n\t\tif (hr == S_OK)\n\t\t{\n\t\t\tif (m_bDelayShutdown)\n\t\t\t{\n\t\t\t\tCHandle h(pT->StartMonitor());\n\t\t\t\tif (h.m_h == NULL)\n\t\t\t\t{\n\t\t\t\t\thr = E_FAIL;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\thr = CoResumeClassObjects();\n\t\t\t\t\tATLASSERT(SUCCEEDED(hr));\n\t\t\t\t\tif (FAILED(hr))\n\t\t\t\t\t{\n\t\t\t\t\t\t::SetEvent(m_hEventShutdown); // tell monitor to shutdown\n\t\t\t\t\t\t::WaitForSingleObject(h, m_dwTimeOut * 2);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\thr = CoResumeClassObjects();\n\t\t\t\tATLASSERT(SUCCEEDED(hr));\n\t\t\t}\n\n\t\t\tif (FAILED(hr))\n\t\t\t\tpT->RevokeClassObjects();\n\t\t}\n\t\telse\n\t\t{\n\t\t\tm_bDelayShutdown = false;\n\t\t}\n\n#endif\t// _ATL_NO_COM_SUPPORT\n\n\t\tATLASSERT(SUCCEEDED(hr));\n\t\treturn hr;\n\t}\n};\n\nextern CUsdPythonToolsLocalServerModule g_AtlModule;\nextern HMODULE g_hInstance;\n// Helpful for debugging zombie processes.\n// Set to the last method that was called in IUSDTools\nextern CString g_DebugIUsdPythonToolsMethod;\n\n#define DEBUG_RECORD_ENTRY() \\\n\tg_DebugIUsdPythonToolsMethod = _T(__FUNCTION__)\n"
  },
  {
    "path": "UsdPythonToolsServer/UsdPythonToolsImpl.cpp",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include \"stdafx.h\"\n#include \"UsdPythonToolsImpl.h\"\n#include \"Module.h\"\n#include \"shared\\PythonUtil.h\"\n#include \"shared\\emb.h\"\n#include \"shared\\environment.h\"\n#include \"shared\\EventViewerLog.h\"\n#include \"UsdPythonToolsLocalServer_h.h\"\n\n#include <vector>\n\n\nHRESULT CUsdPythonToolsImpl::FinalConstruct()\n{\n\tSetupPythonEnvironment( g_hInstance );\n\n\treturn __super::FinalConstruct();\n}\n\nvoid CUsdPythonToolsImpl::FinalRelease()\n{\n\t__super::FinalRelease();\n}\n\nstatic std::wstring FindRelativeFile(LPCWSTR sToolFileName)\n{\n\tconst std::vector<CString> &PathList = GetUsdPathList();\n\n\tfor ( const CString &sDir : PathList )\n\t{\n\t\tTCHAR sFilePath[512];\n\t\t_tcscpy_s( sFilePath, sDir.GetString() );\n\n\t\t::PathCchAppend( sFilePath, ARRAYSIZE( sFilePath ), sToolFileName );\n\n\t\tDWORD nAttribs = ::GetFileAttributes( sFilePath );\n\t\tif ( (nAttribs != INVALID_FILE_ATTRIBUTES) && !(nAttribs & FILE_ATTRIBUTE_DIRECTORY) )\n\t\t\treturn sFilePath;\n\t}\n\n\treturn L\"\";\n}\n\nstatic FILE *OpenRelativeFile(LPCWSTR sToolFileName, std::wstring& sOutFilePath)\n{\n\tsOutFilePath = FindRelativeFile( sToolFileName );\n\n\tFILE *fp = _wfsopen( sOutFilePath.c_str(), L\"rb\", _SH_SECURE );\n\tif ( fp == nullptr )\n\t\treturn nullptr;\n\n\treturn fp;\n}\n\nstatic HRESULT RunDiskPythonScript( LPCWSTR sToolFileName, std::vector<const TPyChar *> &ArgV, std::string &sStdOut, int& exitCode )\n{\n\texitCode = 0;\n\n\tstd::wstring sFilePath;\n\tFILE *fp = OpenRelativeFile( sToolFileName, sFilePath );\n\tif (fp == nullptr)\n\t\treturn E_FAIL;\n\n\tfseek( fp, 0, SEEK_END );\n\tint sizeOfFile = ftell( fp );\n\tfseek( fp, 0, SEEK_SET );\n\n\tCStringA pyScript;\n\tLPSTR pScriptData = pyScript.GetBufferSetLength( sizeOfFile );\n\tfread( pScriptData, 1, sizeOfFile, fp );\n\tpyScript.ReleaseBuffer( sizeOfFile );\n\n\tfclose( fp );\n\tfp = nullptr;\n\n    PyImport_AppendInittab(\"emb\", emb::PyInit_emb);\n\tCPyInterpreter pyInterpreter;\n    PyImport_ImportModule(\"emb\");\n\n    emb::stdout_write_type writeStdOut = [&sStdOut] (std::string s) { sStdOut += s; };\n    emb::set_stdout(writeStdOut);\n    emb::stdout_write_type writeStdErr = [&sStdOut] (std::string s) { sStdOut += s; };\n    emb::set_stderr(writeStdErr);\n\n\tPyAppendSysPath( GetUsdPythonPathList() );\n\tPySetEnvironmentVariable( L\"PATH\", GetUsdPath() );\n\tPySetEnvironmentVariable( L\"PYTHONPATH\", GetUsdPythonPath() );\n\n\tPySys_SetArgvEx( static_cast<int>(ArgV.size()), const_cast<TPyChar**>(&ArgV[0]), 1 );\n\n\tPyObject* pMainModule = PyImport_AddModule(\"__main__\");\n    PyObject* pGlobalDict = PyModule_GetDict(pMainModule);\n\n\tCPyObject result = CPyObject( PyRun_String( pyScript.GetString(), Py_file_input, pGlobalDict, pGlobalDict ) );\n\n\tHRESULT hr = S_OK;\n\tif ( PyErr_Occurred() )\n\t{\n\t\tCPyException e;\n        if ( !e.IsExceptionSystemExit() )\n        {\n\t\t\tCString sErrorMsg = e.tracebackW();\n\t\t\tif ( sErrorMsg.IsEmpty() )\n\t\t\t\tsErrorMsg.Format( _T( \"[Error]\\n%hs\" ), e.what() );\n\n\t\t\tif ( !sStdOut.empty() )\n\t\t\t\tsErrorMsg.AppendFormat( _T( \"\\n\\n[STDOUT]\\n%hs\" ), sStdOut.c_str() );\n\n\t\t\tLogEventMessage( PYTHONTOOLS_CATEGORY, sErrorMsg.GetString(), LogEventType::Error );\n\n            hr = E_FAIL;\n        }\n\t\telse\n\t\t{\n\t\t\tPySystemExitObject* pSystemExitObject = reinterpret_cast<PySystemExitObject*>(e.GetValue());\n\t\t\tif ( pSystemExitObject && pSystemExitObject->code )\n\t\t\t{\n\t\t\t\tif ( PyLong_Check( pSystemExitObject->code ) )\n\t\t\t\t{\n\t\t\t\t\texitCode = PyLong_AsLong( pSystemExitObject->code );\n\t\t\t\t}\n\t\t\t\telse if ( PyUnicode_Check( pSystemExitObject->code ) )\n\t\t\t\t{\n\t\t\t\t\t// unexpected\n\t\t\t\t\tsStdOut += e.what();\n\t\t\t\t\texitCode = -1;\n\t\t\t\t\tLogEventMessage( PYTHONTOOLS_CATEGORY, e.whatW(), LogEventType::Error );\n\t\t\t\t\thr = E_FAIL;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n    emb::reset_stdout();\n\temb::reset_stderr();\n\n\treturn hr;\n}\n\nstatic HRESULT RunResourcePythonScript( UINT nResourceId, std::vector<const TPyChar *> &ArgV, std::string &sStdOut, int& exitCode )\n{\n\texitCode = 0;\n\n\tHRSRC hrscPy = ::FindResource( g_hInstance, MAKEINTRESOURCE( nResourceId ), _T(\"PYTHON\") );\n\tif ( hrscPy == nullptr )\n\t\treturn E_FAIL;\n\n\tHGLOBAL hPy = ::LoadResource( g_hInstance, hrscPy );\n\tif ( hPy == nullptr )\n\t\treturn E_FAIL;\n\n\tvoid* pScriptData = ::LockResource( hPy );\n\tif ( pScriptData == nullptr )\n\t\treturn E_FAIL;\n\n\tDWORD nSize = SizeofResource( g_hInstance, hrscPy );\n\n\tCStringA pyScript;\n\tpyScript.SetString( reinterpret_cast<LPCSTR>(pScriptData), nSize );\n\n\tPyImport_AppendInittab(\"emb\", emb::PyInit_emb);\n\tCPyInterpreter pyInterpreter;\n    PyImport_ImportModule(\"emb\");\n\n    emb::stdout_write_type writeStdOut = [&sStdOut] (std::string s) { sStdOut += s; };\n    emb::set_stdout(writeStdOut);\n    emb::stdout_write_type writeStdErr = [&sStdOut] (std::string s) { sStdOut += s; };\n    emb::set_stderr(writeStdErr);\n\n\tPyAppendSysPath( GetUsdPythonPathList() );\n\tPySetEnvironmentVariable( L\"PATH\", GetUsdPath() );\n\tPySetEnvironmentVariable( L\"PYTHONPATH\", GetUsdPythonPath() );\n\n\tPySys_SetArgvEx( static_cast<int>(ArgV.size()), const_cast<TPyChar**>(&ArgV[0]), 1 );\n\n\tPyObject* pMainModule = PyImport_AddModule(\"__main__\");\n    PyObject* pGlobalDict = PyModule_GetDict(pMainModule);\n\n\tCPyObject result = CPyObject( PyRun_String( pyScript.GetString(), Py_file_input, pGlobalDict, pGlobalDict ) );\n\n\tHRESULT hr = S_OK;\n\tif ( PyErr_Occurred() )\n\t{\n\t\tCPyException e;\n        if ( !e.IsExceptionSystemExit() )\n        {\n\t\t\tCString sErrorMsg = e.tracebackW();\n\t\t\tif ( sErrorMsg.IsEmpty() )\n\t\t\t\tsErrorMsg.Format( _T( \"[Error]\\n%hs\" ), e.what() );\n\n\t\t\tif ( !sStdOut.empty() )\n\t\t\t\tsErrorMsg.AppendFormat( _T( \"\\n\\n[STDOUT]\\n%hs\" ), sStdOut.c_str() );\n\n\t\t\tLogEventMessage( PYTHONTOOLS_CATEGORY, sErrorMsg.GetString(), LogEventType::Error );\n\n            hr = E_FAIL;\n        }\n\t\telse\n\t\t{\n\t\t\tPySystemExitObject* pSystemExitObject = reinterpret_cast<PySystemExitObject*>(e.GetValue());\n\t\t\tif ( pSystemExitObject && pSystemExitObject->code )\n\t\t\t{\n\t\t\t\tif ( PyLong_Check( pSystemExitObject->code ) )\n\t\t\t\t{\n\t\t\t\t\texitCode = PyLong_AsLong( pSystemExitObject->code );\n\t\t\t\t}\n\t\t\t\telse if ( PyUnicode_Check( pSystemExitObject->code ) )\n\t\t\t\t{\n\t\t\t\t\t// unexpected\n\t\t\t\t\tsStdOut += e.what();\n\t\t\t\t\texitCode = -1;\n\t\t\t\t\tLogEventMessage( PYTHONTOOLS_CATEGORY, e.whatW(), LogEventType::Error );\n\t\t\t\t\thr = E_FAIL;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n    emb::reset_stdout();\n\temb::reset_stderr();\n\n\treturn hr;\n}\n\nSTDMETHODIMP CUsdPythonToolsImpl::Record( IN BSTR usdStagePath, IN int imageWidth, IN BSTR renderer, OUT BSTR *outputImagePath )\n{\n\tDEBUG_RECORD_ENTRY();\n\n\tHRESULT hr;\n\n\tTPyChar sPathToHostExe[MAX_PATH];\n#if PY_MAJOR_VERSION >= 3\n\t::GetModuleFileNameW( nullptr, sPathToHostExe, ARRAYSIZE( sPathToHostExe ) );\n#else\n\t::GetModuleFileNameA( nullptr, sPathToHostExe, ARRAYSIZE( sPathToHostExe ) );\n#endif\n\tPy_SetProgramName( sPathToHostExe );\n\n\twchar_t sTempPath[MAX_PATH];\n\t::GetTempPathW( ARRAYSIZE( sTempPath ), sTempPath );\n\twchar_t sTempFileName[MAX_PATH];\n\n\t// search for a unique temp file name\n\tstd::vector<CStringW> tempFileList;\n\tfor ( ;; )\n\t{\n\t\t::GetTempFileNameW( sTempPath, L\"usd\", 0, sTempFileName );\n\t\ttempFileList.push_back( sTempFileName );\n\t\t::PathCchRenameExtension( sTempFileName, ARRAYSIZE( sTempFileName ), L\"png\" );\n\t\tif ( GetFileAttributesW( sTempFileName ) == INVALID_FILE_ATTRIBUTES )\n\t\t\tbreak;\n\t}\n\n\t// delete the temp files that GetTempFileNameW created\n\tfor ( const CStringW &str : tempFileList )\n\t\tDeleteFileW( str );\n\n    std::string sStdOut;\n\n\tCStringW sImageWidth;\n\tsImageWidth.Format( L\"%d\", imageWidth );\n\n\t// locate usdrecord\n\tstd::wstring sUsdRecordAbsolutePath = FindRelativeFile( L\"usdrecord\" );\n\tif ( sUsdRecordAbsolutePath.empty() )\n\t{\n\t\tLogEventMessage( PYTHONTOOLS_CATEGORY, L\"Failed to locate usdrecord\", LogEventType::Error );\n\t\treturn E_FAIL;\n\t}\n\n\tstd::vector<const TPyChar *> ArgV;\n\t// Set the first argument as the absolute path to the usdrecord python script\n\t// We will use argv[0] to load it using importlib\n\tCW2Py pyUsdRecordAbsolutePath( sUsdRecordAbsolutePath.c_str() );\n\tArgV.push_back( pyUsdRecordAbsolutePath );\n\tArgV.push_back( _Tpy(\"--imageWidth\") );\n\tCW2Py pyImageWidth( sImageWidth );\n\tArgV.push_back( pyImageWidth );\n\n\tCW2Py pyRenderer(renderer);\n\tif ( renderer != nullptr && renderer[0] != '\\0' )\n\t{\n\t\tArgV.push_back( _Tpy(\"--renderer\") );\n\t\tArgV.push_back( pyRenderer );\n\t}\n\n\tCW2Py pyUsdStagePath(usdStagePath);\n\tArgV.push_back( pyUsdStagePath );\n\tCW2Py pyTempFileName(sTempFileName);\n\tArgV.push_back( pyTempFileName );\n\n\tint exitCode = 0;\n\thr = RunResourcePythonScript( IDR_PYTHON_THUMBNAIL, ArgV, sStdOut, exitCode );\n\tif ( FAILED( hr ) )\n\t\treturn hr;\n\n\tif ( exitCode != 0 )\n\t{\n\t\tCString sErrorMsg;\n\t\tsErrorMsg.Format( _T( \"Error generating thumbnail for %ls\\n\\n%hs\\n\\nExit Code: %d\" ), usdStagePath, sStdOut.c_str(), exitCode );\n\n\t\tLogEventMessage( PYTHONTOOLS_CATEGORY, sErrorMsg.GetString(), LogEventType::Error );\n\n\t\treturn E_FAIL;\n\t}\n\n\tCComBSTR bstrOutputFile( sTempFileName );\n\t*outputImagePath = bstrOutputFile.Detach();\n\n\treturn S_OK;\n}\n\nSTDMETHODIMP CUsdPythonToolsImpl::View( IN BSTR usdStagePath, IN BSTR renderer )\n{\n\tDEBUG_RECORD_ENTRY();\n\n\tHRESULT hr;\n\n\tTPyChar sPathToHostExe[MAX_PATH];\n#if PY_MAJOR_VERSION >= 3\n\t::GetModuleFileNameW( nullptr, sPathToHostExe, ARRAYSIZE( sPathToHostExe ) );\n#else\n\t::GetModuleFileNameA( nullptr, sPathToHostExe, ARRAYSIZE( sPathToHostExe ) );\n#endif\n\tPy_SetProgramName( sPathToHostExe );\n\n    std::string sStdOut;\n\n\tstd::vector<const TPyChar *> ArgV;\n\tArgV.push_back( sPathToHostExe );\n\n\tCW2Py pyRenderer(renderer);\n\tif ( renderer != nullptr && renderer[0] != '\\0' )\n\t{\n\t\tArgV.push_back( _Tpy(\"--renderer\") );\n\t\tArgV.push_back( pyRenderer );\n\t}\n\n\tCW2Py pyUsdStagePath(usdStagePath);\n\tArgV.push_back( pyUsdStagePath );\n\n\tint exitCode = 0;\n\thr = RunDiskPythonScript( L\"usdview\", ArgV, sStdOut, exitCode );\n\tif ( FAILED( hr ) )\n\t\treturn hr;\n\n\tif ( exitCode != 0 )\n\t{\n\t\tCString sErrorMsg;\n\t\tsErrorMsg.Format( _T( \"Error launching usdview for %ls\\n\\n%hs\\n\\nExit Code: %d\" ), usdStagePath, sStdOut.c_str(), exitCode );\n\n\t\tLogEventMessage( PYTHONTOOLS_CATEGORY, sErrorMsg.GetString(), LogEventType::Error );\n\n\t\treturn E_FAIL;\n\t}\n\n\treturn S_OK;\n}\n\nHRESULT WINAPI CUsdPythonToolsImpl::UpdateRegistry(_In_ BOOL bRegister) throw()\n{\n\tATL::_ATL_REGMAP_ENTRY regMapEntries[] =\n\t{\n\t\t{ L\"APPID\", L\"{8777F2C4-2318-408A-85D8-F65E15811971}\" },\n\t\t{ L\"CLSID_USDPYTHONTOOLS\", L\"{67F43831-59C3-450E-8956-AA76273F3E9F}\" },\n\t\t{ nullptr, nullptr }\n\t};\n\n\treturn g_AtlModule.UpdateRegistryFromResource(IDR_REGISTRY_USDTOOLSIMPL, bRegister, regMapEntries);\n}"
  },
  {
    "path": "UsdPythonToolsServer/UsdPythonToolsImpl.h",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#pragma once\n\n#include \"UsdPythonToolsLocalServer_h.h\"\n\n#include \"resource.h\"\n\nclass ATL_NO_VTABLE CUsdPythonToolsImpl :\n\tpublic IDispatchImpl<IUsdPythonTools, &IID_IUsdPythonTools, &LIBID_UsdPythonToolsLib, /*wMajor =*/ 1, /*wMinor =*/ 0>,\n\tpublic CComObjectRootEx<CComSingleThreadModel>,\n\tpublic CComCoClass<CUsdPythonToolsImpl, &CLSID_UsdPythonTools>\n{\npublic:\n\tDECLARE_NOT_AGGREGATABLE(CUsdPythonToolsImpl)\n\tDECLARE_PROTECT_FINAL_CONSTRUCT()\n\n\tBEGIN_COM_MAP( CUsdPythonToolsImpl )\n\t\tCOM_INTERFACE_ENTRY( IUsdPythonTools )\n\t\tCOM_INTERFACE_ENTRY2( IDispatch, IUsdPythonTools )\n\tEND_COM_MAP()\n\n\tHRESULT FinalConstruct();\n\tvoid FinalRelease();\n\n\tSTDMETHODIMP Record( IN BSTR usdStagePath, IN int imageWidth, IN BSTR renderer, OUT BSTR *outputImagePath ) override;\n\tSTDMETHODIMP View( IN BSTR usdStagePath, IN BSTR renderer ) override;\n\n\tstatic HRESULT WINAPI UpdateRegistry(_In_ BOOL bRegister) throw();\n\nprivate:\n};\n\nOBJECT_ENTRY_AUTO( __uuidof(UsdPythonTools), CUsdPythonToolsImpl )"
  },
  {
    "path": "UsdPythonToolsServer/UsdPythonToolsImpl.rgs",
    "content": "HKCR\n{\n\tNoRemove CLSID\n\t{\n\t\tForceRemove %CLSID_USDPYTHONTOOLS% = s 'Activision USD Python Tools Server'\n\t\t{\n\t\t\tLocalServer32 = s '%MODULE%'\n\t\t\tval AppID = s '%APPID%'\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "UsdPythonToolsServer/UsdPythonToolsLocalServer.idl",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport \"oaidl.idl\";\nimport \"ocidl.idl\";\n\n[\n\tuuid(88D2DCD9-4E41-49B1-B49A-4BD2942FE737),\n\thelpstring(\"UsdPythonTools Type Library\"),\n\tversion(1.0),\n]\nlibrary UsdPythonToolsLib\n{\n\t[\n\t\tuuid(A73B8191-52C6-416E-ADAF-B2D1572CB0FE)\n\t] \n\tstruct UsdVariantPair\n\t{\n\t\tBSTR key;\n\t\tVARIANT value;\n\t};\n\n\t[\n\t\tuuid(36B7B0A6-E4FC-4728-86C1-05AFD6CFCA52),\n\t\tobject,\n\t\tnonextensible,\n\t\toleautomation,\n\t\thelpstring(\"IUsdPythonTools interface\"),\n\t\tdual\n\t]\n\tinterface IUsdPythonTools : IDispatch\n\t{\n\t\t[helpstring(\"Launches usdrecord to generate a thumbnail of a USD stage.\")]\n\t\tHRESULT Record( [in] BSTR usdStagePath, [in] int imageWidth, [in, optional] BSTR renderer, [out, retval] BSTR* outputImagePath );\n\n\t\t[helpstring(\"Launches usdview for a given USD stage.\")]\n\t\tHRESULT View( [in] BSTR usdStagePath, [in, optional] BSTR renderer );\n\t}\n\n\t[\n\t\tuuid(67F43831-59C3-450E-8956-AA76273F3E9F),\n\t\thelpstring(\"UsdPythonTools Server implementation\")\n\t]\n\tcoclass UsdPythonTools\n\t{\n\t\t[default] interface IUsdPythonTools;\n\t}\n};"
  },
  {
    "path": "UsdPythonToolsServer/UsdPythonToolsLocalServer.rc",
    "content": "// Microsoft Visual C++ generated resource script.\n//\n#include \"resource.h\"\n\n#define APSTUDIO_READONLY_SYMBOLS\n/////////////////////////////////////////////////////////////////////////////\n//\n// Generated from the TEXTINCLUDE 2 resource.\n//\n#include \"winres.h\"\n\n/////////////////////////////////////////////////////////////////////////////\n#undef APSTUDIO_READONLY_SYMBOLS\n\n/////////////////////////////////////////////////////////////////////////////\n// English (United States) resources\n\n#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\nLANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US\n#pragma code_page(1252)\n\n#ifdef APSTUDIO_INVOKED\n/////////////////////////////////////////////////////////////////////////////\n//\n// TEXTINCLUDE\n//\n\n1 TEXTINCLUDE \nBEGIN\n    \"resource.h\\0\"\nEND\n\n2 TEXTINCLUDE \nBEGIN\n    \"#include \"\"winres.h\"\"\\r\\n\"\n    \"\\0\"\nEND\n\n3 TEXTINCLUDE \nBEGIN\n    \"1 TYPELIB \"\"USDPythonToolsLocalServer.tlb\"\"\\r\\n\"\n    \"\\r\\n\"\n    \"#define ATVI_VERSION_DESCRIPTION \"\"Activision USD Python Tools Server\"\"\\r\\n\"\n    \"#include \"\"atviversion.rc2\"\"\\r\\n\"\n    \"\\r\\n\"\n    \"\\0\"\nEND\n\n#endif    // APSTUDIO_INVOKED\n\n\n/////////////////////////////////////////////////////////////////////////////\n//\n// REGISTRY\n//\n\nIDR_REGISTRY_MODULE     REGISTRY                \"USDPythonToolsLocalServerModule.rgs\"\n\nIDR_REGISTRY_USDTOOLSIMPL REGISTRY                \"UsdPythonToolsImpl.rgs\"\n\n\n/////////////////////////////////////////////////////////////////////////////\n//\n// Icon\n//\n\n// Icon with lowest ID value placed first to ensure application icon\n// remains consistent on all systems.\nIDI_ICON_USD            ICON                    \"shared\\\\usd.ico\"\n\n\n/////////////////////////////////////////////////////////////////////////////\n//\n// PYTHON\n//\n\nIDR_PYTHON_THUMBNAIL    PYTHON                  \"UsdThumbnail.py\"\n\n#endif    // English (United States) resources\n/////////////////////////////////////////////////////////////////////////////\n\n\n\n#ifndef APSTUDIO_INVOKED\n/////////////////////////////////////////////////////////////////////////////\n//\n// Generated from the TEXTINCLUDE 3 resource.\n//\n1 TYPELIB \"USDPythonToolsLocalServer.tlb\"\n\n#define ATVI_VERSION_DESCRIPTION \"Activision USD Python Tools Server\"\n#include \"atviversion.rc2\"\n\n\n/////////////////////////////////////////////////////////////////////////////\n#endif    // not APSTUDIO_INVOKED\n\n"
  },
  {
    "path": "UsdPythonToolsServer/UsdPythonToolsLocalServer.vcxproj",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup Label=\"ProjectConfigurations\">\n    <ProjectConfiguration Include=\"Debug|x64\">\n      <Configuration>Debug</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release|x64\">\n      <Configuration>Release</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n  </ItemGroup>\n  <PropertyGroup Label=\"Globals\">\n    <VCProjectVersion>16.0</VCProjectVersion>\n    <Keyword>Win32Proj</Keyword>\n    <ProjectGuid>{6AD79C79-3A9D-4C39-B028-C45072541C28}</ProjectGuid>\n    <RootNamespace>UsdPythonToolsLocalServer</RootNamespace>\n    <WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"Configuration\">\n    <ConfigurationType>Application</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v141</PlatformToolset>\n    <WholeProgramOptimization>false</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\" Label=\"Configuration\">\n    <ConfigurationType>Application</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v141</PlatformToolset>\n    <WholeProgramOptimization>false</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n  <Import Project=\"$(SolutionDir)\\atviversion.props\" />\n  <Import Project=\"$(SolutionDir)\\python.props\" />\n  <Import Project=\"$(SolutionDir)\\boost.props\" />\n  <PropertyGroup Label=\"PythonConfiguration\">\n    <RegistryView>RegistryView.Registry32</RegistryView>\n    <RegistryView Condition=\"$(Platform) == 'x64'\">RegistryView.Registry64</RegistryView>\n    <PythonTag>$(PythonVersion)-32</PythonTag>\n    <PythonTag Condition=\"$(Platform) == 'x64'\">$(PythonVersion)</PythonTag>\n    <PythonHome Condition=\"$(PythonHome) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstallPath', null, null, $(RegistryView)))</PythonHome>\n    <PythonHome Condition=\"$(PythonHome) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstallPath', null, null, $(RegistryView)))</PythonHome>\n    <PythonExe Condition=\"$(PythonExe) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstallPath', 'ExecutablePath', null, $(RegistryView)))</PythonExe>\n    <PythonExe Condition=\"$(PythonExe) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstallPath', 'ExecutablePath', null, $(RegistryView)))</PythonExe>\n    <PythonExe Condition=\"$(PythonExe) == '' and $(PythonHome) != ''\">$(PythonHome)python.exe</PythonExe>\n    <PythonDevVersion>$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstalledFeatures', 'dev', null, $(RegistryView)))</PythonDevVersion>\n    <PythonDevVersion Condition=\"$(PythonDevVersion) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstalledFeatures', 'dev', null, $(RegistryView)))</PythonDevVersion>\n    <PythonCorePDBVersion>$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstalledFeatures', 'core_pdb', null, $(RegistryView)))</PythonCorePDBVersion>\n    <PythonCorePDBVersion Condition=\"$(PythonCorePDBVersion) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstalledFeatures', 'core_pdb', null, $(RegistryView)))</PythonCorePDBVersion>\n    <PythonCoreDVersion>$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstalledFeatures', 'core_d', null, $(RegistryView)))</PythonCoreDVersion>\n    <PythonCoreDVersion Condition=\"$(PythonCoreDVersion) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstalledFeatures', 'core_d', null, $(RegistryView)))</PythonCoreDVersion>\n    <PythonDebugSuffix Condition=\"$(PythonCoreDVersion) != ''\">_d</PythonDebugSuffix>\n    <PythonDExe Condition=\"$(PythonExe) != '' and $(PythonDExe) == ''\">$([System.IO.Path]::GetDirectoryName($(PythonExe)))\\python$(PythonDebugSuffix).exe</PythonDExe>\n    <PythonDExe Condition=\"!Exists($(PythonDExe))\">$(PythonExe)</PythonDExe>\n  </PropertyGroup>\n  <ImportGroup Label=\"ExtensionSettings\">\n  </ImportGroup>\n  <ImportGroup Label=\"Shared\">\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <PropertyGroup Label=\"UserMacros\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)bin\\$(PlatformToolset)\\$(PythonTag)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)build\\$(PlatformToolset)\\$(PythonTag)\\$(Configuration)\\$(ProjectName)\\</IntDir>\n    <IgnoreImportLibrary>true</IgnoreImportLibrary>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)bin\\$(PlatformToolset)\\$(PythonTag)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)build\\$(PlatformToolset)\\$(PythonTag)\\$(Configuration)\\$(ProjectName)\\</IntDir>\n    <IgnoreImportLibrary>true</IgnoreImportLibrary>\n  </PropertyGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <SDLCheck>true</SDLCheck>\n      <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <ConformanceMode>true</ConformanceMode>\n    </ClCompile>\n    <Link>\n      <SubSystem>Console</SubSystem>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <SDLCheck>true</SDLCheck>\n      <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <ConformanceMode>true</ConformanceMode>\n    </ClCompile>\n    <Link>\n      <SubSystem>Console</SubSystem>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <ClCompile>\n      <WarningLevel>Level4</WarningLevel>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <SDLCheck>true</SDLCheck>\n      <PreprocessorDefinitions>_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <ConformanceMode>false</ConformanceMode>\n      <PrecompiledHeader>Use</PrecompiledHeader>\n      <InlineFunctionExpansion>Disabled</InlineFunctionExpansion>\n      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n      <AdditionalIncludeDirectories>$(SolutionDir);$(PythonHome)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <Optimization>Disabled</Optimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <EnableCOMDATFolding>false</EnableCOMDATFolding>\n      <OptimizeReferences>false</OptimizeReferences>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(PythonHome)libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>Pathcch.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <DelayLoadDLLs>\n      </DelayLoadDLLs>\n    </Link>\n    <ResourceCompile>\n      <AdditionalIncludeDirectories>$(OutDir);$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n    </ResourceCompile>\n    <Midl>\n      <InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>\n      <MkTypLibCompatible>false</MkTypLibCompatible>\n      <ValidateAllParameters>true</ValidateAllParameters>\n      <WarningLevel>0</WarningLevel>\n      <EnableErrorChecks>All</EnableErrorChecks>\n      <TypeLibraryName>$(OutDir)$(ProjectName).tlb</TypeLibraryName>\n    </Midl>\n    <PostBuildEvent>\n      <Command>%(Command)</Command>\n    </PostBuildEvent>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\n    <ClCompile>\n      <WarningLevel>Level4</WarningLevel>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <SDLCheck>true</SDLCheck>\n      <PreprocessorDefinitions>_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <ConformanceMode>false</ConformanceMode>\n      <PrecompiledHeader>Use</PrecompiledHeader>\n      <AdditionalIncludeDirectories>$(SolutionDir);$(PythonHome)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <Optimization>MaxSpeed</Optimization>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <EnableCOMDATFolding>false</EnableCOMDATFolding>\n      <OptimizeReferences>false</OptimizeReferences>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(PythonHome)libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>Pathcch.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <DelayLoadDLLs>\n      </DelayLoadDLLs>\n    </Link>\n    <ResourceCompile>\n      <AdditionalIncludeDirectories>$(OutDir);$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n    </ResourceCompile>\n    <Midl>\n      <InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>\n      <MkTypLibCompatible>false</MkTypLibCompatible>\n      <ValidateAllParameters>true</ValidateAllParameters>\n      <WarningLevel>0</WarningLevel>\n      <EnableErrorChecks>All</EnableErrorChecks>\n      <TypeLibraryName>$(OutDir)$(ProjectName).tlb</TypeLibraryName>\n    </Midl>\n    <PostBuildEvent>\n      <Command>%(Command)</Command>\n    </PostBuildEvent>\n  </ItemDefinitionGroup>\n  <ItemGroup>\n    <ClInclude Include=\"..\\shared\\emb.h\" />\n    <ClInclude Include=\"..\\shared\\environment.h\" />\n    <ClInclude Include=\"..\\shared\\EventViewerLog.h\" />\n    <ClInclude Include=\"..\\shared\\PythonUtil.h\" />\n    <ClInclude Include=\"resource.h\" />\n    <ClInclude Include=\"stdafx.h\" />\n    <ClInclude Include=\"Module.h\" />\n    <ClInclude Include=\"UsdPythonToolsImpl.h\" />\n    <ClInclude Include=\"UsdPythonToolsLocalServer_h.h\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"..\\shared\\emb.cpp\" />\n    <ClCompile Include=\"..\\shared\\environment.cpp\" />\n    <ClCompile Include=\"stdafx.cpp\">\n      <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">Create</PrecompiledHeader>\n      <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">Create</PrecompiledHeader>\n    </ClCompile>\n    <ClCompile Include=\"Module.cpp\" />\n    <ClCompile Include=\"UsdPythonToolsImpl.cpp\" />\n    <ClCompile Include=\"UsdPythonToolsLocalServer_i.c\">\n      <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">NotUsing</PrecompiledHeader>\n      <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">NotUsing</PrecompiledHeader>\n    </ClCompile>\n  </ItemGroup>\n  <ItemGroup>\n    <None Include=\"UsdPythonToolsImpl.rgs\" />\n    <None Include=\"UsdPythonToolsLocalServerModule.rgs\" />\n    <None Include=\"UsdThumbnail.py\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Midl Include=\"UsdPythonToolsLocalServer.idl\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ResourceCompile Include=\"UsdPythonToolsLocalServer.rc\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Image Include=\"..\\shared\\usd.ico\" />\n    <Image Include=\"shared\\usd.ico\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"..\\shared\\EventViewerMessages.vcxproj\">\n      <Project>{f12e597b-b731-4f5a-bec3-980d20159320}</Project>\n    </ProjectReference>\n  </ItemGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\n  <ImportGroup Label=\"ExtensionTargets\">\n  </ImportGroup>\n</Project>"
  },
  {
    "path": "UsdPythonToolsServer/UsdPythonToolsLocalServer.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup>\n    <Filter Include=\"Source Files\">\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\n      <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\n    </Filter>\n    <Filter Include=\"Header Files\">\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\n      <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>\n    </Filter>\n    <Filter Include=\"Resource Files\">\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\n    </Filter>\n    <Filter Include=\"Shared\">\n      <UniqueIdentifier>{a27a5032-5dc7-4c59-b490-e65c0cc5fee0}</UniqueIdentifier>\n    </Filter>\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"stdafx.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"resource.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"Module.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"UsdPythonToolsImpl.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"UsdPythonToolsLocalServer_h.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"..\\shared\\emb.h\">\n      <Filter>Shared</Filter>\n    </ClInclude>\n    <ClInclude Include=\"..\\shared\\environment.h\">\n      <Filter>Shared</Filter>\n    </ClInclude>\n    <ClInclude Include=\"..\\shared\\EventViewerLog.h\">\n      <Filter>Shared</Filter>\n    </ClInclude>\n    <ClInclude Include=\"..\\shared\\PythonUtil.h\">\n      <Filter>Shared</Filter>\n    </ClInclude>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"stdafx.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"Module.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"UsdPythonToolsImpl.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"UsdPythonToolsLocalServer_i.c\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"..\\shared\\emb.cpp\">\n      <Filter>Shared</Filter>\n    </ClCompile>\n    <ClCompile Include=\"..\\shared\\environment.cpp\">\n      <Filter>Shared</Filter>\n    </ClCompile>\n  </ItemGroup>\n  <ItemGroup>\n    <None Include=\"UsdPythonToolsImpl.rgs\">\n      <Filter>Resource Files</Filter>\n    </None>\n    <None Include=\"UsdPythonToolsLocalServerModule.rgs\">\n      <Filter>Resource Files</Filter>\n    </None>\n    <None Include=\"UsdThumbnail.py\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Midl Include=\"UsdPythonToolsLocalServer.idl\">\n      <Filter>Source Files</Filter>\n    </Midl>\n  </ItemGroup>\n  <ItemGroup>\n    <ResourceCompile Include=\"UsdPythonToolsLocalServer.rc\">\n      <Filter>Resource Files</Filter>\n    </ResourceCompile>\n  </ItemGroup>\n  <ItemGroup>\n    <Image Include=\"..\\shared\\usd.ico\">\n      <Filter>Shared</Filter>\n    </Image>\n    <Image Include=\"shared\\usd.ico\">\n      <Filter>Resource Files</Filter>\n    </Image>\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "UsdPythonToolsServer/UsdPythonToolsLocalServerModule.rgs",
    "content": "HKCU\n{\n\tNoRemove AppID\n\t{\n\t\t'%APPID%' = s 'UsdPythonToolsLocalServer'\n\t\t'UsdPythonToolsLocalServer.exe'\n\t\t{\n\t\t\tval AppID = s '%APPID%'\n\t\t}\n\t}\n}\n\n"
  },
  {
    "path": "UsdPythonToolsServer/UsdThumbnail.py",
    "content": "#  Copyright 2021 Activision Publishing, Inc. \n#\n#  Licensed under the Apache License, Version 2.0 (the \"License\");\n#  you may not use this file except in compliance with the License.\n#  You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n#  Unless required by applicable law or agreed to in writing, software\n#  distributed under the License is distributed on an \"AS IS\" BASIS,\n#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n#  See the License for the specific language governing permissions and\n#  limitations under the License.\n\n# This is a fix for USD issue #1521\n# https://github.com/PixarAnimationStudios/USD/issues/1521\n\nimport sys\ntry:\n    from importlib.util import spec_from_loader, module_from_spec\n    from importlib.machinery import SourceFileLoader \nexcept ImportError:\n    import imp\n\ndef _SetupOpenGLContextFix(width=100, height=100):\n    try:\n        from PySide2 import QtOpenGL\n        from PySide2.QtWidgets import QApplication\n        from PySide2 import QtCore # Activision Change\n    except ImportError:\n        from PySide import QtOpenGL\n        from PySide.QtGui import QApplication\n        from PySide import QtCore # Activision Change\n\n    application = QApplication(sys.argv)\n\n    glFormat = QtOpenGL.QGLFormat()\n    glFormat.setSampleBuffers(True)\n    glFormat.setSamples(4)\n\n    glWidget = QtOpenGL.QGLWidget(glFormat)\n    glWidget.setFixedSize(width, height)\n    # BEGIN - Activision Change\n    glWidget.setAttribute( QtCore.Qt.WA_DontShowOnScreen )\n    # END - Activision Change    \n    glWidget.show()\n    glWidget.setHidden(True)\n\n    return glWidget\n\ndef main():\n    try:\n        spec = spec_from_loader(\"usdrecord\", SourceFileLoader(\"usdrecord\", sys.argv[0]))\n        usdrecord = module_from_spec(spec)\n        spec.loader.exec_module(usdrecord)\n    except:\n        usdrecord = imp.load_source('usdrecord', sys.argv[0])\n\n    usdrecord._SetupOpenGLContext = _SetupOpenGLContextFix\n    return usdrecord.main()\n\nif __name__ == '__main__':\n    sys.exit(main())\n"
  },
  {
    "path": "UsdPythonToolsServer/resource.h",
    "content": "//{{NO_DEPENDENCIES}}\n// Microsoft Visual C++ generated include file.\n// Used by UsdPythonToolsLocalServer.rc\n//\n#define IDR_REGISTRY_MODULE             101\n#define IDR_REGISTRY_USDTOOLSIMPL       102\n#define IDI_ICONUSD                     106\n#define IDI_ICON_USD                    106\n#define IDR_PYTHON_PREVIEWHANLDER       107\n#define IDR_REGISTRY_THUMBNAILIMPL      108\n#define IDR_REGISTRY_USDTHUMBNAILIMPL   108\n#define IDD_DIALOG1                     109\n#define IDR_PYTHON1                     111\n#define IDR_PYTHON_THUMBNAIL            111\n\n// Next default values for new objects\n// \n#ifdef APSTUDIO_INVOKED\n#ifndef APSTUDIO_READONLY_SYMBOLS\n#define _APS_NEXT_RESOURCE_VALUE        112\n#define _APS_NEXT_COMMAND_VALUE         40001\n#define _APS_NEXT_CONTROL_VALUE         1004\n#define _APS_NEXT_SYMED_VALUE           101\n#endif\n#endif\n"
  },
  {
    "path": "UsdPythonToolsServer/stdafx.cpp",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include \"stdafx.h\""
  },
  {
    "path": "UsdPythonToolsServer/stdafx.h",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#pragma once\n\n#ifndef STRICT\n#define STRICT\n#endif\n\n#pragma warning(push)\n#pragma warning(disable: 4244 4459)\n\n#include <boost/python/module.hpp>\n#include <boost/python/def.hpp>\n#include <boost/python/list.hpp>\n#include <boost/python.hpp>\n\n#pragma warning(pop)\n\n#include <WinSDKVer.h>\n#define _WIN32_WINNT 0x0A00\n#include <SDKDDKVer.h>\n\n#define _ATL_APARTMENT_THREADED\n#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS\t// some CString constructors will be explicit\n#define ATL_NO_ASSERT_ON_DESTROY_NONEXISTENT_WINDOW\n// Use the C++ standard templated min/max\n#define NOMINMAX\n#define NOBITMAP\n// Include <mcx.h> if you need this\n#define NOMCX\n// Include <winsvc.h> if you need this\n#define NOSERVICE\n\n#include <windows.h>\n#include <PathCch.h>\n\n#include <atlbase.h>\n#include <atlcom.h>\n#include <atlconv.h>\n#include <atlctl.h>\n#include <atlstr.h>\n#include <atlsafe.h>\n#include <comutil.h>\n\n#include <stdint.h>\n#include <conio.h>\n\n"
  },
  {
    "path": "UsdSdkToolsServer/Module.cpp",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include \"stdafx.h\"\n#include \"Module.h\"\n\nHMODULE g_hInstance;\nCUsdSdkToolsLocalServerModule g_AtlModule;\nCString g_DebugIUsdSdkToolsMethod;\n\nextern \"C\" int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nShowCmd)\n{\n\tUNREFERENCED_PARAMETER( hPrevInstance );\n\tUNREFERENCED_PARAMETER( lpCmdLine );\n\tUNREFERENCED_PARAMETER( nShowCmd );\n\n\tg_hInstance = hInstance;\n\n\tint nResult = g_AtlModule.WinMain( nShowCmd );\n\n\treturn nResult;\n}\n"
  },
  {
    "path": "UsdSdkToolsServer/Module.h",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#pragma once\n\n#include \"UsdSdkToolsLocalServer_h.h\"\n#include \"resource.h\"\n\n// Using an ATL module here because it removes a lot of the \n// boiler-plate COM work that we would have to implement ourselves.\n\nclass CUsdSdkToolsLocalServerModule : public CAtlExeModuleT<CUsdSdkToolsLocalServerModule>\n{\npublic:\n\tDECLARE_LIBID( LIBID_UsdSdkToolsLib )\n\tDECLARE_REGISTRY_APPID_RESOURCEID( IDR_REGISTRY_MODULE, \"{123A65E6-B4B4-4B46-BEF5-D0FCE7173261}\" )\n\n\t// Override CAtlExeModuleT::PreMessageLoop to change REGCLS_MULTIPLEUSE to REGCLS_SINGLEUSE.\n\t// REGCLS_SINGLEUSE will create a new Windows process for every instance of our COM classes, \n\t// REGCLS_MULTIPLEUSE will reuse the same Windows process.\n\tHRESULT PreMessageLoop( _In_ int /*nShowCmd*/ ) throw()\n\t{\n\t\tHRESULT hr = S_OK;\n\t\tCUsdSdkToolsLocalServerModule* pT = static_cast<CUsdSdkToolsLocalServerModule*>(this);\n\n#ifndef _ATL_NO_COM_SUPPORT\n\t\thr = pT->RegisterClassObjects(CLSCTX_LOCAL_SERVER,\n\t\t\tREGCLS_SINGLEUSE | // <- !!!\n\t\t\tREGCLS_SUSPENDED);\n\n\t\tif (FAILED(hr))\n\t\t\treturn hr;\n\n\t\tif (hr == S_OK)\n\t\t{\n\t\t\tif (m_bDelayShutdown)\n\t\t\t{\n\t\t\t\tCHandle h(pT->StartMonitor());\n\t\t\t\tif (h.m_h == NULL)\n\t\t\t\t{\n\t\t\t\t\thr = E_FAIL;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\thr = CoResumeClassObjects();\n\t\t\t\t\tATLASSERT(SUCCEEDED(hr));\n\t\t\t\t\tif (FAILED(hr))\n\t\t\t\t\t{\n\t\t\t\t\t\t::SetEvent(m_hEventShutdown); // tell monitor to shutdown\n\t\t\t\t\t\t::WaitForSingleObject(h, m_dwTimeOut * 2);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\thr = CoResumeClassObjects();\n\t\t\t\tATLASSERT(SUCCEEDED(hr));\n\t\t\t}\n\n\t\t\tif (FAILED(hr))\n\t\t\t\tpT->RevokeClassObjects();\n\t\t}\n\t\telse\n\t\t{\n\t\t\tm_bDelayShutdown = false;\n\t\t}\n\n#endif\t// _ATL_NO_COM_SUPPORT\n\n\t\tATLASSERT(SUCCEEDED(hr));\n\t\treturn hr;\n\t}\n};\n\nextern CUsdSdkToolsLocalServerModule g_AtlModule;\nextern HMODULE g_hInstance;\n// Helpful for debugging zombie processes.\n// Set to the last method that was called in IUsdSdkTools\nextern CString g_DebugIUsdSdkToolsMethod;\n\n#define DEBUG_RECORD_ENTRY() \\\n\tg_DebugIUsdSdkToolsMethod = _T(__FUNCTION__)\n"
  },
  {
    "path": "UsdSdkToolsServer/UsdSdkToolsImpl.cpp",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include \"stdafx.h\"\n#include \"UsdSdkToolsImpl.h\"\n#include \"Module.h\"\n#include \"shared\\environment.h\"\n#include \"shared\\EventViewerLog.h\"\n\n#include <vector>\n\nHRESULT CUsdSdkToolsImpl::FinalConstruct()\n{\n\tSetupPythonEnvironment( g_hInstance );\n\n\treturn __super::FinalConstruct();\n}\n\nvoid CUsdSdkToolsImpl::FinalRelease()\n{\n\t__super::FinalRelease();\n}\n\nstatic void RegisterUsdPlugins()\n{\n\tstatic bool sUsdPluginsRegistered = false;\n\tstatic std::mutex sUsdPluginsRegisteredLock;\n\n\tstd::lock_guard<std::mutex> guard( sUsdPluginsRegisteredLock );\n\n\t// Plugins should be registered only once per session.\n\tif( sUsdPluginsRegistered )\n\t\treturn;\n\n\tsUsdPluginsRegistered = true;\n\n\tTCHAR sModulePath[MAX_PATH];\n\tGetModuleFileName( g_hInstance, sModulePath, ARRAYSIZE( sModulePath ) );\n\n\tstd::vector<std::string> pathsToPlugInfo;\n\n\t// add the folder that contains the shell extension\n\tPathCchRemoveFileSpec( sModulePath, ARRAYSIZE( sModulePath ) );\n\tpathsToPlugInfo.push_back( static_cast<LPCSTR>(ATL::CW2A(sModulePath, CP_UTF8)) );\n\n\t// add the bare-bones usd plugins\n\tPathCchAppend( sModulePath, ARRAYSIZE( sModulePath ), L\"usd\" );\n\tpathsToPlugInfo.push_back( static_cast<LPCSTR>(ATL::CW2A(sModulePath, CP_UTF8)) );\n\n\tpxr::PlugRegistry::GetInstance().RegisterPlugins( pathsToPlugInfo );\n\n\tpxr::ArSetPreferredResolver( \"ArResolverShellExtension\" );\n}\n\nSTDMETHODIMP CUsdSdkToolsImpl::Cat( IN BSTR usdStagePathInput, IN BSTR usdStagePathOuput, IN eUsdFormat formatOutput, IN VARIANT_BOOL flatten )\n{\n\tDEBUG_RECORD_ENTRY();\n\n\tRegisterUsdPlugins();\n\n\tpxr::SdfLayer::FileFormatArguments fileFormat;\n\tif ( formatOutput == USD_FORMAT_USDA )\n\t\tfileFormat[\"target\"] = \"usda\";\n\telse if ( formatOutput == USD_FORMAT_USDC )\n\t\tfileFormat[\"target\"] = \"usdc\";\n\n\tif ( flatten == VARIANT_FALSE )\n\t{\n\t\tstd::string usdStagePathInputA = static_cast<LPCSTR>(ATL::CW2A( usdStagePathInput, CP_UTF8 ));\n\t\tpxr::SdfLayerRefPtr rootLayer = pxr::SdfLayer::OpenAsAnonymous( usdStagePathInputA, false );\n\t\tif ( rootLayer == nullptr )\n\t\t\treturn E_FAIL;\n\n\t\tstd::string usdStagePathOuputA = static_cast<LPCSTR>(ATL::CW2A( usdStagePathOuput, CP_UTF8 ));\n\t\tif ( !rootLayer->Export( usdStagePathOuputA, std::string(), fileFormat ) )\n\t\t\treturn E_FAIL;\n\t}\n\telse\n\t{\n\t\tstd::string usdStagePathInputA = static_cast<LPCSTR>(ATL::CW2A( usdStagePathInput, CP_UTF8 ));\n\t\tpxr::UsdStageRefPtr stage = pxr::UsdStage::Open( usdStagePathInputA );\n\t\tif ( stage == nullptr )\n\t\t\treturn E_FAIL;\n\n\t\tstage->Flatten();\n\n\t\tstd::string usdStagePathOuputA = static_cast<LPCSTR>(ATL::CW2A( usdStagePathOuput, CP_UTF8 ));\n\t\tif ( !stage->Export( usdStagePathOuputA, true, fileFormat ) )\n\t\t\treturn E_FAIL;\n\t}\n\n\treturn S_OK;\n}\n\nSTDMETHODIMP CUsdSdkToolsImpl::Edit( IN BSTR usdStagePath, IN VARIANT_BOOL force )\n{\n\tDEBUG_RECORD_ENTRY();\n\n\tRegisterUsdPlugins();\n\n\tDWORD inputFileAttribs = GetFileAttributes( usdStagePath );\n\tif ( inputFileAttribs == INVALID_FILE_ATTRIBUTES )\n\t\treturn E_INVALIDARG;\n\n\tstd::string usdStagePathA = static_cast<LPCSTR>(ATL::CW2A( usdStagePath, CP_UTF8 ));\n\tpxr::SdfLayerRefPtr rootLayer = pxr::SdfLayer::OpenAsAnonymous( usdStagePathA, false );\n\tif ( rootLayer == nullptr )\n\t\treturn E_FAIL;\n\n\tCStringW usdStagePathOuputW;\n\tusdStagePathOuputW = usdStagePath;\n\tusdStagePathOuputW += L\"-edit.usda\";\n\n\tstd::string exportString;\n\tif ( !rootLayer->ExportToString( &exportString ) )\n\t\treturn E_FAIL;\n\n\tstd::ofstream fileOut(usdStagePathOuputW.GetString(), std::ofstream::out|std::ofstream::trunc);\n\tif (!fileOut.is_open())\n\t\treturn E_FAIL;\n\n\tfileOut << exportString;\n\n\tfileOut.close();\n\n\n\tWIN32_FILE_ATTRIBUTE_DATA wfadBefore = {};\n\t::GetFileAttributesEx( usdStagePathOuputW, GetFileExInfoStandard, &wfadBefore );\n\n\t// hide the file we're editing\n\t::SetFileAttributes( usdStagePathOuputW, wfadBefore.dwFileAttributes | FILE_ATTRIBUTE_HIDDEN );\n\n\tCStringW sEditor = GetUsdEditor();\n\tif ( sEditor.IsEmpty() )\n\t\tsEditor = L\"notepad.exe\";\n\n\tCStringW sCommandLine;\n\tsCommandLine.Format( L\"%s \\\"%s\\\"\", sEditor.GetString(), usdStagePathOuputW.GetString() );\n\n\tSTARTUPINFO si = {};\n\tsi.cb = sizeof( si );\n\tPROCESS_INFORMATION pi = {};\n\tif ( !::CreateProcess( nullptr, sCommandLine.GetBuffer(), nullptr, nullptr, FALSE, 0, nullptr, nullptr, &si, &pi ) )\n\t{\n\t\treturn E_FAIL;\n\t}\n\n\t::WaitForSingleObject( pi.hProcess, INFINITE );\n\n\t::CloseHandle( pi.hProcess );\n\t::CloseHandle( pi.hThread );\n\n\tWIN32_FILE_ATTRIBUTE_DATA wfadAfter = {};\n\t::GetFileAttributesEx( usdStagePathOuputW, GetFileExInfoStandard, &wfadAfter );\n\n\tif ( ::CompareFileTime( &wfadAfter.ftLastWriteTime, &wfadBefore.ftLastWriteTime ) != 0 )\n\t{\n\t\tif ( (inputFileAttribs & FILE_ATTRIBUTE_READONLY) )\n\t\t{\n\t\t\tif ( force == VARIANT_FALSE )\n\t\t\t{\n\t\t\t\t::DeleteFileW( usdStagePathOuputW );\n\t\t\t\treturn S_OK;\n\t\t\t}\n\n\t\t\t::SetFileAttributes( usdStagePath, inputFileAttribs & ~FILE_ATTRIBUTE_READONLY );\n\t\t}\n\n\t\tstd::ifstream fileIn(usdStagePathOuputW.GetString(), std::ifstream::in);\n\t\tif (!fileIn.is_open())\n\t\t\treturn E_FAIL;\n\n\t\tstd::ostringstream importString;\n\t\timportString << fileIn.rdbuf();\n\t\tfileIn.close();\n\n\t\tif ( rootLayer->ImportFromString( importString.str() ) == false )\n\t\t\treturn E_FAIL;\n\n\t\tif ( rootLayer->Export( usdStagePathA ) == false )\n\t\t\treturn E_FAIL;\n\t}\n\n\t::DeleteFileW( usdStagePathOuputW );\n\n\treturn S_OK;\n}\n\nstatic void pause()\n{\n\tstd::cout << std::endl;\n\tstd::cout << \"Press any key to continue...\" << std::endl;\n\t_getch();\n}\n\nSTDMETHODIMP CUsdSdkToolsImpl::Package( IN BSTR usdStagePathInput, IN BSTR usdStagePathOuput, IN eUsdPackageType packageType, IN VARIANT_BOOL verbose )\n{\n\tDEBUG_RECORD_ENTRY();\n\n\t// create and display a console\n\tif (AllocConsole())\n\t{\n\t\tFILE *fout = nullptr;\n\t\tfreopen_s(&fout, \"CONOUT$\", \"w\", stdout);\n\t\tFILE *ferr = nullptr;\n\t\tfreopen_s(&ferr, \"CONOUT$\", \"w\", stderr);\n\t}\n\n\tSetConsoleTitleW( L\"USD Package\" );\n\n\t// ask the user to press a key to exit\n\tatexit( pause );\n\n\tRegisterUsdPlugins();\n\n\tif ( verbose != VARIANT_FALSE )\n\t\tpxr::TfDebug::SetDebugSymbolsByName( \"USDUTILS_CREATE_USDZ_PACKAGE\", 1 );\n\n\tDWORD inputFileAttribs = GetFileAttributes( usdStagePathInput );\n\tif ( inputFileAttribs == INVALID_FILE_ATTRIBUTES )\n\t\treturn E_INVALIDARG;\n\n\tstd::string usdStagePathInputA = static_cast<LPCSTR>(ATL::CW2A( usdStagePathInput, CP_UTF8 ));\n\tstd::string usdStagePathOuputA = static_cast<LPCSTR>(ATL::CW2A( usdStagePathOuput, CP_UTF8 ));\n\n\tif ( packageType == USD_PACKAGE_DEFAULT )\n\t{\n\t\tif ( !pxr::UsdUtilsCreateNewUsdzPackage( pxr::SdfAssetPath( usdStagePathInputA ), usdStagePathOuputA ) )\n\t\t\treturn E_FAIL;\n\t}\n\telse if( packageType == USD_FORMAT_APPLE_ARKIT )\n\t{\n\t\tif ( !pxr::UsdUtilsCreateNewARKitUsdzPackage( pxr::SdfAssetPath( usdStagePathInputA ), usdStagePathOuputA ) )\n\t\t\treturn E_FAIL;\n\t}\n\telse\n\t{\n\t\treturn E_INVALIDARG;\n\t}\n\n\treturn S_OK;\n}\n\nstatic void PrintDictionary( const pxr::VtDictionary &dict, int indent )\n{\n\tfor ( const std::pair<std::string, pxr::VtValue>& stat : dict )\n\t{\n\t\tfor ( int i = 0; i < indent; ++i )\n\t\t\tstd::cout << \"  \";\n\n\t\tif ( stat.second.GetTypeid() == typeid(pxr::VtDictionary) )\n\t\t{\n\t\t\tstd::cout << stat.first << std::endl;\n\t\t\tpxr::VtDictionary nestedDict = stat.second.Get<pxr::VtDictionary>();\n\t\t\tPrintDictionary( nestedDict, indent + 1 );\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif ( stat.second.GetTypeid() == typeid(size_t) )\n\t\t\t\tstd::cout << stat.first << \" = \" << stat.second.Get<size_t>() << std::endl;\n\t\t\telse if ( stat.second.GetTypeid() == typeid(double) )\n\t\t\t\tstd::cout << stat.first << \" = \" << stat.second.Get<double>() << std::endl;\n\t\t\telse\n\t\t\t\tstd::cout << stat.first << \" = \" << \"[UNKNOWN TYPE]\" << std::endl;\n\t\t}\n\t}\n}\n\nSTDMETHODIMP CUsdSdkToolsImpl::DisplayStageStats( IN BSTR usdStagePath )\n{\n\tDEBUG_RECORD_ENTRY();\n\n\t// create and display a console\n\tif (AllocConsole())\n\t{\n\t\tFILE *fout = nullptr;\n\t\tfreopen_s(&fout, \"CONOUT$\", \"w\", stdout);\n\t\tFILE *ferr = nullptr;\n\t\tfreopen_s(&ferr, \"CONOUT$\", \"w\", stderr);\n\t}\n\n\tSetConsoleTitleW( L\"USD Stage Stats\" );\n\n\t// ask the user to press a key to exit\n\tatexit( pause );\n\n\tRegisterUsdPlugins();\n\n\tstd::string sError;\n\tpxr::TfMallocTag::Initialize( &sError );\n\n\tstd::string usdStagePathA = static_cast<LPCSTR>(ATL::CW2A( usdStagePath, CP_UTF8 ));\n\n\tstd::cout << usdStagePathA << std::endl;\n\tstd::cout << std::endl;\n\n\tpxr::VtDictionary dictStats;\n\tpxr::UsdStageRefPtr stage = pxr::UsdUtilsComputeUsdStageStats( usdStagePathA, &dictStats );\n\tif ( stage == nullptr )\n\t\treturn E_FAIL;\n\n\tPrintDictionary( dictStats, 0 );\n\n\treturn S_OK;\n}\n\nHRESULT WINAPI CUsdSdkToolsImpl::UpdateRegistry(_In_ BOOL bRegister) throw()\n{\n\tATL::_ATL_REGMAP_ENTRY regMapEntries[] =\n\t{\n\t\t{ L\"APPID\", L\"{123A65E6-B4B4-4B46-BEF5-D0FCE7173261}\" },\n\t\t{ L\"CLSID_USDSDKTOOLS\", L\"{5F016739-AF12-4899-B710-3FB5C242A11D}\" },\n\t\t{ nullptr, nullptr }\n\t};\n\n\treturn g_AtlModule.UpdateRegistryFromResource(IDR_REGISTRY_USDTOOLSIMPL, bRegister, regMapEntries);\n}"
  },
  {
    "path": "UsdSdkToolsServer/UsdSdkToolsImpl.h",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#pragma once\n\n#include \"UsdSdkToolsLocalServer_h.h\"\n\n#include \"resource.h\"\n\nclass ATL_NO_VTABLE CUsdSdkToolsImpl :\n\tpublic IDispatchImpl<IUsdSdkTools, &IID_IUsdSdkTools, &LIBID_UsdSdkToolsLib, /*wMajor =*/ 1, /*wMinor =*/ 0>,\n\tpublic CComObjectRootEx<CComSingleThreadModel>,\n\tpublic CComCoClass<CUsdSdkToolsImpl, &CLSID_UsdSdkTools>\n{\npublic:\n\tDECLARE_NOT_AGGREGATABLE(CUsdSdkToolsImpl)\n\tDECLARE_PROTECT_FINAL_CONSTRUCT()\n\n\tBEGIN_COM_MAP( CUsdSdkToolsImpl )\n\t\tCOM_INTERFACE_ENTRY( IUsdSdkTools )\n\t\tCOM_INTERFACE_ENTRY2( IDispatch, IUsdSdkTools )\n\tEND_COM_MAP()\n\n\tHRESULT FinalConstruct();\n\tvoid FinalRelease();\n\n\tSTDMETHODIMP Cat( IN BSTR usdStagePathInput, IN BSTR usdStagePathOuput, IN eUsdFormat formatOutput = USD_FORMAT_INPUT, IN VARIANT_BOOL flatten = 0 ) override;\n\tSTDMETHODIMP Edit( IN BSTR usdStagePath, IN VARIANT_BOOL force = 0 ) override;\n\tSTDMETHODIMP Package( IN BSTR usdStagePathInput, IN BSTR usdStagePathOuput, IN eUsdPackageType packageType = USD_PACKAGE_DEFAULT, IN VARIANT_BOOL verbose = 0 ) override;\n\tSTDMETHODIMP DisplayStageStats( IN BSTR usdStagePath ) override;\n\n\tstatic HRESULT WINAPI UpdateRegistry(_In_ BOOL bRegister) throw();\n\nprivate:\n};\n\nOBJECT_ENTRY_AUTO( __uuidof(UsdSdkTools), CUsdSdkToolsImpl )"
  },
  {
    "path": "UsdSdkToolsServer/UsdSdkToolsImpl.rgs",
    "content": "HKCR\n{\n\tNoRemove CLSID\n\t{\n\t\tForceRemove %CLSID_USDSDKTOOLS% = s 'Activision USD SDK Tools Server'\n\t\t{\n\t\t\tLocalServer32 = s '%MODULE%'\n\t\t\tval AppID = s '%APPID%'\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "UsdSdkToolsServer/UsdSdkToolsLocalServer.idl",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport \"oaidl.idl\";\nimport \"ocidl.idl\";\n\ntypedef [uuid(B397354A-F5D9-4835-B584-9524749F7B63), helpstring(\"USD Format\")] \nenum eUsdFormat\n{\n\t[helpstring(\"Same as input file\")]\n\tUSD_FORMAT_INPUT,\n\t[helpstring(\"ASCII\")]\n\tUSD_FORMAT_USDA,\n\t[helpstring(\"Crate\")]\n\tUSD_FORMAT_USDC,\n} eUsdFormat;\n\ntypedef [uuid(266D173D-4142-4CA1-BF25-EC9BC61FDE6A), helpstring(\"USDZ Package Type\")] \nenum eUsdPackageType\n{\n\t[helpstring(\"Default USDZ package.\")]\n\tUSD_PACKAGE_DEFAULT,\n\t[helpstring(\"Apple ARKit USDZ package.\")]\n\tUSD_FORMAT_APPLE_ARKIT\n} eUsdPackageType;\n\n[\n\tuuid(F68344A7-0343-4064-8DA9-7A2ECF6C2D2A),\n\tobject,\n\tnonextensible,\n\toleautomation,\n\thelpstring(\"IUsdSdkTools interface\"),\n\tdual\n]\ninterface IUsdSdkTools : IDispatch\n{\n\t[helpstring(\"Converts between the various USD file formats.\")]\n\tHRESULT Cat( [in] BSTR usdStagePathInput, [in] BSTR usdStagePathOuput, [in, defaultvalue(USD_FORMAT_INPUT)] eUsdFormat formatOutput, [in, defaultvalue(0)] VARIANT_BOOL flatten);\n\n\t[helpstring(\"Launches a text editor for a given USD stage.\")]\n\tHRESULT Edit( [in] BSTR usdStagePath, [in, defaultvalue(0)] VARIANT_BOOL forcewrite);\n\n\t[helpstring(\"Converts a USD stage to a USD package.\")]\n\tHRESULT Package( [in] BSTR usdStagePathInput, [in] BSTR usdStagePathOuput, [in, defaultvalue(USD_PACKAGE_DEFAULT)] eUsdPackageType packageType, [in, defaultvalue(0)] VARIANT_BOOL verbose );\n\n\t[helpstring(\"Displays stats about the USD stage.\")]\n\tHRESULT DisplayStageStats( [in] BSTR usdStagePath );\n}\n\n[\n\tuuid(7704E595-537E-41A0-AF52-53EA2941A773),\n\thelpstring(\"UsdSdkTools Type Library\"),\n\tversion(1.0),\n]\nlibrary UsdSdkToolsLib\n{\n\t[\n\t\tuuid(5F016739-AF12-4899-B710-3FB5C242A11D),\n\t\thelpstring(\"UsdSdkTools Server implementation\")\n\t]\n\tcoclass UsdSdkTools\n\t{\n\t\t[default] interface IUsdSdkTools;\n\t}\n};"
  },
  {
    "path": "UsdSdkToolsServer/UsdSdkToolsLocalServer.rc",
    "content": "// Microsoft Visual C++ generated resource script.\n//\n#include \"resource.h\"\n\n#define APSTUDIO_READONLY_SYMBOLS\n/////////////////////////////////////////////////////////////////////////////\n//\n// Generated from the TEXTINCLUDE 2 resource.\n//\n#include \"winres.h\"\n\n/////////////////////////////////////////////////////////////////////////////\n#undef APSTUDIO_READONLY_SYMBOLS\n\n/////////////////////////////////////////////////////////////////////////////\n// English (United States) resources\n\n#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\nLANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US\n#pragma code_page(1252)\n\n#ifdef APSTUDIO_INVOKED\n/////////////////////////////////////////////////////////////////////////////\n//\n// TEXTINCLUDE\n//\n\n1 TEXTINCLUDE \nBEGIN\n    \"resource.h\\0\"\nEND\n\n2 TEXTINCLUDE \nBEGIN\n    \"#include \"\"winres.h\"\"\\r\\n\"\n    \"\\0\"\nEND\n\n3 TEXTINCLUDE \nBEGIN\n    \"1 TYPELIB \"\"UsdSdkToolsLocalServer.tlb\"\"\\r\\n\"\n    \"\\r\\n\"\n    \"#define ATVI_VERSION_DESCRIPTION \"\"Activision USD SDK Tools Server\"\"\\r\\n\"\n    \"#include \"\"atviversion.rc2\"\"\\r\\n\"\n    \"\\r\\n\"\n    \"\\0\"\nEND\n\n#endif    // APSTUDIO_INVOKED\n\n\n/////////////////////////////////////////////////////////////////////////////\n//\n// REGISTRY\n//\n\nIDR_REGISTRY_MODULE     REGISTRY                \"UsdSdkToolsLocalServerModule.rgs\"\n\nIDR_REGISTRY_USDTOOLSIMPL REGISTRY                \"UsdSdkToolsImpl.rgs\"\n\n\n/////////////////////////////////////////////////////////////////////////////\n//\n// Icon\n//\n\n// Icon with lowest ID value placed first to ensure application icon\n// remains consistent on all systems.\nIDI_ICON_USD            ICON                    \"shared\\\\usd.ico\"\n\n#endif    // English (United States) resources\n/////////////////////////////////////////////////////////////////////////////\n\n\n\n#ifndef APSTUDIO_INVOKED\n/////////////////////////////////////////////////////////////////////////////\n//\n// Generated from the TEXTINCLUDE 3 resource.\n//\n1 TYPELIB \"UsdSdkToolsLocalServer.tlb\"\n\n#define ATVI_VERSION_DESCRIPTION \"Activision USD SDK Tools Server\"\n#include \"atviversion.rc2\"\n\n\n/////////////////////////////////////////////////////////////////////////////\n#endif    // not APSTUDIO_INVOKED\n\n"
  },
  {
    "path": "UsdSdkToolsServer/UsdSdkToolsLocalServer.vcxproj",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup Label=\"ProjectConfigurations\">\n    <ProjectConfiguration Include=\"Debug|x64\">\n      <Configuration>Debug</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release|x64\">\n      <Configuration>Release</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n  </ItemGroup>\n  <PropertyGroup Label=\"Globals\">\n    <VCProjectVersion>16.0</VCProjectVersion>\n    <Keyword>Win32Proj</Keyword>\n    <ProjectGuid>{EA717BDA-3304-439B-BEC8-408D9CE9F3FB}</ProjectGuid>\n    <RootNamespace>UsdSdkToolsLocalServer</RootNamespace>\n    <WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"Configuration\">\n    <ConfigurationType>Application</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v141</PlatformToolset>\n    <WholeProgramOptimization>false</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\" Label=\"Configuration\">\n    <ConfigurationType>Application</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v141</PlatformToolset>\n    <WholeProgramOptimization>false</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n  <Import Project=\"$(SolutionDir)\\atviversion.props\" />\n  <Import Project=\"$(SolutionDir)\\python.props\" />\n  <Import Project=\"$(SolutionDir)\\usd.props\" />\n  <PropertyGroup Label=\"PythonConfiguration\">\n    <RegistryView>RegistryView.Registry32</RegistryView>\n    <RegistryView Condition=\"$(Platform) == 'x64'\">RegistryView.Registry64</RegistryView>\n    <PythonTag>$(PythonVersion)-32</PythonTag>\n    <PythonTag Condition=\"$(Platform) == 'x64'\">$(PythonVersion)</PythonTag>\n    <PythonHome Condition=\"$(PythonHome) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstallPath', null, null, $(RegistryView)))</PythonHome>\n    <PythonHome Condition=\"$(PythonHome) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstallPath', null, null, $(RegistryView)))</PythonHome>\n    <PythonExe Condition=\"$(PythonExe) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstallPath', 'ExecutablePath', null, $(RegistryView)))</PythonExe>\n    <PythonExe Condition=\"$(PythonExe) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstallPath', 'ExecutablePath', null, $(RegistryView)))</PythonExe>\n    <PythonExe Condition=\"$(PythonExe) == '' and $(PythonHome) != ''\">$(PythonHome)python.exe</PythonExe>\n    <PythonDevVersion>$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstalledFeatures', 'dev', null, $(RegistryView)))</PythonDevVersion>\n    <PythonDevVersion Condition=\"$(PythonDevVersion) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstalledFeatures', 'dev', null, $(RegistryView)))</PythonDevVersion>\n    <PythonCorePDBVersion>$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstalledFeatures', 'core_pdb', null, $(RegistryView)))</PythonCorePDBVersion>\n    <PythonCorePDBVersion Condition=\"$(PythonCorePDBVersion) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstalledFeatures', 'core_pdb', null, $(RegistryView)))</PythonCorePDBVersion>\n    <PythonCoreDVersion>$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstalledFeatures', 'core_d', null, $(RegistryView)))</PythonCoreDVersion>\n    <PythonCoreDVersion Condition=\"$(PythonCoreDVersion) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstalledFeatures', 'core_d', null, $(RegistryView)))</PythonCoreDVersion>\n    <PythonDebugSuffix Condition=\"$(PythonCoreDVersion) != ''\">_d</PythonDebugSuffix>\n    <PythonDExe Condition=\"$(PythonExe) != '' and $(PythonDExe) == ''\">$([System.IO.Path]::GetDirectoryName($(PythonExe)))\\python$(PythonDebugSuffix).exe</PythonDExe>\n    <PythonDExe Condition=\"!Exists($(PythonDExe))\">$(PythonExe)</PythonDExe>\n  </PropertyGroup>\n  <ImportGroup Label=\"ExtensionSettings\">\n  </ImportGroup>\n  <ImportGroup Label=\"Shared\">\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <PropertyGroup Label=\"UserMacros\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)bin\\$(PlatformToolset)\\$(PythonTag)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)build\\$(PlatformToolset)\\$(PythonTag)\\$(Configuration)\\$(ProjectName)\\</IntDir>\n    <IgnoreImportLibrary>true</IgnoreImportLibrary>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)bin\\$(PlatformToolset)\\$(PythonTag)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)build\\$(PlatformToolset)\\$(PythonTag)\\$(Configuration)\\$(ProjectName)\\</IntDir>\n    <IgnoreImportLibrary>true</IgnoreImportLibrary>\n  </PropertyGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <SDLCheck>true</SDLCheck>\n      <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <ConformanceMode>true</ConformanceMode>\n    </ClCompile>\n    <Link>\n      <SubSystem>Console</SubSystem>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <SDLCheck>true</SDLCheck>\n      <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <ConformanceMode>true</ConformanceMode>\n    </ClCompile>\n    <Link>\n      <SubSystem>Console</SubSystem>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <ClCompile>\n      <WarningLevel>Level4</WarningLevel>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <SDLCheck>true</SDLCheck>\n      <PreprocessorDefinitions>_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <ConformanceMode>false</ConformanceMode>\n      <PrecompiledHeader>Use</PrecompiledHeader>\n      <InlineFunctionExpansion>Disabled</InlineFunctionExpansion>\n      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n      <AdditionalIncludeDirectories>$(SolutionDir);$(PythonHome)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <Optimization>Disabled</Optimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <EnableCOMDATFolding>false</EnableCOMDATFolding>\n      <OptimizeReferences>false</OptimizeReferences>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(PythonHome)libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>Pathcch.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <DelayLoadDLLs>\n      </DelayLoadDLLs>\n    </Link>\n    <ResourceCompile>\n      <AdditionalIncludeDirectories>$(OutDir);$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n    </ResourceCompile>\n    <Midl>\n      <InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>\n      <MkTypLibCompatible>false</MkTypLibCompatible>\n      <ValidateAllParameters>true</ValidateAllParameters>\n      <WarningLevel>0</WarningLevel>\n      <EnableErrorChecks>All</EnableErrorChecks>\n      <TypeLibraryName>$(OutDir)$(ProjectName).tlb</TypeLibraryName>\n    </Midl>\n    <PostBuildEvent>\n      <Command>%(Command)</Command>\n    </PostBuildEvent>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\n    <ClCompile>\n      <WarningLevel>Level4</WarningLevel>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <SDLCheck>true</SDLCheck>\n      <PreprocessorDefinitions>_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <ConformanceMode>false</ConformanceMode>\n      <PrecompiledHeader>Use</PrecompiledHeader>\n      <AdditionalIncludeDirectories>$(SolutionDir);$(PythonHome)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <Optimization>MaxSpeed</Optimization>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <EnableCOMDATFolding>false</EnableCOMDATFolding>\n      <OptimizeReferences>false</OptimizeReferences>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(PythonHome)libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>Pathcch.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <DelayLoadDLLs>\n      </DelayLoadDLLs>\n    </Link>\n    <ResourceCompile>\n      <AdditionalIncludeDirectories>$(OutDir);$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n    </ResourceCompile>\n    <Midl>\n      <InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>\n      <MkTypLibCompatible>false</MkTypLibCompatible>\n      <ValidateAllParameters>true</ValidateAllParameters>\n      <WarningLevel>0</WarningLevel>\n      <EnableErrorChecks>All</EnableErrorChecks>\n      <TypeLibraryName>$(OutDir)$(ProjectName).tlb</TypeLibraryName>\n    </Midl>\n    <PostBuildEvent>\n      <Command>%(Command)</Command>\n    </PostBuildEvent>\n  </ItemDefinitionGroup>\n  <ItemGroup>\n    <ClInclude Include=\"..\\shared\\environment.h\" />\n    <ClInclude Include=\"..\\shared\\EventViewerLog.h\" />\n    <ClInclude Include=\"..\\shared\\EventViewerMessages.h\" />\n    <ClInclude Include=\"resource.h\" />\n    <ClInclude Include=\"stdafx.h\" />\n    <ClInclude Include=\"Module.h\" />\n    <ClInclude Include=\"UsdSdkToolsImpl.h\" />\n    <ClInclude Include=\"UsdSdkToolsLocalServer_h.h\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"..\\shared\\environment.cpp\" />\n    <ClCompile Include=\"stdafx.cpp\">\n      <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">Create</PrecompiledHeader>\n      <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">Create</PrecompiledHeader>\n    </ClCompile>\n    <ClCompile Include=\"Module.cpp\" />\n    <ClCompile Include=\"UsdSdkToolsImpl.cpp\" />\n    <ClCompile Include=\"UsdSdkToolsLocalServer_i.c\">\n      <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">NotUsing</PrecompiledHeader>\n      <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">NotUsing</PrecompiledHeader>\n    </ClCompile>\n  </ItemGroup>\n  <ItemGroup>\n    <None Include=\"UsdSdkToolsImpl.rgs\" />\n    <None Include=\"UsdSdkToolsLocalServerModule.rgs\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Midl Include=\"UsdSdkToolsLocalServer.idl\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ResourceCompile Include=\"UsdSdkToolsLocalServer.rc\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Image Include=\"..\\shared\\usd.ico\" />\n    <Image Include=\"shared\\usd.ico\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"..\\shared\\EventViewerMessages.vcxproj\">\n      <Project>{f12e597b-b731-4f5a-bec3-980d20159320}</Project>\n    </ProjectReference>\n  </ItemGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\n  <ImportGroup Label=\"ExtensionTargets\">\n  </ImportGroup>\n</Project>"
  },
  {
    "path": "UsdSdkToolsServer/UsdSdkToolsLocalServer.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup>\n    <Filter Include=\"Source Files\">\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\n      <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\n    </Filter>\n    <Filter Include=\"Header Files\">\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\n      <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>\n    </Filter>\n    <Filter Include=\"Resource Files\">\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\n    </Filter>\n    <Filter Include=\"Shared\">\n      <UniqueIdentifier>{a27a5032-5dc7-4c59-b490-e65c0cc5fee0}</UniqueIdentifier>\n    </Filter>\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"stdafx.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"resource.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"Module.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"..\\shared\\environment.h\">\n      <Filter>Shared</Filter>\n    </ClInclude>\n    <ClInclude Include=\"..\\shared\\EventViewerLog.h\">\n      <Filter>Shared</Filter>\n    </ClInclude>\n    <ClInclude Include=\"UsdSdkToolsImpl.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"UsdSdkToolsLocalServer_h.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"..\\shared\\EventViewerMessages.h\">\n      <Filter>Shared</Filter>\n    </ClInclude>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"stdafx.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"Module.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"..\\shared\\environment.cpp\">\n      <Filter>Shared</Filter>\n    </ClCompile>\n    <ClCompile Include=\"UsdSdkToolsImpl.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"UsdSdkToolsLocalServer_i.c\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n  </ItemGroup>\n  <ItemGroup>\n    <None Include=\"UsdSdkToolsImpl.rgs\">\n      <Filter>Resource Files</Filter>\n    </None>\n    <None Include=\"UsdSdkToolsLocalServerModule.rgs\">\n      <Filter>Resource Files</Filter>\n    </None>\n  </ItemGroup>\n  <ItemGroup>\n    <Midl Include=\"UsdSdkToolsLocalServer.idl\">\n      <Filter>Source Files</Filter>\n    </Midl>\n  </ItemGroup>\n  <ItemGroup>\n    <ResourceCompile Include=\"UsdSdkToolsLocalServer.rc\">\n      <Filter>Resource Files</Filter>\n    </ResourceCompile>\n  </ItemGroup>\n  <ItemGroup>\n    <Image Include=\"..\\shared\\usd.ico\">\n      <Filter>Shared</Filter>\n    </Image>\n    <Image Include=\"shared\\usd.ico\">\n      <Filter>Resource Files</Filter>\n    </Image>\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "UsdSdkToolsServer/UsdSdkToolsLocalServerModule.rgs",
    "content": "HKCU\n{\n\tNoRemove AppID\n\t{\n\t\t'%APPID%' = s 'UsdSdkToolsLocalServer'\n\t\t'UsdSdkToolsLocalServer.exe'\n\t\t{\n\t\t\tval AppID = s '%APPID%'\n\t\t}\n\t}\n}\n\n"
  },
  {
    "path": "UsdSdkToolsServer/resource.h",
    "content": "//{{NO_DEPENDENCIES}}\n// Microsoft Visual C++ generated include file.\n// Used by UsdSdkToolsLocalServer.rc\n//\n#define IDR_REGISTRY_MODULE             101\n#define IDR_REGISTRY_USDTOOLSIMPL       102\n#define IDI_ICONUSD                     106\n#define IDI_ICON_USD                    106\n#define IDR_PYTHON_PREVIEWHANLDER       107\n#define IDR_REGISTRY_THUMBNAILIMPL      108\n#define IDR_REGISTRY_USDTHUMBNAILIMPL   108\n#define IDD_DIALOG1                     109\n\n// Next default values for new objects\n// \n#ifdef APSTUDIO_INVOKED\n#ifndef APSTUDIO_READONLY_SYMBOLS\n#define _APS_NEXT_RESOURCE_VALUE        111\n#define _APS_NEXT_COMMAND_VALUE         40001\n#define _APS_NEXT_CONTROL_VALUE         1004\n#define _APS_NEXT_SYMED_VALUE           101\n#endif\n#endif\n"
  },
  {
    "path": "UsdSdkToolsServer/stdafx.cpp",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include \"stdafx.h\""
  },
  {
    "path": "UsdSdkToolsServer/stdafx.h",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#pragma once\n\n#ifndef STRICT\n#define STRICT\n#endif\n\n#include <WinSDKVer.h>\n#define _WIN32_WINNT 0x0A00\n#include <SDKDDKVer.h>\n\n#define _ATL_APARTMENT_THREADED\n#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS\t// some CString constructors will be explicit\n#define ATL_NO_ASSERT_ON_DESTROY_NONEXISTENT_WINDOW\n// Use the C++ standard templated min/max\n#define NOMINMAX\n#define NOBITMAP\n// Include <mcx.h> if you need this\n#define NOMCX\n// Include <winsvc.h> if you need this\n#define NOSERVICE\n\n#include <windows.h>\n#include <PathCch.h>\n\n#pragma warning( push )\n#pragma warning( disable : 4244 4305 5033 4100 4201 4245 4127 )\n\n#include <pxr/usd/usd/stage.h>\n#include <pxr/usd/usd/prim.h>\n#include <pxr/usd/sdf/tokens.h>\n#include <pxr/base/plug/registry.h>\n#include <pxr/usd/usdUtils/introspection.h>\n#include <pxr/usd/sdf/fileFormat.h>\n#include <pxr/usd/usd/usdFileFormat.h>\n#include <pxr/usd/usd/usdaFileFormat.h>\n#include <pxr/usd/ar/defaultResolver.h>\n#include <pxr/usd/ar/defaultResolverContext.h>\n#include <pxr/usd/ar/defineResolver.h>\n#include <pxr/usd/ar/filesystemAsset.h>\n#include <pxr/usd/usdUtils/dependencies.h>\n#include <pxr/base/arch/fileSystem.h>\n\n\n#pragma warning( pop )\n\n#include <atlbase.h>\n#include <atlcom.h>\n#include <atlconv.h>\n#include <atlctl.h>\n#include <atlstr.h>\n#include <atlsafe.h>\n#include <comutil.h>\n\n#include <stdint.h>\n#include <conio.h>\n#include <iostream>\n#include <fstream>"
  },
  {
    "path": "UsdShellExtension/ArResolverShellExtension.cpp",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include \"stdafx.h\"\n#include \"ArResolverShellExtension.h\"\n\n// NOTE\n// /Zc:inline- is set for this file in the vcxproj\n// Enabling /Zc:inline strips out USD plug-in registration\n// https://developercommunity.visualstudio.com/t/zcinline-removes-extern-symbols-inside-anonymous-n/914943\n\nPXR_NAMESPACE_OPEN_SCOPE\n\nAR_DEFINE_RESOLVER(ArResolverShellExtension, ArResolver)\n\nstd::shared_ptr<ArAsset> ArResolverShellExtension::OpenAsset(const std::string& resolvedPath)\n{\n\t// Deny writes.\n\t// The shell extension is used by many processes and threads at the same time. \n\t// fopen on Windows will allow writes with reads\n\tFILE* f = _wfsopen( ATL::CA2W( resolvedPath.c_str(), CP_UTF8 ), L\"rb\", _SH_SECURE );\n\tif (!f) {\n\t\treturn nullptr;\n\t}\n\n\treturn std::shared_ptr<ArAsset>(new ArFilesystemAsset(f));\n}\n\nPXR_NAMESPACE_CLOSE_SCOPE\n\n"
  },
  {
    "path": "UsdShellExtension/ArResolverShellExtension.h",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#pragma once\n\nPXR_NAMESPACE_OPEN_SCOPE\n\nclass ArResolverShellExtension : public ArDefaultResolver\n{\npublic:\n\tstd::shared_ptr<ArAsset> OpenAsset( const std::string &resolvedPath ) override;\n};\n\nPXR_NAMESPACE_CLOSE_SCOPE"
  },
  {
    "path": "UsdShellExtension/Module.cpp",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include \"stdafx.h\"\n#include \"Module.h\"\n#include \"resource.h\"\n#include \"shared/EventViewerMessages.h\"\n#include \"shared/EventViewerLog.h\"\n#include \"shared/environment.h\"\n\n#include <fstream>\n\n#include <Python.h>\n\nHMODULE g_hInstance;\nCShellExtModule g_AtlModule;\n\nBOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved )\n{\n\tswitch ( ul_reason_for_call )\n\t{\n\tcase DLL_PROCESS_ATTACH:\n\t\tg_hInstance = hModule;\n\t\tbreak;\n\t}\n\n\treturn g_AtlModule.DllMain( ul_reason_for_call, lpReserved );\n}\n\nstatic bool s_bSilent = true;\nstatic bool s_bVerify = true;\n\nstatic std::vector<CString> TranslatePathsToList(LPCTSTR paths)\n{\n\tstd::vector<CString> pathList;\n\tCString sPaths(paths);\n\n\tCString sToken;\n\tint pos = 0;\n\tsToken = sPaths.Tokenize(_T(\";\"), pos);\n\tif ( !sToken.IsEmpty() )\n\t{\n\t\twhile ( !sToken.IsEmpty() )\n\t\t{\n\t\t\tpathList.push_back( sToken );\n\t\t\tsToken = sPaths.Tokenize( _T( \";\" ), pos );\n\t\t}\n\t}\n\telse\n\t{\n\t\tpathList.push_back( paths );\n\t}\n\n\treturn pathList;\n}\n\nstatic bool GetPythonInstallationPath( LPTSTR sBuffer, DWORD nBufferSizeInChars )\n{\n\tstd::vector<CStringW> ConfigFileList = BuildConfigFileList( g_hInstance );\n\n\tCStringW sPythonPath;\n\tGetPrivateProfileStringAndExpandEnvironmentStrings( L\"PYTHON\", L\"PATH\", L\"\", sPythonPath, ConfigFileList );\n\twcscpy_s( sBuffer, nBufferSizeInChars, sPythonPath );\n\n\tif ( sBuffer[0] == '\\0' )\n\t{\n#if PY_MAJOR_VERSION >= 3\n\t\tCString sPythonRegKeyInstallPath;\n\t\tsPythonRegKeyInstallPath.Format( _T( \"SOFTWARE\\\\Python\\\\PythonCore\\\\%hs\\\\InstallPath\" ), _CRT_STRINGIZE(PYTHONVERSION) );\n\n\t\tLSTATUS ls;\n\n\t\tCRegKey regPythonInstallPath;\n\t\tls = regPythonInstallPath.Open( HKEY_CURRENT_USER, sPythonRegKeyInstallPath, KEY_READ );\n\t\tif ( ls != ERROR_SUCCESS )\n\t\t\treturn false;\n\n\t\tULONG nChars = nBufferSizeInChars;\n\t\tls = regPythonInstallPath.QueryStringValue( _T(\"\"), sBuffer, &nChars );\n\t\tif ( ls != ERROR_SUCCESS )\n\t\t\treturn false;\n#elif (PY_MAJOR_VERSION == 2) && (PY_MINOR_VERSION == 7)\n\t\t_tcscpy_s(sBuffer, nBufferSizeInChars, _T(\"C:\\\\Python27\\\\\"));\n#endif\n\t}\n\telse\n\t{\n\t\tstd::vector<CString> pathList = TranslatePathsToList( sBuffer );\n\t\twcscpy_s( sBuffer, nBufferSizeInChars, pathList[0] );\n\t}\n\n\treturn true;\n\n}\n\nstatic bool VerifyPythonInstallation()\n{\n\tTCHAR sPython_Path[2048];\n\tGetPythonInstallationPath( sPython_Path, ARRAYSIZE( sPython_Path ) );\n\t\n#if PY_MAJOR_VERSION >= 3\n\t::PathCchAppend( sPython_Path, ARRAYSIZE(sPython_Path), _T( PYTHONDLL ) );\n\tif ( ::GetFileAttributesW( sPython_Path ) == INVALID_FILE_ATTRIBUTES )\n\t\treturn false;\n#else\n\tDWORD nAttrib = ::GetFileAttributesW( sPython_Path );\n\tif ( nAttrib == INVALID_FILE_ATTRIBUTES || (nAttrib & FILE_ATTRIBUTE_DIRECTORY) == 0 )\n\t\treturn false;\n#endif\n\n\treturn true;\n}\n\nstatic bool VerifyPyOpenGLInstallation()\n{\n\tTCHAR sPython_Path[2048];\n\tGetPythonInstallationPath( sPython_Path, ARRAYSIZE( sPython_Path ) );\n\n\t::PathCchAppend( sPython_Path, ARRAYSIZE(sPython_Path), L\"Lib\" );\n\t::PathCchAppend( sPython_Path, ARRAYSIZE(sPython_Path), L\"site-packages\" );\n\t::PathCchAppend( sPython_Path, ARRAYSIZE(sPython_Path), L\"OpenGL\" );\n\n\tif ( ::GetFileAttributesW( sPython_Path ) == INVALID_FILE_ATTRIBUTES )\n\t\treturn false;\n\n\treturn true;\n}\n\nstatic bool VerifyPySideInstallation()\n{\n\tTCHAR sPython_Path[2048];\n\tGetPythonInstallationPath( sPython_Path, ARRAYSIZE( sPython_Path ) );\n\n\t::PathCchAppend( sPython_Path, ARRAYSIZE(sPython_Path), L\"Lib\" );\n\t::PathCchAppend( sPython_Path, ARRAYSIZE(sPython_Path), L\"site-packages\" );\n\t::PathCchAppend( sPython_Path, ARRAYSIZE(sPython_Path), L\"PySide\" );\n\n\tif ( ::GetFileAttributesW( sPython_Path ) == INVALID_FILE_ATTRIBUTES )\n\t\treturn false;\n\n\treturn true;\n}\n\nstatic bool VerifyPySide2Installation()\n{\n\tTCHAR sPython_Path[2048];\n\tGetPythonInstallationPath( sPython_Path, ARRAYSIZE( sPython_Path ) );\n\n\t::PathCchAppend( sPython_Path, ARRAYSIZE(sPython_Path), L\"Lib\" );\n\t::PathCchAppend( sPython_Path, ARRAYSIZE(sPython_Path), L\"site-packages\" );\n\t::PathCchAppend( sPython_Path, ARRAYSIZE(sPython_Path), L\"PySide2\" );\n\n\tif ( ::GetFileAttributesW( sPython_Path ) == INVALID_FILE_ATTRIBUTES )\n\t\treturn false;\n\n\treturn true;\n}\n\nstatic HRESULT RegisterPropDescFile( LPCTSTR sFileName, UINT nResourceId )\n{\n\tHRSRC hrscPd = ::FindResource( g_hInstance, MAKEINTRESOURCE( nResourceId ), _T(\"XML\") );\n\tif ( hrscPd == nullptr )\n\t\treturn E_INVALIDARG;\n\n\tHGLOBAL hPd = ::LoadResource( g_hInstance, hrscPd );\n\tif ( hPd == nullptr )\n\t\treturn E_INVALIDARG;\n\n\tvoid* pXMLData = ::LockResource( hPd );\n\tif ( pXMLData == nullptr )\n\t\treturn E_INVALIDARG;\n\n\tDWORD nSize = SizeofResource( g_hInstance, hrscPd );\n\n\tCStringA sPropDesc;\n\tsPropDesc.SetString( reinterpret_cast<LPCSTR>(pXMLData), nSize );\n\n\tTCHAR sPath[MAX_PATH];\n\t::GetModuleFileName( g_hInstance, sPath, ARRAYSIZE( sPath ) );\n\n\tsPropDesc.Replace( \"%MODULE%\", ATL::CW2A( sPath, CP_UTF8 ) );\n\tsPropDesc.Replace( \"%LANGMODULE%\", ATL::CW2A( sPath, CP_UTF8 ) );\n\n\tsPropDesc.Replace( \"%IDS_USD_PROPGROUP_USD_LABEL%\", _CRT_STRINGIZE( IDS_USD_PROPGROUP_USD_LABEL ) );\n\tsPropDesc.Replace( \"%IDS_USD_DOCUMENTATION_LABEL%\", _CRT_STRINGIZE( IDS_USD_DOCUMENTATION_LABEL ) );\n\tsPropDesc.Replace( \"%IDS_USD_DOCUMENTATION_INVITATIONTEXT%\", _CRT_STRINGIZE( IDS_USD_DOCUMENTATION_INVITATIONTEXT ) );\n\tsPropDesc.Replace( \"%IDS_USD_DOCUMENTATION_MNEMONICS%\", _CRT_STRINGIZE( IDS_USD_DOCUMENTATION_MNEMONICS ) );\n\n\tsPropDesc.Replace( \"%IDS_USD_CUSTOMLAYERDATA_LABEL%\", _CRT_STRINGIZE( IDS_USD_CUSTOMLAYERDATA_LABEL ) );\n\tsPropDesc.Replace( \"%IDS_USD_CUSTOMLAYERDATA_MNEMONICS%\", _CRT_STRINGIZE( IDS_USD_CUSTOMLAYERDATA_MNEMONICS ) );\n\n\t::PathCchRemoveFileSpec( sPath, ARRAYSIZE( sPath ) );\n\t::PathCchAppend( sPath, ARRAYSIZE( sPath ), sFileName );\n\n\tstd::ofstream fileOut( sPath, std::ofstream::out | std::ofstream::trunc | std::ofstream::binary );\n\tif (!fileOut.is_open())\n\t\treturn E_FAIL;\n\n\tfileOut << sPropDesc;\n\n\tfileOut.close();\n\n\tHRESULT hr;\n\thr = PSRegisterPropertySchema( sPath );\n\n\treturn hr;\n}\n\nstatic HRESULT UnregisterPropDescFile( LPCTSTR sFileName )\n{\n\tTCHAR sPath[MAX_PATH];\n\t::GetModuleFileName( g_hInstance, sPath, ARRAYSIZE( sPath ) );\n\t::PathCchRemoveFileSpec( sPath, ARRAYSIZE( sPath ) );\n\t::PathCchAppend( sPath, ARRAYSIZE( sPath ), sFileName );\n\n\tHRESULT hr;\n\thr = PSUnregisterPropertySchema( sPath );\n\n\treturn hr;\n}\n\nstatic HRESULT InstallEventSource()\n{\n\tTCHAR sPath[MAX_PATH];\n\t::GetModuleFileName( g_hInstance, sPath, ARRAYSIZE( sPath ) );\n\n\tLSTATUS ls;\n\tCRegKey regEventLog;\n\tls = regEventLog.Create( HKEY_LOCAL_MACHINE, _T( \"System\\\\CurrentControlSet\\\\Services\\\\Eventlog\\\\Application\\\\\" ) _T( EVENTLOG_SOURCE ) );\n\tif ( ls != ERROR_SUCCESS )\n\t\treturn E_FAIL;\n\n\tDWORD TypesSupported = \n\t\tEVENTLOG_SUCCESS |\n\t\tEVENTLOG_ERROR_TYPE | \n\t\tEVENTLOG_WARNING_TYPE | \n\t\tEVENTLOG_INFORMATION_TYPE;\n\n\tregEventLog.SetDWORDValue( _T( \"TypesSupported\" ), TypesSupported );\n\tregEventLog.SetStringValue( _T( \"EventMessageFile\" ), sPath );\n\tregEventLog.SetStringValue( _T( \"CategoryMessageFile\" ), sPath );\n\tregEventLog.SetDWORDValue( _T( \"CategoryCount\" ), CATEGORY_COUNT );\n\n\treturn S_OK;\n}\n\nstatic HRESULT UninstallEventSource()\n{\n\tLSTATUS ls;\n\tCRegKey regEventLog;\n\tls = regEventLog.Open( HKEY_LOCAL_MACHINE, _T( \"System\\\\CurrentControlSet\\\\Services\\\\Eventlog\\\\Application\" ) );\n\tif ( ls != ERROR_SUCCESS )\n\t\treturn E_FAIL;\n\n\tls = regEventLog.RecurseDeleteKey( _T( EVENTLOG_SOURCE ) );\n\tif ( ls != ERROR_SUCCESS )\n\t\treturn E_FAIL;\n\n\treturn S_OK;\n}\n\n// Called to register/install this shell extension.\n// Typically called from regsvr32.exe\nSTDAPI DllRegisterServer()\n{\n\tHRESULT hr;\n\n\tif ( s_bVerify )\n\t{\n\t\tif ( !VerifyPythonInstallation() )\n\t\t{\n\t\t\tif ( s_bSilent == false )\n\t\t\t{\n\t\t\t\t::MessageBox( nullptr, \n\t\t\t\t\t_T( \"Python \" ) _T( _CRT_STRINGIZE(PYTHONVERSION) ) _T( \" is not installed on this system. It is required to run this shell extension.\\n\\n\" )\n\t\t\t\t\t_T( \"Download and install Python \" ) _T( _CRT_STRINGIZE(PYTHONVERSION) ) _T( \" from python.org\" ), \n\t\t\t\t\t_T( \"Python \" ) _T( _CRT_STRINGIZE(PYTHONVERSION) ) _T( \" Not Installed\" ), \n\t\t\t\t\tMB_ICONERROR );\n\t\t\t}\n\n\t\t\treturn E_PYTHON_NOT_INSTALLED;\n\t\t}\n\n\t\tif ( !VerifyPyOpenGLInstallation() )\n\t\t{\n\t\t\tif ( s_bSilent == false )\n\t\t\t{\n\t\t\t\t::MessageBox( nullptr, \n\t\t\t\t\t_T( \"Python \" ) _T( _CRT_STRINGIZE(PYTHONVERSION) ) _T( \" pyOpenGL is not installed on this system. It is required to run this shell extension.\\n\\n\" )\n\t\t\t\t\t_T( \"Run the following command from a Python \" ) _T( _CRT_STRINGIZE(PYTHONVERSION) ) _T( \" command prompt.\\n\\n\" )\n\t\t\t\t\t_T( \"pip install pyOpenGL\" ), \n\t\t\t\t\t_T( \"Python \" ) _T( _CRT_STRINGIZE(PYTHONVERSION) ) _T( \" pyOpenGL Not Installed\" ), \n\t\t\t\t\tMB_ICONERROR );\n\t\t\t}\n\n\t\t\treturn E_PYOPENGL_NOT_INSTALLED;\n\t\t}\n\n#if PY_MAJOR_VERSION >= 3\n\t\tif ( !VerifyPySide2Installation() )\n\t\t{\n\t\t\tif ( s_bSilent == false )\n\t\t\t{\n\t\t\t\t::MessageBox( nullptr, \n\t\t\t\t\t_T( \"Python \" ) _T( _CRT_STRINGIZE(PYTHONVERSION) ) _T( \" pySide2 is not installed on this system. It is required to run this shell extension.\\n\\n\" )\n\t\t\t\t\t_T( \"Run the following command from a Python \" ) _T( _CRT_STRINGIZE(PYTHONVERSION) ) _T( \" command prompt.\\n\\n\" )\n\t\t\t\t\t_T( \"pip install pySide2\" ), \n\t\t\t\t\t_T( \"Python \" ) _T( _CRT_STRINGIZE(PYTHONVERSION) ) _T( \" pySide2 Not Installed\" ), \n\t\t\t\t\tMB_ICONERROR );\n\t\t\t}\n\n\t\t\treturn E_PYSIDE2_NOT_INSTALLED;\n\t\t}\n#else\n\t\tif ( !VerifyPySideInstallation() )\n\t\t{\n\t\t\tif ( s_bSilent == false )\n\t\t\t{\n\t\t\t\t::MessageBox( nullptr, \n\t\t\t\t\t_T( \"Python \" ) _T( _CRT_STRINGIZE(PYTHONVERSION) ) _T( \" pySide is not installed on this system. It is required to run this shell extension.\\n\\n\" )\n\t\t\t\t\t_T( \"Run the following command from a Python \" ) _T( _CRT_STRINGIZE(PYTHONVERSION) ) _T( \" command prompt.\\n\\n\" )\n\t\t\t\t\t_T( \"pip install pySide\" ), \n\t\t\t\t\t_T( \"Python \" ) _T( _CRT_STRINGIZE(PYTHONVERSION) ) _T( \" pySide Not Installed\" ), \n\t\t\t\t\tMB_ICONERROR );\n\t\t\t}\n\n\t\t\treturn E_PYSIDE2_NOT_INSTALLED;\n\t\t}\n#endif\n\t}\n\n\thr = RegisterPropDescFile(_T(\"UsdPropertyKeys.propdesc\"), IDR_XML_PROPDESC_USD);\n\tif ( FAILED( hr ) )\n\t{\n\t\tif ( s_bSilent == false )\n\t\t{\n\t\t\tCString sError;\n\t\t\tsError.Format( \n\t\t\t\t_T( \"Failed to install UsdPropertyKeys.propdesc.\\n\\n\" )\n\t\t\t\t_T( \"Error: 0x%.8X\" ), \n\t\t\t\thr );\n\n\t\t\t::MessageBox( nullptr, \n\t\t\t\tsError,\n\t\t\t\t_T( \"PSRegisterPropertySchema Failed\" ), \n\t\t\t\tMB_ICONERROR );\n\t\t}\n\t\treturn hr;\n\t}\n\n\thr = InstallEventSource();\n\tif ( FAILED( hr ) )\n\t{\n\t\treturn hr;\n\t}\n\n\thr = g_AtlModule.DllRegisterServer( FALSE );\n\tif ( FAILED( hr ) )\n\t{\n\t\treturn hr;\n\t}\n\n\thr = g_AtlModule.UpdateRegistry( TRUE );\n\tif ( FAILED( hr ) )\n\t{\n\t\treturn hr;\n\t}\n\n\t// notify the shell that we have updated handlers\n\tSHChangeNotify( SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL );\n\n\treturn S_OK;\n}\n\n// Called to unregister/uninstall this shell extension.\n// Typically called from regsvr32.exe /u\nSTDAPI DllUnregisterServer()\n{\n\tg_AtlModule.DllUnregisterServer( FALSE );\n\tg_AtlModule.UpdateRegistry( FALSE );\n\n\tUnregisterPropDescFile( _T( \"UsdPropertyKeys.propdesc\" ) );\n\n\tUninstallEventSource();\n\n\t// notify the shell that we have updated handlers\n\tSHChangeNotify( SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL );\n\n\treturn S_OK;\n}\n\n// Called to return an instance of a COM class we registered\nSTDAPI DllGetClassObject( REFCLSID rclsid, REFIID riid, void **ppv )\n{\n\tHRESULT hr = g_AtlModule.DllGetClassObject( rclsid, riid, ppv );\n\treturn hr;\n}\n\n// Called to determine if the DLL can be unloaded\n// True if all COM references are at 0\nSTDAPI DllCanUnloadNow()\n{\n\treturn g_AtlModule.DllCanUnloadNow();\n}\n\nSTDAPI DllInstall( BOOL bInstall, PCWSTR pszCmdLine )\n{\n\tCoInitialize( nullptr );\n\n\tCCommandLineArgs args;\n\targs.argv = ::CommandLineToArgvW( pszCmdLine, &args.argc );\n\n\ts_bSilent = false;\n\tfor ( int arg = 0; arg < args.argc; ++arg )\n\t{\n\t\tif ( _wcsicmp( args.argv[arg], L\"-silent\" ) == 0 )\n\t\t\ts_bSilent = true;\n\t\telse if ( _wcsicmp( args.argv[arg], L\"-s\" ) == 0 )\n\t\t\ts_bSilent = true;\n\t\telse if ( _wcsicmp( args.argv[arg], L\"/silent\" ) == 0 )\n\t\t\ts_bSilent = true;\n\t\telse if ( _wcsicmp( args.argv[arg], L\"/s\" ) == 0 )\n\t\t\ts_bSilent = true;\n\t\telse if ( _wcsicmp( args.argv[arg], L\"-force\" ) == 0 )\n\t\t\ts_bVerify = false;\n\t\telse if ( _wcsicmp( args.argv[arg], L\"-f\" ) == 0 )\n\t\t\ts_bVerify = false;\n\t\telse if ( _wcsicmp( args.argv[arg], L\"/force\" ) == 0 )\n\t\t\ts_bVerify = false;\n\t\telse if ( _wcsicmp( args.argv[arg], L\"/f\" ) == 0 )\n\t\t\ts_bVerify = false;\n\t}\n\n\tif ( bInstall )\n\t\treturn DllRegisterServer();\n\n\treturn DllUnregisterServer();\n}\n\nHRESULT WINAPI CShellExtModule::UpdateRegistry( _In_ BOOL bRegister ) throw()\n{\n\tATL::_ATL_REGMAP_ENTRY regMapEntries[] =\n\t{\n\t\t{ L\"IDS_FILE_USD\", _CRT_WIDE(_CRT_STRINGIZE(IDS_FILE_USD)) },\n\t\t{ L\"IDS_FILE_USDA\", _CRT_WIDE(_CRT_STRINGIZE(IDS_FILE_USDA)) },\n\t\t{ L\"IDS_FILE_USDC\", _CRT_WIDE(_CRT_STRINGIZE(IDS_FILE_USDC)) },\n\t\t{ L\"IDS_FILE_USDZ\", _CRT_WIDE(_CRT_STRINGIZE(IDS_FILE_USDZ)) },\n\t\t{ L\"IDI_ICON_USD\", _CRT_WIDE(_CRT_STRINGIZE(IDI_ICON_USD)) },\n\t\t{ L\"IDS_SHELL_VIEW\", _CRT_WIDE(_CRT_STRINGIZE(IDS_SHELL_VIEW)) },\n\t\t{ L\"IDS_SHELL_EDIT\", _CRT_WIDE(_CRT_STRINGIZE(IDS_SHELL_EDIT)) },\n\t\t{ L\"IDS_SHELL_CRATE\", _CRT_WIDE(_CRT_STRINGIZE(IDS_SHELL_CRATE)) },\n\t\t{ L\"IDS_SHELL_UNCRATE\", _CRT_WIDE(_CRT_STRINGIZE(IDS_SHELL_UNCRATE)) },\n\t\t{ L\"IDS_SHELL_FLATTEN\", _CRT_WIDE(_CRT_STRINGIZE(IDS_SHELL_FLATTEN)) },\n\t\t{ L\"IDS_SHELL_REFRESHTHUMBNAIL\", _CRT_WIDE(_CRT_STRINGIZE(IDS_SHELL_REFRESHTHUMBNAIL)) },\n\t\t{ L\"IDS_SHELL_STATS\", _CRT_WIDE(_CRT_STRINGIZE(IDS_SHELL_STATS)) },\n\t\t{ nullptr, nullptr }\n\t};\n\n\treturn g_AtlModule.UpdateRegistryFromResource(IDR_REGISTRY_MODULE, bRegister, regMapEntries);\n}"
  },
  {
    "path": "UsdShellExtension/Module.h",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#pragma once\n\n#include \"ShellExt_h.h\"\n#include \"resource.h\"\n\n// Using an ATL module here because it removes a lot of the \n// boiler-plate COM work that we would have to implement ourselves.\n\nclass CShellExtModule : public CAtlDllModuleT<CShellExtModule>\n{\npublic:\n\tDECLARE_LIBID( LIBID_UsdShellExtensionLib )\n\n\tstatic HRESULT WINAPI UpdateRegistry(_In_ BOOL bRegister) throw();\n};\n\nextern CShellExtModule g_AtlModule;\nextern HMODULE g_hInstance;\n\n#define E_PYTHON_NOT_INSTALLED\t\tMAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0200)\n#define E_PYOPENGL_NOT_INSTALLED\tMAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0201)\n#define E_PYSIDE2_NOT_INSTALLED\t\tMAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0202)\n\nclass CCommandLineArgs\n{\npublic:\n\t~CCommandLineArgs()\n\t{\n\t\tif ( argv )\n\t\t\tLocalFree( argv );\n\t}\n\n\tint argc = 0;\n\tLPWSTR *argv = nullptr;\n};\n\n"
  },
  {
    "path": "UsdShellExtension/ShellExecute.cpp",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include \"stdafx.h\"\n#include \"Module.h\"\n\n#pragma warning(push)\n#pragma warning(disable:4192 4278 4471)\n#import \"UsdPythonToolsLocalServer.tlb\" raw_interfaces_only \n#import \"UsdSdkToolsLocalServer.tlb\" raw_interfaces_only \n#pragma warning(pop)\n\nstatic bool GetRendererFromConfig( LPCTSTR system, CComBSTR &outBstr )\n{\n\tTCHAR sModulePath[MAX_PATH];\n\t::GetModuleFileName( g_hInstance, sModulePath, ARRAYSIZE( sModulePath ) );\n\t::PathCchRenameExtension( sModulePath, ARRAYSIZE( sModulePath ), L\"cfg\" );\n\t\n\tTCHAR sRenderer[128];\n\tsRenderer[0] = '\\0';\n\t::GetPrivateProfileString( _T( \"RENDERER\" ), system, _T( \"\" ), sRenderer, ARRAYSIZE( sRenderer ), sModulePath );\n\n\tif ( sRenderer[0] == '\\0' )\n\t\treturn false;\n\n\toutBstr = sRenderer;\n\n\treturn true;\n}\n\nextern \"C\" __declspec(dllexport)\nvoid CALLBACK OpenInUsdViewW( HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int nCmdShow )\n{\n\tUNREFERENCED_PARAMETER( hwnd );\n\tUNREFERENCED_PARAMETER( hinst );\n\tUNREFERENCED_PARAMETER( nCmdShow );\n\n\tCoInitialize( nullptr );\n\n\tHRESULT hr;\n\n\tCCommandLineArgs args;\n\targs.argv = ::CommandLineToArgvW( lpszCmdLine, &args.argc );\n\tif ( args.argc < 1 )\n\t\treturn;\n\n\tif ( ::GetFileAttributesW( args.argv[0] ) == INVALID_FILE_ATTRIBUTES )\n\t\treturn;\n\n\tCComBSTR bstrRenderer;\n\tbool bRendererIsValid = GetRendererFromConfig( _T( \"VIEW\" ), bstrRenderer );\n\n\tCComPtr<UsdPythonToolsLib::IUsdPythonTools> pUsdPythonTools;\n\thr = pUsdPythonTools.CoCreateInstance( __uuidof(UsdPythonToolsLib::UsdPythonTools) );\n\tif ( FAILED( hr ) )\n\t\treturn;\n\n\thr = pUsdPythonTools->View( CComBSTR(args.argv[0]), bRendererIsValid ? bstrRenderer : nullptr );\n\tif ( FAILED( hr ) )\n\t\treturn;\n}\n\nextern \"C\" __declspec(dllexport)\nvoid CALLBACK CrateWithUsdCatW( HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int nCmdShow )\n{\n\tUNREFERENCED_PARAMETER( hwnd );\n\tUNREFERENCED_PARAMETER( hinst );\n\tUNREFERENCED_PARAMETER( nCmdShow );\n\n\tCoInitialize( nullptr );\n\n\tHRESULT hr;\n\n\tCCommandLineArgs args;\n\targs.argv = ::CommandLineToArgvW( lpszCmdLine, &args.argc );\n\tif ( args.argc < 1 )\n\t\treturn;\n\n\tif ( ::GetFileAttributesW( args.argv[0] ) == INVALID_FILE_ATTRIBUTES )\n\t\treturn;\n\n\tCComPtr<UsdSdkToolsLib::IUsdSdkTools> pUSDTools;\n\thr = pUSDTools.CoCreateInstance( __uuidof(UsdSdkToolsLib::UsdSdkTools) );\n\tif ( FAILED( hr ) )\n\t\treturn;\n\n\twchar_t sOutputFile[512];\n\twcscpy_s( sOutputFile, args.argv[0] );\n\tPathCchRenameExtension( sOutputFile, ARRAYSIZE( sOutputFile ), L\"usdc\" );\n\n\thr = pUSDTools->Cat( CComBSTR(args.argv[0]), CComBSTR(sOutputFile), UsdSdkToolsLib::USD_FORMAT_USDC, VARIANT_FALSE );\n\tif ( FAILED( hr ) )\n\t{\n\t\t::MessageBox( hwnd, _T( \"USD Crate Error\" ), _T( \"USD Crate Error\" ), MB_ICONERROR );\n\t\treturn;\n\t}\n}\n\nextern \"C\" __declspec(dllexport)\nvoid CALLBACK UncrateWithUsdCatW( HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int nCmdShow )\n{\n\tUNREFERENCED_PARAMETER( hwnd );\n\tUNREFERENCED_PARAMETER( hinst );\n\tUNREFERENCED_PARAMETER( nCmdShow );\n\n\tCoInitialize( nullptr );\n\n\tHRESULT hr;\n\n\tCCommandLineArgs args;\n\targs.argv = ::CommandLineToArgvW( lpszCmdLine, &args.argc );\n\tif ( args.argc < 1 )\n\t\treturn;\n\n\tif ( ::GetFileAttributesW( args.argv[0] ) == INVALID_FILE_ATTRIBUTES )\n\t\treturn;\n\n\tCComPtr<UsdSdkToolsLib::IUsdSdkTools> pUSDTools;\n\thr = pUSDTools.CoCreateInstance( __uuidof(UsdSdkToolsLib::UsdSdkTools) );\n\tif ( FAILED( hr ) )\n\t\treturn;\n\n\twchar_t sOutputFile[512];\n\twcscpy_s( sOutputFile, args.argv[0] );\n\tPathCchRenameExtension( sOutputFile, ARRAYSIZE( sOutputFile ), L\"usda\" );\n\n\thr = pUSDTools->Cat( CComBSTR(args.argv[0]), CComBSTR(sOutputFile), UsdSdkToolsLib::USD_FORMAT_USDA, VARIANT_FALSE );\n\tif ( FAILED( hr ) )\n\t{\n\t\t::MessageBox( hwnd, _T( \"USD Uncrate Error\" ), _T( \"USD Uncrate Error\" ), MB_ICONERROR );\n\t\treturn;\n\t}\n}\n\nextern \"C\" __declspec(dllexport)\nvoid CALLBACK FlattenWithUsdCatW( HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int nCmdShow )\n{\n\tUNREFERENCED_PARAMETER( hwnd );\n\tUNREFERENCED_PARAMETER( hinst );\n\tUNREFERENCED_PARAMETER( nCmdShow );\n\n\tCoInitialize( nullptr );\n\n\tHRESULT hr;\n\n\tCCommandLineArgs args;\n\targs.argv = ::CommandLineToArgvW( lpszCmdLine, &args.argc );\n\tif ( args.argc < 1 )\n\t\treturn;\n\n\tif ( ::GetFileAttributesW( args.argv[0] ) == INVALID_FILE_ATTRIBUTES )\n\t\treturn;\n\n\tCComPtr<UsdSdkToolsLib::IUsdSdkTools> pUSDTools;\n\thr = pUSDTools.CoCreateInstance( __uuidof(UsdSdkToolsLib::UsdSdkTools) );\n\tif ( FAILED( hr ) )\n\t\treturn;\n\n\thr = pUSDTools->Cat( CComBSTR(args.argv[0]), CComBSTR(args.argv[0]), UsdSdkToolsLib::USD_FORMAT_INPUT, VARIANT_TRUE );\n\tif ( FAILED( hr ) )\n\t{\n\t\t::MessageBox( hwnd, _T( \"USD Flatten Error\" ), _T( \"USD Flatten Error\" ), MB_ICONERROR );\n\t\treturn;\n\t}\n}\n\nextern \"C\" __declspec(dllexport)\nvoid CALLBACK EditInUsdEditW( HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int nCmdShow )\n{\n\tUNREFERENCED_PARAMETER( hwnd );\n\tUNREFERENCED_PARAMETER( hinst );\n\tUNREFERENCED_PARAMETER( nCmdShow );\n\n\tCoInitialize( nullptr );\n\n\tHRESULT hr;\n\n\tCCommandLineArgs args;\n\targs.argv = ::CommandLineToArgvW( lpszCmdLine, &args.argc );\n\tif ( args.argc < 1 )\n\t\treturn;\n\n\tif ( ::GetFileAttributesW( args.argv[0] ) == INVALID_FILE_ATTRIBUTES )\n\t\treturn;\n\n\tCComPtr<UsdSdkToolsLib::IUsdSdkTools> pUSDTools;\n\thr = pUSDTools.CoCreateInstance( __uuidof(UsdSdkToolsLib::UsdSdkTools) );\n\tif ( FAILED( hr ) )\n\t\treturn;\n\n\thr = pUSDTools->Edit( CComBSTR(args.argv[0]), VARIANT_FALSE );\n\tif ( FAILED( hr ) )\n\t{\n\t\t::MessageBox( hwnd, _T( \"USD Edit Error\" ), _T( \"USD Edit Error\" ), MB_ICONERROR );\n\t\treturn;\n\t}\n}\n\nextern \"C\" __declspec(dllexport)\nvoid CALLBACK RefreshThumbnailW( HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int nCmdShow )\n{\n\tUNREFERENCED_PARAMETER( hwnd );\n\tUNREFERENCED_PARAMETER( hinst );\n\tUNREFERENCED_PARAMETER( nCmdShow );\n\n\tCoInitialize( nullptr );\n\n\tHRESULT hr;\n\n\tCCommandLineArgs args;\n\targs.argv = ::CommandLineToArgvW( lpszCmdLine, &args.argc );\n\tif ( args.argc < 1 )\n\t\treturn;\n\n\tif ( ::GetFileAttributesW( args.argv[0] ) == INVALID_FILE_ATTRIBUTES )\n\t\treturn;\n\n\tCComPtr<IShellItem> pShellItem;\n\thr = ::SHCreateItemFromParsingName( args.argv[0], nullptr, IID_PPV_ARGS( &pShellItem.p ) );\n\tif ( FAILED( hr ) )\n\t\treturn;\n\n\tCComPtr<IThumbnailCache> pThumbnailCache;\n\thr = pThumbnailCache.CoCreateInstance( CLSID_LocalThumbnailCache );\n\tif ( FAILED( hr ) )\n\t\treturn;\n\n\t// According to this old thread, force extraction of any size of thumbnail \n\t// should invalidate the entire cache for that IShellItem.\n\t// https://microsoft.public.platformsdk.shell.narkive.com/ABNbF5AQ/how-to-update-thumbnails-on-vista\n\tCComPtr<ISharedBitmap> pSharedBitmap;\n\thr = pThumbnailCache->GetThumbnail( pShellItem, 256, WTS_FORCEEXTRACTION, &pSharedBitmap.p, nullptr, nullptr );\n\n\t// Notify the shell that the item has changed.\n\t::SHChangeNotify( SHCNE_UPDATEITEM, SHCNF_PATHW | SHCNF_FLUSHNOWAIT, args.argv[0], nullptr );\n}\n\nextern \"C\" __declspec(dllexport)\nvoid CALLBACK PackageDefaultW( HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int nCmdShow )\n{\n\tUNREFERENCED_PARAMETER( hwnd );\n\tUNREFERENCED_PARAMETER( hinst );\n\tUNREFERENCED_PARAMETER( nCmdShow );\n\n\tCoInitialize( nullptr );\n\n\tHRESULT hr;\n\n\tCCommandLineArgs args;\n\targs.argv = ::CommandLineToArgvW( lpszCmdLine, &args.argc );\n\tif ( args.argc < 1 )\n\t\treturn;\n\n\tif ( ::GetFileAttributesW( args.argv[0] ) == INVALID_FILE_ATTRIBUTES )\n\t\treturn;\n\n\tCComPtr<UsdSdkToolsLib::IUsdSdkTools> pUSDTools;\n\thr = pUSDTools.CoCreateInstance( __uuidof(UsdSdkToolsLib::UsdSdkTools) );\n\tif ( FAILED( hr ) )\n\t\treturn;\n\n\twchar_t sOutputFile[512];\n\twcscpy_s( sOutputFile, args.argv[0] );\n\tPathCchRenameExtension( sOutputFile, ARRAYSIZE( sOutputFile ), L\"usdz\" );\n\n\thr = pUSDTools->Package( CComBSTR(args.argv[0]), CComBSTR(sOutputFile), UsdSdkToolsLib::USD_PACKAGE_DEFAULT, VARIANT_TRUE );\n\tif ( FAILED( hr ) )\n\t{\n\t\t::MessageBox( hwnd, _T( \"USD Package Error\" ), _T( \"USD Package Error\" ), MB_ICONERROR );\n\t\treturn;\n\t}\n}\n\nextern \"C\" __declspec(dllexport)\nvoid CALLBACK PackageARKitW( HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int nCmdShow )\n{\n\tUNREFERENCED_PARAMETER( hwnd );\n\tUNREFERENCED_PARAMETER( hinst );\n\tUNREFERENCED_PARAMETER( nCmdShow );\n\n\tCoInitialize( nullptr );\n\n\tHRESULT hr;\n\n\tCCommandLineArgs args;\n\targs.argv = ::CommandLineToArgvW( lpszCmdLine, &args.argc );\n\tif ( args.argc < 1 )\n\t\treturn;\n\n\tif ( ::GetFileAttributesW( args.argv[0] ) == INVALID_FILE_ATTRIBUTES )\n\t\treturn;\n\n\tCComPtr<UsdSdkToolsLib::IUsdSdkTools> pUSDTools;\n\thr = pUSDTools.CoCreateInstance( __uuidof(UsdSdkToolsLib::UsdSdkTools) );\n\tif ( FAILED( hr ) )\n\t\treturn;\n\n\twchar_t sOutputFile[512];\n\twcscpy_s( sOutputFile, args.argv[0] );\n\tPathCchRenameExtension( sOutputFile, ARRAYSIZE( sOutputFile ), L\"usdz\" );\n\n\thr = pUSDTools->Package( CComBSTR(args.argv[0]), CComBSTR(sOutputFile), UsdSdkToolsLib::USD_FORMAT_APPLE_ARKIT, VARIANT_TRUE );\n\tif ( FAILED( hr ) )\n\t{\n\t\t::MessageBox( hwnd, _T( \"USD Package Error\" ), _T( \"USD Package Error\" ), MB_ICONERROR );\n\t\treturn;\n\t}\n}\n\n\nextern \"C\" __declspec(dllexport)\nvoid CALLBACK StageStatsW( HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int nCmdShow )\n{\n\tUNREFERENCED_PARAMETER( hwnd );\n\tUNREFERENCED_PARAMETER( hinst );\n\tUNREFERENCED_PARAMETER( nCmdShow );\n\n\tCoInitialize( nullptr );\n\n\tHRESULT hr;\n\n\tCCommandLineArgs args;\n\targs.argv = ::CommandLineToArgvW( lpszCmdLine, &args.argc );\n\tif ( args.argc < 1 )\n\t\treturn;\n\n\tif ( ::GetFileAttributesW( args.argv[0] ) == INVALID_FILE_ATTRIBUTES )\n\t\treturn;\n\n\tCComPtr<UsdSdkToolsLib::IUsdSdkTools> pUSDTools;\n\thr = pUSDTools.CoCreateInstance( __uuidof(UsdSdkToolsLib::UsdSdkTools) );\n\tif ( FAILED( hr ) )\n\t\treturn;\n\n\thr = pUSDTools->DisplayStageStats( CComBSTR(args.argv[0]) );\n\tif ( FAILED( hr ) )\n\t{\n\t\t::MessageBox( hwnd, _T( \"USD Stage Stats Error\" ), _T( \"USD Stage Stats Error\" ), MB_ICONERROR );\n\t\treturn;\n\t}\n}"
  },
  {
    "path": "UsdShellExtension/ShellExt.def",
    "content": "EXPORTS\n\tDllRegisterServer\tPRIVATE\n\tDllUnregisterServer PRIVATE\n\tDllGetClassObject\tPRIVATE\n\tDllCanUnloadNow\t\tPRIVATE\n\tDllInstall\t\t\tPRIVATE"
  },
  {
    "path": "UsdShellExtension/ShellExt.idl",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport \"oaidl.idl\";\nimport \"ocidl.idl\";\nimport \"ShObjIdl.idl\";\nimport \"thumbcache.idl\";\n\n[\n\tuuid(B71120F9-A3EA-4153-8C32-C906CCE1F6F2),\n\tversion(1.0),\n]\nlibrary UsdShellExtensionLib\n{\n\t[\n\t\tuuid(0BCB74E0-5B61-4F24-BAB3-96CC76FE3672)\n\t]\n\tcoclass UsdContextMenu\n\t{\n\t\t[default] interface IContextMenu;\n\t};\n\n\t[\n\t\tuuid(2DEB1AB8-DECA-42C2-B576-3116D9CA8FA8),\n\t\thelpstring(\"USD IPreviewHandler implementation\")\n\t]\n\tcoclass ShellPreviewHandler\n\t{\n\t\t[default] interface IPreviewHandler;\n\t}\n\n\t[\n\t\tuuid(2877CB72-1427-43B0-A2B4-9CB1B2BA8C53),\n\t\thelpstring(\"USD IThumbnailProvider implementation\")\n\t]\n\tcoclass ShellThumbnailProvider\n\t{\n\t\t[default] interface IThumbnailProvider;\n\t}\n\n\t[\n\t\tuuid(5CE761D0-72AA-4484-B2BF-2A0EBF3ACC0C),\n\t\thelpstring(\"USD IPropertyStore implementation\")\n\t]\n\tcoclass ShellPropertyStore\n\t{\n\t\t[default] interface IPropertyStore;\n\t}\n};"
  },
  {
    "path": "UsdShellExtension/ShellExt.rc",
    "content": "// Microsoft Visual C++ generated resource script.\n//\n#include \"resource.h\"\n\n#define APSTUDIO_READONLY_SYMBOLS\n/////////////////////////////////////////////////////////////////////////////\n//\n// Generated from the TEXTINCLUDE 2 resource.\n//\n#include \"winres.h\"\n\n/////////////////////////////////////////////////////////////////////////////\n#undef APSTUDIO_READONLY_SYMBOLS\n\n/////////////////////////////////////////////////////////////////////////////\n// Neutral (Default) resources\n\n#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEUD)\nLANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT\n#pragma code_page(1252)\n\n#include \"EventViewerMessages.rc\"\n\n/////////////////////////////////////////////////////////////////////////////\n//\n// REGISTRY\n//\n\nIDR_REGISTRY_SHELLPREVIEWHANDLERIMPL REGISTRY                \"ShellPreviewHandlerImpl.rgs\"\n\nIDR_REGISTRY_SHELLTHUMBNAILPROVIDERIMPL REGISTRY                \"ShellThumbnailProviderImpl.rgs\"\n\nIDR_REGISTRY_MODULE     REGISTRY                \"ShellExtModule.rgs\"\n\nIDR_REGISTRY_SHELLPROPERTYSTOREIMPL REGISTRY                \"ShellPropertyStoreImpl.rgs\"\n\n\n/////////////////////////////////////////////////////////////////////////////\n//\n// Icon\n//\n\n// Icon with lowest ID value placed first to ensure application icon\n// remains consistent on all systems.\nIDI_ICON_USD            ICON                    \"usd.ico\"\n\n\n/////////////////////////////////////////////////////////////////////////////\n//\n// Dialog\n//\n\nIDD_LOADSCREEN DIALOGEX 0, 0, 231, 130\nSTYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN\nFONT 8, \"MS Shell Dlg\", 400, 0, 0x1\nBEGIN\nEND\n\n\n/////////////////////////////////////////////////////////////////////////////\n//\n// DESIGNINFO\n//\n\n#ifdef APSTUDIO_INVOKED\nGUIDELINES DESIGNINFO\nBEGIN\n    IDD_LOADSCREEN, DIALOG\n    BEGIN\n        LEFTMARGIN, 7\n        TOPMARGIN, 7\n    END\nEND\n#endif    // APSTUDIO_INVOKED\n\n\n/////////////////////////////////////////////////////////////////////////////\n//\n// AFX_DIALOG_LAYOUT\n//\n\nIDD_LOADSCREEN AFX_DIALOG_LAYOUT\nBEGIN\n    0\nEND\n\n\n/////////////////////////////////////////////////////////////////////////////\n//\n// PNG\n//\n\nIDB_LOADSCREEN          PNG                     \"USDLogoLrgWithAlpha.png\"\n\nIDB_LOGO                PNG                     \"logo.png\"\n\n\n/////////////////////////////////////////////////////////////////////////////\n//\n// XML\n//\n\nIDR_XML_PROPDESC_USD    XML                     \"UsdPropertyKeys.propdesc\"\n\n\n#ifdef APSTUDIO_INVOKED\n/////////////////////////////////////////////////////////////////////////////\n//\n// TEXTINCLUDE\n//\n\n1 TEXTINCLUDE \nBEGIN\n    \"resource.h\\0\"\nEND\n\n2 TEXTINCLUDE \nBEGIN\n    \"#include \"\"winres.h\"\"\\r\\n\"\n    \"\\0\"\nEND\n\n3 TEXTINCLUDE \nBEGIN\n    \"1 TYPELIB \"\"UsdShellExtension.tlb\"\"\\r\\n\"\n    \"\\r\\n\"\n    \"#define ATVI_VERSION_DESCRIPTION \"\"Activision USD Shell Extension\"\"\\r\\n\"\n    \"#include \"\"atviversion.rc2\"\"\\r\\n\"\n    \"\\0\"\nEND\n\n#endif    // APSTUDIO_INVOKED\n\n\n/////////////////////////////////////////////////////////////////////////////\n//\n// String Table\n//\n\nSTRINGTABLE\nBEGIN\n    IDS_USD_DOCUMENTATION_LABEL \"Documentation\"\n    IDS_USD_DOCUMENTATION_INVITATIONTEXT \"Add documentation\"\n    IDS_USD_DOCUMENTATION_MNEMONICS \"usddocumentation|usddocs|usddoc\"\n    IDS_USD_PROPGROUP_USD_LABEL \"Universal Scene Description\"\nEND\n\nSTRINGTABLE\nBEGIN\n    IDS_FILE_USD            \"Universal Scene Description\"\n    IDS_FILE_USDA           \"Universal Scene Description ASCII\"\n    IDS_FILE_USDC           \"Universal Scene Description Crate\"\n    IDS_FILE_USDZ           \"Universal Scene Description Package\"\n    IDS_SHELL_VIEW          \"&View\"\n    IDS_SHELL_EDIT          \"&Edit\"\nEND\n\nSTRINGTABLE\nBEGIN\n    IDS_SHELL_CRATE         \"&Crate\"\n    IDS_SHELL_UNCRATE       \"&Uncrate\"\n    IDS_SHELL_FLATTEN       \"&Flatten\"\n    IDS_SHELL_REFRESHTHUMBNAIL \"&Refresh Thumbnail\"\n    IDS_SHELL_STATS         \"&Stats\"\n    IDS_USD_CUSTOMLAYERDATA_LABEL \"Custom layer data\"\n    IDS_USD_CUSTOMLAYERDATA_MNEMONICS \"usdcustomlayerdata|usdlayerdata\"\nEND\n\n#endif    // Neutral (Default) resources\n/////////////////////////////////////////////////////////////////////////////\n\n\n\n#ifndef APSTUDIO_INVOKED\n/////////////////////////////////////////////////////////////////////////////\n//\n// Generated from the TEXTINCLUDE 3 resource.\n//\n1 TYPELIB \"UsdShellExtension.tlb\"\n\n#define ATVI_VERSION_DESCRIPTION \"Activision USD Shell Extension\"\n#include \"atviversion.rc2\"\n\n/////////////////////////////////////////////////////////////////////////////\n#endif    // not APSTUDIO_INVOKED\n\n"
  },
  {
    "path": "UsdShellExtension/ShellExtModule.rgs",
    "content": "HKCR\n{\n\tNoRemove ATVI.USD = s 'Activision Universal Scene Description'\n\t{\n\t\tForceRemove val FriendlyTypeName = s '@%MODULE%,-%IDS_FILE_USD%'\n\n\t\tNoRemove shell\n\t\t{\n\t\t\tForceRemove open = s '@%MODULE%,-%IDS_SHELL_VIEW%'\n\t\t\t{\n\t\t\t\tcommand = s 'rundll32.exe \"%MODULE%\",OpenInUsdView \"%%1\"'\n\t\t\t}\n\n\t\t\tForceRemove edit = s '@%MODULE%,-%IDS_SHELL_EDIT%'\n\t\t\t{\n\t\t\t\tcommand = s 'rundll32.exe \"%MODULE%\",EditInUsdEdit \"%%1\"'\n\t\t\t}\n\n\t\t\tForceRemove compress = s '@%MODULE%,-%IDS_SHELL_CRATE%'\n\t\t\t{\n\t\t\t\tcommand = s 'rundll32.exe \"%MODULE%\",CrateWithUsdCat \"%%1\"'\n\t\t\t}\n\n\t\t\tForceRemove uncompress = s '@%MODULE%,-%IDS_SHELL_UNCRATE%'\n\t\t\t{\n\t\t\t\tcommand = s 'rundll32.exe \"%MODULE%\",UncrateWithUsdCat \"%%1\"'\n\t\t\t}\n\n\t\t\tForceRemove flatten = s '@%MODULE%,-%IDS_SHELL_FLATTEN%'\n\t\t\t{\n\t\t\t\tcommand = s 'rundll32.exe \"%MODULE%\",FlattenWithUsdCat \"%%1\"'\n\t\t\t}\n\n\t\t\tForceRemove thumbnail = s '@%MODULE%,-%IDS_SHELL_REFRESHTHUMBNAIL%'\n\t\t\t{\n\t\t\t\tcommand = s 'rundll32.exe \"%MODULE%\",RefreshThumbnail \"%%1\"'\n\t\t\t}\n\n\t\t\tForceRemove stats = s '@%MODULE%,-%IDS_SHELL_STATS%'\n\t\t\t{\n\t\t\t\tcommand = s 'rundll32.exe \"%MODULE%\",StageStats \"%%1\"'\n\t\t\t}\n\n\t\t\tForceRemove package\n\t\t\t{\n\t\t\t\tForceRemove val ExtendedSubCommandsKey = s 'ATVI.USD\\shell\\package'\n\t\t\t\tForceRemove val MUIVerb = s 'Package'\n\n\t\t\t\tForceRemove Shell\n\t\t\t\t{\n\t\t\t\t\tForceRemove Default\n\t\t\t\t\t{\n\t\t\t\t\t\tForceRemove val MUIVerb = s 'Default'\n\t\t\t\t\t\tForceRemove command = s 'rundll32.exe \"%MODULE%\",PackageDefault \"%%1\"'\n\t\t\t\t\t}\n\t\t\t\t\tForceRemove ARKit\n\t\t\t\t\t{\n\t\t\t\t\t\tForceRemove val MUIVerb = s 'Apple ARKit'\n\t\t\t\t\t\tForceRemove command = s 'rundll32.exe \"%MODULE%\",PackageARKit \"%%1\"'\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tForceRemove DefaultIcon = s '%MODULE%,-%IDI_ICON_USD%'\n\t}\n\n\tNoRemove .usd\n\t{\n\t\tval PerceivedType = s 'document'\n\t\tNoRemove OpenWithProgids\n\t\t{\n\t\t\tForceRemove val ATVI.USD = s 'Activision Universal Scene Description'\n\t\t}\n\t}\n\n\tNoRemove ATVI.USDA = s 'Activision Universal Scene Description ASCII'\n\t{\n\t\tForceRemove val FriendlyTypeName = s '@%MODULE%,-%IDS_FILE_USDA%'\n\n\t\tNoRemove shell\n\t\t{\n\t\t\tForceRemove open = s '@%MODULE%,-%IDS_SHELL_VIEW%'\n\t\t\t{\n\t\t\t\tcommand = s 'rundll32.exe \"%MODULE%\",OpenInUsdView \"%%1\"'\n\t\t\t}\n\n\t\t\tForceRemove edit = s '@%MODULE%,-%IDS_SHELL_EDIT%'\n\t\t\t{\n\t\t\t\tcommand = s 'rundll32.exe \"%MODULE%\",EditInUsdEdit \"%%1\"'\n\t\t\t}\n\n\t\t\tForceRemove compress = s '@%MODULE%,-%IDS_SHELL_CRATE%'\n\t\t\t{\n\t\t\t\tcommand = s 'rundll32.exe \"%MODULE%\",CrateWithUsdCat \"%%1\"'\n\t\t\t}\n\n\t\t\tForceRemove flatten = s '@%MODULE%,-%IDS_SHELL_FLATTEN%'\n\t\t\t{\n\t\t\t\tcommand = s 'rundll32.exe \"%MODULE%\",FlattenWithUsdCat \"%%1\"'\n\t\t\t}\n\n\t\t\tForceRemove thumbnail = s '@%MODULE%,-%IDS_SHELL_REFRESHTHUMBNAIL%'\n\t\t\t{\n\t\t\t\tcommand = s 'rundll32.exe \"%MODULE%\",RefreshThumbnail \"%%1\"'\n\t\t\t}\n\n\t\t\tForceRemove stats = s '@%MODULE%,-%IDS_SHELL_STATS%'\n\t\t\t{\n\t\t\t\tcommand = s 'rundll32.exe \"%MODULE%\",StageStats \"%%1\"'\n\t\t\t}\n\n\t\t\tForceRemove package\n\t\t\t{\n\t\t\t\tForceRemove val ExtendedSubCommandsKey = s 'ATVI.USDA\\shell\\package'\n\t\t\t\tForceRemove val MUIVerb = s 'Package'\n\n\t\t\t\tForceRemove Shell\n\t\t\t\t{\n\t\t\t\t\tForceRemove Default\n\t\t\t\t\t{\n\t\t\t\t\t\tForceRemove val MUIVerb = s 'Default'\n\t\t\t\t\t\tForceRemove command = s 'rundll32.exe \"%MODULE%\",PackageDefault \"%%1\"'\n\t\t\t\t\t}\n\t\t\t\t\tForceRemove ARKit\n\t\t\t\t\t{\n\t\t\t\t\t\tForceRemove val MUIVerb = s 'Apple ARKit'\n\t\t\t\t\t\tForceRemove command = s 'rundll32.exe \"%MODULE%\",PackageARKit \"%%1\"'\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tForceRemove DefaultIcon = s '%MODULE%,-%IDI_ICON_USD%'\n\t}\n\n\tNoRemove .usda\n\t{\n\t\tval PerceivedType = s 'document'\n\t\tNoRemove OpenWithProgids\n\t\t{\n\t\t\tForceRemove val ATVI.USDA = s 'Activision Universal Scene Description ASCII'\n\t\t}\n\t}\n\n\tNoRemove ATVI.USDC = s 'Activision Universal Scene Description Crate'\n\t{\n\t\tForceRemove val FriendlyTypeName = s '@%MODULE%,-%IDS_FILE_USDC%'\n\n\t\tNoRemove shell\n\t\t{\n\t\t\tForceRemove open = s '@%MODULE%,-%IDS_SHELL_VIEW%'\n\t\t\t{\n\t\t\t\tcommand = s 'rundll32.exe \"%MODULE%\",OpenInUsdView \"%%1\"'\n\t\t\t}\n\n\t\t\tForceRemove edit = s '@%MODULE%,-%IDS_SHELL_EDIT%'\n\t\t\t{\n\t\t\t\tcommand = s 'rundll32.exe \"%MODULE%\",EditInUsdEdit \"%%1\"'\n\t\t\t}\n\n\t\t\tForceRemove uncompress = s '@%MODULE%,-%IDS_SHELL_UNCRATE%'\n\t\t\t{\n\t\t\t\tcommand = s 'rundll32.exe \"%MODULE%\",UncrateWithUsdCat \"%%1\"'\n\t\t\t}\n\n\t\t\tForceRemove flatten = s '@%MODULE%,-%IDS_SHELL_FLATTEN%'\n\t\t\t{\n\t\t\t\tcommand = s 'rundll32.exe \"%MODULE%\",FlattenWithUsdCat \"%%1\"'\n\t\t\t}\n\n\t\t\tForceRemove thumbnail = s '@%MODULE%,-%IDS_SHELL_REFRESHTHUMBNAIL%'\n\t\t\t{\n\t\t\t\tcommand = s 'rundll32.exe \"%MODULE%\",RefreshThumbnail \"%%1\"'\n\t\t\t}\n\n\t\t\tForceRemove stats = s '@%MODULE%,-%IDS_SHELL_STATS%'\n\t\t\t{\n\t\t\t\tcommand = s 'rundll32.exe \"%MODULE%\",StageStats \"%%1\"'\n\t\t\t}\n\n\t\t\tForceRemove package\n\t\t\t{\n\t\t\t\tForceRemove val ExtendedSubCommandsKey = s 'ATVI.USDC\\shell\\package'\n\t\t\t\tForceRemove val MUIVerb = s 'Package'\n\n\t\t\t\tForceRemove Shell\n\t\t\t\t{\n\t\t\t\t\tForceRemove Default\n\t\t\t\t\t{\n\t\t\t\t\t\tForceRemove val MUIVerb = s 'Default'\n\t\t\t\t\t\tForceRemove command = s 'rundll32.exe \"%MODULE%\",PackageDefault \"%%1\"'\n\t\t\t\t\t}\n\t\t\t\t\tForceRemove ARKit\n\t\t\t\t\t{\n\t\t\t\t\t\tForceRemove val MUIVerb = s 'Apple ARKit'\n\t\t\t\t\t\tForceRemove command = s 'rundll32.exe \"%MODULE%\",PackageARKit \"%%1\"'\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tForceRemove DefaultIcon = s '%MODULE%,-%IDI_ICON_USD%'\n\t}\n\n\tNoRemove .usdc\n\t{\n\t\tval PerceivedType = s 'document'\n\t\tNoRemove OpenWithProgids\n\t\t{\n\t\t\tForceRemove val ATVI.USDC = s 'Activision Universal Scene Description Crate'\n\t\t}\n\t}\n\n\tNoRemove ATVI.USDZ = s 'Activision Universal Scene Description Package'\n\t{\n\t\tForceRemove val FriendlyTypeName = s '@%MODULE%,-%IDS_FILE_USDZ%'\n\n\t\tNoRemove shell\n\t\t{\n\t\t\tForceRemove open = s '@%MODULE%,-%IDS_SHELL_VIEW%'\n\t\t\t{\n\t\t\t\tcommand = s 'rundll32.exe \"%MODULE%\",OpenInUsdView \"%%1\"'\n\t\t\t}\n\n\t\t\tForceRemove thumbnail = s '@%MODULE%,-%IDS_SHELL_REFRESHTHUMBNAIL%'\n\t\t\t{\n\t\t\t\tcommand = s 'rundll32.exe \"%MODULE%\",RefreshThumbnail \"%%1\"'\n\t\t\t}\n\n\t\t\tForceRemove stats = s '@%MODULE%,-%IDS_SHELL_STATS%'\n\t\t\t{\n\t\t\t\tcommand = s 'rundll32.exe \"%MODULE%\",StageStats \"%%1\"'\n\t\t\t}\n\t\t}\n\t\tForceRemove DefaultIcon = s '%MODULE%,-%IDI_ICON_USD%'\n\t}\n\n\tNoRemove .usdz\n\t{\n\t\tval PerceivedType = s 'document'\n\t\tNoRemove OpenWithProgids\n\t\t{\n\t\t\tForceRemove val ATVI.USDZ = s 'Activision Universal Scene Description Package'\n\t\t}\n\t}\n\n\n}\n\n"
  },
  {
    "path": "UsdShellExtension/ShellPreviewHandlerImpl.cpp",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include \"stdafx.h\"\n#include \"ShellPreviewHandlerImpl.h\"\n#include \"Module.h\"\n#include \"resource.h\"\n\n#pragma warning(push)\n#pragma warning(disable:4192 4278)\n#import \"UsdPreviewLocalServer.tlb\" raw_interfaces_only \n#pragma warning(pop)\n\nstatic RECT UpdateRectForDPI(HWND hwnd, const RECT& rcWnd)\n{\n#if 0\n\tint iDpiProcess = static_cast<int>(::GetSystemDpiForProcess( ::GetCurrentProcess() ));\n\tint iDpiWindow = static_cast<int>(::GetDpiForWindow( hwnd ));\n\n\tRECT rcDpi;\n\trcDpi.left = MulDiv(rcWnd.left, iDpiProcess, iDpiWindow); \n\trcDpi.top = MulDiv(rcWnd.top, iDpiProcess, iDpiWindow); \n\trcDpi.right = MulDiv(rcWnd.right, iDpiProcess, iDpiWindow); \n\trcDpi.bottom = MulDiv(rcWnd.bottom, iDpiProcess, iDpiWindow); \n\n\tCStringA sDebug;\n\tsDebug.Format( \"DPI: p:%d w:%d, {%d, %d, %d, %d} -> {%d, %d, %d, %d}\\n\", iDpiProcess, iDpiWindow, \n\t\trcWnd.left, rcWnd.top, rcWnd.right - rcWnd.left, rcWnd.bottom - rcWnd.top,\n\t\trcDpi.left, rcDpi.top, rcDpi.right - rcDpi.left, rcDpi.bottom - rcDpi.top\n\t\t);\n\tOutputDebugStringA( sDebug );\n\n\treturn rcDpi;\n#else\n\tUNREFERENCED_PARAMETER( hwnd );\n\treturn rcWnd;\n#endif\n}\n\n\nHRESULT CShellPreviewHandlerImpl::CreateLocalServer()\n{\n\tHRESULT hr;\n\thr = m_pPreviewHandler.CoCreateInstance(__uuidof(USDPreview::USDPreviewHandler));\n\tif ( FAILED( hr ) )\n\t\treturn hr;\n\n\tCComQIPtr<IInitializeWithFile> pInitializeWithFile = m_pPreviewHandler.p;\n\tm_pInitializeWithFile = pInitializeWithFile;\n\tif ( m_pInitializeWithFile == nullptr )\n\t\treturn E_NOINTERFACE;\n\n\tCComQIPtr<IObjectWithSite> pObjectWithSite = m_pPreviewHandler.p;\n\tm_pObjectWithSite = pObjectWithSite;\n\tif ( m_pObjectWithSite == nullptr )\n\t\treturn E_NOINTERFACE;\n\n\tCComQIPtr<IOleWindow> pOleWindow = m_pPreviewHandler.p;\n\tm_pOleWindow = pOleWindow;\n\tif ( m_pOleWindow == nullptr )\n\t\treturn E_NOINTERFACE;\n\n\tCComQIPtr<IPreviewHandlerVisuals> pPreviewHandlerVisuals = m_pPreviewHandler.p;\n\tm_pPreviewHandlerVisuals = pPreviewHandlerVisuals;\n\tif ( m_pPreviewHandlerVisuals == nullptr )\n\t\treturn E_NOINTERFACE;\n\n\treturn S_OK;\n}\n\nvoid CShellPreviewHandlerImpl::DestroyLocalServer()\n{\n\tm_pInitializeWithFile = nullptr;\n\tm_pObjectWithSite = nullptr;\n\tm_pOleWindow = nullptr;\n\tm_pPreviewHandler = nullptr;\n\tm_pPreviewHandlerVisuals = nullptr;\n}\n\nHRESULT CShellPreviewHandlerImpl::FinalConstruct()\n{\n\treturn __super::FinalConstruct();\n}\n\nvoid CShellPreviewHandlerImpl::FinalRelease()\n{\n\tDestroyLocalServer();\n\n\t__super::FinalRelease();\n}\n\n// IInitializeWithFile\nSTDMETHODIMP CShellPreviewHandlerImpl::Initialize(__RPC__in_string LPCWSTR pszFilePath, DWORD grfMode)\n{\n\tHRESULT hr;\n\n\thr = CreateLocalServer();\n\tif ( FAILED( hr ) )\n\t\treturn hr;\n\n\tif ( m_pInitializeWithFile == nullptr )\n\t\treturn E_FAIL;\n\n\thr = m_pInitializeWithFile->Initialize( pszFilePath, grfMode );\n\tif ( FAILED( hr ) )\n\t\treturn hr;\n\n\tm_clrBackground = ::GetSysColor( COLOR_WINDOW );\n\tm_clrText = ::GetSysColor( COLOR_WINDOWTEXT );\n\n\treturn hr;\n}\n\n// IObjectWithSite\nSTDMETHODIMP CShellPreviewHandlerImpl::SetSite(__RPC__in_opt IUnknown* pUnkSite)\n{\n\tif ( m_pObjectWithSite == nullptr )\n\t\treturn E_FAIL;\n\n\tHRESULT hr;\n\thr = m_pObjectWithSite->SetSite( pUnkSite );\n\tif ( FAILED( hr ) )\n\t\treturn hr;\n\n\treturn hr;\n}\n\nSTDMETHODIMP CShellPreviewHandlerImpl::GetSite(__RPC__in REFIID riid, __RPC__deref_out_opt void** ppvSite)\n{\n\tif ( m_pObjectWithSite == nullptr )\n\t\treturn E_FAIL;\n\n\tHRESULT hr;\n\thr = m_pObjectWithSite->GetSite( riid, ppvSite );\n\tif ( FAILED( hr ) )\n\t\treturn hr;\n\n\treturn hr;\n}\n\n// IOleWindow\nSTDMETHODIMP CShellPreviewHandlerImpl::GetWindow(__RPC__deref_out_opt HWND* phwnd)\n{\n\tif ( m_pOleWindow == nullptr )\n\t\treturn E_FAIL;\n\n\tHRESULT hr;\n\thr = m_pOleWindow->GetWindow( phwnd );\n\tif ( FAILED( hr ) )\n\t\treturn hr;\n\n\treturn hr;\n}\n\nSTDMETHODIMP CShellPreviewHandlerImpl::ContextSensitiveHelp(BOOL fEnterMode)\n{\n\tif ( m_pOleWindow == nullptr )\n\t\treturn E_FAIL;\n\n\tHRESULT hr;\n\thr = m_pOleWindow->ContextSensitiveHelp( fEnterMode );\n\tif ( FAILED( hr ) )\n\t\treturn hr;\n\n\treturn hr;\n}\n\n// IPreviewHandler\nSTDMETHODIMP CShellPreviewHandlerImpl::SetWindow(__RPC__in HWND hwnd, __RPC__in const RECT* prc)\n{\n\tif ( prc == nullptr )\n\t\treturn E_POINTER;\n\n\tCAutoDpiAware dpi( DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE );\n\n\tm_hWnd = hwnd;\n\tm_rcWndRaw = *prc;\n\n\tm_rcWndDpiAware = UpdateRectForDPI( m_hWnd, m_rcWndRaw );\n\n\tif ( m_pPreviewHandler == nullptr )\n\t\treturn E_FAIL;\n\n\tif ( m_bLoadScreenCreated )\n\t{\n\t\tm_LoadScreenDlg.SetParent( m_hWnd );\n\t\tm_LoadScreenDlg.SetWindowPos( nullptr, &m_rcWndDpiAware, 0 );\n\t}\n\n\tHRESULT hr;\n\thr = m_pPreviewHandler->SetWindow( m_LoadScreenDlg, &m_rcWndRaw );\n\tif ( FAILED( hr ) )\n\t\treturn hr;\n\n\treturn hr;\n}\n\nSTDMETHODIMP CShellPreviewHandlerImpl::SetRect(__RPC__in const RECT* prc)\n{\n\tif ( prc == nullptr )\n\t\treturn E_POINTER;\n\n\tCAutoDpiAware dpi( DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE );\n\n\tm_rcWndRaw = *prc;\n\tm_rcWndDpiAware = UpdateRectForDPI( m_hWnd, m_rcWndRaw );\n\n\tif ( m_pPreviewHandler == nullptr )\n\t\treturn E_FAIL;\n\n\tif (m_bLoadScreenCreated)\n\t\tm_LoadScreenDlg.SetWindowPos( nullptr, &m_rcWndDpiAware, 0 );\n\n\tHRESULT hr;\n\thr = m_pPreviewHandler->SetRect( &m_rcWndRaw );\n\tif ( FAILED( hr ) )\n\t\treturn hr;\n\n\treturn hr;\n}\n\nSTDMETHODIMP CShellPreviewHandlerImpl::DoPreview()\n{\n\tif ( m_pPreviewHandler == nullptr )\n\t\treturn E_FAIL;\n\n\tCAutoDpiAware dpi( DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE );\n\n\tm_LoadScreenDlg.SetBackgroundColor( m_clrBackground );\n\tm_LoadScreenDlg.Create( m_hWnd );\n\tm_LoadScreenDlg.SetWindowPos( nullptr, &m_rcWndDpiAware, 0 );\n\tm_bLoadScreenCreated = true;\n\n\tHRESULT hr;\n\thr = m_pPreviewHandler->SetWindow( m_LoadScreenDlg, &m_rcWndRaw );\n\tif ( FAILED( hr ) )\n\t\treturn hr;\n\n\thr = m_pPreviewHandler->DoPreview();\n\tif ( FAILED( hr ) )\n\t\treturn hr;\n\n\treturn hr;\n}\n\nSTDMETHODIMP CShellPreviewHandlerImpl::Unload()\n{\n\tif ( m_pPreviewHandler == nullptr )\n\t\treturn E_FAIL;\n\n\tm_LoadScreenDlg.DestroyWindow();\n\tm_bLoadScreenCreated = false;\n\n\tHRESULT hr;\n\thr = m_pPreviewHandler->Unload();\n\n\tDestroyLocalServer();\n\n\treturn hr;\n}\n\nSTDMETHODIMP CShellPreviewHandlerImpl::SetFocus()\n{\n\tif ( m_pPreviewHandler == nullptr )\n\t\treturn E_FAIL;\n\n\tHRESULT hr;\n\thr = m_pPreviewHandler->SetFocus();\n\tif ( FAILED( hr ) )\n\t\treturn hr;\n\n\treturn hr;\n}\n\nSTDMETHODIMP CShellPreviewHandlerImpl::QueryFocus(__RPC__deref_out_opt HWND* phwnd)\n{\n\tif ( m_pPreviewHandler == nullptr )\n\t\treturn E_FAIL;\n\n\tHRESULT hr;\n\thr = m_pPreviewHandler->QueryFocus(phwnd);\n\tif ( FAILED( hr ) )\n\t\treturn hr;\n\n\treturn hr;\n}\n\nSTDMETHODIMP CShellPreviewHandlerImpl::TranslateAccelerator(__RPC__in MSG* pmsg)\n{\n\tif ( m_pPreviewHandler == nullptr )\n\t\treturn E_FAIL;\n\n\tHRESULT hr;\n\thr = m_pPreviewHandler->TranslateAccelerator(pmsg);\n\tif ( FAILED( hr ) )\n\t\treturn hr;\n\n\treturn hr;\n}\n\nSTDMETHODIMP CShellPreviewHandlerImpl::SetBackgroundColor( COLORREF color )\n{\n\tif ( m_pPreviewHandlerVisuals == nullptr )\n\t\treturn E_FAIL;\n\n\tHRESULT hr;\n\thr = m_pPreviewHandlerVisuals->SetBackgroundColor(color);\n\tif ( FAILED( hr ) )\n\t\treturn hr;\n\n\tm_clrBackground = color;\n\n\tm_LoadScreenDlg.SetBackgroundColor( m_clrBackground );\n\n\treturn S_OK;\n}\n\nSTDMETHODIMP CShellPreviewHandlerImpl::SetFont( __RPC__in const LOGFONTW *plf )\n{\n\tif ( m_pPreviewHandlerVisuals == nullptr )\n\t\treturn E_FAIL;\n\n\tHRESULT hr;\n\thr = m_pPreviewHandlerVisuals->SetFont(plf);\n\tif ( FAILED( hr ) )\n\t\treturn hr;\n\n\treturn S_OK;\n}\n\nSTDMETHODIMP CShellPreviewHandlerImpl::SetTextColor( COLORREF color )\n{\n\tif ( m_pPreviewHandlerVisuals == nullptr )\n\t\treturn E_FAIL;\n\n\tHRESULT hr;\n\thr = m_pPreviewHandlerVisuals->SetTextColor(color);\n\tif ( FAILED( hr ) )\n\t\treturn hr;\n\n\tm_clrText = color;\n\treturn S_OK;\n}\n\nHRESULT WINAPI CShellPreviewHandlerImpl::UpdateRegistry(_In_ BOOL bRegister) throw()\n{\n\tATL::_ATL_REGMAP_ENTRY regMapEntries[] =\n\t{\n\t\t{ L\"CLSID_SHELLPREVIEWHANDLER\", L\"{2DEB1AB8-DECA-42C2-B576-3116D9CA8FA8}\" },\n\t\t{ nullptr, nullptr }\n\t};\n\n\treturn g_AtlModule.UpdateRegistryFromResource(IDR_REGISTRY_SHELLPREVIEWHANDLERIMPL, bRegister, regMapEntries);\n}"
  },
  {
    "path": "UsdShellExtension/ShellPreviewHandlerImpl.h",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#pragma once\n\n#include \"ShellExt_h.h\"\n\n#include \"UsdLoadScreenDlg.h\"\n#include \"resource.h\"\n\n\nclass ATL_NO_VTABLE CShellPreviewHandlerImpl :\n\tpublic CComObjectRootEx<CComSingleThreadModel>,\n\tpublic CComCoClass<CShellPreviewHandlerImpl, &CLSID_ShellPreviewHandler>,\n\tpublic IInitializeWithFile,\n\tpublic IObjectWithSite,\n\tpublic IOleWindow,\n\tpublic IPreviewHandler,\n\tpublic IPreviewHandlerVisuals\n{\npublic:\n\tDECLARE_NOT_AGGREGATABLE(CShellPreviewHandlerImpl)\n\tDECLARE_PROTECT_FINAL_CONSTRUCT()\n\n\tBEGIN_COM_MAP(CShellPreviewHandlerImpl)\n\t\tCOM_INTERFACE_ENTRY(IInitializeWithFile)\n\t\tCOM_INTERFACE_ENTRY(IObjectWithSite)\n\t\tCOM_INTERFACE_ENTRY(IOleWindow)\n\t\tCOM_INTERFACE_ENTRY(IPreviewHandler)\n\t\tCOM_INTERFACE_ENTRY(IPreviewHandlerVisuals)\n\tEND_COM_MAP()\n\n\tHRESULT FinalConstruct();\n\tvoid FinalRelease();\n\n\t// IInitializeWithFile\n\tSTDMETHODIMP Initialize( __RPC__in_string LPCWSTR pszFilePath, DWORD grfMode ) override;\n\n\t// IObjectWithSite\n\tSTDMETHODIMP SetSite(__RPC__in_opt IUnknown* pUnkSite) override;\n\tSTDMETHODIMP GetSite(__RPC__in REFIID riid, __RPC__deref_out_opt void** ppvSite) override;\n\n\t// IOleWindow\n\tSTDMETHODIMP GetWindow(__RPC__deref_out_opt HWND* phwnd) override;\n\tSTDMETHODIMP ContextSensitiveHelp(BOOL fEnterMode) override;\n\n\t// IPreviewHandler\n\tSTDMETHODIMP SetWindow( __RPC__in HWND hwnd, __RPC__in const RECT* prc) override;\n\tSTDMETHODIMP SetRect( __RPC__in const RECT* prc ) override;\n\tSTDMETHODIMP DoPreview() override;\n\tSTDMETHODIMP Unload() override;\n\tSTDMETHODIMP SetFocus() override;\n\tSTDMETHODIMP QueryFocus( __RPC__deref_out_opt HWND* phwnd) override;\n\tSTDMETHODIMP TranslateAccelerator(__RPC__in MSG* pmsg) override;\n\n\t// IPreviewHandlerVisuals\n    STDMETHODIMP SetBackgroundColor(COLORREF color) override;\n    STDMETHODIMP SetFont(__RPC__in const LOGFONTW *plf) override;\n    STDMETHODIMP SetTextColor(COLORREF color) override;\n\n\tstatic HRESULT WINAPI UpdateRegistry(_In_ BOOL bRegister) throw();\n\nprivate:\n\tHRESULT CreateLocalServer();\n\tvoid DestroyLocalServer();\n\n\tCComPtr<IInitializeWithFile> m_pInitializeWithFile;\n\tCComPtr<IObjectWithSite> m_pObjectWithSite;\n\tCComPtr<IOleWindow> m_pOleWindow;\n\tCComPtr<IPreviewHandler> m_pPreviewHandler;\n\tCComPtr<IPreviewHandlerVisuals> m_pPreviewHandlerVisuals;\n\n\tHWND m_hWnd = nullptr;\n\t// raw dpi-unaware rect\n\tRECT m_rcWndRaw = {};\n\t// window rect adjusted for dpi\n\tRECT m_rcWndDpiAware = {};\n\n\tCOLORREF m_clrBackground;\n\tCOLORREF m_clrText;\n\n\tCUsdLoadScreenDlg m_LoadScreenDlg;\n\tbool m_bLoadScreenCreated = false;\n};\n\nOBJECT_ENTRY_AUTO(__uuidof(ShellPreviewHandler), CShellPreviewHandlerImpl)\n\n"
  },
  {
    "path": "UsdShellExtension/ShellPreviewHandlerImpl.rgs",
    "content": "HKCR\n{\n\tNoRemove ATVI.USD\n\t{\n\t\tNoRemove shellex\n\t\t{\n\t\t\tForceRemove {8895b1c6-b41f-4c1c-a562-0d564250836f} = s '%CLSID_SHELLPREVIEWHANDLER%'\n\t\t}\n\t}\n\n\tNoRemove ATVI.USDA\n\t{\n\t\tNoRemove shellex\n\t\t{\n\t\t\tForceRemove {8895b1c6-b41f-4c1c-a562-0d564250836f} = s '%CLSID_SHELLPREVIEWHANDLER%'\n\t\t}\n\t}\n\n\tNoRemove ATVI.USDC\n\t{\n\t\tNoRemove shellex\n\t\t{\n\t\t\tForceRemove {8895b1c6-b41f-4c1c-a562-0d564250836f} = s '%CLSID_SHELLPREVIEWHANDLER%'\n\t\t}\n\t}\n\n\tNoRemove ATVI.USDZ\n\t{\n\t\tNoRemove shellex\n\t\t{\n\t\t\tForceRemove {8895b1c6-b41f-4c1c-a562-0d564250836f} = s '%CLSID_SHELLPREVIEWHANDLER%'\n\t\t}\n\t}\n\n\tNoRemove CLSID\n\t{\n\t\tForceRemove %CLSID_SHELLPREVIEWHANDLER% = s 'Activision USD Preview Handler'\n\t\t{\n\t\t\tForceRemove InProcServer32 = s '%MODULE%'\n\t\t\t{\n\t\t\t\tval ThreadingModel = s 'Apartment'\n\t\t\t}\n\t\t\tval DisplayName = s 'Activision USD Preview Handler'\n\t\t\tval AppID = s '{6d2b5079-2f0b-48dd-ab7f-97cec514d30b}'\n\t\t\tval DisableProcessIsolation = d '1'\n\t\t\tval DisableLowILProcessIsolation = d '1'\n\t\t\tval Icon = s '%MODULE%,-113'\n\t\t}\n\t}\n}\n\nHKLM\n{\n\tNoRemove Software\n\t{\n\t\tNoRemove Microsoft\n\t\t{\n\t\t\tNoRemove Windows\n\t\t\t{\n\t\t\t\tNoRemove CurrentVersion\n\t\t\t\t{\n\t\t\t\t\tNoRemove PreviewHandlers\n\t\t\t\t\t{\n\t\t\t\t\t\tForceRemove val %CLSID_SHELLPREVIEWHANDLER% = s 'Activision USD Preview Handler'\n\t\t\t\t\t}\n\n\t\t\t\t\tNoRemove 'Shell Extensions'\n\t\t\t\t\t{\n\t\t\t\t\t\tNoRemove Approved\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tForceRemove val %CLSID_SHELLPREVIEWHANDLER% = s 'Activision USD Preview Handler'\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nHKCU\n{\n\tNoRemove Software\n\t{\n\t\tNoRemove Microsoft\n\t\t{\n\t\t\tNoRemove Windows\n\t\t\t{\n\t\t\t\tNoRemove CurrentVersion\n\t\t\t\t{\n\t\t\t\t\tNoRemove PreviewHandlers\n\t\t\t\t\t{\n\t\t\t\t\t\tForceRemove val %CLSID_SHELLPREVIEWHANDLER% = s 'Activision USD Preview Handler'\n\t\t\t\t\t}\n\n\t\t\t\t\tNoRemove 'Shell Extensions'\n\t\t\t\t\t{\n\t\t\t\t\t\tNoRemove Approved\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tForceRemove val %CLSID_SHELLPREVIEWHANDLER% = s 'Activision USD Preview Handler'\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}"
  },
  {
    "path": "UsdShellExtension/ShellPropertyStoreImpl.cpp",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include \"stdafx.h\"\n#include \"ShellPropertyStoreImpl.h\"\n#include \"Module.h\"\n#include \"resource.h\"\n#include \"UsdMetadata.h\"\n#include \"UsdPropertyKeys.h\"\n#include \"ArResolverShellExtension.h\"\n\nstatic void RegisterUsdPlugins()\n{\n\tstatic bool sUsdPluginsRegistered = false;\n\tstatic std::mutex sUsdPluginsRegisteredLock;\n\n\tstd::lock_guard<std::mutex> guard( sUsdPluginsRegisteredLock );\n\n\t// Plugins should be registered only once per session.\n\tif( sUsdPluginsRegistered )\n\t\treturn;\n\n\tsUsdPluginsRegistered = true;\n\n\tTCHAR sModulePath[MAX_PATH];\n\tGetModuleFileName( g_hInstance, sModulePath, ARRAYSIZE( sModulePath ) );\n\n\tstd::vector<std::string> pathsToPlugInfo;\n\n\t// add the folder that contains the shell extension\n\tPathCchRemoveFileSpec( sModulePath, ARRAYSIZE( sModulePath ) );\n\tpathsToPlugInfo.push_back( static_cast<LPCSTR>(ATL::CW2A(sModulePath, CP_UTF8)) );\n\n\t// add the bare-bones usd plugins\n\tPathCchAppend( sModulePath, ARRAYSIZE( sModulePath ), L\"usd\" );\n\tpathsToPlugInfo.push_back( static_cast<LPCSTR>(ATL::CW2A(sModulePath, CP_UTF8)) );\n\n\tpxr::PlugRegistry::GetInstance().RegisterPlugins( pathsToPlugInfo );\n\n\tpxr::ArSetPreferredResolver(pxr::TfType::GetCanonicalTypeName(typeid(pxr::ArResolverShellExtension)));\n}\n\nHRESULT CShellPropertyStoreImpl::FinalConstruct()\n{\n\treturn __super::FinalConstruct();\n}\n\nvoid CShellPropertyStoreImpl::FinalRelease()\n{\n\t__super::FinalRelease();\n}\n\n\n// IInitializeWithFile\nSTDMETHODIMP CShellPropertyStoreImpl::Initialize(__RPC__in_string LPCWSTR pszFilePath, DWORD grfMode)\n{\n\tif ( pszFilePath == nullptr )\n\t\treturn E_POINTER;\n\n\tm_usdStagePath = pszFilePath;\n\tm_grfMode = grfMode;\n\n\tDWORD nAttribs = GetFileAttributesW( pszFilePath );\n\tif ( nAttribs == INVALID_FILE_ATTRIBUTES )\n\t\treturn E_INVALIDARG;\n\n\t// Avoid opening files that are reparse points.\n\t// TedFS stubs are such files. An open here would cause a resolve.\n\tif ( nAttribs & FILE_ATTRIBUTE_REPARSE_POINT )\n\t\treturn E_FAIL;\n\n\tHRESULT hr;\n\thr = PSCreateMemoryPropertyStore(IID_PPV_ARGS(&m_pPropertyStoreCache.p));\n\tif ( FAILED( hr ) )\n\t\treturn hr;\n\n\tRegisterUsdPlugins();\n\n\tstd::string pszFilePathA = static_cast<LPCSTR>(ATL::CW2A( m_usdStagePath, CP_UTF8 ));\n\n\t// open the file for just metadata\n\t// this is a fast read-only load\n\tpxr::SdfLayerRefPtr rootLayer = pxr::SdfLayer::OpenAsAnonymous( pszFilePathA, true );\n\tif ( rootLayer == nullptr )\n\t{\n\t\treturn E_FAIL;\n\t}\n\n\tm_bIsPackage = rootLayer->GetFileFormat()->IsPackage();\n\n\tpxr::VtDictionary customLayerData = rootLayer->GetCustomLayerData();\n\n\thr = ReadUsdMetadata( rootLayer, customLayerData, m_pPropertyStoreCache );\n\tif ( FAILED( hr ) )\n\t{\n\t\treturn hr;\n\t}\n\n\treturn hr;\n}\n\n// IPropertyStore\nSTDMETHODIMP CShellPropertyStoreImpl::Commit()\n{\n\tHRESULT hr = E_FAIL;\n\n\tif ( IsReadOnly() || IsPackage() )\n\t\treturn STG_E_ACCESSDENIED;\n\n\tif ( m_pPropertyStoreCache == nullptr )\n\t\treturn E_UNEXPECTED;\n\n\tRegisterUsdPlugins();\n\n\tstd::string pszFilePathA = static_cast<LPCSTR>(ATL::CW2A( m_usdStagePath, CP_UTF8 ));\n\tpxr::SdfLayerRefPtr rootLayer = pxr::SdfLayer::FindOrOpen( pszFilePathA );\n\tif ( rootLayer == nullptr )\n\t\treturn E_FAIL;\n\n\t// save the file back out\n\tbool bIsDirty = false;\n\tpxr::VtDictionary customLayerData = rootLayer->GetCustomLayerData();\n\thr = WriteUsdMetadata( rootLayer, customLayerData, m_pPropertyStoreCache, bIsDirty );\n\tif ( FAILED( hr ) )\n\t\treturn hr;\n\n\t// check if anything changed\n\tif ( bIsDirty == false )\n\t\treturn S_OK;\n\n\t// save our updated metadata\n\trootLayer->SetCustomLayerData( customLayerData );\n\n\tCStringW usdTempStagePath = m_usdStagePath;\n\tusdTempStagePath += L\".tmp\";\n\n\tif ( !rootLayer->Export( static_cast<LPCSTR>(ATL::CW2A( usdTempStagePath, CP_UTF8 )) ) )\n\t\treturn E_FAIL;\n\n\trootLayer = nullptr;\n\n\tif ( !::ReplaceFileW( m_usdStagePath, usdTempStagePath, nullptr, REPLACEFILE_IGNORE_MERGE_ERRORS|REPLACEFILE_IGNORE_ACL_ERRORS, nullptr, nullptr ) )\n\t\treturn E_FAIL;\n\n\treturn S_OK;\n}\n\nSTDMETHODIMP CShellPropertyStoreImpl::GetCount( __RPC__out DWORD *cProps )\n{\n\tif ( cProps == nullptr )\n\t\treturn E_POINTER;\n\n\tHRESULT hr = E_UNEXPECTED;\n\tif ( m_pPropertyStoreCache )\n\t\thr = m_pPropertyStoreCache->GetCount( cProps );\n\n\treturn hr;\n}\n\nSTDMETHODIMP CShellPropertyStoreImpl::GetAt( DWORD iProp, __RPC__out PROPERTYKEY *pkey )\n{\n\tif ( pkey == nullptr )\n\t\treturn E_POINTER;\n\n\tHRESULT hr = E_UNEXPECTED;\n\tif ( m_pPropertyStoreCache )\n\t\thr = m_pPropertyStoreCache->GetAt( iProp, pkey );\n\n\treturn hr;\n}\n\nSTDMETHODIMP CShellPropertyStoreImpl::GetValue( __RPC__in REFPROPERTYKEY key, __RPC__out PROPVARIANT *pv )\n{\n\tif ( pv == nullptr )\n\t\treturn E_POINTER;\n\n\tHRESULT hr = E_UNEXPECTED;\n\tif ( m_pPropertyStoreCache )\n\t\thr = m_pPropertyStoreCache->GetValue( key, pv );\n\n\treturn hr;\n}\n\nSTDMETHODIMP CShellPropertyStoreImpl::SetValue( __RPC__in REFPROPERTYKEY key, __RPC__in REFPROPVARIANT propvar )\n{\n\tif ( IsReadOnly() || IsPackage() )\n\t\treturn STG_E_ACCESSDENIED;\n\n\tHRESULT hr = E_UNEXPECTED;\n\tif ( m_pPropertyStoreCache && IsPropertyWritable(key) == S_OK )\n\t\thr = m_pPropertyStoreCache->SetValueAndState( key, &propvar, PSC_DIRTY );\n\n\treturn hr;\n}\n\n// IPropertyStoreCapabilities\nSTDMETHODIMP CShellPropertyStoreImpl::IsPropertyWritable( __RPC__in REFPROPERTYKEY key )\n{\n\tif ( IsPackage() )\n\t\treturn S_FALSE;\n\n\treturn IsMetadataPropertyWritable( key );\n}\n\nHRESULT WINAPI CShellPropertyStoreImpl::UpdateRegistry(_In_ BOOL bRegister) throw()\n{\n\tconst wchar_t pPropertyDescription[] = \n\t\tL\"val InfoTip = s 'prop:System.ItemType;System.Size;System.DateModified'\\n\"\n\t\tL\"val FullDetails = s 'prop:System.PropGroup.FileSystem;System.ItemNameDisplay;System.ItemType;System.ItemFolderPathDisplay;System.Size;System.ItemDate;System.DateCreated;System.DateModified;System.DateAccessed;System.FileAttributes;USD.PropGroup.USD;System.Comment;USD.Documentation;USD.CustomLayerData;USD.PropGroup.Activision'\\n\"\n\t\tL\"val PreviewDetails = s 'prop:USD.PropGroup.USD;System.Comment;USD.Documentation;USD.PropGroup.Activision'\\n\"\n\t\tL\"val PreviewTitle = s 'prop:System.FileName;System.ItemType'\\n\";\n\n\tATL::_ATL_REGMAP_ENTRY regMapEntries[] =\n\t{\n\t\t{ L\"CLSID_SHELLPROPERTYSTORE\", L\"{5CE761D0-72AA-4484-B2BF-2A0EBF3ACC0C}\" },\n\t\t{ L\"PROPERTYDESCRIPTIONS\", pPropertyDescription },\n\t\t{ nullptr, nullptr }\n\t};\n\n\treturn g_AtlModule.UpdateRegistryFromResource(IDR_REGISTRY_SHELLPROPERTYSTOREIMPL, bRegister, regMapEntries);\n}"
  },
  {
    "path": "UsdShellExtension/ShellPropertyStoreImpl.h",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#pragma once\n\n#include \"ShellExt_h.h\"\n\n#include \"resource.h\"\n\n\nclass ATL_NO_VTABLE CShellPropertyStoreImpl :\n\tpublic CComObjectRootEx<CComSingleThreadModel>,\n\tpublic CComCoClass<CShellPropertyStoreImpl, &CLSID_ShellPropertyStore>,\n\tpublic IInitializeWithFile,\n\tpublic IPropertyStore,\n\tpublic IPropertyStoreCapabilities\n{\npublic:\n\tDECLARE_NOT_AGGREGATABLE(CShellPropertyStoreImpl)\n\tDECLARE_PROTECT_FINAL_CONSTRUCT()\n\n\tBEGIN_COM_MAP(CShellPropertyStoreImpl)\n\t\tCOM_INTERFACE_ENTRY(IInitializeWithFile)\n\t\tCOM_INTERFACE_ENTRY(IPropertyStore)\n\t\tCOM_INTERFACE_ENTRY(IPropertyStoreCapabilities)\n\tEND_COM_MAP()\n\n\tHRESULT FinalConstruct();\n\tvoid FinalRelease();\n\n\t// IInitializeWithFile\n\tSTDMETHODIMP Initialize( __RPC__in_string LPCWSTR pszFilePath, DWORD grfMode ) override;\n\n\t// IPropertyStore\n    STDMETHODIMP GetCount(  __RPC__out DWORD *cProps ) override;\n    STDMETHODIMP GetAt( DWORD iProp, __RPC__out PROPERTYKEY *pkey ) override;\n    STDMETHODIMP GetValue( __RPC__in REFPROPERTYKEY key, __RPC__out PROPVARIANT *pv ) override;\n    STDMETHODIMP SetValue( __RPC__in REFPROPERTYKEY key, __RPC__in REFPROPVARIANT propvar ) override;\n    STDMETHODIMP Commit() override;\n\n\t// IPropertyStoreCapabilities\n    STDMETHODIMP IsPropertyWritable( __RPC__in REFPROPERTYKEY key) override;\n\n\n\tstatic HRESULT WINAPI UpdateRegistry(_In_ BOOL bRegister) throw();\n\nprivate:\n\tbool IsPackage() const { return m_bIsPackage; }\n\tbool IsReadOnly() const { return (m_grfMode & STGM_READWRITE) == 0; }\n\n\tCStringW m_usdStagePath;\n\tDWORD m_grfMode = 0;\n\tbool m_bIsPackage = false;\n\n\tCComPtr<IPropertyStoreCache> m_pPropertyStoreCache;\n\n};\n\nOBJECT_ENTRY_AUTO(__uuidof(ShellPropertyStore), CShellPropertyStoreImpl)\n\n"
  },
  {
    "path": "UsdShellExtension/ShellPropertyStoreImpl.rgs",
    "content": "HKCR\n{\n\tNoRemove ATVI.USD\n\t{\n\t\t%PROPERTYDESCRIPTIONS%\n\t}\n\n\tNoRemove ATVI.USDA\n\t{\n\t\t%PROPERTYDESCRIPTIONS%\n\t}\n\n\tNoRemove ATVI.USDC\n\t{\n\t\t%PROPERTYDESCRIPTIONS%\n\t}\n\n\tNoRemove ATVI.USDZ\n\t{\n\t\t%PROPERTYDESCRIPTIONS%\n\t}\n\n\tNoRemove CLSID\n\t{\n\t\tForceRemove %CLSID_SHELLPROPERTYSTORE% = s 'Activision USD Property Store'\n\t\t{\n\t\t\tForceRemove InProcServer32 = s '%MODULE%'\n\t\t\t{\n\t\t\t\tval ThreadingModel = s 'Apartment'\n\t\t\t}\n\t\t\tval DisplayName = s 'Activision USD Property Store'\n\t\t\tval DisableProcessIsolation = d '1'\n\t\t}\n\t}\n}\n\nHKLM\n{\n\tNoRemove Software\n\t{\n\t\tNoRemove Microsoft\n\t\t{\n\t\t\tNoRemove Windows\n\t\t\t{\n\t\t\t\tNoRemove CurrentVersion\n\t\t\t\t{\n\t\t\t\t\tNoRemove PropertySystem\n\t\t\t\t\t{\n\t\t\t\t\t\tNoRemove PropertyHandlers\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tForceRemove .usd = s '%CLSID_SHELLPROPERTYSTORE%'\n\t\t\t\t\t\t\tForceRemove .usda = s '%CLSID_SHELLPROPERTYSTORE%'\n\t\t\t\t\t\t\tForceRemove .usdc = s '%CLSID_SHELLPROPERTYSTORE%'\n\t\t\t\t\t\t\tForceRemove .usdz = s '%CLSID_SHELLPROPERTYSTORE%'\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tNoRemove 'Shell Extensions'\n\t\t\t\t\t{\n\t\t\t\t\t\tNoRemove Approved\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tForceRemove val %CLSID_SHELLPROPERTYSTORE% = s 'Activision USD Property Store'\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n"
  },
  {
    "path": "UsdShellExtension/ShellThumbnailProviderImpl.cpp",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include \"stdafx.h\"\n#include \"ShellThumbnailProviderImpl.h\"\n#include \"Module.h\"\n#include \"resource.h\"\n\n#import \"UsdPythonToolsLocalServer.tlb\" raw_interfaces_only \n\n\nHRESULT CShellThumbnailProviderImpl::FinalConstruct()\n{\n\treturn __super::FinalConstruct();\n}\n\nvoid CShellThumbnailProviderImpl::FinalRelease()\n{\n\t__super::FinalRelease();\n}\n\nstatic bool GetRendererFromConfig( CComBSTR &outBstr )\n{\n\tTCHAR sModulePath[MAX_PATH];\n\t::GetModuleFileName( g_hInstance, sModulePath, ARRAYSIZE( sModulePath ) );\n\t::PathCchRenameExtension( sModulePath, ARRAYSIZE( sModulePath ), L\"cfg\" );\n\t\n\tTCHAR sRenderer[128];\n\tsRenderer[0] = '\\0';\n\t::GetPrivateProfileString( _T( \"RENDERER\" ), _T( \"THUMBNAIL\" ), _T( \"\" ), sRenderer, ARRAYSIZE( sRenderer ), sModulePath );\n\n\tif ( sRenderer[0] == '\\0' )\n\t\treturn false;\n\n\toutBstr = sRenderer;\n\n\treturn true;\n}\n\n// IInitializeWithFile\nSTDMETHODIMP CShellThumbnailProviderImpl::Initialize(__RPC__in_string LPCWSTR pszFilePath, DWORD grfMode)\n{\n\tUNREFERENCED_PARAMETER( grfMode );\n\n\tif ( pszFilePath == nullptr )\n\t\treturn E_POINTER;\n\n\tm_usdStagePath = pszFilePath;\n\n\treturn S_OK;\n}\n\n// IThumbnailProvider\nSTDMETHODIMP CShellThumbnailProviderImpl::GetThumbnail( UINT cx, __RPC__deref_out_opt HBITMAP *phbmp, __RPC__out WTS_ALPHATYPE *pdwAlpha)\n{\n\tif ( phbmp == nullptr )\n\t\treturn E_POINTER;\n\n\tHRESULT hr;\n\n\tCComPtr<UsdPythonToolsLib::IUsdPythonTools> pUSDTools;\n\thr = pUSDTools.CoCreateInstance( __uuidof(UsdPythonToolsLib::UsdPythonTools) );\n\tif ( FAILED( hr ) )\n\t\treturn hr;\n\n\tCComBSTR bstrRenderer;\n\tbool bRendererIsSet = GetRendererFromConfig( bstrRenderer );\n\n\tBSTR sThumbnailImage = nullptr;\n\thr = pUSDTools->Record( CComBSTR(m_usdStagePath), cx, bRendererIsSet ? bstrRenderer : nullptr, &sThumbnailImage );\n\tif ( FAILED( hr ) )\n\t\treturn hr;\n\n\tCComBSTR bstrThumbnailImage;\n\tbstrThumbnailImage.Attach( sThumbnailImage );\n\n\tCImage imgBmp;\n\thr = imgBmp.Load( bstrThumbnailImage );\n\tif ( FAILED( hr ) )\n\t\treturn hr;\n\n\t*phbmp = imgBmp.Detach();\n\n\tif ( pdwAlpha )\n\t\t*pdwAlpha = WTSAT_ARGB;\n\n\treturn S_OK;\n}\n\n\nHRESULT WINAPI CShellThumbnailProviderImpl::UpdateRegistry(_In_ BOOL bRegister) throw()\n{\n\tATL::_ATL_REGMAP_ENTRY regMapEntries[] =\n\t{\n\t\t{ L\"CLSID_SHELLTHUMBNAILPROVIDER\", L\"{2877CB72-1427-43B0-A2B4-9CB1B2BA8C53}\" },\n\t\t{ nullptr, nullptr }\n\t};\n\n\treturn g_AtlModule.UpdateRegistryFromResource(IDR_REGISTRY_SHELLTHUMBNAILPROVIDERIMPL, bRegister, regMapEntries);\n}"
  },
  {
    "path": "UsdShellExtension/ShellThumbnailProviderImpl.h",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#pragma once\n\n#include \"ShellExt_h.h\"\n\n#include \"resource.h\"\n\n\nclass ATL_NO_VTABLE CShellThumbnailProviderImpl :\n\tpublic CComObjectRootEx<CComSingleThreadModel>,\n\tpublic CComCoClass<CShellThumbnailProviderImpl, &CLSID_ShellThumbnailProvider>,\n\tpublic IInitializeWithFile,\n\tpublic IThumbnailProvider\n{\npublic:\n\tDECLARE_NOT_AGGREGATABLE(CShellThumbnailProviderImpl)\n\tDECLARE_PROTECT_FINAL_CONSTRUCT()\n\n\tBEGIN_COM_MAP(CShellThumbnailProviderImpl)\n\t\tCOM_INTERFACE_ENTRY(IInitializeWithFile)\n\t\tCOM_INTERFACE_ENTRY(IThumbnailProvider)\n\tEND_COM_MAP()\n\n\tHRESULT FinalConstruct();\n\tvoid FinalRelease();\n\n\t// IInitializeWithFile\n\tSTDMETHODIMP Initialize( __RPC__in_string LPCWSTR pszFilePath, DWORD grfMode ) override;\n\n\t// IThumbnailProvider\n\tSTDMETHODIMP GetThumbnail( UINT cx, __RPC__deref_out_opt HBITMAP *phbmp, __RPC__out WTS_ALPHATYPE *pdwAlpha) override;\n\n\tstatic HRESULT WINAPI UpdateRegistry(_In_ BOOL bRegister) throw();\n\nprivate:\n\tCStringW m_usdStagePath;\n};\n\nOBJECT_ENTRY_AUTO(__uuidof(ShellThumbnailProvider), CShellThumbnailProviderImpl)\n\n"
  },
  {
    "path": "UsdShellExtension/ShellThumbnailProviderImpl.rgs",
    "content": "HKCR\n{\n\tNoRemove ATVI.USD\n\t{\n\t\tNoRemove shellex\n\t\t{\n\t\t\tForceRemove {e357fccd-a995-4576-b01f-234630154e96} = s '%CLSID_SHELLTHUMBNAILPROVIDER%'\n\t\t}\n\t\tForceRemove DefaultIcon = s '%MODULE%,-113'\n\t}\n\n\tNoRemove ATVI.USDA\n\t{\n\t\tNoRemove shellex\n\t\t{\n\t\t\tForceRemove {e357fccd-a995-4576-b01f-234630154e96} = s '%CLSID_SHELLTHUMBNAILPROVIDER%'\n\t\t}\n\t\tForceRemove DefaultIcon = s '%MODULE%,-113'\n\t}\n\n\tNoRemove ATVI.USDC\n\t{\n\t\tNoRemove shellex\n\t\t{\n\t\t\tForceRemove {e357fccd-a995-4576-b01f-234630154e96} = s '%CLSID_SHELLTHUMBNAILPROVIDER%'\n\t\t}\n\t\tForceRemove DefaultIcon = s '%MODULE%,-113'\n\t}\n\n\tNoRemove ATVI.USDZ\n\t{\n\t\tNoRemove shellex\n\t\t{\n\t\t\tForceRemove {e357fccd-a995-4576-b01f-234630154e96} = s '%CLSID_SHELLTHUMBNAILPROVIDER%'\n\t\t}\n\t\tForceRemove DefaultIcon = s '%MODULE%,-113'\n\t}\n\n\tNoRemove CLSID\n\t{\n\t\tForceRemove %CLSID_SHELLTHUMBNAILPROVIDER% = s 'Activision USD Thumbnail Provider'\n\t\t{\n\t\t\tForceRemove InProcServer32 = s '%MODULE%'\n\t\t\t{\n\t\t\t\tval ThreadingModel = s 'Apartment'\n\t\t\t}\n\t\t\tval DisplayName = s 'Activision USD Thumbnail Provider'\n\t\t\tval DisableProcessIsolation = d '1'\n\t\t\tval DisableLowILProcessIsolation = d '1'\n\t\t}\n\t}\n}\n\nHKLM\n{\n\tNoRemove Software\n\t{\n\t\tNoRemove Microsoft\n\t\t{\n\t\t\tNoRemove Windows\n\t\t\t{\n\t\t\t\tNoRemove CurrentVersion\n\t\t\t\t{\n\t\t\t\t\tNoRemove 'Shell Extensions'\n\t\t\t\t\t{\n\t\t\t\t\t\tNoRemove Approved\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tForceRemove val %CLSID_SHELLTHUMBNAILPROVIDER% = s 'Activision USD Thumbnail Provider'\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nHKCU\n{\n\tNoRemove Software\n\t{\n\t\tNoRemove Microsoft\n\t\t{\n\t\t\tNoRemove Windows\n\t\t\t{\n\t\t\t\tNoRemove CurrentVersion\n\t\t\t\t{\n\t\t\t\t\tNoRemove 'Shell Extensions'\n\t\t\t\t\t{\n\t\t\t\t\t\tNoRemove Approved\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tForceRemove val %CLSID_SHELLTHUMBNAILPROVIDER% = s 'Activision USD Thumbnail Provider'\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}"
  },
  {
    "path": "UsdShellExtension/UWPProgressBar.cpp",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include \"stdafx.h\"\n#include \"UWPProgressBar.h\"\n\nstatic float GetPerformanceFrequency()\n{\n\tLARGE_INTEGER li;\n\tQueryPerformanceFrequency( &li );\n\treturn (float)li.QuadPart;\n}\n\nstatic float GetTimeInterval()\n{\n\tstatic float s_fFreq = GetPerformanceFrequency();\n\treturn s_fFreq;\n}\n\nstatic float GetTimePrecise()\n{\n\tLARGE_INTEGER li;\n\tQueryPerformanceCounter( &li );\n\n\treturn (float)li.QuadPart / (GetTimeInterval() / 1000.0f);\n}\n\nvoid CUWPProgressBar::Init()\n{\n\tm_LastUpdateTime = GetTimePrecise();\n\n\tm_ptProgressBarDot[0].Y = -10.0f;\n\tm_ptProgressBarDot[0].X = 0;\n\tfor ( int i = 1; i < ARRAYSIZE( m_ptProgressBarDot ); ++i )\n\t{\n\t\tm_ptProgressBarDot[i].Y = m_ptProgressBarDot[i - 1].Y - 0.5f;\n\t\tm_ptProgressBarDot[i].X = 0.0f;\n\t}\n}\n\nvoid CUWPProgressBar::UpdateProgressBar()\n{\n\tfloat tCurrent = GetTimePrecise();\n\tfloat fDelta = (float)(tCurrent - m_LastUpdateTime);\n\tm_LastUpdateTime = tCurrent;\n\n\tfDelta /= 100.0f;\n\n\tfor ( Gdiplus::PointF &pt : m_ptProgressBarDot )\n\t{\n\t\tpt.Y += fDelta;\n\n\t\t// x = (y^3 / 32) + y\n\t\t// the resulting ranges are:\n\t\t// x: [-30,+30]\n\t\t// y: [-10,+10]\n\t\tpt.X = ((pt.Y * pt.Y * pt.Y) / 32.0f) + pt.Y;\n\n\t\t// if we are past our range, go back to -10.0f\n\t\tif ( pt.Y > 10.0f )\n\t\t\tpt.Y -= 20.0f;\n\t}\n}\n\nvoid CUWPProgressBar::DrawProgressBar( HWND hWnd, Gdiplus::Graphics &gfx, Gdiplus::RectF &rcArea, Gdiplus::Color &backgroundColor )\n{\n\tfloat fDpiWindow = static_cast<float>(::GetDpiForWindow( hWnd ));\n\tfloat fDpiScale = fDpiWindow / USER_DEFAULT_SCREEN_DPI;\n\n\tGdiplus::SolidBrush brush( backgroundColor );\n\tgfx.FillRectangle( &brush, rcArea );\n\n\tGdiplus::SizeF dot;\n\tdot.Width = kfProgressBarDotSize;\n\tdot.Height = kfProgressBarDotSize;\n\n\t// DPI adjust\n\tdot.Width *= fDpiScale;\n\tdot.Height *= fDpiScale;\n\n\tfor ( Gdiplus::PointF &pt : m_ptProgressBarDot )\n\t{\n\t\t// dots do not look good in a width below 720 or so\n\t\tfloat fScaledWidth = std::max<float>( 720.0f, (float)rcArea.Width );\n\n\t\t// pt.X [-30.0f, 30.0f]\n\t\tfloat scaledX = (((pt.X + 30.0f) * fScaledWidth) / 60.0f);\n\t\tscaledX += ((float)rcArea.Width - fScaledWidth) / 2.0f;\n\t\tif ( scaledX < 0 || (scaledX + dot.Width) >= rcArea.Width )\n\t\t\tcontinue;\n\n\t\tGdiplus::RectF rcDot(\n\t\t\trcArea.X + scaledX,\n\t\t\trcArea.Y + ((rcArea.Height - dot.Height) / 2.0f),\n\t\t\tdot.Width,\n\t\t\tdot.Height );\n\n\t\tGdiplus::Color clrDot;\n\t\tBYTE bAlpha = (BYTE)(((100.0f - fabsf( pt.X )) / 100.0f) * 255.0f);\n\t\t//clrDot.SetValue( Gdiplus::Color::MakeARGB(bAlpha, 52, 198, 243) );\n\t\tclrDot.SetValue( Gdiplus::Color::MakeARGB( bAlpha, 200, 200, 200 ) );\n\t\tGdiplus::SolidBrush brushDot( clrDot );\n\n\t\tgfx.FillEllipse( &brushDot, rcDot );\n\t}\n}\n\nvoid CUWPProgressBar::SetBackgroundColor( COLORREF color, bool bWindowsExplorerUsingLightTheme )\n{\n\tUNREFERENCED_PARAMETER( color );\n\n\tm_bWindowsExplorerUsingLightTheme = bWindowsExplorerUsingLightTheme;\n}"
  },
  {
    "path": "UsdShellExtension/UWPProgressBar.h",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#pragma once\n\n// This class attempts to replicate the UWP XAML progress bar\n\nclass CUWPProgressBar\n{\npublic:\n\tvoid Init();\n\n\tvoid UpdateProgressBar();\n\tvoid DrawProgressBar( HWND hWnd, Gdiplus::Graphics &gfx, Gdiplus::RectF &rcDst, Gdiplus::Color &backgroundColor );\n\tvoid SetBackgroundColor( COLORREF color, bool bWindowsExplorerUsingLightTheme );\n\nprivate:\n\tstatic constexpr size_t knProgressBarDotCount = 5;\n\tstatic constexpr float kfProgressBarDotSize = 4.0f;\n\tGdiplus::PointF m_ptProgressBarDot[knProgressBarDotCount];\n\tfloat m_LastUpdateTime = 0;\n\tbool m_bWindowsExplorerUsingLightTheme = true;\n};\n"
  },
  {
    "path": "UsdShellExtension/UsdLoadScreenDlg.cpp",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include \"stdafx.h\"\n#include \"UsdLoadScreenDlg.h\"\n#include \"Module.h\"\n#include \"resource.h\"\n\n#include <algorithm>\n\nstatic constexpr UINT s_TimerIdProgress = 100;\n\nstatic Gdiplus::Image *LoadImageFromResourcePNG( UINT nId )\n{\n\tHRSRC hrscPng = ::FindResource( g_hInstance, MAKEINTRESOURCE( nId ), _T( \"PNG\" ) );\n\tif ( hrscPng != nullptr )\n\t{\n\t\tHGLOBAL hPng = ::LoadResource( g_hInstance, hrscPng );\n\t\tif ( hPng != nullptr )\n\t\t{\n\t\t\tvoid *pImageData = ::LockResource( hPng );\n\t\t\tif ( pImageData != nullptr )\n\t\t\t{\n\t\t\t\tDWORD nSize = ::SizeofResource( g_hInstance, hrscPng );\n\n\t\t\t\tCComPtr<IStream> pImageStream;\n\t\t\t\tpImageStream.p = ::SHCreateMemStream( reinterpret_cast<BYTE *>(pImageData), nSize );\n\n\t\t\t\tGdiplus::Image *img = Gdiplus::Image::FromStream( pImageStream );\n\t\t\t\treturn img;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nullptr;\n}\n\nLRESULT CUsdLoadScreenDlg::OnInitDialog( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled )\n{\n\tUNREFERENCED_PARAMETER( uMsg );\n\tUNREFERENCED_PARAMETER( wParam );\n\tUNREFERENCED_PARAMETER( lParam );\n\tUNREFERENCED_PARAMETER( bHandled );\n\n\tSetWindowText( _T( \"UsdLoadScreenDlg\" ) );\n\n\tGdiplus::GdiplusStartupInputEx gdiplusStartupInput;\n\tGdiplus::GdiplusStartup( &m_gdiplusToken, &gdiplusStartupInput, nullptr );\n\n\tm_pImgLoadScreen = LoadImageFromResourcePNG( IDB_LOADSCREEN );\n\tm_pImgLogo = LoadImageFromResourcePNG( IDB_LOGO );\n\n\tRECT rcClient;\n\tGetClientRect( &rcClient );\n\n\tm_ProgressBar.Init();\n\n\tCreateBackBuffer( rcClient.right - rcClient.left, rcClient.bottom - rcClient.top );\n\tif ( m_pGfx )\n\t\tDraw( *m_pGfx );\n\n\tSetTimer( s_TimerIdProgress, 1, nullptr );\n\n\treturn 0;\n}\n\nLRESULT CUsdLoadScreenDlg::OnPaint( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled )\n{\n\tUNREFERENCED_PARAMETER( uMsg );\n\tUNREFERENCED_PARAMETER( wParam );\n\tUNREFERENCED_PARAMETER( lParam );\n\tUNREFERENCED_PARAMETER( bHandled );\n\n\tPAINTSTRUCT ps;\n\tHDC hDCFrontBuffer = BeginPaint( &ps );\n\n\tif ( !m_imgBackBuffer.IsNull() )\n\t{\n\t\tPOINT ptSrc = { ps.rcPaint.left, ps.rcPaint.top };\n\t\tm_imgBackBuffer.BitBlt( hDCFrontBuffer, ps.rcPaint, ptSrc, SRCCOPY );\n\t}\n\n\tEndPaint( &ps );\n\n\treturn 0;\n}\n\nLRESULT CUsdLoadScreenDlg::OnEraseBkgnd( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled )\n{\n\tUNREFERENCED_PARAMETER( uMsg );\n\tUNREFERENCED_PARAMETER( wParam );\n\tUNREFERENCED_PARAMETER( lParam );\n\tUNREFERENCED_PARAMETER( bHandled );\n\n\treturn (LRESULT)::GetStockObject( NULL_BRUSH );\n}\n\nLRESULT CUsdLoadScreenDlg::OnSize( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled )\n{\n\tUNREFERENCED_PARAMETER( uMsg );\n\tUNREFERENCED_PARAMETER( wParam );\n\tUNREFERENCED_PARAMETER( bHandled );\n\n\tUINT width = LOWORD( lParam );\n\tUINT height = HIWORD( lParam );\n\n\tCreateBackBuffer( width, height );\n\tif ( m_pGfx )\n\t\tDraw( *m_pGfx );\n\tInvalidate( FALSE );\n\n\treturn 0;\n}\n\nLRESULT CUsdLoadScreenDlg::OnCtlColorDlg( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled )\n{\n\tUNREFERENCED_PARAMETER( uMsg );\n\tUNREFERENCED_PARAMETER( wParam );\n\tUNREFERENCED_PARAMETER( lParam );\n\tUNREFERENCED_PARAMETER( bHandled );\n\n\treturn (LRESULT)::GetStockObject( NULL_BRUSH );\n}\n\nLRESULT CUsdLoadScreenDlg::OnTimer( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled )\n{\n\tUNREFERENCED_PARAMETER( uMsg );\n\tUNREFERENCED_PARAMETER( lParam );\n\tUNREFERENCED_PARAMETER( bHandled );\n\n\tswitch ( wParam )\n\t{\n\tcase s_TimerIdProgress:\n\t\tif ( m_pGfx && m_hWnd )\n\t\t{\n\t\t\tm_ProgressBar.UpdateProgressBar();\n\t\t\tm_ProgressBar.DrawProgressBar( m_hWnd, *m_pGfx, m_rcProgressArea, m_Background );\n\t\t\tInvalidateProgressBar( m_rcProgressArea );\n\t\t}\n\t\tbreak;\n\t}\n\n\treturn 0;\n}\n\nvoid CUsdLoadScreenDlg::SetBackgroundColor( COLORREF color )\n{\n\tif ( m_hBackground )\n\t{\n\t\t::DeleteObject( m_hBackground );\n\t\tm_hBackground = nullptr;\n\t}\n\n\tm_bWindowsExplorerUsingLightTheme = true;\n\n\tCRegKey regDarkMode;\n\tLRESULT lr = regDarkMode.Open( HKEY_CURRENT_USER, _T( \"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Themes\\\\Personalize\" ), KEY_READ );\n\tif ( lr == ERROR_SUCCESS )\n\t{\n\t\tDWORD nSystemUsesLightTheme = 0;\n\t\tlr = regDarkMode.QueryDWORDValue( _T( \"SystemUsesLightTheme\" ), nSystemUsesLightTheme );\n\t\tif ( lr == ERROR_SUCCESS )\n\t\t{\n\t\t\tm_bWindowsExplorerUsingLightTheme = (nSystemUsesLightTheme != 0);\n\t\t}\n\t}\n\n\t// Colors hard-coded to Windows 10 2003 Explorer\n\tif ( m_bWindowsExplorerUsingLightTheme == false )\n\t\tcolor = RGB( 32, 32, 32 );\n\n\tm_Background.SetFromCOLORREF( color );\n\n\tm_hBackground = ::CreateSolidBrush( color );\n\n\tm_ProgressBar.SetBackgroundColor( color, m_bWindowsExplorerUsingLightTheme );\n\n\tif ( m_pGfx )\n\t{\n\t\tDraw( *m_pGfx );\n\t\tInvalidate( FALSE );\n\t}\n}\n\nvoid CUsdLoadScreenDlg::OnFinalMessage( _In_ HWND hWnd )\n{\n\tUNREFERENCED_PARAMETER( hWnd );\n\n\tif ( m_hBackground )\n\t{\n\t\t::DeleteObject( m_hBackground );\n\t\tm_hBackground = nullptr;\n\t}\n\n\tdelete m_pImgLoadScreen;\n\tm_pImgLoadScreen = nullptr;\n\n\tif ( m_pGfx )\n\t{\n\t\tdelete m_pGfx;\n\t\tm_pGfx = nullptr;\n\t}\n\tif ( m_hDCBackbuffer )\n\t{\n\t\tm_imgBackBuffer.ReleaseDC();\n\t\tm_hDCBackbuffer = nullptr;\n\t}\n\tm_imgBackBuffer.Destroy();\n\n\tGdiplus::GdiplusShutdown( m_gdiplusToken );\n}\n\nvoid CUsdLoadScreenDlg::CreateBackBuffer( UINT width, UINT height )\n{\n\tif ( m_pGfx )\n\t{\n\t\tdelete m_pGfx;\n\t\tm_pGfx = nullptr;\n\t}\n\tif ( m_hDCBackbuffer )\n\t{\n\t\tm_imgBackBuffer.ReleaseDC();\n\t\tm_hDCBackbuffer = nullptr;\n\t}\n\tm_imgBackBuffer.Destroy();\n\n\tif ( width == 0 || height == 0 )\n\t\treturn;\n\n\tm_imgBackBuffer.Create( width, height, 32, 0 );\n\tm_hDCBackbuffer = m_imgBackBuffer.GetDC();\n\tm_pGfx = Gdiplus::Graphics::FromHDC( m_hDCBackbuffer );\n\n\tm_pGfx->SetCompositingMode( Gdiplus::CompositingModeSourceOver );\n\tm_pGfx->SetCompositingQuality( Gdiplus::CompositingQualityGammaCorrected );\n\tm_pGfx->SetInterpolationMode( Gdiplus::InterpolationModeHighQualityBicubic );\n\tm_pGfx->SetSmoothingMode( Gdiplus::SmoothingModeAntiAlias );\n}\n\nvoid CUsdLoadScreenDlg::Draw( Gdiplus::Graphics &gfx )\n{\n\tif ( m_imgBackBuffer.IsNull() )\n\t\treturn;\n\n\tGdiplus::SolidBrush brush( m_Background );\n\tgfx.FillRectangle( &brush, 0, 0, static_cast<INT>(m_imgBackBuffer.GetWidth()), static_cast<INT>(m_imgBackBuffer.GetHeight()) );\n\n\tfloat fDpiWindow = static_cast<float>(::GetDpiForWindow( m_hWnd ));\n\tfloat fDpiScale = fDpiWindow / USER_DEFAULT_SCREEN_DPI;\n\n\tif ( m_pImgLoadScreen != nullptr )\n\t{\n\t\tGdiplus::SizeF margins;\n\t\tmargins.Width = 50.0f;\n\t\tmargins.Height = 50.0f;\n\n\t\tGdiplus::SizeF sizeWindow;\n\t\tsizeWindow.Width = std::max<Gdiplus::REAL>( 0.0f, m_imgBackBuffer.GetWidth() - (margins.Width * 2) );\n\t\tsizeWindow.Height = std::max<Gdiplus::REAL>( 0.0f, m_imgBackBuffer.GetHeight() - (margins.Height * 2) );\n\n\t\t// initialize the size of the image we draw to the ideal size\n\t\tGdiplus::SizeF sizeImageOriginal;\n\t\tsizeImageOriginal.Width = static_cast<Gdiplus::REAL>(m_pImgLoadScreen->GetWidth());\n\t\tsizeImageOriginal.Height = static_cast<Gdiplus::REAL>(m_pImgLoadScreen->GetHeight());\n\n\t\t// DPI adjust\n\t\tGdiplus::SizeF sizeImageOriginalDpi = sizeImageOriginal;\n\t\tsizeImageOriginalDpi.Width *= fDpiScale;\n\t\tsizeImageOriginalDpi.Height *= fDpiScale;\n\n\t\tGdiplus::SizeF sizeImageResized = sizeImageOriginalDpi;\n\n\t\tif ( sizeImageOriginalDpi.Width > sizeWindow.Width )\n\t\t{\n\t\t\tfloat fAspectRatio = sizeImageOriginalDpi.Height / sizeImageOriginalDpi.Width;\n\t\t\tGdiplus::SizeF sizeNew;\n\t\t\tsizeNew.Width = sizeWindow.Width;\n\t\t\tsizeNew.Height = sizeWindow.Width * fAspectRatio;\n\n\t\t\tif ( sizeNew.Width < sizeImageResized.Width || sizeNew.Height < sizeImageResized.Height )\n\t\t\t\tsizeImageResized = sizeNew;\n\t\t}\n\n\t\tif ( sizeImageOriginalDpi.Height > sizeWindow.Height )\n\t\t{\n\t\t\tfloat fAspectRatio = sizeImageOriginalDpi.Width / sizeImageOriginalDpi.Height;\n\t\t\tGdiplus::SizeF sizeNew;\n\t\t\tsizeNew.Height = sizeWindow.Height;\n\t\t\tsizeNew.Width = sizeWindow.Height * fAspectRatio;\n\n\t\t\tif ( sizeNew.Width < sizeImageResized.Width || sizeNew.Height < sizeImageResized.Height )\n\t\t\t\tsizeImageResized = sizeNew;\n\t\t}\n\n\t\tGdiplus::RectF rcSrc(\n\t\t\t0, 0,\n\t\t\tsizeImageOriginal.Width,\n\t\t\tsizeImageOriginal.Height );\n\n\t\tGdiplus::RectF rcDst(\n\t\t\t((sizeWindow.Width - sizeImageResized.Width) / 2.0f) + margins.Width,\n\t\t\t((sizeWindow.Height - sizeImageResized.Height) / 2.0f) + margins.Height,\n\t\t\tsizeImageResized.Width,\n\t\t\tsizeImageResized.Height );\n\n\t\tgfx.DrawImage( m_pImgLoadScreen, rcDst, rcSrc, Gdiplus::UnitPixel );\n\n\t\tm_rcProgressArea = Gdiplus::RectF(\n\t\t\t2.0f,\n\t\t\trcDst.GetBottom(),\n\t\t\tstatic_cast<Gdiplus::REAL>(m_imgBackBuffer.GetWidth() - 4),\n\t\t\tmargins.Height\n\t\t);\n\t\tm_ProgressBar.DrawProgressBar( m_hWnd, gfx, m_rcProgressArea, m_Background );\n\t}\n\n\tif ( m_pImgLogo != nullptr )\n\t{\n\t\tGdiplus::SizeF margins;\n\t\tmargins.Width = 10.0f;\n\t\tmargins.Height = 10.0f;\n\n\t\tGdiplus::SizeF sizeWindow;\n\t\tsizeWindow.Width = std::max<Gdiplus::REAL>( 0.0f, m_imgBackBuffer.GetWidth() - (margins.Width * 2) );\n\t\tsizeWindow.Height = std::max<Gdiplus::REAL>( 0.0f, m_imgBackBuffer.GetHeight() - (margins.Height * 2) );\n\n\t\t// initialize the size of the image we draw to the ideal size\n\t\tGdiplus::SizeF sizeImageOriginal;\n\t\tsizeImageOriginal.Width = static_cast<Gdiplus::REAL>(m_pImgLogo->GetWidth());\n\t\tsizeImageOriginal.Height = static_cast<Gdiplus::REAL>(m_pImgLogo->GetHeight());\n\n\t\tGdiplus::SizeF sizeImageResized = sizeImageOriginal;\n\t\tsizeImageResized.Width /= 6.0f;\n\t\tsizeImageResized.Height /= 6.0f;\n\n\t\t// DPI adjust\n\t\tsizeImageResized.Width *= fDpiScale;\n\t\tsizeImageResized.Height *= fDpiScale;\n\n\t\tGdiplus::RectF rcSrc(\n\t\t\t0, 0,\n\t\t\tsizeImageOriginal.Width,\n\t\t\tsizeImageOriginal.Height );\n\n\t\tGdiplus::RectF rcDst(\n\t\t\tsizeWindow.Width - sizeImageResized.Width,\n\t\t\tsizeWindow.Height - sizeImageResized.Height,\n\t\t\tsizeImageResized.Width,\n\t\t\tsizeImageResized.Height );\n\n\t\t// do not draw if there is no room\n\t\tif ( m_rcProgressArea.GetBottom() < rcDst.GetTop() )\n\t\t{\n\t\t\t// invert colors for the light theme\n\t\t\tconst float alpha = 0.25f;\n\t\t\tGdiplus::ColorMatrix matrixLightTheme =\n\t\t\t{\n\t\t\t\t-1, 0, 0, 0, 0,\n\t\t\t\t0, -1, 0, 0, 0,\n\t\t\t\t0, 0, -1, 0, 0,\n\t\t\t\t0, 0, 0, alpha, 0,\n\t\t\t\t0, 0, 0, 0, 1\n\t\t\t};\n\t\t\tGdiplus::ColorMatrix matrixDarkTheme =\n\t\t\t{\n\t\t\t\t1, 0, 0, 0, 0,\n\t\t\t\t0, 1, 0, 0, 0,\n\t\t\t\t0, 0, 1, 0, 0,\n\t\t\t\t0, 0, 0, alpha, 0,\n\t\t\t\t0, 0, 0, 0, 1\n\t\t\t};\n\n\t\t\tGdiplus::ImageAttributes attrib;\n\t\t\tattrib.SetColorMatrix( m_bWindowsExplorerUsingLightTheme ? &matrixLightTheme : &matrixDarkTheme );\n\n\t\t\tgfx.DrawImage( m_pImgLogo, rcDst, rcSrc, Gdiplus::UnitPixel, &attrib );\n\t\t}\n\t}\n}\n\nvoid CUsdLoadScreenDlg::InvalidateProgressBar( Gdiplus::RectF &rcArea )\n{\n\tRECT rc;\n\trc.left = static_cast<LONG>(rcArea.GetLeft());\n\trc.top = static_cast<LONG>(rcArea.GetTop());\n\trc.right = static_cast<LONG>(rcArea.GetRight());\n\trc.bottom = static_cast<LONG>(rcArea.GetBottom());\n\tInvalidateRect( &rc, FALSE );\n}"
  },
  {
    "path": "UsdShellExtension/UsdLoadScreenDlg.h",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#pragma once\n\n#include \"resource.h\"\n#include \"UWPProgressBar.h\"\n\nclass CUsdLoadScreenDlg : public CDialogImpl<CUsdLoadScreenDlg>\n{\npublic:\n\tenum { IDD = IDD_LOADSCREEN };\n\n\tvoid SetBackgroundColor( COLORREF color );\n\nprivate:\n\tvoid OnFinalMessage( _In_ HWND hWnd ) override;\n\n\tvoid CreateBackBuffer( UINT width, UINT height );\n\tvoid Draw( Gdiplus::Graphics &gfx );\n\n\tvoid InvalidateProgressBar( Gdiplus::RectF &rcArea );\n\n\tBEGIN_MSG_MAP( CUsdLoadScreenDlg )\n\t\tMESSAGE_HANDLER( WM_INITDIALOG, OnInitDialog )\n\t\tMESSAGE_HANDLER( WM_PAINT, OnPaint )\n\t\tMESSAGE_HANDLER( WM_ERASEBKGND, OnEraseBkgnd )\n\t\tMESSAGE_HANDLER( WM_SIZE, OnSize )\n\t\tMESSAGE_HANDLER( WM_CTLCOLORDLG, OnCtlColorDlg )\n\t\tMESSAGE_HANDLER( WM_TIMER, OnTimer )\n\tEND_MSG_MAP()\n\n\tLRESULT OnInitDialog( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled );\n\tLRESULT OnPaint( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled );\n\tLRESULT OnEraseBkgnd( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled );\n\tLRESULT OnSize( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled );\n\tLRESULT OnCtlColorDlg( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled );\n\tLRESULT OnTimer( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled );\n\n\tCUWPProgressBar m_ProgressBar;\n\n\tCImage m_imgBackBuffer;\n\tHBRUSH m_hBackground = nullptr;\n\tULONG_PTR m_gdiplusToken = 0;\n\tGdiplus::Image *m_pImgLoadScreen = nullptr;\n\tGdiplus::Image *m_pImgLogo = nullptr;\n\tGdiplus::Color m_Background;\n\n\tHDC m_hDCBackbuffer = nullptr;\n\tGdiplus::Graphics *m_pGfx = nullptr;\n\tGdiplus::RectF m_rcProgressArea;\n\n\tbool m_bWindowsExplorerUsingLightTheme = true;\n};\n\nclass CAutoDpiAware\n{\npublic:\n\tCAutoDpiAware(DPI_AWARENESS_CONTEXT ctx)\n\t{\n\t\tm_PreviousContext = ::GetThreadDpiAwarenessContext();\n\t\t::SetThreadDpiAwarenessContext( ctx );\n\t}\n\t~CAutoDpiAware()\n\t{\n\t\t::SetThreadDpiAwarenessContext( m_PreviousContext );\n\t}\n\nprivate:\n\tDPI_AWARENESS_CONTEXT m_PreviousContext;\n};"
  },
  {
    "path": "UsdShellExtension/UsdMetadata.cpp",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include \"stdafx.h\"\n#include \"UsdMetadata.h\"\n#include \"UsdPropertyKeys.h\"\n\nstatic std::string DictionaryToString(const pxr::VtDictionary &dict, std::string prefix = \"\")\n{\n\t// Exports all values on separate lines\n\t// Format: dict.key=value\n\n\tstd::string result;\n\n\tfor ( const std::pair<std::string, pxr::VtValue>& stat : dict )\n\t{\n\t\tif ( stat.second.GetTypeid() == typeid(pxr::VtDictionary) )\n\t\t{\n\t\t\tpxr::VtDictionary nestedDict = stat.second.Get<pxr::VtDictionary>();\n\t\t\tstd::string nestedPrefix = prefix;\n\t\t\tif ( !nestedPrefix.empty() )\n\t\t\t\tnestedPrefix += \".\";\n\t\t\tnestedPrefix += stat.first;\n\t\t\tresult += DictionaryToString( nestedDict, nestedPrefix );\n\t\t}\n\t\telse\n\t\t{\n\t\t\tstd::string name = prefix;\n\t\t\tif ( !name.empty() )\n\t\t\t\tname += \".\";\n\t\t\tname += stat.first;\n\n\t\t\tstd::stringstream ss;\n\t\t\tif ( stat.second.GetTypeid() == typeid(size_t) )\n\t\t\t\tss << name << \"=\" << stat.second.Get<size_t>() << std::endl;\n\t\t\telse if ( stat.second.GetTypeid() == typeid(double) )\n\t\t\t\tss << name << \"=\" << stat.second.Get<double>() << std::endl;\n\t\t\telse if ( stat.second.GetTypeid() == typeid(std::string) )\n\t\t\t\tss << name << \"=\" << stat.second << std::endl;\n\t\t\telse\n\t\t\t\tss << name << \"=\" << \"[UNKNOWN TYPE]\" << std::endl;\n\n\t\t\tresult += ss.str();\n\t\t}\n\t}\n\n\treturn result;\n}\n\nHRESULT ReadUsdMetadata( const pxr::SdfLayerRefPtr &rootLayer, const pxr::VtDictionary &customLayerData, IPropertyStoreCache* pPropertyStoreCache )\n{\n\tHRESULT hr;\n\n\tstd::string sComment = rootLayer->GetComment();\n\thr = StoreStringValue( pPropertyStoreCache, PKEY_Comment, sComment.c_str() );\n\n\tstd::string sDocumentation = rootLayer->GetDocumentation();\n\thr = StoreStringValue( pPropertyStoreCache, PKEY_USD_DOCUMENTATION, sDocumentation.c_str() );\n\n\tstd::string sCustomLayerData = DictionaryToString( customLayerData );\n\thr = StoreStringValue( pPropertyStoreCache, PKEY_USD_CUSTOMLAYERDATA, sCustomLayerData.c_str() );\n\n\treturn S_OK;\n}\n\nHRESULT WriteUsdMetadata( pxr::SdfLayerRefPtr &rootLayer, pxr::VtDictionary &customLayerData, IPropertyStoreCache *pPropertyStoreCache, bool &bIsDirty )\n{\n\tUNREFERENCED_PARAMETER( customLayerData );\n\n\tHRESULT hr;\n\tPSC_STATE state;\n\n\thr = pPropertyStoreCache->GetState( PKEY_Comment, &state);\n\tif ( SUCCEEDED( hr ) && state == PSC_DIRTY )\n\t{\n\t\tstd::string sValue;\n\t\thr = GetValueAsUTF8( pPropertyStoreCache, PKEY_Comment, sValue );\n\t\tif ( SUCCEEDED( hr ) )\n\t\t{\n\t\t\trootLayer->SetComment( sValue );\n\t\t\tbIsDirty = true;\n\t\t}\n\t}\n\n\thr = pPropertyStoreCache->GetState( PKEY_USD_DOCUMENTATION, &state);\n\tif ( SUCCEEDED( hr ) && state == PSC_DIRTY )\n\t{\n\t\tstd::string sValue;\n\t\thr = GetValueAsUTF8( pPropertyStoreCache, PKEY_USD_DOCUMENTATION, sValue );\n\t\tif ( SUCCEEDED( hr ) )\n\t\t{\n\t\t\trootLayer->SetDocumentation( sValue );\n\t\t\tbIsDirty = true;\n\t\t}\n\t}\n\n\treturn S_OK;\n}\n\nHRESULT IsMetadataPropertyWritable( REFPROPERTYKEY key )\n{\n\tif ( IsEqualPropertyKey( key, PKEY_Comment ) /*||\n\t\t IsEqualPropertyKey( key, PKEY_USD_DOCUMENTATION )*/ )\n\t\treturn S_OK;\n\n\treturn S_FALSE;\n}"
  },
  {
    "path": "UsdShellExtension/UsdMetadata.h",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#pragma once\n\nHRESULT ReadUsdMetadata( const pxr::SdfLayerRefPtr &rootLayer, const pxr::VtDictionary &customLayerData, IPropertyStoreCache *pPropertyStoreCache );\nHRESULT WriteUsdMetadata( pxr::SdfLayerRefPtr &rootLayer, pxr::VtDictionary &customLayerData, IPropertyStoreCache *pPropertyStoreCache, bool &bIsDirty );\nHRESULT IsMetadataPropertyWritable( REFPROPERTYKEY key );\n\ninline HRESULT StoreStringValue( IPropertyStoreCache *pPropertyStoreCache, REFPROPERTYKEY key, LPCWSTR sValue )\n{\n\tHRESULT hr;\n\n\tPROPVARIANT propvar = {};\n\thr = InitPropVariantFromString( sValue, &propvar );\n\tif ( SUCCEEDED( hr ) )\n\t{\n\t\thr = PSCoerceToCanonicalValue( key, &propvar );\n\t\tif ( SUCCEEDED( hr ) )\n\t\t{\n\t\t\thr = pPropertyStoreCache->SetValueAndState( key, &propvar, PSC_NORMAL );\n\t\t}\n\n\t\tPropVariantClear( &propvar );\n\t}\n\n\treturn hr;\n}\n\ninline HRESULT StoreStringValue( IPropertyStoreCache *pPropertyStoreCache, REFPROPERTYKEY key, LPCSTR sValue )\n{\n\treturn StoreStringValue( pPropertyStoreCache, key, ATL::CA2W( sValue, CP_UTF8 ) );\n}\n\ninline HRESULT StoreUInt64Value( IPropertyStoreCache *pPropertyStoreCache, REFPROPERTYKEY key, uint64_t nValue )\n{\n\tHRESULT hr;\n\n\tPROPVARIANT propvar = {};\n\thr = InitPropVariantFromUInt64( nValue, &propvar );\n\tif ( SUCCEEDED( hr ) )\n\t{\n\t\thr = pPropertyStoreCache->SetValueAndState( key, &propvar, PSC_NORMAL );\n\n\t\tPropVariantClear( &propvar );\n\t}\n\n\treturn hr;\n}\n\ninline HRESULT StoreDateValue( IPropertyStoreCache *pPropertyStoreCache, REFPROPERTYKEY key, const FILETIME *pft )\n{\n\tHRESULT hr;\n\n\tPROPVARIANT propvar = {};\n\thr = InitPropVariantFromFileTime( pft, &propvar );\n\tif ( SUCCEEDED( hr ) )\n\t{\n\t\thr = pPropertyStoreCache->SetValueAndState( key, &propvar, PSC_NORMAL );\n\n\t\tPropVariantClear( &propvar );\n\t}\n\n\treturn hr;\n}\n\ninline HRESULT GetValueAsUTF8( IPropertyStoreCache *pPropertyStoreCache, REFPROPERTYKEY key, std::string &value )\n{\n\tHRESULT hr;\n\n\tPROPVARIANT propVariant;\n\thr = pPropertyStoreCache->GetValue( key, &propVariant );\n\tif ( SUCCEEDED( hr ) )\n\t{\n\t\tLPCWSTR sUTF16Value = PropVariantToStringWithDefault( propVariant, L\"\" );\n\t\tvalue = ATL::CW2A( sUTF16Value, CP_UTF8 );\n\n\t\treturn hr;\n\t}\n\n\treturn hr;\n}\n"
  },
  {
    "path": "UsdShellExtension/UsdPropertyKeys.h",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#pragma once\n\n#define INITGUID\n#include <propkeydef.h>\n\n// {3B7AB16C-C876-461C-BBA5-2F1182A834D1}\nDEFINE_PROPERTYKEY(PKEY_USD_PROPGROUP, 0x3b7ab16c, 0xc876, 0x461c, 0xbb, 0xa5, 0x2f, 0x11, 0x82, 0xa8, 0x34, 0xd1, PID_FIRST_USABLE + 0);\n\n// {3CEF792B-F66F-42E1-A59D-7BE261E682AE}\nDEFINE_PROPERTYKEY(PKEY_USD_DOCUMENTATION, 0x3cef792b, 0xf66f, 0x42e1, 0xa5, 0x9d, 0x7b, 0xe2, 0x61, 0xe6, 0x82, 0xae, PID_FIRST_USABLE + 1);\n\n// {89379215-052D-429D-9A74-6D220E41C86D}\nDEFINE_PROPERTYKEY(PKEY_USD_CUSTOMLAYERDATA, 0x89379215, 0x52d, 0x429d, 0x9a, 0x74, 0x6d, 0x22, 0xe, 0x41, 0xc8, 0x6d, PID_FIRST_USABLE + 2);\n\n\n#undef INITGUID"
  },
  {
    "path": "UsdShellExtension/UsdPropertyKeys.propdesc",
    "content": "<schema xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://schemas.microsoft.com/windows/2006/propertydescription\" schemaVersion=\"1.0\">\n    <propertyDescriptionList publisher=\"Activision Publishing, Inc.\" product=\"USD\">\n\n        <propertyDescription name=\"USD.PropGroup.USD\" formatID=\"{3B7AB16C-C876-461C-BBA5-2F1182A834D1}\" propID=\"2\">\n            <labelInfo label=\"@%LANGMODULE%,-%IDS_USD_PROPGROUP_USD_LABEL%\" hideLabel=\"false\"/>\n            <searchInfo inInvertedIndex=\"false\" isColumn=\"false\"/>\n            <typeInfo type=\"Null\" isGroup=\"true\" isInnate=\"true\"/>\n        </propertyDescription>\n\n        <propertyDescription name=\"USD.Documentation\" formatID=\"{3CEF792B-F66F-42E1-A59D-7BE261E682AE}\" propID=\"3\">\n            <labelInfo label=\"@%LANGMODULE%,-%IDS_USD_DOCUMENTATION_LABEL%\" invitationText=\"@%LANGMODULE%,-%IDS_USD_DOCUMENTATION_INVITATIONTEXT%\" hideLabel=\"false\"/>\n\t\t\t<searchInfo inInvertedIndex=\"true\" isColumn=\"true\" columnIndexType=\"OnDisk\" maxSize=\"4096\" mnemonics=\"@%LANGMODULE%,-%IDS_USD_DOCUMENTATION_MNEMONICS%\"/>\n\t\t\t<typeInfo type=\"String\" multipleValues=\"false\" isViewable=\"true\" isInnate=\"true\"/>\n\t\t\t<displayInfo displayType=\"String\">\n\t\t\t\t<drawControl control=\"MultiLineText\"/>\n\t\t\t\t<editControl control=\"MultiLineText\"/>\n\t\t\t</displayInfo>\n\t\t</propertyDescription>\n\n\t\t<propertyDescription name=\"USD.CustomLayerData\" formatID=\"{89379215-052D-429D-9A74-6D220E41C86D}\" propID=\"4\">\n\t\t\t<labelInfo label=\"@%LANGMODULE%,-%IDS_USD_CUSTOMLAYERDATA_LABEL%\" hideLabel=\"false\"/>\n\t\t\t<searchInfo inInvertedIndex=\"true\" isColumn=\"true\" columnIndexType=\"OnDisk\" maxSize=\"16384\" mnemonics=\"@%LANGMODULE%,-%IDS_USD_CUSTOMLAYERDATA_MNEMONICS%\"/>\n\t\t\t<typeInfo type=\"String\" multipleValues=\"false\" isViewable=\"true\" isInnate=\"true\"/>\n\t\t\t<displayInfo displayType=\"String\">\n\t\t\t\t<drawControl control=\"MultiLineText\"/>\n\t\t\t\t<editControl control=\"MultiLineText\"/>\n\t\t\t</displayInfo>\n\t\t</propertyDescription>\n\n\t</propertyDescriptionList>\n</schema>"
  },
  {
    "path": "UsdShellExtension/UsdShellExtension-monolithic.manifest",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<!--\n   Copyright 2021 Activision Publishing, Inc. \n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n-->\n<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">\n\n\t<file name=\"usd_ms.dll\"/>\n\t<file name=\"tbb.dll\"/>\n\t<file name=\"tbb_debug.dll\"/>\n\t<file name=\"tbbmalloc.dll\"/>\n\t<file name=\"tbbmalloc_debug.dll\"/>\n\n</assembly>"
  },
  {
    "path": "UsdShellExtension/UsdShellExtension-shared.manifest",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">\n\n\t<file name=\"ar.dll\"/>\n\t<file name=\"arch.dll\"/>\n\t<file name=\"plug.dll\"/>\n\t<file name=\"sdf.dll\"/>\n\t<file name=\"tf.dll\"/>\n\t<file name=\"usd.dll\"/>\n\t<file name=\"usdUtils.dll\"/>\n\t<file name=\"vt.dll\"/>\n\t<file name=\"tbb.dll\"/>\n\t<file name=\"tbb_debug.dll\"/>\n\t<file name=\"tbbmalloc.dll\"/>\n\t<file name=\"tbbmalloc_debug.dll\"/>\n\n</assembly>"
  },
  {
    "path": "UsdShellExtension/UsdShellExtension.vcxproj",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup Label=\"ProjectConfigurations\">\n    <ProjectConfiguration Include=\"Release|x64\">\n      <Configuration>Release</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Debug|x64\">\n      <Configuration>Debug</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"..\\shared\\environment.h\" />\n    <ClInclude Include=\"ArResolverShellExtension.h\" />\n    <ClInclude Include=\"UsdPropertyKeys.h\" />\n    <ClInclude Include=\"resource.h\" />\n    <ClInclude Include=\"Module.h\" />\n    <ClInclude Include=\"ShellExt_h.h\" />\n    <ClInclude Include=\"ShellPreviewHandlerImpl.h\" />\n    <ClInclude Include=\"ShellPropertyStoreImpl.h\" />\n    <ClInclude Include=\"ShellThumbnailProviderImpl.h\" />\n    <ClInclude Include=\"stdafx.h\" />\n    <ClInclude Include=\"UsdMetadata.h\" />\n    <ClInclude Include=\"UsdLoadScreenDlg.h\" />\n    <ClInclude Include=\"UWPProgressBar.h\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"..\\shared\\environment.cpp\" />\n    <ClCompile Include=\"ArResolverShellExtension.cpp\">\n      <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">NotUsing</PrecompiledHeader>\n      <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">NotUsing</PrecompiledHeader>\n      <AdditionalOptions Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">/Zc:inline- %(AdditionalOptions)</AdditionalOptions>\n    </ClCompile>\n    <ClCompile Include=\"Module.cpp\" />\n    <ClCompile Include=\"ShellExecute.cpp\" />\n    <ClCompile Include=\"ShellExt_i.c\">\n      <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">NotUsing</PrecompiledHeader>\n      <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">NotUsing</PrecompiledHeader>\n    </ClCompile>\n    <ClCompile Include=\"ShellPreviewHandlerImpl.cpp\" />\n    <ClCompile Include=\"ShellPropertyStoreImpl.cpp\" />\n    <ClCompile Include=\"ShellThumbnailProviderImpl.cpp\" />\n    <ClCompile Include=\"stdafx.cpp\">\n      <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">Create</PrecompiledHeader>\n      <PrecompiledHeaderFile Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">stdafx.h</PrecompiledHeaderFile>\n      <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">Create</PrecompiledHeader>\n      <PrecompiledHeaderFile Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">stdafx.h</PrecompiledHeaderFile>\n    </ClCompile>\n    <ClCompile Include=\"UsdMetadata.cpp\" />\n    <ClCompile Include=\"UsdLoadScreenDlg.cpp\" />\n    <ClCompile Include=\"UWPProgressBar.cpp\" />\n  </ItemGroup>\n  <ItemGroup>\n    <None Include=\"plugInfo.json\" />\n    <None Include=\"register.bat\" />\n    <None Include=\"unregister.bat\" />\n    <None Include=\"UsdPropertyKeys.propdesc\" />\n    <None Include=\"ShellExt.def\" />\n    <None Include=\"ShellExtModule.rgs\" />\n    <None Include=\"ShellPreviewHandlerImpl.rgs\" />\n    <None Include=\"ShellPropertyStoreImpl.rgs\" />\n    <None Include=\"ShellThumbnailProviderImpl.rgs\" />\n    <None Include=\"UsdShellExtension.ini\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Midl Include=\"ShellExt.idl\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ResourceCompile Include=\"ShellExt.rc\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Image Include=\"logo.png\" />\n    <Image Include=\"usd.ico\" />\n    <Image Include=\"USDLogoLrgWithAlpha.png\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Manifest Condition=\"'$(USDBUILD)'=='monolithic'\" Include=\"UsdShellExtension-monolithic.manifest\" />\n    <Manifest Condition=\"'$(USDBUILD)'=='shared'\" Include=\"UsdShellExtension-shared.manifest\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"..\\shared\\EventViewerMessages.vcxproj\">\n      <Project>{f12e597b-b731-4f5a-bec3-980d20159320}</Project>\n    </ProjectReference>\n  </ItemGroup>\n  <PropertyGroup Label=\"Globals\">\n    <VCProjectVersion>16.0</VCProjectVersion>\n    <Keyword>Win32Proj</Keyword>\n    <ProjectGuid>{9974380d-c9c6-4cf4-8aa2-7d564eb8c4e8}</ProjectGuid>\n    <RootNamespace>UsdShellExtension</RootNamespace>\n    <WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v141</PlatformToolset>\n    <WholeProgramOptimization>false</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v141</PlatformToolset>\n    <WholeProgramOptimization>false</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n  <Import Project=\"$(SolutionDir)\\python.props\" />\n  <Import Project=\"$(SolutionDir)\\boost.props\" />\n  <Import Project=\"$(SolutionDir)\\usd.props\" />\n  <Import Project=\"$(SolutionDir)\\nsis.props\" />\n  <Import Project=\"$(SolutionDir)\\atviversion.props\" />\n  <PropertyGroup Label=\"PythonConfiguration\">\n    <RegistryView>RegistryView.Registry32</RegistryView>\n    <RegistryView Condition=\"$(Platform) == 'x64'\">RegistryView.Registry64</RegistryView>\n    <PythonTag>$(PythonVersion)-32</PythonTag>\n    <PythonTag Condition=\"$(Platform) == 'x64'\">$(PythonVersion)</PythonTag>\n    <PythonHome Condition=\"$(PythonHome) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstallPath', null, null, $(RegistryView)))</PythonHome>\n    <PythonHome Condition=\"$(PythonHome) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstallPath', null, null, $(RegistryView)))</PythonHome>\n    <PythonExe Condition=\"$(PythonExe) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstallPath', 'ExecutablePath', null, $(RegistryView)))</PythonExe>\n    <PythonExe Condition=\"$(PythonExe) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstallPath', 'ExecutablePath', null, $(RegistryView)))</PythonExe>\n    <PythonExe Condition=\"$(PythonExe) == '' and $(PythonHome) != ''\">$(PythonHome)python.exe</PythonExe>\n    <PythonDevVersion>$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstalledFeatures', 'dev', null, $(RegistryView)))</PythonDevVersion>\n    <PythonDevVersion Condition=\"$(PythonDevVersion) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstalledFeatures', 'dev', null, $(RegistryView)))</PythonDevVersion>\n    <PythonCorePDBVersion>$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstalledFeatures', 'core_pdb', null, $(RegistryView)))</PythonCorePDBVersion>\n    <PythonCorePDBVersion Condition=\"$(PythonCorePDBVersion) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstalledFeatures', 'core_pdb', null, $(RegistryView)))</PythonCorePDBVersion>\n    <PythonCoreDVersion>$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstalledFeatures', 'core_d', null, $(RegistryView)))</PythonCoreDVersion>\n    <PythonCoreDVersion Condition=\"$(PythonCoreDVersion) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstalledFeatures', 'core_d', null, $(RegistryView)))</PythonCoreDVersion>\n    <PythonDebugSuffix Condition=\"$(PythonCoreDVersion) != ''\">_d</PythonDebugSuffix>\n    <PythonDExe Condition=\"$(PythonExe) != '' and $(PythonDExe) == ''\">$([System.IO.Path]::GetDirectoryName($(PythonExe)))\\python$(PythonDebugSuffix).exe</PythonDExe>\n    <PythonDExe Condition=\"!Exists($(PythonDExe))\">$(PythonExe)</PythonDExe>\n  </PropertyGroup>\n  <ImportGroup Label=\"ExtensionSettings\">\n  </ImportGroup>\n  <ImportGroup Label=\"Shared\">\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <PropertyGroup Label=\"UserMacros\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)bin\\$(PlatformToolset)\\$(PythonTag)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)build\\$(PlatformToolset)\\$(PythonTag)\\$(Configuration)\\$(ProjectName)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)bin\\$(PlatformToolset)\\$(PythonTag)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)build\\$(PlatformToolset)\\$(PythonTag)\\$(Configuration)\\$(ProjectName)\\</IntDir>\n  </PropertyGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\n    <ClCompile>\n      <WarningLevel>Level4</WarningLevel>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <SDLCheck>true</SDLCheck>\n      <PreprocessorDefinitions>NDEBUG;USDSHELLEXTENSION_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <ConformanceMode>false</ConformanceMode>\n      <AdditionalIncludeDirectories>$(SolutionDir);$(PythonHome)include;$(OutDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <PrecompiledHeader>Use</PrecompiledHeader>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <Optimization>MaxSpeed</Optimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <EnableCOMDATFolding>false</EnableCOMDATFolding>\n      <OptimizeReferences>false</OptimizeReferences>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <AdditionalDependencies>Gdiplus.lib;Shcore.lib;Propsys.lib;Pathcch.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <ModuleDefinitionFile>ShellExt.def</ModuleDefinitionFile>\n      <AdditionalLibraryDirectories>$(PythonHome)libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n    </Link>\n    <ResourceCompile>\n      <AdditionalIncludeDirectories>$(OutDir);$(SolutionDir);$(ProjectDir)..\\shared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n    </ResourceCompile>\n    <Midl>\n      <TypeLibraryName>$(OutDir)$(ProjectName).tlb</TypeLibraryName>\n    </Midl>\n    <PostBuildEvent>\n      <Command>xcopy \"$(ProjectDir)plugInfo.json\" \"$(TargetDir)\" /I /Y /F /R\nxcopy \"$(ProjectDir)register.bat\" \"$(TargetDir)\" /I /Y /F /R\nxcopy \"$(ProjectDir)unregister.bat\" \"$(TargetDir)\" /I /Y /F /R\nxcopy \"$(ProjectDir)UsdShellExtension.ini\" \"$(TargetDir)\" /I /Y /D /R\nxcopy \"$(SolutionDir)NOTICE.txt\" \"$(TargetDir)\" /I /Y /D /R\nxcopy \"$(SolutionDir)LICENSE.txt\" \"$(TargetDir)\" /I /Y /D /R\n\n%(Command)</Command>\n    </PostBuildEvent>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <ClCompile>\n      <WarningLevel>Level4</WarningLevel>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <SDLCheck>true</SDLCheck>\n      <PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <ConformanceMode>false</ConformanceMode>\n      <AdditionalIncludeDirectories>$(SolutionDir);$(PythonHome)include;$(OutDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <InlineFunctionExpansion>Disabled</InlineFunctionExpansion>\n      <Optimization>Disabled</Optimization>\n      <PrecompiledHeader>Use</PrecompiledHeader>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <AdditionalDependencies>Gdiplus.lib;Shcore.lib;Propsys.lib;Pathcch.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <ModuleDefinitionFile>ShellExt.def</ModuleDefinitionFile>\n      <AdditionalLibraryDirectories>$(PythonHome)libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n    </Link>\n    <ResourceCompile>\n      <AdditionalIncludeDirectories>$(OutDir);$(SolutionDir);$(ProjectDir)..\\shared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n    </ResourceCompile>\n    <Midl>\n      <TypeLibraryName>$(OutDir)$(ProjectName).tlb</TypeLibraryName>\n    </Midl>\n    <PostBuildEvent>\n      <Command>xcopy \"$(ProjectDir)plugInfo.json\" \"$(TargetDir)\" /I /Y /F /R\nxcopy \"$(ProjectDir)register.bat\" \"$(TargetDir)\" /I /Y /F /R\nxcopy \"$(ProjectDir)unregister.bat\" \"$(TargetDir)\" /I /Y /F /R\nxcopy \"$(ProjectDir)UsdShellExtension.ini\" \"$(TargetDir)\" /I /Y /D /R\nxcopy \"$(SolutionDir)NOTICE.txt\" \"$(TargetDir)\" /I /Y /D /R\nxcopy \"$(SolutionDir)LICENSE.txt\" \"$(TargetDir)\" /I /Y /D /R\n\n%(Command)</Command>\n    </PostBuildEvent>\n  </ItemDefinitionGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\n  <ImportGroup Label=\"ExtensionTargets\">\n  </ImportGroup>\n</Project>"
  },
  {
    "path": "UsdShellExtension/UsdShellExtension.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup>\n    <Filter Include=\"Source Files\">\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\n      <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\n    </Filter>\n    <Filter Include=\"Header Files\">\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\n      <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>\n    </Filter>\n    <Filter Include=\"Resource Files\">\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\n    </Filter>\n    <Filter Include=\"Files\">\n      <UniqueIdentifier>{d9bfe0ff-29ed-458b-8cd8-ec1eae4c9c07}</UniqueIdentifier>\n    </Filter>\n    <Filter Include=\"Shared\">\n      <UniqueIdentifier>{ee807d35-c06f-4914-b5d4-32a300dc72d8}</UniqueIdentifier>\n    </Filter>\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"resource.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"Module.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"stdafx.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"ShellExt_h.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"ShellPreviewHandlerImpl.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"ShellThumbnailProviderImpl.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"UsdLoadScreenDlg.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"ShellPropertyStoreImpl.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"UsdMetadata.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"UsdPropertyKeys.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"ArResolverShellExtension.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"UWPProgressBar.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"..\\shared\\environment.h\">\n      <Filter>Shared</Filter>\n    </ClInclude>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"Module.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"stdafx.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"ShellExt_i.c\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"ShellPreviewHandlerImpl.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"ShellThumbnailProviderImpl.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"ShellExecute.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"UsdLoadScreenDlg.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"ShellPropertyStoreImpl.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"UsdMetadata.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"ArResolverShellExtension.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"UWPProgressBar.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"..\\shared\\environment.cpp\">\n      <Filter>Shared</Filter>\n    </ClCompile>\n  </ItemGroup>\n  <ItemGroup>\n    <None Include=\"ShellExt.def\">\n      <Filter>Source Files</Filter>\n    </None>\n    <None Include=\"ShellPreviewHandlerImpl.rgs\">\n      <Filter>Resource Files</Filter>\n    </None>\n    <None Include=\"ShellThumbnailProviderImpl.rgs\">\n      <Filter>Resource Files</Filter>\n    </None>\n    <None Include=\"ShellExtModule.rgs\">\n      <Filter>Resource Files</Filter>\n    </None>\n    <None Include=\"ShellPropertyStoreImpl.rgs\">\n      <Filter>Resource Files</Filter>\n    </None>\n    <None Include=\"UsdPropertyKeys.propdesc\">\n      <Filter>Resource Files</Filter>\n    </None>\n    <None Include=\"plugInfo.json\">\n      <Filter>Files</Filter>\n    </None>\n    <None Include=\"register.bat\">\n      <Filter>Files</Filter>\n    </None>\n    <None Include=\"unregister.bat\">\n      <Filter>Files</Filter>\n    </None>\n    <None Include=\"UsdShellExtension.ini\">\n      <Filter>Files</Filter>\n    </None>\n  </ItemGroup>\n  <ItemGroup>\n    <Midl Include=\"ShellExt.idl\">\n      <Filter>Source Files</Filter>\n    </Midl>\n  </ItemGroup>\n  <ItemGroup>\n    <ResourceCompile Include=\"ShellExt.rc\">\n      <Filter>Resource Files</Filter>\n    </ResourceCompile>\n  </ItemGroup>\n  <ItemGroup>\n    <Image Include=\"usd.ico\">\n      <Filter>Resource Files</Filter>\n    </Image>\n    <Image Include=\"USDLogoLrgWithAlpha.png\">\n      <Filter>Resource Files</Filter>\n    </Image>\n    <Image Include=\"logo.png\">\n      <Filter>Resource Files</Filter>\n    </Image>\n  </ItemGroup>\n  <ItemGroup>\n    <Manifest Include=\"UsdShellExtension-monolithic.manifest\" />\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "UsdShellExtension/plugInfo.json",
    "content": "{\n    \"Plugins\": [\n        {\n            \"Info\": {\n                \"Types\": {\n                    \"ArResolverShellExtension\" : {\n                        \"bases\": [\"ArResolver\"]\n                    }\n                }\n            },\n            \"LibraryPath\": \"UsdShellExtension.dll\",\n            \"Name\": \"ArResolverShellExtension\",\n            \"Type\": \"library\"\n        }\n    ]\n}"
  },
  {
    "path": "UsdShellExtension/register.bat",
    "content": "REM This batch needs to be executed as administrator!\n\n@echo off\n\ncd /D %~dp0\n\nset /a success = 1\n\necho UsdPreviewLocalServer.exe /RegServer\nstart /wait UsdPreviewLocalServer.exe /RegServer\nif %ERRORLEVEL% NEQ 0 (\n\techo \u001b[91mUsdPreviewLocalServer.exe failed to register!\u001b[0m\n\tset /a success = 0\n)\n\necho UsdPythonToolsLocalServer.exe /RegServer\nstart /wait UsdPythonToolsLocalServer.exe /RegServer\nif %ERRORLEVEL% NEQ 0 (\n\techo \u001b[91mUsdPythonToolsLocalServer.exe failed to register!\u001b[0m \n\tset /a success = 0\n)\n\necho UsdSdkToolsLocalServer.exe /RegServer\nstart /wait UsdSdkToolsLocalServer.exe /RegServer\nif %ERRORLEVEL% NEQ 0 (\n\techo \u001b[91mUsdSdkToolsLocalServer.exe failed to register!\u001b[0m \n\tset /a success = 0\n)\n\necho regsvr32.exe /n /i UsdShellExtension.dll\nregsvr32.exe /n /i UsdShellExtension.dll\n\nif %success% NEQ 1 (\n\tpause\n\texit /b 1\n)"
  },
  {
    "path": "UsdShellExtension/resource.h",
    "content": "//{{NO_DEPENDENCIES}}\n// Microsoft Visual C++ generated include file.\n// Used by ShellExt.rc\n//\n#define IDR_REGISTRY_SHELLPREVIEWHANDLERIMPL 112\n#define IDI_ICON_USD                    113\n#define IDR_REGISTRY_SHELLTHUMBNAILPROVIDERIMPL 114\n#define IDR_REGISTRY_MODULE             115\n#define IDD_LOADSCREEN                  116\n#define IDB_LOADSCREEN                  118\n#define IDR_REGISTRY_SHELLPROPERTYSTOREIMPL 119\n#define IDS_USD_DOCUMENTATION_LABEL     123\n#define IDR_XML_PROPDESC_USD            124\n#define IDS_USD_DOCUMENTATION_INVITATIONTEXT 124\n#define IDS_USD_DOCUMENTATION_MNEMONICS 125\n#define IDB_LOGO                        125\n#define IDS_USD_PROPGROUP_USD_LABEL     126\n#define IDS_FILE_USD                    138\n#define IDS_FILE_USDA                   139\n#define IDS_FILE_USDC                   140\n#define IDS_FILE_USDZ                   141\n#define IDS_SHELL_VIEW                  142\n#define IDS_SHELL_EDIT                  143\n#define IDS_SHELL_CRATE                 144\n#define IDS_SHELL_UNCRATE               145\n#define IDS_SHELL_FLATTEN               146\n#define IDS_SHELL_REFRESHTHUMBNAIL      147\n#define IDS_SHELL_STATS                 148\n#define IDS_USD_CUSTOMLAYERDATA_LABEL   149\n#define IDS_USD_CUSTOMLAYERDATA_MNEMONICS 150\n\n// Next default values for new objects\n// \n#ifdef APSTUDIO_INVOKED\n#ifndef APSTUDIO_READONLY_SYMBOLS\n#define _APS_NEXT_RESOURCE_VALUE        126\n#define _APS_NEXT_COMMAND_VALUE         40011\n#define _APS_NEXT_CONTROL_VALUE         1001\n#define _APS_NEXT_SYMED_VALUE           101\n#endif\n#endif\n"
  },
  {
    "path": "UsdShellExtension/stdafx.cpp",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include \"stdafx.h\""
  },
  {
    "path": "UsdShellExtension/stdafx.h",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#pragma once\n\n#define WIN32_LEAN_AND_MEAN\n#define NOBITMAP\n#define NOMCX\n#define NOSERVICE\n#define NOMINMAX\n\n#define GDIPVER 0x0110\n\n#include <WinSDKVer.h>\n#define _WIN32_WINNT 0x0A00\n#include <SDKDDKVer.h>\n\n#include <windows.h>\n#include <shellapi.h>\n#include <shellscalingapi.h>\n\n#pragma warning( push )\n#pragma warning( disable : 4244 4305 5033 4100 4201 4245 4127 )\n\n#include <pxr/usd/usd/stage.h>\n#include <pxr/usd/usd/prim.h>\n#include <pxr/usd/sdf/tokens.h>\n#include <pxr/base/plug/registry.h>\n#include <pxr/usd/usdUtils/introspection.h>\n#include <pxr/usd/sdf/fileFormat.h>\n#include <pxr/usd/usd/usdFileFormat.h>\n#include <pxr/usd/ar/defaultResolver.h>\n#include <pxr/usd/ar/defaultResolverContext.h>\n#include <pxr/usd/ar/defineResolver.h>\n#include <pxr/usd/ar/filesystemAsset.h>\n#include <pxr/base/arch/fileSystem.h>\n\n\n#pragma warning( pop )\n\n\n#ifndef max\n#define max(a,b)            (((a) > (b)) ? (a) : (b))\n#endif\n#ifndef min\n#define min(a,b)            (((a) < (b)) ? (a) : (b))\n#endif\n\n#include <atlbase.h>\n#include <atlcom.h>\n#include <atlconv.h>\n#include <atlctl.h>\n#include <atlstr.h>\n#include <atlimage.h>\n#include <atlcomtime.h>\n\n#include <shlobj.h>\n#include <shobjidl.h>\n#include <pathcch.h>\n#include <thumbcache.h>\n#include <propkey.h>\n#include <propvarutil.h>\n\n#include <stdint.h>\n#include <iomanip>\n\n#include <gdiplus.h>"
  },
  {
    "path": "UsdShellExtension/unregister.bat",
    "content": "REM This batch needs to be executed as administrator!\n\n@echo off\n\ncd /D %~dp0\n\nset /a success = 1\n\necho UsdPreviewLocalServer.exe /UnregServer\nstart /wait UsdPreviewLocalServer.exe /UnregServer\nif %ERRORLEVEL% NEQ 0 (\n\techo \u001b[91mUsdPreviewLocalServer.exe failed to unregister!\u001b[0m\n\tset /a success = 0\n)\n\necho UsdPythonToolsLocalServer.exe /UnregServer\nstart /wait UsdPythonToolsLocalServer.exe /UnregServer\nif %ERRORLEVEL% NEQ 0 (\n\techo \u001b[91mUsdPythonToolsLocalServer.exe failed to unregister!\u001b[0m \n\tset /a success = 0\n)\n\necho UsdSdkToolsLocalServer.exe /UnregServer\nstart /wait UsdSdkToolsLocalServer.exe /UnregServer\nif %ERRORLEVEL% NEQ 0 (\n\techo \u001b[91mUsdSdkToolsLocalServer.exe failed to unregister!\u001b[0m \n\tset /a success = 0\n)\n\necho regsvr32.exe /u UsdShellExtension.dll\nregsvr32.exe /u UsdShellExtension.dll\n\nif %success% NEQ 1 (\n\tpause\n\texit /b 1\n)"
  },
  {
    "path": "UsdShellExtension.sln",
    "content": "﻿\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.28307.1209\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"UsdPreviewHandlerPython\", \"UsdPreviewHandlerPython\\UsdPreviewHandlerPython.vcxproj\", \"{248F687E-4028-4243-87B8-2312F57BE8A5}\"\nEndProject\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"UsdPreviewLocalServer\", \"UsdPreviewHandlerServer\\UsdPreviewLocalServer.vcxproj\", \"{279AFA6D-6E35-4798-BA63-8A7E15D11185}\"\nEndProject\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"UsdShellExtension\", \"UsdShellExtension\\UsdShellExtension.vcxproj\", \"{9974380D-C9C6-4CF4-8AA2-7D564EB8C4E8}\"\n\tProjectSection(ProjectDependencies) = postProject\n\t\t{279AFA6D-6E35-4798-BA63-8A7E15D11185} = {279AFA6D-6E35-4798-BA63-8A7E15D11185}\n\t\t{248F687E-4028-4243-87B8-2312F57BE8A5} = {248F687E-4028-4243-87B8-2312F57BE8A5}\n\t\t{EA717BDA-3304-439B-BEC8-408D9CE9F3FB} = {EA717BDA-3304-439B-BEC8-408D9CE9F3FB}\n\tEndProjectSection\nEndProject\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"UsdSdkToolsLocalServer\", \"UsdSdkToolsServer\\UsdSdkToolsLocalServer.vcxproj\", \"{EA717BDA-3304-439B-BEC8-408D9CE9F3FB}\"\nEndProject\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"UsdPythonToolsLocalServer\", \"UsdPythonToolsServer\\UsdPythonToolsLocalServer.vcxproj\", \"{6AD79C79-3A9D-4C39-B028-C45072541C28}\"\nEndProject\nProject(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \"Solution Items\", \"Solution Items\", \"{F2EEFD0F-82FF-4404-94E5-CD2F3837BDA9}\"\n\tProjectSection(SolutionItems) = preProject\n\t\tatviversion.h = atviversion.h\n\t\tBUILDING.md = BUILDING.md\n\t\tREADME.md = README.md\n\tEndProjectSection\nEndProject\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"UsdShellExtensionInstaller\", \"UsdShellExtensionInstaller\\UsdShellExtensionInstaller.vcxproj\", \"{1390252A-71E2-4C4E-B874-301909F40CBA}\"\nEndProject\nProject(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \"Property Sheets\", \"Property Sheets\", \"{8889FDB0-64A4-4AB7-A539-D3328F0846E9}\"\n\tProjectSection(SolutionItems) = preProject\n\t\tatviversion.props = atviversion.props\n\t\tboost.props = boost.props\n\t\tnsis.props = nsis.props\n\t\tpython.props = python.props\n\t\tusd-monolithic.props = usd-monolithic.props\n\t\tusd-shared.props = usd-shared.props\n\t\tusd.props = usd.props\n\tEndProjectSection\nEndProject\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"EventViewerMessages\", \"shared\\EventViewerMessages.vcxproj\", \"{F12E597B-B731-4F5A-BEC3-980D20159320}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|x64 = Debug|x64\n\t\tRelease|x64 = Release|x64\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{248F687E-4028-4243-87B8-2312F57BE8A5}.Debug|x64.ActiveCfg = Debug|x64\n\t\t{248F687E-4028-4243-87B8-2312F57BE8A5}.Debug|x64.Build.0 = Debug|x64\n\t\t{248F687E-4028-4243-87B8-2312F57BE8A5}.Release|x64.ActiveCfg = Release|x64\n\t\t{248F687E-4028-4243-87B8-2312F57BE8A5}.Release|x64.Build.0 = Release|x64\n\t\t{279AFA6D-6E35-4798-BA63-8A7E15D11185}.Debug|x64.ActiveCfg = Debug|x64\n\t\t{279AFA6D-6E35-4798-BA63-8A7E15D11185}.Debug|x64.Build.0 = Debug|x64\n\t\t{279AFA6D-6E35-4798-BA63-8A7E15D11185}.Release|x64.ActiveCfg = Release|x64\n\t\t{279AFA6D-6E35-4798-BA63-8A7E15D11185}.Release|x64.Build.0 = Release|x64\n\t\t{9974380D-C9C6-4CF4-8AA2-7D564EB8C4E8}.Debug|x64.ActiveCfg = Debug|x64\n\t\t{9974380D-C9C6-4CF4-8AA2-7D564EB8C4E8}.Debug|x64.Build.0 = Debug|x64\n\t\t{9974380D-C9C6-4CF4-8AA2-7D564EB8C4E8}.Release|x64.ActiveCfg = Release|x64\n\t\t{9974380D-C9C6-4CF4-8AA2-7D564EB8C4E8}.Release|x64.Build.0 = Release|x64\n\t\t{EA717BDA-3304-439B-BEC8-408D9CE9F3FB}.Debug|x64.ActiveCfg = Debug|x64\n\t\t{EA717BDA-3304-439B-BEC8-408D9CE9F3FB}.Debug|x64.Build.0 = Debug|x64\n\t\t{EA717BDA-3304-439B-BEC8-408D9CE9F3FB}.Release|x64.ActiveCfg = Release|x64\n\t\t{EA717BDA-3304-439B-BEC8-408D9CE9F3FB}.Release|x64.Build.0 = Release|x64\n\t\t{6AD79C79-3A9D-4C39-B028-C45072541C28}.Debug|x64.ActiveCfg = Debug|x64\n\t\t{6AD79C79-3A9D-4C39-B028-C45072541C28}.Debug|x64.Build.0 = Debug|x64\n\t\t{6AD79C79-3A9D-4C39-B028-C45072541C28}.Release|x64.ActiveCfg = Release|x64\n\t\t{6AD79C79-3A9D-4C39-B028-C45072541C28}.Release|x64.Build.0 = Release|x64\n\t\t{1390252A-71E2-4C4E-B874-301909F40CBA}.Debug|x64.ActiveCfg = Debug|x64\n\t\t{1390252A-71E2-4C4E-B874-301909F40CBA}.Release|x64.ActiveCfg = Release|x64\n\t\t{F12E597B-B731-4F5A-BEC3-980D20159320}.Debug|x64.ActiveCfg = Debug|x64\n\t\t{F12E597B-B731-4F5A-BEC3-980D20159320}.Debug|x64.Build.0 = Debug|x64\n\t\t{F12E597B-B731-4F5A-BEC3-980D20159320}.Release|x64.ActiveCfg = Release|x64\n\t\t{F12E597B-B731-4F5A-BEC3-980D20159320}.Release|x64.Build.0 = Release|x64\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {E4AEC1C0-464E-4B29-B0FA-8841731E8735}\n\tEndGlobalSection\nEndGlobal\n"
  },
  {
    "path": "UsdShellExtensionInstaller/CmdLineArgs.nsh",
    "content": "!include FileFunc.nsh\n\n;--------------------------------\nVar CmdLineUsdPath\nVar CmdLineUsdPythonPath\nVar CmdLineUsdPxrPluginPathName\n\nVar CmdLinePythonPath\nVar CmdLinePythonPythonPath\n\nVar CmdLineRendererPreview\nVar CmdLineRendererThumbnail\nVar CmdLineRendererView\n\n;--------------------------------\nFunction ParseCommandLine\n\n  ${GetParameters} $R0\n  ClearErrors\n\n  ${GetOptions} $R0 /USD_PATH= $CmdLineUsdPath\n  ${GetOptions} $R0 /USD_PYTHONPATH= $CmdLineUsdPythonPath\n  ${GetOptions} $R0 /USD_PXRPLUGINPATHNAME= $CmdLineUsdPxrPluginPathName\n\n  ${GetOptions} $R0 /PYTHON_PATH= $CmdLinePythonPath\n  ${GetOptions} $R0 /PYTHON_PYTHONPATH= $CmdLinePythonPythonPath\n\n  ${GetOptions} $R0 /RENDERER_PREVIEW= $CmdLineRendererPreview\n  ${GetOptions} $R0 /RENDERER_THUMBNAIL= $CmdLineRendererThumbnail\n  ${GetOptions} $R0 /RENDERER_VIEW= $CmdLineRendererView\n\nFunctionEnd"
  },
  {
    "path": "UsdShellExtensionInstaller/RestartManager.nsh",
    "content": ";--------------------------------\n!define MAX_PATH 260\n!define CCH_RM_SESSION_KEY 33\n!define RmForceShutdown 0x1\n!define RmShutdownOnlyRegistered 0x10\n\n;--------------------------------\nVar RmExplorerSession\nVar RmApplicationSession\nVar RmWindowsSearchSession\n\n;--------------------------------\n!macro ShutdownExplorer UN\nFunction ${UN}ShutdownExplorer\n\nSetDetailsPrint textonly\nDetailPrint \"Shutting down Windows Explorer...\"\nSetDetailsPrint listonly\n\nSystem::StrAlloc ${CCH_RM_SESSION_KEY}\nPop $0\nSystem::Call 'Rstrtmgr::RmStartSession(*i .R1, i 0, p $0) i.R0'\nSystem::Free $0\n\nStrCpy $RmExplorerSession $R1\n\nDetailPrint \"Shutting down Windows Explorer\"\n\nStrCpy $0 \"$WINDIR\\explorer.exe\"\nSystem::Call '*(w r0)p.R1 ?2'\nSystem::Call 'Rstrtmgr::RmRegisterResources(i $RmExplorerSession, i 1, p R1, i 0, p n, i 0, p n) i.R0'\n\nSystem::Call 'Rstrtmgr::RmShutdown(i $RmExplorerSession, i 0, p n) i.R0'\n\nFunctionEnd\n!macroend\n!insertmacro ShutdownExplorer \"\" \n!insertmacro ShutdownExplorer \"un.\"\n\n\n;--------------------------------\n!macro RestartExplorer UN \nFunction ${UN}RestartExplorer\n\nSetDetailsPrint textonly\nDetailPrint \"Restarting Windows Explorer...\"\nSetDetailsPrint listonly\n\nDetailPrint \"Restarting Windows Explorer\"\n\nSystem::Call 'Rstrtmgr::RmRestart(i $RmExplorerSession, i 0, p n) i.R0'\n\nSystem::Call 'Rstrtmgr::RmEndSession(i $RmExplorerSession) i.R0'\n\nFunctionEnd\n!macroend\n!insertmacro RestartExplorer \"\" \n!insertmacro RestartExplorer \"un.\"\n\n\n;--------------------------------\n!macro ShutdownWindowsSearch UN \nFunction ${UN}ShutdownWindowsSearch \n\nSetDetailsPrint textonly\nDetailPrint \"Shutting down Windows Search...\"\nSetDetailsPrint listonly\n\nSystem::StrAlloc ${CCH_RM_SESSION_KEY}\nPop $0\nSystem::Call 'Rstrtmgr::RmStartSession(*i .R1, i 0, p $0) i.R0'\nSystem::Free $0\n\nStrCpy $RmWindowsSearchSession $R1\n\nDetailPrint \"Shutting down Windows Search\"\n\nStrCpy $0 \"wsearch\"\nSystem::Call '*(w r0)p.R1 ?2'\nSystem::Call 'Rstrtmgr::RmRegisterResources(i $RmWindowsSearchSession, i 0, p n, i 0, p n, i 1, p R1) i.R0'\n\nSystem::Call 'Rstrtmgr::RmShutdown(i $RmWindowsSearchSession, i 0, p n) i.R0'\n\nFunctionEnd\n!macroend\n!insertmacro ShutdownWindowsSearch \"\" \n!insertmacro ShutdownWindowsSearch \"un.\"\n\n;--------------------------------\n!macro RestartWindowsSearch UN \nFunction ${UN}RestartWindowsSearch \n\nSetDetailsPrint textonly\nDetailPrint \"Restarting Windows Search...\"\nSetDetailsPrint listonly\n\nDetailPrint \"Restarting Windows Search\"\n\nSystem::Call 'Rstrtmgr::RmRestart(i $RmWindowsSearchSession, i 0, p n) i.R0'\n\nSystem::Call 'Rstrtmgr::RmEndSession(i $RmWindowsSearchSession) i.R0'\n\nFunctionEnd\n!macroend\n!insertmacro RestartWindowsSearch \"\" \n!insertmacro RestartWindowsSearch \"un.\"\n\n\n;--------------------------------\n!macro ShutdownApplications UN \nFunction ${UN}ShutdownApplications \n\nSetDetailsPrint textonly\nDetailPrint \"Shutting down applications...\"\nSetDetailsPrint listonly\n\nSystem::StrAlloc ${CCH_RM_SESSION_KEY}\nPop $0\nSystem::Call 'Rstrtmgr::RmStartSession(*i .R1, i 0, p $0) i.R0'\nSystem::Free $0\n\nStrCpy $RmApplicationSession $R1\n\nStrCpy $0 \"$INSTDIR\\UsdShellExtension.dll\"\nStrCpy $1 \"$INSTDIR\\tbb.dll\"\nStrCpy $2 \"$INSTDIR\\tbbmalloc.dll\"\nStrCpy $3 \"$INSTDIR\\${BOOSTDLL}\"\nStrCpy $4 \"$INSTDIR\\${PYTHONDLL}\"\nStrCpy $5 \"$INSTDIR\\usd_ms.dll\"\nStrCpy $6 \"$INSTDIR\\UsdPreviewHandler.pyd\"\nSystem::Call '*(w r0, w r1, w r2, w r3, w r4, w r5, w r6)p.R1 ?2'\nSystem::Call 'Rstrtmgr::RmRegisterResources(i $RmApplicationSession, i 6, p R1, i 0, p n, i 1, p R2) i.R0'\n\nDetailPrint \"Shutting down applications using the USD Shell Extension\"\n\n; only shutdown applications that can restart\nSystem::Call 'Rstrtmgr::RmShutdown(i $RmApplicationSession, i ${RmShutdownOnlyRegistered}, p n) i.R0'\n\nFunctionEnd\n!macroend\n!insertmacro ShutdownApplications \"\" \n!insertmacro ShutdownApplications \"un.\"\n\n;--------------------------------\n!macro RestartApplications UN \nFunction ${UN}RestartApplications \n\nSetDetailsPrint textonly\nDetailPrint \"Restarting Applications...\"\nSetDetailsPrint listonly\n\nDetailPrint \"Restarting applications that were using the Shell Extension\"\n\nSystem::Call 'Rstrtmgr::RmRestart(i $RmApplicationSession, i 0, p n) i.R0'\n\nSystem::Call 'Rstrtmgr::RmEndSession(i $RmApplicationSession) i.R0'\n\nFunctionEnd\n!macroend\n!insertmacro RestartApplications \"\" \n!insertmacro RestartApplications \"un.\"\n\n\n;--------------------------------\n!macro ShutdownCOMServers UN \nFunction ${UN}ShutdownCOMServers \n\nSetDetailsPrint textonly\nDetailPrint \"Shutting down COM servers...\"\nSetDetailsPrint listonly\n\nSystem::StrAlloc ${CCH_RM_SESSION_KEY}\nPop $0\nSystem::Call 'Rstrtmgr::RmStartSession(*i .R9, i 0, p $0) i.R0'\nSystem::Free $0\n\nStrCpy $0 \"$INSTDIR\\UsdPreviewLocalServer.exe\"\nStrCpy $1 \"$INSTDIR\\UsdPythonToolsLocalServer.exe\"\nStrCpy $2 \"$INSTDIR\\UsdSdkToolsLocalServer.exe\"\n\nSystem::Call '*(w r0, w r1, w r2)p.R1 ?2'\nSystem::Call 'Rstrtmgr::RmRegisterResources(i R9, i 3, p R1, i 0, p n, i 0, p n) i.R0'\n\nSystem::Call 'Rstrtmgr::RmShutdown(i R9, i ${RmForceShutdown}, p n) i.R0'\n\nSystem::Call 'Rstrtmgr::RmEndSession(i R9) i.R0'\n\nFunctionEnd\n!macroend\n!insertmacro ShutdownCOMServers \"\" \n!insertmacro ShutdownCOMServers \"un.\"\n"
  },
  {
    "path": "UsdShellExtensionInstaller/ShellLinkSetRunAs.nsh",
    "content": "!include LogicLib.nsh\n \n!ifndef IPersistFile\n!define IPersistFile {0000010b-0000-0000-c000-000000000046}\n!endif\n!ifndef CLSID_ShellLink\n!define CLSID_ShellLink {00021401-0000-0000-C000-000000000046}\n!define IID_IShellLinkA {000214EE-0000-0000-C000-000000000046}\n!define IID_IShellLinkW {000214F9-0000-0000-C000-000000000046}\n!define IShellLinkDataList {45e2b4ae-b1c3-11d0-b92f-00a0c90312e1}\n\t!ifdef NSIS_UNICODE\n\t!define IID_IShellLink ${IID_IShellLinkW}\n\t!else\n\t!define IID_IShellLink ${IID_IShellLinkA}\n\t!endif\n!endif\n \n \n \nFunction ShellLinkSetRunAs\nSystem::Store S\npop $9\nSystem::Call \"ole32::CoCreateInstance(g'${CLSID_ShellLink}',i0,i1,g'${IID_IShellLink}',*i.r1)i.r0\"\n${If} $0 = 0\n\tSystem::Call \"$1->0(g'${IPersistFile}',*i.r2)i.r0\" ;QI\n\t${If} $0 = 0\n\t\tSystem::Call \"$2->5(w '$9',i 0)i.r0\" ;Load\n\t\t${If} $0 = 0\n\t\t\tSystem::Call \"$1->0(g'${IShellLinkDataList}',*i.r3)i.r0\" ;QI\n\t\t\t${If} $0 = 0\n\t\t\t\tSystem::Call \"$3->6(*i.r4)i.r0\" ;GetFlags\n\t\t\t\t${If} $0 = 0\n\t\t\t\t\tSystem::Call \"$3->7(i $4|0x2000)i.r0\" ;SetFlags ;SLDF_RUNAS_USER\n\t\t\t\t\t${If} $0 = 0\n\t\t\t\t\t\tSystem::Call \"$2->6(w '$9',i1)i.r0\" ;Save\n\t\t\t\t\t${EndIf}\n\t\t\t\t${EndIf}\n\t\t\t\tSystem::Call \"$3->2()\" ;Release\n\t\t\t${EndIf}\n\t\tSystem::Call \"$2->2()\" ;Release\n\t\t${EndIf}\n\t${EndIf}\n\tSystem::Call \"$1->2()\" ;Release\n${EndIf}\npush $0\nSystem::Store L\nFunctionEnd\n\n!macro ShellLinkSetRunAs link\n  push `${link}`\n\n  Call ShellLinkSetRunAs\n!macroend"
  },
  {
    "path": "UsdShellExtensionInstaller/UsdConfigPage.nsh",
    "content": ";--------------------------------\n; UsdConfigPage\n\n!define /ifndef WS_BORDER           0x00800000\n\n!define USDCONFIGCONFIGPATH_STYLE   ${DEFAULT_STYLES}|${WS_BORDER}|${ES_AUTOHSCROLL}\n!define USDCONFIGCONFIGPATH_EXSTYLE 0;${WS_EX_STATICEDGE}\n\nVar hWndUsdConfigDlg\nVar hWndUsdConfigLabelAll\nVar hWndUsdConfigLabelCurrent\nVar hWndUsdConfigConfigPathAll\nVar hWndUsdConfigConfigPathCurrent\nVar hWndUsdConfigButtonShowAll\nVar hWndUsdConfigButtonShowCurrent\n\nFunction USDConfigPage\n    !insertmacro MUI_HEADER_TEXT \"USD Shell Extension Configuration File\" \"\"\n\n\tnsDialogs::Create 1018\n\tPop $hWndUsdConfigDlg\n\n\t${If} $hWndUsdConfigDlg == error\n\t\tAbort\n\t${EndIf}\n\n    ${NSD_CreateLabel} 0 0 100% 40u \"This file contains the configuration for the USD Shell Extension. \\\n        The configuration can be modified at any time and the changes will be reflected immeditately.$\\r$\\n$\\r$\\n\\\n        The local user configuration file will override the all users configuration file.\"\n\n    SetShellVarContext all\n    ${NSD_CreateLabel} 0 50u 100% 10u \"All Users\"\n    Pop $hWndUsdConfigLabelAll\n    nsDialogs::CreateControl \"${__NSD_Text_CLASS}\" \"${USDCONFIGCONFIGPATH_STYLE}\" \"${USDCONFIGCONFIGPATH_EXSTYLE}\" 0 60u 100% 12u \"$LOCALAPPDATA\\Activision\\UsdShellExtension\\UsdShellExtension.ini\"\n    Pop $hWndUsdConfigConfigPathAll\n    ${NSD_Edit_SetReadOnly} $hWndUsdConfigConfigPathAll 1\n    ${NSD_CreateButton} -100u 75u 100u 15u \"Show in Explorer\"\n    Pop $hWndUsdConfigButtonShowAll\n    ${NSD_OnClick} $hWndUsdConfigButtonShowAll USDConfigPageShowAllClick\n\n\n    SetShellVarContext current\n    ${NSD_CreateLabel} 0 95u 100% 10u \"Local User\"\n    Pop $hWndUsdConfigLabelCurrent\n    nsDialogs::CreateControl \"${__NSD_Text_CLASS}\" \"${USDCONFIGCONFIGPATH_STYLE}\" \"${USDCONFIGCONFIGPATH_EXSTYLE}\" 0 105u 100% 12u \"$LOCALAPPDATA\\Activision\\UsdShellExtension\\UsdShellExtension.ini\"\n    Pop $hWndUsdConfigConfigPathCurrent\n    ${NSD_Edit_SetReadOnly} $hWndUsdConfigConfigPathCurrent 1\n    ${NSD_CreateButton} -100u 120u 100u 15u \"Show in Explorer\"\n    Pop $hWndUsdConfigButtonShowCurrent\n    ${NSD_OnClick} $hWndUsdConfigButtonShowCurrent USDConfigPageShowCurrentClick\n\n    ;CreateFont $0 \"$(^Font)\" \"8\" \"700\"; size 8 weight 700 makes it bold \n    ;SendMessage $hWndUsdConfigLabelCurrent ${WM_SETFONT} $0 0\n    ;SendMessage $hWndUsdConfigLabelAll ${WM_SETFONT} $0 0\n\n\tnsDialogs::Show\nFunctionEnd\n\nFunction USDConfigPageLeave\n\nFunctionEnd\n\nFunction USDConfigPageShowAllClick\n    SetShellVarContext all\n    ExecWait 'explorer.exe /n,/select,\"$LOCALAPPDATA\\Activision\\UsdShellExtension\\UsdShellExtension.ini\"'\nFunctionEnd\n\nFunction USDConfigPageShowCurrentClick\n    SetShellVarContext current\n    ExecWait 'explorer.exe /n,/select,\"$LOCALAPPDATA\\Activision\\UsdShellExtension\\UsdShellExtension.ini\"'\nFunctionEnd\n"
  },
  {
    "path": "UsdShellExtensionInstaller/UsdConfigUtils.nsh",
    "content": "\nFunction ReadConfigFile\n    pop $0 ; file\n    pop $1 ; section\n    pop $2 ; key\n    pop $3 ; value\n\n    System::StrAlloc 1024\n    Pop $R1\n    System::Call 'Kernel32::GetPrivateProfileStringW(w r1, w r2, t \"\", p R1, i 1024, w r0)'\n    ; we can only store a max of 1024 characters in NSIS registers\n    System::Call \"*$R1(&t1024 .s)\"\n    System::Free $R1\nFunctionEnd\n\n!macro ReadConfigFile file section key value\n  push `${value}`\n  push `${key}`\n  push `${section}`\n  push `${file}`\n\n  Call ReadConfigFile\n!macroend\n\nFunction WriteConfigFile\n    pop $0 ; file\n    pop $1 ; section\n    pop $2 ; key\n    pop $3 ; value\n\n    System::Call 'Kernel32::WritePrivateProfileStringW(w r1, w r2, w r3, w r0)'\nFunctionEnd\n\n!macro WriteConfigFile file section key value\n  push `${value}`\n  push `${key}`\n  push `${section}`\n  push `${file}`\n\n  Call WriteConfigFile\n!macroend\n\nFunction PatchConfigFile\n    pop $0 ; file\n    pop $1 ; section\n    pop $2 ; key\n    pop $3 ; value\n\n    ; a string that someone isn't going to enter by hand\n    StrCpy $R0 \"{3D3157AE-140F-49B9-9283-57051DB19E37}\" \n    System::StrAlloc 8192\n    Pop $R1\n    System::Call 'Kernel32::GetPrivateProfileStringW(w r1, w r2, w R0, p R1, i 8192, w r0)'\n    ; copy the returned string into $R2\n    ; we can only store a max of 1024 characters in NSIS registers\n    System::Call \"*$R1(&t1024 .R2)\"\n    System::Free $R1\n\n    ${If} $R2 == \"{3D3157AE-140F-49B9-9283-57051DB19E37}\"\n        System::Call 'Kernel32::WritePrivateProfileStringW(w r1, w r2, w r3, w r0)'\n    ${EndIf}\n\nFunctionEnd\n\n!macro PatchConfigFile file section key value\n  push `${value}`\n  push `${key}`\n  push `${section}`\n  push `${file}`\n\n  Call PatchConfigFile\n!macroend\n\n"
  },
  {
    "path": "UsdShellExtensionInstaller/UsdPathPage.nsh",
    "content": ";--------------------------------\n; UsdPathPage\n\nVar hWndUsdPathDlg\nVar hWndUsdPathEditPath\nVar hWndUsdPathEditPythonPath\nVar hWndUsdPathEditPxrPluginPath\nVar hWndUsdPathButtonBuild\n;Var hWndUsdPathConfigPath\n\nFunction USDPathPage\n    !insertmacro MUI_HEADER_TEXT \"USD Libraries and Tools\" \"Please set the following USD environment variables.\"\n\n\tnsDialogs::Create 1018\n\tPop $hWndUsdPathDlg\n\n\t${If} $hWndUsdPathDlg == error\n\t\tAbort\n\t${EndIf}\n\n    SetShellVarContext all\n\n    ${NSD_CreateLabel} 0 0 100% 10u \"PATH\"\n    !insertmacro ReadConfigFile \"$LOCALAPPDATA\\Activision\\UsdShellExtension\\UsdShellExtension.ini\" \"USD\" \"PATH\" \"\"\n    Pop $R0\n    ${NSD_CreateText} 0 10u 100% 12u $R0\n    Pop $hWndUsdPathEditPath\n\n    ${NSD_CreateLabel} 0 28u 100% 10u \"PYTHONPATH\"\n    !insertmacro ReadConfigFile \"$LOCALAPPDATA\\Activision\\UsdShellExtension\\UsdShellExtension.ini\" \"USD\" \"PYTHONPATH\" \"\"\n    Pop $R0\n    ${NSD_CreateText} 0 38u 100% 12u $R0\n    Pop $hWndUsdPathEditPythonPath\n\n    ${NSD_CreateLabel} 0 56u 100% 10u \"PXR_PLUGINPATH_NAME\"\n    !insertmacro ReadConfigFile \"$LOCALAPPDATA\\Activision\\UsdShellExtension\\UsdShellExtension.ini\" \"USD\" \"PXR_PLUGINPATH_NAME\" \"\"\n    Pop $R0\n    ${NSD_CreateText} 0 66u 100% 12u $R0\n    Pop $hWndUsdPathEditPxrPluginPath\n\n    ${NSD_CreateButton} -140u 90u 140u 15u \"Set using root USD folder\"\n    Pop $hWndUsdPathButtonBuild\n    ${NSD_OnClick} $hWndUsdPathButtonBuild USDPathPageBuildClick\n\n    ;${NSD_CreateLabel} 0 -30u 100% 10u \"Configuration File\"\n    ;${NSD_CreateText} 0 -18u 100% 12u \"$LOCALAPPDATA\\Activision\\UsdShellExtension\\UsdShellExtension.ini\"\n    ;Pop $hWndUsdPathConfigPath\n    ;${NSD_Edit_SetReadOnly} $hWndUsdPathConfigPath 1\n\n\tnsDialogs::Show\nFunctionEnd\n\nFunction USDPathPageLeave\n    SetShellVarContext all\n\n\t${NSD_GetText} $hWndUsdPathEditPath $0\n\t!insertmacro WriteConfigFile \"$LOCALAPPDATA\\Activision\\UsdShellExtension\\UsdShellExtension.ini\" \"USD\" \"PATH\" $0\n\n\t${NSD_GetText} $hWndUsdPathEditPythonPath $0\n\t!insertmacro WriteConfigFile \"$LOCALAPPDATA\\Activision\\UsdShellExtension\\UsdShellExtension.ini\" \"USD\" \"PYTHONPATH\" $0\n\n\t${NSD_GetText} $hWndUsdPathEditPxrPluginPath $0\n\t!insertmacro WriteConfigFile \"$LOCALAPPDATA\\Activision\\UsdShellExtension\\UsdShellExtension.ini\" \"USD\" \"PXR_PLUGINPATH_NAME\" $0\n\nFunctionEnd\n\nFunction USDPathPageBuildClick\n\n    nsDialogs::SelectFolderDialog \"Select root folder of USD installation\"\n    Pop $R0\n\n\t${If} $R0 != error\n        ${NSD_SetText} $hWndUsdPathEditPath \"$R0\\bin\\;$R0\\lib\\\"\n        ${NSD_SetText} $hWndUsdPathEditPythonPath \"$R0\\lib\\python\"\n        ${NSD_SetText} $hWndUsdPathEditPxrPluginPath \"\"\n\t${EndIf}\n\nFunctionEnd\n"
  },
  {
    "path": "UsdShellExtensionInstaller/UsdShellExtensionInstaller.nsi",
    "content": "; Copyright 2021 Activision Publishing, Inc. \n;\n; Licensed under the Apache License, Version 2.0 (the \"License\");\n; you may not use this file except in compliance with the License.\n; You may obtain a copy of the License at\n;\n;     http://www.apache.org/licenses/LICENSE-2.0\n;\n; Unless required by applicable law or agreed to in writing, software\n; distributed under the License is distributed on an \"AS IS\" BASIS,\n; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n; See the License for the specific language governing permissions and\n; limitations under the License.\n\n;--------------------------------\n;Includes\n\n!include \"MUI2.nsh\"\n!include \"Library.nsh\"\n!include \"logiclib.nsh\"\n!include \"x64.nsh\"\n\n!define LIBRARY_X64\n\n!define /ifndef OUT_FILE \"setup.exe\"\n\n!define /ifndef VER_MAJOR 0\n!define /ifndef VER_MINOR 00\n!define /ifndef VER_REVISION 00\n!define /ifndef VER_BUILD 00\n!define /ifndef VER_PRODUCTNAME \"\"\n!define /ifndef VER_COMPANYNAME \"\"\n!define /ifndef VER_COPYRIGHT \"\"\n\n!define /ifndef VERSION \"${VER_MAJOR}.${VER_MINOR}\"\n!define /ifndef USD_VERSION \"Unknown Version\"\n!define /ifndef PYTHON_VERSION \"Unknown Version\"\n\n; The name of the installer\nName \"${VER_PRODUCTNAME}\"\n\n; The file to write\nOutFile \"${OUT_FILE}\"\n\n; Request application privileges for Windows Vista and higher\nRequestExecutionLevel admin\n\n; Build Unicode installer\nUnicode True\n\n;SetCompress off\nSetCompressor LZMA\n\n; The default installation directory\nInstallDir $PROGRAMFILES64\\Activision\\UsdShellExtension\n\n; Registry key to check for directory (so if you install again, it will \n; overwrite the old one automatically)\nInstallDirRegKey HKLM \"Software\\Activision\\UsdShellExtension\" \"Install_Dir\"\n\n!define MUI_BGCOLOR \"FFFFFF\"\n!define MUI_ICON \"..\\..\\..\\..\\shared\\usd.ico\"\n!define MUI_UNICON \"..\\..\\..\\..\\shared\\usd.ico\"\n!define MUI_WELCOMEFINISHPAGE_BITMAP \"..\\..\\..\\..\\shared\\installerWelcome.bmp\"\n!define MUI_WELCOMEFINISHPAGE_BITMAP_STRETCH \"NoStretchNoCropNoAlign\"\n!define MUI_UNWELCOMEFINISHPAGE_BITMAP \"..\\..\\..\\..\\shared\\installerWelcome.bmp\"\n!define MUI_UNWELCOMEFINISHPAGE_BITMAP_STRETCH \"NoStretchNoCropNoAlign\"\n\n!define MUI_WELCOMEPAGE_TITLE \"${VER_PRODUCTNAME}$\\r$\\nVersion ${VERSION}\"\n!define MUI_WELCOMEPAGE_TEXT \"Setup will guide you through the installation of $(^NameDA).$\\r$\\n$\\r$\\nUSD Version: ${USD_VERSION}$\\r$\\nPython Version: ${PYTHON_VERSION}$\\r$\\n$\\r$\\nIt is recommended that you close all other applications before starting Setup. This will make it possible to update relevant system files without having to reboot your computer.$\\r$\\n$\\r$\\n$_CLICK\"\n\n;--------------------------------\n;Utilities\n!include \"${__FILEDIR__}\\UsdConfigUtils.nsh\"\n!include \"${__FILEDIR__}\\RestartManager.nsh\"\n!include \"${__FILEDIR__}\\ShellLinkSetRunAs.nsh\"\n!include \"${__FILEDIR__}\\CmdLineArgs.nsh\"\n\n;--------------------------------\n;Interface Settings\n\n!define MUI_ABORTWARNING\n\n;--------------------------------\n;Pages\n!include \"${__FILEDIR__}\\UsdPathPage.nsh\"\n!include \"${__FILEDIR__}\\UsdConfigPage.nsh\"\n\n!insertmacro MUI_PAGE_WELCOME\n!insertmacro MUI_PAGE_LICENSE \"LICENSE.txt\"\n!insertmacro MUI_PAGE_INSTFILES\nPage custom USDPathPage USDPathPageLeave\nPage custom USDConfigPage USDConfigPageLeave\n!insertmacro MUI_PAGE_FINISH\n\n!insertmacro MUI_UNPAGE_WELCOME\n!insertmacro MUI_UNPAGE_INSTFILES\n!insertmacro MUI_UNPAGE_FINISH\n\n;--------------------------------\n;Languages\n\n!insertmacro MUI_LANGUAGE \"English\"\n\n;--------------------------------\n;Version information\n\n!ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD\nVIProductVersion ${VER_MAJOR}.${VER_MINOR}.${VER_REVISION}.${VER_BUILD}\nVIAddVersionKey \"FileVersion\" \"${VERSION}\"\nVIAddVersionKey \"ProductVersion\" \"${VERSION}\"\nVIAddVersionKey \"FileDescription\" \"${VER_PRODUCTNAME} Setup\"\nVIAddVersionKey \"ProductName\" \"${VER_PRODUCTNAME}\"\nVIAddVersionKey \"LegalCopyright\" \"${VER_COPYRIGHT}\"\nVIAddVersionKey \"CompanyName\" \"${VER_COMPANYNAME}\"\n!endif\n\nSetPluginUnload  alwaysoff\n\n;--------------------------------\nFunction .onInit\n\nCall ParseCommandLine\n\nFunctionEnd\n\n\n;--------------------------------\nSection \"-ShutdownProcesses\" \n\n${DisableX64FSRedirection}\nSetRegView 64\n\nCall ShutdownExplorer\nCall ShutdownWindowsSearch\nCall ShutdownApplications\nCall ShutdownCOMServers\n\nSectionEnd\n\n;--------------------------------\nSection \"-UninstallPrevious\" \n\n${DisableX64FSRedirection}\nSetRegView 64\n\nReadRegStr $R0 HKLM \\\n\"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\UsdShellExtension\" \\\n\"UninstallString\"\nStrCmp $R0 \"\" done\n\nSetDetailsPrint textonly\nDetailPrint \"Uninstalling previous installation...\"\nSetDetailsPrint listonly\nDetailPrint \"Uninstalling previous installation\"\n\nClearErrors\nExecWait '$R0 /S _?=$INSTDIR' ;Do not copy the uninstaller to a temp file\nIfErrors no_remove_uninstaller done\n;You can either use Delete /REBOOTOK in the uninstaller or add some code\n;here to remove the uninstaller. Use a registry key to check\n;whether the user has chosen to uninstall. If you are using an uninstaller\n;components page, make sure all sections are uninstalled.\nno_remove_uninstaller:\n\ndone:\n\nSectionEnd\n\n;--------------------------------\n\n; The stuff to install\nSection \"Install\" \n\n${DisableX64FSRedirection}\nSetRegView 64\n\nSetDetailsPrint textonly\nDetailPrint \"Installing files...\"\nSetDetailsPrint listonly\n\nSetShellVarContext all\n${Unless} ${FileExists} \"$LOCALAPPDATA\\Activision\\UsdShellExtension\\UsdShellExtension.ini\"\n    SetOutPath \"$LOCALAPPDATA\\Activision\\UsdShellExtension\"\n    File UsdShellExtension.ini\n${EndUnless}\nSetShellVarContext current\n${Unless} ${FileExists} \"$LOCALAPPDATA\\Activision\\UsdShellExtension\\UsdShellExtension.ini\"\n    SetOutPath \"$LOCALAPPDATA\\Activision\\UsdShellExtension\"\n    File UsdShellExtension.ini\n${EndUnless}\n\nSetShellVarContext all\nSetOutPath \"$INSTDIR\"\nFile plugInfo.json\nFile LICENSE.txt\nFile NOTICE.txt\n\nSetOutPath \"$INSTDIR\\usd\"\nFile /r .\\usd\\*\n\nSetOutPath \"$INSTDIR\"\n\n!insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED tbb.dll \"$INSTDIR\\tbb.dll\" $INSTDIR\n!insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED tbbmalloc.dll \"$INSTDIR\\tbbmalloc.dll\" $INSTDIR\n!insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED ${BOOSTDLL} \"$INSTDIR\\${BOOSTDLL}\" $INSTDIR\n!if /FileExists \"${PYTHONDLL}\"\n    !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED ${PYTHONDLL} \"$INSTDIR\\${PYTHONDLL}\" $INSTDIR\n!endif\n!insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED usd_ms.dll \"$INSTDIR\\usd_ms.dll\" $INSTDIR\n!insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED UsdPreviewHandler.pyd \"$INSTDIR\\UsdPreviewHandler.pyd\" $INSTDIR\n!insertmacro InstallLib REGEXE NOTSHARED REBOOT_NOTPROTECTED UsdPreviewLocalServer.exe \"$INSTDIR\\UsdPreviewLocalServer.exe\" $INSTDIR\n!insertmacro InstallLib REGEXE NOTSHARED REBOOT_NOTPROTECTED UsdPythonToolsLocalServer.exe \"$INSTDIR\\UsdPythonToolsLocalServer.exe\" $INSTDIR\n!insertmacro InstallLib REGEXE NOTSHARED REBOOT_NOTPROTECTED UsdSdkToolsLocalServer.exe \"$INSTDIR\\UsdSdkToolsLocalServer.exe\" $INSTDIR\n!insertmacro InstallLib REGDLL NOTSHARED REBOOT_NOTPROTECTED UsdShellExtension.dll \"$INSTDIR\\UsdShellExtension.dll\" $INSTDIR\n\n; Write the installation path into the registry\nWriteRegStr HKLM SOFTWARE\\Activision\\UsdShellExtension \"Install_Dir\" \"$INSTDIR\"\n\n; Write the uninstall keys for Windows\nWriteRegStr HKLM \"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\UsdShellExtension\" \"DisplayName\" \"${VER_PRODUCTNAME}\"\nWriteRegStr HKLM \"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\UsdShellExtension\" \"DisplayIcon\" \"$INSTDIR\\UsdShellExtension.dll,0\"\nWriteRegStr HKLM \"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\UsdShellExtension\" \"UninstallString\" '\"$INSTDIR\\uninstall.exe\"'\nWriteRegDWORD HKLM \"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\UsdShellExtension\" \"NoModify\" 1\nWriteRegDWORD HKLM \"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\UsdShellExtension\" \"NoRepair\" 1\nWriteUninstaller \"$INSTDIR\\uninstall.exe\"\n\n; Install start menu items\nSetShellVarContext current\nCreateDirectory '$SMPROGRAMS\\USD Shell Extension'\nCreateShortCut '$SMPROGRAMS\\USD Shell Extension\\USD Shell Extension Configuration (Current User).lnk' '\"$SYSDIR\\NOTEPAD.EXE\"' '\"$LOCALAPPDATA\\Activision\\UsdShellExtension\\USDShellExtension.ini\"' '$SYSDIR\\imageres.dll' 64\n\nSetShellVarContext all\nCreateDirectory '$SMPROGRAMS\\USD Shell Extension'\nCreateShortCut '$SMPROGRAMS\\USD Shell Extension\\USD Shell Extension Configuration (All Users).lnk' '\"$SYSDIR\\NOTEPAD.EXE\"' '\"$LOCALAPPDATA\\Activision\\UsdShellExtension\\USDShellExtension.ini\"' '$SYSDIR\\imageres.dll' 64\nCreateShortCut '$SMPROGRAMS\\USD Shell Extension\\Uninstall USD Shell Extension.lnk' '$INSTDIR\\uninstall.exe' \"\"\n!insertmacro ShellLinkSetRunAs \"$SMPROGRAMS\\USD Shell Extension\\USD Shell Extension Configuration (All Users).lnk\"\n\n; Write version info to registry\nWriteRegStr HKLM \"Software\\Activision\\UsdShellExtension\" \"Version\" \"${VER_MAJOR}.${VER_MINOR}.${VER_REVISION}.${VER_BUILD}\"\nWriteRegStr HKLM \"Software\\Activision\\UsdShellExtension\" \"USD Version\" \"${USD_VERSION}\"\nWriteRegStr HKLM \"Software\\Activision\\UsdShellExtension\" \"Python Version\" \"${PYTHON_VERSION}\"\nWriteRegStr HKLM \"Software\\Activision\\UsdShellExtension\" \"Installer\" \"${OUT_FILE}\"\n\nSectionEnd\n\n;--------------------------------\nSection \"-RestartProcesses\" \n\n${DisableX64FSRedirection}\nSetRegView 64\n\nCall RestartExplorer\nCall RestartWindowsSearch\nCall RestartApplications\n\nSectionEnd\n\n;--------------------------------\nFunction PatchConfigFileAll\n\n!insertmacro PatchConfigFile \"$LOCALAPPDATA\\Activision\\UsdShellExtension\\UsdShellExtension.ini\" \"USD\" \"PATH\" \"\"\n!insertmacro PatchConfigFile \"$LOCALAPPDATA\\Activision\\UsdShellExtension\\UsdShellExtension.ini\" \"USD\" \"PYTHONPATH\" \"\"\n!insertmacro PatchConfigFile \"$LOCALAPPDATA\\Activision\\UsdShellExtension\\UsdShellExtension.ini\" \"USD\" \"PXR_PLUGINPATH_NAME\" \"\"\n!insertmacro PatchConfigFile \"$LOCALAPPDATA\\Activision\\UsdShellExtension\\UsdShellExtension.ini\" \"USD\" \"EDITOR\" \"\"\n\n!insertmacro PatchConfigFile \"$LOCALAPPDATA\\Activision\\UsdShellExtension\\UsdShellExtension.ini\" \"RENDERER\" \"PREVIEW\" \"GL\"\n!insertmacro PatchConfigFile \"$LOCALAPPDATA\\Activision\\UsdShellExtension\\UsdShellExtension.ini\" \"RENDERER\" \"THUMBNAIL\" \"GL\"\n!insertmacro PatchConfigFile \"$LOCALAPPDATA\\Activision\\UsdShellExtension\\UsdShellExtension.ini\" \"RENDERER\" \"VIEW\" \"GL\"\n\n!insertmacro PatchConfigFile \"$LOCALAPPDATA\\Activision\\UsdShellExtension\\UsdShellExtension.ini\" \"PYTHON\" \"PATH\" \"\"\n!insertmacro PatchConfigFile \"$LOCALAPPDATA\\Activision\\UsdShellExtension\\UsdShellExtension.ini\" \"PYTHON\" \"PYTHONPATH\" \"\"\n\nFunctionEnd\n\n;--------------------------------\nFunction ForceConfigFileAll\n\nSetShellVarContext all\n\n${If} $CmdLineUsdPath != \"\"\n    !insertmacro WriteConfigFile \"$LOCALAPPDATA\\Activision\\UsdShellExtension\\UsdShellExtension.ini\" \"USD\" \"PATH\" $CmdLineUsdPath\n${EndIf}\n\n${If} $CmdLineUsdPythonPath != \"\"\n    !insertmacro WriteConfigFile \"$LOCALAPPDATA\\Activision\\UsdShellExtension\\UsdShellExtension.ini\" \"USD\" \"PYTHONPATH\" $CmdLineUsdPythonPath\n${EndIf}\n\n${If} $CmdLineUsdPxrPluginPathName != \"\"\n    !insertmacro WriteConfigFile \"$LOCALAPPDATA\\Activision\\UsdShellExtension\\UsdShellExtension.ini\" \"USD\" \"PXR_PLUGINPATH_NAME\" $CmdLineUsdPxrPluginPathName\n${EndIf}\n\n\n${If} $CmdLinePythonPath != \"\"\n    !insertmacro WriteConfigFile \"$LOCALAPPDATA\\Activision\\UsdShellExtension\\UsdShellExtension.ini\" \"PYTHON\" \"PATH\" $CmdLinePythonPath\n${EndIf}\n\n${If} $CmdLinePythonPythonPath != \"\"\n    !insertmacro WriteConfigFile \"$LOCALAPPDATA\\Activision\\UsdShellExtension\\UsdShellExtension.ini\" \"PYTHON\" \"PYTHONPATH\" $CmdLinePythonPythonPath\n${EndIf}\n\n\n${If} $CmdLineRendererPreview != \"\"\n    !insertmacro WriteConfigFile \"$LOCALAPPDATA\\Activision\\UsdShellExtension\\UsdShellExtension.ini\" \"RENDERER\" \"PREVIEW\" $CmdLineRendererPreview\n${EndIf}\n\n${If} $CmdLineRendererThumbnail != \"\"\n    !insertmacro WriteConfigFile \"$LOCALAPPDATA\\Activision\\UsdShellExtension\\UsdShellExtension.ini\" \"RENDERER\" \"THUMBNAIL\" $CmdLineRendererThumbnail\n${EndIf}\n\n${If} $CmdLineRendererView != \"\"\n    !insertmacro WriteConfigFile \"$LOCALAPPDATA\\Activision\\UsdShellExtension\\UsdShellExtension.ini\" \"RENDERER\" \"VIEW\" $CmdLineRendererView\n${EndIf}\n\nFunctionEnd\n\n;--------------------------------\nSection \"-UpdateConfigFile\" \n\n${DisableX64FSRedirection}\nSetRegView 64\n\n; In order to support updates to the config file and allow for us \n; to support going back to older versions of the shell extension, \n; we will \"patch\" the existing config file using GetPrivateProfileStringW \n; to determine if a value is already set and SetPrivateProfileStringW \n; to enter a blank / default value if no value was set.\n\nSetDetailsPrint textonly\nDetailPrint \"Updating config file...\"\nSetDetailsPrint listonly\n\nSetShellVarContext current\nCall PatchConfigFileAll\nSetShellVarContext all\nCall PatchConfigFileAll\n\n; Force any command line settings into the config file\nCall ForceConfigFileAll\n\nSectionEnd\n\n;--------------------------------\n\n; Uninstaller\n\n;--------------------------------\nSection \"-Un.ShutdownProcesses\" \n\n${DisableX64FSRedirection}\nSetRegView 64\n\nCall un.ShutdownExplorer\nCall un.ShutdownWindowsSearch\nCall un.ShutdownApplications\nCall un.ShutdownCOMServers\n\nSectionEnd\n\n;--------------------------------\nSection \"Uninstall\"\n\n${DisableX64FSRedirection}\nSetRegView 64\nSetShellVarContext all\n\nSetDetailsPrint textonly\nDetailPrint \"Uninstalling files...\"\nSetDetailsPrint listonly\n\n!insertmacro UnInstallLib REGDLL NOTSHARED REBOOT_NOTPROTECTED \"$INSTDIR\\UsdShellExtension.dll\"\n!insertmacro UnInstallLib REGEXE NOTSHARED REBOOT_NOTPROTECTED \"$INSTDIR\\UsdPreviewLocalServer.exe\"\n!insertmacro UnInstallLib REGEXE NOTSHARED REBOOT_NOTPROTECTED \"$INSTDIR\\UsdPythonToolsLocalServer.exe\"\n!insertmacro UnInstallLib REGEXE NOTSHARED REBOOT_NOTPROTECTED \"$INSTDIR\\UsdSdkToolsLocalServer.exe\"\n!insertmacro UnInstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \"$INSTDIR\\tbb.dll\"\n!insertmacro UnInstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \"$INSTDIR\\tbbmalloc.dll\"\n!insertmacro UnInstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \"$INSTDIR\\${BOOSTDLL}\"\n!if /FileExists \"${PYTHONDLL}\"\n    !insertmacro UnInstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \"$INSTDIR\\${PYTHONDLL}\"\n!endif\n!insertmacro UnInstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \"$INSTDIR\\usd_ms.dll\"\n!insertmacro UnInstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \"$INSTDIR\\UsdPreviewHandler.pyd\"\n  \n; Remove registry keys\nDeleteRegKey HKLM \"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\UsdShellExtension\"\nDeleteRegKey HKLM SOFTWARE\\Activision\\UsdShellExtension\n\n; Remove files and uninstaller\n;Delete /REBOOTOK \"$LOCALAPPDATA\\Activision\\UsdShellExtension\\UsdShellExtension.ini\"\nDelete /REBOOTOK \"$INSTDIR\\plugInfo.json\"\nDelete /REBOOTOK \"$INSTDIR\\LICENSE.txt\"\nDelete /REBOOTOK \"$INSTDIR\\NOTICE.txt\"\nRMDir /r /REBOOTOK \"$INSTDIR\\usd\"\nDelete /REBOOTOK \"$INSTDIR\\UsdPropertyKeys.propdesc\"\n\nDelete /REBOOTOK \"$INSTDIR\\uninstall.exe\"\n\n; Remove directories\nRMDir \"$INSTDIR\"\n\n; Remove start menu items\nSetShellVarContext current\nDelete  '$SMPROGRAMS\\USD Shell Extension\\USD Shell Extension Configuration (Current User).lnk'\nSetShellVarContext all\nDelete  '$SMPROGRAMS\\USD Shell Extension\\USD Shell Extension Configuration (All Users).lnk'\nDelete '$SMPROGRAMS\\USD Shell Extension\\Uninstall USD Shell Extension.lnk'\nRMDir '$SMPROGRAMS\\USD Shell Extension'\n\nSectionEnd\n\n;--------------------------------\nSection \"-Un.RestartProcesses\" \n\n${DisableX64FSRedirection}\nSetRegView 64\n\nCall un.RestartExplorer\nCall un.RestartWindowsSearch\nCall un.RestartApplications\n\nSectionEnd\n"
  },
  {
    "path": "UsdShellExtensionInstaller/UsdShellExtensionInstaller.vcxproj",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup Label=\"ProjectConfigurations\">\n    <ProjectConfiguration Include=\"Release|x64\">\n      <Configuration>Release</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Debug|x64\">\n      <Configuration>Debug</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n  </ItemGroup>\n  <PropertyGroup Label=\"Globals\">\n    <VCProjectVersion>16.0</VCProjectVersion>\n    <Keyword>Win32Proj</Keyword>\n    <ProjectGuid>{1390252A-71E2-4C4E-B874-301909F40CBA}</ProjectGuid>\n    <RootNamespace>UsdShellExtensionInstaller</RootNamespace>\n    <WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\" Label=\"Configuration\">\n    <ConfigurationType>Utility</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v141</PlatformToolset>\n    <WholeProgramOptimization>false</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"Configuration\">\n    <ConfigurationType>Utility</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v141</PlatformToolset>\n    <WholeProgramOptimization>false</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n  <Import Project=\"$(SolutionDir)\\python.props\" />\n  <Import Project=\"$(SolutionDir)\\boost.props\" />\n  <Import Project=\"$(SolutionDir)\\usd.props\" />\n  <Import Project=\"$(SolutionDir)\\nsis.props\" />\n  <Import Project=\"$(SolutionDir)\\atviversion.props\" />\n  <PropertyGroup Label=\"PythonConfiguration\">\n    <RegistryView>RegistryView.Registry32</RegistryView>\n    <RegistryView Condition=\"$(Platform) == 'x64'\">RegistryView.Registry64</RegistryView>\n    <PythonTag>$(PythonVersion)-32</PythonTag>\n    <PythonTag Condition=\"$(Platform) == 'x64'\">$(PythonVersion)</PythonTag>\n    <PythonHome Condition=\"$(PythonHome) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstallPath', null, null, $(RegistryView)))</PythonHome>\n    <PythonHome Condition=\"$(PythonHome) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstallPath', null, null, $(RegistryView)))</PythonHome>\n    <PythonExe Condition=\"$(PythonExe) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstallPath', 'ExecutablePath', null, $(RegistryView)))</PythonExe>\n    <PythonExe Condition=\"$(PythonExe) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstallPath', 'ExecutablePath', null, $(RegistryView)))</PythonExe>\n    <PythonExe Condition=\"$(PythonExe) == '' and $(PythonHome) != ''\">$(PythonHome)python.exe</PythonExe>\n    <PythonDevVersion>$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstalledFeatures', 'dev', null, $(RegistryView)))</PythonDevVersion>\n    <PythonDevVersion Condition=\"$(PythonDevVersion) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstalledFeatures', 'dev', null, $(RegistryView)))</PythonDevVersion>\n    <PythonCorePDBVersion>$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstalledFeatures', 'core_pdb', null, $(RegistryView)))</PythonCorePDBVersion>\n    <PythonCorePDBVersion Condition=\"$(PythonCorePDBVersion) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstalledFeatures', 'core_pdb', null, $(RegistryView)))</PythonCorePDBVersion>\n    <PythonCoreDVersion>$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstalledFeatures', 'core_d', null, $(RegistryView)))</PythonCoreDVersion>\n    <PythonCoreDVersion Condition=\"$(PythonCoreDVersion) == ''\">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\$(PythonTag)\\InstalledFeatures', 'core_d', null, $(RegistryView)))</PythonCoreDVersion>\n    <PythonDebugSuffix Condition=\"$(PythonCoreDVersion) != ''\">_d</PythonDebugSuffix>\n    <PythonDExe Condition=\"$(PythonExe) != '' and $(PythonDExe) == ''\">$([System.IO.Path]::GetDirectoryName($(PythonExe)))\\python$(PythonDebugSuffix).exe</PythonDExe>\n    <PythonDExe Condition=\"!Exists($(PythonDExe))\">$(PythonExe)</PythonDExe>\n  </PropertyGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <OutDir>$(SolutionDir)bin\\$(PlatformToolset)\\$(PythonTag)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)build\\$(PlatformToolset)\\$(PythonTag)\\$(Configuration)\\$(ProjectName)\\</IntDir>\n    <TargetName>UsdShellExtension-v$(ATVI_VERSION_MAJOR).$(ATVI_VERSION_MINOR)-u$(USDVERSION)-p$(PythonVersion)-setup.exe</TargetName>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\n    <OutDir>$(SolutionDir)bin\\$(PlatformToolset)\\$(PythonTag)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)build\\$(PlatformToolset)\\$(PythonTag)\\$(Configuration)\\$(ProjectName)\\</IntDir>\n    <TargetName>UsdShellExtension-v$(ATVI_VERSION_MAJOR).$(ATVI_VERSION_MINOR)-u$(USDVERSION)-p$(PythonVersion)-setup.exe</TargetName>\n  </PropertyGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <PostBuildEvent>\n      <Command>@echo off\nREM Do nothing</Command>\n    </PostBuildEvent>\n    <PreBuildEvent>\n      <Command>@echo off\nREM Do nothing</Command>\n    </PreBuildEvent>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\n    <PostBuildEvent>\n      <Command>@echo off\nREM Do nothing</Command>\n    </PostBuildEvent>\n    <PreBuildEvent>\n      <Command>@echo off\nREM Do nothing</Command>\n    </PreBuildEvent>\n  </ItemDefinitionGroup>\n  <ItemGroup>\n    <CustomBuild Include=\"UsdShellExtensionInstaller.nsi\">\n      <FileType>Document</FileType>\n      <Message Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">Building Installer</Message>\n      <LinkObjects Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">false</LinkObjects>\n      <Message Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">Building Installer</Message>\n      <LinkObjects Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">false</LinkObjects>\n      <Command Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">@echo off\ncd /D \"$(OutputPath)\"\n\"$(MAKENSIS)\" /NOCD /DOUT_FILE=\"$(TargetName)\" /DPYTHONDLL=\"$(PythonDLL)\" /DBOOSTDLL=\"$(BOOSTDLL)\" /DVER_PRODUCTNAME=\"$(ATVI_VERSION_PRODUCTNAME)\" /DVER_COMPANYNAME=\"$(ATVI_VERSION_COMPANYNAME)\" /DVER_COPYRIGHT=\"$(ATVI_VERSION_COPYRIGHT)\" /DVER_MAJOR=\"$(ATVI_VERSION_MAJOR)\" /DVER_MINOR=\"$(ATVI_VERSION_MINOR)\" /DVER_REVISION=\"$(ATVI_VERSION_REVISION)\" /DVER_BUILD=\"$(ATVI_VERSION_BUILD)\" /DUSD_VERSION=\"$(USDVERSION)\" /DPYTHON_VERSION=\"$(PythonVersion)\" \"%(FullPath)\"</Command>\n      <Command Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">@echo off\ncd /D \"$(OutputPath)\"\n\"$(MAKENSIS)\" /NOCD /DOUT_FILE=\"$(TargetName)\" /DPYTHONDLL=\"$(PythonDLL)\" /DBOOSTDLL=\"$(BOOSTDLL)\" /DVER_PRODUCTNAME=\"$(ATVI_VERSION_PRODUCTNAME)\" /DVER_COMPANYNAME=\"$(ATVI_VERSION_COMPANYNAME)\" /DVER_COPYRIGHT=\"$(ATVI_VERSION_COPYRIGHT)\" /DVER_MAJOR=\"$(ATVI_VERSION_MAJOR)\" /DVER_MINOR=\"$(ATVI_VERSION_MINOR)\" /DVER_REVISION=\"$(ATVI_VERSION_REVISION)\" /DVER_BUILD=\"$(ATVI_VERSION_BUILD)\" /DUSD_VERSION=\"$(USDVERSION)\" /DPYTHON_VERSION=\"$(PythonVersion)\" \"%(FullPath)\"</Command>\n      <Outputs Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">$(OutputPath)$(TargetName);AlwaysBuildMe.exe%(Outputs)</Outputs>\n      <Outputs Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">$(OutputPath)$(TargetName);AlwaysBuildMe.exe%(Outputs)</Outputs>\n    </CustomBuild>\n  </ItemGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\n  <ImportGroup Label=\"ExtensionTargets\">\n  </ImportGroup>\n</Project>"
  },
  {
    "path": "UsdShellExtensionInstaller/UsdShellExtensionInstaller.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup>\n    <CustomBuild Include=\"UsdShellExtensionInstaller.nsi\">\n    </CustomBuild>\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "atviversion.h",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#ifndef ATVI_VERSION_DESCRIPTION\n#\tdefine ATVI_VERSION_DESCRIPTION\t\"\"\n#endif\n\n#define __ATVI_VERSION_PRODUCT_STRING_INTERNAL3(s) \\\n    #s\n\n#define __ATVI_VERSION_PRODUCT_STRING_INTERNAL2(p, s, b, f) \\\n\t__ATVI_VERSION_PRODUCT_STRING_INTERNAL3(p.s.b.f)\n\n#define __ATVI_VERSION_PRODUCT_STRING_INTERNAL(p, s, b, f) \\\n\t__ATVI_VERSION_PRODUCT_STRING_INTERNAL2(p, s, b, f)\n\n#define ATVI_VERSION_PRODUCT_STRING\t__ATVI_VERSION_PRODUCT_STRING_INTERNAL(ATVI_VERSION_MAJOR, ATVI_VERSION_MINOR, ATVI_VERSION_REVISION, ATVI_VERSION_BUILD)\n\n\n"
  },
  {
    "path": "atviversion.props",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n   Copyright 2021 Activision Publishing, Inc. \n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n-->\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n\t\n  <PropertyGroup>\n    <ATVI_VERSION_MAJOR>1</ATVI_VERSION_MAJOR>\n    <ATVI_VERSION_MINOR>09</ATVI_VERSION_MINOR>\n    <ATVI_VERSION_REVISION>00</ATVI_VERSION_REVISION>\n    <ATVI_VERSION_BUILD>00</ATVI_VERSION_BUILD>\n    <ATVI_VERSION_PRODUCTNAME>Activision USD Shell Extension</ATVI_VERSION_PRODUCTNAME>  \n    <ATVI_VERSION_COMPANYNAME>Activision Publishing, Inc.</ATVI_VERSION_COMPANYNAME>  \n    <ATVI_VERSION_COPYRIGHT>Copyright (C) 2021 Activision Publishing, Inc.</ATVI_VERSION_COPYRIGHT>  \n  </PropertyGroup>\n\n  <ItemDefinitionGroup>\n    <ClCompile>\n      <PreprocessorDefinitions>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)</PreprocessorDefinitions>\n    </ClCompile>\n    <ResourceCompile>\n      <PreprocessorDefinitions>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)</PreprocessorDefinitions>\n    </ResourceCompile>\n  </ItemDefinitionGroup>\n\n</Project>"
  },
  {
    "path": "atviversion.rc2",
    "content": "\n#include \"atviversion.h\"\n\nVS_VERSION_INFO VERSIONINFO\n FILEVERSION ATVI_VERSION_MAJOR,ATVI_VERSION_MINOR,ATVI_VERSION_REVISION,ATVI_VERSION_BUILD\n PRODUCTVERSION ATVI_VERSION_MAJOR,ATVI_VERSION_MINOR,ATVI_VERSION_REVISION,ATVI_VERSION_BUILD\n FILEFLAGSMASK 0x3fL\n#ifdef _DEBUG\n FILEFLAGS 0x1L\n#else\n FILEFLAGS 0x0L\n#endif\n FILEOS 0x4L\n FILETYPE 0x1L\n FILESUBTYPE 0x0L\nBEGIN\n    BLOCK \"StringFileInfo\"\n    BEGIN\n        BLOCK \"040904e4\"\n        BEGIN\n            VALUE \"CompanyName\", ATVI_VERSION_COMPANYNAME\n            VALUE \"FileDescription\", ATVI_VERSION_DESCRIPTION\n            VALUE \"FileVersion\", ATVI_VERSION_PRODUCT_STRING\n            VALUE \"LegalCopyright\", ATVI_VERSION_COPYRIGHT\n            VALUE \"ProductName\", ATVI_VERSION_PRODUCTNAME\n            VALUE \"ProductVersion\", ATVI_VERSION_PRODUCT_STRING\n        END\n    END\n    BLOCK \"VarFileInfo\"\n    BEGIN\n        VALUE \"Translation\", 0x409, 1252\n    END\nEND\n\n"
  },
  {
    "path": "boost.props",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n   Copyright 2021 Activision Publishing, Inc. \n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n-->\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <BOOSTLIBPATH>D:\\USD-shared-full-p37-debug\\lib\\</BOOSTLIBPATH>\n    <BOOSTINCLUDEPATH>D:\\USD-shared-full-p37-debug\\include\\boost-1_70\\</BOOSTINCLUDEPATH>\n    <BOOSTDLL>boost_$(PythonFileName)-vc$(PlatformToolsetVersion)-mt-gd-x64-1_70.dll</BOOSTDLL>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\n    <BOOSTLIBPATH>D:\\USD-shared-full-p37\\lib\\</BOOSTLIBPATH>\n    <BOOSTINCLUDEPATH>D:\\USD-shared-full-p37\\include\\boost-1_70\\</BOOSTINCLUDEPATH>\n    <BOOSTDLL>boost_$(PythonFileName)-vc$(PlatformToolsetVersion)-mt-x64-1_70.dll</BOOSTDLL>\n  </PropertyGroup>\n\t\t\n  <ItemDefinitionGroup>\n    <ClCompile>\n      <AdditionalIncludeDirectories>$(BOOSTINCLUDEPATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n    </ClCompile>\n    <Link>\n      <AdditionalLibraryDirectories>$(BOOSTLIBPATH);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <PostBuildEvent>\n      <Command>\n\t\t  xcopy \"$(BOOSTLIBPATH)$(BOOSTDLL)\" \"$(TargetDir)\" /I /Y /F /R\n\n\t\t  %(Command)\n\t  </Command>\n    </PostBuildEvent>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\n    <PostBuildEvent>\n      <Command>\n\t\t  xcopy \"$(BOOSTLIBPATH)$(BOOSTDLL)\" \"$(TargetDir)\" /I /Y /F /R\n\n\t\t  %(Command)\n\t  </Command>\n    </PostBuildEvent>\n  </ItemDefinitionGroup>\n</Project>\n"
  },
  {
    "path": "docs/DEPLOYMENT.md",
    "content": "Activision USD Shell Extension - Deployment Guide\n=================================================\n\nThe USD Shell Extension has been written to be deployed in many development environments.\n\nDeploying using Setup\n---------------------\nThe 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.\n\n| Switch                    | Description                                               |\n|-                          |-                                                          |\n| /s                        | Runs setup in silent mode                                 |\n| /USD_PATH=                | PATH environment variable for USD                         |\n| /USD_PYTHONPATH=          | PYTHONPATH environment variable for USD                   |\n| /USD_PXR_PLUGINPATH_NAME= | PXR_PLUGINPATH_NAME environment variable for USD          |\n| /USD_EDITOR=              | Editor used for the Edit command in Windows Explorer      |\n| /RENDERER_PREVIEW=        | Hydra renderer used for the Windows Explorer Preview pane |\n| /RENDERER_THUMBNAIL=      | Hydra renderer used for Windows Explorer Thumbnails       |\n| /RENDERER_VIEW=           | Hydra renderer used when launching usdview                |\n| /PYTHON_PATH=             | Path to the installation of Python                        |\n| /PYTHON_PYTHONPATH=       | PYTHONPATH environment variable for Python                |\n\n```\nUsdShellExtension-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\n```\n\nDeploying using Loose Files\n---------------------------\n\nIt is possible to deploy the Shell Extension manually.\n\n1. The files installed by setup can be packaged up for deployment without the use of setup.\n2. A `UsdShellExtension.ini` configuration file can be placed in the install folder.\n3. 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.\n\n**NOTE**  \nCare must be taken to correctly shutdown Windows Explorer and Windows Search when updating the shell extension.\n\n| File                                 |\n|-                                     |\n| usd\\\\\\*.\\*                           |\n| boost_pythonXX-vcXXX-mt-x64-1_70.dll |\n| LICENSE.txt                          |\n| NOTICE.txt                           |\n| plugInfo.json                        |\n| pythonXX.dll                         |\n| tbb.dll                              |\n| tbbmalloc.dll                        |\n| UsdPreviewHandler.pyd                |\n| UsdPreviewLocalServer.exe            |\n| UsdPythonToolsLocalServer.exe        |\n| UsdSdkToolsLocalServer.exe           |\n| UsdShellExtension.dll                |\n| usd_ms.dll                           |\n| register.bat                         |\n| unregister.bat                       |\n"
  },
  {
    "path": "docs/DESIGN.md",
    "content": "Activision USD Shell Extension - Design\n=======================================\n\nFundamentals \n------------\n\nThere are several fundamentals that this shell extension tries to adhere to.\n\n* **Performance**  \n  The extension must not stall Windows Explorer.  \n\n* **Stability**  \n  The extension must be stable. A crash will take down Window Explorer and/or the entire desktop.  \n  \n\nUsdShellExtension\n-----------------\n\nThis is a DLL project. \n\nIt is the core Windows Explorer Shell extension. This DLL is loaded into \nthe Windows Explorer process. As a result, this DLL should not *host* python.\n\n\n| Extension             | Description                                                                                                   |\n|-                      |-                                                                                                              |\n| **IPreviewHandler**   | Adds a preview for USD files by running `usdStageView` (a part of `usdView`) in an out-of-process viewport. |\n| **IThumbnailProvider**| Generates thumbnails for USD files by running `usdRecord` out-of-process.                                    |\n| **IPropertyStore**    | Exposes USD metadata to Windows Explorer and Windows Search.                                                  |\n\n\n**IPreviewHandler**\n\nThe IPreviewHandler runs out-of-process in a Windows provided COM local server called `prevhost.exe`. \nWe run the USD loading screen in `prevhost.exe` but launch the actual preview using our own out of process COM server, `UsdPreviewLocalServer.exe`. \n\nThe `prevhost.exe` process hosts all Windows preview handler in a single process instance. We use `UsdPreviewLocalServer.exe` to isolate `prevhost.exe`.\n\n*UsdPreviewLocalServer.exe*\n\nThis COM server embeds python and launches an instance of `usdStageView` using a custom python script. \nIt isolates python from any Windows system process.\n\nStalling 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.\n\n*UsdPreviewHandlerPython.py*\n\nWhen 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.\n\n**IThumbnailProvider**\n\n*UsdPythonToolsLocalServer.exe*\n\nThumbnail 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.\n\n**IPropertyStore**\n\nThe IPropertyStore interface runs synchronously to the UI in Windows Explorer. It must execute quickly. For this reason \nthe C++ USD SDK is used directly in Windows Explorer. \n\n**USD Activation Context**\n\nThe USD SDK and all of its dependencies are isolated from the rest of Windows Explorer via a Windows Activation Context. \nThis at least guarantees that if any other extension ever loads USD or any of its dependencies into Windows Explorer, we will not clash.\n\n**Python USD Plug-in**\nThis DLL serves as a python plug-in. The python plug-in is called ArResolverShellExtension. It is used to \nallow shared reads across the USD SDK. By default, the USD SDK uses fopen which in MSVC does not allow shared reads. \n\n**rundll**\nThis DLL has several rundll entry points. These entry points are executed from Windows Explorer context menus. \nThey are all located in `ShellExecute.cpp`.\n\nUsdPreviewLocalServer\n---------------------\n\nThis is COM Local Server executable. \n\nThis project serves `usdStageView`, the USD preview window, out of process. `usdStageView` is a python script \nwritten by Pixar. This project hosts python and executes the script. It communicates with `UsdShellExtension` \nvia COM.\n\nIf the Preview server crashes. It will not take down Windows Explorer.\n\nUsdPreviewHandlerPython\n-----------------------\n\nThis is a python extension module.\n\nIt is used to communicate between the python preview window and our shell \nextension. It is hosted by `UsdPreviewLocalServer`.\n\nUsdPythonToolsLocalServer\n-------------------------\n\nThis is COM Local Server executable. \n\nIt is used to host out of process USD python tools. This server is used to capture thumbnails using \n`usdrecord` and to launch `usdview`.\n\nUsdSdkToolsLocalServer\n----------------------\n\nThis is COM Local Server executable. \n\nIt is used to host out of process USD C++ tools. This server executes the conversion between USD file \nformats and generating USD archives.\n"
  },
  {
    "path": "docs/FEATURES.md",
    "content": "Activision USD Shell Extension\n==============================\n\nTable of contents\n-----------------\n\n  - [Windows Explorer Thumbnails](#features-thumbnails)\n  - [Windows Explorer Preview](#features-preview)\n  - [Windows Explorer Format Conversion](#features-conversion)\n  - [Windows Explorer Edit](#features-edit)\n  - [Windows Search](#features-search)\n  - [UsdView](#features-usdview)\n\n<BR>  \n\nWindows Explorer Thumbnails <a name=\"features-thumbnails\"></a>\n---------------------------\n\nThumbnails are automatically generated for USD file types. Thumbnails are generated by rendering out an image of the USD stage in the background.\n\nThumbnails 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.\n\n![thumbnails][thumbnails]\n\n<BR>  \n\nWindows Explorer Preview <a name=\"features-preview\"></a>\n------------------------\n\nThe Windows Explorer Preview pane will display a 3D viewport. \n\nThis viewport uses UsdStageView of UsdView to render a 3D viewport in Windows Explorer.\n\nThe viewport exposes all installed Hydra renderers. The default Hydra renderer can be modified in the configuration file.\n\n![preview][preview]\n\n<BR>  \n\nWindows Explorer Format Conversion <a name=\"features-conversion\"></a>\n----------------------------------\n\nThe Windows Explorer context menu can perform conversions on USD files.\n\n* Crate  \n  Convert a USD file type to USDC Crate Format.\n* Uncrate  \n  Convert a USD file type to USDA ASCII Format.\n* Package  \n  Convert a USD file type to a USDZ Package.\n* Flatten  \n  Flatten a USD file hierarchy to a USD file.  \n\n![convert][convert]\n\n<BR>  \n\nWindows Explorer Edit <a name=\"features-edit\"></a>\n---------------------\n\nThe Windows Explorer context menu exposes the ability to edit USD files in place. This includes crated USDC files.\n\nThe editor application used can be set in the configuration file.\n\n![edit][edit]\n\n<BR>  \n\nWindows Search <a name=\"features-search\"></a>\n--------------\n\nUSD file metadata is exposed to Windows Search. When USD metadata is indexed by Windows Search it can be searched for quickly.\n\n| Metadata        | Search Mnemonics                  | Visible in Explorer | Editable in Explorer | Visible in Properties |\n| --------------- |-----------------------------------|---------------------|----------------------|-----------------------|\n| Comments        | comment, comments                 |                 Yes |                  Yes |                   Yes |\n| Documentation   | usddocumentation, usddocs, usddoc |                 Yes |                   No |                   Yes |\n| CustomLayerData | usdcustomlayerdata, usdlayerdata  |                  No |                   No |                   Yes |  \n\n<BR>  \n\n![search][search]\n\n<BR>  \n\nUsdView <a name=\"features-usdview\"></a>\n-------\nThe default action for USD files in Windows Explorer is to open them in UsdView.\n\n![view][view]\n\n\n[thumbnails]:thumbnails.png \"Windows Explorer Thumbnails\"\n[preview]:preview.png \"Windows Explorer Preview\"\n[convert]:usdcat.png \"Windows Explorer Format Conversion\"\n[edit]:edit.png \"Windows Explorer Edit\"\n[search]:search.png \"Windows Search\"\n[view]:usdview.png \"UsdView\""
  },
  {
    "path": "docs/INSTALLING.md",
    "content": "Activision USD Shell Extension - Installation Guide\n===================================================\n\nThis document covers installing the shell extension from precompiled shell extension setup installers.\n\nStep 1: USD Build\n-----------------\n\nA prerequisite to the installing the shell extension is to have a functional build of USD. \n\nYou can build USD locally from Pixar's GitHub or use per-built libraries such as the ones available at NVIDIA.\n\nWhen building locally, make sure that the USD Python tools are built as well.\n\nPixar's USD Source Repository  \nhttps://github.com/PixarAnimationStudios/USD/\n\nNVIDIA's USD Pre-built Libraries and Tools  \nhttps://developer.nvidia.com/usd\n\n\nStep 2: Verify USD install with usdview\n---------------------------------------\n\nThe shell extension uses usdview for the Windows Explorer preview and usdrecord for thumbnails. usdview must be operational outside of the extension.\n\nLaunch usdview manually out of the USD build and make sure that it is rendering correctly.\n\n\nStep 3: Shell Extension Setup\n-----------------------------\n\nMatch 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.\n\nThe 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.\n\n**NVIDIA Pre-built Libraries Example**\n\nNVIDIA pre-built libraries installation location: `D:\\usd-21-05-usd-win64_py36_release`\n\n| Entry                    | Value                                                                             |\n|-                         |-                                                                                  |\n| **PATH**                 | D:\\usd-21-05-usd-win64_py36_release\\bin\\;D:\\usd-21-05-usd-win64_py36_release\\lib\\ |\n| **PYTHONPATH**           | D:\\usd-21-05-usd-win64_py36_release\\lib\\python                                    |\n| **PXR_PLUGINPATH_NAME**  |                                                                                   |\n\n\nUSD Text Editor\n---------------\nBy default, the text editor used by the `Edit` command is `notepad.exe`. This text editor is guaranteed to be installed.\n\nA custom text editor can be specified in the `UsdShellExtension.ini` file. \n\n**Requirements**\n\nThe editor *must* support not returning on the command line until the text file is closed in the editor.\n\n\n**Visual Studio Code**\n\nVisual Studio Code is a great editor for USDA files that also can perform syntax highlighting.\n\nTo associate Visual Studio Code with the USD Shell Extension use the following command in the ini file:\n\n```\n[USD]\nEDITOR=\"C:\\Users\\pmintus\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\" --wait\n```\n\n\nTroubleshooting\n---------------\n\n**Python**\n\nBy 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.\n\n| Python Version | Search Location                                              |\n|-               |-                                                             |\n| 2.7            | C:\\Python27                                                  |\n| 3.6            | HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\3.6\\InstallPath |\n| 3.7            | HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\3.7\\InstallPath |\n\nIf the Python install is not found at these locations, then it needs to be set explicitly using the `UsdShellExtension.ini` file.\n\n```\n[PYTHON]\nPATH=C:\\Python37\n```\n\n**Event Viewer**\n\nIf the shell extension is not working, then the first place to check for issues is the Windows Event Viewer. \n\nWindows Logs | Application\n\nThe event source will be `Activision USD Shell Extension`.\n\nIf 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.\n\n![eventviewer][eventviewer]\n\n\n**File Associations**\n\nFor 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.\n\nMake sure that the following file type associations are set to `Activision USD Shell Extension`.\n\nThis can be changed manually using Windows Settings. \n\nWindows Settings | Apps | Default apps | Choose default apps by file type\n\n| Extension | App                            |\n|-          |-                               |\n| .usd      | Activision USD Shell Extension |\n| .usda     | Activision USD Shell Extension |\n| .usdc     | Activision USD Shell Extension |\n| .usdz     | Activision USD Shell Extension |\n\n[eventviewer]:EventViewer.png \"Event Viewer\"\n"
  },
  {
    "path": "nsis.props",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n   Copyright 2021 Activision Publishing, Inc. \n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n-->\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <PropertyGroup>\n    <MAKENSIS>$(ProgramFiles)\\NSIS\\makensis.exe</MAKENSIS>\n  </PropertyGroup>\n</Project>"
  },
  {
    "path": "python.props",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n   Copyright 2021 Activision Publishing, Inc. \n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n-->\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <PropertyGroup Label=\"Globals\">\n    <PythonVersion>3.7</PythonVersion>\n\t  <!-- PY_VERSION_HEX encoding -->\n    <PythonVersionHex>0x03070000</PythonVersionHex> \n    <PythonFileName>python37</PythonFileName>\n  </PropertyGroup>\n\n\t<PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n\t\t<PythonDLL>$(PythonFileName).dll</PythonDLL>\n\t</PropertyGroup>\n\t<PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\n\t\t<PythonDLL>$(PythonFileName).dll</PythonDLL>\n\t</PropertyGroup>\n\t\n\t<ItemDefinitionGroup>\n    <ClCompile>\n      <PreprocessorDefinitions>PYTHONVERSION=$(PythonVersion);PYTHONDLL=\"$(PythonDLL)\";%(PreprocessorDefinitions)</PreprocessorDefinitions>\n    </ClCompile>\n\t  <PostBuildEvent Condition=\"$(PythonVersionHex) >= 0x03000000\">\n\t\t  <Command>\n\t\t\t  xcopy \"$(PYTHONHOME)$(PythonDLL)\" \"$(TargetDir)\" /I /Y /F /R\n\n\t\t\t  %(Command)\n\t\t  </Command>\n\t  </PostBuildEvent>\n  </ItemDefinitionGroup>\n\n</Project>"
  },
  {
    "path": "shared/EventViewerLog.h",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#pragma once\n\n#include \"EventViewerMessages.h\"\n\n#define EVENTLOG_SOURCE \"Activision USD Shell Extension\"\n\nenum class LogEventType\n{\n\tError = EVENTLOG_ERROR_TYPE,\n\tWarning = EVENTLOG_WARNING_TYPE,\n\tInformation = EVENTLOG_INFORMATION_TYPE,\n};\n\ninline bool LogEventMessage(WORD category, LPCTSTR sEventMessage, LogEventType type)\n{\n\tbool bSuccess = false;\n\n\tDWORD eventId;\n\tswitch ( type )\n\t{\n\tcase LogEventType::Information:\n\t\teventId = MSG_GENERIC_INFORMATION;\n\t\tbreak;\n\tcase LogEventType::Warning:\n\t\teventId = MSG_GENERIC_WARNING;\n\t\tbreak;\n\tcase LogEventType::Error:\n\t\teventId = MSG_GENERIC_ERROR;\n\t\tbreak;\n\tdefault:\n\t\ttype = LogEventType::Error;\n\t\teventId = MSG_GENERIC_ERROR;\n\t\tbreak;\n\t}\n\n\tHANDLE hEventSource = ::RegisterEventSource( nullptr, _T(EVENTLOG_SOURCE) );\n\tif ( hEventSource )\n\t{\n\t\tbSuccess = (::ReportEvent( hEventSource, static_cast<WORD>(type), category, eventId, nullptr, 1, 0, &sEventMessage, nullptr ) != FALSE);\n\t\t::DeregisterEventSource( hEventSource );\n\t}\n\n\treturn bSuccess;\n}"
  },
  {
    "path": "shared/EventViewerMessages.mc",
    "content": "LanguageNames=(English=0x409:MSG00409)\n\nMessageIdTypedef=WORD\n\nMessageId=0x1\nSymbolicName=GENERIC_CATEGORY\nLanguage=English\nGeneric\n.\n\nMessageId=0x2\nSymbolicName=SHELLEXTENSION_CATEGORY\nLanguage=English\nUSD Shell Extension\n.\n\nMessageId=0x3\nSymbolicName=PREVIEWHANDLER_CATEGORY\nLanguage=English\nUSD Preview Handler Server\n.\n\nMessageId=0x4\nSymbolicName=PYTHONTOOLS_CATEGORY\nLanguage=English\nUSD Python Tools Server\n.\n\nMessageId=0x5\nSymbolicName=SDKTOOLS_CATEGORY\nLanguage=English\nUSD SDK Tools Server\n.\n\nMessageId=0x6\nSymbolicName=CATEGORY_COUNT\nLanguage=English\nNumber of categories\n.\n\nMessageIdTypedef=DWORD\n\nMessageId=0x100\nSeverity=Error\nSymbolicName=MSG_GENERIC_SUCCESS\nLanguage=English\n%1\n.\n\nMessageId=0x101\nSeverity=Informational\nSymbolicName=MSG_GENERIC_INFORMATION\nLanguage=English\n%1\n.\n\nMessageId=0x102\nSeverity=Warning\nSymbolicName=MSG_GENERIC_WARNING\nLanguage=English\n%1\n.\n\nMessageId=0x103\nSeverity=Error\nSymbolicName=MSG_GENERIC_ERROR\nLanguage=English\n%1\n.\n\n"
  },
  {
    "path": "shared/EventViewerMessages.vcxproj",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" ToolsVersion=\"15.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup Label=\"ProjectConfigurations\">\n    <ProjectConfiguration Include=\"Debug|x64\">\n      <Configuration>Debug</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release|x64\">\n      <Configuration>Release</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n  </ItemGroup>\n  <PropertyGroup Label=\"Globals\">\n    <VCProjectVersion>15.0</VCProjectVersion>\n    <ProjectGuid>{F12E597B-B731-4F5A-BEC3-980D20159320}</ProjectGuid>\n    <RootNamespace>USDSharedLib</RootNamespace>\n    <WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>\n    <ProjectName>EventViewerMessages</ProjectName>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"Configuration\">\n    <ConfigurationType>Utility</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v141</PlatformToolset>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\" Label=\"Configuration\">\n    <ConfigurationType>Utility</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v141</PlatformToolset>\n    <WholeProgramOptimization>false</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n  <ImportGroup Label=\"ExtensionSettings\">\n  </ImportGroup>\n  <ImportGroup Label=\"Shared\">\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <PropertyGroup Label=\"UserMacros\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <OutDir>$(SolutionDir)bin\\$(PlatformToolset)\\$(PythonTag)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)build\\$(PlatformToolset)\\$(PythonTag)\\$(Configuration)\\$(ProjectName)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\n    <OutDir>$(SolutionDir)bin\\$(PlatformToolset)\\$(PythonTag)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)build\\$(PlatformToolset)\\$(PythonTag)\\$(Configuration)\\$(ProjectName)\\</IntDir>\n  </PropertyGroup>\n  <ItemGroup>\n    <CustomBuild Include=\"EventViewerMessages.mc\">\n      <FileType>Document</FileType>\n      <Command Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">echo mc %(FullPath)\nmc %(FullPath)</Command>\n      <Message Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">Compiling Messages...</Message>\n      <Outputs Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">%(Filename).rc;%(Filename).h;MSG00409.bin</Outputs>\n      <Command Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">echo mc %(FullPath)\nmc %(FullPath)</Command>\n      <Message Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">Compiling Messages...</Message>\n      <Outputs Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">%(Filename).rc;%(Filename).h;MSG00409.bin</Outputs>\n    </CustomBuild>\n  </ItemGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\n  <ImportGroup Label=\"ExtensionTargets\">\n  </ImportGroup>\n</Project>"
  },
  {
    "path": "shared/EventViewerMessages.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup>\n    <CustomBuild Include=\"EventViewerMessages.mc\" />\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "shared/PythonUtil.h",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#pragma once\n\n#include <exception>\n\n#if PY_MAJOR_VERSION >= 3\n\tusing TPyChar = wchar_t;\n\tusing CW2Py = ATL::CW2CW;\n\t#define __Tpy(x)      L ## x\n#else\n\tusing TPyChar = char;\n\tusing CW2Py = ATL::CW2A;\n\t#define __Tpy(x)      x\n#endif\n\n#define _Tpy(x)       __Tpy(x)\n\nclass CPyInterpreter\n{\npublic:\n    CPyInterpreter()\n    {\n        Py_Initialize();\n    }\n    ~CPyInterpreter()\n    {\n        Py_Finalize();\n    }\n};\n\nclass CPyObject\n{\npublic:\n    constexpr CPyObject() noexcept {}\n    constexpr CPyObject( std::nullptr_t ) noexcept {}\n    constexpr CPyObject( PyObject *pyObject ) noexcept \n    { \n        p = pyObject;  \n    }\n    CPyObject( CPyObject &&pyObject ) noexcept \n    { \n        p = pyObject.p; \n        pyObject.p = nullptr; \n    }\n    ~CPyObject()\n    {\n        reset( nullptr );\n    }\n\n    PyObject *get() const noexcept\n    {\n        return p;\n    }\n\n    PyObject *release() noexcept\n    {\n        PyObject *pyObject = p;\n        p = nullptr;\n        return pyObject;\n    }\n\n    void reset( PyObject *pyObject ) noexcept\n    {\n        if ( p != nullptr )\n        {\n            Py_DECREF( p );\n        }\n\n        p = pyObject;\n    }\n    void reset( std::nullptr_t ) noexcept\n    {\n        if ( p != nullptr )\n        {\n            Py_DECREF( p );\n        }\n\n        p = nullptr;\n    }\n\n    void swap( CPyObject &other ) noexcept\n    {\n        PyObject *pTemp = other.get();\n        other.p = p;\n        p = pTemp;\n    }\n\n    explicit operator bool() const noexcept\n    {\n        return get() != nullptr;\n    }\n\n    PyObject operator*() const\n    {\n        return *p;\n    }\n\n    PyObject* operator->() const noexcept\n    {\n        return p;\n    }\n\n    CPyObject &operator=( CPyObject &&rhs ) noexcept\n    {\n        reset( rhs.p );\n        rhs.p = nullptr;\n\n        return *this;\n    }\n\n    CPyObject &operator=( std::nullptr_t ) noexcept\n    {\n        reset( nullptr );\n\n        return *this;\n    }\n\n    bool operator==(PyObject* pT) const noexcept\n    {\n        return p == pT;\n    }\n\n    PyObject *p = nullptr;\n};\n\n#if PY_MAJOR_VERSION < 3\ninline const char *PyUnicode_AsUTF8( PyObject *unicode )\n{\n    if ( PyUnicode_Check( unicode ) )\n    {\n        CPyObject bytes( PyUnicode_AsEncodedString( unicode, \"UTF-8\", \"strict\" ) );\n        if ( bytes == nullptr )\n            return nullptr;\n\n        const char *s = PyBytes_AS_STRING( bytes.get() );\n        return s;\n    }\n    else if ( PyBytes_Check( unicode ) )\n    {\n        const char *s = PyBytes_AS_STRING( unicode );\n        return s;\n    }\n\n    return nullptr;\n}\n\ninline wchar_t *PyUnicode_AsWideCharString( PyObject *unicode, Py_ssize_t *size )\n{\n    const char *utf8 = PyUnicode_AsUTF8( unicode );\n    if ( utf8 == nullptr )\n        return nullptr;\n\n    int nCharactersNeededWithNullTerminator = ::MultiByteToWideChar( CP_UTF8, 0, utf8, -1, nullptr, 0 );\n    if ( nCharactersNeededWithNullTerminator <= 1 )\n        return nullptr;\n\n    wchar_t* utf16 = reinterpret_cast<wchar_t*>(PyMem_Malloc( sizeof( wchar_t ) * nCharactersNeededWithNullTerminator ));\n    if ( utf16 == nullptr )\n        return nullptr;\n\n    if ( ::MultiByteToWideChar( CP_UTF8, 0, utf8, -1, utf16, nCharactersNeededWithNullTerminator ) <= 0 )\n    {\n        PyMem_Free( utf16 );\n        return nullptr;\n    }\n\n    if ( size )\n        *size = nCharactersNeededWithNullTerminator - 1;\n\n    return utf16;\n}\n#endif\n\nclass CPyString : public CPyObject\n{\npublic:\n    constexpr CPyString() noexcept {}\n    constexpr CPyString( std::nullptr_t ) noexcept {}\n    constexpr CPyString( PyObject *pyObject ) noexcept \n    { \n        p = pyObject;  \n    }\n    CPyString( CPyString &&pyObject ) noexcept \n    { \n        p = pyObject.p; \n        pyObject.p = nullptr; \n    }\n    ~CPyString()\n    {\n        reset( nullptr );\n    }\n\n    explicit operator bool() const noexcept\n    {\n        return get() != nullptr;\n    }\n\n    PyObject operator*() const\n    {\n        return *p;\n    }\n\n    PyObject* operator->() const noexcept\n    {\n        return p;\n    }\n\n    CPyString &operator=( CPyString &&rhs ) noexcept\n    {\n        reset( rhs.p );\n        rhs.p = nullptr;\n\n        return *this;\n    }\n\n    CPyString &operator=( std::nullptr_t ) noexcept\n    {\n        reset( nullptr );\n\n        return *this;\n    }\n\n    bool operator==(PyObject* pT) const noexcept\n    {\n        return p == pT;\n    }\n\n\n    const char *c_str() const noexcept\n    {\n        if ( p == nullptr )\n            return \"\";\n\n        const char* s = PyUnicode_AsUTF8( p );\n        if ( s == nullptr )\n            return \"\";\n\n        return s;\n    }\n\n    static CPyString FromObject( PyObject *pyObject )\n    {\n        if ( pyObject == nullptr )\n            return CPyString();\n\n        CPyString result( PyObject_Str( pyObject ) );\n        return result;\n    }\n};\n\nclass CPyStringW : public CPyObject\n{\npublic:\n    constexpr CPyStringW() noexcept {}\n    constexpr CPyStringW( std::nullptr_t ) noexcept {}\n    constexpr CPyStringW( PyObject *pyObject ) noexcept \n    { \n        p = pyObject;  \n    }\n    CPyStringW( CPyStringW &&pyObject ) noexcept \n    { \n        p = pyObject.p; \n        pyObject.p = nullptr; \n    }\n    ~CPyStringW()\n    {\n        reset( nullptr );\n    }\n\n    explicit operator bool() const noexcept\n    {\n        return get() != nullptr;\n    }\n\n    PyObject operator*() const\n    {\n        return *p;\n    }\n\n    PyObject* operator->() const noexcept\n    {\n        return p;\n    }\n\n    CPyStringW &operator=( CPyStringW &&rhs ) noexcept\n    {\n        reset( rhs.p );\n        rhs.p = nullptr;\n\n        return *this;\n    }\n\n    CPyStringW &operator=( std::nullptr_t ) noexcept\n    {\n        reset( nullptr );\n\n        return *this;\n    }\n\n    bool operator==(PyObject* pT) const noexcept\n    {\n        return p == pT;\n    }\n\n\n    const wchar_t *c_str() const noexcept\n    {\n        if ( p == nullptr )\n            return L\"\";\n\n        if ( s == nullptr )\n            s = PyUnicode_AsWideCharString( p, nullptr );\n\n        return s;\n    }\n\n    void reset( PyObject *pyObject ) noexcept\n    {\n        if ( s )\n        {\n            PyMem_Free ( s );\n            s = nullptr;\n        }\n\n        CPyObject::reset( pyObject );\n    }\n    void reset( std::nullptr_t ) noexcept\n    {\n        if ( s )\n        {\n            PyMem_Free ( s );\n            s = nullptr;\n        }\n\n        CPyObject::reset( nullptr );\n    }\n\n    static CPyStringW FromObject( PyObject *pyObject )\n    {\n        if ( pyObject == nullptr )\n            return CPyStringW();\n\n        CPyStringW result( PyObject_Str( pyObject ) );\n        return result;\n    }\n\nprivate:\n    mutable wchar_t *s = nullptr;\n};\n\ninline CStringW StringListToString( PyObject *pyObject )\n{\n    CStringW result;\n\n    if ( pyObject == nullptr )\n        return result;\n\n    CPyObject itr = PyObject_GetIter( pyObject );\n    if( itr == nullptr )\n        return result;\n\n    for ( ;; )\n    {\n        CPyObject item = PyIter_Next( itr.get() );\n        if ( item == nullptr )\n            break;\n\n        CPyStringW str = CPyStringW::FromObject( item.get() );\n        result += str.c_str();\n    }\n\n    return result;\n}\n\n\nclass CPyException : public std::exception\n{\npublic:\n    CPyException()\n    {\n        if ( PyErr_Occurred() )\n        {\n            PyErr_Fetch( &m_pType.p, &m_pValue.p, &m_pTraceback.p );\n            PyErr_NormalizeException( &m_pType.p, &m_pValue.p, &m_pTraceback.p );\n\n            m_pTracebackObject = reinterpret_cast<PyTracebackObject*>(m_pTraceback.get());\n\n            m_sValue = CPyString::FromObject( m_pValue.get() );\n            m_sValueW = CPyStringW::FromObject( m_pValue.get() );\n\n            m_sTypeW = CPyStringW::FromObject( m_pType.get() );\n        }\n    }\n\n    _NODISCARD virtual char const* what() const override\n    {\n        return m_sValue ? m_sValue.c_str() : \"Unknown exception\";\n    }\n\n    _NODISCARD wchar_t const* whatW() const\n    {\n        return m_sValueW ? m_sValueW.c_str() : L\"Unknown exception\";\n    }\n\n    wchar_t const* typeW() const\n    {\n        return m_sTypeW ? m_sTypeW.c_str() : L\"Unknown type\";\n    }\n\n    const wchar_t *tracebackW() const\n    {\n        if ( m_bTracebackResolved == false )\n        {\n            m_bTracebackResolved = true;\n\n            CPyObject importTraceback = PyImport_ImportModule( \"traceback\" );\n            if ( importTraceback == nullptr )\n                return L\"\";\n\n            CPyObject funcFormatException = PyObject_GetAttrString( importTraceback.get(), \"format_exception\" );\n            if ( funcFormatException == nullptr )\n                return L\"\";\n\n            CPyObject result = PyObject_CallFunctionObjArgs( funcFormatException.get(), m_pType.get(), m_pValue.get(), m_pTraceback.get(), nullptr );\n            if ( result == nullptr )\n                return L\"\";\n\n            m_sTraceback = StringListToString( result.get() );\n        }\n\n        return m_sTraceback;\n    }\n\n    bool IsExceptionSystemExit() const\n    {\n        // We cannot use PyErr_GivenExceptionMatches() because it prevents the ability to delay link pythonXX.dll\n        //return _wcsicmp(m_sTypeW.c_str(), L\"<class 'SystemExit'>\") == 0;\n        return PyErr_GivenExceptionMatches( GetException(), PyExc_SystemExit ) != 0;\n    }\n\n    PyObject *GetException() const { return m_pType.get(); }\n    PyObject *GetValue() const { return m_pValue.get(); }\n\nprivate:\n    CPyObject m_pType;\n    CPyObject m_pValue;\n    CPyObject m_pTraceback;\n\n    PyTracebackObject *m_pTracebackObject = nullptr;\n\n    CPyString m_sValue;\n    CPyStringW m_sValueW;\n    CPyStringW m_sTypeW;\n    mutable CStringW m_sTraceback;\n\n    mutable bool m_bTracebackResolved = false;\n};\n\nclass CPyImport : public CPyObject\n{\npublic:\n    CPyImport(const char* name)\n    {\n        p = PyImport_ImportModule( name );\n        if ( p == nullptr )\n        {\n            throw CPyException();\n        }\n    }\n};\n\nclass CPyAttr : public CPyObject\n{\npublic:\n    CPyAttr(PyObject* object, const char* name)\n    {\n        p = PyObject_GetAttrString( object, name );\n        if ( p == nullptr )\n        {\n            throw CPyException();\n        }\n    }\n};\n\nclass CPyInstance : public CPyObject\n{\npublic:\n    CPyInstance(PyObject* object, const char* name)\n    {\n        // locate the object\n        CPyObject pAttr = PyObject_GetAttrString( object, name );\n        if ( pAttr == nullptr )\n        {\n            throw CPyException();\n        }\n\n        // create an instance of the object\n        p = PyObject_CallObject( pAttr.get(), nullptr );\n        if ( p == nullptr )\n        {\n            throw CPyException();\n        }\n    }\n};\n\nclass CPyCallMethod : public CPyObject\n{\npublic:\n    template <typename... Args>\n    CPyCallMethod(PyObject* object, const char* name, const char* format, Args&&... args)\n    {\n        p = PyObject_CallMethod( object, name, format, std::forward<Args>(args)... );\n        if ( p == nullptr )\n        {\n            throw CPyException();\n        }\n    }\n};\n\nclass CPyCallFunction : public CPyObject\n{\npublic:\n    template <typename... Args>\n    CPyCallFunction(PyObject* object, const char* format, Args&&... args)\n    {\n        p = PyObject_CallFunction( object, format, std::forward<Args>(args)... );\n        if ( p == nullptr )\n        {\n            throw CPyException();\n        }\n    }\n};\n\n\ninline void PySetEnvironmentVariable( LPCWSTR sEnvironmentVariable, LPCWSTR sValue )\n{\n    if ( sEnvironmentVariable == nullptr || sEnvironmentVariable[0] == '\\0' )\n        return;\n\n    CPyObject os = PyImport_ImportModule( \"os\" );\n    if ( os == nullptr )\n        return;\n    CPyObject environClass = PyObject_GetAttrString( os.get(), \"environ\" );\n    if ( environClass == nullptr )\n        return;\n    CPyObject environSetItem = PyObject_GetAttrString( environClass.get(), \"__setitem__\" );\n    if ( environSetItem == nullptr )\n        return;\n    CPyObject pyEnvironmentVariable = PyUnicode_FromString( static_cast<LPCSTR>(ATL::CW2A( sEnvironmentVariable, CP_UTF8 )) );\n    if ( pyEnvironmentVariable == nullptr )\n        return;\n    CPyObject pyValue = PyUnicode_FromString( static_cast<LPCSTR>(ATL::CW2A( sValue ? sValue : L\"\", CP_UTF8 )) );\n    if ( pyValue == nullptr )\n        return;\n    CPyObject args = Py_BuildValue( \"OO\", pyEnvironmentVariable.get(), pyValue.get() );\n    if ( args == nullptr )\n        return;\n\n    CPyObject ret = PyObject_CallObject( environSetItem.get(), args.get() );\n}\n\ninline void PyAppendSysPath(LPCWSTR sPath)\n{\n    if ( sPath == nullptr )\n        return;\n\n    CPyObject sys = PyImport_ImportModule( \"sys\" );\n    if ( sys == nullptr )\n        return;\n    CPyObject path = PyObject_GetAttrString( sys.get(), \"path\" );\n    if ( path == nullptr )\n        return;\n\t\n#if PY_MAJOR_VERSION < 3\n    PyList_Append(path.get(), PyString_FromString(static_cast<LPCSTR>(ATL::CW2A( sPath, CP_UTF8 ))));\n#else\n    PyList_Append(path.get(), PyUnicode_FromString(static_cast<LPCSTR>(ATL::CW2A( sPath, CP_UTF8 ))));\n#endif\n}\n\ninline void PyAppendSysPath(const std::vector<CStringW>& pathList)\n{\n    if ( pathList.empty() )\n        return;\n\n    CPyObject sys = PyImport_ImportModule( \"sys\" );\n    if ( sys == nullptr )\n        return;\n    CPyObject path = PyObject_GetAttrString( sys.get(), \"path\" );\n    if ( path == nullptr )\n        return;\n\t\n    for ( const CStringW &sPath : pathList )\n    {\n#if PY_MAJOR_VERSION < 3\n        PyList_Append(path.get(), PyString_FromString(static_cast<LPCSTR>(ATL::CW2A( sPath, CP_UTF8 ))));\n#else\n        PyList_Append(path.get(), PyUnicode_FromString(static_cast<LPCSTR>(ATL::CW2A( sPath, CP_UTF8 ))));\n#endif\n    }\n}\n"
  },
  {
    "path": "shared/emb.cpp",
    "content": "//\n// Copyright (C) 2011 Mateusz Loskot <mateusz@loskot.net>\n// Distributed under the Boost Software License, Version 1.0.\n// (See accompanying file LICENSE_1_0.txt or copy at\n// http://www.boost.org/LICENSE_1_0.txt)\n//\n// Blog article: http://mateusz.loskot.net/?p=2819\n\n#pragma once\n\n#include \"stdafx.h\"\n#include \"emb.h\"\n\nnamespace emb\n{\n\tstruct Stdout\n\t{\n\t\tPyObject_HEAD\n\t\t\tstdout_write_type write;\n\t};\n\n\tPyObject *Stdout_write( PyObject *self, PyObject *args )\n\t{\n\t\tstd::size_t written( 0 );\n\t\tStdout *selfimpl = reinterpret_cast<Stdout *>(self);\n\t\tif ( selfimpl->write )\n\t\t{\n\t\t\tchar *data;\n\t\t\tif ( !PyArg_ParseTuple( args, \"s\", &data ) )\n\t\t\t\treturn 0;\n\n\t\t\tstd::string str( data );\n\t\t\tselfimpl->write( str );\n\t\t\twritten = str.size();\n\t\t}\n\t\treturn PyLong_FromSize_t( written );\n\t}\n\n\tPyObject *Stdout_flush( PyObject * /*self*/, PyObject * /*args*/ )\n\t{\n\t\t// no-op\n\t\treturn Py_BuildValue( \"\" );\n\t}\n\n\tPyMethodDef Stdout_methods[] =\n\t{\n\t\t{\"write\", Stdout_write, METH_VARARGS, \"sys.stdout.write\"},\n\t\t{\"flush\", Stdout_flush, METH_VARARGS, \"sys.stdout.write\"},\n\t\t{0, 0, 0, 0} // sentinel\n\t};\n\n\tPyTypeObject StdoutType =\n\t{\n\t\tPyVarObject_HEAD_INIT( 0, 0 )\n\t\t\"emb.StdoutType\",     /* tp_name */\n\t\tsizeof( Stdout ),       /* tp_basicsize */\n\t\t0,                    /* tp_itemsize */\n\t\t0,                    /* tp_dealloc */\n\t\t0,                    /* tp_print */\n\t\t0,                    /* tp_getattr */\n\t\t0,                    /* tp_setattr */\n\t\t0,                    /* tp_reserved */\n\t\t0,                    /* tp_repr */\n\t\t0,                    /* tp_as_number */\n\t\t0,                    /* tp_as_sequence */\n\t\t0,                    /* tp_as_mapping */\n\t\t0,                    /* tp_hash  */\n\t\t0,                    /* tp_call */\n\t\t0,                    /* tp_str */\n\t\t0,                    /* tp_getattro */\n\t\t0,                    /* tp_setattro */\n\t\t0,                    /* tp_as_buffer */\n\t\tPy_TPFLAGS_DEFAULT,   /* tp_flags */\n\t\t\"emb.Stdout objects\", /* tp_doc */\n\t\t0,                    /* tp_traverse */\n\t\t0,                    /* tp_clear */\n\t\t0,                    /* tp_richcompare */\n\t\t0,                    /* tp_weaklistoffset */\n\t\t0,                    /* tp_iter */\n\t\t0,                    /* tp_iternext */\n\t\tStdout_methods,       /* tp_methods */\n\t\t0,                    /* tp_members */\n\t\t0,                    /* tp_getset */\n\t\t0,                    /* tp_base */\n\t\t0,                    /* tp_dict */\n\t\t0,                    /* tp_descr_get */\n\t\t0,                    /* tp_descr_set */\n\t\t0,                    /* tp_dictoffset */\n\t\t0,                    /* tp_init */\n\t\t0,                    /* tp_alloc */\n\t\t0,                    /* tp_new */\n\t};\n\n#if PY_MAJOR_VERSION >= 3\n\tPyModuleDef embmodule =\n\t{\n\t\tPyModuleDef_HEAD_INIT,\n\t\t\"emb\", 0, -1, 0,\n\t};\n#endif\n\n\t// Internal state\n\tPyObject *g_stdout;\n\tPyObject *g_stdout_saved;\n\tPyObject *g_stderr;\n\tPyObject *g_stderr_saved;\n\n#if PY_MAJOR_VERSION >= 3\n\t#define NULL_MODULE nullptr\n#else\n\t#define NULL_MODULE\n#endif\n\n\tPyMODINIT_FUNC PyInit_emb( void )\n\t{\n\t\tg_stdout = 0;\n\t\tg_stdout_saved = 0;\n\t\tg_stderr = 0;\n\t\tg_stderr_saved = 0;\n\n\t\tStdoutType.tp_new = PyType_GenericNew;\n\t\tif ( PyType_Ready( &StdoutType ) < 0 )\n\t\t\treturn NULL_MODULE;\n\n#if PY_MAJOR_VERSION >= 3\n\t\tPyObject *m = PyModule_Create( &embmodule );\n#else\n\t\tPyObject *m = Py_InitModule( \"emb\", Stdout_methods );\n#endif\n\t\tif ( m )\n\t\t{\n\t\t\tPy_INCREF( &StdoutType );\n\t\t\tPyModule_AddObject( m, \"Stdout\", reinterpret_cast<PyObject *>(&StdoutType) );\n\t\t}\n\n#if PY_MAJOR_VERSION >= 3\n\t\treturn m;\n#endif\n\t}\n\n\tvoid set_stdout( stdout_write_type write )\n\t{\n\t\tif ( !g_stdout )\n\t\t{\n\t\t\tg_stdout_saved = PySys_GetObject( const_cast<char*>(\"stdout\") ); // borrowed\n\t\t\tg_stdout = StdoutType.tp_new( &StdoutType, 0, 0 );\n\t\t}\n\n\t\tStdout *impl = reinterpret_cast<Stdout *>(g_stdout);\n\t\timpl->write = write;\n\t\tPySys_SetObject( const_cast<char*>(\"stdout\"), g_stdout );\n\t}\n\n\tvoid reset_stdout()\n\t{\n\t\tif ( g_stdout_saved )\n\t\t\tPySys_SetObject( const_cast<char*>(\"stdout\"), g_stdout_saved );\n\n\t\tPy_XDECREF( g_stdout );\n\t\tg_stdout = 0;\n\t}\n\n\tvoid set_stderr( stdout_write_type write )\n\t{\n\t\tif ( !g_stderr )\n\t\t{\n\t\t\tg_stderr_saved = PySys_GetObject( const_cast<char*>(\"stderr\") ); // borrowed\n\t\t\tg_stderr = StdoutType.tp_new( &StdoutType, 0, 0 );\n\t\t}\n\n\t\tStdout *impl = reinterpret_cast<Stdout *>(g_stderr);\n\t\timpl->write = write;\n\t\tPySys_SetObject( const_cast<char*>(\"stderr\"), g_stderr );\n\t}\n\n\tvoid reset_stderr()\n\t{\n\t\tif ( g_stderr_saved )\n\t\t\tPySys_SetObject( const_cast<char*>(\"stderr\"), g_stderr_saved );\n\n\t\tPy_XDECREF( g_stderr );\n\t\tg_stderr = 0;\n\t}\n\n} // namespace emb\n"
  },
  {
    "path": "shared/emb.h",
    "content": "//\n// Copyright (C) 2011 Mateusz Loskot <mateusz@loskot.net>\n// Distributed under the Boost Software License, Version 1.0.\n// (See accompanying file LICENSE_1_0.txt or copy at\n// http://www.boost.org/LICENSE_1_0.txt)\n//\n// Blog article: http://mateusz.loskot.net/?p=2819\n\n#pragma once\n\n#include <functional>\n#include <iostream>\n#include <string>\n\nnamespace emb\n{\n\ttypedef std::function<void( std::string )> stdout_write_type;\n\n\tPyMODINIT_FUNC PyInit_emb( void );\n\tvoid set_stdout( stdout_write_type write );\n\tvoid reset_stdout();\n\tvoid set_stderr( stdout_write_type write );\n\tvoid reset_stderr();\n\n} // namespace emb\n"
  },
  {
    "path": "shared/environment.cpp",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include \"stdafx.h\"\n#include \"environment.h\"\n\n#include <Python.h>\n#include <shlobj.h>\n\nstd::vector<CStringW> g_UsdPathList;\nstd::vector<CStringW> g_UsdPythonPathList;\n\nCStringW g_UsdPath;\nCStringW g_UsdPythonPath;\nCStringW g_UsdEditor;\n\nconst std::vector<CStringW> &GetUsdPathList()\n{\n\treturn g_UsdPathList;\n}\n\nconst std::vector<CStringW> &GetUsdPythonPathList()\n{\n\treturn g_UsdPythonPathList;\n}\n\nconst CStringW &GetUsdPath()\n{\n\treturn g_UsdPath;\n}\n\nconst CStringW &GetUsdPythonPath()\n{\n\treturn g_UsdPythonPath;\n}\n\nconst CStringW &GetUsdEditor()\n{\n\treturn g_UsdEditor;\n}\n\nstatic std::vector<CStringW> TranslatePathsToList(LPCWSTR paths)\n{\n\tstd::vector<CStringW> pathList;\n\tCStringW sPaths(paths);\n\n\tCStringW sToken;\n\tint pos = 0;\n\tsToken = sPaths.Tokenize(L\";\", pos);\n\tif ( !sToken.IsEmpty() )\n\t{\n\t\twhile ( !sToken.IsEmpty() )\n\t\t{\n\t\t\tpathList.push_back( sToken );\n\t\t\tsToken = sPaths.Tokenize( L\";\", pos );\n\t\t}\n\t}\n\telse\n\t{\n\t\tpathList.push_back( paths );\n\t}\n\n\treturn pathList;\n}\n\nstatic CStringW AppendEnvironmentVariable( LPCWSTR sEnvironmentVariable, LPCWSTR sValue )\n{\n\t// CRT environment variables\n\tsize_t sizeRequired = 0;\n\tCStringW sGetBuffer;\n\tif ( _wgetenv_s( &sizeRequired, nullptr, 0, sEnvironmentVariable ) == 0 )\n\t{\n\t\tif ( sizeRequired > 0 )\n\t\t{\n\t\t\tLPWSTR pGetBuffer = sGetBuffer.GetBuffer( static_cast<int>(sizeRequired) );\n\t\t\t_wgetenv_s( &sizeRequired, pGetBuffer, sizeRequired, sEnvironmentVariable );\n\t\t\tsGetBuffer.ReleaseBufferSetLength( static_cast<int>(sizeRequired) );\n\t\t}\n\t}\n\n\tCStringW sSetBuffer = sValue;\n\tsSetBuffer += L\";\";\n\tsSetBuffer += sGetBuffer;\n\t_wputenv_s( sEnvironmentVariable, sSetBuffer );\n\n\treturn sSetBuffer;\n}\n\nstatic void SetupPathEnvironmentVariable(LPCWSTR sUSD_Path, LPCWSTR sPython_Path)\n{\n\tCStringW sSetBuffer;\n\n\tif ( sPython_Path[0] == '\\0' )\n\t{\n#if PY_MAJOR_VERSION >= 3\n\t#if defined(PYTHONVERSION)\n\t\tCStringW sPythonRegKeyInstallPath;\n\t\tsPythonRegKeyInstallPath.Format( L\"SOFTWARE\\\\Python\\\\PythonCore\\\\%hs\\\\InstallPath\", _CRT_STRINGIZE(PYTHONVERSION) );\n\n\t\tLSTATUS ls;\n\t\tCRegKey regPythonInstallPath;\n\t\tls = regPythonInstallPath.Open( HKEY_CURRENT_USER, sPythonRegKeyInstallPath, KEY_READ );\n\t\tif ( ls == ERROR_SUCCESS )\n\t\t{\n\t\t\tTCHAR sValue[512];\n\t\t\tULONG nChars = ARRAYSIZE( sValue );\n\t\t\tls = regPythonInstallPath.QueryStringValue( L\"\", sValue, &nChars );\n\t\t\tif ( ls == ERROR_SUCCESS )\n\t\t\t{\n\t\t\t\tif ( !sSetBuffer.IsEmpty() )\n\t\t\t\t\tsSetBuffer += L\";\";\n\t\t\t\tsSetBuffer += sValue;\n\t\t\t}\n\t\t}\n\t#endif\n#elif PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION == 7\n\t\tstatic constexpr wchar_t python27InstallPath[] = L\"C:\\\\Python27\\\\\";\n\t\tDWORD nAttrib = ::GetFileAttributesW( python27InstallPath );\n\t\tif ( (nAttrib != INVALID_FILE_ATTRIBUTES) && (nAttrib & FILE_ATTRIBUTE_DIRECTORY) )\n\t\t{\n\t\t\tif ( !sSetBuffer.IsEmpty() )\n\t\t\t\tsSetBuffer += L\";\";\n\t\t\tsSetBuffer += python27InstallPath;\n\t\t}\n#endif\n\t}\n\telse\n\t{\n\t\tif ( !sSetBuffer.IsEmpty() )\n\t\t\tsSetBuffer += L\";\";\n\t\tsSetBuffer += sPython_Path;\n\t}\n\n\tif ( !sSetBuffer.IsEmpty() )\n\t\tsSetBuffer += L\";\";\n\tsSetBuffer += sUSD_Path;\n\n\tg_UsdPath = AppendEnvironmentVariable( L\"PATH\", sSetBuffer );\n}\n\nstatic void SetupPythonPathEnvironmentVariable(LPCWSTR sUSD_PythonPath, LPCWSTR sPython_PythonPath)\n{\n\tCStringW sSetBuffer = sUSD_PythonPath;\n\tif ( !sSetBuffer.IsEmpty() )\n\t\tsSetBuffer += L\";\";\n\tsSetBuffer += sPython_PythonPath;\n\n\tg_UsdPythonPath = AppendEnvironmentVariable( L\"PYTHONPATH\", sSetBuffer );\n}\n\nstatic void SetupUsdEditorEnvironmentVariable(LPCWSTR sUSD_EditorPath)\n{\n\tif ( sUSD_EditorPath && sUSD_EditorPath[0] != '\\0' )\n\t{\n\t\tAppendEnvironmentVariable( L\"USD_EDITOR\", sUSD_EditorPath );\n\t\tg_UsdEditor = sUSD_EditorPath;\n\t}\n}\n\nstatic void SetupUsdPluginPathEnvironmentVariable(LPCWSTR sUSD_PluginPath)\n{\n\tif ( sUSD_PluginPath && sUSD_PluginPath[0] != '\\0' )\n\t{\n\t\tAppendEnvironmentVariable( L\"PXR_PLUGINPATH_NAME\", sUSD_PluginPath );\n\t}\n}\n\nvoid GetPrivateProfileStringAndExpandEnvironmentStrings( LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpDefault, CStringW& lpReturnedString, const std::vector<CStringW> &ConfigFileList )\n{\n\t// a default string that a user wouldn't enter by hand\n\tconst wchar_t sDefault[] = L\"{80CA827C-F8A2-42E3-B582-BF7940014D71}\";\n\twchar_t sBuffer[8196];\n\n\tfor ( const CStringW &sConfigFile : ConfigFileList )\n\t{\n\t\tsBuffer[0] = '\\0';\n\t\t::GetPrivateProfileStringW( lpAppName, lpKeyName, sDefault, sBuffer, ARRAYSIZE(sBuffer), sConfigFile );\n\t\tif ( sBuffer[0] != '\\0' && wcscmp( sBuffer, sDefault ) )\n\t\t\tbreak;\n\t}\n\n\t// if we never found an entry, use the passed in default\n\tif ( sBuffer[0] == '\\0' || wcscmp( sBuffer, sDefault ) == 0 )\n\t{\n\t\twcscpy_s( sBuffer, lpDefault );\n\t}\n\n\tDWORD nLengthInChars = ::ExpandEnvironmentStringsW( sBuffer, lpReturnedString.GetBuffer(), lpReturnedString.GetAllocLength() );\n\tif ( static_cast<int>(nLengthInChars) > lpReturnedString.GetAllocLength() )\n\t{\n\t\t::ExpandEnvironmentStringsW( sBuffer, lpReturnedString.GetBuffer(nLengthInChars), nLengthInChars );\n\t}\n\n\tlpReturnedString.ReleaseBuffer( nLengthInChars );\n}\n\nstd::vector<CStringW> BuildConfigFileList( HMODULE hCurrentModule )\n{\n\tstd::vector<CStringW> ConfigFileList;\n\n\t// 1. current user config file\n\t{\n\t\twchar_t *pFolderPath = nullptr;\n\t\tif ( ::SHGetKnownFolderPath( FOLDERID_LocalAppData, KF_FLAG_DEFAULT, nullptr, &pFolderPath ) == S_OK )\n\t\t{\n\t\t\twchar_t sConfigPath[1024];\n\t\t\twcscpy_s( sConfigPath, pFolderPath );\n\t\t\tCoTaskMemFree( pFolderPath );\n\t\t\tpFolderPath = nullptr;\n\t\t\t::PathCchAppend( sConfigPath, ARRAYSIZE( sConfigPath ), L\"Activision\" );\n\t\t\t::PathCchAppend( sConfigPath, ARRAYSIZE( sConfigPath ), L\"UsdShellExtension\" );\n\t\t\t::PathCchAppend( sConfigPath, ARRAYSIZE( sConfigPath ), L\"UsdShellExtension.ini\" );\n\t\t\tConfigFileList.push_back( sConfigPath );\n\t\t}\n\t}\n\n\t// 2. all users config file\n\t{\n\t\twchar_t *pFolderPath = nullptr;\n\t\tif ( ::SHGetKnownFolderPath( FOLDERID_ProgramData, KF_FLAG_DEFAULT, nullptr, &pFolderPath ) == S_OK )\n\t\t{\n\t\t\twchar_t sConfigPath[1024];\n\t\t\twcscpy_s( sConfigPath, pFolderPath );\n\t\t\tCoTaskMemFree( pFolderPath );\n\t\t\tpFolderPath = nullptr;\n\t\t\t::PathCchAppend( sConfigPath, ARRAYSIZE( sConfigPath ), L\"Activision\" );\n\t\t\t::PathCchAppend( sConfigPath, ARRAYSIZE( sConfigPath ), L\"UsdShellExtension\" );\n\t\t\t::PathCchAppend( sConfigPath, ARRAYSIZE( sConfigPath ), L\"UsdShellExtension.ini\" );\n\t\t\tConfigFileList.push_back( sConfigPath );\n\t\t}\n\t}\n\n\t// 3. config file next to module\n\t{\n\t\twchar_t sConfigPath[1024];\n\t\t::GetModuleFileNameW( hCurrentModule, sConfigPath, ARRAYSIZE( sConfigPath ) );\n\t\t::PathCchRemoveFileSpec( sConfigPath, ARRAYSIZE( sConfigPath ) );\n\t\t::PathCchAppend( sConfigPath, ARRAYSIZE( sConfigPath ), L\"UsdShellExtension.ini\" );\n\t\tConfigFileList.push_back( sConfigPath );\n\t}\n\n\treturn ConfigFileList;\n}\n\nvoid SetupPythonEnvironment( HMODULE hCurrentModule )\n{\n\tstd::vector<CStringW> ConfigFileList = BuildConfigFileList(hCurrentModule);\n\n\tCStringW sUSD_Path;\n\tGetPrivateProfileStringAndExpandEnvironmentStrings( L\"USD\", L\"PATH\", L\"\", sUSD_Path, ConfigFileList );\n\n\tCStringW sUSD_PythonPath;\n\tGetPrivateProfileStringAndExpandEnvironmentStrings( L\"USD\", L\"PYTHONPATH\", L\"\", sUSD_PythonPath, ConfigFileList );\n\n\tCStringW sUSD_EditorPath;\n\tGetPrivateProfileStringAndExpandEnvironmentStrings( L\"USD\", L\"EDITOR\", L\"\", sUSD_EditorPath, ConfigFileList );\n\n\tCStringW sUSD_PluginPath;\n\tGetPrivateProfileStringAndExpandEnvironmentStrings( L\"USD\", L\"PXR_PLUGINPATH_NAME\", L\"\", sUSD_PluginPath, ConfigFileList );\n\n\tCStringW sPython_Path;\n\tGetPrivateProfileStringAndExpandEnvironmentStrings( L\"PYTHON\", L\"PATH\", L\"\", sPython_Path, ConfigFileList );\n\n\tCStringW sPython_PythonPath;\n\tGetPrivateProfileStringAndExpandEnvironmentStrings( L\"PYTHON\", L\"PYTHONPATH\", L\"\", sPython_PythonPath, ConfigFileList );\n\n\tg_UsdPathList = TranslatePathsToList(sUSD_Path);\n\tg_UsdPythonPathList = TranslatePathsToList(sUSD_PythonPath);\n\n\tSetupPathEnvironmentVariable( sUSD_Path, sPython_Path );\n\tSetupPythonPathEnvironmentVariable( sUSD_PythonPath, sPython_PythonPath );\n\tSetupUsdEditorEnvironmentVariable( sUSD_EditorPath );\n\tSetupUsdPluginPathEnvironmentVariable( sUSD_PluginPath );\n}"
  },
  {
    "path": "shared/environment.h",
    "content": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#pragma once\n\n#include <vector>\n\nvoid SetupPythonEnvironment( HMODULE hCurrentModule );\nconst std::vector<CStringW> &GetUsdPathList();\nconst std::vector<CStringW> &GetUsdPythonPathList();\nconst CStringW &GetUsdPath();\nconst CStringW &GetUsdPythonPath();\nconst CStringW &GetUsdEditor();\n\nstd::vector<CStringW> BuildConfigFileList( HMODULE hCurrentModule );\nvoid GetPrivateProfileStringAndExpandEnvironmentStrings( LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpDefault, CStringW &lpReturnedString, const std::vector<CStringW> &ConfigFileList );"
  },
  {
    "path": "usd-monolithic.props",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n   Copyright 2021 Activision Publishing, Inc. \n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n-->\n\n<!-- These paths should point to a monolithic build of the USD sdk to avoid additional DLL dependencies -->\n\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <PropertyGroup>\n    <USDBUILD>monolithic</USDBUILD>\n    <USDVERSION>21.02</USDVERSION>\n  </PropertyGroup>\n\t\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <USDBINPATH>d:\\USD-monolithic-bare-debug\\bin\\</USDBINPATH>\n    <USDLIBPATH>d:\\USD-monolithic-bare-debug\\lib\\</USDLIBPATH>\n    <USDINCLUDEPATH>d:\\USD-monolithic-bare-debug\\include\\</USDINCLUDEPATH>\n\t<PXR_PLUGINPATH_NAME>d:\\USD-monolithic-bare-debug\\lib\\usd\\</PXR_PLUGINPATH_NAME>\n  </PropertyGroup>\t\n\t\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\n    <USDBINPATH>d:\\USD-monolithic-bare\\bin\\</USDBINPATH>\n    <USDLIBPATH>d:\\USD-monolithic-bare\\lib\\</USDLIBPATH>\n    <USDINCLUDEPATH>d:\\USD-monolithic-bare\\include\\</USDINCLUDEPATH>\n\t<PXR_PLUGINPATH_NAME>d:\\USD-monolithic-bare\\lib\\usd\\</PXR_PLUGINPATH_NAME>\n  </PropertyGroup>\t\n\n\t<ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <ClCompile>\n      <PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(USDINCLUDEPATH);$(USDINCLUDEPATH)\\boost-1_70;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n    </ClCompile>\n    <Link>\n      <AdditionalDependencies>dbghelp.lib;Ws2_32.lib;usd_ms.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <AdditionalLibraryDirectories>$(USDLIBPATH);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalOptions>/WHOLEARCHIVE:\"$(USDLIBPATH)usd_ms\" %(AdditionalOptions)</AdditionalOptions>\n\t</Link>\n    <PostBuildEvent>\n      <Command>\n\t\t  xcopy \"$(USDBINPATH)tbb_debug.dll\" \"$(TargetDir)\" /I /Y /F /R\n\t\t  xcopy \"$(USDBINPATH)tbb_debug.pdb\" \"$(TargetDir)\" /I /Y /F /R\n\t\t  xcopy \"$(USDBINPATH)tbbmalloc_debug.dll\" \"$(TargetDir)\" /I /Y /F /R\n\t\t  xcopy \"$(USDBINPATH)tbbmalloc_debug.pdb\" \"$(TargetDir)\" /I /Y /F /R\n\t\t  xcopy \"$(USDLIBPATH)usd_ms.dll\" \"$(TargetDir)\" /I /Y /F /R\n\t\t  xcopy \"$(USDLIBPATH)usd_ms.pdb\" \"$(TargetDir)\" /I /Y /F /R\n\t\t  xcopy \"$(PXR_PLUGINPATH_NAME)\" \"$(TargetDir)\\usd\" /I /Y /F /R /S\n\n\t\t  %(Command)\n\t  </Command>\n    </PostBuildEvent>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\n    <ClCompile>\n      <PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(USDINCLUDEPATH);$(USDINCLUDEPATH)\\boost-1_70;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n    </ClCompile>\n    <Link>\n      <AdditionalDependencies>dbghelp.lib;Ws2_32.lib;usd_ms.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <AdditionalLibraryDirectories>$(USDLIBPATH);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalOptions>/WHOLEARCHIVE:\"$(USDLIBPATH)usd_ms\" %(AdditionalOptions)</AdditionalOptions>\n    </Link>\n    <PostBuildEvent>\n      <Command>\n\t\t  xcopy \"$(USDBINPATH)tbb.dll\" \"$(TargetDir)\" /I /Y /F /R\n\t\t  xcopy \"$(USDBINPATH)tbb.pdb\" \"$(TargetDir)\" /I /Y /F /R\n\t\t  xcopy \"$(USDBINPATH)tbbmalloc.dll\" \"$(TargetDir)\" /I /Y /F /R\n\t\t  xcopy \"$(USDBINPATH)tbbmalloc.pdb\" \"$(TargetDir)\" /I /Y /F /R\n\t\t  xcopy \"$(USDLIBPATH)usd_ms.dll\" \"$(TargetDir)\" /I /Y /F /R\n\t\t  xcopy \"$(USDLIBPATH)usd_ms.pdb\" \"$(TargetDir)\" /I /Y /F /R\n\t\t  xcopy \"$(PXR_PLUGINPATH_NAME)\" \"$(TargetDir)\\usd\" /I /Y /F /R /S\n\n\t\t  %(Command)\n\t  </Command>\n    </PostBuildEvent>\n  </ItemDefinitionGroup>\n</Project>\n\n"
  },
  {
    "path": "usd-shared.props",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n   Copyright 2021 Activision Publishing, Inc. \n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n-->\n\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <PropertyGroup>\n    <USDBUILD>shared</USDBUILD>\n  </PropertyGroup>\n\t\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <USDBINPATH>D:\\USD-21.02-debug\\bin\\</USDBINPATH>\n    <USDLIBPATH>D:\\USD-21.02-debug\\lib\\</USDLIBPATH>\n    <USDINCLUDEPATH>D:\\USD-21.02-debug\\include\\</USDINCLUDEPATH>\n\t<PXR_PLUGINPATH_NAME>D:\\USD-21.02-debug\\lib\\usd\\</PXR_PLUGINPATH_NAME>\n  </PropertyGroup>\t\n\t\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\n    <USDBINPATH>D:\\USD-21.02\\bin\\</USDBINPATH>\n    <USDLIBPATH>D:\\USD-21.02\\lib\\</USDLIBPATH>\n    <USDINCLUDEPATH>D:\\USD-21.02\\include\\</USDINCLUDEPATH>\n\t<PXR_PLUGINPATH_NAME>D:\\USD-21.02\\lib\\usd\\</PXR_PLUGINPATH_NAME>\n  </PropertyGroup>\t\n\n\t<ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <ClCompile>\n      <PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(USDINCLUDEPATH);$(USDINCLUDEPATH)\\boost-1_70;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n    </ClCompile>\n    <Link>\n      <AdditionalDependencies>dbghelp.lib;Ws2_32.lib;ar.lib;arch.lib;plug.lib;sdf.lib;tf.lib;usd.lib;usdUtils.lib;vt.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <AdditionalLibraryDirectories>$(USDLIBPATH);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalOptions>/WHOLEARCHIVE:\"$(USDLIBPATH)usd\" %(AdditionalOptions)</AdditionalOptions>\n\t</Link>\n    <PostBuildEvent>\n      <Command>\n        xcopy \"$(USDLIBPATH)ar.dll\" \"$(TargetDir)\" /I /Y /F /R\n        xcopy \"$(USDLIBPATH)ar.pdb\" \"$(TargetDir)\" /I /Y /F /R\n        xcopy \"$(USDLIBPATH)arch.dll\" \"$(TargetDir)\" /I /Y /F /R\n        xcopy \"$(USDLIBPATH)arch.pdb\" \"$(TargetDir)\" /I /Y /F /R\n        xcopy \"$(USDLIBPATH)plug.dll\" \"$(TargetDir)\" /I /Y /F /R\n        xcopy \"$(USDLIBPATH)plug.pdb\" \"$(TargetDir)\" /I /Y /F /R\n        xcopy \"$(USDLIBPATH)sdf.dll\" \"$(TargetDir)\" /I /Y /F /R\n        xcopy \"$(USDLIBPATH)sdf.pdb\" \"$(TargetDir)\" /I /Y /F /R\n        xcopy \"$(USDLIBPATH)tf.dll\" \"$(TargetDir)\" /I /Y /F /R\n        xcopy \"$(USDLIBPATH)tf.pdb\" \"$(TargetDir)\" /I /Y /F /R\n        xcopy \"$(USDLIBPATH)usd.dll\" \"$(TargetDir)\" /I /Y /F /R\n        xcopy \"$(USDLIBPATH)usd.pdb\" \"$(TargetDir)\" /I /Y /F /R\n        xcopy \"$(USDLIBPATH)usdUtils.dll\" \"$(TargetDir)\" /I /Y /F /R\n        xcopy \"$(USDLIBPATH)usdUtils.pdb\" \"$(TargetDir)\" /I /Y /F /R\n        xcopy \"$(USDLIBPATH)vt.dll\" \"$(TargetDir)\" /I /Y /F /R\n        xcopy \"$(USDLIBPATH)vt.pdb\" \"$(TargetDir)\" /I /Y /F /R\n        xcopy \"$(USDBINPATH)tbb.dll\" \"$(TargetDir)\" /I /Y /F /R\n        xcopy \"$(USDBINPATH)tbb.pdb\" \"$(TargetDir)\" /I /Y /F /R\n        xcopy \"$(PXR_PLUGINPATH_NAME)\" \"$(TargetDir)\\usd\" /I /Y /F /R /S\n\n        %(Command)\n\t  </Command>\n    </PostBuildEvent>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\n    <ClCompile>\n      <PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(USDINCLUDEPATH);$(USDINCLUDEPATH)\\boost-1_70;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n    </ClCompile>\n    <Link>\n      <AdditionalDependencies>dbghelp.lib;Ws2_32.lib;ar.lib;arch.lib;plug.lib;sdf.lib;tf.lib;usd.lib;usdUtils.lib;vt.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <AdditionalLibraryDirectories>$(USDLIBPATH);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalOptions>/WHOLEARCHIVE:\"$(USDLIBPATH)usd\" %(AdditionalOptions)</AdditionalOptions>\n    </Link>\n    <PostBuildEvent>\n      <Command>\n        xcopy \"$(USDLIBPATH)ar.dll\" \"$(TargetDir)\" /I /Y /F /R\n        xcopy \"$(USDLIBPATH)ar.pdb\" \"$(TargetDir)\" /I /Y /F /R\n        xcopy \"$(USDLIBPATH)arch.dll\" \"$(TargetDir)\" /I /Y /F /R\n        xcopy \"$(USDLIBPATH)arch.pdb\" \"$(TargetDir)\" /I /Y /F /R\n        xcopy \"$(USDLIBPATH)plug.dll\" \"$(TargetDir)\" /I /Y /F /R\n        xcopy \"$(USDLIBPATH)plug.pdb\" \"$(TargetDir)\" /I /Y /F /R\n        xcopy \"$(USDLIBPATH)sdf.dll\" \"$(TargetDir)\" /I /Y /F /R\n        xcopy \"$(USDLIBPATH)sdf.pdb\" \"$(TargetDir)\" /I /Y /F /R\n        xcopy \"$(USDLIBPATH)tf.dll\" \"$(TargetDir)\" /I /Y /F /R\n        xcopy \"$(USDLIBPATH)tf.pdb\" \"$(TargetDir)\" /I /Y /F /R\n        xcopy \"$(USDLIBPATH)usd.dll\" \"$(TargetDir)\" /I /Y /F /R\n        xcopy \"$(USDLIBPATH)usd.pdb\" \"$(TargetDir)\" /I /Y /F /R\n        xcopy \"$(USDLIBPATH)usdUtils.dll\" \"$(TargetDir)\" /I /Y /F /R\n        xcopy \"$(USDLIBPATH)usdUtils.pdb\" \"$(TargetDir)\" /I /Y /F /R\n        xcopy \"$(USDLIBPATH)vt.dll\" \"$(TargetDir)\" /I /Y /F /R\n        xcopy \"$(USDLIBPATH)vt.pdb\" \"$(TargetDir)\" /I /Y /F /R\n        xcopy \"$(USDBINPATH)tbb.dll\" \"$(TargetDir)\" /I /Y /F /R\n        xcopy \"$(USDBINPATH)tbb.pdb\" \"$(TargetDir)\" /I /Y /F /R\n        xcopy \"$(PXR_PLUGINPATH_NAME)\" \"$(TargetDir)\\usd\" /I /Y /F /R /S\n        \n        %(Command)\n\t  </Command>\n    </PostBuildEvent>\n  </ItemDefinitionGroup>\n</Project>\n\n"
  },
  {
    "path": "usd.props",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n   Copyright 2021 Activision Publishing, Inc. \n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n-->\n\n<!-- These paths should point to a static build of the USD sdk to avoid additional DLL dependencies -->\n\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <Import Project=\"$(SolutionDir)\\usd-monolithic.props\" />\n</Project>\n\n"
  }
]