sverchok icon indicating copy to clipboard operation
sverchok copied to clipboard

Topologic is no longer compatible with new version of Sverchok

Open wassimj opened this issue 2 years ago • 15 comments

Problem statement

Topologic is no longer compatible with new version of sverchok. What has changed? I am getting the following error:

from sverchok.core.socket_data import SvGetSocketInfo
ImportError: cannot import name 'SvGetSocketInfo' from 'sverchok.core.socket_data' (/home/sinasta/.config/blender/3.3/scripts/addons/sverchok-master/core/socket_data.py)

Any help on what I need to change in my code to make it compatible with the new version of sverchok?

Steps to reproduce

  1. Install sverchok
  2. Install Topologic
  3. Try to activate Topologic

Expected result

Topologic activated

Actual result

from sverchok.core.socket_data import SvGetSocketInfo ImportError: cannot import name 'SvGetSocketInfo' from 'sverchok.core.socket_data' (/home/sinasta/.config/blender/3.3/scripts/addons/sverchok-master/core/socket_data.py)

Sverchok version

1.1.0 but it seems sverchok versions are not updated correctly with new releases.

This is especially important for installation-related issues. Please specify how do you install Sverchok: from sverchok-master.zip from github, or from release zip file, or from cloned git repo.

wassimj avatar Jun 12 '22 12:06 wassimj

use socket.objects_number instead

   layout.label(text=(self.label or text) + f". {self.objects_number or ''}")

zeffii avatar Jun 12 '22 12:06 zeffii

Thank you, but now I am getting another error:

Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\BlenderFoundation.Blender_3.2.0.0_x64__ppwjx1n5r4v9t\Blender\3.2\scripts\modules\addon_utils.py", line 335, in enable
    mod = __import__(module_name)
  File "C:\Users\wassi\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\topologicsverchok\__init__.py", line 442, in <module>
    imported_modules = make_node_list()
  File "C:\Users\wassi\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\topologicsverchok\__init__.py", line 437, in make_node_list
    module = importlib.import_module(f".{module_name}", base_name)
  File "C:\Program Files\WindowsApps\BlenderFoundation.Blender_3.2.0.0_x64__ppwjx1n5r4v9t\Blender\3.2\python\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "C:\Users\wassi\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\topologicsverchok\nodes\Topologic\Run.py", line 5, in <module>
    from sverchok.core.update_system import make_tree_from_nodes, do_update
ImportError: cannot import name 'make_tree_from_nodes' from 'sverchok.core.update_system' (C:\Users\wassi\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\sverchok-master\core\update_system.py)

wassimj avatar Jun 12 '22 13:06 wassimj

see some of the diff https://github.com/nortikin/sverchok/commit/d6aa48602d8cc06e3017e1b4c7fc12e0ac4be9dd#diff-8ef72808a2c9f6d5f29d22379c6b8e31d525bce292a8b5afff9ed6acfe4e1d7eR90-R94

zeffii avatar Jun 12 '22 13:06 zeffii

just out of interest, when was the last time you synchronized with sverchok master?

zeffii avatar Jun 12 '22 13:06 zeffii

The file I have is from 30/05/2022

wassimj avatar Jun 12 '22 13:06 wassimj

i'm trying to figure out when make_tree_from_nodes was removed

zeffii avatar Jun 12 '22 13:06 zeffii

This is the (old/offending) code. I think it was copied from the Evolver node. What should the code be if we are to use the newest version of sverchok to update the downstream tree of nodes? Thanks

def sv_execute(self, context, node):
		node.outputs['Status'].sv_set([True])
		tree = node.id_data
		update_list = make_tree_from_nodes([node.name], tree)
		do_update(update_list, tree.nodes)

wassimj avatar Jun 12 '22 13:06 wassimj

look at the updated evolver node https://github.com/nortikin/sverchok/blob/master/nodes/logic/evolver.py

zeffii avatar Jun 12 '22 13:06 zeffii

it looks like

-        update_list = make_tree_from_nodes([node.name], tree)
-        do_update(update_list, tree.nodes)
+        node.process_node(None)

zeffii avatar Jun 12 '22 13:06 zeffii

The changes were introduced by this PR #4323.

I think it is simpler to learn how to use new API of update system on Loop nodes. First block finds which nodes should be updated and sorts them in proper execution order. https://github.com/nortikin/sverchok/blob/6af8ca3047157e634de0b70202f158ea52d5a8aa/nodes/logic/loop_out.py#L284-L288

Try cache syntax is not nessasary here if it is appropriate to update all nodes in spite of whether there are nodes with errors or not. https://github.com/nortikin/sverchok/blob/6af8ca3047157e634de0b70202f158ea52d5a8aa/nodes/logic/loop_out.py#L309-L313

If this was not helpful you can show your current code I will help with how to fix it.

Durman avatar Jun 12 '22 16:06 Durman

this appears to be resolved :)

zeffii avatar Jun 17 '22 05:06 zeffii

I am getting an error: AttributeError: 'SverchCustomTree' object has no attribute 'nodes_from'

wassimj avatar Jul 03 '22 07:07 wassimj

@wassimj feel free to reopen these issues if i close them prematurely.

zeffii avatar Jul 13 '22 10:07 zeffii

maybe @Durman can confirm this, but this does appear to work - I don't know if it's the intended way to use it


from sverchok.core.update_system import SearchTree


(your node)


    (your function)

        stree = SearchTree(self.id_data)
        nodes = stree.nodes_from([self])   # see the definition of this function
        print(list(nodes))

zeffii avatar Jul 13 '22 10:07 zeffii

I think that update system module is internal to Sverchok's add-ons. It can be reused on your risk without any guarantees that it won't be broken in next releases.

What the Evolver and Loop nodes do is completely separate thing from update system. So if there is need for some stability of such nodes I can suggest to create your own independent execution system.

Durman avatar Jul 28 '22 07:07 Durman