def sv_post_load(scene): """ Upgrade nodes, apply preferences and do an update. """ for monad in (ng for ng in bpy.data.node_groups if ng.bl_idname == 'SverchGroupTreeType'): if monad.input_node and monad.output_node: monad.update_cls() else: upgrade_group.upgrade_group(monad) sv_types = {'SverchCustomTreeType', 'SverchGroupTreeType'} sv_trees = list(ng for ng in bpy.data.node_groups if ng.bl_idname in sv_types and ng.nodes) for ng in sv_trees: ng.freeze(True) try: old_nodes.load_old(ng) except: traceback.print_exc() ng.freeze(True) try: upgrade_nodes.upgrade_nodes(ng) except: traceback.print_exc() ng.unfreeze(True) addon_name = data_structure.SVERCHOK_NAME addon = bpy.context.user_preferences.addons.get(addon_name) if addon and hasattr(addon, "preferences"): pref = addon.preferences if pref.apply_theme_on_open: color_def.apply_theme() ''' unsafe_nodes = { 'SvScriptNode', 'FormulaNode', 'Formula2Node', 'EvalKnievalNode', } unsafe = False for tree in sv_trees: if any((n.bl_idname in unsafe_nodes for n in tree.nodes)): unsafe = True break # do nothing with this for now #if unsafe: # print("unsafe nodes found") #else: # print("safe") #print("post load .update()") # do an update ''' for ng in sv_trees: if ng.bl_idname == 'SverchCustomTreeType' and ng.nodes: ng.update()
def test_profile_export(self): try: upgrade_nodes.upgrade_nodes(self.tree) except: traceback.print_exc() export_result = create_dict_of_tree(self.tree) # self.store_reference_json("profile.json", export_result) self.assert_json_equals_file(export_result, "profile.json")
def test_profile_export(self): try: upgrade_nodes.upgrade_nodes(self.tree) except: traceback.print_exc() export_result = JSONExporter.get_tree_structure(self.tree) importer = JSONImporter(export_result) importer.import_into_tree(self.tree, print_log=False) if importer.has_fails: raise (ImportError(importer.fail_massage))
def sv_post_load(scene): """ Upgrade nodes, apply preferences and do an update. """ set_first_run(False) # ensure current nodeview view scale / location parameters reflect users' system settings from sverchok import node_tree node_tree.SverchCustomTreeNode.get_and_set_gl_scale_info( None, "sv_post_load") for monad in (ng for ng in bpy.data.node_groups if ng.bl_idname == 'SverchGroupTreeType'): if monad.input_node and monad.output_node: monad.update_cls() sv_types = {'SverchCustomTreeType', 'SverchGroupTreeType'} sv_trees = list(ng for ng in bpy.data.node_groups if ng.bl_idname in sv_types and ng.nodes) for ng in sv_trees: ng.freeze(True) ng.sv_process = False try: old_nodes.load_old(ng) except: traceback.print_exc() try: dummy_nodes.load_dummy(ng) except: traceback.print_exc() ng.freeze(True) try: upgrade_nodes.upgrade_nodes(ng) except: traceback.print_exc() ng.unfreeze(True) ng.sv_process = True addon_name = data_structure.SVERCHOK_NAME addon = bpy.context.preferences.addons.get(addon_name) if addon and hasattr(addon, "preferences"): pref = addon.preferences if pref.apply_theme_on_open: color_def.apply_theme() for ng in sv_trees: if ng.bl_idname == 'SverchCustomTreeType' and ng.nodes: ng.update()
def sv_post_load(scene): """ Upgrade nodes, apply preferences and do an update. """ for monad in (ng for ng in bpy.data.node_groups if ng.bl_idname == 'SverchGroupTreeType'): if monad.input_node and monad.output_node: monad.update_cls() else: upgrade_group.upgrade_group(monad) sv_types = {'SverchCustomTreeType', 'SverchGroupTreeType'} sv_trees = list(ng for ng in bpy.data.node_groups if ng.bl_idname in sv_types and ng.nodes) for ng in sv_trees: ng.freeze(True) try: old_nodes.load_old(ng) except: traceback.print_exc() ng.freeze(True) try: upgrade_nodes.upgrade_nodes(ng) except: traceback.print_exc() ng.unfreeze(True) addon_name = data_structure.SVERCHOK_NAME addon = bpy.context.preferences.addons.get(addon_name) if addon and hasattr(addon, "preferences"): pref = addon.preferences if pref.apply_theme_on_open: color_def.apply_theme() for ng in sv_trees: if ng.bl_idname == 'SverchCustomTreeType' and ng.nodes: ng.update()