-
Notifications
You must be signed in to change notification settings - Fork 77
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
base: dev
Are you sure you want to change the base?
Conversation
package/com.unity.formats.usd/Samples/UsdTimelinePlayable/README.md
Outdated
Show resolved
Hide resolved
package/com.unity.formats.usd/Samples/HelloUsd/HelloUsdExample.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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 :)
c563da3
to
9656bc2
Compare
There was a problem hiding this 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 :)
package/com.unity.formats.usd/Samples/ExportMeshWithAnimation/Explode.cs
Show resolved
Hide resolved
package/com.unity.formats.usd/Samples/ExportMeshWithAnimation/ExportMeshWithAnimationExample.cs
Outdated
Show resolved
Hide resolved
package/com.unity.formats.usd/Samples/ExportMeshWithAnimation/ExportMeshWithAnimationExample.cs
Show resolved
Hide resolved
package/com.unity.formats.usd/Samples/HelloUsd/Editor/HelloUsdExampleEditor.cs
Outdated
Show resolved
Hide resolved
package/com.unity.formats.usd/Samples/ImportProcessor/Editor/SetHideFlagsEditor.cs
Outdated
Show resolved
Hide resolved
package/com.unity.formats.usd/Samples/UsdTimelinePlayable/README.md
Outdated
Show resolved
Hide resolved
…use custom step by step method rather than simply using the ExporterHelper functions
There was a problem hiding this 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.
package/com.unity.formats.usd/Samples/ExportMesh/Editor/ExportMeshExampleEditor.cs
Show resolved
Hide resolved
package/com.unity.formats.usd/Samples/ExportMesh/Editor/ExportMeshExampleEditor.cs
Outdated
Show resolved
Hide resolved
...rocessor/PostProcessComponents_CombineMeshes/ImportProcessorExample_PostProcessComponents.cs
Outdated
Show resolved
Hide resolved
package/com.unity.formats.usd/Samples/ImportProcessor/ExampleAsset.meta
Outdated
Show resolved
Hide resolved
package/com.unity.formats.usd/Samples/ImportMaterials/Editor/ImportMaterialsExampleEditor.cs
Outdated
Show resolved
Hide resolved
package/com.unity.formats.usd/Samples/ImportMaterials/Editor/ImportMaterialsExampleEditor.cs
Show resolved
Hide resolved
package/com.unity.formats.usd/Samples/ImportMaterials/ImportMaterialsExample.cs
Show resolved
Hide resolved
...com.unity.formats.usd/Samples/UsdTimelinePlayable/Editor/UsdTimelineRecorderExampleEditor.cs
Outdated
Show resolved
Hide resolved
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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
package/com.unity.formats.usd/Samples/UsdTimelinePlayable/UsdTimelineRecorderExample.cs
Outdated
Show resolved
Hide resolved
SampleUtils.FocusConsoleWindow(); | ||
|
||
script.SetUpExportContext(); | ||
Debug.Log($"Export Context has been set up."); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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")) |
There was a problem hiding this comment.
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)." |
There was a problem hiding this comment.
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." |
There was a problem hiding this comment.
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." |
There was a problem hiding this comment.
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...")) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
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: