whiteye11

你们好,我们项目是个2d项目,里面一个人物有许多时装,需要能实现多个spine使用同一套骨骼+动作数据,这样日后加一个动作,只需要在一个spine项目中添加,不然需要所有spine项目都实现一遍,请问有什么好的方案

---

please someone help me!!
whiteye11
  • Beiträge: 5

Erika

Hello, from what I could understand from the automatic translation, it seems like you are looking for the skins feature in spine:
您好,据我从自动翻译中了解的内容,您似乎在寻找spine的皮肤功能:

Skins - Spine User Guide
Benutzeravatar
Erika

Erikari
  • Beiträge: 2827

whiteye11

Erika hat geschrieben:Hello, from what I could understand from the automatic translation, it seems like you are looking for the skins feature in spine:
您好,据我从自动翻译中了解的内容,您似乎在寻找spine的皮肤功能:

Skins - Spine User Guide
多谢回复,有点类似,但是出于加载和内存的考虑,希望能将skin拆成多个文件导出,骨骼和动作只保存一份文件,然后在游戏运行过程中,可以动态地通过setskin方法加载其他skeletonDataAsset的skin,
但是这边试过,动作无法正常播放,因为slots数据全部都变了
whiteye11
  • Beiträge: 5

Harald

请注意,在使用spine-unity时,您还可以附加来自原始Spine项目不包含的图集资产的附件。

我建议您看一下spine-unity unitypackage随附的“ Spine示例/其他示例/ AtlasRegionAttacher”示例场景,并在“ FootSoldier” GameObject处检查“ AtlasRegionAttacher”脚本。

这个最近的论坛主题还涉及相同的主题(不幸的是英文):
Can there be "Modular Assets"?

这个较旧的线程可能对您也很有趣,因为它可以在运行时加载和卸载Spine资产(尽管这涉及更多的编码):
How to dynamically load/unload Skeleton Data Assets
-----
Please note that when using spine-unity, you can also attach Attachments from atlas assets that were not part of the original Spine project.

I can recommend to have a look at the Spine Examples/Other Examples/AtlasRegionAttacher example scene that comes with the spine-unity unitypackage, and check out the AtlasRegionAttacher script at the FootSoldier GameObject.

This recent forum thread also deals with the same topic (unfortunately in English):
Can there be "Modular Assets"?

This older thread might also be interesting for you, as it deals with loading and unloading Spine assets at runtime (this involves more coding though):
How to dynamically load/unload Skeleton Data Assets
Benutzeravatar
Harald

Harri
  • Beiträge: 2774

whiteye11

---

Harald hat geschrieben:请注意,在使用spine-unity时,您还可以附加来自原始Spine项目不包含的图集资产的附件。

我建议您看一下spine-unity unitypackage随附的“ Spine示例/其他示例/ AtlasRegionAttacher”示例场景,并在“ FootSoldier” GameObject处检查“ AtlasRegionAttacher”脚本。

这个最近的论坛主题还涉及相同的主题(不幸的是英文):
Can there be "Modular Assets"?

这个较旧的线程可能对您也很有趣,因为它可以在运行时加载和卸载Spine资产(尽管这涉及更多的编码):
How to dynamically load/unload Skeleton Data Assets
-----
Please note that when using spine-unity, you can also attach Attachments from atlas assets that were not part of the original Spine project.

I can recommend to have a look at the Spine Examples/Other Examples/AtlasRegionAttacher example scene that comes with the spine-unity unitypackage, and check out the AtlasRegionAttacher script at the FootSoldier GameObject.

This recent forum thread also deals with the same topic (unfortunately in English):
Can there be "Modular Assets"?

This older thread might also be interesting for you, as it deals with loading and unloading Spine assets at runtime (this involves more coding though):
How to dynamically load/unload Skeleton Data Assets
感谢回复,但不是很符合我的需求。这边是由一个包含通用骨骼和通用动画的spine工程,加上几十个保护纹理数据和slot数据的spine工程,然后在游戏运行中组合生成一个skeletonAnimation。这边测试发现,如果替换掉skeleton.slots,动画播放会异常。
whiteye11
  • Beiträge: 5

Harald

我是否正确理解您想要将动画分离到单独的项目中并作为单独的.json(或.skel.bytes)文件导出的信息?

该主题已在论坛上进行了简要讨论:
请问Spine用脚本载入时怎么才能不载入图集只取动画

基本上,我在这里看到两个选项:
1)将动画导入每个角色,然后将其导出。 不幸的是,尚不支持通过Spine命令行界面从项目中导入动画。 它计划用于Spine 4.1,可在此发行通知下进行跟踪:
https://github.com/EsotericSoftware/spine-editor/issues/379
2)您可以编写自定义加载代码,以加载仅包含动画的 SkeletonData,然后将动画附加到角色骨架上。 如上面论坛线程中所述,您必须确保骨骼索引,附件索引等匹配。 当您不修改骨架骨骼,插槽等而仅添加动画时,应该是这种情况。
-----
Did I understand you correctly that you want to separate Animations into separate Projects and exported as separate .json (or .skel.bytes) files?

This topic has been discussed here on the forum briefly:
请问Spine用脚本载入时怎么才能不载入图集只取动画

Basically I see two options here:
1) Importing animations to each character, then exporting it. Unfortunately importing animations from a project is not yet supported via the Spine command line interface. It is planned for Spine 4.1, it's tracked under this issue ticket: https://github.com/EsotericSoftware/spine-editor/issues/379
2) You can write custom loading code that loads the animation-only SkeletonData and then append the animations to a character skeleton. As noted in the forum thread above, you have to make sure that the bone indices, attachment indices, etc match up. This should be the case when you don't modify the skeleton bones, slots, etc and only add an animation.
Benutzeravatar
Harald

Harri
  • Beiträge: 2774

whiteye11

Harald hat geschrieben:我是否正确理解您想要将动画分离到单独的项目中并作为单独的.json(或.skel.bytes)文件导出的信息?

该主题已在论坛上进行了简要讨论:
请问Spine用脚本载入时怎么才能不载入图集只取动画

基本上,我在这里看到两个选项:
1)将动画导入每个角色,然后将其导出。 不幸的是,尚不支持通过Spine命令行界面从项目中导入动画。 它计划用于Spine 4.1,可在此发行通知下进行跟踪:
https://github.com/EsotericSoftware/spine-editor/issues/379
2)您可以编写自定义加载代码,以加载仅包含动画的 SkeletonData,然后将动画附加到角色骨架上。 如上面论坛线程中所述,您必须确保骨骼索引,附件索引等匹配。 当您不修改骨架骨骼,插槽等而仅添加动画时,应该是这种情况。
-----
Did I understand you correctly that you want to separate Animations into separate Projects and exported as separate .json (or .skel.bytes) files?

This topic has been discussed here on the forum briefly:
请问Spine用脚本载入时怎么才能不载入图集只取动画

Basically I see two options here:
1) Importing animations to each character, then exporting it. Unfortunately importing animations from a project is not yet supported via the Spine command line interface. It is planned for Spine 4.1, it's tracked under this issue ticket: https://github.com/EsotericSoftware/spine-editor/issues/379
2) You can write custom loading code that loads the animation-only SkeletonData and then append the animations to a character skeleton. As noted in the forum thread above, you have to make sure that the bone indices, attachment indices, etc match up. This should be the case when you don't modify the skeleton bones, slots, etc and only add an animation.
差不多,其实是希望骨骼,动作,皮肤,都单独导出成一个二进制文件。或者spine-unity中能否提供二进制的写入方法,由我们自行去实现这种功能
whiteye11
  • Beiträge: 5

Harald

恐怕我不能完全理解您的帖子(很可能自动翻译无法正确翻译所有内容)。

无论使用.json还是二进制.skel.bytes导出,都可以相同地导入它们。 从任何格式加载后,必须将加载的动画数据附加到角色的骨骼数据中。

如果这不是您的意思,请用更多的文字描述您想要实现的目标。
-----
I'm afraid I don't completely understand your posting (most likely automatic translation failed to translate everything correctly).

It does not matter whether you are using .json or binary .skel.bytes export, you can import them just the same. After loading from any format, you have to append the loaded animation data to your character's skeleton data.

If this is not what you mean, please describe in more words what you want to achieve.
Benutzeravatar
Harald

Harri
  • Beiträge: 2774

whiteye11

Harald hat geschrieben:恐怕我不能完全理解您的帖子(很可能自动翻译无法正确翻译所有内容)。

无论使用.json还是二进制.skel.bytes导出,都可以相同地导入它们。 从任何格式加载后,必须将加载的动画数据附加到角色的骨骼数据中。

如果这不是您的意思,请用更多的文字描述您想要实现的目标。
-----
I'm afraid I don't completely understand your posting (most likely automatic translation failed to translate everything correctly).

It does not matter whether you are using .json or binary .skel.bytes export, you can import them just the same. After loading from any format, you have to append the loaded animation data to your character's skeleton data.

If this is not what you mean, please describe in more words what you want to achieve.
很抱歉这么迟才回复。我的意思是,项目中包含两个工程:1.通用骨骼。2.人物角色。
1.通用骨骼:这个工程只有一个,其中只包含动作、骨骼,不包含皮肤、图片。
2.人物角色:这个工程有几十个,其中只包含皮肤、图片,不包含动作、骨骼。
游戏中,读取通用骨骼和人物角色动态的合并成一个skeletonAnimation.
这样做的原因是,以后添加一个动作,在通用骨骼中添加即可,无需几十个人物角色全部重做。
希望官方能看下,有什么实现方式
whiteye11
  • Beiträge: 5

Harald

感谢您再次与我们联系,我想我现在可以理解您正在努力实现的目标。

不幸的是,没有一种简便的方法可以从Spine Editor导出单独的皮肤描述文件。当将骨架导出为.json时,文件将始终包含“骨骼”和“插槽”部分以及“皮肤”部分。目前暂时无法单独导出。

您需要做的是创建一个脚本(例如在python中)或一个在导出后会自动调用的应用程序。然后,此脚本将从一个完整的骨架文件中创建两个单独的.json文件:一个没有.skins部分的.json文件,以及一个仅包含skins部分的文件。然后,您可以在运行时下载文件的两部分并以编程方式连接文件内容。然后,您需要在“ SkeletonDataAsset”处分配它,以像在正常工作流程中那样加载它。您仍然需要手动下载并分配Atlas资产和png文件,因为如果您担心大小,还需要按需下载它们。

请注意,将皮肤与骨骼分离不会获得太多收益。将皮肤与骨骼,插槽和动画一起导出为二进制.skel.bytes文件而不将其分为两个文件,效率最高。无论如何,纹理很可能会主导下载大小。因此,如上所述,您可能需要考虑按需下载和分配纹理参考。
-----
Thanks for getting back to us, I think I can now understand what you are trying to achieve.

Unfortunately there is no comfortable way to export separate skin description files from the Spine Editor. When exporting a skeleton as .json, the file will always contain both the bones and slots section, as well as the skins section. It cannot be exported separately for now.

What you would need to do is create a script (e.g. in python) or an application which is called automatically after export. This script would then create two separate .json files from one complete skeleton file: one .json file without the skins section, and one containing only the skins section. Then you could at runtime download both parts of the file and concatenate the file content programmatically. Then you would need to assign it at a SkeletonDataAsset to load it as it would do in the normal workflow. You would still need to manually download and assign the atlas asset and png files, as you will also want to download them on demand if size is of concern.

Please note that you will not gain much by separating skins from a skeleton. It is most likely much more efficient to export the skin together with the bones, slots and animations as a binary .skel.bytes file and not separate it into two files. The textures will most likely dominate the download size anyway. So as mentioned in postings above, you might want to consider downloading and assigning texture references on demand.
Benutzeravatar
Harald

Harri
  • Beiträge: 2774

msqsw

你可以试试看 用SPINE自带的皮肤功能来做,然后每套皮肤用到的图片 分别放在放在不同文件夹内,最后用纹理打包器(ctrl+p)来打包图片,这样每个文件夹内的图各自导出不同的纹理集 正常导出只导出二进制或者JSON数据格式 。加载的时候 程序去控制 只加载目前皮肤使用的贴图文件
Benutzeravatar
msqsw
  • Beiträge: 21

Jianan

这个问题有解决方案了吗?
Jianan
  • Beiträge: 3

Harald

自动翻译可能无法正确翻译您的问题:您是否在问这个问题的解决方案? 如果是这样,请参见上面的答案,他们已经列出了潜在的解决方案。
-----
Automatic translation might have failed to translate your question properly: Are you asking if there is a solution to this problem? If so, please see the answers above, they already list potential solutions.
Benutzeravatar
Harald

Harri
  • Beiträge: 2774


Zurück zu 中国Spine用户