-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[usdImaging] fix _GetDirtyBitsForPrimvarChange for PrimvarChangeAdd
It was observed that primvars such as widths for UsdGeomPoints would not update in hdSt from the usdImagingDelegate. If the widths primvar was not read from disk it would always display with it's default value. The change here is that with a PrimvarChangeAdd it will set the incoming dirty bit instead of just DirtyPrimvar
- Loading branch information
1 parent
080df97
commit 50aad30
Showing
9 changed files
with
122 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+3.28 KB
pxr/usdImaging/bin/testusdview/testenv/testUsdviewPointWidths/baseline/end.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.59 KB
...in/testusdview/testenv/testUsdviewPointWidths/baseline/set_point_widths_025.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.75 KB
...in/testusdview/testenv/testUsdviewPointWidths/baseline/set_point_widths_050.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.11 KB
...sdview/testenv/testUsdviewPointWidths/baseline/set_point_widths_primvar_075.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.28 KB
pxr/usdImaging/bin/testusdview/testenv/testUsdviewPointWidths/baseline/start.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions
8
pxr/usdImaging/bin/testusdview/testenv/testUsdviewPointWidths/points.usda
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#usda 1.0 | ||
( | ||
defaultPrim = "World" | ||
upAxis = "Y" | ||
) | ||
|
||
def Xform "Scene" { | ||
} |
93 changes: 93 additions & 0 deletions
93
pxr/usdImaging/bin/testusdview/testenv/testUsdviewPointWidths/testUsdviewPointWidths.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
#!/pxrpythonsubst | ||
# | ||
# Copyright 2020 Pixar | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "Apache License") | ||
# with the following modification; you may not use this file except in | ||
# compliance with the Apache License and the following modification to it: | ||
# Section 6. Trademarks. is deleted and replaced with: | ||
# | ||
# 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. | ||
# | ||
# You may obtain a copy of the Apache License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the Apache License with the above modification is | ||
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the Apache License for the specific | ||
# language governing permissions and limitations under the Apache License. | ||
# | ||
from __future__ import print_function | ||
|
||
from pxr.Usdviewq.common import Usd, UsdGeom | ||
from pxr import Vt, Gf, Sdf | ||
|
||
# Remove any unwanted visuals from the view, and enable autoClip | ||
def _modifySettings(appController): | ||
appController._dataModel.viewSettings.showBBoxes = False | ||
appController._dataModel.viewSettings.showHUD = False | ||
appController._dataModel.viewSettings.autoComputeClippingPlanes = True | ||
|
||
def _createPoints(stage): | ||
# define the points Prim on the stage | ||
points = UsdGeom.Points.Define(stage, Sdf.Path("/Scene/points")) | ||
|
||
positions = [] | ||
for x in range(-5, 5): | ||
positions.append(Gf.Vec3f(x, 0, 10)) | ||
|
||
points.CreatePointsAttr().Set(Vt.Vec3fArray(positions)) | ||
return points | ||
|
||
def _createWidths(points, widthSize): | ||
# initialize the widths attribute to a specific value | ||
widths = [] | ||
for _ in range(0, len(points.GetPointsAttr().Get())): | ||
widths.append(widthSize) | ||
|
||
points.CreateWidthsAttr().Set(widths) | ||
|
||
def _createWidthsPrimvar(points, widthSize): | ||
widths = [] | ||
for _ in range(0, len(points.GetPointsAttr().Get())): | ||
widths.append(widthSize) | ||
|
||
api = UsdGeom.PrimvarsAPI(points) | ||
api.CreatePrimvar(UsdGeom.Tokens.widths, Sdf.ValueTypeNames.FloatArray).Set(widths) | ||
|
||
def _removeWidthsPrimvar(points): | ||
api = UsdGeom.PrimvarsAPI(points) | ||
api.RemovePrimvar(UsdGeom.Tokens.widths) | ||
|
||
def _testPointsWidthsAttr(appController): | ||
# create the initial set of points that we will be changing the widths on | ||
points = _createPoints(appController._dataModel.stage) | ||
|
||
# take a screen shot of the points with their default widths | ||
appController._takeShot("start.png") | ||
|
||
# now author the widths attribute to a non-default width size | ||
_createWidths(points, 0.25) | ||
appController._takeShot("set_point_widths_025.png") | ||
|
||
# change widths to a different value | ||
_createWidths(points, 0.5) | ||
appController._takeShot("set_point_widths_050.png") | ||
|
||
# now author the widths primvar to override the widths attr | ||
_createWidthsPrimvar(points, 0.75) | ||
appController._takeShot("set_point_widths_primvar_075.png") | ||
|
||
# remove the widths primvar to revert back to the widths attr | ||
_removeWidthsPrimvar(points) | ||
appController._takeShot("end.png") | ||
|
||
# This test adds and removes primvars that are used/unused by the material. | ||
def testUsdviewInputFunction(appController): | ||
_modifySettings(appController) | ||
_testPointsWidthsAttr(appController) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters