前辈 我用的模拟器 sp.spine.TextureAtlas is not a constructor 该怎么修改
mark一下
mark!!!
我换图以后,图片本身透明的会出现白底…
设置图片预乘选项
void SkeletonRenderer::createRegion(const std::string& slotName,cocos2d::middleware::Texture2D * texture){
Slot *slot = _skeleton->findSlot(slotName.c_str());
Texture* texture2D = texture->getNativeTexture();
RegionAttachment* attachment = (RegionAttachment*)slot->getAttachment();
float width = texture2D->getWidth();
float height = texture2D->getHeight();
float wide = texture->getPixelsWide();
float high = texture->getPixelsHigh();
attachment->setUVs(0, 0, 1,1, false);
attachment->setWidth(wide);
attachment->setHeight(high);
attachment->setRegionWidth(wide);
attachment->setRegionHeight(high);
attachment->setRegionOriginalWidth(wide);
attachment->setRegionOriginalHeight(high);
attachment->setRegionOffsetX(0);
attachment->setRegionOffsetY(15);
texture->setPixelsWide(width);
texture->setPixelsHigh(height);
texture->setRealTextureIndex(1);
AttachmentVertices * attachV = (AttachmentVertices *)attachment->getRendererObject();
if (attachV->_texture == texture) return;
CC_SAFE_RELEASE(attachV->_texture);
attachV->_texture = texture;
CC_SAFE_RETAIN(texture);
V2F_T2F_C4B* vertices = attachV->_triangles->verts;
for (int i = 0, ii = 0; i < 4; ++i, ii += 2) {
vertices[i].texCoord.u = attachment->getUVs()[ii];
vertices[i].texCoord.v = attachment->getUVs()[ii+1];
}
attachment->updateOffset();
}
自己增加个函数,绑定下c++层,这个我写的可以的
4赞
1.10.2版本支持吗
你是怎么解决这个问题的呢
mark Spine换图
把spine动画的缓存模式改为private或者shared即可,最后在换装之后调用invalidAnimationCache()
就行了。这样做的话native端你需要在SkeletonCacheAnimation.cpp
和SkeletonRenderer.cpp
里都实现对应的方法。realtime下怎么解决相互影响的问题还在看
你可以用2.3的挂点,升级下引擎,实在不行
mark spine换图
web上无效 同骨骼的skeletonData的都是一个实例 一改俱改啊
一个换装,方案1 挂点 结果挂的点渲染永远在最上层
方案2 换贴图,结果换一个,所有的同骨骼都换了,也是醉醉的
1赞
MeshAttachment 怎么更改呢,没有setRegion 方法。
目前只能更改 RegionAttachment 的,单独换骨骼节点需要把spine动画的缓存模式改为private或者shared,最后在换装之后调用invalidAnimationCache()
1赞
native 用不了,也没报错啥的,就是没换成功,web上亲测可行
大佬,请问一下 2.3.4报setRegion not a function 有遇到吗