Anyone ever managed to get Particle Systems to work with Proxy-based multi-inherit?

I’ve been using this nifty “multi-inherit” method to mix data loaded from json with classes that add methods:

I was hoping I could leverage it for instantiating particle systems too, but it does not seem to work:

Just wondering if anyone had ever tried anything similar.

Not sure what you are actually trying to achieve, but this should work.
I noticed that when trying to output the object (for example console.log) it complains about a missing getDesc function. Going to the original post you linked, the function looks like this:

function getDesc (obj, prop) {
  var desc = Object.getOwnPropertyDescriptor(obj, prop);
  return desc || (obj=Object.getPrototypeOf(obj) ? getDesc(obj, prop) : void 0);

The getOwnPropertyDescriptor is calling this function as well, so to me, without analyzing this entire thing for too long, it seems like a never ending loop (which is what the browser is also complaining about, when adding this function - maximum call stack size exceeded).

Couldn’t you get the same effect with prototype inheritance?

The goal is to have two prototypes: one with the data (loaded from json) and one with functionality (the ParticleSystem.) This avoids giant functions full of
particleSystem.minSize = 1; particleSystem.maxSize = 2; etc...

Object.create() (prototypical inheritance) does not seem to work either:

You can get roughly the same thing with

    let particle_system = new BABYLON.ParticleSystem("particles", 2000, _.scene);                                                                                            
    let proto = this.particles[type];                                                                                                                                        
    for(let prop of Object.keys(proto)){                                                                                                                                 
      particle_system[prop] = proto[prop];                                                                                                                               
    return particle_system;

Thanks for taking a look anyway.

if you just want to combine a json and a js, you can use Object.assign, or, as you did, iterate over the keys of props… then metaprogramming is an overkill in that case, as you only one one prototype.

Oh wow, I did not know about Object.assign… that just about does the trick! Thanks!