geometry-script icon indicating copy to clipboard operation
geometry-script copied to clipboard

Does not work for me on Blender 3.6

Open rsaccon opened this issue 1 year ago • 7 comments

I just installed the addon from your latest zip, copy pasted the Repeat Grid example into the Blender Text Editor and tried to run it. Unfortunately I got an error:

Error: Python: Traceback (most recent call last):
  File "/Repeat Grid.py", line 5, in <module>
  File "/Users/robertosaccon/Library/Application Support/Blender/3.6/scripts/addons/geometry-script-main/api/tree.py", line 41, in build_tree
    node_group.is_modifier = True
AttributeError: 'GeometryNodeTree' object has no attribute 'is_modifier'

did I do anything wrong ?

update: tried the other examples, same error.

rsaccon avatar Nov 12 '23 22:11 rsaccon

The latest merge has breaking changes due to moving from Blender 3.6 -> 4.0. For Blender 3.6 you can download the previous version.

alphadito avatar Nov 13 '23 02:11 alphadito

We should probably add version checks for 4.0 specific changes

carson-katri avatar Nov 13 '23 03:11 carson-katri

Thanks a lot, the previous version works perfectly. Now I am gonna deep dive into it. Yeah, version checks would be great, I anticipate more people like me have to stick to Blender 3.6 for now (I have a 2013 Macbook Pro, where Blender >= 4.0 does not run anymore).

rsaccon avatar Nov 13 '23 09:11 rsaccon

@carson-katri Hmm... how about something like this in tree.py?

def check_version(min_major, min_minor, min_patch):
    major, minor, patch = bpy.app.version
    if (major, minor, patch) < (min_major, min_minor, min_patch):
        raise Exception(f"Your Blender version {major}.{minor}.{patch} is not compatible. "
                        f"Geometry Script now requires at least Blender {min_major}.{min_minor}.{min_patch}. "
                        f"Please update Blender or install a previous version of Geometry Script.")

def tree(name):
    check_version(4, 0, 0)
    ...
    def build_tree(builder):
        ...

alphadito avatar Nov 13 '23 18:11 alphadito

@alphadito I meant backwards compatibility, so we could switch back to the 3.x method as needed. This means we could still fix bugs or provide new API for older versions.

Could optionally create custom abstractions that expose a unified API for all versions.

carson-katri avatar Nov 13 '23 18:11 carson-katri

@carson-katri Ah yep I initially tried to do a bit of monkey patching for backwards compatibility but the bpy.types.GeometryNodeTree class appears to have a read only __ slots __ attribute defined so you can't just mutate the blender 3.6 object to have 4.0 attribute names.

Perhaps we could make a wrapper class?

class NodeGroupWrapper:
    def __init__(self,nodegroup,version):
        self.nodegroup = nodegroup
        self.version = version 
    @property
    def inputs(self):
        if self.version[0] < 4:
            return self.nodegroup.inputs
        else:
            return [i for i in self.nodegroup.interface.items_tree if i.item_type == 'SOCKET' and i.in_out == 'INPUT'] 

alphadito avatar Nov 13 '23 19:11 alphadito

Could we have different documentation for each of the blender versions? Because many things there aren't working in the current version of blender. For example, I didn't manage to return multiple values on the node tree unless I use the yield keyword. In the current documentation it says that I should be able to use a dictionary, but it won't work

MadMaia3D avatar Feb 23 '24 02:02 MadMaia3D