Skip to main content

Tools for using asyncio to control a Second Life viewer over the LEAP protocol

Project description

outleap

codecov

A Python library using asyncio to control a Second Life viewer over the LEAP protocol.

See https://bitbucket.org/lindenlab/leap/src/main/ for more details on LEAP.

Installing

pip install outleap, or pip install -e . to install from source.

If you want to use the LEAP REPL or UI inspector, do pip install outleap[tools], or pip install -e .[tools].

Usage

Look in the "examples" directory.

You can run a LEAP script with your_viewer --leap some_script.py if you have the executable bit set.

import asyncio
import sys

from outleap import LEAPClient, LLViewerControlAPI


async def amain():
    # Create a client speaking LEAP over stdin/stdout and connect it
    async with await LEAPClient.create_stdio_client() as client:
        # Use our typed wrapper around the LLViewerControl LEAP API
        viewer_control_api = LLViewerControlAPI(client)
        # Ask for a config value and print it in the viewer logs
        print(await viewer_control_api.get("Global", "StatsPilotFile"), file=sys.stderr)


asyncio.run(amain())

If you just want to play around with the LEAP APIs:

$ outleap-repl
# ... in another terminal ...
$ viewer --leap outleap-agent

will give you an interactive REPL with a LEAP client object, with all the API wrappers already imported:

>>> floater_api = LLFloaterRegAPI(client)
>>> floater_api.show_instance(name="preferences")
>>> window_api = LLWindowAPI(client)
>>> prefs_path = UIPath.for_floater("Preferences")
>>> pprint.pp(await window_api.get_info(prefs_path))
{'available': True,
 'class': '19LLFloaterPreference',
 'enabled': 1,
 'enabled_chain': 1,
 'path': '/main_view/menu_stack/world_panel/Floater View/Preferences',
 'rect': {'bottom': 234, 'left': 593, 'right': 1255, 'top': 762},
 'value': None,
 'visible': 1,
 'visible_chain': 1}

Similarly, there's an interactive UI tree inspector available through outleap-inspector. It can be launched through viewer --leap outleap-inspector.

Screenshot of outleap-inspector

What viewers does LEAP even work in?

Due to the fact that LEAP has only historically been used internally for testing, or for integration with the official viewer's updater, many viewers have disabled LEAP both intentionally or accidentally.

The code in the upstream viewer also appears to refuse to launch LEAP scripts if the updater isn't present, which I don't entirely understand. I can't compile it to check.

Does it work in Firestorm?

No, the code to launch LEAP scripts is commented out. If you do your own build with those lines uncommented it'll work fine.

Does it work in Alchemy?

Probably not, and definitely not on Linux. Alchemy does the same SL updater presence checks as upstream before attempting to launch LEAP scripts, which I imagine wouldn't succeed. Haven't tried.

Does it work in LL's official viewer?

Yeah, probably.

Does it work in <other viewer>?

No, probably not.

Credits

The project scaffolding is based on code from https://github.com/MatthieuDartiailh/bytecode

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

outleap-0.8.4.tar.gz (159.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

outleap-0.8.4-py3-none-any.whl (34.5 kB view details)

Uploaded Python 3

File details

Details for the file outleap-0.8.4.tar.gz.

File metadata

  • Download URL: outleap-0.8.4.tar.gz
  • Upload date:
  • Size: 159.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for outleap-0.8.4.tar.gz
Algorithm Hash digest
SHA256 ec5f0245379929da5b9af4fe5f6009540f8b9a399851a884a24639ee09145ba5
MD5 90a4406183b99a511ee7d834008d969b
BLAKE2b-256 a3fef67d296392e75ceb41b1f70c073d23ae0882f2c6d7890ff71b0372aad856

See more details on using hashes here.

File details

Details for the file outleap-0.8.4-py3-none-any.whl.

File metadata

  • Download URL: outleap-0.8.4-py3-none-any.whl
  • Upload date:
  • Size: 34.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for outleap-0.8.4-py3-none-any.whl
Algorithm Hash digest
SHA256 148a00ddb418cfffc0ba0c9f12dc83c21b7492afbbf88ce804fb4a7add55282f
MD5 b85f51643c3a3798ae6a97e8886640e8
BLAKE2b-256 45f298a3a211099f333631220bde0ea4fdba28bd7e46e84cab782314534c5f0d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page