Geonode Shape Keys does not work with Blender 4.0 #184

Closed
opened 2023-12-16 07:30:03 +01:00 by MidnightArrow · 3 comments

It appears the Geonode Shape Key addon has not been updated for Blender 4. In Blender v4.0.2 with GNSK v0.0.4, saving a file with a default cube and then linking the cube and attempting to add a shape key produces the following error message:

Python: Traceback (most recent call last):
  File "C:\Users\****************\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\geonode_shapekeys\operators.py", line 158, in execute
    mod.node_group = link_shape_key_node_tree(context)
  File "C:\Users\****************\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\geonode_shapekeys\operators.py", line 71, in link_shape_key_node_tree
    with bpy.data.libraries.load(blend_path, link=do_link, relative=True) as (data_from, data_to):
OSError: load: C:\. failed to open blend file

Changing the filepath in the preferences to point to the blend file included with the addon then produces this message:

Python: Traceback (most recent call last):
  File "C:\Users\****************\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\geonode_shapekeys\operators.py", line 169, in execute
    geomod_set_param_value(mod, 'Sculpt', sk_ob)
  File "C:\Users\****************\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\geonode_shapekeys\operators.py", line 20, in geomod_set_param_value
    input_id = geomod_get_identifier(modifier, param_name)
  File "C:\Users\****************\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\geonode_shapekeys\operators.py", line 11, in geomod_get_identifier
    input = modifier.node_group.inputs.get(param_name)
AttributeError: 'GeometryNodeTree' object has no attribute 'inputs'

I assume this is related to the recent refactoring of the API: https://wiki.blender.org/wiki/Reference/Release_Notes/4.0/Python_API#Node_Groups

Using the same file with Blender 3.6 works as expected.

It appears the Geonode Shape Key addon has not been updated for Blender 4. In Blender v4.0.2 with GNSK v0.0.4, saving a file with a default cube and then linking the cube and attempting to add a shape key produces the following error message: ``` Python: Traceback (most recent call last): File "C:\Users\****************\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\geonode_shapekeys\operators.py", line 158, in execute mod.node_group = link_shape_key_node_tree(context) File "C:\Users\****************\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\geonode_shapekeys\operators.py", line 71, in link_shape_key_node_tree with bpy.data.libraries.load(blend_path, link=do_link, relative=True) as (data_from, data_to): OSError: load: C:\. failed to open blend file ``` Changing the filepath in the preferences to point to the blend file included with the addon then produces this message: ``` Python: Traceback (most recent call last): File "C:\Users\****************\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\geonode_shapekeys\operators.py", line 169, in execute geomod_set_param_value(mod, 'Sculpt', sk_ob) File "C:\Users\****************\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\geonode_shapekeys\operators.py", line 20, in geomod_set_param_value input_id = geomod_get_identifier(modifier, param_name) File "C:\Users\****************\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\geonode_shapekeys\operators.py", line 11, in geomod_get_identifier input = modifier.node_group.inputs.get(param_name) AttributeError: 'GeometryNodeTree' object has no attribute 'inputs' ``` I assume this is related to the recent refactoring of the API: https://wiki.blender.org/wiki/Reference/Release_Notes/4.0/Python_API#Node_Groups Using the same file with Blender 3.6 works as expected.
Member

Hi,

Are you still having this issue? Also if the bug is related to a specific blender version please provide the hash for that version of blender from the About Blender pop-up.

Hi, Are you still having this issue? Also if the bug is related to a specific blender version please provide the hash for that version of blender from the [**About Blender**](https://docs.blender.org/manual/en/latest/interface/window_system/topbar.html#blender-menu) pop-up.
Nick Alberelli added the
Kind: Community
label 2024-02-01 16:39:46 +01:00
Author

No, because I fixed it myself.

Like I said, the script files need to be updated to account for the API changes in 4.0.

def geomod_get_identifier(modifier: bpy.types.Modifier, param_name: str) -> str:
    
    # 3.x
    # input = modifier.node_group.inputs.get(param_name)

    # 4.0
    input = modifier.node_group.interface.items_tree[param_name]

    if input:
        return input.identifier

I've already patched my own script files, and it's been over a month, so I don't remember what other corrections need to be made.

No, because I fixed it myself. Like I said, the script files need to be updated to account for the API changes in 4.0. ``` def geomod_get_identifier(modifier: bpy.types.Modifier, param_name: str) -> str: # 3.x # input = modifier.node_group.inputs.get(param_name) # 4.0 input = modifier.node_group.interface.items_tree[param_name] if input: return input.identifier ``` I've already patched my own script files, and it's been over a month, so I don't remember what other corrections need to be made.
Member

Hey there, thanks for the report, should be fixed now!

dbdf99cf92
67dd17a0fb

Hey there, thanks for the report, should be fixed now! https://projects.blender.org/studio/blender-studio-pipeline/commit/dbdf99cf92de96c3e1a719a0f3de684f630404d9 https://projects.blender.org/studio/blender-studio-pipeline/commit/67dd17a0fbf4c2c906e683ad73135308213738ef
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: studio/blender-studio-tools#184
No description provided.