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

Editor: Added samples info for REALISTIC shading #28432

Merged
merged 1 commit into from
May 22, 2024

Conversation

ycw
Copy link
Contributor

@ycw ycw commented May 19, 2024

This PR added samples info in the viewport info for REALISTIC shading:

pathtracer.samples.in.info.mp4

Preview: https://raw.githack.com/ycw/three.js/editor-viewport-info-samples-info/editor/index.html

@ycw
Copy link
Contributor Author

ycw commented May 19, 2024

just in case you can't find it in the demo video 🙏🏻:

1

@mrdoob mrdoob added this to the r165 milestone May 20, 2024

samplesText.setValue( samples );

const samplesStringKey = ( pluralRules.select( samples ) === 'one' ) ? 'viewport/info/oneSample' : 'viewport/info/samples';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Reconsidering #28245.

Do we really need this distinction? Stuff like that creates an unnecessary complexity. Why not just using Sample(s)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

vertex(ices) then ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Or we just always use the plural? I personally don't see 1 samples as an issue which should be fixed with a separate code path.

Copy link
Contributor Author

@ycw ycw May 20, 2024

Choose a reason for hiding this comment

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

The issue about using (s) for just 'Sample(s)' is that, that unit will be inconsistent with other units formatted in the same area:

1 object
1 vertex
0 triangles
1 sample(s)

The reason that we can't apply (s) for other units has been mentioned #28432 (comment)

If handling of plural rules causes readability problems, then I prefer taking them into a function: (update: this function is now implemented in 54a4957)

function setInfo( quantity, unit ) { // ... set UI text values with proper format ... }

Copy link
Collaborator

Choose a reason for hiding this comment

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

Then I vote for always using plural (without brackets).

Copy link
Contributor Author

@ycw ycw May 20, 2024

Choose a reason for hiding this comment

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

Note that the transition from 0 > 1 > 2 samples is noticeable in low-end devices, so 'always use plural' like 1samples will confuse users that the quantity is incorrect.

@ycw ycw force-pushed the editor-viewport-info-samples-info branch from 55ca69b to 54a4957 Compare May 20, 2024 19:22
@ycw
Copy link
Contributor Author

ycw commented May 21, 2024

Or, we can uses icons with long description as tooltips shown on hover, this way plural rules can be eliminated totally:

image

Thoughts? thanks :D

@mrdoob
Copy link
Owner

mrdoob commented May 22, 2024

Do you mind leaving the plural refactoring for another PR?
This PR is about adding the samples info, but the plural refactoring is blocking it...

@ycw ycw force-pushed the editor-viewport-info-samples-info branch from 54a4957 to bdb29a8 Compare May 22, 2024 11:23
@ycw
Copy link
Contributor Author

ycw commented May 22, 2024

Do you mind leaving the plural refactoring for another PR?

ok

@mrdoob mrdoob merged commit 4686d48 into mrdoob:dev May 22, 2024
11 checks passed

samplesText.setValue( samples );

const samplesStringKey = ( pluralRules.select( samples ) === 'one' ) ? 'viewport/info/oneSample' : 'viewport/info/samples';
Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems the plural logic is still in place though....

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mind leaving the plural refactoring for another PR?

^^^^^^^

:D

Copy link
Owner

@mrdoob mrdoob May 22, 2024

Choose a reason for hiding this comment

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

I think the current plural code is fine (with the clean up).

The refactoring was over engineering.

@mrdoob
Copy link
Owner

mrdoob commented May 22, 2024

Some clean up: 1cc0bfe

@ycw
Copy link
Contributor Author

ycw commented May 22, 2024

thanks.

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