1#!/pxrpythonsubst
2#
3# Copyright 2020 Pixar
4#
5# Licensed under the Apache License, Version 2.0 (the "Apache License")
6# with the following modification; you may not use this file except in
7# compliance with the Apache License and the following modification to it:
8# Section 6. Trademarks. is deleted and replaced with:
9#
10# 6. Trademarks. This License does not grant permission to use the trade
11#    names, trademarks, service marks, or product names of the Licensor
12#    and its affiliates, except as required to comply with Section 4(c) of
13#    the License and to reproduce the content of the NOTICE file.
14#
15# You may obtain a copy of the Apache License at
16#
17#     http://www.apache.org/licenses/LICENSE-2.0
18#
19# Unless required by applicable law or agreed to in writing, software
20# distributed under the Apache License with the above modification is
21# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
22# KIND, either express or implied. See the Apache License for the specific
23# language governing permissions and limitations under the Apache License.
24#
25
26from pxr.Usdviewq.qt import QtWidgets
27from pxr.Usdviewq.common import SelectionHighlightModes
28
29def _waitForRefresh():
30    import time
31    time.sleep(0.5)
32    QtWidgets.QApplication.processEvents()
33
34# Remove any unwanted visuals from the view.
35def _modifySettings(appController):
36    appController._dataModel.viewSettings.showBBoxes = False
37    appController._dataModel.viewSettings.showHUD = False
38    appController._dataModel.viewSettings.selHighlightMode = (
39        SelectionHighlightModes.NEVER)
40
41
42#
43# Test a case where we move an instanced root that contains strictly
44# non-instancable-by-Hydra prims (i.e., no rprims).
45#
46def _testInstancingEdits6146(appController):
47    from pxr import Sdf, Usd
48
49    testALayer = Sdf.Layer.FindOrOpen("usd-6146/testA.usda")
50    appController._dataModel.stage.GetRootLayer().TransferContent(testALayer)
51    _waitForRefresh()
52
53    testBLayer = Sdf.Layer.FindOrOpen("usd-6146/testB.usda")
54    appController._dataModel.stage.GetRootLayer().TransferContent(testBLayer)
55    _waitForRefresh()
56
57    # If we get this far without crashing, we're good for now.
58
59
60def testUsdviewInputFunction(appController):
61    _modifySettings(appController)
62    _testInstancingEdits6146(appController)
63