CubicVR.js
CubicVR.js copied to clipboard
Add properties and name to all scene items
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.
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.