Fast-64 / fast64

Blender based editor for scenes, meshes, and more in first-party N64 games
GNU General Public License v3.0
314 stars 74 forks source link

Exporting a Shaded Texture model as .glb with "custom properties" crashes with error message. #437

Closed Boxingbruin closed 2 months ago

Boxingbruin commented 2 months ago

When trying to export a 3d model with Fast64 materials that are shaded textures with a texture applied to the object, exporting as a .glb file with "custom properties" blender crashes on version 4.2.1 and outputs an error on versions 3.3 and 3.6.

I am unable to export a textured object as .glb with custom properties enabled.


Python: Traceback (most recent call last):
  File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\__init__.py", line 852, in execute
    return gltf2_blender_export.save(context, export_settings)
  File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_export.py", line 34, in save
    json, buffer = __export(export_settings)
  File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_export.py", line 51, in __export
    __gather_gltf(exporter, export_settings)
  File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_export.py", line 65, in __gather_gltf
    active_scene_idx, scenes, animations = gltf2_blender_gather.gather_gltf2(export_settings)
  File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather.py", line 28, in gather_gltf2
    scenes.append(__gather_scene(blender_scene, export_settings))
  File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 35, in wrapper_cached
    result = func(*args, **kwargs)
  File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather.py", line 69, in __gather_scene
    node = gltf2_blender_gather_nodes.gather_node(
  File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_nodes.py", line 34, in gather_node
    mesh=__gather_mesh(vnode, blender_object, export_settings),
  File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_nodes.py", line 242, in __gather_mesh
    result = gltf2_blender_gather_mesh.gather_mesh(blender_mesh,
  File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 35, in wrapper_cached
    result = func(*args, **kwargs)
  File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_mesh.py", line 57, in gather_mesh
    primitives=__gather_primitives(blender_mesh, uuid_for_skined_data, vertex_groups, modifiers, materials, export_settings),
  File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_mesh.py", line 134, in __gather_primitives
    return gltf2_blender_gather_primitives.gather_primitives(blender_mesh,
  File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 35, in wrapper_cached
    result = func(*args, **kwargs)
  File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_primitives.py", line 77, in gather_primitives
    material = gltf2_blender_gather_materials.gather_material(
  File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 35, in wrapper_cached
    result = func(*args, **kwargs)
  File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\material\gltf2_blender_gather_materials.py", line 99, in gather_material
    material = deepcopy(base_material)
  File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\python\lib\copy.py", line 172, in deepcopy
    y = _reconstruct(x, memo, *rv)
  File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\python\lib\copy.py", line 271, in _reconstruct
    state = deepcopy(state, memo)
  File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\python\lib\copy.py", line 146, in deepcopy
    y = copier(x, memo)
  File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\python\lib\copy.py", line 231, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\python\lib\copy.py", line 146, in deepcopy
    y = copier(x, memo)
  File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\python\lib\copy.py", line 231, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\python\lib\copy.py", line 146, in deepcopy
    y = copier(x, memo)
  File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\python\lib\copy.py", line 231, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\python\lib\copy.py", line 146, in deepcopy
    y = copier(x, memo)
  File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\python\lib\copy.py", line 231, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\python\lib\copy.py", line 161, in deepcopy
    rv = reductor(4)
TypeError: cannot pickle 'Image' object

'''
Dragorn421 commented 2 months ago

This is a problem with the gltf addon, we can't fix it on fast64

Lilaa3 commented 2 months ago

Weird that this wasn´t showing up in my glTF pr #368 , but yes like dragon said we can´t do much, they're relying on deep copy to make a material copy instead of material.copy()

Lilaa3 commented 2 months ago

https://github.com/KhronosGroup/glTF-Blender-IO/blob/463f949343136fe87254707fe2120ce30574890b/addons/io_scene_gltf2/blender/exp/material/gltf2_blender_gather_materials.py#L110