use of com.talosvfx.talos.editor.addons.scene.widgets.AssetListPopup in project talos by rockbite.
the class AssetSelectWidget method getSubWidget.
@Override
public Actor getSubWidget() {
Table table = new Table();
Skin skin = TalosMain.Instance().getSkin();
final SquareButton button = new SquareButton(skin, skin.getDrawable("ic-file-edit"));
nameLabel = new Label("", skin);
nameLabel.setEllipsis(true);
nameLabel.setAlignment(Align.right);
table.add(nameLabel).growX().maxWidth(130).padRight(2);
table.add(button).right().padRight(-2);
button.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
Vector2 pos = new Vector2(button.getWidth() / 2f, button.getHeight() / 2f);
button.localToStageCoordinates(pos);
AssetListPopup assetListPopup = SceneEditorAddon.get().workspace.getAssetListPopup();
assetListPopup.showPopup(getStage(), pos, filter, new FilteredTree.ItemListener() {
@Override
public void chosen(FilteredTree.Node node) {
String path = (String) node.getObject();
if (Gdx.files.absolute(path).isDirectory())
return;
String relative = AssetImporter.relative(Gdx.files.absolute(path));
updateWidget(relative);
callValueChanged(relative);
assetListPopup.remove();
}
});
}
});
return table;
}
Aggregations