Closed hansnolte closed 1 year ago
Is it possible to export from Krita to GIMP with saving layer structure?
Hi tozpeak,
I don't know exactly, but I didn't want to go through several programs, something is always stuck.
Thank you for reaching out, hansnoite! To use the Krita exporter, you probably need to run the installation for the program located at /Krita (https://github.com/Aodaruma/coa_tools2/tree/master/Krita). I have no experience with Krita, and the program hasn't been modified since it was forked. I believe you should refer to the ndee85/coa_tools repository for the correct installation method: https://github.com/ndee85/coa_tools#krita-exporter
I found that I haven't written the installation method for Krita in README.md, so I have to write about the installation method properly. Also, once all the critical bugs are fixed, we need to bundle each script into a zip and upload it to releases.
Hi Aodaruma, many thanks for your answer.
As you can see in my first screenshot, I installed the plugin correctly. But it is greyed out because no module was found.
The addon will probably have been written for Krita 4 (or 3).
I understand the reason for the import error: when renaming coa_tools to coa_tools2, coa_tools2_docker was specified in __init__.py
, but the filename remained coa_tools_docker.py
: https://github.com/Aodaruma/coa_tools2/blob/master/Krita/coa_tools_exporter/__init__.py#L1
Either change the filename of coa_tools_docker.py
to coa_tools2_docker.py
or modify __init__.py
to from .coa_tools_docker import *
, and this issue might be resolved.
Hi Aodaruma,
many thanks for your help. I rename coa_tools_docker.py to coa_tools2_docker.py but that did not work.
thank you for replying. i created branch here and pushed some commits to fix these errors. can you try to install them from that?
Great, you're slowly getting closer to it.
It is not grayed out anymore and I have a Docker-Window. When I want to export the sprites I get this error message.
TypeError
Python 3.10.7: C:\Program Files\Krita (x64)\bin\krita.exe
Tue Sep 26 17:33:43 2023
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:\Program Files\Krita (x64)\share\krita\pykrita\coa_tools2_exporter\coa_tools2_docker.py in export(self=<coa_tools2_exporter.coa_tools2_docker.COATools2Docker object>)
164
165 if self.exportPath.text() != "" and self.exportName.text() != "":
166 self.exportSelectedNodes(self.exportPath.text(), self.exportName.text())
167 QtWidgets.QMessageBox.about(self, "Info", "Exported finished.")
168 else:
self = <coa_tools2_exporter.coa_tools2_docker.COATools2Docker object>
self.exportSelectedNodes = <bound method COATools2Docker.exportSelectedNode...porter.coa_tools2_docker.COATools2Docker object>>
self.exportPath = <PyQt5.QtWidgets.QLineEdit object>
self.exportPath.text = <built-in method text of QLineEdit object>
self.exportName = <PyQt5.QtWidgets.QLineEdit object>
self.exportName.text = <built-in method text of QLineEdit object>
C:\Program Files\Krita (x64)\share\krita\pykrita\coa_tools2_exporter\coa_tools2_docker.py in exportSelectedNodes(self=<coa_tools2_exporter.coa_tools2_docker.COATools2Docker object>, exportPath='E:/temp/zzz', coaObjectName='testson')
203 jsonData["nodes"].append(newCoaNode)
204
205 self.exportNode(node, path)
206
207 ### write json data
self = <coa_tools2_exporter.coa_tools2_docker.COATools2Docker object>
self.exportNode = <bound method COATools2Docker.exportNode of <coa...porter.coa_tools2_docker.COATools2Docker object>>
node = <PyKrita.krita.Node object>
path = r'E:/temp/zzz\sprites\{"coa_tools2_data":_"",_"exp...th":_"e:/temp/zzz",_"export_name":_"testson"}.png'
C:\Program Files\Krita (x64)\share\krita\pykrita\coa_tools2_exporter\coa_tools2_docker.py in exportNode(self=<coa_tools2_exporter.coa_tools2_docker.COATools2Docker object>, node=<PyKrita.krita.Node object>, path=r'E:/temp/zzz\sprites\{"coa_tools2_data":_"",_"exp...th":_"e:/temp/zzz",_"export_name":_"testson"}.png')
234 ### paste pixel data into layer of new document
235 newNode = newDoc.rootNode().childNodes()[0]
236 newNode.setPixelData(
237 pixelData, 0.0, 0.0, node.bounds().width(), node.bounds().height()
238 )
newNode = <PyKrita.krita.Node object>
newNode.setPixelData = <built-in method setPixelData of Node object>
pixelData = PyQt5.QtCore.QByteArray(b'')
node = <PyKrita.krita.Node object>
node.bounds = <built-in method bounds of Node object>
).width undefined
).height undefined
TypeError: setPixelData(self, Union[QByteArray, bytes, bytearray], int, int, int, int): argument 2 has unexpected type 'float'
__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 = ("setPixelData(self, Union[QByteArray, bytes, byte...int, int): argument 2 has unexpected type 'float'",)
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:\Program Files\Krita (x64)\share\krita\pykrita\coa_tools2_exporter\coa_tools2_docker.py", line 166, in export
self.exportSelectedNodes(self.exportPath.text(), self.exportName.text())
File "C:\Program Files\Krita (x64)\share\krita\pykrita\coa_tools2_exporter\coa_tools2_docker.py", line 205, in exportSelectedNodes
self.exportNode(node, path)
File "C:\Program Files\Krita (x64)\share\krita\pykrita\coa_tools2_exporter\coa_tools2_docker.py", line 236, in exportNode
newNode.setPixelData(
TypeError: setPixelData(self, Union[QByteArray, bytes, bytearray], int, int, int, int): argument 2 has unexpected type 'float'
I pushed a commit that fixes the error you shared, download and check it works (As far as I have tried with krita, this should fix it completely!)
Yeeess!
It works perfectly. Great Job Aodaruma.
Thank you very much Hans
As feared, the Krita importer does not work.
Tested with Krita 5.1.5: When I copy the coa_tools_exporter.desktop and the coa_tools_exporter folder to the pykrita by hand, I get this error message in the python module management.
When I try to import the coa_tools2-master.zip via Tools->Scripts, this error occur.
Bye Hans