powroupi / blender_mmd_tools

mmd_tools is a blender addon for importing Models and Motions of MikuMikuDance.
GNU General Public License v3.0
1.73k stars 278 forks source link

KeyError: 'bpy_prop_collection[key]: key "Shader" not found' when import my pmx file #398

Closed xiaomaofeng closed 7 months ago

xiaomaofeng commented 7 months ago

File "D:\Program Files\Blender Foundation\Blender 4.0\4.0\scripts\addons\mmd_tools\properties\material.py", line 29, in _updateIsDoubleSided Traceback (most recent call last): File "D:\Program Files\Blender Foundation\Blender 4.0\4.0\scripts\addons\mmd_tools\properties\material.py", line 45, in _updateSelfShadow FnMaterial(prop.id_data).update_self_shadow() File "D:\Program Files\Blender Foundation\Blender 4.0\4.0\scripts\addons\mmd_tools\core\material.py", line 583, in update_self_shadow self.update_shader_input('Self Shadow', mmd_mat.enabled_self_shadow) File "D:\Program Files\Blender Foundation\Blender 4.0\4.0\scripts\addons\mmd_tools\core\material.py", line 622, in update_shader_input self.update_shader_nodes() File "D:\Program Files\Blender Foundation\Blender 4.0\4.0\scripts\addons\mmd_tools\core\material.py", line 666, in __update_shader_nodes if not node_shader.outputs['Shader'].is_linked: KeyError: 'bpy_prop_collection[key]: key "Shader" not found' File "D:\Program Files\Blender Foundation\Blender 4.0\4.0\scripts\addons\mmd_tools\properties\material.py", line 44, in _updateSelfShadow Traceback (most recent call last): File "D:\Program Files\Blender Foundation\Blender 4.0\4.0\scripts\addons\mmd_tools\operators\fileio.py", line 182, in _do_execute importer_cls().execute( File "D:\Program Files\Blender Foundation\Blender 4.0\4.0\scripts\addons\mmd_tools\core\pmx\importer.py", line 845, in execute self.importMaterials() File "D:\Program Files\Blender Foundation\Blender 4.0\4.0\scripts\addons\mmd_tools\core\pmx\importer.py", line 557, in importMaterials texture_slot = fnMat.create_texture(self.textureTable[i.texture]) File "D:\Program Files\Blender Foundation\Blender 4.0\4.0\scripts\addons\mmd_tools\core\material.py", line 420, in create_texture texture = self.create_texture_node('mmd_base_tex', filepath, (-4, -1)) File "D:\Program Files\Blender Foundation\Blender 4.0\4.0\scripts\addons\mmd_tools\core\material.py", line 508, in create_texture_node self.update_shader_nodes() File "D:\Program Files\Blender Foundation\Blender 4.0\4.0\scripts\addons\mmd_tools\core\material.py", line 666, in update_shader_nodes if not node_shader.outputs['Shader'].is_linked: KeyError: 'bpy_prop_collection[key]: key "Shader" not found'

My Blend Version:4.0.1 mmd tools: using the lastest code in dev_testbranch

nagadomi commented 7 months ago

https://github.com/UuuNyaa/blender_mmd_tools/issues/116

xiaomaofeng commented 7 months ago

in the dev_test branch the code already has commited, but i still get this error, maybe other problem? or i mush to install other version with blend? `

def __update_shader_input(self, name, val):
    mat = self.material
    if mat.name.startswith('mmd_'): # skip mmd_edge.*
        return
    self.__update_shader_nodes()
    shader = mat.node_tree.nodes.get('mmd_shader', None)
    if shader and name in shader.inputs:
        if hasattr(shader, 'node_tree'):
            input_socket = shader.node_tree.inputs[name]
            if hasattr(input_socket, 'min_value'):
                val = min(max(val, input_socket.min_value), input_socket.max_value)
        shader.inputs[name].default_value = val`

thanks to replay

xiaomaofeng commented 7 months ago

in the dev_test branch the code already has commited, but i still get this error, maybe other problem? or i mush to install other version with blend? `

def __update_shader_input(self, name, val):
    mat = self.material
    if mat.name.startswith('mmd_'): # skip mmd_edge.*
        return
    self.__update_shader_nodes()
    shader = mat.node_tree.nodes.get('mmd_shader', None)
    if shader and name in shader.inputs:
        if hasattr(shader, 'node_tree'):
            input_socket = shader.node_tree.inputs[name]
            if hasattr(input_socket, 'min_value'):
                val = min(max(val, input_socket.min_value), input_socket.max_value)
        shader.inputs[name].default_value = val`

thanks to replay

i only modify the material.py in the location of blender addons, and reopen blender, but nothing happened. still get suck, i'm so sorry to bother you

nagadomi commented 7 months ago

currently, mmd_tools is developed in another repository linked above. only blender-v4 branch is compatible for Blender 4.0.

xiaomaofeng commented 7 months ago

thanks, i had to reinstall blender 3.6 lts, mmd tools work fine.