CubicVR.js icon indicating copy to clipboard operation
CubicVR.js copied to clipboard

Add properties and name to all scene items

Open BraindeadBZH opened this issue 12 years ago • 1 comments

Hi,

It would be great that every items in the scene have the properties and name member, like SceneObject. Camera is missing the properties member. Light is missing both name and properties.

Thanks.

BraindeadBZH avatar Jan 27 '13 21:01 BraindeadBZH

The modification for Light:

if (typeof (light_type) == 'object') {
    // ...
    this.name = (light_type.name === undef) ? ((name !== undef) ? name : null) : light_type.name;
    this.properties = base.get(light_type.properties)||{};
} else {
    // ...
    this.name = "light" + this.light_type;
    this.properties = {};
}

The modification for Camera:

if (typeof (width) == 'object') {
    // ...
    this.properties = base.get(obj_init.properties)||{};

    height = obj_init.height ? obj_init.height : undef;
    width = obj_init.width ? obj_init.width : undef;
} else {
    // ...
    this.properties = {};
}

Its particularly useful when you construct your scene from JSON file and you have to interact with the items.

BraindeadBZH avatar Jan 27 '13 22:01 BraindeadBZH