Showing preview only (459K chars total). Download the full file or copy to clipboard to get everything.
Repository: Activision/USDShellExtension
Branch: main
Commit: b7655b9436f2
Files: 132
Total size: 424.5 KB
Directory structure:
gitextract_0s2b2fo_/
├── .gitignore
├── BUILDING.md
├── CONTRIBUTING.txt
├── LICENSE.txt
├── NOTICE.txt
├── README.md
├── UsdPreviewHandlerPython/
│ ├── Module.cpp
│ ├── Module.h
│ ├── StageViewWnd.cpp
│ ├── StageViewWnd.h
│ ├── UsdPreviewHandlerEvent.h
│ ├── UsdPreviewHandlerMgr.cpp
│ ├── UsdPreviewHandlerMgr.h
│ ├── UsdPreviewHandlerPython.rc
│ ├── UsdPreviewHandlerPython.vcxproj
│ ├── UsdPreviewHandlerPython.vcxproj.filters
│ ├── pyUsdPreviewHandler.cpp
│ ├── resource.h
│ ├── stdafx.cpp
│ └── stdafx.h
├── UsdPreviewHandlerServer/
│ ├── Module.cpp
│ ├── Module.h
│ ├── UsdPreviewHandlerImpl.cpp
│ ├── UsdPreviewHandlerImpl.h
│ ├── UsdPreviewHandlerImpl.rgs
│ ├── UsdPreviewHandlerPython.py
│ ├── UsdPreviewLocalServer.idl
│ ├── UsdPreviewLocalServer.rc
│ ├── UsdPreviewLocalServer.vcxproj
│ ├── UsdPreviewLocalServer.vcxproj.filters
│ ├── UsdPreviewLocalServerModule.rgs
│ ├── UsdPreviewThread.cpp
│ ├── UsdPreviewThread.h
│ ├── resource.h
│ ├── stdafx.cpp
│ └── stdafx.h
├── UsdPythonToolsServer/
│ ├── Module.cpp
│ ├── Module.h
│ ├── UsdPythonToolsImpl.cpp
│ ├── UsdPythonToolsImpl.h
│ ├── UsdPythonToolsImpl.rgs
│ ├── UsdPythonToolsLocalServer.idl
│ ├── UsdPythonToolsLocalServer.rc
│ ├── UsdPythonToolsLocalServer.vcxproj
│ ├── UsdPythonToolsLocalServer.vcxproj.filters
│ ├── UsdPythonToolsLocalServerModule.rgs
│ ├── UsdThumbnail.py
│ ├── resource.h
│ ├── stdafx.cpp
│ └── stdafx.h
├── UsdSdkToolsServer/
│ ├── Module.cpp
│ ├── Module.h
│ ├── UsdSdkToolsImpl.cpp
│ ├── UsdSdkToolsImpl.h
│ ├── UsdSdkToolsImpl.rgs
│ ├── UsdSdkToolsLocalServer.idl
│ ├── UsdSdkToolsLocalServer.rc
│ ├── UsdSdkToolsLocalServer.vcxproj
│ ├── UsdSdkToolsLocalServer.vcxproj.filters
│ ├── UsdSdkToolsLocalServerModule.rgs
│ ├── resource.h
│ ├── stdafx.cpp
│ └── stdafx.h
├── UsdShellExtension/
│ ├── ArResolverShellExtension.cpp
│ ├── ArResolverShellExtension.h
│ ├── Module.cpp
│ ├── Module.h
│ ├── ShellExecute.cpp
│ ├── ShellExt.def
│ ├── ShellExt.idl
│ ├── ShellExt.rc
│ ├── ShellExtModule.rgs
│ ├── ShellPreviewHandlerImpl.cpp
│ ├── ShellPreviewHandlerImpl.h
│ ├── ShellPreviewHandlerImpl.rgs
│ ├── ShellPropertyStoreImpl.cpp
│ ├── ShellPropertyStoreImpl.h
│ ├── ShellPropertyStoreImpl.rgs
│ ├── ShellThumbnailProviderImpl.cpp
│ ├── ShellThumbnailProviderImpl.h
│ ├── ShellThumbnailProviderImpl.rgs
│ ├── UWPProgressBar.cpp
│ ├── UWPProgressBar.h
│ ├── UsdLoadScreenDlg.cpp
│ ├── UsdLoadScreenDlg.h
│ ├── UsdMetadata.cpp
│ ├── UsdMetadata.h
│ ├── UsdPropertyKeys.h
│ ├── UsdPropertyKeys.propdesc
│ ├── UsdShellExtension-monolithic.manifest
│ ├── UsdShellExtension-shared.manifest
│ ├── UsdShellExtension.ini
│ ├── UsdShellExtension.vcxproj
│ ├── UsdShellExtension.vcxproj.filters
│ ├── plugInfo.json
│ ├── register.bat
│ ├── resource.h
│ ├── stdafx.cpp
│ ├── stdafx.h
│ └── unregister.bat
├── UsdShellExtension.sln
├── UsdShellExtensionInstaller/
│ ├── CmdLineArgs.nsh
│ ├── RestartManager.nsh
│ ├── ShellLinkSetRunAs.nsh
│ ├── UsdConfigPage.nsh
│ ├── UsdConfigUtils.nsh
│ ├── UsdPathPage.nsh
│ ├── UsdShellExtensionInstaller.nsi
│ ├── UsdShellExtensionInstaller.vcxproj
│ └── UsdShellExtensionInstaller.vcxproj.filters
├── atviversion.h
├── atviversion.props
├── atviversion.rc2
├── boost.props
├── docs/
│ ├── DEPLOYMENT.md
│ ├── DESIGN.md
│ ├── FEATURES.md
│ └── INSTALLING.md
├── nsis.props
├── python.props
├── shared/
│ ├── EventViewerLog.h
│ ├── EventViewerMessages.mc
│ ├── EventViewerMessages.vcxproj
│ ├── EventViewerMessages.vcxproj.filters
│ ├── PythonUtil.h
│ ├── emb.cpp
│ ├── emb.h
│ ├── environment.cpp
│ └── environment.h
├── usd-monolithic.props
├── usd-shared.props
└── usd.props
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
.vs/
bin/
build/
*.aps
*.user
*_h.h
*_i.c
*_p.c
dlldata.c
EventViewerMessages.h
EventViewerMessages.rc
MSG00409.bin
================================================
FILE: BUILDING.md
================================================
ACTIVISION USD SHELL EXTENSION
==============================
## Dependencies
* Boost
* Python (2.7, 3.6, 3.7)
* USD SDK
* Windows 10 SDK
* Visual Studio 2017+
* ATL
* Python C++ Tools
#### Boost
`boost.props`
Boost is required for Boost.Python. It is used to build a python extension module. The boost
compilation must match the version of MSVC and Python used by the shell extension.
#### Python
`python.props`
Currently only Python 2.7, 3.6, and 3.7 are supported. The USD SDK does not currently support Python 3.8+ on Windows.
#### USD SDK
`usd.props`
The shell extension requires a bare-bones monolithic build of the USD SDK. The monolithic build
is a single DLL which makes it easier to isolate it into its own activation context in Windows Explorer.
The shell extension is currently set up to build against a build of USD that does not use Python.
The shell extension is injected into Windows Explorer which is also the process that runs
the Windows Desktop. We want to keep as much out of that process as we can.
```
python.exe build_scripts\build_usd.py d:\USD-monolithic-bare --build-monolithic --no-tests --no-examples --no-tutorials --no-tools --no-docs --no-python --no-imaging --no-ptex --no-openvdb --no-usdview --no-embree --no-prman --no-openimageio --no-opencolorio --no-alembic --no-hdf5 --no-draco --no-materialx
```
#### Windows 10 SDK
Windows 10 SDK 10.0.14393.0 or higher is required to build the shell extension. This requirement is only
due to High DPI support. It would be possible to remove High DPI support and compile the shell extension
for Windows 7.
#### Visual Studio
Visual Studio is the only supported build tool at this time.
The following Visual Studio components are required:
- C++ ATL
- Python Language Support
## Simple Build
The simplest way to build the shell extension is to build two flavors of the USD SDK. The first being a
bare-bones version of the SDK that is used by Windows Explorer. The second is a full version used by
everything else.
Bare-Bones USD SDK
```
python.exe build_scripts\build_usd.py d:\USD-monolithic-bare --build-monolithic --no-tests --no-examples --no-tutorials --no-tools --no-docs --no-python --no-imaging --no-ptex --no-openvdb --no-usdview --no-embree --no-prman --no-openimageio --no-opencolorio --no-alembic --no-hdf5 --no-draco --no-materialx
```
Full USD SDK
```
python.exe build_scripts\build_usd.py d:\USD-shared-full [--embree] [--materialx]
```
Then update the property sheets to point to these builds.
`usd.props`
Point this property sheet to the bare-bones USD SDK.
`boost.props`
Point this property sheet to the full USD SDK's version of boost.
`UsdShellExtension.ini`
Point the paths in this configuration file to the full USD SDK.
```
[USD]
PATH=D:\USD-shared-full\bin\;D:\USD-shared-full\lib\
PYTHONPATH=D:\USD-shared-full\lib\python
PXR_PLUGINPATH_NAME=
```
================================================
FILE: CONTRIBUTING.txt
================================================
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:
Activision-Corporate-CLA-USD-Shell-Extension.pdf: for corporate contributors
Activision-Individual-CLA-USD-Shell-Extension.pdf: for individual contributors
Please send your signed CLAs to LegalAffairs@activision.com, making sure to include your github username in the email. Please wait for our confirmation that you're approved for contributions, after which you can submit pull requests.
================================================
FILE: LICENSE.txt
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
============================================================
emb.cpp, emb.h
============================================================
Copyright (C) 2011 Mateusz Loskot <mateusz@loskot.net>
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Blog article: http://mateusz.loskot.net/?p=2819
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
============================================================
Universal Scene Description
============================================================
Universal Scene Description
Copyright 2016 Pixar
All rights reserved.
This product includes software developed at:
Pixar (http://www.pixar.com/).
Modified Apache 2.0 License
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor
and its affiliates, except as required to comply with Section 4(c) of
the License and to reproduce the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
================================================
FILE: NOTICE.txt
================================================
Activision USD Shell Extension
Copyright 2021 Activision Publishing, Inc.
All rights reserved.
This product includes software developed at Activision Publishing, Inc.
================================================
FILE: README.md
================================================
Activision USD Shell Extension
==============================
A Windows Shell Extension for the Pixar USD file format.
**Windows Explorer Features**
* Hydra Realtime Preview
* Thumbnails
* Context Menus
* Metadata Properties
**Windows Search Features**
* Metadata Search
More details available [here](./docs/FEATURES.md).
Goals
-----
There are several goals that this shell extension tries to adhere to and takes extra precautions to meet.
* **Performance**
It is important that the shell extension not stall Windows Explorer.
* **Stability**
Instability in the shell extension will take down Window Explorer and/or the entire desktop.
The mitigation strategy is to run the majority of the shell extension asynchronously out of the
Windows Explorer process.
Dependencies
------------
The following dependencies are required:
* [Microsoft Visual Studio (2017 or newer)](https://visualstudio.microsoft.com/vs/)
* [Universal Scene Description (USD)](https://graphics.pixar.com/usd/docs/index.html)
* [Python (2.7, 3.6, 3.7)](https://www.python.org/)
Required Microsoft Visual Studio Components:
* Desktop development with C++
* C++ ATL
* Windows 10 SDK
* Windows Universal C Runtime
* Python language support
================================================
FILE: UsdPreviewHandlerPython/Module.cpp
================================================
// Copyright 2021 Activision Publishing, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "stdafx.h"
#include "Module.h"
HMODULE g_hInstance;
BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved )
{
UNREFERENCED_PARAMETER( lpReserved );
switch ( ul_reason_for_call )
{
case DLL_PROCESS_ATTACH:
g_hInstance = hModule;
break;
}
return TRUE;
}
================================================
FILE: UsdPreviewHandlerPython/Module.h
================================================
// Copyright 2021 Activision Publishing, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
extern HMODULE g_hInstance;
================================================
FILE: UsdPreviewHandlerPython/StageViewWnd.cpp
================================================
// Copyright 2021 Activision Publishing, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "stdafx.h"
#include "StageViewWnd.h"
#include "Module.h"
#include "resource.h"
void CStageViewWnd::Init( HWND hWndToSubclass )
{
if ( m_hWnd )
Term();
SubclassWindow( hWndToSubclass );
}
void CStageViewWnd::Term()
{
UnsubclassWindow();
}
================================================
FILE: UsdPreviewHandlerPython/StageViewWnd.h
================================================
// Copyright 2021 Activision Publishing, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include "resource.h"
class CStageViewWnd : public CWindowImpl<CStageViewWnd>
{
public:
void Init( HWND hWndToSubclass );
void Term();
private:
BEGIN_MSG_MAP(CStageViewWnd)
END_MSG_MAP()
};
================================================
FILE: UsdPreviewHandlerPython/UsdPreviewHandlerEvent.h
================================================
// Copyright 2021 Activision Publishing, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
enum eUsdPreviewEvent
{
USDPREVIEWEVENT_INVALID,
USDPREVIEWEVENT_QUIT,
USDPREVIEWEVENT_RESIZE,
USDPREVIEWEVENT_RESIZERECT,
USDPREVIEWEVENT_SETWINDOW,
};
struct UsdPreviewEventData
{
eUsdPreviewEvent event;
intptr_t data1;
intptr_t data2;
};
typedef void (*FNUSDPREVIEWPUSHEVENT)(eUsdPreviewEvent event, intptr_t data1, intptr_t data2);
typedef HWND (*FNUSDPREVIEWGETPREVIEWWINDOW)();
================================================
FILE: UsdPreviewHandlerPython/UsdPreviewHandlerMgr.cpp
================================================
// Copyright 2021 Activision Publishing, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "stdafx.h"
#include "UsdPreviewHandlerMgr.h"
#include "UsdPreviewHandlerEvent.h"
CUsdPreviewHandlerMgr CUsdPreviewHandlerMgr::s_Singleton;
UsdPreviewEventData CUsdPreviewHandlerMgr::PeekEvent()
{
UsdPreviewEventData eventData = {};
std::lock_guard<std::mutex> guard(m_EventQueueMutex);
if (m_EventQueue.empty())
return eventData;
eventData = m_EventQueue.front();
m_EventQueue.pop();
return eventData;
}
void CUsdPreviewHandlerMgr::LoadComplete()
{
m_bLoadComplete = true;
if( m_bQuit == false )
SetParent( m_hWndParent, m_hWndChild, m_hWndStageView );
}
void CUsdPreviewHandlerMgr::PostEvent(eUsdPreviewEvent event, intptr_t data1, intptr_t data2)
{
switch (event)
{
case USDPREVIEWEVENT_RESIZE:
OnResize(static_cast<int>(data1), static_cast<int>(data2));
return;
case USDPREVIEWEVENT_RESIZERECT:
OnResizeRect(*reinterpret_cast<RECT*>(data1));
return;
case USDPREVIEWEVENT_SETWINDOW:
OnResizeRect(*reinterpret_cast<RECT*>(data2));
break;
case USDPREVIEWEVENT_QUIT:
OnQuit();
break;
}
UsdPreviewEventData eventData = {};
eventData.event = event;
eventData.data1 = data1;
eventData.data2 = data2;
std::lock_guard<std::mutex> guard(m_EventQueueMutex);
m_EventQueue.push(std::move(eventData));
}
void CUsdPreviewHandlerMgr::SetParent(HWND hWndParent, HWND hWndChild, HWND hWndStageView)
{
if ( m_bLoadComplete )
{
// The parent passed in here is actually the load screen dialog.
// We want to swap the load screen dialog here with our dialog.
HWND hWndLoadScreen = hWndParent;
RECT rcClient;
::GetClientRect( hWndLoadScreen, &rcClient );
HWND hWndPreviewParent = ::GetParent( hWndLoadScreen );
::SetParent( hWndChild, hWndPreviewParent );
::SetWindowLong( hWndChild, GWL_STYLE, WS_POPUP|WS_CLIPCHILDREN );
::SetWindowPos( hWndChild, HWND_TOP, 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top, SWP_FRAMECHANGED );
::ShowWindow( hWndChild, SW_SHOW );
::ShowWindow( hWndLoadScreen, SW_HIDE );
m_StageViewWnd.Init( hWndStageView );
}
m_hWndParent = hWndParent;
m_hWndChild = hWndChild;
m_hWndStageView = hWndStageView;
}
void CUsdPreviewHandlerMgr::OnResize(int cx, int cy)
{
if (m_bLoadComplete && m_hWndChild != nullptr)
::SetWindowPos(m_hWndChild, nullptr, 0, 0, cx, cy, 0);
}
void CUsdPreviewHandlerMgr::OnResizeRect(const RECT& rc)
{
if (m_bLoadComplete && m_hWndChild != nullptr)
::SetWindowPos(m_hWndChild, nullptr, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, 0);
}
void CUsdPreviewHandlerMgr::OnQuit()
{
m_bQuit = true;
// clear out our data
m_hWndChild = nullptr;
m_hWndParent = nullptr;
m_hWndStageView = nullptr;
}
HWND CUsdPreviewHandlerMgr::GetPreviewWindow() const
{
return m_hWndChild;
}
bool CUsdPreviewHandlerMgr::IsValid() const
{
return m_hWndChild != nullptr;
}
// pushes an event to Python
extern "C" __declspec(dllexport)
void UsdPreviewPushEvent(eUsdPreviewEvent event, intptr_t data1, intptr_t data2)
{
CUsdPreviewHandlerMgr::GetSingleton().PostEvent(event, data1, data2);
}
// pushes an event to Python
extern "C" __declspec(dllexport)
HWND UsdPreviewGetPreviewWindow()
{
return CUsdPreviewHandlerMgr::GetSingleton().GetPreviewWindow();
}
================================================
FILE: UsdPreviewHandlerPython/UsdPreviewHandlerMgr.h
================================================
// Copyright 2021 Activision Publishing, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include "UsdPreviewHandlerMgr.h"
#include "UsdPreviewHandlerEvent.h"
#include "StageViewWnd.h"
#include <queue>
#include <mutex>
class CUsdPreviewHandlerMgr
{
public:
static CUsdPreviewHandlerMgr& GetSingleton();
UsdPreviewEventData PeekEvent();
void PostEvent(eUsdPreviewEvent event, intptr_t data1, intptr_t data2);
void SetParent(HWND hWndParent, HWND hWndChild, HWND hWndStageView);
HWND GetPreviewWindow() const;
void LoadComplete();
bool IsValid() const;
private:
void OnResize(int cx, int cy);
void OnResizeRect(const RECT& rc);
void OnQuit();
static CUsdPreviewHandlerMgr s_Singleton;
std::queue<UsdPreviewEventData> m_EventQueue;
std::mutex m_EventQueueMutex;
HWND m_hWndParent = nullptr;
HWND m_hWndChild = nullptr;
HWND m_hWndStageView = nullptr;
bool m_bLoadComplete = false;
bool m_bQuit = false;
CStageViewWnd m_StageViewWnd;
};
inline CUsdPreviewHandlerMgr& CUsdPreviewHandlerMgr::GetSingleton()
{
return s_Singleton;
}
================================================
FILE: UsdPreviewHandlerPython/UsdPreviewHandlerPython.rc
================================================
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"#define ATVI_VERSION_DESCRIPTION ""Activision USD Preview Python Module""\r\n"
"#include ""atviversion.rc2""\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define ATVI_VERSION_DESCRIPTION "Activision USD Preview Python Module"
#include "atviversion.rc2"
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
================================================
FILE: UsdPreviewHandlerPython/UsdPreviewHandlerPython.vcxproj
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{248f687e-4028-4243-87b8-2312f57be8a5}</ProjectGuid>
<RootNamespace>UsdPreviewHandlerPython</RootNamespace>
<ProjectName>UsdPreviewHandlerPython</ProjectName>
<WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>false</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<Import Project="$(SolutionDir)\atviversion.props" />
<Import Project="$(SolutionDir)\python.props" />
<Import Project="$(SolutionDir)\boost.props" />
<PropertyGroup Label="PythonConfiguration">
<RegistryView>RegistryView.Registry32</RegistryView>
<RegistryView Condition="$(Platform) == 'x64'">RegistryView.Registry64</RegistryView>
<PythonTag>$(PythonVersion)-32</PythonTag>
<PythonTag Condition="$(Platform) == 'x64'">$(PythonVersion)</PythonTag>
<PythonHome Condition="$(PythonHome) == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\$(PythonTag)\InstallPath', null, null, $(RegistryView)))</PythonHome>
<PythonHome Condition="$(PythonHome) == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\$(PythonTag)\InstallPath', null, null, $(RegistryView)))</PythonHome>
<PythonExe Condition="$(PythonExe) == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\$(PythonTag)\InstallPath', 'ExecutablePath', null, $(RegistryView)))</PythonExe>
<PythonExe Condition="$(PythonExe) == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\$(PythonTag)\InstallPath', 'ExecutablePath', null, $(RegistryView)))</PythonExe>
<PythonExe Condition="$(PythonExe) == '' and $(PythonHome) != ''">$(PythonHome)python.exe</PythonExe>
<PythonDevVersion>$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\$(PythonTag)\InstalledFeatures', 'dev', null, $(RegistryView)))</PythonDevVersion>
<PythonDevVersion Condition="$(PythonDevVersion) == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\$(PythonTag)\InstalledFeatures', 'dev', null, $(RegistryView)))</PythonDevVersion>
<PythonCorePDBVersion>$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\$(PythonTag)\InstalledFeatures', 'core_pdb', null, $(RegistryView)))</PythonCorePDBVersion>
<PythonCorePDBVersion Condition="$(PythonCorePDBVersion) == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\$(PythonTag)\InstalledFeatures', 'core_pdb', null, $(RegistryView)))</PythonCorePDBVersion>
<PythonCoreDVersion>$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\$(PythonTag)\InstalledFeatures', 'core_d', null, $(RegistryView)))</PythonCoreDVersion>
<PythonCoreDVersion Condition="$(PythonCoreDVersion) == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\$(PythonTag)\InstalledFeatures', 'core_d', null, $(RegistryView)))</PythonCoreDVersion>
<PythonDebugSuffix Condition="$(PythonCoreDVersion) != ''">_d</PythonDebugSuffix>
<PythonDExe Condition="$(PythonExe) != '' and $(PythonDExe) == ''">$([System.IO.Path]::GetDirectoryName($(PythonExe)))\python$(PythonDebugSuffix).exe</PythonDExe>
<PythonDExe Condition="!Exists($(PythonDExe))">$(PythonExe)</PythonDExe>
</PropertyGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)bin\$(PlatformToolset)\$(PythonTag)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)build\$(PlatformToolset)\$(PythonTag)\$(Configuration)\$(ProjectName)\</IntDir>
<TargetExt>.pyd</TargetExt>
<TargetName>UsdPreviewHandler</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)bin\$(PlatformToolset)\$(PythonTag)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)build\$(PlatformToolset)\$(PythonTag)\$(Configuration)\$(ProjectName)\</IntDir>
<TargetExt>.pyd</TargetExt>
<TargetName>UsdPreviewHandler</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;USDPREVIEW_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>false</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>$(PythonHome)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<AdditionalLibraryDirectories>$(PythonHome)libs;C:\usd-20.08\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>UxTheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent />
<ResourceCompile>
<AdditionalIncludeDirectories>$(OutDir);$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;USDPREVIEW_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>false</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>$(PythonHome)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>false</EnableCOMDATFolding>
<OptimizeReferences>false</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<AdditionalLibraryDirectories>$(PythonHome)libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>UxTheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent />
<ResourceCompile>
<AdditionalIncludeDirectories>$(OutDir);$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="Module.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="StageViewWnd.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="UsdPreviewHandlerEvent.h" />
<ClInclude Include="UsdPreviewHandlerMgr.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="Module.cpp" />
<ClCompile Include="StageViewWnd.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="pyUsdPreviewHandler.cpp" />
<ClCompile Include="UsdPreviewHandlerMgr.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="UsdPreviewHandlerPython.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
================================================
FILE: UsdPreviewHandlerPython/UsdPreviewHandlerPython.vcxproj.filters
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="UsdPreviewHandlerEvent.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="UsdPreviewHandlerMgr.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="StageViewWnd.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Module.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="pyUsdPreviewHandler.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="UsdPreviewHandlerMgr.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="StageViewWnd.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Module.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="UsdPreviewHandlerPython.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project>
================================================
FILE: UsdPreviewHandlerPython/pyUsdPreviewHandler.cpp
================================================
// Copyright 2021 Activision Publishing, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "stdafx.h"
#include "UsdPreviewHandlerEvent.h"
#include "UsdPreviewHandlerMgr.h"
using namespace boost::python;
struct UsdPreviewApp
{
void SetParent( uint64_t nWndParent, uint64_t nWndChild, uint64_t nWndStageView );
UsdPreviewEventData PeekEvent();
void LoadComplete();
};
BOOST_PYTHON_MODULE( UsdPreviewHandler )
{
using namespace boost::python;
enum_<eUsdPreviewEvent>( "UsdPreviewEvent" )
.value( "NoMoreEvents", USDPREVIEWEVENT_INVALID)
.value( "Quit", USDPREVIEWEVENT_QUIT)
;
class_<UsdPreviewEventData>( "UsdPreviewEventData", "help", no_init )
.def_readonly("event", &UsdPreviewEventData::event)
.def_readonly("data1", &UsdPreviewEventData::data1)
.def_readonly("data2", &UsdPreviewEventData::data2)
;
class_<UsdPreviewApp>( "UsdPreviewApp", "help", init<>() )
.def( "SetParent", &UsdPreviewApp::SetParent )
.def( "PeekEvent", &UsdPreviewApp::PeekEvent )
.def( "LoadComplete", &UsdPreviewApp::LoadComplete )
;
}
void UsdPreviewApp::SetParent( uint64_t nWndParent, uint64_t nWndChild, uint64_t nWndStageView )
{
HWND hWndParent = reinterpret_cast<HWND>(nWndParent);
HWND hWndChild = reinterpret_cast<HWND>(nWndChild);
HWND hWndStageView = reinterpret_cast<HWND>(nWndStageView);
CUsdPreviewHandlerMgr::GetSingleton().SetParent(hWndParent, hWndChild, hWndStageView);
}
UsdPreviewEventData UsdPreviewApp::PeekEvent()
{
return CUsdPreviewHandlerMgr::GetSingleton().PeekEvent();
}
void UsdPreviewApp::LoadComplete()
{
CUsdPreviewHandlerMgr::GetSingleton().LoadComplete();
}
================================================
FILE: UsdPreviewHandlerPython/resource.h
================================================
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by UsdPreviewHandlerPython.rc
//
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 103
#define _APS_NEXT_COMMAND_VALUE 40012
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
================================================
FILE: UsdPreviewHandlerPython/stdafx.cpp
================================================
// Copyright 2021 Activision Publishing, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "stdafx.h"
================================================
FILE: UsdPreviewHandlerPython/stdafx.h
================================================
// Copyright 2021 Activision Publishing, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#pragma warning(push)
#pragma warning(disable: 4244 4459)
#include <boost/python/module.hpp>
#include <boost/python/def.hpp>
#include <boost/python/list.hpp>
#include <boost/python.hpp>
#pragma warning(pop)
#include <iostream>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <tchar.h>
#include <Uxtheme.h>
#include <atlbase.h>
#include <atlcom.h>
#include <atlconv.h>
#include <atlstr.h>
#include <atlwin.h>
================================================
FILE: UsdPreviewHandlerServer/Module.cpp
================================================
// Copyright 2021 Activision Publishing, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "stdafx.h"
#include "Module.h"
HMODULE g_hInstance;
CUSDPreviewLocalServerModule g_AtlModule;
extern "C" int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nShowCmd)
{
UNREFERENCED_PARAMETER( hPrevInstance );
UNREFERENCED_PARAMETER( lpCmdLine );
UNREFERENCED_PARAMETER( nShowCmd );
g_hInstance = hInstance;
int nResult = g_AtlModule.WinMain( nShowCmd );
return nResult;
}
================================================
FILE: UsdPreviewHandlerServer/Module.h
================================================
// Copyright 2021 Activision Publishing, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include "USDPreviewLocalServer_h.h"
#include "resource.h"
// Using an ATL module here because it removes a lot of the
// boiler-plate COM work that we would have to implement ourselves.
class CUSDPreviewLocalServerModule : public CAtlExeModuleT<CUSDPreviewLocalServerModule>
{
public:
DECLARE_LIBID( LIBID_USDPreview )
DECLARE_REGISTRY_APPID_RESOURCEID( IDR_REGISTRY_MODULE, "{067AAB34-285D-40D1-92EF-A5ED449EFEEE}" )
// Override CAtlExeModuleT::PreMessageLoop to change REGCLS_MULTIPLEUSE to REGCLS_SINGLEUSE.
// REGCLS_SINGLEUSE will create a new Windows process for every instance of our COM classes,
// REGCLS_MULTIPLEUSE will reuse the same Windows process.
HRESULT PreMessageLoop( _In_ int /*nShowCmd*/ ) throw()
{
HRESULT hr = S_OK;
CUSDPreviewLocalServerModule* pT = static_cast<CUSDPreviewLocalServerModule*>(this);
#ifndef _ATL_NO_COM_SUPPORT
hr = pT->RegisterClassObjects(CLSCTX_LOCAL_SERVER,
REGCLS_SINGLEUSE | // <- !!!
REGCLS_SUSPENDED);
if (FAILED(hr))
return hr;
if (hr == S_OK)
{
if (m_bDelayShutdown)
{
CHandle h(pT->StartMonitor());
if (h.m_h == NULL)
{
hr = E_FAIL;
}
else
{
hr = CoResumeClassObjects();
ATLASSERT(SUCCEEDED(hr));
if (FAILED(hr))
{
::SetEvent(m_hEventShutdown); // tell monitor to shutdown
::WaitForSingleObject(h, m_dwTimeOut * 2);
}
}
}
else
{
hr = CoResumeClassObjects();
ATLASSERT(SUCCEEDED(hr));
}
if (FAILED(hr))
pT->RevokeClassObjects();
}
else
{
m_bDelayShutdown = false;
}
#endif // _ATL_NO_COM_SUPPORT
ATLASSERT(SUCCEEDED(hr));
return hr;
}
};
extern CUSDPreviewLocalServerModule g_AtlModule;
extern HMODULE g_hInstance;
================================================
FILE: UsdPreviewHandlerServer/UsdPreviewHandlerImpl.cpp
================================================
// Copyright 2021 Activision Publishing, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "stdafx.h"
#include "USDPreviewHandlerImpl.h"
#include "Module.h"
#include "shared\PythonUtil.h"
#include "shared\emb.h"
#include "shared\environment.h"
#include "shared\EventViewerLog.h"
HRESULT CUsdPreviewHandlerImpl::FinalConstruct()
{
SetupPythonEnvironment( g_hInstance );
m_hUsdPreviewLib = LoadLibraryEx(_T("UsdPreviewHandler.pyd"), nullptr, LOAD_LIBRARY_SEARCH_APPLICATION_DIR|LOAD_LIBRARY_SEARCH_SYSTEM32);
if (m_hUsdPreviewLib == nullptr)
return E_FAIL;
m_fnUsdPreviewPushEvent = reinterpret_cast<FNUSDPREVIEWPUSHEVENT>(GetProcAddress(m_hUsdPreviewLib, "UsdPreviewPushEvent"));
if (m_fnUsdPreviewPushEvent == nullptr)
return E_FAIL;
m_fnUsdGetPreviewWindow = reinterpret_cast<FNUSDPREVIEWGETPREVIEWWINDOW>(GetProcAddress(m_hUsdPreviewLib, "UsdPreviewGetPreviewWindow"));
if (m_fnUsdGetPreviewWindow == nullptr)
return E_FAIL;
if ( !m_PreviewThread.Init() )
return E_FAIL;
m_clrBackground = ::GetSysColor( COLOR_WINDOW );
m_clrText = ::GetSysColor( COLOR_WINDOWTEXT );
return __super::FinalConstruct();
}
void CUsdPreviewHandlerImpl::FinalRelease()
{
m_PreviewThread.Term();
if (m_hUsdPreviewLib)
{
FreeLibrary(m_hUsdPreviewLib);
m_hUsdPreviewLib = nullptr;
m_fnUsdPreviewPushEvent = nullptr;
m_fnUsdGetPreviewWindow = nullptr;
}
__super::FinalRelease();
}
// IInitializeWithFile
STDMETHODIMP CUsdPreviewHandlerImpl::Initialize(__RPC__in_string LPCWSTR pszFilePath, DWORD grfMode)
{
UNREFERENCED_PARAMETER(grfMode);
m_usdStagePath = pszFilePath;
return S_OK;
}
// IObjectWithSite
STDMETHODIMP CUsdPreviewHandlerImpl::SetSite(__RPC__in_opt IUnknown* pUnkSite)
{
m_pSite = nullptr;
m_pPreviewHandlerFrame = nullptr;
m_PreviewHandlerFrameInfo.Term();
if (pUnkSite != nullptr)
{
m_pSite = pUnkSite;
CComQIPtr<IPreviewHandlerFrame> pIPreviewHandlerFrame(m_pSite);
m_pPreviewHandlerFrame = pIPreviewHandlerFrame;
if ( m_pPreviewHandlerFrame )
m_pPreviewHandlerFrame->GetWindowContext( &m_PreviewHandlerFrameInfo );
}
return S_OK;
}
STDMETHODIMP CUsdPreviewHandlerImpl::GetSite(__RPC__in REFIID riid, __RPC__deref_out_opt void** ppvSite)
{
if (ppvSite == nullptr)
return E_POINTER;
if (m_pSite == nullptr)
{
*ppvSite = nullptr;
return E_FAIL;
}
HRESULT hr;
hr = m_pSite->QueryInterface(riid, ppvSite);
return hr;
}
// IOleWindow
STDMETHODIMP CUsdPreviewHandlerImpl::GetWindow(__RPC__deref_out_opt HWND* phwnd)
{
if (phwnd == nullptr)
return E_POINTER;
*phwnd = m_fnUsdGetPreviewWindow();
if ( *phwnd == nullptr )
return E_FAIL;
return S_OK;
}
STDMETHODIMP CUsdPreviewHandlerImpl::ContextSensitiveHelp(BOOL fEnterMode)
{
UNREFERENCED_PARAMETER(fEnterMode);
return E_NOTIMPL;
}
// IPreviewHandler
STDMETHODIMP CUsdPreviewHandlerImpl::SetWindow(__RPC__in HWND hwnd, __RPC__in const RECT* prc)
{
if (prc == nullptr)
return E_POINTER;
m_hWndParent = hwnd;
m_rcWindow = *prc;
PushEvent( USDPREVIEWEVENT_SETWINDOW, reinterpret_cast<intptr_t>(m_hWndParent), reinterpret_cast<intptr_t>(&m_rcWindow) );
return S_OK;
}
STDMETHODIMP CUsdPreviewHandlerImpl::SetRect(__RPC__in const RECT* prc)
{
if (prc == nullptr)
return E_POINTER;
m_rcWindow = *prc;
PushEvent( USDPREVIEWEVENT_RESIZERECT, reinterpret_cast<intptr_t>(&m_rcWindow) );
return S_OK;
}
STDMETHODIMP CUsdPreviewHandlerImpl::DoPreview()
{
HRESULT hr;
hr = m_PreviewThread.LaunchPreviewWindow( reinterpret_cast<HWND>(m_hWndParent), m_usdStagePath );
if (FAILED(hr))
return hr;
return S_OK;
}
STDMETHODIMP CUsdPreviewHandlerImpl::Unload()
{
// push the shutdown event to Python
PushEvent( USDPREVIEWEVENT_QUIT );
m_usdStagePath.Empty();
m_pSite = nullptr;
m_pPreviewHandlerFrame = nullptr;
m_PreviewHandlerFrameInfo.Term();
m_hWndParent = nullptr;
m_rcWindow = {};
return S_OK;
}
STDMETHODIMP CUsdPreviewHandlerImpl::SetFocus()
{
return S_OK;
}
STDMETHODIMP CUsdPreviewHandlerImpl::QueryFocus(__RPC__deref_out_opt HWND* phwnd)
{
if ( phwnd == nullptr )
return E_POINTER;
*phwnd = nullptr;
return S_OK;
}
STDMETHODIMP CUsdPreviewHandlerImpl::TranslateAccelerator(__RPC__in MSG* pmsg)
{
if (pmsg == nullptr)
return E_POINTER;
if ( m_pPreviewHandlerFrame && IsAccelerator( m_PreviewHandlerFrameInfo.haccel, m_PreviewHandlerFrameInfo.cAccelEntries, pmsg, nullptr ) )
{
return m_pPreviewHandlerFrame->TranslateAccelerator(pmsg);
}
return S_FALSE;
}
STDMETHODIMP CUsdPreviewHandlerImpl::SetBackgroundColor( COLORREF color )
{
m_clrBackground = color;
return S_OK;
}
STDMETHODIMP CUsdPreviewHandlerImpl::SetFont( __RPC__in const LOGFONTW *plf )
{
UNREFERENCED_PARAMETER( plf );
return S_OK;
}
STDMETHODIMP CUsdPreviewHandlerImpl::SetTextColor( COLORREF color )
{
m_clrText = color;
return S_OK;
}
bool CUsdPreviewHandlerImpl::PushEvent(eUsdPreviewEvent event, intptr_t data1, intptr_t data2)
{
// push the event to Python
if (m_fnUsdPreviewPushEvent == nullptr)
return false;
m_fnUsdPreviewPushEvent(event, data1, data2);
return true;
}
HRESULT WINAPI CUsdPreviewHandlerImpl::UpdateRegistry(_In_ BOOL bRegister) throw()
{
ATL::_ATL_REGMAP_ENTRY regMapEntries[] =
{
{ L"APPID", L"{067AAB34-285D-40D1-92EF-A5ED449EFEEE}" },
{ L"TYPELIB", L"{68DF0FAC-996B-4933-B092-9733E77061BB}" },
{ L"CLSID_USDPREVIEWHANDLER", L"{07D4D38F-9C98-48F8-A057-26241405D5C8}" },
{ nullptr, nullptr }
};
return g_AtlModule.UpdateRegistryFromResource(IDR_REGISTRY_USDPREVIEWHANDLERIMPL, bRegister, regMapEntries);
}
================================================
FILE: UsdPreviewHandlerServer/UsdPreviewHandlerImpl.h
================================================
// Copyright 2021 Activision Publishing, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include "USDPreviewLocalServer_h.h"
#include "USDPreviewThread.h"
#include "UsdPreviewHandlerPython\UsdPreviewHandlerEvent.h"
#include "resource.h"
class CPreviewHandlerFrameInfo : public PREVIEWHANDLERFRAMEINFO
{
public:
CPreviewHandlerFrameInfo()
{
haccel = nullptr;
cAccelEntries = 0;
}
~CPreviewHandlerFrameInfo()
{
Term();
}
void Term()
{
if ( haccel )
{
DestroyAcceleratorTable( haccel );
haccel = nullptr;
}
}
};
class ATL_NO_VTABLE CUsdPreviewHandlerImpl :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CUsdPreviewHandlerImpl, &CLSID_USDPreviewHandler>,
public IInitializeWithFile,
public IObjectWithSite,
public IOleWindow,
public IPreviewHandler,
public IPreviewHandlerVisuals
{
public:
DECLARE_NOT_AGGREGATABLE(CUsdPreviewHandlerImpl)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(CUsdPreviewHandlerImpl)
COM_INTERFACE_ENTRY(IInitializeWithFile)
COM_INTERFACE_ENTRY(IObjectWithSite)
COM_INTERFACE_ENTRY(IOleWindow)
COM_INTERFACE_ENTRY(IPreviewHandler)
COM_INTERFACE_ENTRY(IPreviewHandlerVisuals)
END_COM_MAP()
HRESULT FinalConstruct();
void FinalRelease();
// IInitializeWithFile
STDMETHODIMP Initialize( __RPC__in_string LPCWSTR pszFilePath, DWORD grfMode ) override;
// IObjectWithSite
STDMETHODIMP SetSite(__RPC__in_opt IUnknown* pUnkSite) override;
STDMETHODIMP GetSite(__RPC__in REFIID riid, __RPC__deref_out_opt void** ppvSite) override;
// IOleWindow
STDMETHODIMP GetWindow(__RPC__deref_out_opt HWND* phwnd) override;
STDMETHODIMP ContextSensitiveHelp(BOOL fEnterMode) override;
// IPreviewHandler
STDMETHODIMP SetWindow( __RPC__in HWND hwnd, __RPC__in const RECT* prc) override;
STDMETHODIMP SetRect( __RPC__in const RECT* prc ) override;
STDMETHODIMP DoPreview() override;
STDMETHODIMP Unload() override;
STDMETHODIMP SetFocus() override;
STDMETHODIMP QueryFocus( __RPC__deref_out_opt HWND* phwnd) override;
STDMETHODIMP TranslateAccelerator(__RPC__in MSG* pmsg) override;
// IPreviewHandlerVisuals
STDMETHODIMP SetBackgroundColor(COLORREF color) override;
STDMETHODIMP SetFont(__RPC__in const LOGFONTW *plf) override;
STDMETHODIMP SetTextColor(COLORREF color) override;
static HRESULT WINAPI UpdateRegistry(_In_ BOOL bRegister) throw();
private:
bool PushEvent(eUsdPreviewEvent event, intptr_t data1 = 0, intptr_t data2 = 0);
HMODULE m_hUsdPreviewLib = nullptr;
FNUSDPREVIEWPUSHEVENT m_fnUsdPreviewPushEvent = nullptr;
FNUSDPREVIEWGETPREVIEWWINDOW m_fnUsdGetPreviewWindow = nullptr;
CUSDPreviewThread m_PreviewThread;
CStringW m_usdStagePath;
CComPtr<IUnknown> m_pSite;
CComPtr<IPreviewHandlerFrame> m_pPreviewHandlerFrame;
HWND m_hWndParent = nullptr;
RECT m_rcWindow = {};
CPreviewHandlerFrameInfo m_PreviewHandlerFrameInfo;
COLORREF m_clrBackground;
COLORREF m_clrText;
};
OBJECT_ENTRY_AUTO(__uuidof(USDPreviewHandler), CUsdPreviewHandlerImpl)
================================================
FILE: UsdPreviewHandlerServer/UsdPreviewHandlerImpl.rgs
================================================
HKCR
{
NoRemove CLSID
{
ForceRemove %CLSID_USDPREVIEWHANDLER% = s 'Activision USD Preview Handler Server'
{
LocalServer32 = s '%MODULE%'
val AppID = s '%APPID%'
}
}
}
================================================
FILE: UsdPreviewHandlerServer/UsdPreviewHandlerPython.py
================================================
# Copyright 2021 Activision Publishing, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import print_function
import sys
import os
import argparse
from pxr import Usd, UsdUtils, Sdf, UsdAppUtils
from pxr.Usdviewq.stageView import StageView
from pxr.UsdAppUtils.complexityArgs import RefinementComplexities
import UsdPreviewHandler
try:
from PySide2.QtCore import *
from PySide2.QtGui import *
from PySide2.QtWidgets import *
except ImportError:
from PySide.QtCore import *
from PySide.QtGui import *
class Widget(QWidget):
def __init__(self, stage=None, app=None, previewApp=None):
super(Widget, self).__init__()
self.setStyleSheet(u"")
self.model = StageView.DefaultDataModel()
self.view = StageView(dataModel=self.model,
printTiming=True)
self.model.viewSettings.showHUD = False
self.app = app
self.previewApp = previewApp
self.layout = QVBoxLayout(self)
self.layout.addWidget(self.view)
self.layout.setContentsMargins(0, 0, 0, 0)
self.isLoadComplete = False
if stage:
self.setStage(stage)
def setStage(self, stage):
self.model.stage = stage
def OnComplexity(self, action):
self.model.viewSettings.complexity = RefinementComplexities.fromName(action.text())
def OnShadingMode(self, action):
self.model.viewSettings.renderMode = str(action.text())
def OnToggleDisplayGuide(self, action):
self.model.viewSettings.displayGuide = (self.actionDisplay_Guide.isChecked())
def OnToggleDisplayProxy(self, action):
self.model.viewSettings.displayProxy = (self.actionDisplay_Proxy.isChecked())
def OnToggleDisplayRender(self, action):
self.model.viewSettings.displayRender = (self.actionDisplay_Render.isChecked())
def OnRendererPlugin(self, plugin):
if not self.view.SetRendererPlugin(plugin):
# If SetRendererPlugin failed, we need to reset the check mark
# to whatever the currently loaded renderer is.
for action in self.rendererPluginActionGroup.actions():
if action.text() == self.view.rendererDisplayName:
action.setChecked(True)
break
# Then display an error message to let the user know something
# went wrong, and disable the menu item so it can't be selected
# again.
for action in self.rendererPluginActionGroup.actions():
if action.pluginType == plugin:
self.statusMessage(
'Renderer not supported: %s' % action.text())
action.setText(action.text() + " (unsupported)")
action.setDisabled(True)
break
def buildContextMenu_Renderer(self, contextMenu):
self.rendererPluginActionGroup = QActionGroup(self)
self.rendererPluginActionGroup.setExclusive(True)
rendererMenu = contextMenu.addMenu("Hydra Renderer")
pluginTypes = self.view.GetRendererPlugins()
for pluginType in pluginTypes:
name = self.view.GetRendererDisplayName(pluginType)
action = rendererMenu.addAction(name)
action.setCheckable(True)
action.pluginType = pluginType
self.rendererPluginActionGroup.addAction(action)
action.triggered[bool].connect(lambda _, pluginType=pluginType:
self.OnRendererPlugin(pluginType))
# Now set the checked box on the current renderer (it should
# have been set by now).
currentRendererId = self.view.GetCurrentRendererId()
foundPlugin = False
for action in self.rendererPluginActionGroup.actions():
if action.pluginType == currentRendererId:
action.setChecked(True)
foundPlugin = True
break
# Disable the menu if no plugins were found
rendererMenu.setEnabled(foundPlugin)
def buildContextMenu_Complexity(self, contextMenu):
self.actionLow = QAction("Low", self)
self.actionLow.setObjectName(u"actionLow")
self.actionLow.setCheckable(True)
self.actionMedium = QAction("Medium", self)
self.actionMedium.setCheckable(True)
self.actionMedium.setObjectName(u"actionMedium")
self.actionHigh = QAction("High", self)
self.actionHigh.setCheckable(True)
self.actionHigh.setObjectName(u"actionHigh")
self.actionVery_High = QAction("Very High", self)
self.actionVery_High.setCheckable(True)
self.actionVery_High.setObjectName(u"actionVery_High")
self.complexityGroup = QActionGroup(self)
self.complexityGroup.setExclusive(True)
self.complexityGroup.addAction(self.actionLow)
self.complexityGroup.addAction(self.actionMedium)
self.complexityGroup.addAction(self.actionHigh)
self.complexityGroup.addAction(self.actionVery_High)
self.complexityGroup.triggered.connect(self.OnComplexity)
self.actionLow.setChecked(True)
complexityMenu = contextMenu.addMenu("Complexity")
complexityMenu.addAction(self.actionLow)
complexityMenu.addAction(self.actionMedium)
complexityMenu.addAction(self.actionHigh)
complexityMenu.addAction(self.actionVery_High)
def buildContextMenu_ShadingMode(self, contextMenu):
self.actionWireframe = QAction("Wireframe", self)
self.actionWireframe.setCheckable(True)
self.actionWireframeOnSurface = QAction("WireframeOnSurface", self)
self.actionWireframeOnSurface.setCheckable(True)
self.actionSmooth_Shaded = QAction("Smooth Shaded", self)
self.actionSmooth_Shaded.setCheckable(True)
self.actionFlat_Shaded = QAction("Flat Shaded", self)
self.actionFlat_Shaded.setCheckable(True)
self.actionPoints = QAction("Points", self)
self.actionPoints.setCheckable(True)
self.actionGeom_Only = QAction("Geom Only", self)
self.actionGeom_Only.setCheckable(True)
self.actionGeom_Smooth = QAction("Geom Smooth", self)
self.actionGeom_Smooth.setCheckable(True)
self.actionGeom_Flat = QAction("Geom Flat", self)
self.actionGeom_Flat.setCheckable(True)
self.actionHidden_Surface_Wireframe = QAction("Hidden Surface Wireframe", self)
self.actionHidden_Surface_Wireframe.setCheckable(True)
self.shadingGroup = QActionGroup(self)
self.shadingGroup.setExclusive(True)
self.shadingGroup.addAction(self.actionWireframe)
self.shadingGroup.addAction(self.actionWireframeOnSurface)
self.shadingGroup.addAction(self.actionSmooth_Shaded)
self.shadingGroup.addAction(self.actionFlat_Shaded)
self.shadingGroup.addAction(self.actionPoints)
self.shadingGroup.addAction(self.actionGeom_Only)
self.shadingGroup.addAction(self.actionGeom_Smooth)
self.shadingGroup.addAction(self.actionGeom_Flat)
self.shadingGroup.addAction(self.actionHidden_Surface_Wireframe)
self.shadingGroup.triggered.connect(self.OnShadingMode)
self.actionGeom_Smooth.setChecked(True)
complexityMenu = contextMenu.addMenu("Shading Mode")
complexityMenu.addAction(self.actionWireframe)
complexityMenu.addAction(self.actionWireframeOnSurface)
complexityMenu.addAction(self.actionSmooth_Shaded)
complexityMenu.addAction(self.actionFlat_Shaded)
complexityMenu.addAction(self.actionPoints)
complexityMenu.addAction(self.actionGeom_Only)
complexityMenu.addAction(self.actionGeom_Smooth)
complexityMenu.addAction(self.actionGeom_Flat)
complexityMenu.addAction(self.actionHidden_Surface_Wireframe)
def buildContextMenu_DisplayPurposes(self, contextMenu):
self.actionDisplay_Guide = QAction("Guide", self)
self.actionDisplay_Guide.setCheckable(True)
self.actionDisplay_Guide.triggered.connect(self.OnToggleDisplayGuide)
self.actionDisplay_Guide.setChecked(self.model.viewSettings.displayGuide)
self.actionDisplay_Proxy = QAction("Proxy", self)
self.actionDisplay_Proxy.setCheckable(True)
self.actionDisplay_Proxy.triggered.connect(self.OnToggleDisplayProxy)
self.actionDisplay_Proxy.setChecked(self.model.viewSettings.displayProxy)
self.actionDisplay_Render = QAction("Render", self)
self.actionDisplay_Render.setCheckable(True)
self.actionDisplay_Render.triggered.connect(self.OnToggleDisplayRender)
self.actionDisplay_Render.setChecked(self.model.viewSettings.displayRender)
displayPurposesMenu = contextMenu.addMenu("Display Purposes")
displayPurposesMenu.addAction(self.actionDisplay_Guide)
displayPurposesMenu.addAction(self.actionDisplay_Proxy)
displayPurposesMenu.addAction(self.actionDisplay_Render)
def buildContextMenu(self):
self.contextMenu = QMenu(self)
self.buildContextMenu_Renderer(self.contextMenu)
self.buildContextMenu_Complexity(self.contextMenu)
self.buildContextMenu_ShadingMode(self.contextMenu)
self.buildContextMenu_DisplayPurposes(self.contextMenu)
def closeEvent(self, event):
# Ensure to close the renderer to avoid GlfPostPendingGLErrors
self.view.closeRenderer()
def contextMenuEvent(self, event):
modifiers = self.app.keyboardModifiers()
altModifer = ((modifiers & Qt.AltModifier) == Qt.AltModifier)
shiftModifer = ((modifiers & Qt.ShiftModifier) == Qt.ShiftModifier)
controlModifer = ((modifiers & Qt.ControlModifier) == Qt.ControlModifier)
if not altModifer and not shiftModifer and not controlModifer:
self.contextMenu.exec_(self.mapToGlobal(event.pos()))
def timerEvent(self, event):
if (not self.isLoadComplete) and (not self.view._isFirstImage):
self.isLoadComplete = True
self.previewApp.LoadComplete()
eventData = self.previewApp.PeekEvent()
while eventData.event != UsdPreviewHandler.UsdPreviewEvent.NoMoreEvents:
if eventData.event == UsdPreviewHandler.UsdPreviewEvent.Quit:
self.app.quit()
eventData = self.previewApp.PeekEvent()
def setStyleSheetUsingState(app, resourceDir):
# We use a style file that is actually a template, which we fill
# in from state, and is how we change app font sizes, for example.
# Qt style sheet accepts only forward slashes as path separators
resourceDir = resourceDir.replace("\\", "/")
fontSize = 10
baseFontSizeStr = "%spt" % str(fontSize)
# The choice of 8 for smallest smallSize is for performance reasons,
# based on the "Gotham Rounded" font used by usdviewstyle.qss . If we
# allow it to float, we get a 2-3 hundred millisecond hit in startup
# time as Qt (apparently) manufactures a suitably sized font.
# Mysteriously, we don't see this cost for larger font sizes.
smallSize = 8 if fontSize < 12 else int(round(fontSize * 0.8))
smallFontSizeStr = "%spt" % str(smallSize)
# Apply the style sheet to it
sheet = open(os.path.join(resourceDir, 'usdviewstyle.qss'), 'r')
sheetString = sheet.read() % {
'RESOURCE_DIR' : resourceDir,
'BASE_FONT_SZ' : baseFontSizeStr,
'SMALL_FONT_SZ' : smallFontSizeStr }
app.setStyleSheet(sheetString)
def main():
programName = os.path.basename(sys.argv[0])
parser = argparse.ArgumentParser(prog=programName,
description='Preview for Windows Explorer')
parser.add_argument('usdFilePath', action='store', type=str,
help='USD file to preview')
parser.add_argument('--hwnd', action='store', type=int,
default=0,
help='The HWND of the parent window')
parser.add_argument('--usdviewqDir', action='store', type=str,
help='Full path to the usdviewq python folder')
UsdAppUtils.rendererArgs.AddCmdlineArgs(parser)
args = parser.parse_args()
with Usd.StageCacheContext(UsdUtils.StageCache.Get()):
stage = Usd.Stage.Open(args.usdFilePath)
previewApp = UsdPreviewHandler.UsdPreviewApp()
app = QApplication([])
setStyleSheetUsingState(app, args.usdviewqDir)
window = Widget(stage, app, previewApp)
window.setWindowFlags( Qt.Popup | Qt.Tool )
window.setAttribute( Qt.WA_DontShowOnScreen )
window.show()
# poll for events every so often
window.startTimer( 250 )
try:
import ctypes
ctypes.pythonapi.PyCObject_AsVoidPtr.restype = ctypes.c_void_p
ctypes.pythonapi.PyCObject_AsVoidPtr.argtypes = [ctypes.py_object]
previewApp.SetParent( args.hwnd, ctypes.pythonapi.PyCObject_AsVoidPtr(window.effectiveWinId()), ctypes.pythonapi.PyCObject_AsVoidPtr(window.view.effectiveWinId()) )
except:
previewApp.SetParent( args.hwnd, window.effectiveWinId(), window.view.effectiveWinId() )
window.setAttribute( Qt.WA_DontShowOnScreen, False )
# Make camera fit the loaded geometry
window.view.updateView(resetCam=True, forceComputeBBox=True)
# force a draw when hidden
window.view.glDraw()
window.buildContextMenu()
app.exec_()
if __name__ == "__main__":
sys.exit(main())
================================================
FILE: UsdPreviewHandlerServer/UsdPreviewLocalServer.idl
================================================
// Copyright 2021 Activision Publishing, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import "oaidl.idl";
import "ocidl.idl";
import "ShObjIdl.idl";
[
uuid(68DF0FAC-996B-4933-B092-9733E77061BB),
helpstring("USDPreview Type Library"),
version(1.0),
]
library USDPreview
{
[
uuid(07D4D38F-9C98-48F8-A057-26241405D5C8),
helpstring("USD IPreviewHandler Server implementation")
]
coclass USDPreviewHandler
{
[default] interface IPreviewHandler;
}
};
================================================
FILE: UsdPreviewHandlerServer/UsdPreviewLocalServer.rc
================================================
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"1 TYPELIB ""USDPreviewLocalServer.tlb""\r\n"
"\r\n"
"#define ATVI_VERSION_DESCRIPTION ""Activision USD Preview Server""\r\n"
"#include ""atviversion.rc2""\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// REGISTRY
//
IDR_REGISTRY_MODULE REGISTRY "USDPreviewLocalServerModule.rgs"
IDR_REGISTRY_USDPREVIEWHANDLERIMPL REGISTRY "USDPreviewHandlerImpl.rgs"
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON_USD ICON "shared\\usd.ico"
/////////////////////////////////////////////////////////////////////////////
//
// PYTHON
//
IDR_PYTHON_PREVIEWHANLDER PYTHON "UsdPreviewHandlerPython.py"
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
1 TYPELIB "USDPreviewLocalServer.tlb"
#define ATVI_VERSION_DESCRIPTION "Activision USD Preview Server"
#include "atviversion.rc2"
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
================================================
FILE: UsdPreviewHandlerServer/UsdPreviewLocalServer.vcxproj
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{279AFA6D-6E35-4798-BA63-8A7E15D11185}</ProjectGuid>
<RootNamespace>UsdPreviewLocalServer</RootNamespace>
<WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>false</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>false</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<Import Project="$(SolutionDir)\atviversion.props" />
<Import Project="$(SolutionDir)\python.props" />
<Import Project="$(SolutionDir)\boost.props" />
<PropertyGroup Label="PythonConfiguration">
<RegistryView>RegistryView.Registry32</RegistryView>
<RegistryView Condition="$(Platform) == 'x64'">RegistryView.Registry64</RegistryView>
<PythonTag>$(PythonVersion)-32</PythonTag>
<PythonTag Condition="$(Platform) == 'x64'">$(PythonVersion)</PythonTag>
<PythonHome Condition="$(PythonHome) == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\$(PythonTag)\InstallPath', null, null, $(RegistryView)))</PythonHome>
<PythonHome Condition="$(PythonHome) == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\$(PythonTag)\InstallPath', null, null, $(RegistryView)))</PythonHome>
<PythonExe Condition="$(PythonExe) == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\$(PythonTag)\InstallPath', 'ExecutablePath', null, $(RegistryView)))</PythonExe>
<PythonExe Condition="$(PythonExe) == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\$(PythonTag)\InstallPath', 'ExecutablePath', null, $(RegistryView)))</PythonExe>
<PythonExe Condition="$(PythonExe) == '' and $(PythonHome) != ''">$(PythonHome)python.exe</PythonExe>
<PythonDevVersion>$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\$(PythonTag)\InstalledFeatures', 'dev', null, $(RegistryView)))</PythonDevVersion>
<PythonDevVersion Condition="$(PythonDevVersion) == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\$(PythonTag)\InstalledFeatures', 'dev', null, $(RegistryView)))</PythonDevVersion>
<PythonCorePDBVersion>$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\$(PythonTag)\InstalledFeatures', 'core_pdb', null, $(RegistryView)))</PythonCorePDBVersion>
<PythonCorePDBVersion Condition="$(PythonCorePDBVersion) == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\$(PythonTag)\InstalledFeatures', 'core_pdb', null, $(RegistryView)))</PythonCorePDBVersion>
<PythonCoreDVersion>$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\$(PythonTag)\InstalledFeatures', 'core_d', null, $(RegistryView)))</PythonCoreDVersion>
<PythonCoreDVersion Condition="$(PythonCoreDVersion) == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\$(PythonTag)\InstalledFeatures', 'core_d', null, $(RegistryView)))</PythonCoreDVersion>
<PythonDebugSuffix Condition="$(PythonCoreDVersion) != ''">_d</PythonDebugSuffix>
<PythonDExe Condition="$(PythonExe) != '' and $(PythonDExe) == ''">$([System.IO.Path]::GetDirectoryName($(PythonExe)))\python$(PythonDebugSuffix).exe</PythonDExe>
<PythonDExe Condition="!Exists($(PythonDExe))">$(PythonExe)</PythonDExe>
</PropertyGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)bin\$(PlatformToolset)\$(PythonTag)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)build\$(PlatformToolset)\$(PythonTag)\$(Configuration)\$(ProjectName)\</IntDir>
<IgnoreImportLibrary>true</IgnoreImportLibrary>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)bin\$(PlatformToolset)\$(PythonTag)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)build\$(PlatformToolset)\$(PythonTag)\$(Configuration)\$(ProjectName)\</IntDir>
<IgnoreImportLibrary>true</IgnoreImportLibrary>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>false</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<AdditionalIncludeDirectories>$(SolutionDir);$(PythonHome)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Optimization>Disabled</Optimization>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>false</EnableCOMDATFolding>
<OptimizeReferences>false</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(PythonHome)libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>Pathcch.lib;%(AdditionalDependencies)</AdditionalDependencies>
<DelayLoadDLLs>
</DelayLoadDLLs>
</Link>
<ResourceCompile>
<AdditionalIncludeDirectories>$(OutDir);$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Midl>
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
<MkTypLibCompatible>false</MkTypLibCompatible>
<ValidateAllParameters>true</ValidateAllParameters>
<WarningLevel>0</WarningLevel>
<EnableErrorChecks>All</EnableErrorChecks>
<TypeLibraryName>$(OutDir)$(ProjectName).tlb</TypeLibraryName>
</Midl>
<PostBuildEvent>
<Command>%(Command)
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>false</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<AdditionalIncludeDirectories>$(SolutionDir);$(PythonHome)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>false</EnableCOMDATFolding>
<OptimizeReferences>false</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(PythonHome)libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>Pathcch.lib;%(AdditionalDependencies)</AdditionalDependencies>
<DelayLoadDLLs>
</DelayLoadDLLs>
</Link>
<ResourceCompile>
<AdditionalIncludeDirectories>$(OutDir);$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Midl>
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
<MkTypLibCompatible>false</MkTypLibCompatible>
<ValidateAllParameters>true</ValidateAllParameters>
<WarningLevel>0</WarningLevel>
<EnableErrorChecks>All</EnableErrorChecks>
<TypeLibraryName>$(OutDir)$(ProjectName).tlb</TypeLibraryName>
</Midl>
<PostBuildEvent>
<Command>%(Command)
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\shared\emb.h" />
<ClInclude Include="..\shared\environment.h" />
<ClInclude Include="..\shared\EventViewerLog.h" />
<ClInclude Include="..\shared\PythonUtil.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="UsdPreviewHandlerImpl.h" />
<ClInclude Include="Module.h" />
<ClInclude Include="UsdPreviewLocalServer_h.h" />
<ClInclude Include="UsdPreviewThread.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\shared\emb.cpp" />
<ClCompile Include="..\shared\environment.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="UsdPreviewHandlerImpl.cpp" />
<ClCompile Include="Module.cpp" />
<ClCompile Include="UsdPreviewLocalServer_i.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="UsdPreviewThread.cpp" />
</ItemGroup>
<ItemGroup>
<Midl Include="UsdPreviewLocalServer.idl">
<EnableErrorChecks>All</EnableErrorChecks>
<ValidateAllParameters>true</ValidateAllParameters>
</Midl>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="UsdPreviewLocalServer.rc" />
</ItemGroup>
<ItemGroup>
<None Include="..\python.props" />
<None Include="UsdPreviewHandlerImpl.rgs" />
<None Include="UsdPreviewHandlerPython.py" />
<None Include="UsdPreviewLocalServerModule.rgs" />
</ItemGroup>
<ItemGroup>
<Image Include="..\shared\usd.ico" />
<Image Include="shared\usd.ico" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\shared\EventViewerMessages.vcxproj">
<Project>{f12e597b-b731-4f5a-bec3-980d20159320}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
================================================
FILE: UsdPreviewHandlerServer/UsdPreviewLocalServer.vcxproj.filters
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Shared">
<UniqueIdentifier>{31617a27-1920-4188-aada-071adaa53b76}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Module.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="UsdPreviewLocalServer_h.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="UsdPreviewThread.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="UsdPreviewHandlerImpl.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\shared\emb.h">
<Filter>Shared</Filter>
</ClInclude>
<ClInclude Include="..\shared\environment.h">
<Filter>Shared</Filter>
</ClInclude>
<ClInclude Include="..\shared\EventViewerLog.h">
<Filter>Shared</Filter>
</ClInclude>
<ClInclude Include="..\shared\PythonUtil.h">
<Filter>Shared</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Module.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="UsdPreviewLocalServer_i.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="UsdPreviewThread.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="UsdPreviewHandlerImpl.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\shared\emb.cpp">
<Filter>Shared</Filter>
</ClCompile>
<ClCompile Include="..\shared\environment.cpp">
<Filter>Shared</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="UsdPreviewLocalServerModule.rgs">
<Filter>Resource Files</Filter>
</None>
<None Include="UsdPreviewHandlerImpl.rgs">
<Filter>Resource Files</Filter>
</None>
<None Include="UsdPreviewHandlerPython.py" />
<None Include="..\python.props" />
</ItemGroup>
<ItemGroup>
<Midl Include="UsdPreviewLocalServer.idl">
<Filter>Source Files</Filter>
</Midl>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="UsdPreviewLocalServer.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Image Include="..\shared\usd.ico">
<Filter>Shared</Filter>
</Image>
<Image Include="shared\usd.ico">
<Filter>Resource Files</Filter>
</Image>
</ItemGroup>
</Project>
================================================
FILE: UsdPreviewHandlerServer/UsdPreviewLocalServerModule.rgs
================================================
HKCU
{
NoRemove AppID
{
'%APPID%' = s 'USDPreviewLocalServer'
'USDPreviewLocalServer.exe'
{
val AppID = s '%APPID%'
}
}
}
================================================
FILE: UsdPreviewHandlerServer/UsdPreviewThread.cpp
================================================
// Copyright 2021 Activision Publishing, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "stdafx.h"
#include "USDPreviewThread.h"
#include "Module.h"
#include "shared\PythonUtil.h"
#include "shared\emb.h"
#include "shared\environment.h"
#include "shared\EventViewerLog.h"
CUSDPreviewThread::~CUSDPreviewThread()
{
Term();
}
bool CUSDPreviewThread::Init()
{
return true;
}
void CUSDPreviewThread::Term()
{
WaitForExit();
}
static bool GetRendererFromConfig( LPCTSTR system, CStringW &out )
{
std::vector<CStringW> ConfigFileList = BuildConfigFileList( g_hInstance );
CStringW sRenderer;
GetPrivateProfileStringAndExpandEnvironmentStrings( L"RENDERER", system, L"GL", sRenderer, ConfigFileList );
if ( sRenderer.IsEmpty() )
return false;
out = sRenderer;
return true;
}
HRESULT CUSDPreviewThread::LaunchPreviewWindow( HWND hWndParent, LPCTSTR pPathToUsdStage )
{
m_hParent = hWndParent;
m_sPathToUsdStage = pPathToUsdStage;
m_hThread = ::CreateThread( nullptr, 0, ThreadProc, this, 0, nullptr );
if ( m_hThread == nullptr )
return false;
return S_OK;
}
void CUSDPreviewThread::WaitForExit()
{
if ( m_hThread == nullptr )
return;
if ( ::WaitForSingleObject( m_hThread, 1000 ) == WAIT_TIMEOUT )
{
TerminateThread( m_hThread, (DWORD)-1 );
}
m_hThread = nullptr;
}
static CStringW LocateUsdviewq()
{
const std::vector<CString> &PathList = GetUsdPythonPathList();
for ( const CString &sDir : PathList )
{
TCHAR sFilePath[512];
_tcscpy_s( sFilePath, sDir.GetString() );
::PathCchAppend( sFilePath, ARRAYSIZE( sFilePath ), _T("pxr\\Usdviewq") );
DWORD nAttribs = ::GetFileAttributes( sFilePath );
if ( (nAttribs != INVALID_FILE_ATTRIBUTES) && (nAttribs & FILE_ATTRIBUTE_DIRECTORY) )
return sFilePath;
}
return L"";
}
DWORD WINAPI CUSDPreviewThread::ThreadProc( _In_ LPVOID lpParameter )
{
CUSDPreviewThread *pThis = reinterpret_cast<CUSDPreviewThread *>(lpParameter);
TPyChar sPathToHostExe[MAX_PATH];
#if PY_MAJOR_VERSION >= 3
::GetModuleFileNameW(nullptr, sPathToHostExe, ARRAYSIZE(sPathToHostExe));
#else
::GetModuleFileNameA(nullptr, sPathToHostExe, ARRAYSIZE(sPathToHostExe));
#endif
Py_SetProgramName(sPathToHostExe);
PyImport_AppendInittab("emb", emb::PyInit_emb);
CPyInterpreter pyInterpreter;
PyImport_ImportModule("emb");
CStringW shWndParent;
shWndParent.Format(L"%d", pThis->m_hParent);
CStringW sRenderer;
GetRendererFromConfig( _T( "PREVIEW" ), sRenderer );
CStringW sUsdViewqFolder;
sUsdViewqFolder = LocateUsdviewq();
// UsdStageView initializes the renderer from this environment variable
_tputenv_s( _T("HD_DEFAULT_RENDERER"), sRenderer );
std::vector<const TPyChar *> ArgV;
ArgV.push_back( sPathToHostExe );
ArgV.push_back( _Tpy( "--hwnd" ) );
CW2Py pyhWndParent( shWndParent );
ArgV.push_back( pyhWndParent );
ArgV.push_back( _Tpy( "--usdviewqDir" ) );
CW2Py pyUsdViewqFolder( sUsdViewqFolder );
ArgV.push_back( pyUsdViewqFolder );
CW2Py pyPathToUsdStage( pThis->m_sPathToUsdStage );
ArgV.push_back( pyPathToUsdStage );
PyAppendSysPath( GetUsdPythonPathList() );
PySetEnvironmentVariable( L"PATH", GetUsdPath() );
PySetEnvironmentVariable( L"PYTHONPATH", GetUsdPythonPath() );
PySys_SetArgvEx( static_cast<int>(ArgV.size()), const_cast<TPyChar**>(&ArgV[0]), 1 );
HRSRC hrscPy = ::FindResource( g_hInstance, MAKEINTRESOURCE( IDR_PYTHON_PREVIEWHANLDER ), _T("PYTHON") );
if ( hrscPy == nullptr )
return static_cast<DWORD>(-1);
HGLOBAL hPy = ::LoadResource( g_hInstance, hrscPy );
if ( hPy == nullptr )
return static_cast<DWORD>(-1);
void* pScriptData = ::LockResource( hPy );
if ( pScriptData == nullptr )
return static_cast<DWORD>(-1);
DWORD nSize = SizeofResource( g_hInstance, hrscPy );
CStringA pyScript;
pyScript.SetString( reinterpret_cast<LPCSTR>(pScriptData), nSize );
PyObject* pMainModule = PyImport_AddModule("__main__");
PyObject* pGlobalDict = PyModule_GetDict(pMainModule);
std::string buffer;
emb::stdout_write_type writeStdOut = [&buffer] (std::string s) { buffer += s; };
emb::set_stdout(writeStdOut);
emb::stdout_write_type writeStdErr = [&buffer] (std::string s) { buffer += s; };
emb::set_stderr(writeStdErr);
CPyObject result = CPyObject( PyRun_String( pyScript.GetString(), Py_file_input, pGlobalDict, pGlobalDict ) );
emb::reset_stdout();
emb::reset_stderr();
int exitCode = 0;
if ( PyErr_Occurred() )
{
CPyException e;
if ( !e.IsExceptionSystemExit() )
{
CString sErrorMsg = e.tracebackW();
if ( !buffer.empty() )
sErrorMsg.AppendFormat( _T( "\n\n[STDOUT]\n%hs" ), buffer.c_str() );
if ( sErrorMsg.IsEmpty() )
{
sErrorMsg = e.typeW();
}
LogEventMessage( PREVIEWHANDLER_CATEGORY, sErrorMsg.GetString(), LogEventType::Error );
return static_cast<DWORD>(-1);
}
else
{
PySystemExitObject* pSystemExitObject = reinterpret_cast<PySystemExitObject*>(e.GetValue());
if ( pSystemExitObject && pSystemExitObject->code )
{
if ( PyLong_Check( pSystemExitObject->code ) )
{
exitCode = PyLong_AsLong( pSystemExitObject->code );
}
else if ( PyUnicode_Check( pSystemExitObject->code ) )
{
// unexpected
buffer += e.what();
exitCode = -1;
LogEventMessage( PREVIEWHANDLER_CATEGORY, e.whatW(), LogEventType::Error );
}
}
}
}
return exitCode;
}
================================================
FILE: UsdPreviewHandlerServer/UsdPreviewThread.h
================================================
// Copyright 2021 Activision Publishing, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
class CUSDPreviewThread
{
public:
~CUSDPreviewThread();
bool Init();
void Term();
HRESULT LaunchPreviewWindow(HWND hWndParent, LPCTSTR pPathToUsdStage);
void WaitForExit();
bool IsValid() const;
private:
static DWORD WINAPI ThreadProc( _In_ LPVOID lpParameter );
HANDLE m_hThread = nullptr;
HWND m_hParent = 0;
CString m_sPathToUsdStage;
};
inline bool CUSDPreviewThread::IsValid() const
{
return m_hThread != nullptr;
}
================================================
FILE: UsdPreviewHandlerServer/resource.h
================================================
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by UsdPreviewLocalServer.rc
//
#define IDR_REGISTRY_MODULE 101
#define IDR_REGISTRY_USDPREVIEWIMPL 102
#define IDR_REGISTRY_PREVIEWHANDLERIMPL 105
#define IDR_REGISTRY_USDPREVIEWHANDLERIMPL 105
#define IDI_ICONUSD 106
#define IDI_ICON_USD 106
#define IDR_PYTHON_PREVIEWHANLDER 107
#define IDR_REGISTRY_THUMBNAILIMPL 108
#define IDR_REGISTRY_USDTHUMBNAILIMPL 108
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 109
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1004
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
================================================
FILE: UsdPreviewHandlerServer/stdafx.cpp
================================================
// Copyright 2021 Activision Publishing, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "stdafx.h"
================================================
FILE: UsdPreviewHandlerServer/stdafx.h
================================================
// Copyright 2021 Activision Publishing, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#ifndef STRICT
#define STRICT
#endif
#pragma warning(push)
#pragma warning(disable: 4244 4459)
#include <boost/python/module.hpp>
#include <boost/python/def.hpp>
#include <boost/python/list.hpp>
#include <boost/python.hpp>
#pragma warning(pop)
#include <WinSDKVer.h>
#define _WIN32_WINNT 0x0A00
#include <SDKDDKVer.h>
#define _ATL_APARTMENT_THREADED
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
#define ATL_NO_ASSERT_ON_DESTROY_NONEXISTENT_WINDOW
// Use the C++ standard templated min/max
#define NOMINMAX
#define NOBITMAP
// Include <mcx.h> if you need this
#define NOMCX
// Include <winsvc.h> if you need this
#define NOSERVICE
#include <windows.h>
#include <PathCch.h>
#include <atlbase.h>
#include <atlcom.h>
#include <atlconv.h>
#include <atlctl.h>
#include <atlstr.h>
#include <atlsafe.h>
#include <comutil.h>
#include <stdint.h>
================================================
FILE: UsdPythonToolsServer/Module.cpp
================================================
// Copyright 2021 Activision Publishing, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "stdafx.h"
#include "Module.h"
HMODULE g_hInstance;
CUsdPythonToolsLocalServerModule g_AtlModule;
CString g_DebugIUsdPythonToolsMethod;
extern "C" int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nShowCmd)
{
UNREFERENCED_PARAMETER( hPrevInstance );
UNREFERENCED_PARAMETER( lpCmdLine );
UNREFERENCED_PARAMETER( nShowCmd );
g_hInstance = hInstance;
int nResult = g_AtlModule.WinMain( nShowCmd );
return nResult;
}
================================================
FILE: UsdPythonToolsServer/Module.h
================================================
// Copyright 2021 Activision Publishing, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include "UsdPythonToolsLocalServer_h.h"
#include "resource.h"
// Using an ATL module here because it removes a lot of the
// boiler-plate COM work that we would have to implement ourselves.
class CUsdPythonToolsLocalServerModule : public CAtlExeModuleT<CUsdPythonToolsLocalServerModule>
{
public:
DECLARE_LIBID( LIBID_UsdPythonToolsLib )
DECLARE_REGISTRY_APPID_RESOURCEID( IDR_REGISTRY_MODULE, "{8777F2C4-2318-408A-85D8-F65E15811971}" )
// Override CAtlExeModuleT::PreMessageLoop to change REGCLS_MULTIPLEUSE to REGCLS_SINGLEUSE.
// REGCLS_SINGLEUSE will create a new Windows process for every instance of our COM classes,
// REGCLS_MULTIPLEUSE will reuse the same Windows process.
HRESULT PreMessageLoop( _In_ int /*nShowCmd*/ ) throw()
{
HRESULT hr = S_OK;
CUsdPythonToolsLocalServerModule* pT = static_cast<CUsdPythonToolsLocalServerModule*>(this);
#ifndef _ATL_NO_COM_SUPPORT
hr = pT->RegisterClassObjects(CLSCTX_LOCAL_SERVER,
REGCLS_SINGLEUSE | // <- !!!
REGCLS_SUSPENDED);
if (FAILED(hr))
return hr;
if (hr == S_OK)
{
if (m_bDelayShutdown)
{
CHandle h(pT->StartMonitor());
if (h.m_h == NULL)
{
hr = E_FAIL;
}
else
{
hr = CoResumeClassObjects();
ATLASSERT(SUCCEEDED(hr));
if (FAILED(hr))
{
::SetEvent(m_hEventShutdown); // tell monitor to shutdown
::WaitForSingleObject(h, m_dwTimeOut * 2);
}
}
}
else
{
hr = CoResumeClassObjects();
ATLASSERT(SUCCEEDED(hr));
}
if (FAILED(hr))
pT->RevokeClassObjects();
}
else
{
m_bDelayShutdown = false;
}
#endif // _ATL_NO_COM_SUPPORT
ATLASSERT(SUCCEEDED(hr));
return hr;
}
};
extern CUsdPythonToolsLocalServerModule g_AtlModule;
extern HMODULE g_hInstance;
// Helpful for debugging zombie processes.
// Set to the last method that was called in IUSDTools
extern CString g_DebugIUsdPythonToolsMethod;
#define DEBUG_RECORD_ENTRY() \
g_DebugIUsdPythonToolsMethod = _T(__FUNCTION__)
================================================
FILE: UsdPythonToolsServer/UsdPythonToolsImpl.cpp
================================================
// Copyright 2021 Activision Publishing, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "stdafx.h"
#include "UsdPythonToolsImpl.h"
#include "Module.h"
#include "shared\PythonUtil.h"
#include "shared\emb.h"
#include "shared\environment.h"
#include "shared\EventViewerLog.h"
#include "UsdPythonToolsLocalServer_h.h"
#include <vector>
HRESULT CUsdPythonToolsImpl::FinalConstruct()
{
SetupPythonEnvironment( g_hInstance );
return __super::FinalConstruct();
}
void CUsdPythonToolsImpl::FinalRelease()
{
__super::FinalRelease();
}
static std::wstring FindRelativeFile(LPCWSTR sToolFileName)
{
const std::vector<CString> &PathList = GetUsdPathList();
for ( const CString &sDir : PathList )
{
TCHAR sFilePath[512];
_tcscpy_s( sFilePath, sDir.GetString() );
::PathCchAppend( sFilePath, ARRAYSIZE( sFilePath ), sToolFileName );
DWORD nAttribs = ::GetFileAttributes( sFilePath );
if ( (nAttribs != INVALID_FILE_ATTRIBUTES) && !(nAttribs & FILE_ATTRIBUTE_DIRECTORY) )
return sFilePath;
}
return L"";
}
static FILE *OpenRelativeFile(LPCWSTR sToolFileName, std::wstring& sOutFilePath)
{
sOutFilePath = FindRelativeFile( sToolFileName );
FILE *fp = _wfsopen( sOutFilePath.c_str(), L"rb", _SH_SECURE );
if ( fp == nullptr )
return nullptr;
return fp;
}
static HRESULT RunDiskPythonScript( LPCWSTR sToolFileName, std::vector<const TPyChar *> &ArgV, std::string &sStdOut, int& exitCode )
{
exitCode = 0;
std::wstring sFilePath;
FILE *fp = OpenRelativeFile( sToolFileName, sFilePath );
if (fp == nullptr)
return E_FAIL;
fseek( fp, 0, SEEK_END );
int sizeOfFile = ftell( fp );
fseek( fp, 0, SEEK_SET );
CStringA pyScript;
LPSTR pScriptData = pyScript.GetBufferSetLength( sizeOfFile );
fread( pScriptData, 1, sizeOfFile, fp );
pyScript.ReleaseBuffer( sizeOfFile );
fclose( fp );
fp = nullptr;
PyImport_AppendInittab("emb", emb::PyInit_emb);
CPyInterpreter pyInterpreter;
PyImport_ImportModule("emb");
emb::stdout_write_type writeStdOut = [&sStdOut] (std::string s) { sStdOut += s; };
emb::set_stdout(writeStdOut);
emb::stdout_write_type writeStdErr = [&sStdOut] (std::string s) { sStdOut += s; };
emb::set_stderr(writeStdErr);
PyAppendSysPath( GetUsdPythonPathList() );
PySetEnvironmentVariable( L"PATH", GetUsdPath() );
PySetEnvironmentVariable( L"PYTHONPATH", GetUsdPythonPath() );
PySys_SetArgvEx( static_cast<int>(ArgV.size()), const_cast<TPyChar**>(&ArgV[0]), 1 );
PyObject* pMainModule = PyImport_AddModule("__main__");
PyObject* pGlobalDict = PyModule_GetDict(pMainModule);
CPyObject result = CPyObject( PyRun_String( pyScript.GetString(), Py_file_input, pGlobalDict, pGlobalDict ) );
HRESULT hr = S_OK;
if ( PyErr_Occurred() )
{
CPyException e;
if ( !e.IsExceptionSystemExit() )
{
CString sErrorMsg = e.tracebackW();
if ( sErrorMsg.IsEmpty() )
sErrorMsg.Format( _T( "[Error]\n%hs" ), e.what() );
if ( !sStdOut.empty() )
sErrorMsg.AppendFormat( _T( "\n\n[STDOUT]\n%hs" ), sStdOut.c_str() );
LogEventMessage( PYTHONTOOLS_CATEGORY, sErrorMsg.GetString(), LogEventType::Error );
hr = E_FAIL;
}
else
{
PySystemExitObject* pSystemExitObject = reinterpret_cast<PySystemExitObject*>(e.GetValue());
if ( pSystemExitObject && pSystemExitObject->code )
{
if ( PyLong_Check( pSystemExitObject->code ) )
{
exitCode = PyLong_AsLong( pSystemExitObject->code );
}
else if ( PyUnicode_Check( pSystemExitObject->code ) )
{
// unexpected
sStdOut += e.what();
exitCode = -1;
LogEventMessage( PYTHONTOOLS_CATEGORY, e.whatW(), LogEventType::Error );
hr = E_FAIL;
}
}
}
}
emb::reset_stdout();
emb::reset_stderr();
return hr;
}
static HRESULT RunResourcePythonScript( UINT nResourceId, std::vector<const TPyChar *> &ArgV, std::string &sStdOut, int& exitCode )
{
exitCode = 0;
HRSRC hrscPy = ::FindResource( g_hInstance, MAKEINTRESOURCE( nResourceId ), _T("PYTHON") );
if ( hrscPy == nullptr )
return E_FAIL;
HGLOBAL hPy = ::LoadResource( g_hInstance, hrscPy );
if ( hPy == nullptr )
return E_FAIL;
void* pScriptData = ::LockResource( hPy );
if ( pScriptData == nullptr )
return E_FAIL;
DWORD nSize = SizeofResource( g_hInstance, hrscPy );
CStringA pyScript;
pyScript.SetString( reinterpret_cast<LPCSTR>(pScriptData), nSize );
PyImport_AppendInittab("emb", emb::PyInit_emb);
CPyInterpreter pyInterpreter;
PyImport_ImportModule("emb");
emb::stdout_write_type writeStdOut = [&sStdOut] (std::string s) { sStdOut += s; };
emb::set_stdout(writeStdOut);
emb::stdout_write_type writeStdErr = [&sStdOut] (std::string s) { sStdOut += s; };
emb::set_stderr(writeStdErr);
PyAppendSysPath( GetUsdPythonPathList() );
PySetEnvironmentVariable( L"PATH", GetUsdPath() );
PySetEnvironmentVariable( L"PYTHONPATH", GetUsdPythonPath() );
PySys_SetArgvEx( static_cast<int>(ArgV.size()), const_cast<TPyChar**>(&ArgV[0]), 1 );
PyObject* pMainModule = PyImport_AddModule("__main__");
PyObject* pGlobalDict = PyModule_GetDict(pMainModule);
CPyObject result = CPyObject( PyRun_String( pyScript.GetString(), Py_file_input, pGlobalDict, pGlobalDict ) );
HRESULT hr = S_OK;
if ( PyErr_Occurred() )
{
CPyException e;
if ( !e.IsExceptionSystemExit() )
{
CString sErrorMsg = e.tracebackW();
if ( sErrorMsg.IsEmpty() )
sErrorMsg.Format( _T( "[Error]\n%hs" ), e.what() );
if ( !sStdOut.empty() )
sErrorMsg.AppendFormat( _T( "\n\n[STDOUT]\n%hs" ), sStdOut.c_str() );
LogEventMessage( PYTHONTOOLS_CATEGORY, sErrorMsg.GetString(), LogEventType::Error );
hr = E_FAIL;
}
else
{
PySystemExitObject* pSystemExitObject = reinterpret_cast<PySystemExitObject*>(e.GetValue());
if ( pSystemExitObject && pSystemExitObject->code )
{
if ( PyLong_Check( pSystemExitObject->code ) )
{
exitCode = PyLong_AsLong( pSystemExitObject->code );
}
else if ( PyUnicode_Check( pSystemExitObject->code ) )
{
// unexpected
sStdOut += e.what();
exitCode = -1;
LogEventMessage( PYTHONTOOLS_CATEGORY, e.whatW(), LogEventType::Error );
hr = E_FAIL;
}
}
}
}
emb::reset_stdout();
emb::reset_stderr();
return hr;
}
STDMETHODIMP CUsdPythonToolsImpl::Record( IN BSTR usdStagePath, IN int imageWidth, IN BSTR renderer, OUT BSTR *outputImagePath )
{
DEBUG_RECORD_ENTRY();
HRESULT hr;
TPyChar sPathToHostExe[MAX_PATH];
#if PY_MAJOR_VERSION >= 3
::GetModuleFileNameW( nullptr, sPathToHostExe, ARRAYSIZE( sPathToHostExe ) );
#else
::GetModuleFileNameA( nullptr, sPathToHostExe, ARRAYSIZE( sPathToHostExe ) );
#endif
Py_SetProgramName( sPathToHostExe );
wchar_t sTempPath[MAX_PATH];
::GetTempPathW( ARRAYSIZE( sTempPath ), sTempPath );
wchar_t sTempFileName[MAX_PATH];
// search for a unique temp file name
std::vector<CStringW> tempFileList;
for ( ;; )
{
::GetTempFileNameW( sTempPath, L"usd", 0, sTempFileName );
tempFileList.push_back( sTempFileName );
::PathCchRenameExtension( sTempFileName, ARRAYSIZE( sTempFileName ), L"png" );
if ( GetFileAttributesW( sTempFileName ) == INVALID_FILE_ATTRIBUTES )
break;
}
// delete the temp files that GetTempFileNameW created
for ( const CStringW &str : tempFileList )
DeleteFileW( str );
std::string sStdOut;
CStringW sImageWidth;
sImageWidth.Format( L"%d", imageWidth );
// locate usdrecord
std::wstring sUsdRecordAbsolutePath = FindRelativeFile( L"usdrecord" );
if ( sUsdRecordAbsolutePath.empty() )
{
LogEventMessage( PYTHONTOOLS_CATEGORY, L"Failed to locate usdrecord", LogEventType::Error );
return E_FAIL;
}
std::vector<const TPyChar *> ArgV;
// Set the first argument as the absolute path to the usdrecord python script
// We will use argv[0] to load it using importlib
CW2Py pyUsdRecordAbsolutePath( sUsdRecordAbsolutePath.c_str() );
ArgV.push_back( pyUsdRecordAbsolutePath );
ArgV.push_back( _Tpy("--imageWidth") );
CW2Py pyImageWidth( sImageWidth );
ArgV.push_back( pyImageWidth );
CW2Py pyRenderer(renderer);
if ( renderer != nullptr && renderer[0] != '\0' )
{
ArgV.push_back( _Tpy("--renderer") );
ArgV.push_back( pyRenderer );
}
CW2Py pyUsdStagePath(usdStagePath);
ArgV.push_back( pyUsdStagePath );
CW2Py pyTempFileName(sTempFileName);
ArgV.push_back( pyTempFileName );
int exitCode = 0;
hr = RunResourcePythonScript( IDR_PYTHON_THUMBNAIL, ArgV, sStdOut, exitCode );
if ( FAILED( hr ) )
return hr;
if ( exitCode != 0 )
{
CString sErrorMsg;
sErrorMsg.Format( _T( "Error generating thumbnail for %ls\n\n%hs\n\nExit Code: %d" ), usdStagePath, sStdOut.c_str(), exitCode );
LogEventMessage( PYTHONTOOLS_CATEGORY, sErrorMsg.GetString(), LogEventType::Error );
return E_FAIL;
}
CComBSTR bstrOutputFile( sTempFileName );
*outputImagePath = bstrOutputFile.Detach();
return S_OK;
}
STDMETHODIMP CUsdPythonToolsImpl::View( IN BSTR usdStagePath, IN BSTR renderer )
{
DEBUG_RECORD_ENTRY();
HRESULT hr;
TPyChar sPathToHostExe[MAX_PATH];
#if PY_MAJOR_VERSION >= 3
::GetModuleFileNameW( nullptr, sPathToHostExe, ARRAYSIZE( sPathToHostExe ) );
#else
::GetModuleFileNameA( nullptr, sPathToHostExe, ARRAYSIZE( sPathToHostExe ) );
#endif
Py_SetProgramName( sPathToHostExe );
std::string sStdOut;
std::vector<const TPyChar *> ArgV;
ArgV.push_back( sPathToHostExe );
CW2Py pyRenderer(renderer);
if ( renderer != nullptr && renderer[0] != '\0' )
{
ArgV.push_back( _Tpy("--renderer") );
ArgV.push_back( pyRenderer );
}
CW2Py pyUsdStagePath(usdStagePath);
ArgV.push_back( pyUsdStagePath );
int exitCode = 0;
hr = RunDiskPythonScript( L"usdview", ArgV, sStdOut, exitCode );
if ( FAILED( hr ) )
return hr;
if ( exitCode != 0 )
{
CString sErrorMsg;
sErrorMsg.Format( _T( "Error launching usdview for %ls\n\n%hs\n\nExit Code: %d" ), usdStagePath, sStdOut.c_str(), exitCode );
LogEventMessage( PYTHONTOOLS_CATEGORY, sErrorMsg.GetString(), LogEventType::Error );
return E_FAIL;
}
return S_OK;
}
HRESULT WINAPI CUsdPythonToolsImpl::UpdateRegistry(_In_ BOOL bRegister) throw()
{
ATL::_ATL_REGMAP_ENTRY regMapEntries[] =
{
{ L"APPID", L"{8777F2C4-2318-408A-85D8-F65E15811971}" },
{ L"CLSID_USDPYTHONTOOLS", L"{67F43831-59C3-450E-8956-AA76273F3E9F}" },
{ nullptr, nullptr }
};
return g_AtlModule.UpdateRegistryFromResource(IDR_REGISTRY_USDTOOLSIMPL, bRegister, regMapEntries);
}
================================================
FILE: UsdPythonToolsServer/UsdPythonToolsImpl.h
================================================
// Copyright 2021 Activision Publishing, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include "UsdPythonToolsLocalServer_h.h"
#include "resource.h"
class ATL_NO_VTABLE CUsdPythonToolsImpl :
public IDispatchImpl<IUsdPythonTools, &IID_IUsdPythonTools, &LIBID_UsdPythonToolsLib, /*wMajor =*/ 1, /*wMinor =*/ 0>,
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CUsdPythonToolsImpl, &CLSID_UsdPythonTools>
{
public:
DECLARE_NOT_AGGREGATABLE(CUsdPythonToolsImpl)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP( CUsdPythonToolsImpl )
COM_INTERFACE_ENTRY( IUsdPythonTools )
COM_INTERFACE_ENTRY2( IDispatch, IUsdPythonTools )
END_COM_MAP()
HRESULT FinalConstruct();
void FinalRelease();
STDMETHODIMP Record( IN BSTR usdStagePath, IN int imageWidth, IN BSTR renderer, OUT BSTR *outputImagePath ) override;
STDMETHODIMP View( IN BSTR usdStagePath, IN BSTR renderer ) override;
static HRESULT WINAPI UpdateRegistry(_In_ BOOL bRegister) throw();
private:
};
OBJECT_ENTRY_AUTO( __uuidof(UsdPythonTools), CUsdPythonToolsImpl )
================================================
FILE: UsdPythonToolsServer/UsdPythonToolsImpl.rgs
================================================
HKCR
{
NoRemove CLSID
{
ForceRemove %CLSID_USDPYTHONTOOLS% = s 'Activision USD Python Tools Server'
{
LocalServer32 = s '%MODULE%'
val AppID = s '%APPID%'
}
}
}
================================================
FILE: UsdPythonToolsServer/UsdPythonToolsLocalServer.idl
================================================
// Copyright 2021 Activision Publishing, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import "oaidl.idl";
import "ocidl.idl";
[
uuid(88D2DCD9-4E41-49B1-B49A-4BD2942FE737),
helpstring("UsdPythonTools Type Library"),
version(1.0),
]
library UsdPythonToolsLib
{
[
uuid(A73B8191-52C6-416E-ADAF-B2D1572CB0FE)
]
struct UsdVariantPair
{
BSTR key;
VARIANT value;
};
[
uuid(36B7B0A6-E4FC-4728-86C1-05AFD6CFCA52),
object,
nonextensible,
oleautomation,
helpstring("IUsdPythonTools interface"),
dual
]
interface IUsdPythonTools : IDispatch
{
[helpstring("Launches usdrecord to generate a thumbnail of a USD stage.")]
HRESULT Record( [in] BSTR usdStagePath, [in] int imageWidth, [in, optional] BSTR renderer, [out, retval] BSTR* outputImagePath );
[helpstring("Launches usdview for a given USD stage.")]
HRESULT View( [in] BSTR usdStagePath, [in, optional] BSTR renderer );
}
[
uuid(67F43831-59C3-450E-8956-AA76273F3E9F),
helpstring("UsdPythonTools Server implementation")
]
coclass UsdPythonTools
{
[default] interface IUsdPythonTools;
}
};
================================================
FILE: UsdPythonToolsServer/UsdPythonToolsLocalServer.rc
================================================
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"1 TYPELIB ""USDPythonToolsLocalServer.tlb""\r\n"
"\r\n"
"#define ATVI_VERSION_DESCRIPTION ""Activision USD Python Tools Server""\r\n"
"#include ""atviversion.rc2""\r\n"
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// REGISTRY
//
IDR_REGISTRY_MODULE REGISTRY "USDPythonToolsLocalServerModule.rgs"
IDR_REGISTRY_USDTOOLSIMPL REGISTRY "UsdPythonToolsImpl.rgs"
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON_USD ICON "shared\\usd.ico"
/////////////////////////////////////////////////////////////////////////////
//
// PYTHON
//
IDR_PYTHON_THUMBNAIL PYTHON "UsdThumbnail.py"
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
1 TYPELIB "USDPythonToolsLocalServer.tlb"
#define ATVI_VERSION_DESCRIPTION "Activision USD Python Tools Server"
#include "atviversion.rc2"
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
================================================
FILE: UsdPythonToolsServer/UsdPythonToolsLocalServer.vcxproj
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{6AD79C79-3A9D-4C39-B028-C45072541C28}</ProjectGuid>
<RootNamespace>UsdPythonToolsLocalServer</RootNamespace>
<WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>false</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>false</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<Import Project="$(SolutionDir)\atviversion.props" />
<Import Project="$(SolutionDir)\python.props" />
<Import Project="$(SolutionDir)\boost.props" />
<PropertyGroup Label="PythonConfiguration">
<RegistryView>RegistryView.Registry32</RegistryView>
<RegistryView Condition="$(Platform) == 'x64'">RegistryView.Registry64</RegistryView>
<PythonTag>$(PythonVersion)-32</PythonTag>
<PythonTag Condition="$(Platform) == 'x64'">$(PythonVersion)</PythonTag>
<PythonHome Condition="$(PythonHome) == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\$(PythonTag)\InstallPath', null, null, $(RegistryView)))</PythonHome>
<PythonHome Condition="$(PythonHome) == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\$(PythonTag)\InstallPath', null, null, $(RegistryView)))</PythonHome>
<PythonExe Condition="$(PythonExe) == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\$(PythonTag)\InstallPath', 'ExecutablePath', null, $(RegistryView)))</PythonExe>
<PythonExe Condition="$(PythonExe) == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\$(PythonTag)\InstallPath', 'ExecutablePath', null, $(RegistryView)))</PythonExe>
<PythonExe Condition="$(PythonExe) == '' and $(PythonHome) != ''">$(PythonHome)python.exe</PythonExe>
<PythonDevVersion>$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\$(PythonTag)\InstalledFeatures', 'dev', null, $(RegistryView)))</PythonDevVersion>
<PythonDevVersion Condition="$(PythonDevVersion) == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\$(PythonTag)\InstalledFeatures', 'dev', null, $(RegistryView)))</PythonDevVersion>
<PythonCorePDBVersion>$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\$(PythonTag)\InstalledFeatures', 'core_pdb', null, $(RegistryView)))</PythonCorePDBVersion>
<PythonCorePDBVersion Condition="$(PythonCorePDBVersion) == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\$(PythonTag)\InstalledFeatures', 'core_pdb', null, $(RegistryView)))</PythonCorePDBVersion>
<PythonCoreDVersion>$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\$(PythonTag)\InstalledFeatures', 'core_d', null, $(RegistryView)))</PythonCoreDVersion>
<PythonCoreDVersion Condition="$(PythonCoreDVersion) == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\$(PythonTag)\InstalledFeatures', 'core_d', null, $(RegistryView)))</PythonCoreDVersion>
<PythonDebugSuffix Condition="$(PythonCoreDVersion) != ''">_d</PythonDebugSuffix>
<PythonDExe Condition="$(PythonExe) != '' and $(PythonDExe) == ''">$([System.IO.Path]::GetDirectoryName($(PythonExe)))\python$(PythonDebugSuffix).exe</PythonDExe>
<PythonDExe Condition="!Exists($(PythonDExe))">$(PythonExe)</PythonDExe>
</PropertyGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)bin\$(PlatformToolset)\$(PythonTag)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)build\$(PlatformToolset)\$(PythonTag)\$(Configuration)\$(ProjectName)\</IntDir>
<IgnoreImportLibrary>true</IgnoreImportLibrary>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)bin\$(PlatformToolset)\$(PythonTag)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)build\$(PlatformToolset)\$(PythonTag)\$(Configuration)\$(ProjectName)\</IntDir>
<IgnoreImportLibrary>true</IgnoreImportLibrary>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>false</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<AdditionalIncludeDirectories>$(SolutionDir);$(PythonHome)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Optimization>Disabled</Optimization>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>false</EnableCOMDATFolding>
<OptimizeReferences>false</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(PythonHome)libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>Pathcch.lib;%(AdditionalDependencies)</AdditionalDependencies>
<DelayLoadDLLs>
</DelayLoadDLLs>
</Link>
<ResourceCompile>
<AdditionalIncludeDirectories>$(OutDir);$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Midl>
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
<MkTypLibCompatible>false</MkTypLibCompatible>
<ValidateAllParameters>true</ValidateAllParameters>
<WarningLevel>0</WarningLevel>
<EnableErrorChecks>All</EnableErrorChecks>
<TypeLibraryName>$(OutDir)$(ProjectName).tlb</TypeLibraryName>
</Midl>
<PostBuildEvent>
<Command>%(Command)</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>false</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<AdditionalIncludeDirectories>$(SolutionDir);$(PythonHome)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>false</EnableCOMDATFolding>
<OptimizeReferences>false</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(PythonHome)libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>Pathcch.lib;%(AdditionalDependencies)</AdditionalDependencies>
<DelayLoadDLLs>
</DelayLoadDLLs>
</Link>
<ResourceCompile>
<AdditionalIncludeDirectories>$(OutDir);$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Midl>
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
<MkTypLibCompatible>false</MkTypLibCompatible>
<ValidateAllParameters>true</ValidateAllParameters>
<WarningLevel>0</WarningLevel>
<EnableErrorChecks>All</EnableErrorChecks>
<TypeLibraryName>$(OutDir)$(ProjectName).tlb</TypeLibraryName>
</Midl>
<PostBuildEvent>
<Command>%(Command)</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\shared\emb.h" />
<ClInclude Include="..\shared\environment.h" />
<ClInclude Include="..\shared\EventViewerLog.h" />
<ClInclude Include="..\shared\PythonUtil.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="Module.h" />
<ClInclude Include="UsdPythonToolsImpl.h" />
<ClInclude Include="UsdPythonToolsLocalServer_h.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\shared\emb.cpp" />
<ClCompile Include="..\shared\environment.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="Module.cpp" />
<ClCompile Include="UsdPythonToolsImpl.cpp" />
<ClCompile Include="UsdPythonToolsLocalServer_i.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="UsdPythonToolsImpl.rgs" />
<None Include="UsdPythonToolsLocalServerModule.rgs" />
<None Include="UsdThumbnail.py" />
</ItemGroup>
<ItemGroup>
<Midl Include="UsdPythonToolsLocalServer.idl" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="UsdPythonToolsLocalServer.rc" />
</ItemGroup>
<ItemGroup>
<Image Include="..\shared\usd.ico" />
<Image Include="shared\usd.ico" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\shared\EventViewerMessages.vcxproj">
<Project>{f12e597b-b731-4f5a-bec3-980d20159320}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
================================================
FILE: UsdPythonToolsServer/UsdPythonToolsLocalServer.vcxproj.filters
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Shared">
<UniqueIdentifier>{a27a5032-5dc7-4c59-b490-e65c0cc5fee0}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Module.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="UsdPythonToolsImpl.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="UsdPythonToolsLocalServer_h.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\shared\emb.h">
<Filter>Shared</Filter>
</ClInclude>
<ClInclude Include="..\shared\environment.h">
<Filter>Shared</Filter>
</ClInclude>
<ClInclude Include="..\shared\EventViewerLog.h">
<Filter>Shared</Filter>
</ClInclude>
<ClInclude Include="..\shared\PythonUtil.h">
<Filter>Shared</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Module.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="UsdPythonToolsImpl.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="UsdPythonToolsLocalServer_i.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\shared\emb.cpp">
<Filter>Shared</Filter>
</ClCompile>
<ClCompile Include="..\shared\environment.cpp">
<Filter>Shared</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="UsdPythonToolsImpl.rgs">
<Filter>Resource Files</Filter>
</None>
<None Include="UsdPythonToolsLocalServerModule.rgs">
<Filter>Resource Files</Filter>
</None>
<None Include="UsdThumbnail.py" />
</ItemGroup>
<ItemGroup>
<Midl Include="UsdPythonToolsLocalServer.idl">
<Filter>Source Files</Filter>
</Midl>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="UsdPythonToolsLocalServer.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Image Include="..\shared\usd.ico">
<Filter>Shared</Filter>
</Image>
<Image Include="shared\usd.ico">
<Filter>Resource Files</Filter>
</Image>
</ItemGroup>
</Project>
================================================
FILE: UsdPythonToolsServer/UsdPythonToolsLocalServerModule.rgs
================================================
HKCU
{
NoRemove AppID
{
'%APPID%' = s 'UsdPythonToolsLocalServer'
'UsdPythonToolsLocalServer.exe'
{
val AppID = s '%APPID%'
}
}
}
================================================
FILE: UsdPythonToolsServer/UsdThumbnail.py
================================================
# Copyright 2021 Activision Publishing, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This is a fix for USD issue #1521
# https://github.com/PixarAnimationStudios/USD/issues/1521
import sys
try:
from importlib.util import spec_from_loader, module_from_spec
from importlib.machinery import SourceFileLoader
except ImportError:
import imp
def _SetupOpenGLContextFix(width=100, height=100):
try:
from PySide2 import QtOpenGL
from PySide2.QtWidgets import QApplication
from PySide2 import QtCore # Activision Change
except ImportError:
from PySide import QtOpenGL
from PySide.QtGui import QApplication
from PySide import QtCore # Activision Change
application = QApplication(sys.argv)
glFormat = QtOpenGL.QGLFormat()
glFormat.setSampleBuffers(True)
glFormat.setSamples(4)
glWidget = QtOpenGL.QGLWidget(glFormat)
glWidget.setFixedSize(width, height)
# BEGIN - Activision Change
glWidget.setAttribute( QtCore.Qt.WA_DontShowOnScreen )
# END - Activision Change
glWidget.show()
glWidget.setHidden(True)
return glWidget
def main():
try:
spec = spec_from_loader("usdrecord", SourceFileLoader("usdrecord", sys.argv[0]))
usdrecord = module_from_spec(spec)
spec.loader.exec_module(usdrecord)
except:
usdrecord = imp.load_source('usdrecord', sys.argv[0])
usdrecord._SetupOpenGLContext = _SetupOpenGLContextFix
return usdrecord.main()
if __name__ == '__main__':
sys.exit(main())
================================================
FILE: UsdPythonToolsServer/resource.h
================================================
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by UsdPythonToolsLocalServer.rc
//
#define IDR_REGISTRY_MODULE 101
#define IDR_REGISTRY_USDTOOLSIMPL 102
#define IDI_ICONUSD 106
#define IDI_ICON_USD 106
#define IDR_PYTHON_PREVIEWHANLDER 107
#define IDR_REGISTRY_THUMBNAILIMPL 108
#define IDR_REGISTRY_USDTHUMBNAILIMPL 108
#define IDD_DIALOG1 109
#define IDR_PYTHON1 111
#define IDR_PYTHON_THUMBNAIL 111
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 112
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1004
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
================================================
FILE: UsdPythonToolsServer/stdafx.cpp
================================================
// Copyright 2021 Activision Publishing, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "stdafx.h"
================================================
FILE: UsdPythonToolsServer/stdafx.h
================================================
// Copyright 2021 Activision Publishing, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#ifndef STRICT
#define STRICT
#endif
#pragma warning(push)
#pragma warning(disable: 4244 4459)
#include <boost/python/module.hpp>
#include <boost/python/def.hpp>
#include <boost/python/list.hpp>
#include <boost/python.hpp>
#pragma warning(pop)
#include <WinSDKVer.h>
#define _WIN32_WINNT 0x0A00
#include <SDKDDKVer.h>
#define _ATL_APARTMENT_THREADED
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
#define ATL_NO_ASSERT_ON_DESTROY_NONEXISTENT_WINDOW
// Use the C++ standard templated min/max
#define NOMINMAX
#define NOBITMAP
// Include <mcx.h> if you need this
#define NOMCX
// Include <winsvc.h> if you need this
#define NOSERVICE
#include <windows.h>
#include <PathCch.h>
#include <atlbase.h>
#include <atlcom.h>
#include <atlconv.h>
#include <atlctl.h>
#include <atlstr.h>
#include <atlsafe.h>
#include <comutil.h>
#include <stdint.h>
#include <conio.h>
================================================
FILE: UsdSdkToolsServer/Module.cpp
================================================
// Copyright 2021 Activision Publishing, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "stdafx.h"
#include "Module.h"
HMODULE g_hInstance;
CUsdSdkToolsLocalServerModule g_AtlModule;
CString g_DebugIUsdSdkToolsMethod;
extern "C" int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nShowCmd)
{
UNREFERENCED_PARAMETER( hPrevInstance );
UNREFERENCED_PARAMETER( lpCmdLine );
UNREFERENCED_PARAMETER( nShowCmd );
g_hInstance = hInstance;
int nResult = g_AtlModule.WinMain( nShowCmd );
return nResult;
}
================================================
FILE: UsdSdkToolsServer/Module.h
================================================
// Copyright 2021 Activision Publishing, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include "UsdSdkToolsLocalServer_h.h"
#include "resource.h"
// Using an ATL module here because it removes a lot of the
// boiler-plate COM work that we would have to implement ourselves.
class CUsdSdkToolsLocalServerModule : public CAtlExeModuleT<CUsdSdkToolsLocalServerModule>
{
public:
DECLARE_LIBID( LIBID_UsdSdkToolsLib )
DECLARE_REGISTRY_APPID_RESOURCEID( IDR_REGISTRY_MODULE, "{123A65E6-B4B4-4B46-BEF5-D0FCE7173261}" )
// Override CAtlExeModuleT::PreMessageLoop to change REGCLS_MULTIPLEUSE to REGCLS_SINGLEUSE.
// REGCLS_SINGLEUSE will create a new Windows process for every instance of our COM classes,
// REGCLS_MULTIPLEUSE will reuse the same Windows process.
HRESULT PreMessageLoop( _In_ int /*nShowCmd*/ ) throw()
{
HRESULT hr = S_OK;
CUsdSdkToolsLocalServerModule* pT = static_cast<CUsdSdkToolsLocalServerModule*>(this);
#ifndef _ATL_NO_COM_SUPPORT
hr = pT->RegisterClassObjects(CLSCTX_LOCAL_SERVER,
REGCLS_SINGLEUSE | // <- !!!
REGCLS_SUSPENDED);
if (FAILED(hr))
return hr;
if (hr == S_OK)
{
if (m_bDelayShutdown)
{
CHandle h(pT->StartMonitor());
if (h.m_h == NULL)
{
hr = E_FAIL;
}
else
{
hr = CoResumeClassObjects();
ATLASSERT(SUCCEEDED(hr));
if (FAILED(hr))
{
::SetEvent(m_hEventShutdown); // tell monitor to shutdown
::WaitForSingleObject(h, m_dwTimeOut * 2);
}
}
}
else
{
hr = CoResumeClassObjects();
ATLASSERT(SUCCEEDED(hr));
}
if (FAILED(hr))
pT->RevokeClassObjects();
}
else
{
m_bDelayShutdown = false;
}
#endif // _ATL_NO_COM_SUPPORT
ATLASSERT(SUCCEEDED(hr));
return hr;
}
};
extern CUsdSdkToolsLocalServerModule g_AtlModule;
extern HMODULE g_hInstance;
// Helpful for debugging zombie processes.
// Set to the last method that was called in IUsdSdkTools
extern CString g_DebugIUsdSdkToolsMethod;
#define DEBUG_RECORD_ENTRY() \
g_DebugIUsdSdkToolsMethod = _T(__FUNCTION__)
================================================
FILE: UsdSdkToolsServer/UsdSdkToolsImpl.cpp
================================================
// Copyright 2021 Activision Publishing, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "stdafx.h"
#include "UsdSdkToolsImpl.h"
#include "Module.h"
#include "shared\environment.h"
#include "shared\EventViewerLog.h"
#include <vector>
HRESULT CUsdSdkToolsImpl::FinalConstruct()
{
SetupPythonEnvironment( g_hInstance );
return __super::FinalConstruct();
}
void CUsdSdkToolsImpl::FinalRelease()
{
__super::FinalRelease();
}
static void RegisterUsdPlugins()
{
static bool sUsdPluginsRegistered = false;
static std::mutex sUsdPluginsRegisteredLock;
std::lock_guard<std::mutex> guard( sUsdPluginsRegisteredLock );
// Plugins should be registered only once per session.
if( sUsdPluginsRegistered )
return;
sUsdPluginsRegistered = true;
TCHAR sModulePath[MAX_PATH];
GetModuleFileName( g_hInstance, sModulePath, ARRAYSIZE( sModulePath ) );
std::vector<std::string> pathsToPlugInfo;
// add the folder that contains the shell extension
PathCchRemoveFileSpec( sModulePath, ARRAYSIZE( sModulePath ) );
pathsToPlugInfo.push_back( static_cast<LPCSTR>(ATL::CW2A(sModulePath, CP_UTF8)) );
// add the bare-bones usd plugins
PathCchAppend( sModulePath, ARRAYSIZE( sModulePath ), L"usd" );
pathsToPlugInfo.push_back( static_cast<LPCSTR>(ATL::CW2A(sModulePath, CP_UTF8)) );
pxr::PlugRegistry::GetInstance().RegisterPlugins( pathsToPlugInfo );
pxr::ArSetPreferredResolver( "ArResolverShellExtension" );
}
STDMETHODIMP CUsdSdkToolsImpl::Cat( IN BSTR usdStagePathInput, IN BSTR usdStagePathOuput, IN eUsdFormat formatOutput, IN VARIANT_BOOL flatten )
{
DEBUG_RECORD_ENTRY();
RegisterUsdPlugins();
pxr::SdfLayer::FileFormatArguments fileFormat;
if ( formatOutput == USD_FORMAT_USDA )
fileFormat["target"] = "usda";
else if ( formatOutput == USD_FORMAT_USDC )
fileFormat["target"] = "usdc";
if ( flatten == VARIANT_FALSE )
{
std::string usdStagePathInputA = static_cast<LPCSTR>(ATL::CW2A( usdStagePathInput, CP_UTF8 ));
pxr::SdfLayerRefPtr rootLayer = pxr::SdfLayer::OpenAsAnonymous( usdStagePathInputA, false );
if ( rootLayer == nullptr )
return E_FAIL;
std::string usdStagePathOuputA = static_cast<LPCSTR>(ATL::CW2A( usdStagePathOuput, CP_UTF8 ));
if ( !rootLayer->Export( usdStagePathOuputA, std::string(), fileFormat ) )
return E_FAIL;
}
else
{
std::string usdStagePathInputA = static_cast<LPCSTR>(ATL::CW2A( usdStagePathInput, CP_UTF8 ));
pxr::UsdStageRefPtr stage = pxr::UsdStage::Open( usdStagePathInputA );
if ( stage == nullptr )
return E_FAIL;
stage->Flatten();
std::string usdStagePathOuputA = static_cast<LPCSTR>(ATL::CW2A( usdStagePathOuput, CP_UTF8 ));
if ( !stage->Export( usdStagePathOuputA, true, fileFormat ) )
return E_FAIL;
}
return S_OK;
}
STDMETHODIMP CUsdSdkToolsImpl::Edit( IN BSTR usdStagePath, IN VARIANT_BOOL force )
{
DEBUG_RECORD_ENTRY();
RegisterUsdPlugins();
DWORD inputFileAttribs = GetFileAttributes( usdStagePath );
if ( inputFileAttribs == INVALID_FILE_ATTRIBUTES )
return E_INVALIDARG;
std::string usdStagePathA = static_cast<LPCSTR>(ATL::CW2A( usdStagePath, CP_UTF8 ));
pxr::SdfLayerRefPtr rootLayer = pxr::SdfLayer::OpenAsAnonymous( usdStagePathA, false );
if ( rootLayer == nullptr )
return E_FAIL;
CStringW usdStagePathOuputW;
usdStagePathOuputW = usdStagePath;
usdStagePathOuputW += L"-edit.usda";
std::string exportString;
if ( !rootLayer->ExportToString( &exportString ) )
return E_FAIL;
std::ofstream fileOut(usdStagePathOuputW.GetString(), std::ofstream::out|std::ofstream::trunc);
if (!fileOut.is_open())
return E_FAIL;
fileOut << exportString;
fileOut.close();
WIN32_FILE_ATTRIBUTE_DATA wfadBefore = {};
::GetFileAttributesEx( usdStagePathOuputW, GetFileExInfoStandard, &wfadBefore );
// hide the file we're editing
::SetFileAttributes( usdStagePathOuputW, wfadBefore.dwFileAttributes | FILE_ATTRIBUTE_HIDDEN );
CStringW sEditor = GetUsdEditor();
if ( sEditor.IsEmpty() )
sEditor = L"notepad.exe";
CStringW sCommandLine;
sCommandLine.Format( L"%s \"%s\"", sEditor.GetString(), usdStagePathOuputW.GetString() );
STARTUPINFO si = {};
si.cb = sizeof( si );
PROCESS_INFORMATION pi = {};
if ( !::CreateProcess( nullptr, sCommandLine.GetBuffer(), nullptr, nullptr, FALSE, 0, nullptr, nullptr, &si, &pi ) )
{
return E_FAIL;
}
::WaitForSingleObject( pi.hProcess, INFINITE );
::CloseHandle( pi.hProcess );
::CloseHandle( pi.hThread );
WIN32_FILE_ATTRIBUTE_DATA wfadAfter = {};
::GetFileAttributesEx( usdStagePathOuputW, GetFileExInfoStandard, &wfadAfter );
if ( ::CompareFileTime( &wfadAfter.ftLastWriteTime, &wfadBefore.ftLastWriteTime ) != 0 )
{
if ( (inputFileAttribs & FILE_ATTRIBUTE_READONLY) )
{
if ( force == VARIANT_FALSE )
{
::DeleteFileW( usdStagePathOuputW );
return S_OK;
}
::SetFileAttributes( usdStagePath, inputFileAttribs & ~FILE_ATTRIBUTE_READONLY );
}
std::ifstream fileIn(usdStagePathOuputW.GetString(), std::ifstream::in);
if (!fileIn.is_open())
return E_FAIL;
std::ostringstream importString;
importString << fileIn.rdbuf();
fileIn.close();
if ( rootLayer->ImportFromString( importString.str() ) == false )
return E_FAIL;
if ( rootLayer->Export( usdStagePathA ) == false )
return E_FAIL;
}
::DeleteFileW( usdStagePathOuputW );
return S_OK;
}
static void pause()
{
std::cout << std::endl;
std::cout << "Press any key to continue..." << std::endl;
_getch();
}
STDMETHODIMP CUsdSdkToolsImpl::Package( IN BSTR usdStagePathInput, IN BSTR usdStagePathOuput, IN eUsdPackageType packageType, IN VARIANT_BOOL verbose )
{
DEBUG_RECORD_ENTRY();
// create and display a console
if (AllocConsole())
{
FILE *fout = nullptr;
freopen_s(&fout, "CONOUT$", "w", stdout);
FILE *ferr = nullptr;
freopen_s(&ferr, "CONOUT$", "w", stderr);
}
SetConsoleTitleW( L"USD Package" );
// ask the user to press a key to exit
atexit( pause );
RegisterUsdPlugins();
if ( verbose != VARIANT_FALSE )
pxr::TfDebug::SetDebugSymbolsByName( "USDUTILS_CREATE_USDZ_PACKAGE", 1 );
DWORD inputFileAttribs = GetFileAttributes( usdStagePathInput );
if ( inputFileAttribs == INVALID_FILE_ATTRIBUTES )
return E_INVALIDARG;
std::string usdStagePathInputA = static_cast<LPCSTR>(ATL::CW2A( usdStagePathInput, CP_UTF8 ));
std::string usdStagePathOuputA = static_cast<LPCSTR>(ATL::CW2A( usdStagePathOuput, CP_UTF8 ));
if ( packageType == USD_PACKAGE_DEFAULT )
{
if ( !pxr::UsdUtilsCreateNewUsdzPackage( pxr::SdfAssetPath( usdStagePathInputA ), usdStagePathOuputA ) )
return E_FAIL;
}
else if( packageType == USD_FORMAT_APPLE_ARKIT )
{
if ( !pxr::UsdUtilsCreateNewARKitUsdzPackage( pxr::SdfAssetPath( usdStagePathInputA ), usdStagePathOuputA ) )
return E_FAIL;
}
else
{
return E_INVALIDARG;
}
return S_OK;
}
static void PrintDictionary( const pxr::VtDictionary &dict, int indent )
{
for ( const std::pair<std::string, pxr::VtValue>& stat : dict )
{
for ( int i = 0; i < indent; ++i )
std::cout << " ";
if ( stat.second.GetTypeid() == typeid(pxr::VtDictionary) )
{
std::cout << stat.first << std::endl;
pxr::VtDictionary nestedDict = stat.second.Get<pxr::VtDictionary>();
PrintDictionary( nestedDict, indent + 1 );
}
else
{
if ( stat.second.GetTypeid() == typeid(size_t) )
std::cout << stat.first << " = " << stat.second.Get<size_t>() << std::endl;
else if ( stat.second.GetTypeid() == typeid(double) )
std::cout << stat.first << " = " << stat.second.Get<double>() << std::endl;
else
std::cout << stat.first << " = " << "[UNKNOWN TYPE]" << std::endl;
}
}
}
STDMETHODIMP CUsdSdkToolsImpl::DisplayStageStats( IN BSTR usdStagePath )
{
DEBUG_RECORD_ENTRY();
// create and display a console
if (AllocConsole())
{
FILE *fout = nullptr;
freopen_s(&fout, "CONOUT$", "w", stdout);
FILE *ferr = nullptr;
freopen_s(&ferr, "CONOUT$", "w", stderr);
}
SetConsoleTitleW( L"USD Stage Stats" );
// ask the user to press a key to exit
atexit( pause );
RegisterUsdPlugins();
std::string sError;
pxr::TfMallocTag::Initialize( &sError );
std::string usdStagePathA = static_cast<LPCSTR>(ATL::CW2A( usdStagePath, CP_UTF8 ));
std::cout << usdStagePathA << std::endl;
std::cout << std::endl;
pxr::VtDictionary dictStats;
pxr::UsdStageRefPtr stage = pxr::UsdUtilsComputeUsdStageStats( usdStagePathA, &dictStats );
if ( stage == nullptr )
return E_FAIL;
PrintDictionary( dictStats, 0 );
return S_OK;
}
HRESULT WINAPI CUsdSdkToolsImpl::UpdateRegistry(_In_ BOOL bRegister) throw()
{
ATL::_ATL_REGMAP_ENTRY regMapEntries[] =
{
{ L"APPID", L"{123A65E6-B4B4-4B46-BEF5-D0FCE7173261}" },
{ L"CLSID_USDSDKTOOLS", L"{5F016739-AF12-4899-B710-3FB5C242A11D}" },
{ nullptr, nullptr }
};
return g_AtlModule.UpdateRegistryFromResource(IDR_REGISTRY_USDTOOLSIMPL, bRegister, regMapEntries);
}
================================================
FILE: UsdSdkToolsServer/UsdSdkToolsImpl.h
================================================
// Copyright 2021 Activision Publishing, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include "UsdSdkToolsLocalServer_h.h"
#include "resource.h"
class ATL_NO_VTABLE CUsdSdkToolsImpl :
public IDispatchImpl<IUsdSdkTools, &IID_IUsdSdkTools, &LIBID_UsdSdkToolsLib, /*wMajor =*/ 1, /*wMinor =*/ 0>,
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CUsdSdkToolsImpl, &CLSID_UsdSdkTools>
{
public:
DECLARE_NOT_AGGREGATABLE(CUsdSdkToolsImpl)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP( CUsdSdkToolsImpl )
COM_INTERFACE_ENTRY( IUsdSdkTools )
COM_INTERFACE_ENTRY2( IDispatch, IUsdSdkTools )
END_COM_MAP()
HRESULT FinalConstruct();
void FinalRelease();
STDMETHODIMP Cat( IN BSTR usdStagePathInput, IN BSTR usdStagePathOuput, IN eUsdFormat formatOutput = USD_FORMAT_INPUT, IN VARIANT_BOOL flatten = 0 ) override;
STDMETHODIMP Edit( IN BSTR usdStagePath, IN VARIANT_BOOL force = 0 ) override;
STDMETHODIMP Package( IN BSTR usdStagePathInput, IN BSTR usdStagePathOuput, IN eUsdPackageType packageType = USD_PACKAGE_DEFAULT, IN VARIANT_BOOL verbose = 0 ) override;
STDMETHODIMP DisplayStageStats( IN BSTR usdStagePath ) override;
static HRESULT WINAPI UpdateRegistry(_In_ BOOL bRegister) throw();
private:
};
OBJECT_ENTRY_AUTO( __uuidof(UsdSdkTools), CUsdSdkToolsImpl )
================================================
FILE: UsdSdkToolsServer/UsdSdkToolsImpl.rgs
================================================
HKCR
{
NoRemove CLSID
{
ForceRemove %CLSID_USDSDKTOOLS% = s 'Activision USD SDK Tools Server'
{
LocalServer32 = s '%MODULE%'
val AppID = s '%APPID%'
}
}
}
================================================
FILE: UsdSdkToolsServer/UsdSdkToolsLocalServer.idl
================================================
// Copyright 2021 Activision Publishing, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import "oaidl.idl";
import "ocidl.idl";
typedef [uuid(B397354A-F5D9-4835-B584-9524749F7B63), helpstring("USD Format")]
enum eUsdFormat
{
[helpstring("Same as input file")]
USD_FORMAT_INPUT,
[helpstring("ASCII")]
USD_FORMAT_USDA,
[helpstring("Crate")]
USD_FORMAT_USDC,
} eUsdFormat;
typedef [uuid(266D173D-4142-4CA1-BF25-EC9BC61FDE6A), helpstring("USDZ Package Type")]
enum eUsdPackageType
{
[helpstring("Default USDZ package.")]
USD_PACKAGE_DEFAULT,
[helpstring("Apple ARKit USDZ package.")]
USD_FORMAT_APPLE_ARKIT
} eUsdPackageType;
[
uuid(F68344A7-0343-4064-8DA9-7A2ECF6C2D2A),
object,
nonextensible,
oleautomation,
helpstring("IUsdSdkTools interface"),
dual
]
interface IUsdSdkTools : IDispatch
{
[helpstring("Converts between the various USD file formats.")]
HRESULT Cat( [in] BSTR usdStagePathInput, [in] BSTR usdStagePathOuput, [in, defaultvalue(USD_FORMAT_INPUT)] eUsdFormat formatOutput, [in, defaultvalue(0)] VARIANT_BOOL flatten);
[helpstring("Launches a text editor for a given USD stage.")]
HRESULT Edit( [in] BSTR usdStagePath, [in, defaultvalue(0)] VARIANT_BOOL forcewrite);
[helpstring("Converts a USD stage to a USD package.")]
HRESULT Package( [in] BSTR usdStagePathInput, [in] BSTR usdStagePathOuput, [in, defaultvalue(USD_PACKAGE_DEFAULT)] eUsdPackageType packageType, [in, defaultvalue(0)] VARIANT_BOOL verbose );
[helpstring("Displays stats about the USD stage.")]
HRESULT DisplayStageStats( [in] BSTR usdStagePath );
}
[
uuid(7704E595-537E-41A0-AF52-53EA2941A773),
helpstring("UsdSdkTools Type Library"),
version(1.0),
]
library UsdSdkToolsLib
{
[
uuid(5F016739-AF12-4899-B710-3FB5C242A11D),
helpstring("UsdSdkTools Server implementation")
]
coclass UsdSdkTools
{
[default] interface IUsdSdkTools;
}
};
================================================
FILE: UsdSdkToolsServer/UsdSdkToolsLocalServer.rc
================================================
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"1 TYPELIB ""UsdSdkToolsLocalServer.tlb""\r\n"
"\r\n"
"#define ATVI_VERSION_DESCRIPTION ""Activision USD SDK Tools Server""\r\n"
"#include ""atviversion.rc2""\r\n"
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// REGISTRY
//
IDR_REGISTRY_MODULE REGISTRY "UsdSdkToolsLocalServerModule.rgs"
IDR_REGISTRY_USDTOOLSIMPL REGISTRY "UsdSdkToolsImpl.rgs"
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON_USD ICON "shared\\usd.ico"
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
1 TYPELIB "UsdSdkToolsLocalServer.tlb"
#define ATVI_VERSION_DESCRIPTION "Activision USD SDK Tools Server"
#include "atviversion.rc2"
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
================================================
FILE: UsdSdkToolsServer/UsdSdkToolsLocalServer.vcxproj
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{EA717BDA-3304-439B-BEC8-408D9CE9F3FB}</ProjectGuid>
<RootNamespace>UsdSdkToolsLocalServer</RootNamespace>
<WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>false</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>false</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<Import Project="$(SolutionDir)\atviversion.props" />
<Import Project="$(SolutionDir)\python.props" />
<Import Project="$(SolutionDir)\usd.props" />
<PropertyGroup Label="PythonConfiguration">
<RegistryView>RegistryView.Registry32</RegistryView>
<RegistryView Condition="$(Platform) == 'x64'">RegistryView.Registry64</RegistryView>
<PythonTag>$(PythonVersion)-32</PythonTag>
<PythonTag Condition="$(Platform) == 'x64'">$(PythonVersion)</PythonTag>
<PythonHome Condition="$(PythonHome) == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\$(PythonTag)\InstallPath', null, null, $(RegistryView)))</PythonHome>
<PythonHome Condition="$(PythonHome) == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\$(PythonTag)\InstallPath', null, null, $(RegistryView)))</PythonHome>
<PythonExe Condition="$(PythonExe) == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\$(PythonTag)\InstallPath', 'ExecutablePath', null, $(RegistryView)))</PythonExe>
<PythonExe Condition="$(PythonExe) == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\$(PythonTag)\InstallPath', 'ExecutablePath', null, $(RegistryView)))</PythonExe>
<PythonExe Condition="$(PythonExe) == '' and $(PythonHome) != ''">$(PythonHome)python.exe</PythonExe>
<PythonDevVersion>$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\$(PythonTag)\InstalledFeatures', 'dev', null, $(RegistryView)))</PythonDevVersion>
<PythonDevVersion Condition="$(PythonDevVersion) == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\$(PythonTag)\InstalledFeatures', 'dev', null, $(RegistryView)))</PythonDevVersion>
<PythonCorePDBVersion>$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\$(PythonTag)\InstalledFeatures', 'core_pdb', null, $(RegistryView)))</PythonCorePDBVersion>
<PythonCorePDBVersion Condition="$(PythonCorePDBVersion) == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\$(PythonTag)\InstalledFeatures', 'core_pdb', null, $(RegistryView)))</PythonCorePDBVersion>
<PythonCoreDVersion>$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\$(PythonTag)\InstalledFeatures', 'core_d', null, $(RegistryView)))</PythonCoreDVersion>
<PythonCoreDVersion Condition="$(PythonCoreDVersion) == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\$(PythonTag)\InstalledFeatures', 'core_d', null, $(RegistryView)))</PythonCoreDVersion>
<PythonDebugSuffix Condition="$(PythonCoreDVersion) != ''">_d</PythonDebugSuffix>
<PythonDExe Condition="$(PythonExe) != '' and $(PythonDExe) == ''">$([System.IO.Path]::GetDirectoryName($(PythonExe)))\python$(PythonDebugSuffix).exe</PythonDExe>
<PythonDExe Condition="!Exists($(PythonDExe))">$(PythonExe)</PythonDExe>
</PropertyGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)bin\$(PlatformToolset)\$(PythonTag)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)build\$(PlatformToolset)\$(PythonTag)\$(Configuration)\$(ProjectName)\</IntDir>
<IgnoreImportLibrary>true</IgnoreImportLibrary>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)bin\$(PlatformToolset)\$(PythonTag)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)build\$(PlatformToolset)\$(PythonTag)\$(Configuration)\$(ProjectName)\</IntDir>
<IgnoreImportLibrary>true</IgnoreImportLibrary>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>false</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<AdditionalIncludeDirectories>$(SolutionDir);$(PythonHome)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Optimization>Disabled</Optimization>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>false</EnableCOMDATFolding>
<OptimizeReferences>false</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(PythonHome)libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>Pathcch.lib;%(AdditionalDependencies)</AdditionalDependencies>
<DelayLoadDLLs>
</DelayLoadDLLs>
</Link>
<ResourceCompile>
<AdditionalIncludeDirectories>$(OutDir);$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Midl>
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
<MkTypLibCompatible>false</MkTypLibCompatible>
<ValidateAllParameters>true</ValidateAllParameters>
<WarningLevel>0</WarningLevel>
<EnableErrorChecks>All</EnableErrorChecks>
<TypeLibraryName>$(OutDir)$(ProjectName).tlb</TypeLibraryName>
</Midl>
<PostBuildEvent>
<Command>%(Command)</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>false</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<AdditionalIncludeDirectories>$(SolutionDir);$(PythonHome)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>false</EnableCOMDATFolding>
<OptimizeReferences>false</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(PythonHome)libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>Pathcch.lib;%(AdditionalDependencies)</AdditionalDependencies>
<DelayLoadDLLs>
</DelayLoadDLLs>
</Link>
<ResourceCompile>
<AdditionalIncludeDirectories>$(OutDir);$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Midl>
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
<MkTypLibCompatible>false</MkTypLibCompatible>
<ValidateAllParameters>true</ValidateAllParameters>
<WarningLevel>0</WarningLevel>
<EnableErrorChecks>All</EnableErrorChecks>
<TypeLibraryName>$(OutDir)$(ProjectName).tlb</TypeLibraryName>
</Midl>
<PostBuildEvent>
<Command>%(Command)</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\shared\environment.h" />
<ClInclude Include="..\shared\EventViewerLog.h" />
<ClInclude Include="..\shared\EventViewerMessages.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="Module.h" />
<ClInclude Include="UsdSdkToolsImpl.h" />
<ClInclude Include="UsdSdkToolsLocalServer_h.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\shared\environment.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="Module.cpp" />
<ClCompile Include="UsdSdkToolsImpl.cpp" />
<ClCompile Include="UsdSdkToolsLocalServer_i.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="UsdSdkToolsImpl.rgs" />
<None Include="UsdSdkToolsLocalServerModule.rgs" />
</ItemGroup>
<ItemGroup>
<Midl Include="UsdSdkToolsLocalServer.idl" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="UsdSdkToolsLocalServer.rc" />
</ItemGroup>
<ItemGroup>
<Image Include="..\shared\usd.ico" />
<Image Include="shared\usd.ico" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\shared\EventViewerMessages.vcxproj">
<Project>{f12e597b-b731-4f5a-bec3-980d20159320}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
================================================
FILE: UsdSdkToolsServer/UsdSdkToolsLocalServer.vcxproj.filters
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Shared">
<UniqueIdentifier>{a27a5032-5dc7-4c59-b490-e65c0cc5fee0}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Module.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\shared\environment.h">
<Filter>Shared</Filter>
</ClInclude>
<ClInclude Include="..\shared\EventViewerLog.h">
<Filter>Shared</Filter>
</ClInclude>
<ClInclude Include="UsdSdkToolsImpl.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="UsdSdkToolsLocalServer_h.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\shared\EventViewerMessages.h">
<Filter>Shared</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Module.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\shared\environment.cpp">
<Filter>Shared</Filter>
</ClCompile>
<ClCompile Include="UsdSdkToolsImpl.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="UsdSdkToolsLocalServer_i.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="UsdSdkToolsImpl.rgs">
<Filter>Resource Files</Filter>
</None>
<None Include="UsdSdkToolsLocalServerModule.rgs">
<Filter>Resource Files</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Midl Include="UsdSdkToolsLocalServer.idl">
<Filter>Source Files</Filter>
</Midl>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="UsdSdkToolsLocalServer.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Image Include="..\shared\usd.ico">
<Filter>Shared</Filter>
</Image>
<Image Include="shared\usd.ico">
<Filter>Resource Files</Filter>
</Image>
</ItemGroup>
</Project>
================================================
FILE: UsdSdkToolsServer/UsdSdkToolsLocalServerModule.rgs
================================================
HKCU
{
NoRemove AppID
{
'%APPID%' = s 'UsdSdkToolsLocalServer'
'UsdSdkToolsLocalServer.exe'
{
val AppID = s '%APPID%'
}
}
}
================================================
FILE: UsdSdkToolsServer/resource.h
================================================
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by UsdSdkToolsLocalServer.rc
//
#define IDR_REGISTRY_MODULE 101
#define IDR_REGISTRY_USDTOOLSIMPL 102
#define IDI_ICONUSD 106
#define IDI_ICON_USD 106
#define IDR_PYTHON_PREVIEWHANLDER 107
#define IDR_REGISTRY_THUMBNAILIMPL
gitextract_0s2b2fo_/ ├── .gitignore ├── BUILDING.md ├── CONTRIBUTING.txt ├── LICENSE.txt ├── NOTICE.txt ├── README.md ├── UsdPreviewHandlerPython/ │ ├── Module.cpp │ ├── Module.h │ ├── StageViewWnd.cpp │ ├── StageViewWnd.h │ ├── UsdPreviewHandlerEvent.h │ ├── UsdPreviewHandlerMgr.cpp │ ├── UsdPreviewHandlerMgr.h │ ├── UsdPreviewHandlerPython.rc │ ├── UsdPreviewHandlerPython.vcxproj │ ├── UsdPreviewHandlerPython.vcxproj.filters │ ├── pyUsdPreviewHandler.cpp │ ├── resource.h │ ├── stdafx.cpp │ └── stdafx.h ├── UsdPreviewHandlerServer/ │ ├── Module.cpp │ ├── Module.h │ ├── UsdPreviewHandlerImpl.cpp │ ├── UsdPreviewHandlerImpl.h │ ├── UsdPreviewHandlerImpl.rgs │ ├── UsdPreviewHandlerPython.py │ ├── UsdPreviewLocalServer.idl │ ├── UsdPreviewLocalServer.rc │ ├── UsdPreviewLocalServer.vcxproj │ ├── UsdPreviewLocalServer.vcxproj.filters │ ├── UsdPreviewLocalServerModule.rgs │ ├── UsdPreviewThread.cpp │ ├── UsdPreviewThread.h │ ├── resource.h │ ├── stdafx.cpp │ └── stdafx.h ├── UsdPythonToolsServer/ │ ├── Module.cpp │ ├── Module.h │ ├── UsdPythonToolsImpl.cpp │ ├── UsdPythonToolsImpl.h │ ├── UsdPythonToolsImpl.rgs │ ├── UsdPythonToolsLocalServer.idl │ ├── UsdPythonToolsLocalServer.rc │ ├── UsdPythonToolsLocalServer.vcxproj │ ├── UsdPythonToolsLocalServer.vcxproj.filters │ ├── UsdPythonToolsLocalServerModule.rgs │ ├── UsdThumbnail.py │ ├── resource.h │ ├── stdafx.cpp │ └── stdafx.h ├── UsdSdkToolsServer/ │ ├── Module.cpp │ ├── Module.h │ ├── UsdSdkToolsImpl.cpp │ ├── UsdSdkToolsImpl.h │ ├── UsdSdkToolsImpl.rgs │ ├── UsdSdkToolsLocalServer.idl │ ├── UsdSdkToolsLocalServer.rc │ ├── UsdSdkToolsLocalServer.vcxproj │ ├── UsdSdkToolsLocalServer.vcxproj.filters │ ├── UsdSdkToolsLocalServerModule.rgs │ ├── resource.h │ ├── stdafx.cpp │ └── stdafx.h ├── UsdShellExtension/ │ ├── ArResolverShellExtension.cpp │ ├── ArResolverShellExtension.h │ ├── Module.cpp │ ├── Module.h │ ├── ShellExecute.cpp │ ├── ShellExt.def │ ├── ShellExt.idl │ ├── ShellExt.rc │ ├── ShellExtModule.rgs │ ├── ShellPreviewHandlerImpl.cpp │ ├── ShellPreviewHandlerImpl.h │ ├── ShellPreviewHandlerImpl.rgs │ ├── ShellPropertyStoreImpl.cpp │ ├── ShellPropertyStoreImpl.h │ ├── ShellPropertyStoreImpl.rgs │ ├── ShellThumbnailProviderImpl.cpp │ ├── ShellThumbnailProviderImpl.h │ ├── ShellThumbnailProviderImpl.rgs │ ├── UWPProgressBar.cpp │ ├── UWPProgressBar.h │ ├── UsdLoadScreenDlg.cpp │ ├── UsdLoadScreenDlg.h │ ├── UsdMetadata.cpp │ ├── UsdMetadata.h │ ├── UsdPropertyKeys.h │ ├── UsdPropertyKeys.propdesc │ ├── UsdShellExtension-monolithic.manifest │ ├── UsdShellExtension-shared.manifest │ ├── UsdShellExtension.ini │ ├── UsdShellExtension.vcxproj │ ├── UsdShellExtension.vcxproj.filters │ ├── plugInfo.json │ ├── register.bat │ ├── resource.h │ ├── stdafx.cpp │ ├── stdafx.h │ └── unregister.bat ├── UsdShellExtension.sln ├── UsdShellExtensionInstaller/ │ ├── CmdLineArgs.nsh │ ├── RestartManager.nsh │ ├── ShellLinkSetRunAs.nsh │ ├── UsdConfigPage.nsh │ ├── UsdConfigUtils.nsh │ ├── UsdPathPage.nsh │ ├── UsdShellExtensionInstaller.nsi │ ├── UsdShellExtensionInstaller.vcxproj │ └── UsdShellExtensionInstaller.vcxproj.filters ├── atviversion.h ├── atviversion.props ├── atviversion.rc2 ├── boost.props ├── docs/ │ ├── DEPLOYMENT.md │ ├── DESIGN.md │ ├── FEATURES.md │ └── INSTALLING.md ├── nsis.props ├── python.props ├── shared/ │ ├── EventViewerLog.h │ ├── EventViewerMessages.mc │ ├── EventViewerMessages.vcxproj │ ├── EventViewerMessages.vcxproj.filters │ ├── PythonUtil.h │ ├── emb.cpp │ ├── emb.h │ ├── environment.cpp │ └── environment.h ├── usd-monolithic.props ├── usd-shared.props └── usd.props
SYMBOL INDEX (204 symbols across 38 files)
FILE: UsdPreviewHandlerPython/Module.cpp
function BOOL (line 20) | BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID...
FILE: UsdPreviewHandlerPython/StageViewWnd.h
function class (line 19) | class CStageViewWnd : public CWindowImpl<CStageViewWnd>
FILE: UsdPreviewHandlerPython/UsdPreviewHandlerEvent.h
type eUsdPreviewEvent (line 17) | enum eUsdPreviewEvent
type UsdPreviewEventData (line 26) | struct UsdPreviewEventData
type HWND (line 35) | typedef HWND (*FNUSDPREVIEWGETPREVIEWWINDOW)();
FILE: UsdPreviewHandlerPython/UsdPreviewHandlerMgr.cpp
function UsdPreviewEventData (line 21) | UsdPreviewEventData CUsdPreviewHandlerMgr::PeekEvent()
function HWND (line 121) | HWND CUsdPreviewHandlerMgr::GetPreviewWindow() const
function UsdPreviewPushEvent (line 132) | __declspec(dllexport)
function HWND (line 139) | __declspec(dllexport)
FILE: UsdPreviewHandlerPython/UsdPreviewHandlerMgr.h
function class (line 24) | class CUsdPreviewHandlerMgr
function CUsdPreviewHandlerMgr (line 59) | inline CUsdPreviewHandlerMgr& CUsdPreviewHandlerMgr::GetSingleton()
FILE: UsdPreviewHandlerPython/pyUsdPreviewHandler.cpp
type UsdPreviewApp (line 21) | struct UsdPreviewApp
function BOOST_PYTHON_MODULE (line 28) | BOOST_PYTHON_MODULE( UsdPreviewHandler )
function UsdPreviewEventData (line 59) | UsdPreviewEventData UsdPreviewApp::PeekEvent()
FILE: UsdPreviewHandlerServer/Module.cpp
function _tWinMain (line 21) | int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTST...
FILE: UsdPreviewHandlerServer/Module.h
function class (line 23) | class CUSDPreviewLocalServerModule : public CAtlExeModuleT<CUSDPreviewLo...
FILE: UsdPreviewHandlerServer/UsdPreviewHandlerImpl.cpp
function HRESULT (line 23) | HRESULT CUsdPreviewHandlerImpl::FinalConstruct()
function STDMETHODIMP (line 64) | STDMETHODIMP CUsdPreviewHandlerImpl::Initialize(__RPC__in_string LPCWSTR...
function STDMETHODIMP (line 74) | STDMETHODIMP CUsdPreviewHandlerImpl::SetSite(__RPC__in_opt IUnknown* pUn...
function STDMETHODIMP (line 92) | STDMETHODIMP CUsdPreviewHandlerImpl::GetSite(__RPC__in REFIID riid, __RP...
function STDMETHODIMP (line 110) | STDMETHODIMP CUsdPreviewHandlerImpl::GetWindow(__RPC__deref_out_opt HWND...
function STDMETHODIMP (line 122) | STDMETHODIMP CUsdPreviewHandlerImpl::ContextSensitiveHelp(BOOL fEnterMode)
function STDMETHODIMP (line 129) | STDMETHODIMP CUsdPreviewHandlerImpl::SetWindow(__RPC__in HWND hwnd, __RP...
function STDMETHODIMP (line 142) | STDMETHODIMP CUsdPreviewHandlerImpl::SetRect(__RPC__in const RECT* prc)
function STDMETHODIMP (line 154) | STDMETHODIMP CUsdPreviewHandlerImpl::DoPreview()
function STDMETHODIMP (line 164) | STDMETHODIMP CUsdPreviewHandlerImpl::Unload()
function STDMETHODIMP (line 179) | STDMETHODIMP CUsdPreviewHandlerImpl::SetFocus()
function STDMETHODIMP (line 184) | STDMETHODIMP CUsdPreviewHandlerImpl::QueryFocus(__RPC__deref_out_opt HWN...
function STDMETHODIMP (line 193) | STDMETHODIMP CUsdPreviewHandlerImpl::TranslateAccelerator(__RPC__in MSG*...
function STDMETHODIMP (line 206) | STDMETHODIMP CUsdPreviewHandlerImpl::SetBackgroundColor( COLORREF color )
function STDMETHODIMP (line 212) | STDMETHODIMP CUsdPreviewHandlerImpl::SetFont( __RPC__in const LOGFONTW *...
function STDMETHODIMP (line 218) | STDMETHODIMP CUsdPreviewHandlerImpl::SetTextColor( COLORREF color )
function HRESULT (line 236) | HRESULT WINAPI CUsdPreviewHandlerImpl::UpdateRegistry(_In_ BOOL bRegiste...
FILE: UsdPreviewHandlerServer/UsdPreviewHandlerImpl.h
function class (line 23) | class CPreviewHandlerFrameInfo : public PREVIEWHANDLERFRAMEINFO
FILE: UsdPreviewHandlerServer/UsdPreviewHandlerPython.py
class Widget (line 32) | class Widget(QWidget):
method __init__ (line 33) | def __init__(self, stage=None, app=None, previewApp=None):
method setStage (line 58) | def setStage(self, stage):
method OnComplexity (line 61) | def OnComplexity(self, action):
method OnShadingMode (line 64) | def OnShadingMode(self, action):
method OnToggleDisplayGuide (line 67) | def OnToggleDisplayGuide(self, action):
method OnToggleDisplayProxy (line 70) | def OnToggleDisplayProxy(self, action):
method OnToggleDisplayRender (line 73) | def OnToggleDisplayRender(self, action):
method OnRendererPlugin (line 76) | def OnRendererPlugin(self, plugin):
method buildContextMenu_Renderer (line 95) | def buildContextMenu_Renderer(self, contextMenu):
method buildContextMenu_Complexity (line 126) | def buildContextMenu_Complexity(self, contextMenu):
method buildContextMenu_ShadingMode (line 156) | def buildContextMenu_ShadingMode(self, contextMenu):
method buildContextMenu_DisplayPurposes (line 202) | def buildContextMenu_DisplayPurposes(self, contextMenu):
method buildContextMenu (line 221) | def buildContextMenu(self):
method closeEvent (line 229) | def closeEvent(self, event):
method contextMenuEvent (line 234) | def contextMenuEvent(self, event):
method timerEvent (line 244) | def timerEvent(self, event):
function setStyleSheetUsingState (line 258) | def setStyleSheetUsingState(app, resourceDir):
function main (line 286) | def main():
FILE: UsdPreviewHandlerServer/UsdPreviewThread.cpp
function GetRendererFromConfig (line 38) | static bool GetRendererFromConfig( LPCTSTR system, CStringW &out )
function HRESULT (line 53) | HRESULT CUSDPreviewThread::LaunchPreviewWindow( HWND hWndParent, LPCTSTR...
function CStringW (line 78) | static CStringW LocateUsdviewq()
function DWORD (line 98) | DWORD WINAPI CUSDPreviewThread::ThreadProc( _In_ LPVOID lpParameter )
FILE: UsdPreviewHandlerServer/UsdPreviewThread.h
function class (line 17) | class CUSDPreviewThread
FILE: UsdPythonToolsServer/Module.cpp
function _tWinMain (line 22) | int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTST...
FILE: UsdPythonToolsServer/Module.h
function class (line 23) | class CUsdPythonToolsLocalServerModule : public CAtlExeModuleT<CUsdPytho...
FILE: UsdPythonToolsServer/UsdPythonToolsImpl.cpp
function HRESULT (line 27) | HRESULT CUsdPythonToolsImpl::FinalConstruct()
function FindRelativeFile (line 39) | static std::wstring FindRelativeFile(LPCWSTR sToolFileName)
function FILE (line 58) | static FILE *OpenRelativeFile(LPCWSTR sToolFileName, std::wstring& sOutF...
function HRESULT (line 69) | static HRESULT RunDiskPythonScript( LPCWSTR sToolFileName, std::vector<c...
function HRESULT (line 154) | static HRESULT RunResourcePythonScript( UINT nResourceId, std::vector<co...
function STDMETHODIMP (line 239) | STDMETHODIMP CUsdPythonToolsImpl::Record( IN BSTR usdStagePath, IN int i...
function STDMETHODIMP (line 327) | STDMETHODIMP CUsdPythonToolsImpl::View( IN BSTR usdStagePath, IN BSTR re...
function HRESULT (line 374) | HRESULT WINAPI CUsdPythonToolsImpl::UpdateRegistry(_In_ BOOL bRegister) ...
FILE: UsdPythonToolsServer/UsdThumbnail.py
function _SetupOpenGLContextFix (line 25) | def _SetupOpenGLContextFix(width=100, height=100):
function main (line 51) | def main():
FILE: UsdSdkToolsServer/Module.cpp
function _tWinMain (line 22) | int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTST...
FILE: UsdSdkToolsServer/Module.h
function class (line 23) | class CUsdSdkToolsLocalServerModule : public CAtlExeModuleT<CUsdSdkTools...
FILE: UsdSdkToolsServer/UsdSdkToolsImpl.cpp
function HRESULT (line 23) | HRESULT CUsdSdkToolsImpl::FinalConstruct()
function RegisterUsdPlugins (line 35) | static void RegisterUsdPlugins()
function STDMETHODIMP (line 66) | STDMETHODIMP CUsdSdkToolsImpl::Cat( IN BSTR usdStagePathInput, IN BSTR u...
function STDMETHODIMP (line 106) | STDMETHODIMP CUsdSdkToolsImpl::Edit( IN BSTR usdStagePath, IN VARIANT_BO...
function pause (line 200) | static void pause()
function STDMETHODIMP (line 207) | STDMETHODIMP CUsdSdkToolsImpl::Package( IN BSTR usdStagePathInput, IN BS...
function PrintDictionary (line 255) | static void PrintDictionary( const pxr::VtDictionary &dict, int indent )
function STDMETHODIMP (line 280) | STDMETHODIMP CUsdSdkToolsImpl::DisplayStageStats( IN BSTR usdStagePath )
function HRESULT (line 318) | HRESULT WINAPI CUsdSdkToolsImpl::UpdateRegistry(_In_ BOOL bRegister) thr...
FILE: UsdShellExtension/Module.cpp
function BOOL (line 29) | BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID...
function TranslatePathsToList (line 44) | static std::vector<CString> TranslatePathsToList(LPCTSTR paths)
function GetPythonInstallationPath (line 68) | static bool GetPythonInstallationPath( LPTSTR sBuffer, DWORD nBufferSize...
function VerifyPythonInstallation (line 107) | static bool VerifyPythonInstallation()
function VerifyPyOpenGLInstallation (line 125) | static bool VerifyPyOpenGLInstallation()
function VerifyPySideInstallation (line 140) | static bool VerifyPySideInstallation()
function VerifyPySide2Installation (line 155) | static bool VerifyPySide2Installation()
function HRESULT (line 170) | static HRESULT RegisterPropDescFile( LPCTSTR sFileName, UINT nResourceId )
function HRESULT (line 220) | static HRESULT UnregisterPropDescFile( LPCTSTR sFileName )
function HRESULT (line 233) | static HRESULT InstallEventSource()
function HRESULT (line 258) | static HRESULT UninstallEventSource()
function STDAPI (line 275) | STDAPI DllRegisterServer()
function STDAPI (line 388) | STDAPI DllUnregisterServer()
function STDAPI (line 404) | STDAPI DllGetClassObject( REFCLSID rclsid, REFIID riid, void **ppv )
function STDAPI (line 412) | STDAPI DllCanUnloadNow()
function STDAPI (line 417) | STDAPI DllInstall( BOOL bInstall, PCWSTR pszCmdLine )
function HRESULT (line 451) | HRESULT WINAPI CShellExtModule::UpdateRegistry( _In_ BOOL bRegister ) th...
FILE: UsdShellExtension/Module.h
function class (line 23) | class CShellExtModule : public CAtlDllModuleT<CShellExtModule>
function class (line 38) | class CCommandLineArgs
FILE: UsdShellExtension/ShellExecute.cpp
function GetRendererFromConfig (line 24) | static bool GetRendererFromConfig( LPCTSTR system, CComBSTR &outBstr )
function OpenInUsdViewW (line 42) | __declspec(dllexport)
function CrateWithUsdCatW (line 74) | __declspec(dllexport)
function UncrateWithUsdCatW (line 110) | __declspec(dllexport)
function FlattenWithUsdCatW (line 146) | __declspec(dllexport)
function EditInUsdEditW (line 178) | __declspec(dllexport)
function RefreshThumbnailW (line 210) | __declspec(dllexport)
function PackageDefaultW (line 249) | __declspec(dllexport)
function PackageARKitW (line 285) | __declspec(dllexport)
function StageStatsW (line 322) | __declspec(dllexport)
FILE: UsdShellExtension/ShellPreviewHandlerImpl.cpp
function RECT (line 25) | static RECT UpdateRectForDPI(HWND hwnd, const RECT& rcWnd)
function HRESULT (line 52) | HRESULT CShellPreviewHandlerImpl::CreateLocalServer()
function HRESULT (line 91) | HRESULT CShellPreviewHandlerImpl::FinalConstruct()
function STDMETHODIMP (line 104) | STDMETHODIMP CShellPreviewHandlerImpl::Initialize(__RPC__in_string LPCWS...
function STDMETHODIMP (line 126) | STDMETHODIMP CShellPreviewHandlerImpl::SetSite(__RPC__in_opt IUnknown* p...
function STDMETHODIMP (line 139) | STDMETHODIMP CShellPreviewHandlerImpl::GetSite(__RPC__in REFIID riid, __...
function STDMETHODIMP (line 153) | STDMETHODIMP CShellPreviewHandlerImpl::GetWindow(__RPC__deref_out_opt HW...
function STDMETHODIMP (line 166) | STDMETHODIMP CShellPreviewHandlerImpl::ContextSensitiveHelp(BOOL fEnterM...
function STDMETHODIMP (line 180) | STDMETHODIMP CShellPreviewHandlerImpl::SetWindow(__RPC__in HWND hwnd, __...
function STDMETHODIMP (line 209) | STDMETHODIMP CShellPreviewHandlerImpl::SetRect(__RPC__in const RECT* prc)
function STDMETHODIMP (line 233) | STDMETHODIMP CShellPreviewHandlerImpl::DoPreview()
function STDMETHODIMP (line 257) | STDMETHODIMP CShellPreviewHandlerImpl::Unload()
function STDMETHODIMP (line 273) | STDMETHODIMP CShellPreviewHandlerImpl::SetFocus()
function STDMETHODIMP (line 286) | STDMETHODIMP CShellPreviewHandlerImpl::QueryFocus(__RPC__deref_out_opt H...
function STDMETHODIMP (line 299) | STDMETHODIMP CShellPreviewHandlerImpl::TranslateAccelerator(__RPC__in MS...
function STDMETHODIMP (line 312) | STDMETHODIMP CShellPreviewHandlerImpl::SetBackgroundColor( COLORREF color )
function STDMETHODIMP (line 329) | STDMETHODIMP CShellPreviewHandlerImpl::SetFont( __RPC__in const LOGFONTW...
function STDMETHODIMP (line 342) | STDMETHODIMP CShellPreviewHandlerImpl::SetTextColor( COLORREF color )
function HRESULT (line 356) | HRESULT WINAPI CShellPreviewHandlerImpl::UpdateRegistry(_In_ BOOL bRegis...
FILE: UsdShellExtension/ShellPropertyStoreImpl.cpp
function RegisterUsdPlugins (line 23) | static void RegisterUsdPlugins()
function HRESULT (line 54) | HRESULT CShellPropertyStoreImpl::FinalConstruct()
function STDMETHODIMP (line 66) | STDMETHODIMP CShellPropertyStoreImpl::Initialize(__RPC__in_string LPCWST...
function STDMETHODIMP (line 114) | STDMETHODIMP CShellPropertyStoreImpl::Commit()
function STDMETHODIMP (line 159) | STDMETHODIMP CShellPropertyStoreImpl::GetCount( __RPC__out DWORD *cProps )
function STDMETHODIMP (line 171) | STDMETHODIMP CShellPropertyStoreImpl::GetAt( DWORD iProp, __RPC__out PRO...
function STDMETHODIMP (line 183) | STDMETHODIMP CShellPropertyStoreImpl::GetValue( __RPC__in REFPROPERTYKEY...
function STDMETHODIMP (line 195) | STDMETHODIMP CShellPropertyStoreImpl::SetValue( __RPC__in REFPROPERTYKEY...
function STDMETHODIMP (line 208) | STDMETHODIMP CShellPropertyStoreImpl::IsPropertyWritable( __RPC__in REFP...
function HRESULT (line 216) | HRESULT WINAPI CShellPropertyStoreImpl::UpdateRegistry(_In_ BOOL bRegist...
FILE: UsdShellExtension/ShellPropertyStoreImpl.h
function STDMETHODIMP (line 50) | STDMETHODIMP Commit() override;
FILE: UsdShellExtension/ShellThumbnailProviderImpl.cpp
function HRESULT (line 23) | HRESULT CShellThumbnailProviderImpl::FinalConstruct()
function GetRendererFromConfig (line 33) | static bool GetRendererFromConfig( CComBSTR &outBstr )
function STDMETHODIMP (line 52) | STDMETHODIMP CShellThumbnailProviderImpl::Initialize(__RPC__in_string LP...
function STDMETHODIMP (line 65) | STDMETHODIMP CShellThumbnailProviderImpl::GetThumbnail( UINT cx, __RPC__...
function HRESULT (line 102) | HRESULT WINAPI CShellThumbnailProviderImpl::UpdateRegistry(_In_ BOOL bRe...
FILE: UsdShellExtension/UWPProgressBar.cpp
function GetPerformanceFrequency (line 18) | static float GetPerformanceFrequency()
function GetTimeInterval (line 25) | static float GetTimeInterval()
function GetTimePrecise (line 31) | static float GetTimePrecise()
FILE: UsdShellExtension/UWPProgressBar.h
function class (line 19) | class CUWPProgressBar
FILE: UsdShellExtension/UsdLoadScreenDlg.cpp
function LRESULT (line 49) | LRESULT CUsdLoadScreenDlg::OnInitDialog( UINT uMsg, WPARAM wParam, LPARA...
function LRESULT (line 78) | LRESULT CUsdLoadScreenDlg::OnPaint( UINT uMsg, WPARAM wParam, LPARAM lPa...
function LRESULT (line 99) | LRESULT CUsdLoadScreenDlg::OnEraseBkgnd( UINT uMsg, WPARAM wParam, LPARA...
function LRESULT (line 109) | LRESULT CUsdLoadScreenDlg::OnSize( UINT uMsg, WPARAM wParam, LPARAM lPar...
function LRESULT (line 126) | LRESULT CUsdLoadScreenDlg::OnCtlColorDlg( UINT uMsg, WPARAM wParam, LPAR...
function LRESULT (line 136) | LRESULT CUsdLoadScreenDlg::OnTimer( UINT uMsg, WPARAM wParam, LPARAM lPa...
FILE: UsdShellExtension/UsdLoadScreenDlg.h
function class (line 20) | class CUsdLoadScreenDlg : public CDialogImpl<CUsdLoadScreenDlg>
function class (line 67) | class CAutoDpiAware
FILE: UsdShellExtension/UsdMetadata.cpp
function DictionaryToString (line 19) | static std::string DictionaryToString(const pxr::VtDictionary &dict, std...
function HRESULT (line 61) | HRESULT ReadUsdMetadata( const pxr::SdfLayerRefPtr &rootLayer, const pxr...
function HRESULT (line 77) | HRESULT WriteUsdMetadata( pxr::SdfLayerRefPtr &rootLayer, pxr::VtDiction...
function HRESULT (line 111) | HRESULT IsMetadataPropertyWritable( REFPROPERTYKEY key )
FILE: UsdShellExtension/UsdMetadata.h
function HRESULT (line 21) | inline HRESULT StoreStringValue( IPropertyStoreCache *pPropertyStoreCach...
function HRESULT (line 41) | inline HRESULT StoreStringValue( IPropertyStoreCache *pPropertyStoreCach...
function HRESULT (line 46) | inline HRESULT StoreUInt64Value( IPropertyStoreCache *pPropertyStoreCach...
function HRESULT (line 62) | inline HRESULT StoreDateValue( IPropertyStoreCache *pPropertyStoreCache,...
function HRESULT (line 78) | inline HRESULT GetValueAsUTF8( IPropertyStoreCache *pPropertyStoreCache,...
FILE: shared/EventViewerLog.h
function LogEventType (line 21) | enum class LogEventType
FILE: shared/PythonUtil.h
function class (line 31) | class CPyInterpreter
function class (line 44) | class CPyObject
function wchar_t (line 160) | inline wchar_t *PyUnicode_AsWideCharString( PyObject *unicode, Py_ssize_...
function class (line 187) | class CPyString : public CPyObject
function class (line 264) | class CPyStringW : public CPyObject
function CStringW (line 364) | inline CStringW StringListToString( PyObject *pyObject )
function class (line 389) | class CPyException : public std::exception
function class (line 472) | class CPyImport : public CPyObject
function class (line 485) | class CPyAttr : public CPyObject
function class (line 498) | class CPyInstance : public CPyObject
function class (line 519) | class CPyCallMethod : public CPyObject
function class (line 533) | class CPyCallFunction : public CPyObject
function PySetEnvironmentVariable (line 548) | inline void PySetEnvironmentVariable( LPCWSTR sEnvironmentVariable, LPCW...
function PyAppendSysPath (line 575) | inline void PyAppendSysPath(LPCWSTR sPath)
function PyAppendSysPath (line 594) | inline void PyAppendSysPath(const std::vector<CStringW>& pathList)
FILE: shared/emb.cpp
type emb (line 14) | namespace emb
type Stdout (line 16) | struct Stdout
function PyObject (line 22) | PyObject *Stdout_write( PyObject *self, PyObject *args )
function PyObject (line 39) | PyObject *Stdout_flush( PyObject * /*self*/, PyObject * /*args*/ )
function PyMODINIT_FUNC (line 114) | PyMODINIT_FUNC PyInit_emb( void )
function set_stdout (line 141) | void set_stdout( stdout_write_type write )
function reset_stdout (line 154) | void reset_stdout()
function set_stderr (line 163) | void set_stderr( stdout_write_type write )
function reset_stderr (line 176) | void reset_stderr()
FILE: shared/emb.h
function namespace (line 15) | namespace emb
FILE: shared/environment.cpp
function CStringW (line 38) | const CStringW &GetUsdPath()
function CStringW (line 43) | const CStringW &GetUsdPythonPath()
function CStringW (line 48) | const CStringW &GetUsdEditor()
function TranslatePathsToList (line 53) | static std::vector<CStringW> TranslatePathsToList(LPCWSTR paths)
function CStringW (line 77) | static CStringW AppendEnvironmentVariable( LPCWSTR sEnvironmentVariable,...
function SetupPathEnvironmentVariable (line 100) | static void SetupPathEnvironmentVariable(LPCWSTR sUSD_Path, LPCWSTR sPyt...
function SetupPythonPathEnvironmentVariable (line 152) | static void SetupPythonPathEnvironmentVariable(LPCWSTR sUSD_PythonPath, ...
function SetupUsdEditorEnvironmentVariable (line 162) | static void SetupUsdEditorEnvironmentVariable(LPCWSTR sUSD_EditorPath)
function SetupUsdPluginPathEnvironmentVariable (line 171) | static void SetupUsdPluginPathEnvironmentVariable(LPCWSTR sUSD_PluginPath)
function GetPrivateProfileStringAndExpandEnvironmentStrings (line 179) | void GetPrivateProfileStringAndExpandEnvironmentStrings( LPCWSTR lpAppNa...
function BuildConfigFileList (line 208) | std::vector<CStringW> BuildConfigFileList( HMODULE hCurrentModule )
function SetupPythonEnvironment (line 256) | void SetupPythonEnvironment( HMODULE hCurrentModule )
Condensed preview — 132 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (468K chars).
[
{
"path": ".gitignore",
"chars": 116,
"preview": ".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",
"chars": 2894,
"preview": "ACTIVISION USD SHELL EXTENSION\n==============================\n\n\n## Dependencies\n\n* Boost\n* Python (2.7, 3.6, 3.7)\n* USD "
},
{
"path": "CONTRIBUTING.txt",
"chars": 602,
"preview": "Thank you for your interest in USD Shell Extension. Before contributing code to the project, please sign a Contributor L"
},
{
"path": "LICENSE.txt",
"chars": 22209,
"preview": " Apache License\n Version 2.0, January 2004\n "
},
{
"path": "NOTICE.txt",
"chars": 172,
"preview": "Activision USD Shell Extension\nCopyright 2021 Activision Publishing, Inc.\n \nAll rights reserved.\n\nThis product include"
},
{
"path": "README.md",
"chars": 1240,
"preview": "Activision USD Shell Extension\n==============================\n\nA Windows Shell Extension for the Pixar USD file format. "
},
{
"path": "UsdPreviewHandlerPython/Module.cpp",
"chars": 910,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdPreviewHandlerPython/Module.h",
"chars": 649,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdPreviewHandlerPython/StageViewWnd.cpp",
"chars": 863,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdPreviewHandlerPython/StageViewWnd.h",
"chars": 816,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdPreviewHandlerPython/UsdPreviewHandlerEvent.h",
"chars": 1014,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdPreviewHandlerPython/UsdPreviewHandlerMgr.cpp",
"chars": 3817,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdPreviewHandlerPython/UsdPreviewHandlerMgr.h",
"chars": 1588,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdPreviewHandlerPython/UsdPreviewHandlerPython.rc",
"chars": 1546,
"preview": "// Microsoft Visual C++ generated resource script.\n//\n#include \"resource.h\"\n\n#define APSTUDIO_READONLY_SYMBOLS\n/////////"
},
{
"path": "UsdPreviewHandlerPython/UsdPreviewHandlerPython.vcxproj",
"chars": 10125,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msb"
},
{
"path": "UsdPreviewHandlerPython/UsdPreviewHandlerPython.vcxproj.filters",
"chars": 2093,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuil"
},
{
"path": "UsdPreviewHandlerPython/pyUsdPreviewHandler.cpp",
"chars": 2138,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdPreviewHandlerPython/resource.h",
"chars": 406,
"preview": "//{{NO_DEPENDENCIES}}\n// Microsoft Visual C++ generated include file.\n// Used by UsdPreviewHandlerPython.rc\n//\n\n// Next "
},
{
"path": "UsdPreviewHandlerPython/stdafx.cpp",
"chars": 625,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdPreviewHandlerPython/stdafx.h",
"chars": 1042,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdPreviewHandlerServer/Module.cpp",
"chars": 1038,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdPreviewHandlerServer/Module.h",
"chars": 2348,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdPreviewHandlerServer/UsdPreviewHandlerImpl.cpp",
"chars": 6041,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdPreviewHandlerServer/UsdPreviewHandlerImpl.h",
"chars": 3526,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdPreviewHandlerServer/UsdPreviewHandlerImpl.rgs",
"chars": 183,
"preview": "HKCR\n{\n\tNoRemove CLSID\n\t{\n\t\tForceRemove %CLSID_USDPREVIEWHANDLER% = s 'Activision USD Preview Handler Server'\n\t\t{\n\t\t\tLoc"
},
{
"path": "UsdPreviewHandlerServer/UsdPreviewHandlerPython.py",
"chars": 14059,
"preview": "# Copyright 2021 Activision Publishing, Inc. \n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# y"
},
{
"path": "UsdPreviewHandlerServer/UsdPreviewLocalServer.idl",
"chars": 979,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdPreviewHandlerServer/UsdPreviewLocalServer.rc",
"chars": 2333,
"preview": "// Microsoft Visual C++ generated resource script.\n//\n#include \"resource.h\"\n\n#define APSTUDIO_READONLY_SYMBOLS\n/////////"
},
{
"path": "UsdPreviewHandlerServer/UsdPreviewLocalServer.vcxproj",
"chars": 13709,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msb"
},
{
"path": "UsdPreviewHandlerServer/UsdPreviewLocalServer.vcxproj.filters",
"chars": 3444,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuil"
},
{
"path": "UsdPreviewHandlerServer/UsdPreviewLocalServerModule.rgs",
"chars": 137,
"preview": "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 '%A"
},
{
"path": "UsdPreviewHandlerServer/UsdPreviewThread.cpp",
"chars": 5893,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdPreviewHandlerServer/UsdPreviewThread.h",
"chars": 1058,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdPreviewHandlerServer/resource.h",
"chars": 803,
"preview": "//{{NO_DEPENDENCIES}}\n// Microsoft Visual C++ generated include file.\n// Used by UsdPreviewLocalServer.rc\n//\n#define IDR"
},
{
"path": "UsdPreviewHandlerServer/stdafx.cpp",
"chars": 625,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdPreviewHandlerServer/stdafx.h",
"chars": 1509,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdPythonToolsServer/Module.cpp",
"chars": 1078,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdPythonToolsServer/Module.h",
"chars": 2602,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdPythonToolsServer/UsdPythonToolsImpl.cpp",
"chars": 10929,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdPythonToolsServer/UsdPythonToolsImpl.h",
"chars": 1590,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdPythonToolsServer/UsdPythonToolsImpl.rgs",
"chars": 176,
"preview": "HKCR\n{\n\tNoRemove CLSID\n\t{\n\t\tForceRemove %CLSID_USDPYTHONTOOLS% = s 'Activision USD Python Tools Server'\n\t\t{\n\t\t\tLocalServ"
},
{
"path": "UsdPythonToolsServer/UsdPythonToolsLocalServer.idl",
"chars": 1603,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdPythonToolsServer/UsdPythonToolsLocalServer.rc",
"chars": 2342,
"preview": "// Microsoft Visual C++ generated resource script.\n//\n#include \"resource.h\"\n\n#define APSTUDIO_READONLY_SYMBOLS\n/////////"
},
{
"path": "UsdPythonToolsServer/UsdPythonToolsLocalServer.vcxproj",
"chars": 13459,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msb"
},
{
"path": "UsdPythonToolsServer/UsdPythonToolsLocalServer.vcxproj.filters",
"chars": 3207,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuil"
},
{
"path": "UsdPythonToolsServer/UsdPythonToolsLocalServerModule.rgs",
"chars": 145,
"preview": "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"
},
{
"path": "UsdPythonToolsServer/UsdThumbnail.py",
"chars": 2066,
"preview": "# Copyright 2021 Activision Publishing, Inc. \n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# y"
},
{
"path": "UsdPythonToolsServer/resource.h",
"chars": 848,
"preview": "//{{NO_DEPENDENCIES}}\n// Microsoft Visual C++ generated include file.\n// Used by UsdPythonToolsLocalServer.rc\n//\n#define"
},
{
"path": "UsdPythonToolsServer/stdafx.cpp",
"chars": 625,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdPythonToolsServer/stdafx.h",
"chars": 1528,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdSdkToolsServer/Module.cpp",
"chars": 1072,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdSdkToolsServer/Module.h",
"chars": 2578,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdSdkToolsServer/UsdSdkToolsImpl.cpp",
"chars": 9341,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdSdkToolsServer/UsdSdkToolsImpl.h",
"chars": 1838,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdSdkToolsServer/UsdSdkToolsImpl.rgs",
"chars": 170,
"preview": "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 ="
},
{
"path": "UsdSdkToolsServer/UsdSdkToolsLocalServer.idl",
"chars": 2377,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdSdkToolsServer/UsdSdkToolsLocalServer.rc",
"chars": 2161,
"preview": "// Microsoft Visual C++ generated resource script.\n//\n#include \"resource.h\"\n\n#define APSTUDIO_READONLY_SYMBOLS\n/////////"
},
{
"path": "UsdSdkToolsServer/UsdSdkToolsLocalServer.vcxproj",
"chars": 13310,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msb"
},
{
"path": "UsdSdkToolsServer/UsdSdkToolsLocalServer.vcxproj.filters",
"chars": 2973,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuil"
},
{
"path": "UsdSdkToolsServer/UsdSdkToolsLocalServerModule.rgs",
"chars": 139,
"preview": "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 '"
},
{
"path": "UsdSdkToolsServer/resource.h",
"chars": 757,
"preview": "//{{NO_DEPENDENCIES}}\n// Microsoft Visual C++ generated include file.\n// Used by UsdSdkToolsLocalServer.rc\n//\n#define ID"
},
{
"path": "UsdSdkToolsServer/stdafx.cpp",
"chars": 625,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdSdkToolsServer/stdafx.h",
"chars": 2005,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdShellExtension/ArResolverShellExtension.cpp",
"chars": 1428,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdShellExtension/ArResolverShellExtension.h",
"chars": 824,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdShellExtension/Module.cpp",
"chars": 13960,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdShellExtension/Module.h",
"chars": 1446,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdShellExtension/ShellExecute.cpp",
"chars": 10234,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdShellExtension/ShellExt.def",
"chars": 138,
"preview": "EXPORTS\n\tDllRegisterServer\tPRIVATE\n\tDllUnregisterServer PRIVATE\n\tDllGetClassObject\tPRIVATE\n\tDllCanUnloadNow\t\tPRIVATE\n\tDl"
},
{
"path": "UsdShellExtension/ShellExt.idl",
"chars": 1450,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdShellExtension/ShellExt.rc",
"chars": 4511,
"preview": "// Microsoft Visual C++ generated resource script.\n//\n#include \"resource.h\"\n\n#define APSTUDIO_READONLY_SYMBOLS\n/////////"
},
{
"path": "UsdShellExtension/ShellExtModule.rgs",
"chars": 6054,
"preview": "HKCR\n{\n\tNoRemove ATVI.USD = s 'Activision Universal Scene Description'\n\t{\n\t\tForceRemove val FriendlyTypeName = s '@%MODU"
},
{
"path": "UsdShellExtension/ShellPreviewHandlerImpl.cpp",
"chars": 8462,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdShellExtension/ShellPreviewHandlerImpl.h",
"chars": 3173,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdShellExtension/ShellPreviewHandlerImpl.rgs",
"chars": 1889,
"preview": "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_SH"
},
{
"path": "UsdShellExtension/ShellPropertyStoreImpl.cpp",
"chars": 6883,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdShellExtension/ShellPropertyStoreImpl.h",
"chars": 2289,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdShellExtension/ShellPropertyStoreImpl.rgs",
"chars": 1142,
"preview": "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 "
},
{
"path": "UsdShellExtension/ShellThumbnailProviderImpl.cpp",
"chars": 2999,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdShellExtension/ShellThumbnailProviderImpl.h",
"chars": 1650,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdShellExtension/ShellThumbnailProviderImpl.rgs",
"chars": 1752,
"preview": "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_SH"
},
{
"path": "UsdShellExtension/UWPProgressBar.cpp",
"chars": 3396,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdShellExtension/UWPProgressBar.h",
"chars": 1210,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdShellExtension/UsdLoadScreenDlg.cpp",
"chars": 11113,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdShellExtension/UsdLoadScreenDlg.h",
"chars": 2524,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdShellExtension/UsdMetadata.cpp",
"chars": 3561,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdShellExtension/UsdMetadata.h",
"chars": 2749,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdShellExtension/UsdPropertyKeys.h",
"chars": 1229,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdShellExtension/UsdPropertyKeys.propdesc",
"chars": 1962,
"preview": "<schema xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://schemas.microsoft.com/windows/2006/propertyd"
},
{
"path": "UsdShellExtension/UsdShellExtension-monolithic.manifest",
"chars": 898,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<!--\n Copyright 2021 Activision Publishing, Inc. \n\n Licensed"
},
{
"path": "UsdShellExtension/UsdShellExtension-shared.manifest",
"chars": 459,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersi"
},
{
"path": "UsdShellExtension/UsdShellExtension.vcxproj",
"chars": 14023,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msb"
},
{
"path": "UsdShellExtension/UsdShellExtension.vcxproj.filters",
"chars": 5135,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuil"
},
{
"path": "UsdShellExtension/plugInfo.json",
"chars": 379,
"preview": "{\n \"Plugins\": [\n {\n \"Info\": {\n \"Types\": {\n \"ArResolverShellExtens"
},
{
"path": "UsdShellExtension/register.bat",
"chars": 841,
"preview": "REM This batch needs to be executed as administrator!\n\n@echo off\n\ncd /D %~dp0\n\nset /a success = 1\n\necho UsdPreviewLocalS"
},
{
"path": "UsdShellExtension/resource.h",
"chars": 1559,
"preview": "//{{NO_DEPENDENCIES}}\n// Microsoft Visual C++ generated include file.\n// Used by ShellExt.rc\n//\n#define IDR_REGISTRY_SHE"
},
{
"path": "UsdShellExtension/stdafx.cpp",
"chars": 625,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdShellExtension/stdafx.h",
"chars": 1945,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "UsdShellExtension/unregister.bat",
"chars": 853,
"preview": "REM This batch needs to be executed as administrator!\n\n@echo off\n\ncd /D %~dp0\n\nset /a success = 1\n\necho UsdPreviewLocalS"
},
{
"path": "UsdShellExtension.sln",
"chars": 4859,
"preview": "\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.28307.1209\nM"
},
{
"path": "UsdShellExtensionInstaller/CmdLineArgs.nsh",
"chars": 863,
"preview": "!include FileFunc.nsh\n\n;--------------------------------\nVar CmdLineUsdPath\nVar CmdLineUsdPythonPath\nVar CmdLineUsdPxrPl"
},
{
"path": "UsdShellExtensionInstaller/RestartManager.nsh",
"chars": 5128,
"preview": ";--------------------------------\n!define MAX_PATH 260\n!define CCH_RM_SESSION_KEY 33\n!define RmForceShutdown 0x1\n!define"
},
{
"path": "UsdShellExtensionInstaller/ShellLinkSetRunAs.nsh",
"chars": 1388,
"preview": "!include LogicLib.nsh\n \n!ifndef IPersistFile\n!define IPersistFile {0000010b-0000-0000-c000-000000000046}\n!endif\n!ifndef "
},
{
"path": "UsdShellExtensionInstaller/UsdConfigPage.nsh",
"chars": 2779,
"preview": ";--------------------------------\n; UsdConfigPage\n\n!define /ifndef WS_BORDER 0x00800000\n\n!define USDCONFIGCONF"
},
{
"path": "UsdShellExtensionInstaller/UsdConfigUtils.nsh",
"chars": 1694,
"preview": "\nFunction ReadConfigFile\n pop $0 ; file\n pop $1 ; section\n pop $2 ; key\n pop $3 ; value\n\n System::StrAllo"
},
{
"path": "UsdShellExtensionInstaller/UsdPathPage.nsh",
"chars": 2622,
"preview": ";--------------------------------\n; UsdPathPage\n\nVar hWndUsdPathDlg\nVar hWndUsdPathEditPath\nVar hWndUsdPathEditPythonPat"
},
{
"path": "UsdShellExtensionInstaller/UsdShellExtensionInstaller.nsi",
"chars": 15467,
"preview": "; Copyright 2021 Activision Publishing, Inc. \n;\n; Licensed under the Apache License, Version 2.0 (the \"License\");\n; you "
},
{
"path": "UsdShellExtensionInstaller/UsdShellExtensionInstaller.vcxproj",
"chars": 8962,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msb"
},
{
"path": "UsdShellExtensionInstaller/UsdShellExtensionInstaller.vcxproj.filters",
"chars": 246,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuil"
},
{
"path": "atviversion.h",
"chars": 1133,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "atviversion.props",
"chars": 2246,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n Copyright 2021 Activision Publishing, Inc. \n\n Licensed under the Apache"
},
{
"path": "atviversion.rc2",
"chars": 920,
"preview": "\n#include \"atviversion.h\"\n\nVS_VERSION_INFO VERSIONINFO\n FILEVERSION ATVI_VERSION_MAJOR,ATVI_VERSION_MINOR,ATVI_VERSION_R"
},
{
"path": "boost.props",
"chars": 2294,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n Copyright 2021 Activision Publishing, Inc. \n\n Licensed under the Apache"
},
{
"path": "docs/DEPLOYMENT.md",
"chars": 3005,
"preview": "Activision USD Shell Extension - Deployment Guide\n=================================================\n\nThe USD Shell Exten"
},
{
"path": "docs/DESIGN.md",
"chars": 4837,
"preview": "Activision USD Shell Extension - Design\n=======================================\n\nFundamentals \n------------\n\nThere are s"
},
{
"path": "docs/FEATURES.md",
"chars": 3330,
"preview": "Activision USD Shell Extension\n==============================\n\nTable of contents\n-----------------\n\n - [Windows Explore"
},
{
"path": "docs/INSTALLING.md",
"chars": 4966,
"preview": "Activision USD Shell Extension - Installation Guide\n===================================================\n\nThis document c"
},
{
"path": "nsis.props",
"chars": 846,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n Copyright 2021 Activision Publishing, Inc. \n\n Licensed under the Apache"
},
{
"path": "python.props",
"chars": 1679,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n Copyright 2021 Activision Publishing, Inc. \n\n Licensed under the Apache"
},
{
"path": "shared/EventViewerLog.h",
"chars": 1604,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "shared/EventViewerMessages.mc",
"chars": 969,
"preview": "LanguageNames=(English=0x409:MSG00409)\n\nMessageIdTypedef=WORD\n\nMessageId=0x1\nSymbolicName=GENERIC_CATEGORY\nLanguage=Engl"
},
{
"path": "shared/EventViewerMessages.vcxproj",
"chars": 3916,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" ToolsVersion=\"15.0\" xmlns=\"http://schemas.microso"
},
{
"path": "shared/EventViewerMessages.vcxproj.filters",
"chars": 221,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuil"
},
{
"path": "shared/PythonUtil.h",
"chars": 14082,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "shared/emb.cpp",
"chars": 4572,
"preview": "//\n// Copyright (C) 2011 Mateusz Loskot <mateusz@loskot.net>\n// Distributed under the Boost Software License, Version 1."
},
{
"path": "shared/emb.h",
"chars": 617,
"preview": "//\n// Copyright (C) 2011 Mateusz Loskot <mateusz@loskot.net>\n// Distributed under the Boost Software License, Version 1."
},
{
"path": "shared/environment.cpp",
"chars": 8592,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "shared/environment.h",
"chars": 1150,
"preview": "// Copyright 2021 Activision Publishing, Inc. \n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// "
},
{
"path": "usd-monolithic.props",
"chars": 4243,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n Copyright 2021 Activision Publishing, Inc. \n\n Licensed under the Apache"
},
{
"path": "usd-shared.props",
"chars": 5687,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n Copyright 2021 Activision Publishing, Inc. \n\n Licensed under the Apache"
},
{
"path": "usd.props",
"chars": 917,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n Copyright 2021 Activision Publishing, Inc. \n\n Licensed under the Apache"
}
]
// ... and 1 more files (download for full content)
About this extraction
This page contains the full source code of the Activision/USDShellExtension GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 132 files (424.5 KB), approximately 119.4k tokens, and a symbol index with 204 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.