BigRoy / usd-qtpy

Python Qt components for building custom USD tools.
MIT License
57 stars 8 forks source link

Bugfix: Fix action states in Viewer context menu #36

Closed BigRoy closed 7 months ago

BigRoy commented 7 months ago

Set action check state in a way supported by more Qt bindings + fix check state for some cases

Fixes #35

@Sasbom can you confirm this works for you?

Sasbom commented 7 months ago

Set action check state in a way supported by more Qt bindings + fix check state for some cases

Fixes #35

@Sasbom can you confirm this works for you?

confirm_viewermenu It works!!

BigRoy commented 7 months ago

I can't get the display purpose toggles to work however, but maybe it's because my tested files don't have purpose opinions written in them.

Sasbom commented 7 months ago

I can't get the display purpose toggles to work however, but maybe it's because my tested files don't have purpose opinions written in them.

Maybe it'd be an idea to add a toggle for "default" since that seems to be... well... the default, for prims that lost their purpose.

Also, after playing around a bit, I find myself wanting to see the kitchen scene with subdivision active, which could be achieved using the "complexity" variable.

I don't know what the neat way to access this is, but it's in: pxr.Usdviewq.stageView.StageView._dataModel.viewSettings.complexity,

and is of type: pxr.UsdAppUtils.complexityArgs.RefinementComplexities._RefinementComplexity.

The RefinementComplexities class has a property called RefinementComplexities._ordered that has all registered, valid complexities, with the right values inside to get the viewer to pick up on it properly!

BigRoy commented 7 months ago

Maybe it'd be an idea to add a toggle for "default" since that seems to be... well... the default, for prims that lost their purpose.

Not sure how USD View handles that unfortunately.

Also, after playing around a bit, I find myself wanting to see the kitchen scene with subdivision active, which could be achieved using the "complexity" variable.

Added with https://github.com/BigRoy/usd-qtpy/pull/36/commits/f42fee2963aaf042223f25688631b9a4a0b3b764

Sasbom commented 7 months ago

Not sure how USD View handles that unfortunately.

This is just a gamble on how it works, but,

if I recall correctly, it's just a flag called "default", i think might be represented as UsdGeom.Tokens.default_, which stores "default" as a str.

the StageView object holds a set, StageView._dataModel.includedPurposes, which is just a set of strings. It gets refreshed when StageView.updateBboxPurposes is called.

All the bool attributes of viewSettings.display(purpose) are there to modify this set on updates.

in usdrecord you can use "default" as a valid purpose argument too, so it would seem that it makes sense, however it's a bit of a shot in the dark. I just assume they assumed that everyone would want to always see "default flagged" things.