flo / m3addon

Blender Addon to import and export m3 files
59 stars 16 forks source link

Exporting: object of type 'M3Sturcture' has no len() #10

Closed sclu1034 closed 11 years ago

sclu1034 commented 11 years ago

When I try to export a model as .m3 I get this error:

Traceback (most recent call last): File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\m3addon-masterinit.py", line 3697, in invoke m3export.export(scene, fileName) File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\m3addon-master\m3export.py", line 2283, in export exporter.export(scene, filename) File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\m3addon-master\m3export.py", line 65, in export m3.saveAndInvalidateModel(model, m3FileName) File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\m3addon-master\m3.py", line 1264, in saveAndInvalidateModel sections = modelToSections(model) File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\m3addon-master\m3.py", line 1233, in modelToSections header.introduceIndexReferences(indexMaker) File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\m3addon-master\m3.py", line 243, in introduceIndexReferences field.introduceIndexReferences(self, indexMaker) File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\m3addon-master\m3.py", line 342, in introduceIndexReferences referencedObject.introduceIndexReferences(indexMaker) File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\m3addon-master\m3.py", line 243, in introduceIndexReferences field.introduceIndexReferences(self, indexMaker) File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\m3addon-master\m3.py", line 342, in introduceIndexReferences referencedObject.introduceIndexReferences(indexMaker) File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\m3addon-master\m3.py", line 243, in introduceIndexReferences field.introduceIndexReferences(self, indexMaker) File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\m3addon-master\m3.py", line 338, in introduceIndexReferences indexReference = indexMaker.getIndexReferenceTo(referencedObjects, self.referenceStructureDescription, structureDescription) File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\m3addon-master\m3.py", line 1199, in getIndexReferenceTo repititions = structureDescription.countInstances(objectsToSave) File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\m3addon-master\m3.py", line 187, in countInstances return len(instances) TypeError: object of type 'M3Sturcture' has no len()

This doesn't work on any model. New ones or imported m3-models from Starcraft II.

I downloaded this scripted multiple time to be sure it was not edited. I know I'm using version 2.67. I've tested the script in multiple versions: 2.63, 2.64, 2.67

Does anybody know how to fix this? Would be great :-)

flo commented 11 years ago

I can't reproduce it. I updated the script to print some additional debug information. Can you try it again?

sclu1034 commented 11 years ago

Now the last lines turned to this:

File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\m3addon-master\m3.py", line 189, in countInstances raise Exception("Can't measure the length of %s which is a %s" " (instances, self.structureName)) Exception: Can't measure the length of ReferenceV0: {{'entries': '1', 'flags': '0', 'index': '11'}} which is a l32

flo commented 11 years ago

Lets meet in the IRC channcel m3addon of freenode.net:

http://webchat.freenode.net/?channels=m3addon

Maybe you can help me to reproduce the bug so that I can fix it.

sclu1034 commented 11 years ago

Tomorrow would be better for me... From 17:30 (GMT+1) i could join your chat.

flo commented 11 years ago

Well, I don't know if I am then already back from work... I most likely will come about an hour later or so.

Whare are the exact steps you do to get this exception? When I click the "Export As M3" in the "M3 Quick Export" Panel (Scene Properties Tab) while I have an empty scene it just exports perfectly.

sclu1034 commented 11 years ago

Tried empty screen and default start screen my self: They worked fine. But everytime I import a model from Starcraft II I get the error. Steps are: extract Starcraft models with MPQ Editor, import into new blender file, hit quick export, error.

The specific file I want is this modification of MonoTrack_00: https://dl.dropboxusercontent.com/u/55703447/DualTrack_00.blend

flo commented 11 years ago

The problem was that your model contained two animations with the same name. This isn't supported by the m3addon and I don't know any other SC2 model which has not unique animation names. I added a detection of duplicate names. It shows now a more descriptive error message.

sclu1034 commented 11 years ago

Ok, thanks for your help. I'll fix this in my model.

EDIT: Worked fine now!