17 Jul 2014, 14:18
Hello, me again!
I ran into a strange issue when using different cameras with different depth orders and Button nodes. There are four cameras ordered from 0 to 3 (background, main, interface, popup) for a proper layering. Everything works fine when the Buttons do not pass events. However, setting passEvent to true for a single Button results in the Button being pressed whenever there is an event "above" it, even if it is covered by another Button at the event position. This only happens when depth ordering is done by the cameras and not within a single camera state where Transforms are used for depth ordering.
The second Button in this example will also react when pressing one of the Buttons above.
I ran into a strange issue when using different cameras with different depth orders and Button nodes. There are four cameras ordered from 0 to 3 (background, main, interface, popup) for a proper layering. Everything works fine when the Buttons do not pass events. However, setting passEvent to true for a single Button results in the Button being pressed whenever there is an event "above" it, even if it is covered by another Button at the event position. This only happens when depth ordering is done by the cameras and not within a single camera state where Transforms are used for depth ordering.
<CameraState cameraId="background_camera"/>
<FixedParameters diffuseColor="1.0f, 1.0f, 1.0f, 1.0f">
<Button upStateChildIndex="0" downStateChildIndex="1" hoverStateChildIndex="2" posX="-500" sizeX="500" sizeY="500">
<PlaneGeometry frameSizeX="500" frameSizeY="500" materialSlot="2"/>
<PlaneGeometry frameSizeX="400" frameSizeY="400" materialSlot="2"/>
<PlaneGeometry frameSizeX="500" frameSizeY="500" materialSlot="2"/>
</Button>
</FixedParameters>
<CameraState cameraId="main_camera"/>
<FixedParameters diffuseColor="0.0f, 0.0f, 1.0f, 1.0f">
<Button upStateChildIndex="0" downStateChildIndex="1" hoverStateChildIndex="2" posX="-300" sizeX="500" sizeY="500" passEvents="yes">
<PlaneGeometry frameSizeX="500" frameSizeY="500" materialSlot="2"/>
<PlaneGeometry frameSizeX="400" frameSizeY="400" materialSlot="2"/>
<PlaneGeometry frameSizeX="500" frameSizeY="500" materialSlot="2"/>
</Button>
</FixedParameters>
<CameraState cameraId="interface_camera"/>
<FixedParameters diffuseColor="0.0f, 1.0f, 0.0f, 1.0f">
<Button upStateChildIndex="0" downStateChildIndex="1" hoverStateChildIndex="2" posX="-100" sizeX="500" sizeY="500">
<PlaneGeometry frameSizeX="500" frameSizeY="500" materialSlot="2"/>
<PlaneGeometry frameSizeX="400" frameSizeY="400" materialSlot="2"/>
<PlaneGeometry frameSizeX="500" frameSizeY="500" materialSlot="2"/>
</Button>
</FixedParameters>
<CameraState cameraId="popup_camera"/>
<FixedParameters diffuseColor="1.0f, 0.0f, 0.0f, 1.0f">
<Button upStateChildIndex="0" downStateChildIndex="1" hoverStateChildIndex="2" posX="100" sizeX="500" sizeY="500">
<PlaneGeometry frameSizeX="500" frameSizeY="500" materialSlot="2"/>
<PlaneGeometry frameSizeX="400" frameSizeY="400" materialSlot="2"/>
<PlaneGeometry frameSizeX="500" frameSizeY="500" materialSlot="2"/>
</Button>
</FixedParameters>
The second Button in this example will also react when pressing one of the Buttons above.