Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
xiaomaofeng opened this issue Nov 30, 2023 · 5 comments

Comments

@xiaomaofeng
Copy link

xiaomaofeng commented Nov 30, 2023

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
Copy link
Collaborator

UuuNyaa#116

@xiaomaofeng
Copy link
Author

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
Copy link
Author

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
Copy link
Collaborator

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

@xiaomaofeng
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants