The different helper classes really come in handy when developing, especially for non-visible objects like planes and lights.
I wonder if it makes sense to let all the current helpers extend a base class called "Helper" or so. This would make it easy to traverse through all the helpers in an object with a .isHelper
property and e.g. change their visibility.
The thing is that helpers have different super classes right now e.g. Object3D
, LineSegments
, Line
or Mesh
. I think you need some refactoring in order to change this situation. Not sure it's worth to do so just for introducing a .isHelper
property...
Yep that's a good point... They do all have Object3D as a super class, it would be possible to add a super class between Object3D and the next (super) class. Just for an .isHelper
that does sound over the top though.
Has something like this been discussed before? i can't seem to find anything in the direction
Has something like this been discussed before?
Not to my knowledge.
I would vote for such a change if the Helper
class would do a bit more than just defining .isHelper
. Unfortunately, helpers work differently and don't share a common interface.
I know this is a long shot, but I'd suggest mixin pattern for helper class.
For example:
export const Helper = ( superclass ) => class extends superclass {
constructor() {
this.isHelper = true;
}
}
And then you define your custom helper...
export class MyHelper extends Helper(MeshOrWhatever) {
}
This can be handled at the app level.
var myHelpers = [];
myHelpers.push( gridHelper );
Most helpful comment
This can be handled at the app level.