REDxEYE / SourceIO

SourceIO is an Blender(3.4+) addon for importing source engine textures/models/maps
https://discord.gg/XJvhzaXZf3
MIT License
565 stars 52 forks source link

"IndexError: list index out of range" error when importing custom maps #303

Open LightShade12 opened 2 weeks ago

LightShade12 commented 2 weeks ago

Blender version: 4.0 release Platform: Windows 10 SourceIO version: 5.4.0

Issue: When attempting to import custom goldsrc maps for cstrike 1.6, I get an error and the import fails.

Expectation: I hoped the map would load normally like other official maps

The log while importing de_dust_2_2020:

Traceback (most recent call last):
  File "C:\Users\subha\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\SourceIO\blender_bindings\operators\goldsrc_operators.py", line 47, in execute
    bsp.load_map()
  File "C:\Users\subha\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\SourceIO\blender_bindings\goldsrc\bsp\import_bsp.py", line 106, in load_map
    self.load_entities()
  File "C:\Users\subha\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\SourceIO\blender_bindings\goldsrc\bsp\import_bsp.py", line 241, in load_entities
    entity_handlers[entity_class](entity, self.scale, self.bsp_collection, self.fix_rotation,
  File "C:\Users\subha\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\SourceIO\blender_bindings\goldsrc\bsp\entity_handlers.py", line 18, in handle_generic_model_prop
    return handle_model_prop(model_name, entity_data, scale, parent_collection,
  File "C:\Users\subha\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\SourceIO\blender_bindings\goldsrc\bsp\entity_handlers.py", line 56, in handle_model_prop
    model_container = import_model(model_name, mdl_buffer, content_manager, opts, None)
  File "C:\Users\subha\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\SourceIO\blender_bindings\models\__init__.py", line 29, in import_model
    container = handler(model_path, buffer, content_manager, options)
  File "C:\Users\subha\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\SourceIO\blender_bindings\models\mdl10\__init__.py", line 17, in import_mdl10
    return import_model(buffer, texture_mdl, options)
  File "C:\Users\subha\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\SourceIO\blender_bindings\models\mdl10\import_mdl.py", line 129, in import_model
    process(mesh_triverts[0],
  File "C:\Users\subha\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\SourceIO\blender_bindings\models\mdl10\import_mdl.py", line 116, in process
    transform = bone_transforms[body_part_model.bone_normal_info[v0.vertex_index]].to_3x3()
IndexError: list index out of range

more log: image only half of the models get imported: image Import settings: image

REDxEYE commented 2 weeks ago

Fixed now. Test with master

LightShade12 commented 2 weeks ago

Thank you for such rapid response. However now there's a new error: TypeError: expected sequence size 8192, got 262144 here's the log:

[ERROR]--[GoldSrc::Texture:get_contents]: Could not find texture resource: !C2A54
[INFO]--[Shaders::goldsrc_shader:create_nodes]: Creating material '!C2A54'
[INFO]--[Shaders::goldsrc_shader_mode2:create_nodes]: Creating material '!C2A54_RM2'
[INFO]--[Shaders::goldsrc_shader:create_nodes]: Creating material 'SCROLLDUST2020'
[INFO]--[Shaders::goldsrc_shader_mode5:create_nodes]: Creating material 'SCROLLDUST2020_RM5'
[INFO]--[ContentManager:find_file]: Requesting +0WATERFALL1 file
[ERROR]--[GoldSrc::Texture:get_contents]: Could not find texture resource: +0WATERFALL1
[INFO]--[Shaders::goldsrc_shader:create_nodes]: Creating material '+0WATERFALL1'
[INFO]--[Shaders::goldsrc_shader_mode2:create_nodes]: Creating material '+0WATERFALL1_RM2'
[INFO]--[ContentManager:find_file]: Requesting REDHANGINGRUG file
[DEBUG]--[ContentManager:find_file]: Found in cstrike_itsitaly!
[INFO]--[Shaders::goldsrc_shader:create_nodes]: Creating material 'REDHANGINGRUG'
Traceback (most recent call last):
  File "C:\Users\subha\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\SourceIO\blender_bindings\operators\goldsrc_operators.py", line 47, in execute
    bsp.load_map()
  File "C:\Users\subha\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\SourceIO\blender_bindings\goldsrc\bsp\import_bsp.py", line 106, in load_map
    self.load_entities()
  File "C:\Users\subha\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\SourceIO\blender_bindings\goldsrc\bsp\import_bsp.py", line 262, in load_entities
    self.load_brush(entity_class, entity, "brushes")
  File "C:\Users\subha\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\SourceIO\blender_bindings\goldsrc\bsp\import_bsp.py", line 342, in load_brush
    model_object = self.load_bmodel(model_index,
  File "C:\Users\subha\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\SourceIO\blender_bindings\goldsrc\bsp\import_bsp.py", line 173, in load_bmodel
    self.load_material(face_texture_name)
  File "C:\Users\subha\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\SourceIO\blender_bindings\goldsrc\bsp\import_bsp.py", line 133, in load_material
    shader.create_nodes(mat, rad_data)
  File "C:\Users\subha\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\SourceIO\blender_bindings\material_loader\shaders\goldsrc_shaders\goldsrc_shader.py", line 16, in create_nodes
    basetexture = self.load_texture(material.name, model_name)
  File "C:\Users\subha\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\SourceIO\blender_bindings\material_loader\shaders\goldsrc_shader_base.py", line 46, in load_texture
    model_texture.pixels.foreach_set(model_texture_info.data.ravel())
TypeError: expected sequence size 8192, got 262144

here's a longer log: image This is for the same de_dust_2020 map import.

REDxEYE commented 2 weeks ago

Please upload map and it's resources

LightShade12 commented 2 weeks ago

Here is the map source: https://gamebanana.com/dl/546696 Here is map page: https://gamebanana.com/mods/83688