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

add loop and loopMode capabilities for AnimationSystem, fix for comp-audio to match comp-anim: state-->action #599

Merged
merged 9 commits into from
Apr 30, 2024

Conversation

hanbollar
Copy link
Contributor

@hanbollar hanbollar commented Apr 30, 2024

Linking

related to:

Problem

loop not implemented for data-comp-animation

Solution

implement it

Breaking Change

YES!!

  • changes audio state --> action. Made sure this was updated in the documentation repo and the samples here
  • adds looping for data-comp-animation

Notes

...


Required to Merge

  • PASS - all necessary actions must pass (excluding the auto-skipped ones)
  • TEST IN HEADSET - main dev-testing-example and any of the other examples still work as expected
  • VIDEO - if this pr changes something visually - post a video here of it in headset-MR and/or on desktop (depending on what it affects) for the reviewer to reference.
Untitled.mov
  • TITLE - make sure the pr's title is updated appropriately as it will be used to name the commit on merge
  • BREAKING CHANGE
    • DOCUMENTATION: This includes any changes to html tags and their components
    • SAMPLES/INDEX.HTML: This includes any changes (html tags or otherwise) that must be done to our landing page submodule as an effect of this pr's updates
      • make a pr in the mrjs landing page repo that updates the landing page to match the breaking change
      • link the pr of the landing page repo here: #pr
      • that pr must be approved by @hanbollar

Signed-off-by: hanbollar <github@hannahbollar.com>
Copy link

render bot commented Apr 30, 2024

Signed-off-by: hanbollar <github@hannahbollar.com>
Signed-off-by: hanbollar <github@hannahbollar.com>
Signed-off-by: hanbollar <github@hannahbollar.com>
Signed-off-by: hanbollar <github@hannahbollar.com>
Signed-off-by: hanbollar <github@hannahbollar.com>
@hanbollar hanbollar changed the title WIP - add 'loop' and 'loopMode' capabilities for animation loops add loop and loopMode capabilities for AnimationSystem, fix for comp-audio to be action instead of state Apr 30, 2024
Signed-off-by: hanbollar <github@hannahbollar.com>
Signed-off-by: hanbollar <github@hannahbollar.com>
Signed-off-by: hanbollar <github@hannahbollar.com>
@hanbollar hanbollar changed the title add loop and loopMode capabilities for AnimationSystem, fix for comp-audio to be action instead of state add loop and loopMode capabilities for AnimationSystem, fix for comp-audio to match comp-anim: state-->action Apr 30, 2024
Copy link
Member

@michaelthatsit michaelthatsit left a comment

Choose a reason for hiding this comment

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

Looks great with a few comments!

break;
let action = entity.mixer.clipAction(clip);

if (comp.hasOwnProperty('action')) {
Copy link
Member

Choose a reason for hiding this comment

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

You can also do comp?.action which is a little cleaner.

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 like the simpler approach you note, but that also makes it turn into a truthy check of the action value if it exists, meaning it can silently error (instead of hitting the default case) if a user makes a typo and leaves it as a 0 or an empty string for example

i'd prefer to keep it as the hasOwnProperty line, but lmk your thoughts

Copy link
Member

Choose a reason for hiding this comment

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

hmm does comp?.action == null not hit the default state?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry im confused - all that does is check if comp exists - and then whether comp.action == null

in the comp.hasOwnProperty line im trying to check if action exists before running through our switch statements - do you have a different preferred way of writing that?

in the audio system it looks like that's setup as comp.action ?? false - is that what you'd prefer instead?

Copy link
Contributor Author

@hanbollar hanbollar Apr 30, 2024

Choose a reason for hiding this comment

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

i think i'd still be a little worried of the comp.action value existing but being incorrect as a truthy-ness option and not going into if-statement even with comp.action ?? false 🤔

thoughts?

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'm going to merge it in since approved so not blocker, but lmk since that's a quick pr fix afterwards if needed

src/core/componentSystems/AnimationSystem.js Show resolved Hide resolved
@michaelthatsit
Copy link
Member

Approved for merge.

I use object.property pretty much everywhere so we miiight need to decide which approach to take across the board for consistency at some point.

@hanbollar
Copy link
Contributor Author

I use object.property pretty much everywhere so we miiight need to decide which approach to take across the board for consistency at some point.

oh i think object.property is fine most places we have it - i just think this is an edge situation where we need to be very careful of user entry given the multiple options that arent just true/false

@hanbollar hanbollar merged commit 8e3afe4 into main Apr 30, 2024
6 checks passed
@hanbollar hanbollar deleted the hb-anim-loop branch April 30, 2024 19:57
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.

2 participants