- make SceneExplorerProperty syncing a bit more consistent

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10085 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 12 years ago
parent 1fc78cae84
commit 08212605bc
  1. 15
      sdk/jme3-core/src/com/jme3/gde/core/properties/SceneExplorerProperty.java

@ -121,15 +121,20 @@ public class SceneExplorerProperty<T> extends PropertySupport.Reflection<T> {
mutex.postWriteRequest(new Runnable() { mutex.postWriteRequest(new Runnable() {
public void run() { public void run() {
T realValue = getSuperValue(); T realValue = getSuperValue();
if (objectLocal == null && !inited) { if ((objectLocal == null) && !inited) {
inited = true; inited = true;
T newObject = duplicateObject(realValue);
notifyListeners(PROP_INIT_CHANGE, null, newObject);
objectLocal = duplicateObject(realValue); objectLocal = duplicateObject(realValue);
notifyListeners(PROP_INIT_CHANGE, null, objectLocal); } else if ((objectLocal != null) && !objectLocal.equals(realValue)) {
} else if (objectLocal != null && !objectLocal.equals(realValue)) {
T oldObject = objectLocal; T oldObject = objectLocal;
T newObject = duplicateObject(realValue); T newObject = duplicateObject(realValue);
notifyListeners(PROP_SCENE_CHANGE, oldObject, newObject); notifyListeners(PROP_SCENE_CHANGE, oldObject, newObject);
objectLocal = newObject; objectLocal = newObject;
} else if ((objectLocal == null) && (realValue != null)) {
T newObject = duplicateObject(realValue);
notifyListeners(PROP_SCENE_CHANGE, null, newObject);
objectLocal = duplicateObject(realValue);
} }
} }
}); });
@ -144,9 +149,9 @@ public class SceneExplorerProperty<T> extends PropertySupport.Reflection<T> {
public void setValue(final T val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { public void setValue(final T val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
mutex.postWriteRequest(new Runnable() { mutex.postWriteRequest(new Runnable() {
public void run() { public void run() {
final T oldObject = (T) objectLocal; final T oldObject = objectLocal;
objectLocal = val; objectLocal = val;
final T sceneObject = (T) duplicateObject(val); final T sceneObject = duplicateObject(val);
notifyListeners(PROP_USER_CHANGE, oldObject, objectLocal); notifyListeners(PROP_USER_CHANGE, oldObject, objectLocal);
SceneApplication.getApplication().enqueue(new Callable<Void>() { SceneApplication.getApplication().enqueue(new Callable<Void>() {
public Void call() throws Exception { public Void call() throws Exception {

Loading…
Cancel
Save