Summary
Add an exclusionScope list to LightBase that allows excluding nodes from the light's scope.
Problem
If a parent node is added to the scope of the light, all nodes under it are implicitly included in the scope. If one of those child nodes should not be included, the user must instead traverse the children hierarchy and add them individually.
Solution
Adding an exclusionScope list to LightBase to allow excluding nodes from the scope list without needing to traverse the scenegraph hierarchy and adding only the desired nodes to the scope..
Specification
The LightBase class doc was updated from:
/**
* The {@code LightBase} class provides definitions of common properties for
* objects that represent a form of Light source. These properties
* include:
* <ul>
* <li>The color that defines color of the light source.
* </ul>
*
* Note that this is a conditional feature. See
* {@link javafx.application.ConditionalFeature#SCENE3D ConditionalFeature.SCENE3D}
* for more information.
*
* <p>
* An application should not extend the LightBase class directly. Doing so may lead to
* an UnsupportedOperationException being thrown.
* </p>
*
* @since JavaFX 8.0
*/
to:
/**
* The {@code LightBase} class provides definitions of common properties for
* objects that represent a form of light source. These properties
* include:
* <ul>
* <li>{@code color} - the color of the light source</li>
* <li>{@code scope} - a list of nodes the light source affects</li>
* <li>{@code exlusionScope} - a list of nodes the light source does not affect</li>
* </ul>
*
* <p>
* A node can exist in only one of the lists, if it is added to one, it is silently removed from the other. If a node
* does not exist in any list, it inherits its affected state from its parent, recursively. An exception to this is that
* a light with an empty {@code scope} affects all nodes in its scene/subscene implicitly (except for those in its
* {@code exlusionScope}) as if the root of the scene is in the {@code scope}. <br>
* The {@code exlusionScope} is useful only for nodes that would otherwise be in scope of the light. Excluding a node is
* a convenient alternative to traversing the scenegraph hierarchy and adding all of the other nodes to the light's
* scope. Instead, the scope can remain wide and specific nodes can be excluded.
*
* <p>
* Note that this is a conditional feature. See
* {@link javafx.application.ConditionalFeature#SCENE3D ConditionalFeature.SCENE3D}
* for more information.
*
* <p>
* An application should not extend the {@code LightBase} class directly. Doing so may lead to
* an {@code UnsupportedOperationException} being thrown.
* </p>
*
* @since JavaFX 8.0
*/
Added the getExclusionScope() method:
/**
* Gets the list of nodes that specifies the hierarchical exclusion scope of this light. Any {@code Shape3D}s in
* this list or under a {@code Parent} in this list are not affected by this light, unless a closer parent exists in
* the {@code scope} list. <br>
* This is a convenience list for excluding nodes that would otherwise be in scope of the light.
*
* @return the list of nodes that specifies the hierarchical exclusion scope of this light
* @see #getScope
* @since 13
*/
public ObservableList<Node> getExclusionScope()
Updated the getScope() method docs from:
/**
* Gets the list of nodes that specifies the
* hierarchical scope of this Light. If the scope list is empty,
* the Light node has universe scope: all nodes under it's scene
* are affected by it. If the scope list is non-empty, only those
* 3D Shape nodes in the scope list and under the Group nodes in the
* scope list are affected by this Light node.
* @return the list of nodes that specifies the hierarchical scope of this
* Light
*/
to:
/**
* Gets the list of nodes that specifies the hierarchical scope of this light. Any {@code Shape3D}s in this list or
* under a {@code Parent} in this list are affected by this light, unless a closer parent exists in the
* {@code exclusionScope} list. If the list is empty, all nodes under the light's scene/subscene are affected by it
* (unless they are in the {@code exclusionScope}).
*
* @return the list of nodes that specifies the hierarchical scope of this light
* @see #getExclusionScope
*/
- csr of
-
JDK-8222258 Add exclusion scope for LightBase
-
- Resolved
-