fix(canvas): Live2D 外观 - 补齐随部署发布的 Cubism Core 运行库

This commit is contained in:
ddCat committed 2026-09-22 14:17:27 +08:00
1 parent 818a59e354
commit b667605902
7 files changed
+35 -9

No files matched your search

+12
View File
@@ -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
View File
@@ -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
+2 -2
View File
@@ -9,13 +9,13 @@ function loadCore() {
if (corePromise) return corePromise;
corePromise = new Promise<void>((resolve, reject) => {
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`;
const timer = window.setTimeout(() => fail(), 15000);
const fail = () => {
clearTimeout(timer);
script.remove();
reject(new Error("Live2D 运行库未安装或加载失败,请部署 Cubism Core 后重试"));
reject(new Error("Live2D 运行库加载失败,请确认部署产物包含 Cubism Core 且静态资源可访问后重试"));
};
script.onload = () => {
if (!("Live2DCubismCore" in window)) {
@@ -163,7 +163,7 @@ export function CanvasAppearanceEditor({ value, onChange, disabled, onUploading
}
/>
) : 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>
);