diff --git a/utils/sv_IO_panel_tools.py b/utils/sv_IO_panel_tools.py index cf6724e5644d5cca31a43c7e6c04dbd6ae9408a2..63445e924afc235d026b07a27de65eefbfb03d62 100644 --- a/utils/sv_IO_panel_tools.py +++ b/utils/sv_IO_panel_tools.py @@ -31,6 +31,7 @@ from sverchok import old_nodes from sverchok.utils.sv_IO_monad_helpers import pack_monad, unpack_monad from sverchok.utils.logging import debug, info, warning, error, exception from sverchok.utils.sv_requests import urlopen +from sverchok.utils.sv_node_utils import absolute_location_generic # pylint: disable=w0621 @@ -141,11 +142,7 @@ def get_superficial_props(node_dict, node): node_dict['width'] = node.width node_dict['label'] = node.label node_dict['hide'] = node.hide - - if hasattr(node, 'absolute_location'): - node_dict['location'] = node.absolute_location - else: - node_dict['location'] = node.location[:] + node_dict['location'] = absolute_location_generic(node) if node.use_custom_color: node_dict['color'] = node.color[:] @@ -167,9 +164,9 @@ def collect_custom_socket_properties(node, node_dict): continue value = getattr(socket, tracked_prop_name) - defaultValue = socket.bl_rna.properties[tracked_prop_name].default + default_value = socket.bl_rna.properties[tracked_prop_name].default # property value same as default ? => don't store it - if value == defaultValue: + if value == default_value: continue # print("Processing custom property: ", tracked_prop_name, " value = ", value) diff --git a/utils/sv_node_utils.py b/utils/sv_node_utils.py index da6383de176543e656a45610cb7e448563f4b33b..73b1f4a6ea4a8d4fa0ab6e17314e37fcfb38f393 100644 --- a/utils/sv_node_utils.py +++ b/utils/sv_node_utils.py @@ -24,6 +24,16 @@ def frame_adjust(caller_node, new_node): locx, locy = recursive_framed_location_finder(new_node, loc_xy) new_node.location = locx, locy +def absolute_location_generic(node): + """ + all nodes of type Sverchok Custom will have the absolute_location attribute, + but some nodes (at the moment only ReRoute) are "part of the pynodes API" and can not + be augmented, so this function will return the appropriate location for all nodes + """ + if hasattr(node, 'absolute_location'): + return node.absolute_location + return recursive_framed_location_finder(node, node.location[:]) + def scaled_dpi(): """