spine是否可以用外部图片进行换皮

MeshAttachment 怎么更改呢,没有setRegion 方法。

目前只能更改 RegionAttachment 的,单独换骨骼节点需要把spine动画的缓存模式改为private或者shared,最后在换装之后调用invalidAnimationCache()

1赞

native 用不了,也没报错啥的,就是没换成功,web上亲测可行

大佬,请问一下 2.3.4报setRegion not a function 有遇到吗

mark 。。。

请教下绑定c++后 js传一个cc.texture2d类型的过来后 cocos2d::middleware::Texture2D * texture 获取到的arg2是空值

cocos2d::middleware::Texture2D* arg2 = nullptr;
ok &= seval_to_native_ptr(args[2], &arg2);

cocos2d::middleware::Texture2D 和 cc.Texture2D 不是一个类型吧
jsb-adapter 里面把一些函数参数的 cc.Texture2D 转成了 cocos2d::middleware::Texture2D,你可以看一下 jsb-adapter 的源码

我是上述代码写的,(我的图片有透明的地方,原spine局部也有透明的地方,图片的规格是同一样大的)换成之后图片变大了,怎么解决呢

你好,我的spine里面也是 MeshAttachment,请问这种情况怎么改呢

好久没用了,官方好像推出了spine的插槽换皮方式吧,可以去看看

经过实测,只能更换大小相同的图片,否则大小显示不对,比如原始图100100,替换为200200的图片,结果图片会自动缩放到100*100大小,基本上没法用。

MeshAttachment 也是差不多的用法,判断一下是什么Attachment;然后强转成对应的Attachment

if (attachment != NULL && attachment->getRTTI().instanceOf(RegionAttachment::rtti)) {
RegionAttachment *regionAttachment = static_cast<RegionAttachment *>(attachment);
AttachmentVertices *attachV = (AttachmentVertices *)regionAttachment->getRendererObject();
if (attachV->_texture == texture_temp) {
return;
}
CC_SAFE_RELEASE(attachV->_texture);
attachV->_texture = texture_temp;
CC_SAFE_RETAIN(texture_temp);

			regionAttachment->updateOffset();

		}
		else if (attachment != NULL && attachment->getRTTI().instanceOf(MeshAttachment::rtti)) {
			MeshAttachment *mesh = static_cast<MeshAttachment *>(attachment);
			AttachmentVertices *attachV = (AttachmentVertices *)mesh->getRendererObject();
			if (attachV->_texture == texture_temp) {
				return;
			}
			CC_SAFE_RELEASE(attachV->_texture);
			attachV->_texture = texture_temp;
			CC_SAFE_RETAIN(texture_temp);
		}

2.4版本不行,有好的解决版本么

mark骨骼动画挂皮

谢谢分享~顶一下

mark!

native的MeshAttachment可不可以替换page和atlasRegion?

mark~

Mark一下

支持插槽替换个外部的spine动画上去吗?