Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selection by kind #641

Merged
merged 2 commits into from
Jul 12, 2020
Merged

Selection by kind #641

merged 2 commits into from
Jul 12, 2020

Conversation

huidong-chen
Copy link

@huidong-chen huidong-chen commented Jul 9, 2020

The pull request is to add a "UsdSelectionKind" option var to override selection
behavior (GUI support is coming separately).

The default behavior is to select the exact prim which is picked in the viewport.

If the option var is assigned with a non-empty string to indicate a Kind token,
the nearest ancestor that is assigned with that Kind or a subcategory of that
Kind will be selected when a prim is picked in the viewport. If the prim doesn't
have any qualified ancester, it falls back to the default behavior (but it can be
slower due to the cost of walking the scene hierarchy).

If the option var is undefined or empty, the default behavior will be used to
select the exact prim.

For details about Kind, please refer to Kind : Extensible Categorization.

Examples:

// Select the nearing ancester which is a model or its subcategory.
optionVar -sv "UsdSelectionKind" "model";

// Select the nearing ancester which is a group or its subcategory.
optionVar -sv "UsdSelectionKind" "group";

// Select the nearing ancester which is a user-defined kind or its subcategory.
optionVar -sv "UsdSelectionKind" "user-defined";

// Select the exact prim that is picked in the viewport.
optionVar -sv "UsdSelectionKind" "";

Huidong Chen added 2 commits July 9, 2020 11:40
Defined a "UsdSelectionKind" option var to control the selection behavior.

If the option var is assigned with a non-empty string to indicate a Kind token,
the nearest ancestor that is assigned with that Kind token or a subcategory of
that Kind token will be selected when a prim is picked in the viewport. If the
prim doesn't have any qualified ancester, it falls back to the default behavior
which will select the exact prim (can be slower due to walking the hierarchy).

If the option var is undefined or empty, the default behavior will be used to
select the exact prim.

For details about Kind, please refer to "Kind : Extensible Categorization"
(https://graphics.pixar.com/usd/docs/api/kind_page_front.html#mainpage_kind).

Examples:

// Select the nearing ancester which is a model or its subcategory.
optionVar -sv "UsdSelectionKind" "model";

// Select the nearing ancester which is a group or its subcategory.
optionVar -sv "UsdSelectionKind" "group";

// Select the nearing ancester which is a user-defined kind or its subcategory.
optionVar -sv "UsdSelectionKind" "user-defined";

// Select the exact prim that is picked in the viewport.
optionVar -sv "UsdSelectionKind" "";
@huidong-chen huidong-chen added the vp2renderdelegate Related to VP2RenderDelegate label Jul 9, 2020
@huidong-chen huidong-chen linked an issue Jul 9, 2020 that may be closed by this pull request
@huidong-chen huidong-chen mentioned this pull request Jul 10, 2020
@cfmoore007
Copy link

From a usability perspective, it appears to work as advertised.

def Xform "apple" (
    kind = "component"
)

1) select by component
cmds.optionVar(sv=('UsdSelectionKind','component'))

optionVar_component

2) optionVar empty ( select prim )
cmds.optionVar(sv=('UsdSelectionKind',''))
optionVar_empty

Thanks, @HdC-adsk !

@kxl-adsk kxl-adsk merged commit 6d0cbde into dev Jul 12, 2020
@kxl-adsk kxl-adsk deleted the HdC-adsk/selection-by-kind branch July 12, 2020 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vp2renderdelegate Related to VP2RenderDelegate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Selection by Kind
4 participants