[0]laya3.0的spine是不是不支持外部图片设置附件
如题,我看官方的例子中是使用同一个图集的换装。支不支持使用外部的随便一张图片替换掉插槽上的附件?
我看unity跟cocos都是支持的。
如图。同样的功能我在unity实现了。
但是laya这边一直搞不出来。不知道是不是哪里搞错了。官方大佬能回答下么,谢谢啦~
下面是我做的demo
我看unity跟cocos都是支持的。
如图。同样的功能我在unity实现了。
但是laya这边一直搞不出来。不知道是不是哪里搞错了。官方大佬能回答下么,谢谢啦~
下面是我做的demo
没有找到相关结果
已邀请:
5 个回复
小高
赞同来自:
小高
赞同来自:
1689124599用户
赞同来自:
layabox
赞同来自:
1689124599用户
赞同来自:
if (attachment instanceof this.templet.ns.RegionAttachment) {
let region = attachment;
renderable.vertices = this.vertices;
renderable.numVertices = 4;
renderable.numFloats = clippedVertexSize << 2;
region.computeWorldVertices(slot.bone, renderable.vertices, 0, clippedVertexSize);
triangles = QUAD_TRIANGLES;
uvs = region.uvs;
name = region.region.renderObject.page.name;
texture = this.templet.getTexture(name);
this.templet.getTexture(name);
这个方法返回的是spine自身使用的texture。但是这个
attachment现在使用的是外部的texture所以gettexture返回空,
我现在临时的做法是判断下是不是有效值
if (texture == null || texture == undefined){
texture = region.region.texture;
}
值无效的话直接用region上的texture。
后续看官方的处理。