• Editor
  • Announcement: New Krita export plugin for Spine

  • Изменено
Related Discussions
...

Hello,
I'm pleased to announce an alpha release of a new Krita plugin to export Spine files, available here. Heavily inspired and borrowing code from Chartinger's Krita plugin, expanded with new features such as image scale on export. This is alpha code is working well, bug reports and such welcome. Features

  1. Change scale, canvas size or rotate on export

  2. Choose from available documents, allowing dialog to stay visible and export multiple files in one session

  3. Automatic setting of output directory and width/height parameters

  4. Supports bone, slot, merge and ignore tags for groups.

Todo

  1. Working on setting origin via Guides

  2. Support multiple transforms on output

  3. Support skins

  4. Persistent settings saving, such as relative output directory

Bugs

  1. Choosing the Document sets the parameters only on the shown transform tab

Screenshot

Awesome!

This is great, thanks for sharing!

12 дней спустя

Thank you!
I can now cancel my Creative Cloud monthly payment.<3
Does it work with Krita 3 too?

13 дней спустя

Krita 4.2.1 has an error: ... Not enough arguments...

Fix:

Add the import in file SpineExport.py

from krita import InfoObject

next change the method parameters:

from:

child.save(layer_file_name, 96, 96)

to:

child.save(layer_file_name, 96, 96, InfoObject())
14 дней спустя

Really looking forward to progress in this plugin as this would simplify my work flow by cutting out the photoshop middle man :bigeye:

5 дней спустя

Tried copy the folder and .desktop to the pykrita folder and but the export option does not show up in the menu.
Does the script not work in the latest Krita version

2 года спустя

It's a great plugin but I'm having a problem. krita v4.4.8 is giving me an error and not exporting.

Is there anything I can read from the error message?

TypeError
Python 3.8.1: E:\Steam\steamapps\common\Krita\krita\bin\krita.exe
Sat Oct  2 15:41:51 2021

A problem occurred in a Python script.  Here is the sequence of
function calls leading up to the error, in the order they occurred.

 C:\Users\kingn\AppData\Roaming\krita\pykrita\KritaToSpine\uidocumenttools.py in confirmButton(self=<KritaToSpine.uidocumenttools.UIDocumentTools object>)
  126                 widget.adjust(cloneDoc)
  127                 # Save the json from the clone
  128                 self.spineExport.exportDocument(cloneDoc, self.directoryTextField.text())
  129                 # Clone no longer needed
  130                 cloneDoc.close()
self = <KritaToSpine.uidocumenttools.UIDocumentTools object>
self.spineExport = <KritaToSpine.SpineExport.SpineExport object>
self.spineExport.exportDocument = <bound method SpineExport.exportDocument of <KritaToSpine.SpineExport.SpineExport object>>
cloneDoc = <PyKrita.krita.Document object>
self.directoryTextField = <PyQt5.QtWidgets.QLineEdit object>
self.directoryTextField.text = <built-in method text of QLineEdit object>

 C:\Users\kingn\AppData\Roaming\krita\pykrita\KritaToSpine\SpineExport.py in exportDocument(self=<KritaToSpine.SpineExport.SpineExport object>, document=<PyKrita.krita.Document object>, directory='D:/video/factory workers/Stream/img/alert/spine')
   41             Krita.instance().setBatchmode(True)
   42             self.document = document
   43             self._export(document.rootNode(), directory)
   44             Krita.instance().setBatchmode(False)
   45             with open('{0}/{1}'.format(directory, 'spine.json'), 'w') as outfile:
self = <KritaToSpine.SpineExport.SpineExport object>
self._export = <bound method SpineExport._export of <KritaToSpine.SpineExport.SpineExport object>>
document = <PyKrita.krita.Document object>
document.rootNode = <built-in method rootNode of Document object>
directory = 'D:/video/factory workers/Stream/img/alert/spine'

 C:\Users\kingn\AppData\Roaming\krita\pykrita\KritaToSpine\SpineExport.py in _export(self=<KritaToSpine.SpineExport.SpineExport object>, node=<PyKrita.krita.GroupLayer object>, directory='D:/video/factory workers/Stream/img/alert/spine', bone='root', xOffset=0, yOffset=0, slot=None)
  111             name = self.mergePattern.sub('', child.name()).strip()
  112             layer_file_name = '{0}/{1}.{2}'.format(directory, name, self.fileFormat)
  113             child.save(layer_file_name, 96, 96)
  114 
  115             newSlot = slot
child = <PyKrita.krita.Node object>
child.save = <built-in method save of Node object>
layer_file_name = 'D:/video/factory workers/Stream/img/alert/spine/back_hair.png'
TypeError: save(self, str, float, float, InfoObject, QRect = QRect()): not enough arguments
    __cause__ = None
    __class__ = <class 'TypeError'>
    __context__ = None
    __delattr__ = <method-wrapper '__delattr__' of TypeError object>
    __dict__ = {}
    __dir__ = <built-in method __dir__ of TypeError object>
    __doc__ = 'Inappropriate argument type.'
    __eq__ = <method-wrapper '__eq__' of TypeError object>
    __format__ = <built-in method __format__ of TypeError object>
    __ge__ = <method-wrapper '__ge__' of TypeError object>
    __getattribute__ = <method-wrapper '__getattribute__' of TypeError object>
    __gt__ = <method-wrapper '__gt__' of TypeError object>
    __hash__ = <method-wrapper '__hash__' of TypeError object>
    __init__ = <method-wrapper '__init__' of TypeError object>
    __init_subclass__ = <built-in method __init_subclass__ of type object>
    __le__ = <method-wrapper '__le__' of TypeError object>
    __lt__ = <method-wrapper '__lt__' of TypeError object>
    __ne__ = <method-wrapper '__ne__' of TypeError object>
    __new__ = <built-in method __new__ of type object>
    __reduce__ = <built-in method __reduce__ of TypeError object>
    __reduce_ex__ = <built-in method __reduce_ex__ of TypeError object>
    __repr__ = <method-wrapper '__repr__' of TypeError object>
    __setattr__ = <method-wrapper '__setattr__' of TypeError object>
    __setstate__ = <built-in method __setstate__ of TypeError object>
    __sizeof__ = <built-in method __sizeof__ of TypeError object>
    __str__ = <method-wrapper '__str__' of TypeError object>
    __subclasshook__ = <built-in method __subclasshook__ of type object>
    __suppress_context__ = False
    __traceback__ = <traceback object>
    args = ('save(self, str, float, float, InfoObject, QRect = QRect()): not enough arguments',)
    with_traceback = <built-in method with_traceback of TypeError object>

The above is a description of an error in a Python program.  Here is
the original traceback:

Traceback (most recent call last):
  File "C:\Users\kingn\AppData\Roaming\krita\pykrita\KritaToSpine\uidocumenttools.py", line 128, in confirmButton
    self.spineExport.exportDocument(cloneDoc, self.directoryTextField.text())
  File "C:\Users\kingn\AppData\Roaming\krita\pykrita\KritaToSpine\SpineExport.py", line 43, in exportDocument
    self._export(document.rootNode(), directory)
  File "C:\Users\kingn\AppData\Roaming\krita\pykrita\KritaToSpine\SpineExport.py", line 113, in _export
    child.save(layer_file_name, 96, 96)
TypeError: save(self, str, float, float, InfoObject, QRect = QRect()): not enough arguments
19 дней спустя

Hello,
Is there any chance that the plugin will support skins soon ?

Thank you very much ! 🙂

2 года спустя

Hi. I have just started using Spine. But this plugin doesn't work with Krita 5.2.2, so I made a fix. I didn't delve into the results, so please let me know if you have any problems. I used the version DanStout/KritaToSpine which can work with [Skin] tag. I open a pull request, but now the patched version can be downloaded from my repository Savidiy/KritaToSpinetree/master.

    Hello Savidiy

    I'm glad to see that people still need to use this feature 🙂
    I don't have so much time to try it, but thank you for the upload. I'll give a feedback when I use it

    have a nice day 🙂

    Savidiy Hi. Your repo seems to be private. Or at the very least, the link leads to 404.

    • Savidiy ответили на это сообщение.

      Savidiy It's working now and thank you for getting it up to date. Skin and merge support is pretty big. I wasn't aware it's available somewhere else other than Photoshop.

      15 дней спустя

      I've added a few improvements for exporting:

      The selected width and height is saved.

      When merging the pass-through checkbox is unchecked (in my case it fix black exported image)

      The layer blending is passed to spine for Normal, Additive, Multiply and Screen variants.

      • T.Fly() ответили на это сообщение.
      • T.Fly() и Luke оценили это.

        Savidiy Would you be interested to do a pull request for spine scripts repo? EsotericSoftware/spine-scripts

        More people should know they are not forced into the Adobe ecosystem to get all the relevant parts of the PhotoshopToSpine script functionality since no other script on there supports those features.

        • Savidiy ответили на это сообщение.

          BTW, we are working on having the Spine editor process a PSD file itself. Most image editing software can write the PSD format, so this will break us free from the nasty Adobe products. We already have this working but it isn't finished. It will be in 4.3 for sure, but maybe it can make it into 4.2.

          6 дней спустя

          T.Fly()
          Sorry, but I'm not ready to take on the responsibility of maintaining the plugin in the official repository. Especially if they make support for PSD files it may become irrelevant.