question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Suggestion: Add children param to Group constructor

See original GitHub issue

Is your feature request related to a problem? Please describe.

When using Group we always end up using the same pattern:

//create group
let group = new Group();

//create meshes
let m1 = new Mesh( geom, mat );
let m2 = new Mesh( geom, mat );
...

//add meshes
group.add( m1 );
group.add( m2 );
...

return group;

I think this can be simplified if Group accepted children as parameter in constructor, as Mesh accepts Geometry and Material.

Describe the solution you’d like

Using the proposed change the code would look like:

//create meshes
let m1 = new Mesh( geom, mat );
let m2 = new Mesh( geom, mat );

return new Group( [ m1, m2, ... ] );

I think Group should accept children as parameter since its purpose is precisely that, having children. And it would simplify the code.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Mugen87commented, Jun 2, 2021

If we do this, users could expect we change the constructor of Bone in the same fashion. Simply because in many cases bones do have bones as children.

I think it’s better if 3D objects only accept a geometry and/or material parameter. And that’s it.

1reaction
Mugen87commented, May 31, 2021

Are you aware that you can do this?

group.add( m1, m2 );

This works with an arbitrary number of arguments. Against this backdrop, I do not vote to change the API.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to pass large number of parameters to a constructor?
Solution 2 ; class Child { private ; string childblood, DateTime childdbirth ) { sname = childname; sblood = childblood; dbirth = childdbirth;...
Read more >
Why default constructor is required in a parent class if it has an ...
With empty parameter list I mean the implicit super() the compiler could add if the super class had a nonparametric constructor. For example...
Read more >
Best practices for AudioProcessorValueTreeState and child ...
One solution might be to create a custom ParamGroup struct that holds references to the parameters for a given group using their specific...
Read more >
Constructors and Destructors - Manual - PHP
PHP allows developers to declare constructor methods for classes. Classes which have a constructor method call this method on each newly-created object, ...
Read more >
Children Parameters - Android Developers
To add a children parameter to a frame or group, select the layer in Figma and click the + button next to “Parameters”,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found