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");
}
}
}
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);
}
}
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;
}
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();
}
}
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);
}
}
}
Aggregations