fix(canvas): Live2D 外观 - 补齐随部署发布的 Cubism Core 运行库
This commit is contained in:
1 parent
818a59e354
commit
b667605902
7 files changed
+35
-9
No files matched your search
+1
-2
@@ -73,6 +73,5 @@ camera_language_guide.md
|
|||||||
backend/cmd/server/server
|
backend/cmd/server/server
|
||||||
# One-off local probe scripts and their compiled output.
|
# One-off local probe scripts and their compiled output.
|
||||||
backend/tmp_*
|
backend/tmp_*
|
||||||
# Deployment-owned proprietary Live2D Core; never redistribute in this repository.
|
# Keep the runtime in source control; its optional debug map is not deployed.
|
||||||
/web/public/live2d/live2dcubismcore.min.js
|
|
||||||
/web/public/live2d/live2dcubismcore.min.js.map
|
/web/public/live2d/live2dcubismcore.min.js.map
|
||||||
@@ -17,14 +17,14 @@ description: 助手名称、文案、模型导入和运行库部署
|
|||||||
|
|
||||||
## 部署运行库
|
## 部署运行库
|
||||||
|
|
||||||
前端使用固定版本 `pixi.js@6.5.10` 和 `pixi-live2d-display@0.4.0`,按需加载 Cubism 3/4 渲染适配器。Cubism Core 不包含在仓库中,不从第三方 CDN 加载,也不接受模型 ZIP 中的脚本。
|
前端使用固定版本 `pixi.js@6.5.10` 和 `pixi-live2d-display@0.4.0`,按需加载 Cubism 3/4 渲染适配器。Cubism Core 已纳入仓库的 `web/public/live2d/live2dcubismcore.min.js`,随前端构建及静态镜像发布,无需部署者另行安装。不从第三方 CDN 加载,也不接受模型 ZIP 中的脚本。Core 保留原始版权与许可声明,不适用本项目的 MIT 许可证;参见同目录 `NOTICE.txt`。
|
||||||
|
|
||||||
1. 部署者从 Live2D 官方获取具有相应授权、与模型版本兼容的 Cubism SDK for Web。
|
1. 使用前确认 Live2D SDK 及模型素材的适用授权;内置运行库不代替部署者对使用场景的授权确认。
|
||||||
2. 将 Core 文件 `live2dcubismcore.min.js` 放到前端 `web/public/live2d/` 后重新构建;静态镜像部署也可将文件只读挂载到 `/usr/share/nginx/html/live2d/live2dcubismcore.min.js`。该文件已被 Git 忽略,不提交到本仓库。
|
2. 拉取包含运行库的提交并重新构建前端,或部署由该提交构建的新镜像。Vite 将 Core 复制到 `dist/live2d/live2dcubismcore.min.js`,Docker 镜像中对应 `/usr/share/nginx/html/live2d/live2dcubismcore.min.js`。旧镜像不会因拉取源码自动更新;已有同路径挂载时应检查是否遮蔽内置文件。
|
||||||
3. 确认同源 `/live2d/live2dcubismcore.min.js` 返回 JavaScript 而非 SPA 页面。非根路径部署跟随前端构建 BASE_URL。
|
3. 确认同源 `/live2d/live2dcubismcore.min.js` 返回 JavaScript 而非 SPA 页面。非根路径部署跟随前端构建 BASE_URL。
|
||||||
4. 后台导入并预览,成功后选择 Live2D,点击顶部「保存修改」。导入本身不启用;失败不更改当前形象。
|
4. 后台导入并预览,成功后选择 Live2D,点击顶部「保存修改」。导入本身不启用;失败不更改当前形象。
|
||||||
|
|
||||||
没有 Core、模型不兼容、网络超时或 WebGL 上下文丢失时,入口回退默认动态球,仍可点击打开 Agent。后台显示错误并提供重试。未提供授权 Core 和真实模型时,不能仅凭构建成功认定播放验收通过。
|
部署产物遗漏 Core、模型不兼容、网络超时或 WebGL 上下文丢失时,入口回退默认动态球,仍可点击打开 Agent。后台显示错误并提供重试。未使用具有适用授权的真实模型验证时,不能仅凭构建成功认定播放验收通过。
|
||||||
|
|
||||||
接入层支持旧版 `drawables.renderOrders` 和新版 Core 的 `Model.getRenderOrders()` 绘制顺序接口,不修改 Core 文件。当前 Cubism 4 渲染适配器不支持新版离屏渲染对象;此类模型会明确报错,而不是忽略对象后显示不完整形象。
|
接入层支持旧版 `drawables.renderOrders` 和新版 Core 的 `Model.getRenderOrders()` 绘制顺序接口,不修改 Core 文件。当前 Cubism 4 渲染适配器不支持新版离屏渲染对象;此类模型会明确报错,而不是忽略对象后显示不完整形象。
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,12 @@ description: 当前项目已实现功能的手工验证清单与未确认边界
|
|||||||
|
|
||||||
# 待测试
|
# 待测试
|
||||||
|
|
||||||
|
## Live2D 运行库随部署交付
|
||||||
|
|
||||||
|
- Cubism Core 已纳入版本控制,保留原始版权声明并附第三方许可说明;前端构建和静态镜像直接包含运行文件,不再要求部署者手工安装。
|
||||||
|
- [x] 5 项 Live2D 专项测试及前端生产构建通过;Core 可初始化并读取版本,构建产物中的 Core 和许可说明与源文件逐字节一致。未执行 Docker 镜像构建或服务器部署。
|
||||||
|
- [ ] 服务器更新至包含本次修复的新镜像,确认 `/live2d/live2dcubismcore.min.js` 返回 JavaScript 而非 SPA 页面;使用有授权的真实模型完成后台预览、保存及画布形象验收。
|
||||||
|
|
||||||
## 技能文件包迁移元数据长度
|
## 技能文件包迁移元数据长度
|
||||||
|
|
||||||
- [x] 启动迁移对旧技能名称、简介的回填元数据按字符数限制长度,省略号计入上限;不改写原始名称、简介和正文,不放宽非迁移入口的校验。
|
- [x] 启动迁移对旧技能名称、简介的回填元数据按字符数限制长度,省略号计入上限;不改写原始名称、简介和正文,不放宽非迁移入口的校验。
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
Live2D Cubism Core
|
||||||
|
Copyright (C) 2019 Live2D Inc. All rights reserved.
|
||||||
|
|
||||||
|
live2dcubismcore.min.js is third-party software, not covered by this
|
||||||
|
project's MIT license. Its original copyright and license header is retained.
|
||||||
|
The file identifies itself as "Redistributable Code" under the Live2D
|
||||||
|
Proprietary Software License Agreement:
|
||||||
|
https://www.live2d.com/eula/live2d-proprietary-software-license-agreement_en.html
|
||||||
|
|
||||||
|
Use and distribution remain subject to the applicable Live2D terms.
|
||||||
|
Bundling the runtime does not grant rights to model assets or replace any
|
||||||
|
license required for your use of the Live2D SDK.
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* Live2D Cubism Core
|
||||||
|
* (C) 2019 Live2D Inc. All rights reserved.
|
||||||
|
*
|
||||||
|
* This file is licensed pursuant to the license agreement below.
|
||||||
|
* This file corresponds to the "Redistributable Code" in the agreement.
|
||||||
|
* https://www.live2d.com/eula/live2d-proprietary-software-license-agreement_en.html
|
||||||
|
*/
|
||||||
|
var Live2DCubismCore;!function(Live2DCubismCore){var _scriptDir,_csm=function(){function _csm(){}return _csm.getVersion=function(){return _em.ccall("csmGetVersion","number",[],[])},_csm.getLatestMocVersion=function(){return _em.ccall("csmGetLatestMocVersion","number",[],[])},_csm.getMocVersion=function(moc,mocSize){return _em.ccall("csmGetMocVersion","number",["number","number"],[moc,mocSize])},_csm.getLogFunction=function(){return _em.ccall("csmGetLogFunction","number",[],[])},_csm.getSizeofModel=function(moc){return _em.ccall("csmGetSizeofModel","number",["number"],[moc])},_csm.reviveMocInPlace=function(memory,mocSize){return _em.ccall("csmReviveMocInPlace","number",["number","number"],[memory,mocSize])},_csm.initializeModelInPlace=function(moc,memory,modelSize){return _em.ccall("csmInitializeModelInPlace","number",["number","number","number"],[moc,memory,modelSize])},_csm.hasMocConsistency=function(memory,mocSize){return _em.ccall("csmHasMocConsistency","number",["number","number"],[memory,mocSize])},_csm.getRenderOrders=function(model){return _em.ccall("csmGetRenderOrders","number",["number"],[model])},_csm.getParameterCount=function(model){return _em.ccall("csmGetParameterCount","number",["number"],[model])},_csm.getParameterIds=function(model){return _em.ccall("csmGetParameterIds","number",["number"],[model])},_csm.getParameterMinimumValues=function(model){return _em.ccall("csmGetParameterMinimumValues","number",["number"],[model])},_csm.getParameterTypes=function(model){return _em.ccall("csmGetParameterTypes","number",["number"],[model])},_csm.getParameterMaximumValues=function(model){return _em.ccall("csmGetParameterMaximumValues","number",["number"],[model])},_csm.getParameterDefaultValues=function(model){return _em.ccall("csmGetParameterDefaultValues","number",["number"],[model])},_csm.getParameterValues=function(model){return _em.ccall("csmGetParameterValues","number",["number"],[model])},_csm.getParameterRepeats=function(model){return _em.ccall("csmGetParameterRepeats","number",["number"],[model])},_csm.getParameterKeyCounts=function(model){return _em.ccall("csmGetParameterKeyCounts","number",["number"],[model])},_csm.getParameterKeyValues=function(model){return _em.ccall("csmGetParameterKeyValues","number",["number"],[model])},_csm.getPartCount=function(model){return _em.ccall("csmGetPartCount","number",["number"],[model])},_csm.getPartIds=function(model){return _em.ccall("csmGetPartIds","number",["number"],[model])},_csm.getPartOpacities=function(model){return _em.ccall("csmGetPartOpacities","number",["number"],[model])},_csm.getPartParentPartIndices=function(model){return _em.ccall("csmGetPartParentPartIndices","number",["number"],[model])},_csm.getPartOffscreenIndices=function(model){return _em.ccall("csmGetPartOffscreenIndices","number",["number"],[model])},_csm.getDrawableCount=function(model){return _em.ccall("csmGetDrawableCount","number",["number"],[model])},_csm.getDrawableIds=function(model){return _em.ccall("csmGetDrawableIds","number",["number"],[model])},_csm.getDrawableConstantFlags=function(model){return _em.ccall("csmGetDrawableConstantFlags","number",["number"],[model])},_csm.getDrawableDynamicFlags=function(model){return _em.ccall("csmGetDrawableDynamicFlags","number",["number"],[model])},_csm.getDrawableTextureIndices=function(model){return _em.ccall("csmGetDrawableTextureIndices","number",["number"],[model])},_csm.getDrawableDrawOrders=function(model){return _em.ccall("csmGetDrawableDrawOrders","number",["number"],[model])},_csm.getDrawableOpacities=function(model){return _em.ccall("csmGetDrawableOpacities","number",["number"],[model])},_csm.getDrawableMaskCounts=function(model){return _em.ccall("csmGetDrawableMaskCounts","number",["number"],[model])},_csm.getDrawableMasks=function(model){return _em.ccall("csmGetDrawableMasks","number",["number"],[model])},_csm.getDrawableVertexCounts=function(model){return _em.ccall("csmGetDrawableVertexCounts","number",["number"],[model])},_csm.getDrawableVertexPositions=function(model){return _em.ccall("csmGetDrawableVertexPositions","number",["number"],[model])},_csm.getDrawableVertexUvs=function(model){return _em.ccall("csmGetDrawableVertexUvs","number",["number"],[model])},_csm.getDrawableIndexCounts=function(model){return _em.ccall("csmGetDrawableIndexCounts","number",["number"],[model])},_csm.getDrawableIndices=function(model){return _em.ccall("csmGetDrawableIndices","number",["number"],[model])},_csm.getDrawableMultiplyColors=function(model){return _em.ccall("csmGetDrawableMultiplyColors","number",["number"],[model])},_csm.getDrawableScreenColors=function(model){return _em.ccall("csmGetDrawableScreenColors","number",["number"],[model])},_csm.getDrawableParentPartIndices=function(model){return _em.ccall("csmGetDrawableParentPartIndices","number",["number"],[model])},_csm.getDrawableBlendModes=function(model){return _em.ccall("csmGetDrawableBlendModes","number",["number"],[model])},_csm.getOffscreenCount=function(model){return _em.ccLine truncated
|
||||||
@@ -9,13 +9,13 @@ function loadCore() {
|
|||||||
if (corePromise) return corePromise;
|
if (corePromise) return corePromise;
|
||||||
corePromise = new Promise<void>((resolve, reject) => {
|
corePromise = new Promise<void>((resolve, reject) => {
|
||||||
const script = document.createElement("script");
|
const script = document.createElement("script");
|
||||||
// Deployment-owned runtime only. Uploaded models may never provide executable code.
|
// Bundled same-origin runtime only. Uploaded models may never provide executable code.
|
||||||
script.src = `${import.meta.env.BASE_URL}live2d/live2dcubismcore.min.js`;
|
script.src = `${import.meta.env.BASE_URL}live2d/live2dcubismcore.min.js`;
|
||||||
const timer = window.setTimeout(() => fail(), 15000);
|
const timer = window.setTimeout(() => fail(), 15000);
|
||||||
const fail = () => {
|
const fail = () => {
|
||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
script.remove();
|
script.remove();
|
||||||
reject(new Error("Live2D 运行库未安装或加载失败,请部署 Cubism Core 后重试"));
|
reject(new Error("Live2D 运行库加载失败,请确认部署产物包含 Cubism Core 且静态资源可访问后重试"));
|
||||||
};
|
};
|
||||||
script.onload = () => {
|
script.onload = () => {
|
||||||
if (!("Live2DCubismCore" in window)) {
|
if (!("Live2DCubismCore" in window)) {
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ export function CanvasAppearanceEditor({ value, onChange, disabled, onUploading
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
<p className="text-xs text-foreground/60">部署者需自行确认 Live2D 授权并安装 Cubism Core 至 /live2d/live2dcubismcore.min.js。未安装时名称、文案和默认动态球仍可使用。未启用的导入包可在资源管理中清理。</p>
|
<p className="text-xs text-foreground/60">项目已内置 Cubism Core,无需另行安装。使用前仍需确认 Live2D SDK 及模型素材的适用授权。未启用的导入包可在资源管理中清理。</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in new issue
Block a user