0

At the weekend there was little time for coding, so I did not have much to do (I modeled the logo =)). Redid the code from the previous post.
Firstly, I checked that the passed parameters are an object:

if ( !(params instanceof Object) ) {

  console.error( 'params must be an object. Now params are ' + typeof params );
  return;

}

Instead of manually input parameters for each standard object, I create its geometry, take a list of parameters, create a new object with these parameters

geometry = new THREE.BoxGeometry();
Object.assign( data, geometry.parameters );
geometry.dispose();

For each key in this object, I check its presence in the transmitted object with parameters, if it exists, I assign a value, if not, I throw a warning, the value remains undefined. This check is for the developer, not for the user.

for (const key in data) {

  if ( params.hasOwnProperty(key) ) {
    data[ key ] = params[ key ];
  }
  else {
    console.warn( 'Parameter "' + key + '" is missing ' );
  }
}

In TA_UI added verification that the object came with parameters

createParametersMenu( entity ) {

if ( !entity.geometry.parameters) {

  console.warn( "No Params" );
  return;

}
0