Search in sources :

Example 1 with EventHandler

use of com.talosvfx.talos.editor.notifications.EventHandler in project talos by rockbite.

the class SceneEditorWorkspace method onLayerListUpdated.

@EventHandler
public void onLayerListUpdated(LayerListUpdated event) {
    Array<String> layerList = getLayerList();
    // find all game objects and if any of them is on layer that does not exist, change its layer to default
    Array<GameObject> list = new Array<>();
    list = currentContainer.getSelfObject().getChildrenByComponent(RendererComponent.class, list);
    for (GameObject gameObject : list) {
        RendererComponent component = gameObject.getComponentSlow(RendererComponent.class);
        String sortingLayer = component.getSortingLayer();
        if (!layerList.contains(sortingLayer, false)) {
            component.setSortingLayer("Default");
        }
    }
}
Also used : SpriteRendererComponent(com.talosvfx.talos.editor.addons.scene.logic.components.SpriteRendererComponent) RendererComponent(com.talosvfx.talos.editor.addons.scene.logic.components.RendererComponent) EventHandler(com.talosvfx.talos.editor.notifications.EventHandler)

Example 2 with EventHandler

use of com.talosvfx.talos.editor.notifications.EventHandler in project talos by rockbite.

the class HierarchyWidget method onGameObjectSelectionChanged.

@EventHandler
public void onGameObjectSelectionChanged(GameObjectSelectionChanged event) {
    if (currentContainer != null) {
        Array<GameObject> gameObjects = event.get();
        Array<FilteredTree.Node> nodes = new Array<>();
        for (GameObject gameObject : gameObjects) {
            nodes.add(nodeMap.get(gameObject));
        }
        tree.getSelection().clear();
        tree.getSelection().addAll(nodes);
    }
}
Also used : Array(com.badlogic.gdx.utils.Array) GameObject(com.talosvfx.talos.editor.addons.scene.logic.GameObject) EventHandler(com.talosvfx.talos.editor.notifications.EventHandler)

Example 3 with EventHandler

use of com.talosvfx.talos.editor.notifications.EventHandler in project talos by rockbite.

the class HierarchyWidget method onGameObjectNameChanged.

@EventHandler
public void onGameObjectNameChanged(GameObjectNameChanged event) {
    GameObject gameObject = objectMap.get(event.oldName);
    objectMap.remove(event.oldName);
    objectMap.put(event.newName, gameObject);
    nodeMap.get(gameObject).name = event.newName;
}
Also used : GameObject(com.talosvfx.talos.editor.addons.scene.logic.GameObject) EventHandler(com.talosvfx.talos.editor.notifications.EventHandler)

Example 4 with EventHandler

use of com.talosvfx.talos.editor.notifications.EventHandler in project talos by rockbite.

the class SceneEditorWorkspace method onComponentUpdated.

@EventHandler
public void onComponentUpdated(ComponentUpdated event) {
    AComponent component = event.getComponent();
    sceneEditorAddon.propertyPanel.propertyProviderUpdated(component);
    if (!event.wasRapid()) {
        TalosMain.Instance().ProjectController().setDirty();
    }
}
Also used : AComponent(com.talosvfx.talos.editor.addons.scene.logic.components.AComponent) EventHandler(com.talosvfx.talos.editor.notifications.EventHandler)

Example 5 with EventHandler

use of com.talosvfx.talos.editor.notifications.EventHandler in project talos by rockbite.

the class SceneEditorWorkspace method onGameObjectSelectionChanged.

@EventHandler
public void onGameObjectSelectionChanged(GameObjectSelectionChanged event) {
    Array<GameObject> gameObjects = event.get();
    for (Gizmo gizmo : gizmoList) {
        gizmo.setSelected(false);
    }
    if (gameObjects.size == 1) {
        Array<Gizmo> gizmos = gizmoMap.get(gameObjects.get(0));
        for (Gizmo gizmo : gizmos) {
            gizmo.setSelected(true);
        }
    } else {
        for (GameObject gameObject : gameObjects) {
            Array<Gizmo> gizmos = gizmoMap.get(gameObject);
            if (gizmos != null) {
                for (Gizmo gizmo : gizmos) {
                    if (gizmo.isMultiSelect()) {
                        gizmo.setSelected(true);
                    }
                }
            }
        }
    }
    if (selection.size == 0) {
        // we select the main container then
        if (currentContainer instanceof Scene) {
            Scene scene = (Scene) currentContainer;
            selectPropertyHolder(scene);
        }
    } else {
        if (selection.size == 1) {
            selectPropertyHolder(gameObjects.first());
        } else {
            MultiPropertyHolder multiPropertyHolder = new MultiPropertyHolder(gameObjects);
            selectPropertyHolder(multiPropertyHolder);
        }
    }
}
Also used : TransformGizmo(com.talosvfx.talos.editor.addons.scene.widgets.gizmos.TransformGizmo) Gizmo(com.talosvfx.talos.editor.addons.scene.widgets.gizmos.Gizmo) EventHandler(com.talosvfx.talos.editor.notifications.EventHandler)

Aggregations

EventHandler (com.talosvfx.talos.editor.notifications.EventHandler)5 GameObject (com.talosvfx.talos.editor.addons.scene.logic.GameObject)2 Array (com.badlogic.gdx.utils.Array)1 AComponent (com.talosvfx.talos.editor.addons.scene.logic.components.AComponent)1 RendererComponent (com.talosvfx.talos.editor.addons.scene.logic.components.RendererComponent)1 SpriteRendererComponent (com.talosvfx.talos.editor.addons.scene.logic.components.SpriteRendererComponent)1 Gizmo (com.talosvfx.talos.editor.addons.scene.widgets.gizmos.Gizmo)1 TransformGizmo (com.talosvfx.talos.editor.addons.scene.widgets.gizmos.TransformGizmo)1