11/*
2- * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
3- * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
2+ * Copyright (c) 2024 jMonkeyEngine
3+ * All rights reserved.
4+ *
5+ * Redistribution and use in source and binary forms, with or without
6+ * modification, are permitted provided that the following conditions are
7+ * met:
8+ *
9+ * * Redistributions of source code must retain the above copyright
10+ * notice, this list of conditions and the following disclaimer.
11+ *
12+ * * Redistributions in binary form must reproduce the above copyright
13+ * notice, this list of conditions and the following disclaimer in the
14+ * documentation and/or other materials provided with the distribution.
15+ *
16+ * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
17+ * may be used to endorse or promote products derived from this software
18+ * without specific prior written permission.
19+ *
20+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
431 */
532package com .jme3 .anim ;
633
734import com .jme3 .scene .Spatial ;
8- import java .util .Iterator ;
935
1036/**
1137 * Extension of {@link ArmatureMask}.
@@ -58,6 +84,7 @@ public AlertArmatureMask addAll() {
5884 }
5985 return this ;
6086 }
87+
6188 /**
6289 * Adds the given joint and all its children to this mask.
6390 * @param joint
@@ -67,6 +94,7 @@ public AlertArmatureMask addFromJoint(String joint) {
6794 super .addFromJoint (skin .getArmature (), joint );
6895 return this ;
6996 }
97+
7098 /**
7199 * Adds the given joints to this mask.
72100 * @param joints
@@ -100,20 +128,23 @@ public AlertArmatureMask setCheckUpperLayers(boolean check) {
100128 public String getTargetLayer () {
101129 return layer ;
102130 }
131+
103132 /**
104133 * Get the {@link AnimComposer} this mask is for.
105134 * @return
106135 */
107136 public AnimComposer getAnimComposer () {
108137 return anim ;
109138 }
139+
110140 /**
111141 * Get the {@link SkinningControl} this mask is for.
112142 * @return
113143 */
114144 public SkinningControl getSkinningControl () {
115145 return skin ;
116146 }
147+
117148 /**
118149 * Returns true if this mask is checking upper layers for joint use.
119150 * @return
@@ -126,16 +157,13 @@ public boolean isCheckUpperLayers() {
126157 public boolean contains (Object target ) {
127158 return simpleContains (target ) && (!checkUpperLayers || !isAffectedByUpperLayers (target ));
128159 }
160+
129161 private boolean simpleContains (Object target ) {
130162 return super .contains (target );
131163 }
164+
132165 private boolean isAffectedByUpperLayers (Object target ) {
133166 boolean higher = false ;
134- /**
135- * ... Since AnimComposer does not provide a Collection that
136- * has a decending iterator, we will just have to skip over
137- * a bunch of lower layers before we actually need to do anything.
138- */
139167 for (String name : anim .getLayerNames ()) {
140168 if (name .equals (layer )) {
141169 higher = true ;
@@ -169,6 +197,7 @@ else if (lyr.getMask().contains(target)) {
169197 public static AlertArmatureMask all (String layer , Spatial spatial ) {
170198 return new AlertArmatureMask (layer , spatial ).addAll ();
171199 }
200+
172201 /**
173202 * Creates an {@code AlertArmatureMask} for all joints.
174203 * @param layer
0 commit comments