Skip to content

Conversation

@pravusjif
Copy link
Member

Add propagate_to_children field to PBVisibilityComponent.

The rules for propagation are introduced as code comments and are:

  1. If child has own PBVisibilityComponent -> Own component takes priority, skip in propagation
  2. Child's PBVisibilityComponent removed -> Re-inherit from parent hierarchy
  3. Child has own component + propagateToChildren=TRUE -> Child's propagation takes over for grandchildren (blocks ancestor)
  4. Child has own component + propagateToChildren=FALSE -> "Pass-through": grandchildren inherit from ancestor, not child
  5. Entity reparented into non-propagating hierarchy -> Reset to visible
  6. Entity reparented into propagating hierarchy -> Inherit new hierarchy visibility
  7. Reparented entity has children -> Propagate visibility to all descendants of reparented entity
  8. Parent's PBVisibilityComponent removed -> Children reset to visible

Related PRS

@github-actions
Copy link

github-actions bot commented Dec 17, 2025

Test this pull request

  • The @dcl/protocol package can be tested in scenes by running
    npm install "https://sdk-team-cdn.decentraland.org/@dcl/protocol/branch//dcl-protocol-1.0.0-20440016425.commit-449da37.tgz"

@robtfm
Copy link
Contributor

robtfm commented Dec 22, 2025

it's quite complex to read the rules, i think it is more simply (and still completely) expressed with:

- any own visibility component takes priority
- if no own visibility component, visibility is determined by visibility of the nearest parent with propagate = true
- if no own component and no parent with propagate = true, visibility is "visible"
- visibility is always updated, whenever hierarchy, parent component or own component changes

@robtfm
Copy link
Contributor

robtfm commented Dec 22, 2025

the current rules are useful for implementers though...

    // Propagation follows certain rules:
    // 1. If child has own PBVisibilityComponent -> Own component takes priority, skip in propagation
    // 2. Child's PBVisibilityComponent removed -> Re-inherit from parent hierarchy
    // 3. Child has own component + propagateToChildren=TRUE -> Child's propagation takes over for grandchildren (blocks ancestor)
    // 4. Child has own component + propagateToChildren=FALSE -> "Pass-through": grandchildren inherit from ancestor, not child
    // 5. Entity reparented into non-propagating hierarchy -> Reset to visible
    // 6. Entity reparented into propagating hierarchy -> Inherit new hierarchy visibility
    // 7. Reparented entity has children -> Propagate visibility to all descendants of reparented entity
    // 8. Parent's PBVisibilityComponent removed -> Children reset to visible

so it's up to you i guess, i approve as is, the functionality and description is sound as is

robtfm
robtfm previously approved these changes Dec 22, 2025
nicoecheza
nicoecheza previously approved these changes Dec 22, 2025
@robtfm
Copy link
Contributor

robtfm commented Dec 22, 2025

maybe it should be default=true?

i have it like that in bevy currently and didn't see any issues (though maybe that's because they are .... invisible)

@pravusjif
Copy link
Member Author

maybe it should be default=true?

i have it like that in bevy currently and didn't see any issues (though maybe that's because they are .... invisible)

I wouldn't put it to default true because that will potentially break existent scenes behaviour.

Imagine a scene that uses the VisibilityComponent today and if we start using the propagation to be true by default that current usage would start hiding things that weren't intended to be hidden...

I know at least content team does use the component so ti will at the very least affect probably every complex scene already deployed by the content team (minigames, genesis plaza, some festival scenes)

Signed-off-by: Pravus <pravusjif@gmail.com>
@pravusjif pravusjif dismissed stale reviews from nicoecheza and robtfm via 54ce874 December 22, 2025 18:03
@pravusjif pravusjif requested review from nicoecheza and robtfm and removed request for cyaiox, gonpombo8 and kuruk-mm December 22, 2025 18:06
@pravusjif pravusjif merged commit 417c1dc into main Dec 22, 2025
3 checks passed
@pravusjif pravusjif deleted the feat/visibility-component-propagate-to-children branch December 22, 2025 18:15
kuruk-mm added a commit that referenced this pull request Jan 29, 2026
#348)

* feat: audio source & video player spatial audio (#323)

* feat: visibility component propagateToChildren (#330)

Add propagate_to_children field to PBVisibilityComponent.

The rules for propagation are introduced as code comments and are:

1. If child has own PBVisibilityComponent -> Own component takes priority, skip in propagation
2. Child's PBVisibilityComponent removed -> Re-inherit from parent hierarchy
3. Child has own component + propagateToChildren=TRUE -> Child's propagation takes over for grandchildren (blocks ancestor)
4. Child has own component + propagateToChildren=FALSE -> "Pass-through": grandchildren inherit from ancestor, not child
5. Entity reparented into non-propagating hierarchy -> Reset to visible
6. Entity reparented into propagating hierarchy -> Inherit new hierarchy visibility
7. Reparented entity has children -> Propagate visibility to all descendants of reparented entity
8. Parent's PBVisibilityComponent removed -> Children reset to visible

* feat: movePlayerTo new 'duration' field (#331)

* feat: Social service changes from experimental (#343)

* feat: extract social service changes from experimental

- Add errors.proto with social service error definitions
- Update v2/social_service_v2.proto with voice chat, community features
- Add v3/social_service_v3.proto with new social service definitions

* remove unused social service v3

* feat: pointer max player distance (#345)

* Add timestamp field to PlayerEmote message

* Add is_instant and is_emoting fields to Movement message

Cherry-picked from experimental PR #279 (fix: emotes interpolation)

---------

Co-authored-by: Gon Pombo <gonzalo@decentraland.org>
Co-authored-by: Pravus <pravusjif@gmail.com>
Co-authored-by: Nicolas Lorusso <56365551+lorux0@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants