Gaukler / Blender-ALAMO-Plugin

Blender plugin enabling import/export of ALAMO files, used in Empire at War : Forces of Corruption
MIT License
15 stars 17 forks source link

Certain .ALO files will not import #6

Open wideeyenow opened 1 year ago

wideeyenow commented 1 year ago

For the most part, most alo files I attempt to import into blender work just fine. However some models keep giving the error:

Python: Traceback (most recent call last):
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_alamo_tools\import_alo.py", line 907, in execute
    originalArmature = utils.findArmature()
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_alamo_tools\utils.py", line 10, in findArmature
    armature = bpy.data.objects[armatureName]
KeyError: 'bpy_prop_collection[key]: key "" not found'

After conversing with AI, to no avail, it was attempted to fix(what I assume is) the problem area:

def findArmature():
    armatureName = bpy.context.scene.ActiveSkeleton.skeletonEnum
    if armatureName == 'None':
        return None
    armature = bpy.data.objects[armatureName]
    return armature

this didn't work...

def findArmature():
    armatureName = bpy.context.scene.ActiveSkeleton.skeletonEnum
    if armatureName == 'None':
        for armature in bpy.context.scene.objects:
            if armature.type == 'ARMATURE':
                armatureName = armature.name
    armature = bpy.data.objects[armatureName]
    return armature

But still no armature is found. And as AI had explained, it's because there is no model that is active in the scene. So to test that the alo files that I had were indeed real, I used the "ALOViewer" app/program, and it shows the models and their bones, so I know nothing is wrong with the alo files that I'm trying to import.

I am decent with C# language, but python throws me for a loop, so at multiple attempts to fix this error(or at least force the mesh to import), I have failed.

I'm not sure if the dev that made this plugin is still around, or is even worried about this anymore? But if someone can give a little insight on how to find(or force) the alo file to at least give the mesh in return(even if losing all animations/shaders or even bones). As I mostly am worried about the meshes(I can re-skin/animate manually in blender).

wideeyenow commented 1 year ago

I apologize for the syntax, I can't get the code to show as snippets. It is not intentional to make the text large or small, I will attempt to fix the layout.

wideeyenow commented 1 year ago

Figured out upon a first load of Blender, everything works fine. If you previously imported a model, you cannot import another. You just have to keep closing and re-loading Blender for each model to import. Cheers!