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

EMSUSD-254 Allow selecting the referenced prim #3372

Merged
merged 4 commits into from
Oct 20, 2023

Conversation

pierrebai-adsk
Copy link
Collaborator

To allow selecting the referenced prim when adding a new USD reference or payload, multiple sub-systems had to be modified:

  • The usdImportDialog command, to accept new parameters
  • Qt dialog layout.
  • The Qt tree model and tree item implementing the USD hierarchy view.
  • The functions managing the USD ref/payload file dialog.
  • The Python code that ties everything together.

Modify the usdImportDialog command:

  • Add a new flag to the usdImprotDialog command to control if variants are shown.
  • Add a new flag to the usdImprotDialog command to control if the root prim is shown.
  • Add a new flag to the usdImprotDialog command to set the window title.
  • Add a new flag to the usdImprotDialog command to set the help label.
  • Add a new flag to the usdImprotDialog command to set the help target.
  • Allow setting the prim path with the edit flag.
  • Use the new prim path flag in the Python code that builds the UI.
  • Added helper function to manage the transfer of the prim path from the UI to the command.

Modify the Qt dialog to enable all those flags:

  • Add a USDImportDialogOptions structure to hold all the various options.
  • Pass that around to all the relevant sub-functions.
  • Modify the dialog to hide variants, header message, etc when relevant.
  • Change the add ref/payload dialog accept button label to be "Reference".
  • Implement most of the referenced prim logic.
  • Fix the import dialog to only use the prim path if not empty.

Modify the USD hierarchy tree model and item:

  • Change TreeModel to handle not showing the root and not showing variants.
  • Made the tree item add a 'default prim' icon next to the prim name when it is the default prim.
  • Added the default prim image used by the tree item.
  • Make the tree model factory preselect the top prim.
  • Modify the factory to create the correct number of column depending on if variants are shown.
  • Make the tree model factory use the first root prim if no default prim are present.
  • Added a helper method on the tree model to retrieve the first item.

Modify the relative-file utility classes:

  • Allow all the relative-UI classes to hook into the filename selection.
  • For the add payload/ref one, update the referenced prim UI when the filename changes.
  • Still missing pre-selecting the correct prim in the selection dialog and some corner cases.
  • Save the selected prim path in an option var to communicate it to the calling code.

Modify the context menu:

  • Use all of the above to create the add-ref or add-payload command with the selected prim path.

@pierrebai-adsk pierrebai-adsk added enhancement New feature or request adsk Related to Autodesk plugin labels Oct 6, 2023
To allow selecting the referenced prim when adding a new USD reference or
payload, multiple sub-systems had to be modified:
- The usdImportDialog command, to accept new parameters
- Qt dialog layout.
- The Qt tree model and tree item implementing the USD hierchy view.
- The functions managing the USD ref/payload filel dialog.
- The Python code that ties everything together.

Modify the usdImportDialog command:
- Add a new flag to the usdImprotDialog command to control if variants are shown.
- Add a new flag to the usdImprotDialog command to control if the root prim is shown.
- Add a new flag to the usdImprotDialog command to set the window title.
- Add a new flag to the usdImprotDialog command to set the help label.
- Add a new flag to the usdImprotDialog command to set the help target.
- Allow setting the prim path with the edit flag.
- Use the new prim path flag in the Python code that builds the UI.
- Added helper function to manage the transfer of the prim path from the UI to the command.

Modify the Qt dialog to enable all those flags:
- Add a USDImportDialogOptions structure to hold all the various options.
- Pass that around to all the relevant sub-functions.
- Modify the dialog to hide variants, header message, etc when relevant.
- Change the add ref/payload dialog accept button label to be "Reference".
- Implement most of the referenced prim logic.
- Fix the import dialog to only use the prim path if not empty.

Modify the USD hierarchy tree model and item:
- Change TreeModel to handle not showing the root and not showing variants.
- Made the tree item add a 'default prim' icon next to the prim name when it is the default prim.
- Added the default prim image used by the tree item.
- Make the tree model factory preselect the top prim.
- Modify the factory to create the correct number of column depending on if variants are shown.
- Make the tree model factory use the first root prim if no default prim are present.
- Added a helper method on the tree model to retrieve the first item.

Modify the relative-file utility classes:
- Allow all the relative-UI classes to hook into the filename selection.
- For the add payload/ref one, update the referenced prim UI when the filename changes.
- Still missing pre-selecting the correct prim in the selection dialog and some corner cases.
- Save the selected prim path in an option var to communicate it to the calling code.

Modify the cntext menu:
- Use all of the above to create the add-ref or add-payload command with the selected prim path.
@pierrebai-adsk
Copy link
Collaborator Author

Another big PR, I know...

@@ -136,27 +216,48 @@ def createUsdRefOrPayloadUI(showLoadPayload=False):
for label in listEditedAsLabels:
cmds.menuItem(label=label)

if showLoadPayload:
if uiForLoad:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I change showLoadPayload to uiForLoad since the UI elements are for teh case we load vs save (example of saving: creating the USD cache when merging a Maya ref)

kColumnName,
kColumnType,
kColumnVariants,
kColumnLast
};
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I change this because TreeItem and TreeModel had both an enumwith the same values which were magically assumed to be in the same order. Now there is a single enum, and that enum must be convertible to an int to pass to Qt.

Also, center the icons vertically.
Copy link
Collaborator

@vlasovi vlasovi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@pierrebai-adsk pierrebai-adsk added the ready-for-merge Development process is finished, PR is ready for merge label Oct 16, 2023
@AramAzhari-adsk
Copy link
Collaborator

Looks good to me. Great job!

@seando-adsk seando-adsk merged commit b2b48b4 into dev Oct 20, 2023
12 checks passed
@seando-adsk seando-adsk deleted the bailp/EMSUSD-254/select-ref-prim branch October 20, 2023 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adsk Related to Autodesk plugin enhancement New feature or request ready-for-merge Development process is finished, PR is ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants