Skip to content

Commit

Permalink
v0.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Arkueid committed Sep 25, 2024
1 parent 1865254 commit 3c92f00
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 24 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']
python-version: ['3.10.0', '3.11.0', '3.12.0']
architecture: ['x86', 'x64']

steps:
Expand All @@ -33,7 +33,7 @@ jobs:
run: python -m pip install build

- name: Build a source tarball
if: ${{ matrix.python-version == '3.10' && matrix.architecture == 'x86' }}
if: ${{ matrix.python-version == '3.10.0' && matrix.architecture == 'x86' }}
run: python -m build --sdist . --outdir dist/

- name: Build a binary wheel
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
- name: Upload Source Distribution to Release
uses: softprops/action-gh-release@v2
if: ${{ matrix.python-version == '3.10' && matrix.architecture == 'x86' }}
if: ${{ matrix.python-version == '3.10.0' && matrix.architecture == 'x86' }}
with:
# tag_name: v0.2.2-alpha
files: |
Expand Down
10 changes: 7 additions & 3 deletions LAppModelWrapper.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#include <GL/glew.h>
#ifdef WIN32
#include <GL/wglew.h>
#endif // WIN32

#include <LAppModel.hpp>
#include <CubismFramework.hpp>
#include <LAppPal.hpp>
Expand Down Expand Up @@ -682,8 +687,7 @@ static PyMethodDef live2d_methods[] = {
{"clearBuffer", (PyCFunction)live2d_clear_buffer, METH_VARARGS, ""},
{"setLogEnable", (PyCFunction)live2d_set_log_enable, METH_VARARGS, ""},
{"logEnable", (PyCFunction)live2d_log_enable, METH_VARARGS, ""},
{NULL, NULL, 0, NULL} // 哨兵
};
{NULL, NULL, 0, NULL}};

// 定义live2d模块
static struct PyModuleDef liv2d_module = {
Expand Down Expand Up @@ -729,7 +733,7 @@ PyMODINIT_FUNC PyInit_live2d(void)

#ifdef WIN32
// 强制utf-8
SetConsoleOutputCP(65001);
// SetConsoleOutputCP(65001);
#endif

return m;
Expand Down
4 changes: 2 additions & 2 deletions Main/live2d/LAppModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,13 +537,13 @@ void LAppModel::DoDraw()

void LAppModel::Draw(CubismMatrix44 &matrix)
{
_model->Update();

if (_model == NULL)
{
return;
}

_model->Update();

matrix.MultiplyByMatrix(_modelMatrix);

GetRenderer<Rendering::CubismRenderer_OpenGLES2>()->SetMvpMatrix(&matrix);
Expand Down
2 changes: 1 addition & 1 deletion Main/live2d/Log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void _LOG(const int level, const char *fmt, ...)
{
format = LOG_INFO_CONSOLE_FORMAT;
}
else if (level == LogLevel::ERROR)
else if (level == LogLevel::_ERROR)
{
format = LOG_ERROR_CONSOLE_FORMAT;
}
Expand Down
5 changes: 2 additions & 3 deletions Main/live2d/Log.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ enum LogLevel
{
INFO,
DEBUG,
ERROR
_ERROR
};


void setLogEnable(bool on);
void _LOG(const int format, const char *fmt, ...);

#define Debug(fmt, ...) _LOG(LogLevel::DEBUG, fmt, ##__VA_ARGS__)
#define Info(fmt, ...) _LOG(LogLevel::INFO, fmt, ##__VA_ARGS__)
#define Error(fmt, ...) _LOG(LogLevel::ERROR, fmt, ##__VA_ARGS__)
#define Error(fmt, ...) _LOG(LogLevel::_ERROR, fmt, ##__VA_ARGS__)
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,10 @@ pip install live2d_py-0.2.2-cp310-cp310-win32.whl

[live2d-desktop](https://github.com/Arkueid/Live2DMascot)

![alt](./docs/2.png)
![alt](./docs/2.png)

## 贡献

感谢 [@96bearli] 为本项目提供的帮助和支持。

[@96bearli]: https://github.com/96bearli
2 changes: 1 addition & 1 deletion package/live2d/utils/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ def Error(*args, **kwargs):
print(
time.strftime(f"{RED}[ERROR %Y-%m-%d %H:%M:%S]", time.localtime(time.time())),
*args,
RESET
RESET,
**kwargs
)
Binary file modified package/live2d/v3/live2d.pyd
Binary file not shown.
3 changes: 1 addition & 2 deletions package/main_glfw.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@ def init_window(width, height, title):
glfw.terminate()
return None

glfw.make_context_current(window)
return window


# 渲染循环
def main():
window = init_window(270, 200, "Simple GLFW Window")
window = init_window(270, 200, "pyside6")
if not window:
print("Failed to create GLFW window")
return
Expand Down
13 changes: 5 additions & 8 deletions package/main_pygame.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,14 @@
live2d.setLogEnable(True)


def draw():
pygame.display.flip()
pygame.time.wait(10)


def main():
pygame.init()
pygame.mixer.init()
live2d.init()

display = (700, 500)
pygame.display.set_mode(display, DOUBLEBUF | OPENGL)
pygame.display.set_mode(display, DOUBLEBUF | OPENGL | NOFRAME)
pygame.display.set_caption("pygame window")

live2d.glewInit()
live2d.setGLProperties()
Expand Down Expand Up @@ -130,9 +126,10 @@ def on_finish_motion_callback():

model.SetOffset(dx, dy)
model.SetScale(scale)
live2d.clearBuffer(0.0, 0.0, 1.0, 0.0)
live2d.clearBuffer(1.0, 0.0, 0.0, 0.0)
model.Draw()
draw()
pygame.display.flip()
# pygame.time.wait(10)

live2d.dispose()

Expand Down
9 changes: 9 additions & 0 deletions updates.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# 更新内容

## 2024/9/24
* 更正`HitTest`的参数类型
* 移除动态库内全局动作回调函数
* 添加`live2d.clearBuffer`的可选背景色参数 by [@96bearli]
* 修正`live2d.utils.log.logEnable`与动态库的状态同步
* 修复简易面捕的抖动问题 by [@96bearli]

[@96bearli]: https://github.com/96bearli

## 2024/8/22
添加:

Expand Down

0 comments on commit 3c92f00

Please sign in to comment.