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

Are children selectors supported? #36

Open
marcusdiy opened this issue Jul 6, 2021 · 1 comment
Open

Are children selectors supported? #36

marcusdiy opened this issue Jul 6, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@marcusdiy
Copy link

Like in HTML, is there a way to use nested/recursive selector?
So this _r.select("*:mesh material:ball material:blue"); so it would:

  1. split query by space " " so we have 3 nested selectors
  2. find all *:mesh and the return childrens
  3. find all children from previus query with material:ball
  4. find all children with material:blue and return
@fabsharp
Copy link
Contributor

fabsharp commented Jul 7, 2021

Hi @marcusdiy and thanks for taking the time to test our framework, it's our first public issue :).

There's no nested/recursive selector implemented so a solution would be to use the filter methods :
let res = _r.select(*:mesh).filter(mesh => return mesh.material && (mesh.material.name == "blue" || mesh.material.name == "ball"))

...But _r is not usefull in this case so maybe we can do something with the attribute selector. For example with _r we can make _r.select('*:mesh [isVisible = true])
...But it's not recursive on the attribute, so it could be a good improvement to do something like
_r.select('*:mesh [material.name == blue || material.name == ball])

What do you think ?

@fabsharp fabsharp added the enhancement New feature or request label Jul 7, 2021
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

No branches or pull requests

2 participants