Search in sources :

Example 1 with RendererComponent

use of com.talosvfx.talos.editor.addons.scene.logic.components.RendererComponent 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)

Aggregations

RendererComponent (com.talosvfx.talos.editor.addons.scene.logic.components.RendererComponent)1 SpriteRendererComponent (com.talosvfx.talos.editor.addons.scene.logic.components.SpriteRendererComponent)1 EventHandler (com.talosvfx.talos.editor.notifications.EventHandler)1