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 Core模块,需要自行前往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 及以上版本
  • 视线跟踪
  • 点击交互
  • 动作播放回调
  • 口型同步
  • 模型各部分参数控制
  • 各部件透明度控制
  • 精确到部件的点击检测

兼容性

Python 版本

Python 版本支持:从 live2d-py 0.3.2 开始使用 Python C Limited API,理论上兼容 Python 3.2 以上的所有版本。

Cubism Live2D 版本

live2d-py 支持的live2d模型 实现
live2d.v2 Cubism 2.1 以及更早的版本 纯 Python 实现
live2d.v3 Cubism 3.0 及以上版本 Python C Extension 封装

Python 版本及平台

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

:question:: 尚未测试

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

Platform Python Version live2d.v2 live2d.v3 构建状态 PyPI
MacOS arm64 >3.0, <=3.10 :white_check_mark: :question: :construction: :x:
MacOS arm64 >=3.11 :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark:
Windows x86/x64 >3.0, <3.8 :white_check_mark: :question: :construction: :x:
Windows x86/x64 >=3.8 :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark:
Ubuntu 20.04/Arch, x64 >3.0, <3.8 :white_check_mark: :question: :construction: :x:
Ubuntu 20.04/Arch, x64 >=3.8 :white_check_mark: :white_check_mark: :white_check_mark: :x:

注:

  • live2d.v2 由 Cubism Web SDK 转写为纯 Python,尚未使用 numpy 等优化的库,性能有待提升
  • 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-win32.whl
  1. 通过 PyPI 安装
pip install live2d-py
  1. 从源码构建,参考 安装#源码构建

示例

简易面捕

源码见 main_facial_bind_mediapipe.py

面捕-期末周破防

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

Live2DViewer

多模型加载

源码见 main_pygame_three_model.py

three_model

添加背景

源码见 main_pygame_background.py

background

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

源码见 main_pygame.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.6.1.tar.gz (457.1 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.6.1-cp313-cp313-win_amd64.whl (295.9 kB view details)

Uploaded CPython 3.13Windows x86-64

live2d_py-0.6.1-cp313-cp313-win32.whl (268.7 kB view details)

Uploaded CPython 3.13Windows x86

live2d_py-0.6.1-cp313-cp313-macosx_15_0_universal2.whl (352.7 kB view details)

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

live2d_py-0.6.1-cp312-cp312-win_amd64.whl (295.8 kB view details)

Uploaded CPython 3.12Windows x86-64

live2d_py-0.6.1-cp312-cp312-win32.whl (268.5 kB view details)

Uploaded CPython 3.12Windows x86

live2d_py-0.6.1-cp312-cp312-macosx_15_0_universal2.whl (352.4 kB view details)

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

live2d_py-0.6.1-cp311-cp311-win_amd64.whl (295.8 kB view details)

Uploaded CPython 3.11Windows x86-64

live2d_py-0.6.1-cp311-cp311-win32.whl (268.6 kB view details)

Uploaded CPython 3.11Windows x86

live2d_py-0.6.1-cp311-cp311-macosx_15_0_universal2.whl (352.6 kB view details)

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

File details

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

File metadata

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

File hashes

Hashes for live2d_py-0.6.1.tar.gz
Algorithm Hash digest
SHA256 d9b4bea685f6c7dd61d85d87b24bd6d5f09236eaa52fe93539ec89f25bc5fcde
MD5 15344e7aa39cd63849c9e3b6b9c39985
BLAKE2b-256 09155027f508f5d2c0a9772a06403ee2e6db6160b56a512f98093bdc4705f38a

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for live2d_py-0.6.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 043ce777de7ed7876e87ba408b072a339e7bafeddc37203d9ce7d3a395958446
MD5 88b4a2f0e01abee4fff8b62441d5eb9d
BLAKE2b-256 898cfb8280a2b6028838de4a5cb05d27540693f7210e59aee676ef592a4adedb

See more details on using hashes here.

File details

Details for the file live2d_py-0.6.1-cp313-cp313-win32.whl.

File metadata

  • Download URL: live2d_py-0.6.1-cp313-cp313-win32.whl
  • Upload date:
  • Size: 268.7 kB
  • Tags: CPython 3.13, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for live2d_py-0.6.1-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 a5ad4f656a2ff079d4843f1cdcad00f38de1c10ef9a39e39c10946ce23ee8915
MD5 7087e7df6b2d10aa39397f008e202067
BLAKE2b-256 1a8218215f896010ef242b932214693262192999c98cf710b1d51e76d11e8585

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.6.1-cp313-cp313-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 666c00787f58bbb126b5a0971c50843948da392ceb316cc893e1e5974415f460
MD5 4895955f8c5b3cc75c28e0e3d58fa3bd
BLAKE2b-256 764c5fe2ec1fd2bb2d3e1ab7b5b4e4100b03e5ce5499418b742239da44c48c89

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.6.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 295.8 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.6.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b6fda904c6c6ce806e7dfd7ee0d9638e15f5d225cb1704ea934471a7cdde9bd7
MD5 4637caf3523c8ff087704bfde25583cf
BLAKE2b-256 1a0d98332e78e0fdf65371f7c47304a129d6dbe940db48a682a9515d22c62043

See more details on using hashes here.

File details

Details for the file live2d_py-0.6.1-cp312-cp312-win32.whl.

File metadata

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

File hashes

Hashes for live2d_py-0.6.1-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 532698f1644f2823d5b0207f6fb1f6d16baba2558e238c1d83f494fceccda255
MD5 1752b86bcfb5923b5c2b0fcf2e9efbb9
BLAKE2b-256 b3ce5e52bdfb8ba194c6b4517d063258126ff98c5fb24fb11932f6b27fff310a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.6.1-cp312-cp312-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 7ebe8d55cdf767fd121bb3ae709e2b50fa578fbf9b1f6df92590b566319ac907
MD5 249dd3f4ec9d09e199b981276db4174a
BLAKE2b-256 c80f939857edba734d12d6a8c1ed2c200d0f02a5427542b64e817f06e0299927

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.6.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 295.8 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.6.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 20aabc48d9d8128085984729f1dd3c43fed4957f0a607881cee069f9145fd292
MD5 5a2d4003de669ba8f40ae5509da74e81
BLAKE2b-256 32f5ad919b0b00bc09d6814510ea023003fdba7e0bcd8065e6a582bb2803f57c

See more details on using hashes here.

File details

Details for the file live2d_py-0.6.1-cp311-cp311-win32.whl.

File metadata

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

File hashes

Hashes for live2d_py-0.6.1-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 4cd2567ba04547e57df15874ec692b0b227979edd08611b3a603d3d5f988afef
MD5 deb51903bd35dec872d72da2e50a6169
BLAKE2b-256 e491ce8933899f7be4cc2e12ce075a9979e1a6f5680b9ad665361efff60c73bb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.6.1-cp311-cp311-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 8d23d4dfa9a9050b602eeab59f75cc54e67410fcfe9cd9f64c980fce23cc98dc
MD5 68ff1b47c0c9d11b1e6e41a458f17aef
BLAKE2b-256 1e66ad0259b8212f629ddb6996a80d4e8ece4a8260593a80549247c995c33aea

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