def cache_node_categories(): ''' Cache category names, nodes and enum items ''' if _all_categories: return node_categories = make_node_cats() categories = node_categories.keys() _all_categories["categories"] = {} _all_categories["categories"]["names"] = list(categories) _all_categories["categories"]["names"].append("All") _all_categories["categories"]["All"] = {} _all_categories["categories"]["All"]["nodes"] = [] for category in categories: # print("adding category: ", category) nodes = [n for l in node_categories[category] for n in l] _all_categories["categories"][category] = {} _all_categories["categories"][category]["nodes"] = nodes _all_categories["categories"]["All"]["nodes"].extend(nodes) categoryItems = [] categoryItems.append(("All", "All", "", 0)) for i, category in enumerate(categories): categoryItem = (category, category.title(), "", i + 1) categoryItems.append(categoryItem) _all_categories["categories"]["items"] = categoryItems
def sv_colors_definition(): addon_name = sverchok.__name__ addon = bpy.context.user_preferences.addons.get(addon_name) if addon: prefs = addon.preferences sv_node_colors = { "Viz": prefs.color_viz, "Text": prefs.color_tex, "Scene": prefs.color_sce, "Layout": prefs.color_lay, "Generators": prefs.color_gen, } else: sv_node_colors = default_theme sv_node_cats = make_node_cats() sv_cats_node = {} for ca, no in sv_node_cats.items(): for n in no: try: sv_cats_node[n[0]] = sv_node_colors[ca] except: sv_cats_node[n[0]] = False return sv_cats_node
import os import importlib.util as getutil import bpy import sverchok import nodeitems_utils from sverchok.menu import make_node_cats from sverchok.ui.sv_icons import custom_icon from sverchok.utils.sv_default_macros import macros, DefaultMacros from nodeitems_utils import _node_categories # pylint: disable=c0326 sv_tree_types = {'SverchCustomTreeType', 'SverchGroupTreeType'} node_cats = make_node_cats() addon_name = sverchok.__name__ loop = {} loop_reverse = {} local_macros = {} ddir = lambda content: [n for n in dir(content) if not n.startswith('__')] def format_item(k, v): return k + " | " + v['display_name'] def format_macro_item(k, v): return '< ' + k.replace('_', ' ') + " | " + slice_docstring(v) def slice_docstring(desc):
zeffii 2014. borrows heavily from insights provided by Dynamic Space Bar! but massively condensed for sanity. ''' import bpy from sverchok.menu import make_node_cats, draw_add_node_operator from sverchok.utils import get_node_class_reference from sverchok.ui.sv_icons import node_icon, icon, get_icon_switch, custom_icon from sverchok.ui import presets # from nodeitems_utils import _node_categories sv_tree_types = {'SverchCustomTreeType', 'SverchGroupTreeType'} node_cats = make_node_cats() #menu_prefs = {} # _items_to_remove = {} def layout_draw_categories(layout, node_details): for node_info in node_details: if node_info[0] == 'separator': layout.separator() continue if not node_info: print(repr(node_info), 'is incomplete, or unparsable')