- change Spatial and AbstractControl so that control.setSpatial doesn't have to be called in Control.cloneForSpatial but the engine also doesn't throw an exception if it does
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10367 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
cc13547e19
commit
b17fbf1f49
@ -1182,7 +1182,9 @@ public abstract class Spatial implements Savable, Cloneable, Collidable, Cloneab
|
|||||||
|
|
||||||
clone.controls = new SafeArrayList<Control>(Control.class);
|
clone.controls = new SafeArrayList<Control>(Control.class);
|
||||||
for (int i = 0; i < controls.size(); i++) {
|
for (int i = 0; i < controls.size(); i++) {
|
||||||
clone.controls.add(controls.get(i).cloneForSpatial(clone));
|
Control newControl = controls.get(i).cloneForSpatial(clone);
|
||||||
|
newControl.setSpatial(this);
|
||||||
|
clone.controls.add(newControl);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (userData != null) {
|
if (userData != null) {
|
||||||
|
@ -54,7 +54,7 @@ public abstract class AbstractControl implements Control {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setSpatial(Spatial spatial) {
|
public void setSpatial(Spatial spatial) {
|
||||||
if (this.spatial != null && spatial != null) {
|
if (this.spatial != null && spatial != null && spatial != this.spatial) {
|
||||||
throw new IllegalStateException("This control has already been added to a Spatial");
|
throw new IllegalStateException("This control has already been added to a Spatial");
|
||||||
}
|
}
|
||||||
this.spatial = spatial;
|
this.spatial = spatial;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user