Skip to content

fix: initialize live2d in PixiStage constructor#757

Merged
MakinoharaShoko merged 2 commits intoOpenWebGAL:devfrom
HardyNLee:fix-live2d-loading
Aug 17, 2025
Merged

fix: initialize live2d in PixiStage constructor#757
MakinoharaShoko merged 2 commits intoOpenWebGAL:devfrom
HardyNLee:fix-live2d-loading

Conversation

@HardyNLee
Copy link
Copy Markdown
Contributor

介绍

将初始化 Live 2D 的函数放在 PixiStage 的构造函数中
支持设置旧版表情混合回退

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @HardyNLee, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求解决了Live2D初始化中的一个关键问题,通过将initLive2D函数的调用从Live2DCore构造函数移动到PixiStage构造函数。此前,直接在Live2DCore构造函数中初始化会导致加载失败。此修复确保Live2D在适当的阶段进行初始化。此外,此PR还引入了对旧版表情混合模式的支持,通过新的配置选项为Live2D表情处理提供了更大的灵活性。

Highlights

  • Live2D初始化修复: Live2D.initLive2D()的调用已从Live2DCore构造函数移动到PixiStage构造函数,解决了Live2D在其自身核心类中直接初始化时加载失败的问题。
  • 支持旧版表情混合模式: Live2DCore中新增了legacyExpressionBlendMode属性和相关逻辑,实现了Live2D模型旧版表情混合行为的动态配置。此设置现在可以通过新命令进行控制。
  • Live2DCore重构: Live2DCore类已进行重构,将其构造函数与initLive2D调用解耦,并正确管理新的legacyExpressionBlendMode设置,确保在Live2D可用后应用配置。
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

本次 PR 将 Live2D 的初始化逻辑从 Live2DCore 的构造函数中移至 PixiStage 的构造函数中异步调用,解决了之前提到的加载失败问题。同时,增加了对 legacyExpressionBlendMode 配置的支持,允许在游戏配置中进行设置。

整体修改方向正确,代码实现清晰。我只发现了一个小的代码冗余问题,并已在文件中提出了具体的修改建议。修复后即可合并。

Comment on lines +63 to +65
if (command === 'Legacy_Expression_Blend_Mode') {
Live2D.legacyExpressionBlendMode = res === true;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

这里的 res === true 判断是多余的。在前面的代码中(第 47-49 行),res 已经被转换成布尔值了。为了保持代码一致性和简洁性,建议直接使用 res

与此文件中的 Enable_Appreciation 的处理方式 dispatch(setEnableAppreciationMode(res)); 保持一致,可以提高代码的可读性。

建议修改为:

if (command === 'Legacy_Expression_Blend_Mode') {
  Live2D.legacyExpressionBlendMode = res;
}
Suggested change
if (command === 'Legacy_Expression_Blend_Mode') {
Live2D.legacyExpressionBlendMode = res === true;
}
if (command === 'Legacy_Expression_Blend_Mode') {
Live2D.legacyExpressionBlendMode = res;
}

@MakinoharaShoko MakinoharaShoko merged commit a067bc3 into OpenWebGAL:dev Aug 17, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants