Skip to main content

A non-web Live2D library for Python.

Project description

koe live2d-py


Docker Build Version Python Version CMake C++17 CsmSDK

English README

注意:本仓库不包含 Live2D Cubism Core 及 Framework(受许可限制),源码编译时需自行从 Live2D官网 下载。

使用 Python 直接加载和操作 Live2D 模型,不通过 Web Engine 等间接手段进行渲染。

基于 Python C Extension 对 Live2D Native SDK (C++) 进行了封装。理论上,只要配置好 OpenGL 上下文,可在 Python 中将 live2d 绘制在任何基于 OpenGL 的窗口。

代码使用示例:examples

详细使用文档:Wiki

修改和开发:CONTRIBUTING

兼容UI库

理论上兼容所有能使用 OpenGL 进行绘制的UI库: Pygame / PyQt5 / PySide2 / PySide6 / GLFW / pyopengltk / FreeGlut / Qfluentwidgets ...

支持功能

  • 加载模型:Cubism 2.1Cubism 3.0 及以上版本
  • 视线跟踪
  • 点击交互
  • 动作播放回调
  • 口型同步
  • 模型各部分参数控制
  • 各部件透明度控制
  • 精确到部件的点击检测

兼容性

Cubism Live2D 版本

live2d-py 支持的live2d模型 实现
live2d.v2 Cubism 2.1 以及更早的版本 纯 Python 实现
live2d.v2cpp Cubism 2.1 以及更早的版本 C++ 移植 (高性能)
live2d.v3 Cubism 3.0 及以上版本 Python C Extension 封装

推荐使用 live2d.v2cpp 替代 live2d.v2 以获得更好的性能。API 完全兼容,只需将 import live2d.v2 as live2d 替换为 import live2d.v2cpp as live2d

Python 版本及平台

:white_check_mark:: 可用, 支持, 已通过

:question:: 尚未测试

:construction:, :x:: 编译期问题或平台兼容性问题待解决

Platform Python Version live2d.v2 live2d.v2cpp live2d.v3 PyPI
macOS arm64 >=3.11 :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark:
Windows x64 >=3.11 :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark:
Linux x64 >=3.11 :white_check_mark: :white_check_mark: :white_check_mark: :x:

注:

  • Cubism 2.X 导出的模型:文件名格式常为 XXX.mocXXX.model.jsonXXX.mtn
  • Cubism 3.0 及以上导出的模型:文件名格式常为 XXX.moc3XXX.model3.json, XXX.motion3.json

使用说明

  1. Release 中下载对应版本的 whl 文件并安装(推荐)
pip install live2d_py-0.X.X-cpXXX-cpXXX-win_amd64.whl
  1. 通过 PyPI 安装
pip install live2d-py
  1. 从源码构建,参考 安装#源码构建

示例

简易面捕

源码见 main_facial_bind.py

面捕-期末周破防

基于 live2d-py C 模块及 Qt 开发的 Live2DViewer

Live2DViewer

多模型加载

源码见 main_glfw_four_model.py

multi_model

添加背景

源码见 main_pygame_background.py

background

模型变换 & 口型同步音频 & 点击测试

源码见 main_glfw.py

完整用例

模型整体透明度示例

源码见 main_pyqt5_canvas_opacity.py

opacity

鸣谢

特别感谢以下用户为本项目提供的帮助和支持: 96bearli, Ovizro, AnyaCoder, jahtim, Honghe, RobertMeow, LUORANCHENG, TinyKiecoo, Barracuda72, GuangChen2333, makabakadot, thynetruly, mastwet, KyvYang, @Mozilla88, @CooperWang0912, @minghf85

非常感谢以下项目及其贡献者们的帮助:

CubismNativeSamples (live2d.v3)

Cubism2 Web SDK (live2d.v2)

de4jsJavaScript 反混淆工具)

JsConvert (JavascriptPython 工具)

D2Evil (moc 文件分析)

facial-landmarks-for-cubism (面捕参考)

Live2D 模型:

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

live2d_py-0.7.0.tar.gz (345.8 kB view details)

Uploaded Source

Built Distributions

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

live2d_py-0.7.0-cp314-cp314-win_amd64.whl (448.6 kB view details)

Uploaded CPython 3.14Windows x86-64

live2d_py-0.7.0-cp314-cp314-macosx_15_0_universal2.whl (524.8 kB view details)

Uploaded CPython 3.14macOS 15.0+ universal2 (ARM64, x86-64)

live2d_py-0.7.0-cp313-cp313-win_amd64.whl (437.4 kB view details)

Uploaded CPython 3.13Windows x86-64

live2d_py-0.7.0-cp313-cp313-macosx_15_0_universal2.whl (524.8 kB view details)

Uploaded CPython 3.13macOS 15.0+ universal2 (ARM64, x86-64)

live2d_py-0.7.0-cp312-cp312-win_amd64.whl (437.2 kB view details)

Uploaded CPython 3.12Windows x86-64

live2d_py-0.7.0-cp312-cp312-macosx_15_0_universal2.whl (524.5 kB view details)

Uploaded CPython 3.12macOS 15.0+ universal2 (ARM64, x86-64)

live2d_py-0.7.0-cp311-cp311-win_amd64.whl (437.2 kB view details)

Uploaded CPython 3.11Windows x86-64

live2d_py-0.7.0-cp311-cp311-macosx_15_0_universal2.whl (524.6 kB view details)

Uploaded CPython 3.11macOS 15.0+ universal2 (ARM64, x86-64)

live2d_py-0.7.0-cp310-cp310-win_amd64.whl (437.2 kB view details)

Uploaded CPython 3.10Windows x86-64

File details

Details for the file live2d_py-0.7.0.tar.gz.

File metadata

  • Download URL: live2d_py-0.7.0.tar.gz
  • Upload date:
  • Size: 345.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for live2d_py-0.7.0.tar.gz
Algorithm Hash digest
SHA256 a9ff84237b9bfcb50a852ccac5377fbe3ea4495a02efe09601924e0c48407ca0
MD5 a35f8a9bf1c86af9ea1b70da8aea5701
BLAKE2b-256 12c91aa781189888a38c96bd8edeaf29dd74bb1008772243987bab35ca1b4b65

See more details on using hashes here.

File details

Details for the file live2d_py-0.7.0-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: live2d_py-0.7.0-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 448.6 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for live2d_py-0.7.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 6ba67b15b4de56f1eaa911f9f07ccfd98e06c646b0566ed5e9a2d6ede18db741
MD5 f56acaa706c8f8af213ab1ab4c1deefa
BLAKE2b-256 9da5197cc021cbbfb8aeee90f8c9d9e1f6de59f7acbc3799b504fd01048ebb68

See more details on using hashes here.

File details

Details for the file live2d_py-0.7.0-cp314-cp314-macosx_15_0_universal2.whl.

File metadata

File hashes

Hashes for live2d_py-0.7.0-cp314-cp314-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 a07e7ced10879a8af888dbb2512c2b49cf6aafb471d686e5d771481a94b7adc8
MD5 0e7b2b7d87c4e49cfad34c2a8b968a71
BLAKE2b-256 3357be8f8120231292454fab25053b901ba19bd28b9a3f3e2467c9c5fe9b59f1

See more details on using hashes here.

File details

Details for the file live2d_py-0.7.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: live2d_py-0.7.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 437.4 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for live2d_py-0.7.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 89eae45fb24fdbb9f2b116e90224ab02d79049769571d85d3979be1746304bf4
MD5 413b1442430f804e137d8277d23a3d8a
BLAKE2b-256 641f1c789139c59b6d5b2461024a2bb91029226966c655caf4f6bdeaf2ec8a4f

See more details on using hashes here.

File details

Details for the file live2d_py-0.7.0-cp313-cp313-macosx_15_0_universal2.whl.

File metadata

File hashes

Hashes for live2d_py-0.7.0-cp313-cp313-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 e723f83a9bca47aef2c1a502eaf3ba8dd27fbf52308deb246d8fa1107e5e47ea
MD5 520d9caf793956e4211ef848f0ca8521
BLAKE2b-256 8610d15dc1d67423348658ce4c6838194b180a8ffe5239169db76bc904fd721f

See more details on using hashes here.

File details

Details for the file live2d_py-0.7.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: live2d_py-0.7.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 437.2 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for live2d_py-0.7.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 1a3f632bf38c2a3c6532eaa9e748df6c85ed7701e6b9397a83453fc15f41cd8e
MD5 c29a85ac17d0bf591becc368615ea21a
BLAKE2b-256 3c1d68d93dcf7e5475cc27668fd218709d0fc7ddadb2e09d507a5f059c706b21

See more details on using hashes here.

File details

Details for the file live2d_py-0.7.0-cp312-cp312-macosx_15_0_universal2.whl.

File metadata

File hashes

Hashes for live2d_py-0.7.0-cp312-cp312-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 45feaf462d6c382376d4429f49adde8266d72b7c1d6f5d41ffeb0ad20a485aa6
MD5 b62928951df879873d17a92e78d4ca38
BLAKE2b-256 1f66854e1759b9061f5c49f2f92fca82956fd63789ee1746c9aa7a39165d3673

See more details on using hashes here.

File details

Details for the file live2d_py-0.7.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: live2d_py-0.7.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 437.2 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for live2d_py-0.7.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 068c4e9c401f597af260c8df0a1a7191cc2b8831d18b8684caae98221d82d076
MD5 342a1343d7490af61fe4afef4fe5584a
BLAKE2b-256 01d998696071b268387bce0b68139780a5630435ad5894d916147c91d235f845

See more details on using hashes here.

File details

Details for the file live2d_py-0.7.0-cp311-cp311-macosx_15_0_universal2.whl.

File metadata

File hashes

Hashes for live2d_py-0.7.0-cp311-cp311-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 9867dda082fbad5380d78725a92ee6b14b11e69cb71f548567e103f120dfc802
MD5 2ab59cfb19eb93953aa5b5b692d32c0e
BLAKE2b-256 598fc986026a8e756de431061247803541cc32ed99869a9dc08b33f233da690c

See more details on using hashes here.

File details

Details for the file live2d_py-0.7.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: live2d_py-0.7.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 437.2 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.0

File hashes

Hashes for live2d_py-0.7.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 eccb1947c7326c71d605f3021a4a6b6621e835bc1c5f24b1ef303d821887e5ed
MD5 f6c2434c70eb0a4a6d90638982b10d6a
BLAKE2b-256 c2f885be809b12670a05132b4b7179cb4df7dfd85d8b4ed954b75288b8ad3fcf

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