Electrostat-Lab / jMonkeyBuilder

Alex's Jme3 Scene editor Maintained Version
https://hub.jmonkeyengine.org/t/editor-jmonkeybuilder/35179/1232
Apache License 2.0
6 stars 3 forks source link

Fixed thread lock issue #8

Closed pavly-gerges closed 2 years ago

pavly-gerges commented 2 years ago

Fixed thread lock issue #3 when saving the terrain :

1) Removed stamp locker that was used to lock the scene update until editor tasks process. 2) Replaced the stamp with some Editor Flags using EditorStateManager and bound that to jme3 update :

    @Override
    public void update() {
        // finish if the editor state isn't for updating the scene
        if (!EditorStateManager.isUpdating()) {
            return;
        }
        // update the editor enqueued components before being hooked to jme3 update
        final GLTaskExecutor editorGLTaskExecutor = GLTaskExecutor.getInstance();
        editorGLTaskExecutor.dispatch();
        // hook up jme3 update --> calls --> simpleUpdate
        super.update();
        listener.setLocation(cam.getLocation());
        listener.setRotation(cam.getRotation());
    }

Now the scene updater is well locked against editor tasks.