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

[Draft][USDU-331] Make package samples more user friendly #367

Draft
wants to merge 36 commits into
base: dev
Choose a base branch
from

Conversation

lee-aandrew
Copy link
Contributor

@lee-aandrew lee-aandrew commented Apr 4, 2023

Purpose of this PR

Ticket/Jira #:

Currently our package samples can be a bit confusing for users,
To increase user friendly-ness the following have been addressed:

  • In general, all Samples are much less Play Mode reliant - I've changed all samples to be done via Editor buttons, with changes being made in Edit Mode

  • All Samples should be able to be fully executed within the "SAMPLE ENTRY POINT" object, without having to select different Unity GameObjects

  • ExportAnimationWithRecorder (New):
    -- Quick example scene with serialized fields that show the proper set up of how to record animation of Unity GameObject and export it as a USD file

  • ExportMesh:
    -- Made the process of exporting a more step-by-step process

  • HelloUsd:
    -- Added more console debug logs
    -- Added auto focus to console window

  • ExportMeshTransformOverrides
    -- Set up a scene where a USD asset is imported
    -- Randomly changes the transform value
    -- Exports it as a transform overrides USD file

  • ExportMeshWithAnimation
    -- Made it more a step by step process

  • ImportMaterials
    -- Made it more a step by step process

  • ImportMesh
    -- Made it more a step by step process

  • ImportProcessor:
    -- Added a new scene that show off the functionalities of CombineMeshes.cs and SetHideFlags.cs that implements Unity USD's ImportProcessor

  • UsdTimelinePlayable:
    -- Quick example scene with serialized fields that show the proper set up of how to play the animation of an imported USD asset

Testing

Functional Testing status:

Performance Testing status:

Overall Product Risks

Complexity:

Halo Effect:

Additional information

Note to reviewers:

Reminder:

  • Add entry in CHANGELOG.md (if applicable)

@michaeljblain michaeljblain requested a review from a team April 6, 2023 10:27
Copy link
Collaborator

@vickycl vickycl left a comment

Choose a reason for hiding this comment

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

I've run through the samples and I think there's a confusing mix of samples running in playmode and edit mode. Because we don't really support USD at runtime, I think we should make all of the samples consistently run in Editor only and maybe use more buttons to trigger behaviours (which I think would be more similar to what users will probably want to do).

Let's have a call to discuss next steps :)

package/com.unity.formats.usd/package.json Outdated Show resolved Hide resolved
@lee-aandrew lee-aandrew changed the title Make package samples more user friendly [Draft] Make package samples more user friendly Apr 21, 2023
Copy link
Collaborator

@vickycl vickycl left a comment

Choose a reason for hiding this comment

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

A few comments based only on the PR, let me know when you want me to check out and test the samples :)

Copy link
Collaborator

@vickycl vickycl left a comment

Choose a reason for hiding this comment

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

ImportMesh samples are much nicer now :) There's just some small points on those ones for consistency.

I found the new layout for the PostProcessing samples to be confusing, as a couple of things were hidden away in folder structures or different scenes. Hopefully the comments made sense?

For the ImportMaterials samples, I think the step breakdown is too much. There's no value to having each step as a separate button, and more chance of breakage. I think we should return that to being more simple, as a user wanting to emulate that sample would need to look at the code anyway and not care about the button steps. I also think it's missing the previous behaviour of applying the imported material to the cube in the scene and rotating in playmode to show it off.

There are two missing .sample.json files- I think they were for ExportMesh and ExportMeshTransformOverrides. These files help the UPM-CI find the Samples and add them to the package json.

GUILayout.Label($" 5. Set the <color={SampleUtils.TextColor.Blue}>Source Object</color> within the newly created <b>'Usd Playable Track'</b> as the USD GameObject, <color={SampleUtils.TextColor.Yellow}>'UsdAssetWithTimeline'</color> (first child of this object).", labelStyle);
GUILayout.Label($" 6. Within the 'Timeline Window' Right Click within the newly created <b>Usd Playable Track</b>, and select <color={SampleUtils.TextColor.Yellow}>'Add From Usd Asset'</color>.", labelStyle);
GUILayout.Label($" 7. In the new pop up <color={SampleUtils.TextColor.Blue}>'Select Usd Asset'</color> window select the USD GameObject, <color={SampleUtils.TextColor.Yellow}>'UsdAssetWithTimeline'</color>.", labelStyle);
GUILayout.Label($" 8. You can now play the Timeline animation and see the animation being played in your <b>Scene View</b> window.", labelStyle);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is only meant to be a 'Sample' so that a user can play around with the features, not a full walkthrough. Having the steps written out makes it quite brittle and easy to become out of date. I personally think these steps would be better suited to being in the documentation instead of a Sample, where they will be easier and more obvious to keep up to date.

Copy link
Contributor Author

@lee-aandrew lee-aandrew May 5, 2023

Choose a reason for hiding this comment

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

I've removed a lot of steps from both this and ExportAnimationWithRecorderExample with the belief that all the serialized fields will be saved 🤞

Lemme know what you think!

@lee-aandrew lee-aandrew requested a review from vickycl May 5, 2023 01:00
@lee-aandrew lee-aandrew changed the title [Draft] Make package samples more user friendly [USDU-331] Make package samples more user friendly May 5, 2023
SampleUtils.FocusConsoleWindow();

script.SetUpExportContext();
Debug.Log($"Export Context has been set up.");
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think each of these debug.logs should use the same green, so that they all stand out as behaviour caused by the samples

Copy link
Collaborator

Choose a reason for hiding this comment

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

'Setup Export Context' isn't really a useful step. It doesn't explain what is happening or why. Perhaps just combine this with the export step, or at least call it "Generate settings for export"


if (GUILayout.Button("6. Close Scene"))
{
script.CloseScene();
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't see a reason to do the Save and Close steps seperately- I think they should be combined into one step to reduce clicks.

{
if (script.IsFinishedRecording)
{
if (GUILayout.Button("Recording Complete - Stop Scene"))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should be "Recording Complete - Exit Playmode"

@@ -1,4 +1,4 @@
{
"displayName" : "ExportMesh",
"description" : "A sample showing how to record a scene to a USD file."
"description" : "A sample showing how Unity Game Object can be exported as a USD file (without animation)."
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add something along the lines of "using the Unity USD APIs directly" so that it's clear that this isn't the only way of doing it for a first time user

@@ -0,0 +1,4 @@
{
"displayName" : "ExportMeshTransformOverrides",
"description" : "A sample showing an example of imported USD file exported as transform override."
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this should be "A sample showing how to export an imported USD asset with modified transforms as a USD override file using the Unity USD APIs."

@@ -0,0 +1,4 @@
{
"displayName" : "ExportMeshWithAnimation",
"description" : "A sample showing how to record a scene to a USD file."
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should be "A sample showing how to record an animation to a USD file without using the recorder package."

script.InitializeUsd();
}

if (GUILayout.Button("2. Set USD File Path..."))
Copy link
Collaborator

Choose a reason for hiding this comment

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

This additional step makes the sample confusing. To make it less confusing and also remove the risk of it going wrong, just remove it and always import the USD file provided with the Sample.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this approach is too confusing and detracts away from the automatic post processing we're trying to demonstrate. I think in the interest of getting this landed we should revert this sample to how it was for now, but I've sent you a message on Slack so we can discuss.


void Update()
{
SetSampleUsdFilePath();
Copy link
Collaborator

Choose a reason for hiding this comment

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

This shouldn't be called every frame :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think having this run every frame is beneficial to make sure the user cant change the path for this USD Asset to another USD file since not every USD file will contain animation
I just want to enforce this specific asset on this Sample

Copy link
Collaborator

Choose a reason for hiding this comment

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

The file path isn't easily modifiable anyway, and it's demonstrating a bad practice for a user (running something every editor frame, especially something doing a GetComponent and a string manipulation). It would be a very edge case behaviour if a user modified that file path manually, and personally if they did so I think it would be better if it caused an issue (as it would in a real case) instead of silently 'fixed' itself

Copy link
Collaborator

Choose a reason for hiding this comment

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

[hijacking this file to say] I think the Hello USD would benefit from calling out in the .sample.json that it is the introductory walkthrough of how to write and read a USD file through code, so that it's easy for a user to pick a first sample to look at and also understand why it's broken down to be so granular.

@lee-aandrew lee-aandrew marked this pull request as draft May 10, 2023 19:53
@lee-aandrew lee-aandrew changed the title [USDU-331] Make package samples more user friendly [Draft][USDU-331] Make package samples more user friendly May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants