aframe
aframe copied to clipboard
Introduce sceneOnly flag for components
Description:
There are a couple of components intended to be used on <a-scene> exclusively. These reside in src/components/scene, but little prevents people from (accidentally) using them on other entities. Only the fog component performed a check that it was applied to the scene.
Instead of adding similar checks to all these components, this PR introduces a sceneOnly flag that components can set in their definition. Similar to the multiple flag this will throw when a sceneOnly component is being added to an entity that isn't the scene.
Changes proposed:
- Introduce
sceneOnlyflag in property definition - Verify that
sceneOnlycomponents are only added to<a-scene>otherwise throw an Error